当前位置: 首页>>代码示例>>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;未经允许,请勿转载。