コード例 #1
0
ファイル: admin.php プロジェクト: jamesvillarrubia/uniken-web
 public function load_form_page()
 {
     wp_enqueue_script('postbox');
     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 ($this->p->is_avail['util']['um']) {
                         $this->readme_info = array();
                         $ngfbum = NgfbUm::get_instance();
                         $ngfbum->update->check_for_updates(null, true, false);
                     } else {
                         $um_lca = $this->p->cf['lca'] . 'um';
                         $um_name = $this->p->cf['plugin'][$um_lca]['name'];
                         $this->p->notice->err('The <strong>' . $um_name . '</strong> extension plugin is required to check for plugin and extension updates.');
                     }
                     break;
                 case 'clear_all_cache':
                     $this->p->util->clear_all_cache();
                     break;
                 case 'clear_metabox_prefs':
                     NgfbUser::delete_metabox_prefs(get_current_user_id());
                     break;
                 case 'change_show_options':
                     if (isset($this->p->cf['form']['show_options'][$_GET['show_opts']])) {
                         NgfbUser::save_pref(array('show_opts' => $_GET['show_opts']));
                     }
                     break;
             }
         }
     }
     // the plugin information metabox on all settings pages needs this
     $this->p->admin->set_readme_info($this->p->cf['feed_cache_exp']);
     // 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->mods['util']['user']->reset_metabox_prefs($this->pagehook, array('purchase'), null, 'side', true);
     }
     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', __('Basic / Common Features', NGFB_TEXTDOM), array(&$this, 'show_metabox_status_gpl'), $this->pagehook, 'side');
     add_meta_box($this->pagehook . '_status_pro', __('Pro Version Features', NGFB_TEXTDOM), array(&$this, 'show_metabox_status_pro'), $this->pagehook, 'side');
     add_meta_box($this->pagehook . '_help', __('Help and Support', NGFB_TEXTDOM), array(&$this, 'show_metabox_help'), $this->pagehook, 'side');
 }
コード例 #2
0
ファイル: admin.php プロジェクト: leotaillard/btws2016
 public function load_setting_page()
 {
     $lca = $this->p->cf['lca'];
     $action_query = $lca . '-action';
     wp_enqueue_script('postbox');
     if (!empty($_GET[$action_query])) {
         $action_name = SucomUtil::sanitize_hookname($_GET[$action_query]);
         if (empty($_GET[NGFB_NONCE])) {
             if ($this->p->debug->enabled) {
                 $this->p->debug->log('nonce token validation query field missing');
             }
         } elseif (!wp_verify_nonce($_GET[NGFB_NONCE], self::get_nonce())) {
             $this->p->notice->err(__('Nonce token validation failed for action \\"' . $action_name . '\\".', 'nextgen-facebook'));
         } else {
             $_SERVER['REQUEST_URI'] = remove_query_arg(array($action_query, NGFB_NONCE));
             switch ($action_name) {
                 case 'check_for_updates':
                     if ($this->p->is_avail['util']['um']) {
                         self::$readme_info = array();
                         $ngfbum = NgfbUm::get_instance();
                         $ngfbum->update->check_for_updates(null, true, false);
                     } else {
                         $this->p->notice->err(sprintf(__('The <b>%s</b> extension is required to check for Pro version updates.', 'nextgen-facebook'), $this->p->cf['plugin'][$lca . 'um']['name']));
                     }
                     break;
                 case 'clear_all_cache':
                     $this->p->util->clear_all_cache();
                     break;
                 case 'clear_metabox_prefs':
                     $user_id = get_current_user_id();
                     $user = get_userdata($user_id);
                     //$user_name = trim( $user->first_name.' '.$user->last_name );
                     $user_name = $user->display_name;
                     NgfbUser::delete_metabox_prefs($user_id);
                     $this->p->notice->inf(sprintf(__('Metabox layout preferences for user ID #%d "%s" have been reset.', 'nextgen-facebook'), $user_id, $user_name));
                     break;
                 case 'clear_hidden_notices':
                     $user_id = get_current_user_id();
                     $user = get_userdata($user_id);
                     //$user_name = trim( $user->first_name.' '.$user->last_name );
                     $user_name = $user->display_name;
                     delete_user_option($user_id, NGFB_DISMISS_NAME);
                     $this->p->notice->inf(sprintf(__('Hidden notices for user ID #%d "%s" have been cleared.', 'nextgen-facebook'), $user_id, $user_name));
                     break;
                 case 'change_show_options':
                     if (isset($this->p->cf['form']['show_options'][$_GET['show-opts']])) {
                         $this->p->notice->inf(sprintf('Option preference saved &mdash; viewing "%s" by default.', $this->p->cf['form']['show_options'][$_GET['show-opts']]));
                         NgfbUser::save_pref(array('show_opts' => $_GET['show-opts']));
                     }
                     $_SERVER['REQUEST_URI'] = remove_query_arg(array('show-opts'));
                     break;
                 case 'modify_tmpl_head_elements':
                     $this->modify_tmpl_head_elements();
                     break;
                 default:
                     do_action($lca . '_load_setting_page_' . $action_name, $this->pagehook, $this->menu_id, $this->menu_name, $this->menu_lib);
                     break;
             }
         }
     }
     // the plugin information metabox on all settings pages needs this
     $this->p->admin->set_readme_info($this->p->cf['feed_cache_exp']);
     // 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_' . $lca . '_tid']) || !$this->p->check->aop($lca, true, $this->p->is_avail['aop'])) {
         add_meta_box($this->pagehook . '_purchase', _x('Pro / Power-User Version', 'metabox title (side)', 'nextgen-facebook'), array(&$this, 'show_metabox_purchase'), $this->pagehook, 'side');
         $this->p->mods['util']['user']->reset_metabox_prefs($this->pagehook, array('purchase'), null, 'side', true);
     }
     add_meta_box($this->pagehook . '_help', _x('Help and Support', 'metabox title (side)', 'nextgen-facebook'), array(&$this, 'show_metabox_help'), $this->pagehook, 'side');
     if ($this->menu_lib === 'submenu') {
         add_meta_box($this->pagehook . '_status_gpl', _x('Standard Features', 'metabox title (side)', 'nextgen-facebook'), array(&$this, 'show_metabox_status_gpl'), $this->pagehook, 'side');
         add_meta_box($this->pagehook . '_status_pro', _x('Pro Version Features', 'metabox title (side)', 'nextgen-facebook'), array(&$this, 'show_metabox_status_pro'), $this->pagehook, 'side');
     }
     if ($this->menu_lib === 'submenu' || $this->menu_lib === 'sitesubmenu') {
         add_meta_box($this->pagehook . '_version_info', _x('Version Information', 'metabox title (side)', 'nextgen-facebook'), array(&$this, 'show_metabox_version_info'), $this->pagehook, 'side');
     }
 }