Esempio n. 1
0
 protected function get_submit_buttons($submit_text = '', $class = 'submit-buttons')
 {
     if (empty($submit_text)) {
         $submit_text = __('Save All Changes', NGFB_TEXTDOM);
     }
     $show_opts_next = SucomUtil::next_key(NgfbUser::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(), NGFB_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)', NGFB_TEXTDOM), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?action=clear_all_cache'), $this->get_nonce(), NGFB_NONCE));
     }
     $action_buttons .= $this->form->get_button(__('Check for Update(s)', NGFB_TEXTDOM), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?action=check_for_updates'), $this->get_nonce(), NGFB_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', NGFB_TEXTDOM), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?action=clear_metabox_prefs'), $this->get_nonce(), NGFB_NONCE));
     }
     return '<div class="' . $class . '">' . $action_buttons . '</div>';
 }
Esempio n. 2
0
 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[NGFB_NONCE])) {
             $this->p->debug->log('Nonce token validation query field missing.');
         } elseif (!wp_verify_nonce($_GET[NGFB_NONCE], $this->get_nonce())) {
             $this->p->notice->err(__('Nonce token validation failed for plugin action (action ignored).', NGFB_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(null, true);
                     }
                     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.', NGFB_TEXTDOM));
                     break;
                 case 'clear_metabox_prefs':
                     NgfbUser::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(NGFB_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', NGFB_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', NGFB_TEXTDOM), array(&$this, 'show_metabox_help'), $this->pagehook, 'side');
     add_meta_box($this->pagehook . '_info', __('Version Information', NGFB_TEXTDOM), array(&$this, 'show_metabox_info'), $this->pagehook, 'side');
     add_meta_box($this->pagehook . '_status_gpl', __('Standard Features', NGFB_TEXTDOM), array(&$this, 'show_metabox_status_gpl'), $this->pagehook, 'side');
     add_meta_box($this->pagehook . '_status_pro', __('Pro Features', NGFB_TEXTDOM), array(&$this, 'show_metabox_status_pro'), $this->pagehook, 'side');
 }
Esempio n. 3
0
 private static function uninstall_plugin()
 {
     global $wpdb;
     $cf = NgfbConfig::get_config();
     $options = get_option($cf['lca'] . '_options');
     if (empty($options['plugin_preserve'])) {
         delete_option($cf['lca'] . '_options');
         delete_post_meta_by_key('_' . $cf['lca'] . '_meta');
         NgfbUser::delete_metabox_prefs();
     }
     // delete update related options
     delete_option('external_updates-' . $cf['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);
         }
     }
 }
Esempio n. 4
0
 private static function uninstall_plugin()
 {
     $var_const = NgfbConfig::get_variable_constants();
     $opts = get_option($var_const['NGFB_OPTIONS_NAME'], array());
     delete_option($var_const['NGFB_TS_NAME']);
     delete_option($var_const['NGFB_NOTICE_NAME']);
     if (empty($opts['plugin_preserve'])) {
         delete_option($var_const['NGFB_OPTIONS_NAME']);
         delete_post_meta_by_key($var_const['NGFB_META_NAME']);
         foreach (get_users() as $user) {
             // site specific user options
             delete_user_option($user->ID, $var_const['NGFB_NOTICE_NAME']);
             delete_user_option($user->ID, $var_const['NGFB_DISMISS_NAME']);
             // global / network user options
             delete_user_meta($user->ID, $var_const['NGFB_META_NAME']);
             delete_user_meta($user->ID, $var_const['NGFB_PREF_NAME']);
             NgfbUser::delete_metabox_prefs($user->ID);
         }
         foreach (NgfbTaxonomy::get_public_terms() as $term_id) {
             NgfbTaxonomy::delete_term_meta($term_id, $var_const['NGFB_META_NAME']);
         }
     }
     // delete transients
     global $wpdb;
     $dbquery = 'SELECT option_name FROM ' . $wpdb->options . ' WHERE option_name LIKE \'_transient_timeout_ngfb_%\';';
     $expired = $wpdb->get_col($dbquery);
     foreach ($expired as $transient) {
         $key = str_replace('_transient_timeout_', '', $transient);
         if (!empty($key)) {
             delete_transient($key);
         }
     }
 }
Esempio n. 5
0
 public function add_class_postbox_website($classes)
 {
     $show_opts = NgfbUser::show_opts();
     $classes[] = 'postbox_website';
     if (!empty($show_opts)) {
         $classes[] = 'postbox_show_' . $show_opts;
     }
     return $classes;
 }
Esempio n. 6
0
 protected function get_submit_buttons($submit_text = '', $class = 'submit-buttons')
 {
     if (empty($submit_text)) {
         $submit_text = _x('Save All Plugin Settings', 'submit button', 'nextgen-facebook');
     }
     $show_opts_next = SucomUtil::next_key(NgfbUser::show_opts(), $this->p->cf['form']['show_options']);
     $show_opts_text = sprintf(_x('View %s by Default', 'submit button', 'nextgen-facebook'), _x($this->p->cf['form']['show_options'][$show_opts_next], 'option value', 'nextgen-facebook'));
     $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(), NGFB_NONCE)) . '<br/>';
     if ($this->menu_lib === 'setting' || $this->menu_lib === 'submenu') {
         $action_buttons .= $this->form->get_button(_x('Clear All Cache(s)', 'submit button', 'nextgen-facebook'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=clear_all_cache'), self::get_nonce(), NGFB_NONCE));
     }
     if ($this->menu_lib !== 'profile') {
         // don't show on profile pages
         $action_buttons .= $this->form->get_button(_x('Check for Pro Update(s)', 'submit button', 'nextgen-facebook'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=check_for_updates'), self::get_nonce(), NGFB_NONCE), false, $this->p->is_avail['util']['um'] ? false : true);
     }
     // disable button if um not available
     $action_buttons .= $this->form->get_button(_x('Reset Metabox Layout', 'submit button', 'nextgen-facebook'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=clear_metabox_prefs'), self::get_nonce(), NGFB_NONCE));
     $action_buttons .= $this->form->get_button(_x('Reset Hidden Notices', 'submit button', 'nextgen-facebook'), 'button-secondary', null, wp_nonce_url($this->p->util->get_admin_url('?' . $this->p->cf['lca'] . '-action=clear_hidden_notices'), self::get_nonce(), NGFB_NONCE));
     return '<div class="' . $class . '">' . $action_buttons . '</div>';
 }
Esempio n. 7
0
 private static function uninstall_plugin()
 {
     $cf = NgfbConfig::get_config();
     if (!defined('NGFB_OPTIONS_NAME')) {
         define('NGFB_OPTIONS_NAME', $cf['lca'] . '_options');
     }
     if (!defined('NGFB_META_NAME')) {
         define('NGFB_META_NAME', '_' . $cf['lca'] . '_meta');
     }
     if (!defined('NGFB_PREF_NAME')) {
         define('NGFB_PREF_NAME', '_' . $cf['lca'] . '_pref');
     }
     $slug = $cf['plugin'][$cf['lca']]['slug'];
     $opts = get_option(NGFB_OPTIONS_NAME);
     if (empty($opts['plugin_preserve'])) {
         delete_option(NGFB_OPTIONS_NAME);
         delete_post_meta_by_key(NGFB_META_NAME);
         foreach (array(NGFB_META_NAME, NGFB_PREF_NAME) as $meta_key) {
             foreach (get_users(array('meta_key' => $meta_key)) as $user) {
                 delete_user_option($user->ID, $meta_key);
                 NgfbUser::delete_metabox_prefs($user->ID);
             }
         }
         foreach (NgfbTaxonomy::get_public_terms() as $term_id) {
             NgfbTaxonomy::delete_term_meta($term_id, NGFB_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);
         }
     }
 }