Esempio n. 1
0
 public function handle_save_settings()
 {
     if (@$_POST && isset($_POST['option_page'])) {
         $changed = false;
         if ('essb_settings_group' == $this->getval($_POST, 'option_page')) {
             $this->update_optons();
             $this->update_fanscounter_options();
             $this->restore_settings();
             $this->apply_readymade();
             //$this->apply_import();
             $changed = true;
             if (class_exists('ESSBDynamicCache')) {
                 ESSBDynamicCache::flush();
             }
             if (class_exists('ESSBPrecompiledResources')) {
                 ESSBPrecompiledResources::flush();
             }
             if (function_exists('purge_essb_cache_static_cache')) {
                 purge_essb_cache_static_cache();
             }
         }
         if ($changed) {
             if (defined('ESSB3_SOCIALFANS_ACTIVE')) {
                 if (class_exists('ESSBSocialFollowersCounter')) {
                     essb_followers_counter()->settle_immediate_update();
                     $current_options = get_option(ESSB3_OPTIONS_NAME);
                     $fanscounter_clear_on_save = ESSBOptionValuesHelper::options_bool_value($current_options, 'fanscounter_clear_on_save');
                     if ($fanscounter_clear_on_save) {
                         essb_followers_counter()->clear_stored_values();
                         //print "clear active";
                     }
                 }
             }
             $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
             $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
             //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
             $goback = esc_url_raw(add_query_arg(array('settings-updated' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
             //$goback = str_replace('#038;', '', $goback);
             wp_redirect($goback);
             die;
         }
     }
     if (@$_REQUEST && isset($_REQUEST['import2x'])) {
         $this->apply_import();
         $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
         $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
         //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
         $goback = remove_query_arg('import2x');
         $goback = esc_url_raw(add_query_arg(array('settings-imported' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
         //$goback = str_replace('#038;', '', $goback);
         wp_redirect($goback);
         die;
     }
     if (@$_REQUEST && isset($_REQUEST['ready_style'])) {
         $this->apply_readymade();
         $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
         $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
         //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
         $goback = remove_query_arg('ready_style');
         $goback = esc_url_raw(add_query_arg(array('settings-imported' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
         //$goback = str_replace('#038;', '', $goback);
         wp_redirect($goback);
         die;
     }
 }
    printf('<div class="essb-information-box"><div class="icon"><i class="fa fa-gear"></i></div><div class="inner">%1$s</div></div>', __('Plugin settings are restored to default.' . $cache_plugin_message, ESSB3_TEXT_DOMAIN));
}
if ($is_cache_active) {
    $cache_clear_address = esc_url_raw(add_query_arg(array('purge-cache' => 'true'), wp_get_referer()));
    printf('<div class="essb-information-box"><div class="icon blue"><i class="fa fa-database"></i></div><div class="inner">%1$s: <b>%2$s</b><a href="%3$s" class="button float_right">%4$s</a></div></div>', __('Easy Social Share Buttons cache is running:', ESSB3_TEXT_DOMAIN), $display_cache_mode, $cache_clear_address, __('Purge Cache', ESSB3_TEXT_DOMAIN));
}
if ($general_precompiled_resources) {
    $cache_clear_address = esc_url_raw(add_query_arg(array('rebuild-resource' => 'true'), wp_get_referer()));
    printf('<div class="essb-information-box"><div class="icon blue"><i class="fa fa-history"></i></div><div class="inner"><b>%1$s</b><a href="%2$s" class="button float_right">%3$s</a></div></div>', __('Easy Social Share Buttons is using precompiled static resources', ESSB3_TEXT_DOMAIN), $cache_clear_address, __('Rebuild resources', ESSB3_TEXT_DOMAIN));
}
if ($backup == 'true') {
    printf('<div class="essb-information-box"><div class="icon"><i class="fa fa-gear"></i></div><div class="inner">%1$s</div></div>', __('Backup of your current settings is generated. Copy generated configuration string and save it on your computer. You can use it to restore settings or transfer them to other site.', ESSB3_TEXT_DOMAIN));
}
if ($purge_cache == 'true') {
    if (class_exists('ESSBDynamicCache')) {
        ESSBDynamicCache::flush();
    }
    if (function_exists('purge_essb_cache_static_cache')) {
        purge_essb_cache_static_cache();
    }
    printf('<div class="essb-information-box"><div class="icon"><i class="fa fa-info-circle"></i></div><div class="inner">%1$s</div></div>', __('Easy Social Share Buttons for WordPress Cache is purged!', ESSB3_TEXT_DOMAIN));
}
if ($rebuild_resource == "true") {
    if (class_exists('ESSBPrecompiledResources')) {
        ESSBPrecompiledResources::flush();
    }
}
if ($current_tab == "analytics") {
    $settings_url = esc_url_raw(get_admin_url() . 'admin.php?page=essb_options&tab=social&section=sharing&subsection=sharing-6');
    if (!ESSBOptionValuesHelper::is_active_module('ssanalytics')) {
        printf('<div class="essb-information-box"><div class="icon orange"><i class="fa fa-info-circle"></i></div><div class="inner">%1$s<a href="%2$s" class="button float_right">%3$s</a></div></div>', __('Statistics function in not activated!', ESSB3_TEXT_DOMAIN), $settings_url, __('Click here to go to settings and activte it', ESSB3_TEXT_DOMAIN));
Esempio n. 3
0
 public function handle_save_settings()
 {
     if (@$_POST && isset($_POST['option_page'])) {
         $changed = false;
         if ('essb_settings_group' == $this->getval($_POST, 'option_page')) {
             $this->update_optons();
             $this->update_fanscounter_options();
             $this->restore_settings();
             $this->apply_readymade();
             //$this->apply_import();
             $changed = true;
             if (class_exists('ESSBDynamicCache')) {
                 ESSBDynamicCache::flush();
             }
             if (function_exists('purge_essb_cache_static_cache')) {
                 purge_essb_cache_static_cache();
             }
         }
         if ($changed) {
             if (defined('ESSB3_SOCIALFANS_ACTIVE')) {
                 ESSBSocialFansCounter::clear_cached_data();
             }
             $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
             $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
             //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
             $goback = esc_url_raw(add_query_arg(array('settings-updated' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
             //$goback = str_replace('#038;', '', $goback);
             wp_redirect($goback);
             die;
         }
     }
     if (@$_REQUEST && isset($_REQUEST['import2x'])) {
         $this->apply_import();
         $user_section = isset($_REQUEST['section']) ? $_REQUEST['section'] : '';
         $user_subsection = isset($_REQUEST['subsection']) ? $_REQUEST['subsection'] : '';
         //$goback = add_query_arg ( 'settings-updated', 'true', wp_get_referer () );
         $goback = remove_query_arg('import2x');
         $goback = esc_url_raw(add_query_arg(array('settings-imported' => 'true', 'section' => $user_section, 'subsection' => $user_subsection), wp_get_referer()));
         //$goback = str_replace('#038;', '', $goback);
         wp_redirect($goback);
         die;
     }
 }