Changeset 3472200
- Timestamp:
- 03/01/2026 07:18:42 PM (4 weeks ago)
- Location:
- rc-site-manager-optimization/trunk
- Files:
-
- 14 added
- 1 deleted
- 13 edited
-
includes/admin.php (added)
-
includes/database.php (modified) (3 diffs)
-
includes/functions/premium.php (modified) (4 diffs)
-
premium/custom_software_1 (added)
-
premium/custom_software_1/custom_software_1_function.php (added)
-
premium/custom_software_1/custom_software_1_script.js (added)
-
premium/custom_software_1/front_end (added)
-
premium/custom_software_1/front_end/index.php (added)
-
premium/custom_software_1/index.php (added)
-
premium/custom_software_1/tab_code.php (added)
-
premium/custom_software_1/tab_code_fn.php (added)
-
premium/index.php (added)
-
premium/ultra_speed/assets/builders/elementor/thegem/thegem_style_clean.hash (modified) (1 diff)
-
premium/ultra_speed/assets/builders/elementor/thegem/thegem_style_clean.min.css (modified) (3 diffs)
-
premium/ultra_speed/front_end/index.php (modified) (1 diff)
-
premium/ultra_speed/front_end/ros/fonts.php (modified) (1 diff)
-
premium/ultra_speed/front_end/ros/html.php (modified) (1 diff)
-
premium/ultra_speed/front_end/ros/index.php (modified) (1 diff)
-
premium/ultra_speed/front_end/ros/selected_functions.php (added)
-
premium/ultra_speed/front_end/ros/utility_functions.php (added)
-
premium/ultra_speed/front_end/wp_rocket.php__OLD (deleted)
-
premium/ultra_speed/index.php (modified) (6 diffs)
-
premium/ultra_speed/tab_functions.php (added)
-
premium/ultra_speed/tab_functions_fn.php (added)
-
premium/ultra_speed/tab_settings_fn.php (modified) (1 diff)
-
premium/ultra_speed/ultra_speed_function.php (modified) (1 diff)
-
premium/ultra_speed/ultra_speed_script.js (modified) (2 diffs)
-
settings/tab_premium_fn.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rc-site-manager-optimization/trunk/includes/database.php
r3438010 r3472200 45 45 PRIMARY KEY (id), 46 46 UNIQUE KEY control (control) 47 ) $charset_collate; 48 "; 49 50 // 📌 Tabella: rc_sm_tb_premium_custom_software 51 $rc_sm_premium_custom_software_table = RC_SM_TABLE_PREMIUM_CUSTOM_SOFTWARE; 52 $tables[$rc_sm_premium_custom_software_table] = " 53 CREATE TABLE {$rc_sm_premium_custom_software_table} ( 54 id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, 55 software VARCHAR(100) NOT NULL, 56 control VARCHAR(100) NOT NULL, 57 value LONGTEXT NOT NULL, 58 date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 59 PRIMARY KEY (id), 60 UNIQUE KEY software_control (software, control) 47 61 ) $charset_collate; 48 62 "; … … 180 194 181 195 196 // ─── Ultra Speed ────────────────────────────────────────────────────────────── 197 182 198 function rc_sm_ultra_speed_get_value($control) { 183 199 global $wpdb; … … 214 230 } 215 231 } 232 233 234 // ─── Custom Software (tabella condivisa per tutti i moduli) ─────────────────── 235 236 function rc_sm_custom_software_get_value($software, $control) { 237 global $wpdb; 238 $table_name = esc_sql(RC_SM_TABLE_PREMIUM_CUSTOM_SOFTWARE); 239 240 $result = $wpdb->get_var($wpdb->prepare( 241 "SELECT value FROM $table_name WHERE software = %s AND control = %s", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Safe: table name escaped with esc_sql() 242 $software, 243 $control 244 )); 245 246 return $result ? json_decode($result, true) : array(); 247 } 248 249 function rc_sm_custom_software_set_value($software, $control, $value) { 250 global $wpdb; 251 $table_name = esc_sql(RC_SM_TABLE_PREMIUM_CUSTOM_SOFTWARE); 252 253 $existing = rc_sm_custom_software_get_value($software, $control); 254 255 if (empty($existing)) { 256 return $wpdb->insert($table_name, array( 257 'software' => $software, 258 'control' => $control, 259 'value' => wp_json_encode($value), 260 'date' => current_time('mysql') 261 )) !== false; 262 } else { 263 return $wpdb->update($table_name, 264 array( 265 'value' => wp_json_encode($value), 266 'date' => current_time('mysql') 267 ), 268 array( 269 'software' => $software, 270 'control' => $control, 271 ) 272 ) !== false; 273 } 274 } -
rc-site-manager-optimization/trunk/includes/functions/premium.php
r3444385 r3472200 6 6 function rc_sm_premium_licence_verify($slug, $licence_key) { 7 7 8 $valid_slugs = array('sus', ' wab');8 $valid_slugs = array('sus', 'cs1'); 9 9 if (!in_array($slug, $valid_slugs)) { 10 10 return array( … … 196 196 $valid_patches = array(); 197 197 $valid_patches[] = rc_sm_premium_licence_get_patch('sus'); 198 $valid_patches[] = rc_sm_premium_licence_get_patch(' wab');198 $valid_patches[] = rc_sm_premium_licence_get_patch('cs1'); 199 199 $valid_patches = array_filter($valid_patches); 200 200 … … 227 227 $valid_patches = array(); 228 228 $valid_patches[] = rc_sm_premium_licence_get_patch('sus'); 229 $valid_patches[] = rc_sm_premium_licence_get_patch(' wab');229 $valid_patches[] = rc_sm_premium_licence_get_patch('cs1'); 230 230 $valid_patches = array_filter($valid_patches); 231 231 … … 250 250 return rc_sm_ultra_speed_get_value('preload_images'); 251 251 } 252 253 254 255 256 252 257 253 -
rc-site-manager-optimization/trunk/premium/ultra_speed/assets/builders/elementor/thegem/thegem_style_clean.hash
r3438935 r3472200 1 7a6af8bfff8b254e02d9094ef290880a 1 00eb7d75908f3a0d99c72f3be92f6527 -
rc-site-manager-optimization/trunk/premium/ultra_speed/assets/builders/elementor/thegem/thegem_style_clean.min.css
r3438935 r3472200 4 4 Author: Codex Themes. 5 5 Theme URI: http://codex-themes.com/thegem/ 6 Version: 5.1 1.06 Version: 5.12.0 7 7 Tags: one-column, two-columns, left-sidebar, right-sidebar, custom-background, custom-colors, custom-header, custom-menu, featured-images, flexible-header, full-width-template, theme-options, translation-ready 8 8 License: GNU General Public License … … 6196 6196 .e-con.thegem-e-con-layout-thegem { 6197 6197 --container-max-width: 1170px; 6198 --content-width: 1170px; 6198 6199 --container-default-padding-inline-end: 21px; 6199 6200 --container-default-padding-inline-start: 21px; … … 6229 6230 .e-con.thegem-e-con-layout-thegem:has(> .e-con-inner > .e-con) { 6230 6231 --container-max-width: 1212px; 6232 --content-width: 1212px; 6231 6233 --container-default-padding-inline-start: 0; 6232 6234 --container-default-padding-inline-end: 0; -
rc-site-manager-optimization/trunk/premium/ultra_speed/front_end/index.php
r3451522 r3472200 17 17 18 18 19 20 19 21 if ( $ultra_speed_enabled !== 'on' ) return; 22 23 20 24 21 25 // Include custom code dalla cartella uploads 22 26 $upload_dir = wp_upload_dir(); 23 $custom_code_path = $upload_dir['basedir'] . '/rc-site-manager-optimization/premium/ultraspeed/php/code.php'; 27 $custom_base_path = $upload_dir['basedir'] . '/rc-site-manager-optimization/premium/ultraspeed/php/'; 28 29 $custom_code_path = $custom_base_path . 'code.php'; 24 30 if ( file_exists( $custom_code_path ) ) { 25 31 include $custom_code_path; 26 32 } 27 33 34 $functions_general_path = $custom_base_path . 'functions_general.php'; 35 if ( file_exists( $functions_general_path ) ) { 36 include $functions_general_path; 37 } 38 39 $functions_wp_rocket_path = $custom_base_path . 'functions_wp_rocket.php'; 40 if ( file_exists( $functions_wp_rocket_path ) ) { 41 include $functions_wp_rocket_path; 42 } 43 44 45 28 46 29 47 include 'ros/index.php'; 30 #include 'ros/wp_rocket.php';31 48 include 'builders/index.php'; 32 49 -
rc-site-manager-optimization/trunk/premium/ultra_speed/front_end/ros/fonts.php
r3456067 r3472200 1 1 <?php 2 /**3 * Fonts - Preload e @font-face4 */5 2 6 3 if ( ! defined( 'ABSPATH' ) ) exit; -
rc-site-manager-optimization/trunk/premium/ultra_speed/front_end/ros/html.php
r3451522 r3472200 3 3 if ( ! defined( 'ABSPATH' ) ) exit; 4 4 5 /** SE NON TROVA IL MAIN LO INSERISCE */6 add_action( 'template_redirect', function() {7 ob_start( function( $html ) {8 if ( preg_match( '/<main[\s>]/i', $html ) ) {9 return $html;10 }11 12 $added = false;13 14 $html = preg_replace( '#</header>#i', '</header><main role="main">', $html, 1, $count );15 if ( $count ) $added = true;16 17 $html = preg_replace( '#<footer#i', '</main><footer', $html, 1, $count2 );18 if ( ! $count2 && $added ) {19 $html = preg_replace( '#</body>#i', '</main></body>', $html, 1 );20 }21 22 if ( ! $added ) {23 $html = preg_replace( '#<body([^>]*)>#i', '<body$1><main role="main">', $html, 1 );24 $html = preg_replace( '#</body>#i', '</main></body>', $html, 1 );25 }26 27 return $html;28 });29 }); -
rc-site-manager-optimization/trunk/premium/ultra_speed/front_end/ros/index.php
r3451522 r3472200 6 6 include 'images.php'; 7 7 include 'html.php'; 8 include 'utility_functions.php'; 9 include 'selected_functions.php'; 8 10 include 'remove_html.php'; 9 11 include 'plugins/index.php'; -
rc-site-manager-optimization/trunk/premium/ultra_speed/index.php
r3444385 r3472200 1 1 <?php 2 2 if ( ! defined( 'ABSPATH' ) ) exit; 3 4 include RC_SM_PLUGIN_DIR . 'premium/ultra_speed/front_end/index.php';5 3 6 4 define('RC_SM_PAGE_DIR_ULTRA_SPEED', 'premium_ultra_speed'); … … 11 9 if ($tab === 'tab_' . RC_SM_PAGE_DIR_ULTRA_SPEED . '_preload') { 12 10 include 'tab_preload_fn.php'; 11 } elseif ($tab === 'tab_' . RC_SM_PAGE_DIR_ULTRA_SPEED . '_functions') { 12 include 'tab_functions_fn.php'; 13 13 } elseif ($tab === 'tab_' . RC_SM_PAGE_DIR_ULTRA_SPEED . '_settings') { 14 14 include 'tab_settings_fn.php'; … … 52 52 if ($tab === 'tab_' . RC_SM_PAGE_DIR_ULTRA_SPEED . '_preload') { 53 53 include 'tab_preload.php'; 54 } elseif ($tab === 'tab_' . RC_SM_PAGE_DIR_ULTRA_SPEED . '_functions') { 55 include 'tab_functions.php'; 54 56 } elseif ($tab === 'tab_' . RC_SM_PAGE_DIR_ULTRA_SPEED . '_settings') { 55 57 include 'tab_settings.php'; … … 57 59 58 60 wp_die(); 59 });60 61 add_action('wp_ajax_rc_sm_preload_fonts_save', function() {62 if (!rc_sm_security_ajax_verify()) {63 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]);64 return;65 }66 67 include_once 'tab_preload_fn.php';68 69 $data = $_POST;70 $result = rc_sm_preload_fonts_save($data);71 72 if ($result) {73 wp_send_json_success(['message' => __('Fonts configuration saved successfully.', 'rc-site-manager-optimization')]);74 } else {75 wp_send_json_error(['message' => __('Error saving fonts configuration.', 'rc-site-manager-optimization')]);76 }77 });78 79 add_action('wp_ajax_rc_sm_preload_images_save', function() {80 if (!rc_sm_security_ajax_verify()) {81 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]);82 return;83 }84 85 include_once 'tab_preload_fn.php';86 87 $data = $_POST;88 $result = rc_sm_preload_images_save($data);89 90 if ($result) {91 wp_send_json_success(['message' => __('Images configuration saved successfully.', 'rc-site-manager-optimization')]);92 } else {93 wp_send_json_error(['message' => __('Error saving images configuration.', 'rc-site-manager-optimization')]);94 }95 });96 97 add_action('wp_ajax_rc_sm_wp_rocket_settings_save', function() {98 if (!rc_sm_security_ajax_verify()) {99 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]);100 return;101 }102 103 include_once 'tab_settings_fn.php';104 105 $data = $_POST;106 $result = rc_sm_wp_rocket_settings_save($data);107 108 if ($result) {109 wp_send_json_success(['message' => __('WP Rocket settings saved successfully.', 'rc-site-manager-optimization')]);110 } else {111 wp_send_json_error(['message' => __('Error saving WP Rocket settings.', 'rc-site-manager-optimization')]);112 }113 });114 115 add_action('wp_ajax_rc_sm_general_settings_save', function() {116 if (!rc_sm_security_ajax_verify()) {117 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]);118 return;119 }120 121 include_once 'tab_settings_fn.php';122 123 $data = $_POST;124 $result = rc_sm_general_settings_save($data);125 126 if ($result) {127 wp_send_json_success(['message' => __('General settings saved successfully.', 'rc-site-manager-optimization')]);128 } else {129 wp_send_json_error(['message' => __('Error saving general settings.', 'rc-site-manager-optimization')]);130 }131 61 }); 132 62 … … 157 87 158 88 <a href="#" class="rc_sm_tab_button" 89 data-tab="tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_functions" 90 data-ajax-action="rc_sm_load_tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>"> 91 <span class="dashicons dashicons-editor-code"></span><?php echo esc_html__('Functions', 'rc-site-manager-optimization'); ?> 92 </a> 93 94 <a href="#" class="rc_sm_tab_button" 159 95 data-tab="tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_settings" 160 96 data-ajax-action="rc_sm_load_tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>"> … … 166 102 167 103 <div class="rc_sm_tab_content tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_preload active" 168 data-tab="tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_preload">104 data-tab="tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_preload"> 169 105 <div class="rc_sm_loader_tab"></div> 170 106 </div> 171 107 108 <div class="rc_sm_tab_content tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_functions" 109 data-tab="tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_functions"> 110 <div class="rc_sm_loader_tab"></div> 111 </div> 112 172 113 <div class="rc_sm_tab_content tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_settings" 173 data-tab="tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_settings">114 data-tab="tab_<?php echo esc_attr($rc_sm_page_dir_tab_ultra_speed); ?>_settings"> 174 115 <div class="rc_sm_loader_tab"></div> 175 116 </div> -
rc-site-manager-optimization/trunk/premium/ultra_speed/tab_settings_fn.php
r3444385 r3472200 80 80 // Salva file Custom Php 81 81 $custom_php = isset($data['custom_php']) ? trim(wp_unslash($data['custom_php'])) : ''; 82 83 // Verifica presenza <?php 84 if (!empty($custom_php) && strpos($custom_php, '<?php') === false) { 85 wp_send_json_error(['message' => __('Il codice PHP deve contenere il tag di apertura PHP', 'rc-site-manager-optimization')]); 86 return; 87 } 88 82 89 $custom_php_path = $custom_dir . 'code.php'; 83 90 file_put_contents($custom_php_path, $custom_php); -
rc-site-manager-optimization/trunk/premium/ultra_speed/ultra_speed_function.php
r3438010 r3472200 2 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 3 4 add_action('wp_ajax_rc_sm_preload_fonts_save', function() { 5 if (!rc_sm_security_ajax_verify()) { 6 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 7 return; 8 } 9 10 include_once 'tab_preload_fn.php'; 11 12 $data = $_POST; 13 $result = rc_sm_preload_fonts_save($data); 14 15 if ($result) { 16 wp_send_json_success(['message' => __('Fonts configuration saved successfully.', 'rc-site-manager-optimization')]); 17 } else { 18 wp_send_json_error(['message' => __('Error saving fonts configuration.', 'rc-site-manager-optimization')]); 19 } 20 }); 21 22 add_action('wp_ajax_rc_sm_preload_images_save', function() { 23 if (!rc_sm_security_ajax_verify()) { 24 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 25 return; 26 } 27 28 include_once 'tab_preload_fn.php'; 29 30 $data = $_POST; 31 $result = rc_sm_preload_images_save($data); 32 33 if ($result) { 34 wp_send_json_success(['message' => __('Images configuration saved successfully.', 'rc-site-manager-optimization')]); 35 } else { 36 wp_send_json_error(['message' => __('Error saving images configuration.', 'rc-site-manager-optimization')]); 37 } 38 }); 39 40 add_action('wp_ajax_rc_sm_wp_rocket_settings_save', function() { 41 if (!rc_sm_security_ajax_verify()) { 42 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 43 return; 44 } 45 46 include_once 'tab_settings_fn.php'; 47 48 $data = $_POST; 49 $result = rc_sm_wp_rocket_settings_save($data); 50 51 if ($result) { 52 wp_send_json_success(['message' => __('WP Rocket settings saved successfully.', 'rc-site-manager-optimization')]); 53 } else { 54 wp_send_json_error(['message' => __('Error saving WP Rocket settings.', 'rc-site-manager-optimization')]); 55 } 56 }); 57 58 add_action('wp_ajax_rc_sm_general_settings_save', function() { 59 if (!rc_sm_security_ajax_verify()) { 60 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 61 return; 62 } 63 64 include_once 'tab_settings_fn.php'; 65 66 $data = $_POST; 67 $result = rc_sm_general_settings_save($data); 68 69 if ($result) { 70 wp_send_json_success(['message' => __('General settings saved successfully.', 'rc-site-manager-optimization')]); 71 } else { 72 wp_send_json_error(['message' => __('Error saving general settings.', 'rc-site-manager-optimization')]); 73 } 74 }); 75 add_action('wp_ajax_rc_sm_wp_rocket_functions_save', function() { 76 if (!rc_sm_security_ajax_verify()) { 77 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 78 return; 79 } 80 81 include_once 'tab_functions_fn.php'; 82 83 $data = $_POST; 84 $result = rc_sm_wp_rocket_functions_save($data); 85 86 if ($result) { 87 wp_send_json_success(['message' => __('WP Rocket functions saved successfully.', 'rc-site-manager-optimization')]); 88 } else { 89 wp_send_json_error(['message' => __('Error saving WP Rocket functions.', 'rc-site-manager-optimization')]); 90 } 91 }); 92 93 add_action('wp_ajax_rc_sm_general_functions_save', function() { 94 if (!rc_sm_security_ajax_verify()) { 95 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 96 return; 97 } 98 99 include_once 'tab_functions_fn.php'; 100 101 $data = $_POST; 102 $result = rc_sm_general_functions_save($data); 103 104 if ($result) { 105 wp_send_json_success(['message' => __('General functions saved successfully.', 'rc-site-manager-optimization')]); 106 } else { 107 wp_send_json_error(['message' => __('Error saving general functions.', 'rc-site-manager-optimization')]); 108 } 109 }); 110 111 add_action('wp_ajax_rc_sm_wp_rocket_functions_save', function() { 112 if (!rc_sm_security_ajax_verify()) { 113 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 114 return; 115 } 116 117 include_once 'tab_functions_fn.php'; 118 119 $data = $_POST; 120 $result = rc_sm_wp_rocket_functions_save($data); 121 122 if ($result) { 123 wp_send_json_success(['message' => __('WP Rocket functions saved successfully.', 'rc-site-manager-optimization')]); 124 } else { 125 wp_send_json_error(['message' => __('Error saving WP Rocket functions.', 'rc-site-manager-optimization')]); 126 } 127 }); 128 129 add_action('wp_ajax_rc_sm_general_functions_save', function() { 130 if (!rc_sm_security_ajax_verify()) { 131 wp_send_json_error(['message' => __('Security check failed.', 'rc-site-manager-optimization')]); 132 return; 133 } 134 135 include_once 'tab_functions_fn.php'; 136 137 $data = $_POST; 138 $result = rc_sm_general_functions_save($data); 139 140 if ($result) { 141 wp_send_json_success(['message' => __('General functions saved successfully.', 'rc-site-manager-optimization')]); 142 } else { 143 wp_send_json_error(['message' => __('Error saving general functions.', 'rc-site-manager-optimization')]); 144 } 145 }); -
rc-site-manager-optimization/trunk/premium/ultra_speed/ultra_speed_script.js
r3444385 r3472200 143 143 }); 144 144 145 146 // === TAB FUNCTIONS === 147 $(document).on('rc_sm_tab_loaded', function (e, tabId) { 148 if (tabId !== 'tab_premium_ultra_speed_functions') return; 149 150 $(document).off('click.fn_general_php'); 151 $(document).off('click.fn_wpr_php'); 152 $(document).off('submit.general_functions', '.rc_sm_general_functions_form'); 153 $(document).off('submit.wp_rocket_functions', '.rc_sm_wp_rocket_functions_form'); 154 155 // Customize General Php Functions 156 $(document).on('click.fn_general_php', '.rc_sm_customize_general_php', function(e) { 157 e.preventDefault(); 158 const $link = $(this); 159 const $textarea = $('.rc_sm_general_php_textarea'); 160 161 if ($textarea.hasClass('rc_sm_custom')) { 162 $textarea.prop('readonly', true); 163 $textarea.removeClass('rc_sm_custom'); 164 $link.text($link.text().replace('Lock', 'Customize')); 165 } else { 166 $textarea.prop('readonly', false); 167 $textarea.addClass('rc_sm_custom'); 168 $link.text($link.text().replace('Customize', 'Lock')); 169 } 170 }); 171 172 // Customize WP Rocket Php Functions 173 $(document).on('click.fn_wpr_php', '.rc_sm_customize_wpr_php', function(e) { 174 e.preventDefault(); 175 const $link = $(this); 176 const $textarea = $('.rc_sm_wpr_php_textarea'); 177 178 if ($textarea.hasClass('rc_sm_custom')) { 179 $textarea.prop('readonly', true); 180 $textarea.removeClass('rc_sm_custom'); 181 $link.text($link.text().replace('Lock', 'Customize')); 182 } else { 183 $textarea.prop('readonly', false); 184 $textarea.addClass('rc_sm_custom'); 185 $link.text($link.text().replace('Customize', 'Lock')); 186 } 187 }); 188 189 // Handle General Functions form submit 190 $(document).on('submit.general_functions', '.rc_sm_general_functions_form', function(e) { 191 e.preventDefault(); 192 193 const $form = $(this); 194 const $submitBtn = $form.find('button[type="submit"]'); 195 const $submitWrapper = $form.find('.rc_sm_form_divider_submit'); 196 const formData = $form.serialize() + '&action=rc_sm_general_functions_save&nonce=' + rc_sm_ajax.nonce; 197 198 $.post(rc_sm_ajax.ajax_url, formData) 199 .done(function(response) { 200 if (response && response.success) { 201 rc_sm_js_notice_fly_show(response.data.message || rc_sm_ajax.i18n.rc_sm_text_config_saved, 'success'); 202 const $tabBox = $('.rc_sm_box_wrap_tab'); 203 if ($tabBox.length) { $('html, body').animate({ scrollTop: $tabBox.offset().top - 50 }, 500); } 204 } else { 205 rc_sm_js_notice_fly_show((response && response.data && response.data.message) ? response.data.message : rc_sm_ajax.i18n.rc_sm_text_error_saving_config, 'error'); 206 } 207 }) 208 .fail(function() { rc_sm_js_notice_fly_show(rc_sm_ajax.i18n.rc_sm_text_ajax_error, 'error'); }) 209 .always(function() { 210 setTimeout(function() { 211 $submitBtn.removeClass('rc_sm_loader_active').prop('disabled', false).attr('disabled', false); 212 $submitWrapper.find('.rc_sm_button_loader_ico').remove(); 213 }, 100); 214 }); 215 }); 216 217 // Handle WP Rocket Functions form submit 218 $(document).on('submit.wp_rocket_functions', '.rc_sm_wp_rocket_functions_form', function(e) { 219 e.preventDefault(); 220 221 const $form = $(this); 222 const $submitBtn = $form.find('button[type="submit"]'); 223 const $submitWrapper = $form.find('.rc_sm_form_divider_submit'); 224 const formData = $form.serialize() + '&action=rc_sm_wp_rocket_functions_save&nonce=' + rc_sm_ajax.nonce; 225 226 $.post(rc_sm_ajax.ajax_url, formData) 227 .done(function(response) { 228 if (response && response.success) { 229 rc_sm_js_notice_fly_show(response.data.message || rc_sm_ajax.i18n.rc_sm_text_config_saved, 'success'); 230 const $tabBox = $('.rc_sm_box_wrap_tab'); 231 if ($tabBox.length) { $('html, body').animate({ scrollTop: $tabBox.offset().top - 50 }, 500); } 232 } else { 233 rc_sm_js_notice_fly_show((response && response.data && response.data.message) ? response.data.message : rc_sm_ajax.i18n.rc_sm_text_error_saving_config, 'error'); 234 } 235 }) 236 .fail(function() { rc_sm_js_notice_fly_show(rc_sm_ajax.i18n.rc_sm_text_ajax_error, 'error'); }) 237 .always(function() { 238 setTimeout(function() { 239 $submitBtn.removeClass('rc_sm_loader_active').prop('disabled', false).attr('disabled', false); 240 $submitWrapper.find('.rc_sm_button_loader_ico').remove(); 241 }, 100); 242 }); 243 }); 244 245 }); 246 247 145 248 // === TAB SETTINGS === 146 249 $(document).on('rc_sm_tab_loaded', function (e, tabId) { … … 379 482 380 483 }); 484 485 // === TAB FUNCTIONS === 486 $(document).on('rc_sm_tab_loaded', function (e, tabId) { 487 if (tabId !== 'tab_premium_ultra_speed_functions') return; 488 489 // RIMUOVI handler precedenti 490 $(document).off('click.fn_switch'); 491 $(document).off('click.fn_customize'); 492 $(document).off('click.fn_reset'); 493 $(document).off('submit.wp_rocket_functions', '.rc_sm_wp_rocket_functions_form'); 494 $(document).off('click.fn_custom_php'); 495 $(document).off('submit.general_functions', '.rc_sm_general_functions_form'); 496 497 // Gestisci show/hide textarea quando si clicca sullo switch WP Rocket 498 $(document).on('click.fn_switch', '.rc_sm_wp_rocket_function .rc_sm_switch', function() { 499 const $switch = $(this); 500 const $input = $switch.find('.rc_sm_switch_form'); 501 const $function = $switch.closest('.rc_sm_wp_rocket_function'); 502 const $codeDiv = $function.find('.rc_sm_wp_rocket_fn_code'); 503 504 setTimeout(function() { 505 if ($input.val() === 'on') { 506 $codeDiv.slideDown(300); 507 } else { 508 $codeDiv.slideUp(300); 509 } 510 }, 50); 511 }); 512 513 // Gestisci click su Customize per rendere textarea editabile (WP Rocket) 514 $(document).on('click.fn_customize', '.rc_sm_customize_fn_code', function(e) { 515 e.preventDefault(); 516 const $link = $(this); 517 const $codeDiv = $link.closest('.rc_sm_wp_rocket_fn_code'); 518 const $textarea = $codeDiv.find('textarea'); 519 520 if ($textarea.hasClass('rc_sm_custom')) { 521 $textarea.prop('readonly', true); 522 $textarea.removeClass('rc_sm_custom'); 523 $link.text($link.text().replace('Lock', 'Customize')); 524 } else { 525 $textarea.prop('readonly', false); 526 $textarea.addClass('rc_sm_custom'); 527 $link.text($link.text().replace('Customize', 'Lock')); 528 } 529 }); 530 531 // Gestisci click su Reset (WP Rocket) 532 $(document).on('click.fn_reset', '.rc_sm_reset_fn_code', function(e) { 533 e.preventDefault(); 534 const $link = $(this); 535 const $codeDiv = $link.closest('.rc_sm_wp_rocket_fn_code'); 536 const $textarea = $codeDiv.find('textarea'); 537 const originalContent = $textarea.data('original-content'); 538 539 if (confirm('Are you sure you want to reset the code to its default value? Any customizations will be lost.')) { 540 $textarea.val(originalContent); 541 $textarea.prop('readonly', true); 542 $textarea.removeClass('rc_sm_custom'); 543 const $customizeLink = $codeDiv.find('.rc_sm_customize_fn_code'); 544 $customizeLink.text($customizeLink.text().replace('Lock', 'Customize')); 545 rc_sm_js_notice_fly_show('Code reset to default value', 'success'); 546 } 547 }); 548 549 // Inizializza stato delle textarea al caricamento 550 $('.rc_sm_wp_rocket_fn_switch').each(function() { 551 const $switch = $(this); 552 const $function = $switch.closest('.rc_sm_wp_rocket_function'); 553 const $codeDiv = $function.find('.rc_sm_wp_rocket_fn_code'); 554 555 if ($switch.val() === 'on') { 556 $codeDiv.show(); 557 } else { 558 $codeDiv.hide(); 559 } 560 }); 561 562 // Handle form submit WP Rocket Functions 563 $(document).on('submit.wp_rocket_functions', '.rc_sm_wp_rocket_functions_form', function(e) { 564 e.preventDefault(); 565 566 const $form = $(this); 567 const $submitBtn = $form.find('button[type="submit"]'); 568 const $submitWrapper = $form.find('.rc_sm_form_divider_submit'); 569 570 const formDataString = $form.serialize(); 571 const formData = formDataString + '&action=rc_sm_wp_rocket_functions_save&nonce=' + rc_sm_ajax.nonce; 572 573 $.post(rc_sm_ajax.ajax_url, formData) 574 .done(function(response) { 575 if (response && response.success) { 576 const successMsg = response.data.message || 577 ((typeof rc_sm_ajax !== 'undefined' && rc_sm_ajax.i18n && rc_sm_ajax.i18n.rc_sm_text_config_saved) 578 ? rc_sm_ajax.i18n.rc_sm_text_config_saved 579 : 'Configuration saved successfully.'); 580 rc_sm_js_notice_fly_show(successMsg, 'success'); 581 582 const $tabBox = $('.rc_sm_box_wrap_tab'); 583 if ($tabBox.length) { 584 $('html, body').animate({ scrollTop: $tabBox.offset().top - 50 }, 500); 585 } 586 } else { 587 if (response && response.data && response.data.errors && Array.isArray(response.data.errors)) { 588 response.data.errors.forEach(function(errorMsg) { 589 rc_sm_js_notice_fly_show(errorMsg, 'error'); 590 }); 591 } else { 592 const errorMsg = (response && response.data && response.data.message) ? response.data.message : 593 ((typeof rc_sm_ajax !== 'undefined' && rc_sm_ajax.i18n && rc_sm_ajax.i18n.rc_sm_text_error_saving_config) 594 ? rc_sm_ajax.i18n.rc_sm_text_error_saving_config 595 : 'Error saving configuration.'); 596 rc_sm_js_notice_fly_show(errorMsg, 'error'); 597 } 598 } 599 }) 600 .fail(function() { 601 const errorMsg = (typeof rc_sm_ajax !== 'undefined' && rc_sm_ajax.i18n && rc_sm_ajax.i18n.rc_sm_text_ajax_error) 602 ? rc_sm_ajax.i18n.rc_sm_text_ajax_error 603 : 'AJAX request failed.'; 604 rc_sm_js_notice_fly_show(errorMsg, 'error'); 605 }) 606 .always(function() { 607 setTimeout(function() { 608 $submitBtn.removeClass('rc_sm_loader_active'); 609 $submitBtn.prop('disabled', false); 610 $submitBtn.attr('disabled', false); 611 $submitWrapper.find('.rc_sm_button_loader_ico').remove(); 612 }, 100); 613 }); 614 }); 615 616 // Gestisci click su Customize per Custom Php (General Functions) 617 $(document).on('click.fn_custom_php', '.rc_sm_customize_custom_php', function(e) { 618 e.preventDefault(); 619 const $link = $(this); 620 const $textarea = $('.rc_sm_custom_php_textarea'); 621 622 if ($textarea.hasClass('rc_sm_custom')) { 623 $textarea.prop('readonly', true); 624 $textarea.removeClass('rc_sm_custom'); 625 $link.text($link.text().replace('Lock', 'Customize')); 626 } else { 627 $textarea.prop('readonly', false); 628 $textarea.addClass('rc_sm_custom'); 629 $link.text($link.text().replace('Customize', 'Lock')); 630 } 631 }); 632 633 // Handle General Functions form submit 634 $(document).on('submit.general_functions', '.rc_sm_general_functions_form', function(e) { 635 e.preventDefault(); 636 637 const $form = $(this); 638 const $submitBtn = $form.find('button[type="submit"]'); 639 const $submitWrapper = $form.find('.rc_sm_form_divider_submit'); 640 641 const formDataString = $form.serialize(); 642 const formData = formDataString + '&action=rc_sm_general_functions_save&nonce=' + rc_sm_ajax.nonce; 643 644 $.post(rc_sm_ajax.ajax_url, formData) 645 .done(function(response) { 646 if (response && response.success) { 647 const successMsg = response.data.message || 648 ((typeof rc_sm_ajax !== 'undefined' && rc_sm_ajax.i18n && rc_sm_ajax.i18n.rc_sm_text_config_saved) 649 ? rc_sm_ajax.i18n.rc_sm_text_config_saved 650 : 'Configuration saved successfully.'); 651 rc_sm_js_notice_fly_show(successMsg, 'success'); 652 653 const $tabBox = $('.rc_sm_box_wrap_tab'); 654 if ($tabBox.length) { 655 $('html, body').animate({ scrollTop: $tabBox.offset().top - 50 }, 500); 656 } 657 } else { 658 if (response && response.data && response.data.errors && Array.isArray(response.data.errors)) { 659 response.data.errors.forEach(function(errorMsg) { 660 rc_sm_js_notice_fly_show(errorMsg, 'error'); 661 }); 662 } else { 663 const errorMsg = (response && response.data && response.data.message) ? response.data.message : 664 ((typeof rc_sm_ajax !== 'undefined' && rc_sm_ajax.i18n && rc_sm_ajax.i18n.rc_sm_text_error_saving_config) 665 ? rc_sm_ajax.i18n.rc_sm_text_error_saving_config 666 : 'Error saving configuration.'); 667 rc_sm_js_notice_fly_show(errorMsg, 'error'); 668 } 669 } 670 }) 671 .fail(function() { 672 const errorMsg = (typeof rc_sm_ajax !== 'undefined' && rc_sm_ajax.i18n && rc_sm_ajax.i18n.rc_sm_text_ajax_error) 673 ? rc_sm_ajax.i18n.rc_sm_text_ajax_error 674 : 'AJAX request failed.'; 675 rc_sm_js_notice_fly_show(errorMsg, 'error'); 676 }) 677 .always(function() { 678 setTimeout(function() { 679 $submitBtn.removeClass('rc_sm_loader_active'); 680 $submitBtn.prop('disabled', false); 681 $submitBtn.attr('disabled', false); 682 $submitWrapper.find('.rc_sm_button_loader_ico').remove(); 683 }, 100); 684 }); 685 }); 686 687 }); 381 688 382 689 }); -
rc-site-manager-optimization/trunk/settings/tab_premium_fn.php
r3438010 r3472200 9 9 'name' => 'RC Site Ultra Speed', 10 10 'prefix' => 'rc_sus_' 11 ), 12 'cs1' => array( 13 'name' => 'RC Custom Software 1', 14 'prefix' => 'rc_cs1_' 11 15 ) 12 16 );
Note: See TracChangeset
for help on using the changeset viewer.