コード例 #1
0
ファイル: register.php プロジェクト: christocmp/bingopaws
 private static function uninstall_plugin()
 {
     global $wpdb;
     $cf = WpssoConfig::get_config();
     $slug = $cf['plugin'][$cf['lca']]['slug'];
     $options = get_option($cf['lca'] . '_options');
     if (empty($options['plugin_preserve'])) {
         delete_option($cf['lca'] . '_options');
         delete_post_meta_by_key('_' . $cf['lca'] . '_meta');
         WpssoUser::delete_metabox_prefs();
     }
     // delete update related options
     delete_option('external_updates-' . $slug);
     delete_option($cf['lca'] . '_umsg');
     delete_option($cf['lca'] . '_utime');
     // delete stored admin notices
     foreach (array('nag', 'err', 'inf') as $type) {
         $msg_opt = $cf['lca'] . '_notices_' . $type;
         delete_option($msg_opt);
         foreach (get_users(array('meta_key' => $msg_opt)) as $user) {
             delete_user_option($user->ID, $msg_opt);
         }
     }
     // delete transients
     $dbquery = 'SELECT option_name FROM ' . $wpdb->options . ' WHERE option_name LIKE \'_transient_timeout_' . $cf['lca'] . '_%\';';
     $expired = $wpdb->get_col($dbquery);
     foreach ($expired as $transient) {
         $key = str_replace('_transient_timeout_', '', $transient);
         if (!empty($key)) {
             delete_transient($key);
         }
     }
 }
コード例 #2
0
ファイル: register.php プロジェクト: sonvq/passioninvestment
 private static function uninstall_plugin()
 {
     $var_const = WpssoConfig::get_variable_constants();
     $opts = get_option($var_const['WPSSO_OPTIONS_NAME'], array());
     delete_option($var_const['WPSSO_TS_NAME']);
     delete_option($var_const['WPSSO_NOTICE_NAME']);
     if (empty($opts['plugin_preserve'])) {
         delete_option($var_const['WPSSO_OPTIONS_NAME']);
         delete_post_meta_by_key($var_const['WPSSO_META_NAME']);
         foreach (get_users() as $user) {
             // site specific user options
             delete_user_option($user->ID, $var_const['WPSSO_NOTICE_NAME']);
             delete_user_option($user->ID, $var_const['WPSSO_DISMISS_NAME']);
             // global / network user options
             delete_user_meta($user->ID, $var_const['WPSSO_META_NAME']);
             delete_user_meta($user->ID, $var_const['WPSSO_PREF_NAME']);
             WpssoUser::delete_metabox_prefs($user->ID);
         }
         foreach (WpssoTaxonomy::get_public_terms() as $term_id) {
             WpssoTaxonomy::delete_term_meta($term_id, $var_const['WPSSO_META_NAME']);
         }
     }
     // delete transients
     global $wpdb;
     $dbquery = 'SELECT option_name FROM ' . $wpdb->options . ' WHERE option_name LIKE \'_transient_timeout_wpsso_%\';';
     $expired = $wpdb->get_col($dbquery);
     foreach ($expired as $transient) {
         $key = str_replace('_transient_timeout_', '', $transient);
         if (!empty($key)) {
             delete_transient($key);
         }
     }
 }
コード例 #3
0
ファイル: admin.php プロジェクト: christocmp/bingopaws
 public function load_form_page()
 {
     wp_enqueue_script('postbox');
     $upload_dir = wp_upload_dir();
     // returns assoc array with path info
     $user_opts = $this->p->addons['util']['user']->get_options();
     if (!empty($_GET['action'])) {
         if (empty($_GET[WPSSO_NONCE])) {
             $this->p->debug->log('Nonce token validation query field missing.');
         } elseif (!wp_verify_nonce($_GET[WPSSO_NONCE], $this->get_nonce())) {
             $this->p->notice->err(__('Nonce token validation failed for plugin action (action ignored).', WPSSO_TEXTDOM));
         } else {
             switch ($_GET['action']) {
                 case 'check_for_updates':
                     if (!empty($this->p->options['plugin_' . $this->p->cf['lca'] . '_tid'])) {
                         $this->readme_info = array();
                         $this->p->update->check_for_updates();
                         $this->p->notice->inf(__('Plugin update information has been checked and updated.', WPSSO_TEXTDOM));
                     }
                     break;
                 case 'clear_all_cache':
                     $deleted_cache = $this->p->util->delete_expired_file_cache(true);
                     $deleted_transient = $this->p->util->delete_expired_transients(true);
                     wp_cache_flush();
                     if (function_exists('w3tc_pgcache_flush')) {
                         w3tc_pgcache_flush();
                     } elseif (function_exists('wp_cache_clear_cache')) {
                         wp_cache_clear_cache();
                     }
                     $this->p->notice->inf(__('Cached files, WP object cache, transient cache, and any additional caches, ' . 'like APC, Memcache, Xcache, W3TC, Super Cache, etc. have all been cleared.', WPSSO_TEXTDOM));
                     break;
                 case 'clear_metabox_prefs':
                     WpssoUser::delete_metabox_prefs(get_current_user_id());
                     break;
                 case 'change_display_options':
                     if (isset($this->p->cf['form']['display_options'][$_GET['display_options']])) {
                         $this->p->options['plugin_display'] = $_GET['display_options'];
                     }
                     $this->p->opt->save_options(WPSSO_OPTIONS_NAME, $this->p->options);
                     break;
             }
         }
     }
     // the plugin information metabox on all settings pages needs this
     $this->p->admin->set_readme_info($this->feed_cache_expire());
     // add child metaboxes first, since they contain the default reset_metabox_prefs()
     $this->p->admin->submenu[$this->menu_id]->add_meta_boxes();
     if (empty($this->p->options['plugin_' . $this->p->cf['lca'] . '_tid']) || !$this->p->check->aop()) {
         add_meta_box($this->pagehook . '_purchase', __('Pro Version', WPSSO_TEXTDOM), array(&$this, 'show_metabox_purchase'), $this->pagehook, 'side');
         add_filter('postbox_classes_' . $this->pagehook . '_' . $this->pagehook . '_purchase', array(&$this, 'add_class_postbox_highlight_side'));
         $this->p->addons['util']['user']->reset_metabox_prefs($this->pagehook, array('purchase'), null, 'side', true);
     }
     add_meta_box($this->pagehook . '_help', __('Help and Support', WPSSO_TEXTDOM), array(&$this, 'show_metabox_help'), $this->pagehook, 'side');
     add_meta_box($this->pagehook . '_info', __('Version Information', WPSSO_TEXTDOM), array(&$this, 'show_metabox_info'), $this->pagehook, 'side');
     add_meta_box($this->pagehook . '_status', __('Plugin Features', WPSSO_TEXTDOM), array(&$this, 'show_metabox_status'), $this->pagehook, 'side');
 }
コード例 #4
0
 private static function uninstall_plugin()
 {
     $cf = WpssoConfig::get_config();
     if (!defined('WPSSO_OPTIONS_NAME')) {
         define('WPSSO_OPTIONS_NAME', $cf['lca'] . '_options');
     }
     if (!defined('WPSSO_META_NAME')) {
         define('WPSSO_META_NAME', '_' . $cf['lca'] . '_meta');
     }
     if (!defined('WPSSO_PREF_NAME')) {
         define('WPSSO_PREF_NAME', '_' . $cf['lca'] . '_pref');
     }
     $slug = $cf['plugin'][$cf['lca']]['slug'];
     $opts = get_option(WPSSO_OPTIONS_NAME);
     if (empty($opts['plugin_preserve'])) {
         delete_option(WPSSO_OPTIONS_NAME);
         delete_post_meta_by_key(WPSSO_META_NAME);
         foreach (array(WPSSO_META_NAME, WPSSO_PREF_NAME) as $meta_key) {
             foreach (get_users(array('meta_key' => $meta_key)) as $user) {
                 delete_user_option($user->ID, $meta_key);
                 WpssoUser::delete_metabox_prefs($user->ID);
             }
         }
         foreach (WpssoTaxonomy::get_public_terms() as $term_id) {
             WpssoTaxonomy::delete_term_meta($term_id, WPSSO_META_NAME);
         }
     }
     // delete transients
     global $wpdb;
     $dbquery = 'SELECT option_name FROM ' . $wpdb->options . ' WHERE option_name LIKE \'_transient_timeout_' . $cf['lca'] . '_%\';';
     $expired = $wpdb->get_col($dbquery);
     foreach ($expired as $transient) {
         $key = str_replace('_transient_timeout_', '', $transient);
         if (!empty($key)) {
             delete_transient($key);
         }
     }
 }
コード例 #5
0
ファイル: admin.php プロジェクト: sonvq/passioninvestment
 protected function get_submit_buttons($submit_text = '', $class = 'submit-buttons')
 {
     if (empty($submit_text)) {
         $submit_text = _x('Save All Plugin Settings', 'submit button', 'wpsso');
     }
     $show_opts_next = SucomUtil::next_key(WpssoUser::show_opts(), $this->p->cf['form']['show_options']);
     $show_opts_text = sprintf(_x('View %s by Default', 'submit button', 'wpsso'), _x($this->p->cf['form']['show_options'][$show_opts_next], 'option value', 'wpsso'));
     $show_opts_url = $this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=change_show_options&show-opts=' . $show_opts_next);
     $action_buttons = '<input type="submit" class="button-primary" value="' . $submit_text . '" />' . $this->form->get_button($show_opts_text, 'button-secondary button-highlight', null, wp_nonce_url($show_opts_url, self::get_nonce(), WPSSO_NONCE)) . '<br/>';
     if (empty($this->p->cf['*']['lib']['sitesubmenu'][$this->menu_id])) {
         // don't show on the network admin pages
         $action_buttons .= $this->form->get_button(_x('Clear All Cache(s)', 'submit button', 'wpsso'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=clear_all_cache'), self::get_nonce(), WPSSO_NONCE));
     }
     $action_buttons .= $this->form->get_button(_x('Check for Update(s)', 'submit button', 'wpsso'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=check_for_updates'), self::get_nonce(), WPSSO_NONCE), false, $this->p->is_avail['util']['um'] ? false : true);
     if (empty($this->p->cf['*']['lib']['sitesubmenu'][$this->menu_id])) {
         // don't show on the network admin pages
         $action_buttons .= $this->form->get_button(_x('Reset Metabox Layout', 'submit button', 'wpsso'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=clear_metabox_prefs'), self::get_nonce(), WPSSO_NONCE));
     }
     if (empty($this->p->cf['*']['lib']['sitesubmenu'][$this->menu_id])) {
         // don't show on the network admin pages
         $action_buttons .= $this->form->get_button(_x('Reset Hidden Notices', 'submit button', 'wpsso'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=clear_hidden_notices'), self::get_nonce(), WPSSO_NONCE));
     }
     return '<div class="' . $class . '">' . $action_buttons . '</div>';
 }
コード例 #6
0
 protected function get_submit_buttons($submit_text = '', $class = 'submit-buttons')
 {
     if (empty($submit_text)) {
         $submit_text = __('Save All Changes', WPSSO_TEXTDOM);
     }
     $show_opts_next = SucomUtil::next_key(WpssoUser::show_opts(), $this->p->cf['form']['show_options']);
     $show_opts_text = 'Prefer ' . $this->p->cf['form']['show_options'][$show_opts_next] . ' View';
     $show_opts_url = $this->p->util->get_admin_url('?action=change_show_options&show_opts=' . $show_opts_next);
     $action_buttons = '<input type="submit" class="button-primary" value="' . $submit_text . '" />' . $this->form->get_button($show_opts_text, 'button-secondary button-highlight', null, wp_nonce_url($show_opts_url, $this->get_nonce(), WPSSO_NONCE)) . '<br/>';
     if (empty($this->p->cf['*']['lib']['sitesubmenu'][$this->menu_id])) {
         // don't show on the network admin pages
         $action_buttons .= $this->form->get_button(__('Clear All Cache(s)', WPSSO_TEXTDOM), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?action=clear_all_cache'), $this->get_nonce(), WPSSO_NONCE));
     }
     $action_buttons .= $this->form->get_button(__('Check for Update(s)', WPSSO_TEXTDOM), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?action=check_for_updates'), $this->get_nonce(), WPSSO_NONCE), false, $this->p->is_avail['util']['um'] ? false : true);
     if (empty($this->p->cf['*']['lib']['sitesubmenu'][$this->menu_id])) {
         // don't show on the network admin pages
         $action_buttons .= $this->form->get_button(__('Reset Metabox Layout', WPSSO_TEXTDOM), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?action=clear_metabox_prefs'), $this->get_nonce(), WPSSO_NONCE));
     }
     return '<div class="' . $class . '">' . $action_buttons . '</div>';
 }