예제 #1
0
 /**
  * Make sure the needed scripts are loaded for admin pages
  */
 function init()
 {
     if (filter_input(INPUT_GET, 'YMBESEO_reset_defaults') && wp_verify_nonce(filter_input(INPUT_GET, 'nonce'), 'YMBESEO_reset_defaults') && current_user_can('manage_options')) {
         YMBESEO_Options::reset();
         wp_redirect(admin_url('admin.php?page=YMBESEO_dashboard'));
     }
     if (YMBESEO_Utils::grant_access()) {
         add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
         add_action('admin_enqueue_scripts', array($this, 'config_page_styles'));
     }
 }
예제 #2
0
 /**
  * Register (whitelist) the option for the configuration pages.
  * The validation callback is already registered separately on the sanitize_option hook,
  * so no need to double register.
  *
  * @return void
  */
 public function register_setting()
 {
     if (YMBESEO_Utils::grant_access()) {
         register_setting($this->group_name, $this->option_name);
     }
 }
 /**
  * Check whether the current user is allowed to access the configuration.
  *
  * @deprecated 1.5.6.1
  * @deprecated use YMBESEO_Utils::grant_access()
  * @see        YMBESEO_Utils::grant_access()
  *
  * @return boolean
  */
 public static function grant_access()
 {
     _deprecated_function(__METHOD__, 'WPSEO 1.5.6.1', 'YMBESEO_Utils::grant_access()');
     return YMBESEO_Utils::grant_access();
 }
예제 #4
0
 /**
  * Enqueues the (tiny) global JS needed for the plugin.
  */
 function config_page_scripts()
 {
     if (YMBESEO_Utils::grant_access()) {
         wp_enqueue_script('wpseo-admin-global-script', plugins_url('js/wp-seo-admin-global' . YMBESEO_CSSJS_SUFFIX . '.js', YMBESEO_FILE), array('jquery'), YMBESEO_VERSION, true);
     }
 }