Astra_Addon_Admin_Ajax::astra_addon_update_whitelabel()
Save whitelabel Settings.
Description
Source
File: admin/core/includes/class-astra-addon-admin-ajax.php
public function astra_addon_update_whitelabel() { $response_data = array( 'message' => $this->get_error_msg( 'permission' ) ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( $response_data ); } if ( empty( $_POST ) ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } /** * Nonce verification. */ if ( ! check_ajax_referer( 'astra_addon_update_admin_setting', 'security', false ) ) { $response_data = array( 'message' => $this->get_error_msg( 'nonce' ) ); wp_send_json_error( $response_data ); } $white_label_settings = Astra_Ext_White_Label_Markup::get_white_labels(); $data = isset( $_POST['data'] ) ? array_map( 'sanitize_text_field', json_decode( stripslashes( $_POST['data'] ), true ) ) : array(); $parent = isset( $_POST['parent'] ) ? sanitize_text_field( $_POST['parent'] ) : false; $key = isset( $_POST['key'] ) ? sanitize_text_field( $_POST['key'] ) : false; $value = isset( $_POST['value'] ) ? sanitize_text_field( stripslashes( $_POST['value'] ) ) : false; if ( $parent && $key ) { if ( ! $parent || ! $key || ! $value ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } $white_label_settings[ $parent ][ $key ] = $value; } else { if ( ! $data ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } $white_label_settings['astra-agency']['author'] = isset( $data['agencyAuthorName'] ) ? $data['agencyAuthorName'] : $white_label_settings['astra-agency']['author']; $white_label_settings['astra-agency']['author_url'] = isset( $data['agencyAuthorURL'] ) ? $data['agencyAuthorURL'] : $white_label_settings['astra-agency']['author_url']; $white_label_settings['astra-agency']['licence'] = isset( $data['agencyLicenseLink'] ) ? $data['agencyLicenseLink'] : $white_label_settings['astra-agency']['licence']; $white_label_settings['astra']['name'] = isset( $data['themeName'] ) ? $data['themeName'] : $white_label_settings['astra']['name']; $white_label_settings['astra']['description'] = isset( $data['themeDescription'] ) ? $data['themeDescription'] : $white_label_settings['astra']['description']; $white_label_settings['astra']['screenshot'] = isset( $data['themeScreenshotURL'] ) ? $data['themeScreenshotURL'] : $white_label_settings['astra']['screenshot']; $white_label_settings['astra']['icon'] = isset( $data['themeIconURL'] ) ? $data['themeIconURL'] : $white_label_settings['astra']['icon']; $white_label_settings['astra-pro']['name'] = isset( $data['pluginName'] ) ? $data['pluginName'] : $white_label_settings['astra-pro']['name']; $white_label_settings['astra-pro']['description'] = isset( $data['pluginDescription'] ) ? $data['pluginDescription'] : $white_label_settings['astra-pro']['description']; $white_label_settings['astra-sites']['name'] = isset( $data['sTPluginName'] ) ? $data['sTPluginName'] : $white_label_settings['astra-sites']['name']; $white_label_settings['astra-sites']['description'] = isset( $data['sTPluginDescription'] ) ? $data['sTPluginDescription'] : $white_label_settings['astra-sites']['description']; } Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_white_label', $white_label_settings, true ); $theme_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra', 'name', 'astra' ); $response = array( 'rebranded_theme_name' => rawurlencode( $theme_name ), ); wp_send_json_success( $response ); }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |