Changeset 2567602
- Timestamp:
- 07/19/2021 08:02:45 PM (5 years ago)
- Location:
- wp-cloud-server/trunk/includes/admin/functions
- Files:
-
- 1 added
- 2 edited
-
ajax-functions.php (modified) (2 diffs)
-
misc-functions.php (modified) (2 diffs)
-
settings-functions.php (added)
Legend:
- Unmodified
- Added
- Removed
-
wp-cloud-server/trunk/includes/admin/functions/ajax-functions.php
r2433251 r2567602 19 19 */ 20 20 function wpcs_ajax_load_scripts() { 21 22 // Load the JavaScript for the dashboard tabs & set-up the related Ajax script 23 $dashboard_tabs_args = array( 24 'ajaxurl' => admin_url( 'admin-ajax.php' ), 25 'ajax_settings_dashboard_tabs_nonce' => wp_create_nonce( 'settings_dashboard_ui_tabs_nonce' ), 26 ); 27 28 wp_enqueue_script( 'settings_dashboard-tabs-update', WPCS_PLUGIN_URL . 'includes/admin/assets/js/dashboard-tab.js', array( 'jquery' ), '1.0.0', false ); 29 wp_localize_script( 'settings_dashboard-tabs-update', 'wpcs_settings_dashboard_tabs_ajax_script', $dashboard_tabs_args ); 30 21 31 22 32 // Load the JavaScript for the dashboard & set-up the related Ajax script … … 69 79 } 70 80 add_action( 'wp_ajax_dashboard_update', 'wpcs_ajax_process_dashboard_update' ); 81 82 /** 83 * Create the Option for the Dashboard Tabs Update 84 * 85 * @since 3.0.6 86 */ 87 function wpcs_ajax_process_dashboard_tabs_update() { 88 89 // Check the nonce for the admin notice data 90 check_ajax_referer( 'settings_dashboard_ui_tabs_nonce', 'settings_dashboard_tabs_nonce' ); 91 92 // Pick up the notice "admin_type" - passed via the "data-tab" attribute 93 if ( isset( $_POST['settings_dashboard_tabs_type'] ) ) { 94 $position = $_POST['settings_dashboard_tabs_type']; 95 $tab_id = $_POST['settings_dashboard_tabs_id']; 96 update_option( "wpcs_{$tab_id}_current_tab", $position ); 97 } 98 } 99 add_action( 'wp_ajax_settings_dashboard_tabs', 'wpcs_ajax_process_dashboard_tabs_update' ); 71 100 72 101 /** -
wp-cloud-server/trunk/includes/admin/functions/misc-functions.php
r2492109 r2567602 319 319 } 320 320 321 function wpcs_delete_ server_template( $provider, $template) {321 function wpcs_delete_template( $provider, $template, $type = 'server') { 322 322 323 323 $module_data = get_option( 'wpcs_module_list' ); 324 324 $template_data = get_option( 'wpcs_template_data_backup' ); 325 325 $completed_tasks = get_option( 'wpcs_tasks_completed', array()); 326 326 327 327 foreach ( $module_data[$provider]['templates'] as $key => $templates ) { 328 328 329 if ( $template == $templates['name'] ) { 330 329 331 unset( $module_data[$provider]['templates'][$key] ); 330 332 unset( $template_data[$provider]['templates'][$key] ); 331 $completed_tasks[]=$template; 332 $delete_complete = true; 333 } 334 } 333 334 $template_count = ( isset( $module_data[ $provider ][ "{$type}_template_count" ] ) ) ? $module_data[ $provider ][ "{$type}_template_count" ] : 0; 335 $template_count = ( $template_count > 0 ) ? --$template_count : $template_count; 336 337 $module_data[ $provider ][ "{$type}_template_count" ] = $template_count; 338 $template_data[ $provider ][ "{$type}_template_count" ] = $template_count; 339 340 $completed_tasks[]=$template; 341 $delete_complete = true; 342 } 343 } 335 344 update_option( 'wpcs_tasks_completed', $completed_tasks); 336 345 update_option( 'wpcs_module_list', $module_data ); … … 356 365 <?php 357 366 } 367 368 /** 369 * Check module is Active 370 * 371 * @since 3.0.6 372 * @return boolean module active 373 */ 374 function wpcs_check_module_active( $module = null ) { 375 376 $module_list = get_option( 'wpcs_module_list' ); 377 378 return ( 'active' == $module_list[$module]['status'] ) ? true : false; 379 380 }
Note: See TracChangeset
for help on using the changeset viewer.