Changeset 3356280
- Timestamp:
- 09/04/2025 06:20:50 PM (6 months ago)
- Location:
- system-update-exporter/trunk
- Files:
-
- 40 added
- 13 edited
-
.distignore (added)
-
.gitignore (added)
-
admin/settings.php (modified) (6 diffs)
-
assets/js/admin-scripts.js (modified) (3 diffs)
-
composer.json (added)
-
composer.lock (added)
-
includes/Export.php (modified) (8 diffs)
-
includes/SystemStatus.php (modified) (1 diff)
-
languages/system-update-exporter-de_DE.po (modified) (2 diffs)
-
languages/system-update-exporter-en_US.po (modified) (2 diffs)
-
languages/system-update-exporter-es_ES.po (modified) (2 diffs)
-
languages/system-update-exporter-fr_FR.po (modified) (2 diffs)
-
languages/system-update-exporter-it_IT.po (modified) (2 diffs)
-
languages/system-update-exporter.pot (modified) (2 diffs)
-
phpunit.xml (added)
-
readme.txt (modified) (2 diffs)
-
system-update-exporter.php (modified) (3 diffs)
-
tests (added)
-
tests/bootstrap.php (added)
-
tests/test-plugin.php (added)
-
uninstall.php (modified) (1 diff)
-
vendor/phpoffice/math/.gitignore (added)
-
vendor/phpoffice/math/composer.json (added)
-
vendor/phpoffice/math/tests (added)
-
vendor/phpoffice/math/tests/Math (added)
-
vendor/phpoffice/math/tests/Math/Element (added)
-
vendor/phpoffice/math/tests/Math/Element/AbstractGroupElementTest.php (added)
-
vendor/phpoffice/math/tests/Math/Element/FractionTest.php (added)
-
vendor/phpoffice/math/tests/Math/Element/IdentifierTest.php (added)
-
vendor/phpoffice/math/tests/Math/Element/NumericTest.php (added)
-
vendor/phpoffice/math/tests/Math/Element/OperatorTest.php (added)
-
vendor/phpoffice/math/tests/Math/Element/SemanticsTest.php (added)
-
vendor/phpoffice/math/tests/Math/Element/SuperscriptTest.php (added)
-
vendor/phpoffice/math/tests/Math/Reader (added)
-
vendor/phpoffice/math/tests/Math/Reader/MathMLTest.php (added)
-
vendor/phpoffice/math/tests/Math/Reader/OfficeMathMLTest.php (added)
-
vendor/phpoffice/math/tests/Math/Writer (added)
-
vendor/phpoffice/math/tests/Math/Writer/MathMLTest.php (added)
-
vendor/phpoffice/math/tests/Math/Writer/OfficeMathMLTest.php (added)
-
vendor/phpoffice/math/tests/Math/Writer/WriterTestCase.php (added)
-
vendor/phpoffice/math/tests/resources (added)
-
vendor/phpoffice/math/tests/resources/schema (added)
-
vendor/phpoffice/math/tests/resources/schema/mathml3 (added)
-
vendor/phpoffice/math/tests/resources/schema/mathml3/mathml3-common.xsd (added)
-
vendor/phpoffice/math/tests/resources/schema/mathml3/mathml3-content.xsd (added)
-
vendor/phpoffice/math/tests/resources/schema/mathml3/mathml3-presentation.xsd (added)
-
vendor/phpoffice/math/tests/resources/schema/mathml3/mathml3-strict-content.xsd (added)
-
vendor/phpoffice/math/tests/resources/schema/mathml3/mathml3.xsd (added)
-
vendor/phpoffice/phpword/composer.json (added)
-
vendor/shuchkin/simplexlsxgen/.gitignore (added)
-
vendor/shuchkin/simplexlsxgen/composer.json (added)
-
vendor/shuchkin/simplexlsxgen/composer.lock (added)
-
vendor/shuchkin/simplexlsxgen/examples/.gitignore (added)
Legend:
- Unmodified
- Added
- Removed
-
system-update-exporter/trunk/admin/settings.php
r3326838 r3356280 28 28 } 29 29 30 function systupex_sanitize_url( $input ) {31 return esc_url_raw( $input );32 }33 34 30 function systupex_sanitize_textarea( $input ) { 35 31 return sanitize_textarea_field( $input ); … … 56 52 ) ); 57 53 58 register_setting( 'systupex_settings_group', 'systupex_export_logo', array(59 'sanitize_callback' => __NAMESPACE__ . '\\systupex_sanitize_checkbox',60 ) );61 62 54 register_setting( 'systupex_settings_group', 'systupex_export_summary', array( 63 55 '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',68 56 ) ); 69 57 … … 81 69 return; 82 70 } 83 $roles = wp_roles()->roles; 84 $show_logo = get_option( 'systupex_export_logo', '0' ); 71 $roles = wp_roles()->roles; 85 72 $show_summary = get_option( 'systupex_export_summary', '1' ); 86 73 $allowed_roles = get_option( 'systupex_allowed_roles', [] ); … … 144 131 <th scope="row"><?php esc_html_e( 'Add more info to file', 'system-update-exporter' ); ?></th> 145 132 <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>155 133 <label class="format-csv format-excel format-word format-xml"> 156 134 <input type="checkbox" name="systupex_export_summary" value="1" <?php checked( $show_summary, '1' ); ?>> … … 198 176 */ 199 177 function systupex_save_roles_capabilities( $option ) { 200 // Verificar permisos del usuario201 178 if ( ! current_user_can( 'manage_options' ) ) { 202 179 wp_die( esc_html__( 'You are not allowed to perform this action.', 'system-update-exporter' ) ); 203 180 } 204 181 205 // Verificar que venimos del formulario correcto y nonce válido206 182 if ( 207 183 ! isset( $_POST['option_page'] ) || $_POST['option_page'] !== 'systupex_settings_group' || … … 240 216 } 241 217 add_action( 'update_option_systupex_allowed_roles', __NAMESPACE__ . '\\systupex_save_roles_capabilities' ); 242 243 /**244 * Enqueue Admin Scripts245 */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 8 8 9 9 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")); 12 11 13 12 tab.classList.add("nav-tab-active"); … … 18 17 }); 19 18 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"); 27 21 28 22 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"; 33 27 }); 34 if (logoCheckbox && logoWrapper) {35 logoWrapper.style.display = (logoCheckbox.checked && selectedFormat === 'word') ? 'block' : 'none';36 }37 28 } 38 29 39 30 if (formatSelect) { 40 formatSelect.addEventListener('change', toggleCompositionOptions); 41 } 42 if (logoCheckbox) { 43 logoCheckbox.addEventListener('change', toggleCompositionOptions); 31 formatSelect.addEventListener("change", toggleCompositionOptions); 44 32 } 45 33 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.useImageText54 },55 multiple: false56 });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 }66 34 67 35 const toggleEditor = (checkboxSelector, wrapperId) => { … … 70 38 if (checkbox && wrapper) { 71 39 const toggle = () => { 72 wrapper.style.display = checkbox.checked ? 'block' : 'none';40 wrapper.style.display = checkbox.checked ? "block" : "none"; 73 41 }; 74 checkbox.addEventListener( 'change', toggle);42 checkbox.addEventListener("change", toggle); 75 43 toggle(); 76 44 } 77 45 }; 78 46 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 ); 80 51 }); -
system-update-exporter/trunk/includes/Export.php
r3326838 r3356280 92 92 93 93 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"'); 95 95 header('Content-Length: ' . strlen($contents)); 96 96 … … 104 104 $summary_text = wp_kses_post(get_option('systupex_export_summary_text', '')); 105 105 $data = []; 106 106 $data[] = [wp_strip_all_tags('WordPress Updates Report', ['bold' => true, 'name' => 'Poppins', 'size' => 16])]; 107 $data[] = ['']; 107 108 if (get_option('systupex_export_summary') && !empty($summary_text)) { 108 109 $data[] = [wp_strip_all_tags($summary_text)]; … … 138 139 139 140 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"'); 141 142 header('Pragma: no-cache'); 142 143 header('Expires: 0'); 143 144 144 $xlsx->downloadAs(' systupex.xlsx');145 $xlsx->downloadAs('WordPress Updates Report.xlsx'); 145 146 exit; 146 147 } … … 152 153 153 154 $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); 165 157 166 158 if (!empty($summary_text)) { … … 168 160 $section->addTextBreak(1); 169 161 } 170 171 $section->addText('WordPress Updates Report', ['bold' => true, 'name' => 'Poppins', 'size' => 16]);172 $section->addTextBreak(1);173 162 174 163 $table = $section->addTable(); … … 200 189 } 201 190 202 $temp_file = tempnam(sys_get_temp_dir(), ' systupex') . '.docx';191 $temp_file = tempnam(sys_get_temp_dir(), 'report') . '.docx'; 203 192 $phpWord->save($temp_file, 'Word2007'); 204 193 $content = file_get_contents($temp_file); … … 208 197 header('Content-Description: File Transfer'); 209 198 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"'); 211 200 header('Content-Transfer-Encoding: binary'); 212 201 header('Content-Length: ' . strlen($content)); … … 251 240 252 241 header('Content-Type: application/xml'); 253 header('Content-Disposition: attachment; filename=" systupex.xml"');242 header('Content-Disposition: attachment; filename="WordPress Updates Report.xml"'); 254 243 header('Content-Length: ' . strlen($xml->asXML())); 255 244 -
system-update-exporter/trunk/includes/SystemStatus.php
r3326838 r3356280 205 205 return; 206 206 } 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 } 218 220 } 221 echo '</tbody></table>'; 222 } else { 223 echo '<p>No Memcached statistics found.</p>'; 219 224 } 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>'; 223 227 } 224 228 } 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>'; 226 230 } 227 231 } -
system-update-exporter/trunk/languages/system-update-exporter-de_DE.po
r3326838 r3356280 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: System Update Exporter 1.0. 0\n"5 "Project-Id-Version: System Update Exporter 1.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n" 7 7 "Last-Translator: Umbradev <[email protected]>\n" … … 188 188 msgstr "Weitere Informationen zur Datei hinzufügen" 189 189 190 #: admin/settings.php:125191 msgid "Add logo"192 msgstr "Logo hinzufügen"193 194 190 #: admin/settings.php:130 195 191 msgid "Select image" -
system-update-exporter/trunk/languages/system-update-exporter-en_US.po
r3326838 r3356280 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: System Update Exporter 1.0. 0\n"5 "Project-Id-Version: System Update Exporter 1.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n" 7 7 "Last-Translator: Umbradev <[email protected]>\n" … … 189 189 msgstr "Add more info to file" 190 190 191 #: admin/settings.php:125192 msgid "Add logo"193 msgstr "Add logo"194 195 191 #: admin/settings.php:130 196 192 msgid "Select image" -
system-update-exporter/trunk/languages/system-update-exporter-es_ES.po
r3326838 r3356280 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: System Update Exporter 1.0. 0\n"5 "Project-Id-Version: System Update Exporter 1.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n" 7 7 "Last-Translator: Umbradev <[email protected]>\n" … … 189 189 msgstr "Agregar más información al archivo" 190 190 191 #: admin/settings.php:125192 msgid "Add logo"193 msgstr "Agregar logo"194 195 #: admin/settings.php:130196 msgid "Select image"197 msgstr "Seleccionar imagen"198 199 191 #: admin/settings.php:134 200 192 msgid "Resume text" -
system-update-exporter/trunk/languages/system-update-exporter-fr_FR.po
r3326838 r3356280 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: System Update Exporter 1.0. 0\n"5 "Project-Id-Version: System Update Exporter 1.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n" 7 7 "Last-Translator: Umbradev <[email protected]>\n" … … 189 189 msgstr "Ajouter plus d'infos au fichier" 190 190 191 #: admin/settings.php:125192 msgid "Add logo"193 msgstr "Ajouter un logo"194 195 #: admin/settings.php:130196 msgid "Select image"197 msgstr "Sélectionner une image"198 199 191 #: admin/settings.php:134 200 192 msgid "Resume text" -
system-update-exporter/trunk/languages/system-update-exporter-it_IT.po
r3326838 r3356280 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: System Update Exporter 1.0. 0\n"5 "Project-Id-Version: System Update Exporter 1.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n" 7 7 "Last-Translator: Umbradev <[email protected]>\n" … … 188 188 msgstr "Aggiungi più informazioni al file" 189 189 190 #: admin/settings.php:125191 msgid "Add logo"192 msgstr "Aggiungi logo"193 194 #: admin/settings.php:130195 msgid "Select image"196 msgstr "Seleziona immagine"197 198 190 #: admin/settings.php:134 199 191 msgid "Resume text" -
system-update-exporter/trunk/languages/system-update-exporter.pot
r3326838 r3356280 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: System Update Exporter 1.0. 0\n"5 "Project-Id-Version: System Update Exporter 1.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/system-update-exporter\n" 7 7 "Last-Translator: Umbradev <[email protected]>\n" … … 201 201 msgstr "" 202 202 203 #: admin/settings.php:125204 msgid "Add logo"205 msgstr ""206 207 #: admin/settings.php:130208 msgid "Select image"209 msgstr ""210 211 203 #: admin/settings.php:134 212 204 msgid "Resume text" -
system-update-exporter/trunk/readme.txt
r3326968 r3356280 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 70 70 * System status feature. 71 71 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 72 77 == Credits == 73 78 Developed by Umbradev (https://umbradev.es). -
system-update-exporter/trunk/system-update-exporter.php
r3326838 r3356280 4 4 * Plugin URI: https://wordpress.org/plugins/system-update-exporter/ 5 5 * Description: A plugin to retrieve and export system information and pending updates for WordPress, plugins, and themes. 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Author: Umbradev 8 8 * Author URI: https://umbradev.es … … 20 20 } 21 21 22 define( 'SYSTUPEX_VERSION', '1.0. 0' );22 define( 'SYSTUPEX_VERSION', '1.0.1' ); 23 23 define( 'SYSTUPEX_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 24 24 define( 'SYSTUPEX_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); … … 50 50 SYSTUPEX_VERSION, 51 51 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 ]60 52 ); 61 53 } -
system-update-exporter/trunk/uninstall.php
r3326838 r3356280 22 22 'systupex_export_header', 23 23 'systupex_export_header_text', 24 'systupex_export_logo',25 'systupex_export_logo_url',26 24 'systupex_export_summary', 27 25 'systupex_export_summary_text',
Note: See TracChangeset
for help on using the changeset viewer.