Пример #1
0
 function update()
 {
     $update_version = get_option('mainwp_child_update_version');
     if ($update_version === $this->update_version) {
         return;
     }
     if (false === $update_version) {
         $options = array('mainwp_child_legacy', 'mainwp_child_auth', 'mainwp_branding_ext_enabled', 'mainwp_child_uniqueId', 'mainwp_child_onetime_htaccess', 'mainwp_child_htaccess_set', 'mainwp_child_fix_htaccess', 'mainwp_child_pubkey', 'mainwp_child_server', 'mainwp_child_nonce', 'mainwp_child_nossl', 'mainwp_child_nossl_key', 'mainwp_child_remove_wp_version', 'mainwp_child_remove_rsd', 'mainwp_child_remove_wlw', 'mainwp_child_remove_core_updates', 'mainwp_child_remove_plugin_updates', 'mainwp_child_remove_theme_updates', 'mainwp_child_remove_php_reporting', 'mainwp_child_remove_scripts_version', 'mainwp_child_remove_styles_version', 'mainwp_child_remove_readme', 'heatMapEnabled', 'mainwp_child_clone_sites', 'mainwp_child_pluginDir', 'mainwp_premium_updates', 'mainwp_child_activated_once', 'mainwp_maintenance_opt_alert_404', 'mainwp_maintenance_opt_alert_404_email', 'mainwp_ext_code_snippets', 'mainwp_ext_snippets_enabled', 'mainwp_temp_clone_plugins', 'mainwp_temp_clone_themes', 'mainwp_child_click_data', 'mainwp_child_clone_from_server_last_folder', 'mainwp_child_clone_permalink', 'mainwp_child_restore_permalink', 'mainwp_keyword_links_htaccess_set', 'mainwp_kwl_options', 'mainwp_kwl_keyword_links', 'mainwp_kwl_click_statistic_data', 'mainwp_kwl_statistic_data_', 'mainwp_kwl_enable_statistic', 'mainwpKeywordLinks', 'mainwp_branding_ext_enabled', 'mainwp_branding_plugin_header', 'mainwp_branding_support_email', 'mainwp_branding_support_message', 'mainwp_branding_remove_restore', 'mainwp_branding_remove_setting', 'mainwp_branding_remove_wp_tools', 'mainwp_branding_remove_wp_setting', 'mainwp_branding_remove_permalink', 'mainwp_branding_button_contact_label', 'mainwp_branding_send_email_message', 'mainwp_branding_message_return_sender', 'mainwp_branding_submit_button_title', 'mainwp_branding_disable_wp_branding', 'mainwp_branding_extra_settings', 'mainwp_branding_child_hide', 'mainwp_branding_show_support', 'mainwp_branding_disable_change');
         foreach ($options as $option) {
             MainWP_Helper::fix_option($option);
         }
     } else {
         if (false === $update_version || '1.0' === $update_version || '1.1' === $update_version) {
             $options = array('mainwp_child_pubkey', 'mainwp_child_branding_disconnected', 'mainwp_branding_plugin_header', 'mainwp_child_update_version', 'mainwp_child_auth', 'mainwp_child_clone_permalink', 'mainwp_child_restore_permalink', 'mainwp_ext_snippets_enabled', 'mainwp_child_fix_htaccess', 'mainwp_child_pluginDir', 'mainwp_child_htaccess_set', 'heatMapEnabled', 'heatMapsIndividualOverrideSetting', 'heatMapExtensionLoaded', 'heatMapsIndividualDisable', 'mainwp_child_nossl', 'mainwp_updraftplus_ext_enabled', 'mainwpKeywordLinks', 'mainwp_keyword_links_htaccess_set', 'mainwp_branding_button_contact_label', 'mainwp_branding_extra_settings', 'mainwp_branding_ext_enabled', 'mainwp_creport_ext_branding_enabled', 'mainwp_pagespeed_ext_enabled', 'mainwp_linkschecker_ext_enabled', 'mainwp_wordfence_ext_enabled', 'mainwp_ithemes_ext_enabled', 'mainwp_maintenance_opt_alert_404');
             foreach ($options as $option) {
                 MainWP_Helper::fix_option($option, 'yes');
             }
             if (!is_array(get_option('mainwp_security'))) {
                 $securityOptions = array('wp_version' => 'mainwp_child_remove_wp_version', 'rsd' => 'mainwp_child_remove_rsd', 'wlw' => 'mainwp_child_remove_wlw', 'core_updates' => 'mainwp_child_remove_core_updates', 'plugin_updates' => 'mainwp_child_remove_plugin_updates', 'theme_updates' => 'mainwp_child_remove_theme_updates', 'php_reporting' => 'mainwp_child_remove_php_reporting', 'scripts_version' => 'mainwp_child_remove_scripts_version', 'styles_version' => 'mainwp_child_remove_styles_version', 'readme' => 'mainwp_child_remove_readme');
                 $security = array();
                 foreach ($securityOptions as $option => $old) {
                     $value = get_option($old);
                     $security[$option] = 'T' === $value;
                 }
                 MainWP_Helper::update_option('mainwp_security', $security, 'yes');
             }
         } else {
             if ($update_version == '1.2') {
                 MainWP_Child_Plugins_Check::Instance()->cleanup_deactivation(false);
                 MainWP_Child_Themes_Check::Instance()->cleanup_deactivation(false);
             }
         }
     }
     MainWP_Helper::update_option('mainwp_child_update_version', $this->update_version, 'yes');
 }