當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WPSEO_Options::grant_access方法代碼示例

本文整理匯總了PHP中WPSEO_Options::grant_access方法的典型用法代碼示例。如果您正苦於以下問題:PHP WPSEO_Options::grant_access方法的具體用法?PHP WPSEO_Options::grant_access怎麽用?PHP WPSEO_Options::grant_access使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WPSEO_Options的用法示例。


在下文中一共展示了WPSEO_Options::grant_access方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 /**
  * Make sure the needed scripts are loaded for admin pages
  */
 function init()
 {
     if (isset($_GET['wpseo_reset_defaults']) && wp_verify_nonce($_GET['nonce'], 'wpseo_reset_defaults') && current_user_can('manage_options')) {
         WPSEO_Options::reset();
         wp_redirect(admin_url('admin.php?page=wpseo_dashboard'));
     }
     $this->adminpages = apply_filters('wpseo_admin_pages', $this->adminpages);
     if (WPSEO_Options::grant_access()) {
         add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
         add_action('admin_enqueue_scripts', array($this, 'config_page_styles'));
     }
 }
開發者ID:johnreytepacia,項目名稱:etarticles,代碼行數:15,代碼來源:class-config.php

示例2: test_grant_access

 /**
  * @covers WPSEO_Options::grant_access
  */
 public function test_grant_access()
 {
     if (is_multisite()) {
         // should be true when not running multisite
         $this->assertTrue(WPSEO_Options::grant_access());
         return;
         // stop testing, not multisite
     }
     // admins should return true
     $user_id = $this->factory->user->create(array('role' => 'administrator'));
     wp_set_current_user($user_id);
     $this->assertTrue(WPSEO_Options::grant_access());
     // todo test for superadmins
     // editors should return false
     // $user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     // wp_set_current_user( $user_id );
     // $this->assertTrue( WPSEO_Options::grant_access() );
 }
開發者ID:michalvittek,項目名稱:wordpress-seo,代碼行數:21,代碼來源:test-class-wpseo-options.php

示例3: grant_access

 /**
  * Check whether the current user is allowed to access the configuration.
  *
  * @deprecated 1.5.0
  * @deprecated use WPSEO_Options::grant_access()
  * @see        WPSEO_Options::grant_access()
  *
  * @return boolean
  */
 function grant_access()
 {
     _deprecated_function(__METHOD__, 'WPSEO 1.5.0', 'WPSEO_Options::grant_access()');
     return WPSEO_Options::grant_access();
 }
開發者ID:CrankMaster336,項目名稱:FFW-TR,代碼行數:14,代碼來源:class-admin.php

示例4: register_setting

 /**
  * 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 (WPSEO_Options::grant_access()) {
         register_setting($this->group_name, $this->option_name);
     }
 }
開發者ID:johnreytepacia,項目名稱:etarticles,代碼行數:13,代碼來源:class-wpseo-options.php

示例5: register_setting

 /**
  * 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.
  *
  * @todo [JRF] if the extra bit below is no longer needed, move the if combined with a check
  * for $this->multisite_only to the abstract class
  *
  * @return void
  */
 public function register_setting()
 {
     if (function_exists('is_multisite') && is_multisite() && WPSEO_Options::grant_access()) {
         register_setting($this->group_name, $this->option_name);
     }
 }
開發者ID:donwea,項目名稱:nhap.org,代碼行數:16,代碼來源:class-wpseo-options.php


注:本文中的WPSEO_Options::grant_access方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。