当前位置: 首页>>代码示例>>PHP>>正文


PHP ApiMain::Modules方法代码示例

本文整理汇总了PHP中ApiMain::Modules方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiMain::Modules方法的具体用法?PHP ApiMain::Modules怎么用?PHP ApiMain::Modules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ApiMain的用法示例。


在下文中一共展示了ApiMain::Modules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructs an instance of ApiMain that utilizes the module and format specified by $request.
  *
  * @param $request object - if this is an instance of FauxRequest, errors are thrown and no printing occurs
  * @param $enableWrite bool should be set to true if the api may modify data
  */
 public function __construct($request, $enableWrite = false)
 {
     $this->mInternalMode = $request instanceof FauxRequest;
     // Special handling for the main module: $parent === $this
     parent::__construct($this, $this->mInternalMode ? 'main_int' : 'main');
     if (!$this->mInternalMode) {
         // Impose module restrictions.
         // If the current user cannot read,
         // Remove all modules other than login
         global $wgUser;
         if (!$wgUser->isAllowed('read')) {
             self::$Modules = array('login' => self::$Modules['login'], 'help' => self::$Modules['help']);
         }
     }
     $this->mModules = self::$Modules;
     $this->mModuleNames = array_keys($this->mModules);
     // todo: optimize
     $this->mFormats = self::$Formats;
     $this->mFormatNames = array_keys($this->mFormats);
     // todo: optimize
     $this->mResult = new ApiResult($this);
     $this->mShowVersions = false;
     $this->mEnableWrite = $enableWrite;
     $this->mRequest =& $request;
     $this->mSquidMaxage = 0;
 }
开发者ID:mediawiki-extensions,项目名称:bizzwiki,代码行数:32,代码来源:ApiMain.php

示例2: __construct

 /**
  * Constructs an instance of ApiMain that utilizes the module and format specified by $request.
  *
  * @param $request object - if this is an instance of FauxRequest, errors are thrown and no printing occurs
  * @param $enableWrite bool should be set to true if the api may modify data
  */
 public function __construct($request, $enableWrite = false)
 {
     $this->mInternalMode = $request instanceof FauxRequest;
     // Special handling for the main module: $parent === $this
     parent::__construct($this, $this->mInternalMode ? 'main_int' : 'main');
     if (!$this->mInternalMode) {
         // Impose module restrictions.
         // If the current user cannot read,
         // Remove all modules other than login
         global $wgUser;
         if ($request->getVal('callback') !== null) {
             // JSON callback allows cross-site reads.
             // For safety, strip user credentials.
             wfDebug("API: stripping user credentials for JSON callback\n");
             $wgUser = new User();
         }
         if (!$wgUser->isAllowed('read')) {
             self::$Modules = array('login' => self::$Modules['login'], 'logout' => self::$Modules['logout'], 'help' => self::$Modules['help']);
         }
     }
     global $wgAPIModules, $wgEnableWriteAPI;
     // extension modules
     $this->mModules = $wgAPIModules + self::$Modules;
     if ($wgEnableWriteAPI) {
         $this->mModules += self::$WriteModules;
     }
     $this->mModuleNames = array_keys($this->mModules);
     // todo: optimize
     $this->mFormats = self::$Formats;
     $this->mFormatNames = array_keys($this->mFormats);
     // todo: optimize
     $this->mResult = new ApiResult($this);
     $this->mShowVersions = false;
     $this->mEnableWrite = $enableWrite;
     $this->mRequest =& $request;
     $this->mSquidMaxage = 0;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:43,代码来源:ApiMain.php


注:本文中的ApiMain::Modules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。