Plugin Directory

Changeset 3356280


Ignore:
Timestamp:
09/04/2025 06:20:50 PM (6 months ago)
Author:
umbradev
Message:

System Update Exporter v1.0.1 - Removed logo option, minor fixes

Location:
system-update-exporter/trunk
Files:
40 added
13 edited

Legend:

Unmodified
Added
Removed
  • system-update-exporter/trunk/admin/settings.php

    r3326838 r3356280  
    2828}
    2929
    30 function systupex_sanitize_url( $input ) {
    31     return esc_url_raw( $input );
    32 }
    33 
    3430function systupex_sanitize_textarea( $input ) {
    3531    return sanitize_textarea_field( $input );
     
    5652    ) );
    5753   
    58     register_setting( 'systupex_settings_group', 'systupex_export_logo', array(
    59         'sanitize_callback' => __NAMESPACE__ . '\\systupex_sanitize_checkbox',
    60     ) );
    61    
    6254    register_setting( 'systupex_settings_group', 'systupex_export_summary', array(
    6355        'sanitize_callback' => __NAMESPACE__ . '\\systupex_sanitize_checkbox',
    64     ) );
    65    
    66     register_setting( 'systupex_settings_group', 'systupex_export_logo_url', array(
    67         'sanitize_callback' => __NAMESPACE__ . '\\systupex_sanitize_url',
    6856    ) );
    6957   
     
    8169        return;
    8270    }
    83     $roles = wp_roles()->roles;
    84     $show_logo    = get_option( 'systupex_export_logo', '0' );
     71    $roles        = wp_roles()->roles;
    8572    $show_summary = get_option( 'systupex_export_summary', '1' );
    8673    $allowed_roles = get_option( 'systupex_allowed_roles', [] );
     
    144131                    <th scope="row"><?php esc_html_e( 'Add more info to file', 'system-update-exporter' ); ?></th>
    145132                    <td id="composition-options">
    146                         <label class="format-word ">
    147                             <input type="checkbox" name="systupex_export_logo" value="1" <?php checked( $show_logo, '1' ); ?>>
    148                             <?php esc_html_e( 'Add logo', 'system-update-exporter' ); ?>
    149                         </label>
    150                         <div id="systupex_logo_upload_wrapper" style="margin-top: 10px; display: <?php echo esc_attr( $show_logo ? 'block' : 'none' ); ?>;">
    151                             <input type="hidden" name="systupex_export_logo_url" id="systupex_export_logo_url" value="<?php echo esc_attr( get_option('systupex_export_logo_url') ); ?>" />
    152                             <img id="systupex_logo_preview" src="<?php echo esc_attr( get_option('systupex_export_logo_url') ); ?>" style="max-width: 150px; display: <?php echo get_option('systupex_export_logo_url') ? 'block' : 'none'; ?>; margin-bottom: 10px;" />
    153                             <button type="button" class="button" id="systupex_logo_upload_button"><?php esc_html_e('Select image', 'system-update-exporter'); ?></button>
    154                         </div>
    155133                        <label class="format-csv format-excel format-word format-xml">
    156134                            <input type="checkbox" name="systupex_export_summary" value="1" <?php checked( $show_summary, '1' ); ?>>
     
    198176 */
    199177function systupex_save_roles_capabilities( $option ) {
    200     // Verificar permisos del usuario
    201178    if ( ! current_user_can( 'manage_options' ) ) {
    202179        wp_die( esc_html__( 'You are not allowed to perform this action.', 'system-update-exporter' ) );
    203180    }
    204181
    205     // Verificar que venimos del formulario correcto y nonce válido
    206182    if (
    207183        ! isset( $_POST['option_page'] ) || $_POST['option_page'] !== 'systupex_settings_group' ||
     
    240216}
    241217add_action( 'update_option_systupex_allowed_roles', __NAMESPACE__ . '\\systupex_save_roles_capabilities' );
    242 
    243 /**
    244  * Enqueue Admin Scripts
    245  */
    246 function systupex_enqueue_admin_scripts($hook) {
    247     if (strpos($hook, 'systupex-settings') !== false) {
    248         wp_enqueue_media();
    249     }
    250 }
    251 add_action('admin_enqueue_scripts', __NAMESPACE__ . '\\systupex_enqueue_admin_scripts');
  • system-update-exporter/trunk/assets/js/admin-scripts.js

    r3326838 r3356280  
    88
    99            tabs.forEach((t) => t.classList.remove("nav-tab-active"));
    10             contents.forEach((c) => c.style.display = "none");
    11 
     10            contents.forEach((c) => (c.style.display = "none"));
    1211
    1312            tab.classList.add("nav-tab-active");
     
    1817    });
    1918
    20     const formatSelect = document.getElementById('systupex_format_select');
    21     const compositionOptions = document.querySelectorAll('#composition-options label');
    22     const logoCheckbox = document.querySelector('input[name="systupex_export_logo"]');
    23     const logoWrapper = document.getElementById('systupex_logo_upload_wrapper');
    24     const uploadButton = document.getElementById('systupex_logo_upload_button');
    25     const logoInput = document.getElementById('systupex_export_logo_url');
    26     const logoPreview = document.getElementById('systupex_logo_preview');
     19    const formatSelect = document.getElementById("systupex_format_select");
     20    const compositionOptions = document.querySelectorAll("#composition-options label");
    2721
    2822    function toggleCompositionOptions() {
    29         const selectedFormat = formatSelect?.value || '';
    30         compositionOptions.forEach(label => {
    31             const shouldShow = label.classList.contains('format-' + selectedFormat);
    32             label.style.display = shouldShow ? 'block' : 'none';
     23        const selectedFormat = formatSelect?.value || "";
     24        compositionOptions.forEach((label) => {
     25            const shouldShow = label.classList.contains("format-" + selectedFormat);
     26            label.style.display = shouldShow ? "block" : "none";
    3327        });
    34         if (logoCheckbox && logoWrapper) {
    35             logoWrapper.style.display = (logoCheckbox.checked && selectedFormat === 'word') ? 'block' : 'none';
    36         }
    3728    }
    3829
    3930    if (formatSelect) {
    40         formatSelect.addEventListener('change', toggleCompositionOptions);
    41     }
    42     if (logoCheckbox) {
    43         logoCheckbox.addEventListener('change', toggleCompositionOptions);
     31        formatSelect.addEventListener("change", toggleCompositionOptions);
    4432    }
    4533    toggleCompositionOptions();
    46 
    47     if (uploadButton) {
    48         uploadButton.addEventListener('click', function (e) {
    49             e.preventDefault();
    50             const mediaUploader = wp.media({
    51                 title: systupex_vars.selectLogoText,
    52                 button: {
    53                     text: systupex_vars.useImageText
    54                 },
    55                 multiple: false
    56             });
    57             mediaUploader.on('select', function () {
    58                 const attachment = mediaUploader.state().get('selection').first().toJSON();
    59                 logoInput.value = attachment.url;
    60                 logoPreview.src = attachment.url;
    61                 logoPreview.style.display = 'block';
    62             });
    63             mediaUploader.open();
    64         });
    65     }
    6634
    6735    const toggleEditor = (checkboxSelector, wrapperId) => {
     
    7038        if (checkbox && wrapper) {
    7139            const toggle = () => {
    72                 wrapper.style.display = checkbox.checked ? 'block' : 'none';
     40                wrapper.style.display = checkbox.checked ? "block" : "none";
    7341            };
    74             checkbox.addEventListener('change', toggle);
     42            checkbox.addEventListener("change", toggle);
    7543            toggle();
    7644        }
    7745    };
    7846
    79     toggleEditor('input[name="systupex_export_summary"]', 'systupex_summary_editor_wrapper');
     47    toggleEditor(
     48        'input[name="systupex_export_summary"]',
     49        "systupex_summary_editor_wrapper"
     50    );
    8051});
  • system-update-exporter/trunk/includes/Export.php

    r3326838 r3356280  
    9292
    9393        header('Content-Type: text/csv');
    94         header('Content-Disposition: attachment; filename="systupex.csv"');
     94        header('Content-Disposition: attachment; filename="WordPress Updates WordPress Updates Report.csv"');
    9595        header('Content-Length: ' . strlen($contents));
    9696
     
    104104        $summary_text = wp_kses_post(get_option('systupex_export_summary_text', ''));
    105105        $data = [];
    106 
     106        $data[] = [wp_strip_all_tags('WordPress Updates Report', ['bold' => true, 'name' => 'Poppins', 'size' => 16])];
     107        $data[] = [''];
    107108        if (get_option('systupex_export_summary') && !empty($summary_text)) {
    108109            $data[] = [wp_strip_all_tags($summary_text)];
     
    138139
    139140        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    140         header('Content-Disposition: attachment; filename="systupex.xlsx"');
     141        header('Content-Disposition: attachment; filename="WordPress Updates Report.xlsx"');
    141142        header('Pragma: no-cache');
    142143        header('Expires: 0');
    143144
    144         $xlsx->downloadAs('systupex.xlsx');
     145        $xlsx->downloadAs('WordPress Updates Report.xlsx');
    145146        exit;
    146147    }
     
    152153
    153154        $summary_text = wp_kses_post(get_option('systupex_export_summary_text', ''));
    154         $logo_url = wp_kses_post(get_option('systupex_export_logo_url'));
    155 
    156         if (!empty($logo_url)) {
    157             $tmp_path = download_url($logo_url);
    158             if (!is_wp_error($tmp_path)) {
    159                 $section->addImage($tmp_path, ['width' => 200, 'height' => 100, 'alignment' => Jc::CENTER]);
    160                 $section->addTextBreak(1);
    161 
    162                 wp_delete_file($tmp_path);
    163             }
    164         }
     155        $section->addText('WordPress Updates Report', ['bold' => true, 'name' => 'Poppins', 'size' => 16]);
     156        $section->addTextBreak(1);
    165157
    166158        if (!empty($summary_text)) {
     
    168160            $section->addTextBreak(1);
    169161        }
    170 
    171         $section->addText('WordPress Updates Report', ['bold' => true, 'name' => 'Poppins', 'size' => 16]);
    172         $section->addTextBreak(1);
    173162
    174163        $table = $section->addTable();
     
    200189        }
    201190
    202         $temp_file = tempnam(sys_get_temp_dir(), 'systupex') . '.docx';
     191        $temp_file = tempnam(sys_get_temp_dir(), 'report') . '.docx';
    203192        $phpWord->save($temp_file, 'Word2007');
    204193        $content = file_get_contents($temp_file);
     
    208197        header('Content-Description: File Transfer');
    209198        header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
    210         header('Content-Disposition: attachment; filename="systupex.docx"');
     199        header('Content-Disposition: attachment; filename="WordPress Updates Report.docx"');
    211200        header('Content-Transfer-Encoding: binary');
    212201        header('Content-Length: ' . strlen($content));
     
    251240
    252241        header('Content-Type: application/xml');
    253         header('Content-Disposition: attachment; filename="systupex.xml"');
     242        header('Content-Disposition: attachment; filename="WordPress Updates Report.xml"');
    254243        header('Content-Length: ' . strlen($xml->asXML()));
    255244
  • system-update-exporter/trunk/includes/SystemStatus.php

    r3326838 r3356280  
    205205            return;
    206206        }
    207         if ( class_exists( 'Memcached' ) ) {
    208             $mem = new Memcached();
    209             $stats = $mem->getStats();
    210             if ( ! empty( $stats ) ) {
    211                 echo '<h3>' . esc_html__( 'Memcached Statistics', 'system-update-exporter' ) . '</h3>';
    212                 echo '<table class="widefat striped"><tbody>';
    213                 foreach ( $stats as $server => $data ) {
    214                     // translators: %s is the name or address of the Memcached server.
    215                     echo '<tr><td colspan="2"><strong>' . sprintf( esc_html__( 'Server: %s', 'system-update-exporter' ), esc_html( $server ) ) . '</strong></td></tr>';
    216                     foreach ( $data as $key => $val ) {
    217                         echo '<tr><td>' . esc_html( $key ) . '</td><td>' . esc_html( $val ) . '</td></tr>';
     207        if ( class_exists('Memcached') ) {
     208            try {
     209                $mem = new \Memcached();
     210                $mem->addServer('127.0.0.1', 11211);
     211                $stats = $mem->getStats();
     212               
     213                if (!empty($stats)) {
     214                    echo '<h3>Memcached Statistics</h3><table class="widefat striped"><tbody>';
     215                    foreach ($stats as $server => $data) {
     216                        echo '<tr><td colspan="2"><strong>Server: ' . esc_html($server) . '</strong></td></tr>';
     217                        foreach ($data as $key => $val) {
     218                            echo '<tr><td>' . esc_html($key) . '</td><td>' . esc_html($val) . '</td></tr>';
     219                        }
    218220                    }
     221                    echo '</tbody></table>';
     222                } else {
     223                    echo '<p>No Memcached statistics found.</p>';
    219224                }
    220                 echo '</tbody></table>';
    221             } else {
    222                 echo '<p>' . esc_html__( 'No Memcached statistics found.', 'system-update-exporter' ) . '</p>';
     225            } catch (\Exception $e) {
     226                echo '<p>Memcached error: ' . esc_html($e->getMessage()) . '</p>';
    223227            }
    224228        } else {
    225             echo '<p>' . esc_html__( 'The Memcached extension is not installed or enabled.', 'system-update-exporter' ) . '</p>';
     229            echo '<p>The Memcached extension is not installed or enabled.</p>';
    226230        }
    227231    }
  • system-update-exporter/trunk/languages/system-update-exporter-de_DE.po

    r3326838 r3356280  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: System Update Exporter 1.0.0\n"
     5"Project-Id-Version: System Update Exporter 1.0.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n"
    77"Last-Translator: Umbradev <[email protected]>\n"
     
    188188msgstr "Weitere Informationen zur Datei hinzufügen"
    189189
    190 #: admin/settings.php:125
    191 msgid "Add logo"
    192 msgstr "Logo hinzufügen"
    193 
    194190#: admin/settings.php:130
    195191msgid "Select image"
  • system-update-exporter/trunk/languages/system-update-exporter-en_US.po

    r3326838 r3356280  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: System Update Exporter 1.0.0\n"
     5"Project-Id-Version: System Update Exporter 1.0.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n"
    77"Last-Translator: Umbradev <[email protected]>\n"
     
    189189msgstr "Add more info to file"
    190190
    191 #: admin/settings.php:125
    192 msgid "Add logo"
    193 msgstr "Add logo"
    194 
    195191#: admin/settings.php:130
    196192msgid "Select image"
  • system-update-exporter/trunk/languages/system-update-exporter-es_ES.po

    r3326838 r3356280  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: System Update Exporter 1.0.0\n"
     5"Project-Id-Version: System Update Exporter 1.0.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n"
    77"Last-Translator: Umbradev <[email protected]>\n"
     
    189189msgstr "Agregar más información al archivo"
    190190
    191 #: admin/settings.php:125
    192 msgid "Add logo"
    193 msgstr "Agregar logo"
    194 
    195 #: admin/settings.php:130
    196 msgid "Select image"
    197 msgstr "Seleccionar imagen"
    198 
    199191#: admin/settings.php:134
    200192msgid "Resume text"
  • system-update-exporter/trunk/languages/system-update-exporter-fr_FR.po

    r3326838 r3356280  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: System Update Exporter 1.0.0\n"
     5"Project-Id-Version: System Update Exporter 1.0.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n"
    77"Last-Translator: Umbradev <[email protected]>\n"
     
    189189msgstr "Ajouter plus d'infos au fichier"
    190190
    191 #: admin/settings.php:125
    192 msgid "Add logo"
    193 msgstr "Ajouter un logo"
    194 
    195 #: admin/settings.php:130
    196 msgid "Select image"
    197 msgstr "Sélectionner une image"
    198 
    199191#: admin/settings.php:134
    200192msgid "Resume text"
  • system-update-exporter/trunk/languages/system-update-exporter-it_IT.po

    r3326838 r3356280  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: System Update Exporter 1.0.0\n"
     5"Project-Id-Version: System Update Exporter 1.0.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n"
    77"Last-Translator: Umbradev <[email protected]>\n"
     
    188188msgstr "Aggiungi più informazioni al file"
    189189
    190 #: admin/settings.php:125
    191 msgid "Add logo"
    192 msgstr "Aggiungi logo"
    193 
    194 #: admin/settings.php:130
    195 msgid "Select image"
    196 msgstr "Seleziona immagine"
    197 
    198190#: admin/settings.php:134
    199191msgid "Resume text"
  • system-update-exporter/trunk/languages/system-update-exporter.pot

    r3326838 r3356280  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: System Update Exporter 1.0.0\n"
     5"Project-Id-Version: System Update Exporter 1.0.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n"
    77"Last-Translator: Umbradev <[email protected]>\n"
     
    201201msgstr ""
    202202
    203 #: admin/settings.php:125
    204 msgid "Add logo"
    205 msgstr ""
    206 
    207 #: admin/settings.php:130
    208 msgid "Select image"
    209 msgstr ""
    210 
    211203#: admin/settings.php:134
    212204msgid "Resume text"
  • system-update-exporter/trunk/readme.txt

    r3326968 r3356280  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    7070* System status feature.
    7171
     72= 1.0.1 =
     73* Removed the option to add a logo in Word exports.
     74* Improved export to Word: now only summary text is included if set.
     75* Minor code cleanup and removed unused logo-related settings.
     76
    7277== Credits ==
    7378Developed by Umbradev (https://umbradev.es).
  • system-update-exporter/trunk/system-update-exporter.php

    r3326838 r3356280  
    44 * Plugin URI: https://wordpress.org/plugins/system-update-exporter/
    55 * Description: A plugin to retrieve and export system information and pending updates for WordPress, plugins, and themes.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: Umbradev
    88 * Author URI: https://umbradev.es
     
    2020}
    2121
    22 define( 'SYSTUPEX_VERSION', '1.0.0' );
     22define( 'SYSTUPEX_VERSION', '1.0.1' );
    2323define( 'SYSTUPEX_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    2424define( 'SYSTUPEX_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     
    5050            SYSTUPEX_VERSION,
    5151            true
    52         );
    53         wp_localize_script(
    54             'systupex-admin-scripts',
    55             'systupex_vars',
    56             [
    57                 'selectLogoText' => __( 'Select Logo', 'system-update-exporter' ),
    58                 'useImageText'   => __( 'Use This Image', 'system-update-exporter' ),
    59             ]
    6052        );
    6153    }
  • system-update-exporter/trunk/uninstall.php

    r3326838 r3356280  
    2222    'systupex_export_header',
    2323    'systupex_export_header_text',
    24     'systupex_export_logo',
    25     'systupex_export_logo_url',
    2624    'systupex_export_summary',
    2725    'systupex_export_summary_text',
Note: See TracChangeset for help on using the changeset viewer.