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


PHP ApiBase::__construct方法代码示例

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


在下文中一共展示了ApiBase::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

 /**
  * @param $main ApiMain
  * @param $action string
  */
 public function __construct($main, $action)
 {
     parent::__construct($main, $action);
     // Allow custom modules to be added in LocalSettings.php
     global $wgAPIPropModules, $wgAPIListModules, $wgAPIMetaModules, $wgMemc, $wgAPICacheHelpTimeout;
     self::appendUserModules($this->mQueryPropModules, $wgAPIPropModules);
     self::appendUserModules($this->mQueryListModules, $wgAPIListModules);
     self::appendUserModules($this->mQueryMetaModules, $wgAPIMetaModules);
     $this->mPropModuleNames = array_keys($this->mQueryPropModules);
     $this->mListModuleNames = array_keys($this->mQueryListModules);
     $this->mMetaModuleNames = array_keys($this->mQueryMetaModules);
     // Get array of query generators from cache if present
     $key = wfMemcKey('apiquerygenerators', SpecialVersion::getVersion('nodb'));
     if ($wgAPICacheHelpTimeout > 0) {
         $cached = $wgMemc->get($key);
         if ($cached) {
             $this->mAllowedGenerators = $cached;
             return;
         }
     }
     $this->makeGeneratorList($this->mQueryPropModules);
     $this->makeGeneratorList($this->mQueryListModules);
     if ($wgAPICacheHelpTimeout > 0) {
         $wgMemc->set($key, $this->mAllowedGenerators, $wgAPICacheHelpTimeout);
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:30,代码来源:ApiQuery.php

示例3: __construct

 public function __construct(ApiMain $main, $name, Config $config)
 {
     parent::__construct($main, $name);
     $this->veConfig = $config;
     $this->serviceClient = new VirtualRESTServiceClient(new MultiHttpClient(array()));
     $this->serviceClient->mount('/restbase/', $this->getVRSObject());
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:7,代码来源:ApiVisualEditor.php

示例4: __construct

 /**
  * @param ApiMain $main
  */
 public function __construct(ApiMain $main)
 {
     parent::__construct($main, 'result');
     $this->mIsRawMode = false;
     $this->mCheckingSize = true;
     $this->reset();
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:10,代码来源:ApiResult.php

示例5: __construct

 /**
  * Constructs an instance of ApiMain that utilizes the module and format specified by $request.
  *
  * @param $request WebRequest - 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();
         }
     }
     global $wgAPIModules;
     // extension modules
     $this->mModules = $wgAPIModules + self::$Modules;
     $this->mModuleNames = array_keys($this->mModules);
     $this->mFormats = self::$Formats;
     $this->mFormatNames = array_keys($this->mFormats);
     $this->mResult = new ApiResult($this);
     $this->mShowVersions = false;
     $this->mEnableWrite = $enableWrite;
     $this->mRequest =& $request;
     $this->mSquidMaxage = -1;
     // flag for executeActionWithErrorHandling()
     $this->mCommit = false;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:37,代码来源:ApiMain.php

示例6: __construct

 public function __construct(ApiBase $query, $moduleName, $paramPrefix = '')
 {
     parent::__construct($query->getMain(), $moduleName, $paramPrefix);
     $this->mQueryModule = $query;
     $this->mDb = null;
     $this->resetQueryParams();
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:7,代码来源:ApiQueryBase.php

示例7: __construct

 public function __construct(ApiMain $main, $name)
 {
     global $wgContentTranslationParsoid;
     parent::__construct($main, $name);
     $this->serviceClient = new VirtualRESTServiceClient(new MultiHttpClient(array()));
     $parsoidConfig = $wgContentTranslationParsoid;
     $this->serviceClient->mount('/parsoid/', new ParsoidVirtualRESTService(array('URL' => $parsoidConfig['url'], 'prefix' => $parsoidConfig['prefix'], 'timeout' => $parsoidConfig['timeout'])));
 }
开发者ID:Wikia,项目名称:mediawiki-extensions-ContentTranslation,代码行数:8,代码来源:ApiContentTranslationPublish.php

示例8: __construct

 public function __construct($main, $action)
 {
     parent::__construct($main, $action);
     $this->mPropModuleNames = array_keys($this->mQueryPropModules);
     $this->mListModuleNames = array_keys($this->mQueryListModules);
     $this->mMetaModuleNames = array_keys($this->mQueryMetaModules);
     // Allow the entire list of modules at first,
     // but during module instantiation check if it can be used as a generator.
     $this->mAllowedGenerators = array_merge($this->mListModuleNames, $this->mPropModuleNames);
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:10,代码来源:ApiQuery.php

示例9: __construct

	/**
	 * Constructor
	 * @param $dbSource ApiBase Module implementing getDB().
	 *        Allows PageSet to reuse existing db connection from the shared state like ApiQuery.
	 * @param int $flags Zero or more flags like DISABLE_GENERATORS
	 * @param int $defaultNamespace the namespace to use if none is specified by a prefix.
	 * @since 1.21 accepts $flags instead of two boolean values
	 */
	public function __construct( ApiBase $dbSource, $flags = 0, $defaultNamespace = NS_MAIN ) {
		parent::__construct( $dbSource->getMain(), $dbSource->getModuleName() );
		$this->mDbSource = $dbSource;
		$this->mAllowGenerator = ( $flags & ApiPageSet::DISABLE_GENERATORS ) == 0;
		$this->mDefaultNamespace = $defaultNamespace;

		$this->profileIn();
		$this->mParams = $this->extractRequestParams();
		$this->mResolveRedirects = $this->mParams['redirects'];
		$this->mConvertTitles = $this->mParams['converttitles'];
		$this->profileOut();
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:20,代码来源:ApiPageSet.php

示例10: __construct

	/**
	 * Constructor
	 * If $format ends with 'fm', pretty-print the output in HTML.
	 * @param $main ApiMain
	 * @param string $format Format name
	 */
	public function __construct( $main, $format ) {
		parent::__construct( $main, $format );

		$this->mIsHtml = ( substr( $format, - 2, 2 ) === 'fm' ); // ends with 'fm'
		if ( $this->mIsHtml ) {
			$this->mFormat = substr( $format, 0, - 2 ); // remove ending 'fm'
		} else {
			$this->mFormat = $format;
		}
		$this->mFormat = strtoupper( $this->mFormat );
		$this->mCleared = false;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:18,代码来源:ApiFormatBase.php

示例11: __construct

 /**
  * Constructor
  */
 public function __construct($main, $format)
 {
     parent::__construct($main, $format);
     $this->mIsHtml = substr($format, -2, 2) === 'fm';
     // ends with 'fm'
     if ($this->mIsHtml) {
         $this->mFormat = substr($format, 0, -2);
     } else {
         $this->mFormat = $format;
     }
     $this->mFormat = strtoupper($this->mFormat);
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:15,代码来源:ApiFormatBase.php

示例12: __construct

 /**
  * Constructor
  * $apiStartTime - time of the originating call for profiling purposes
  * $modules - an array of actions (keys) and classes that handle them (values) 
  */
 public function __construct($apiStartTime, $modules, $formats, $enableWrite)
 {
     // Special handling for the main module: $parent === $this
     parent::__construct($this, 'main');
     $this->mModules = $modules;
     $this->mModuleNames = array_keys($modules);
     $this->mFormats = $formats;
     $this->mFormatNames = array_keys($formats);
     $this->mApiStartTime = $apiStartTime;
     $this->mResult = new ApiResult($this);
     $this->mShowVersions = false;
     $this->mEnableWrite = $enableWrite;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:18,代码来源:ApiMain.php

示例13: __construct

 public function __construct($main, $action)
 {
     parent::__construct($main, $action);
     // Allow custom modules to be added in LocalSettings.php
     global $wgAPIPropModules, $wgAPIListModules, $wgAPIMetaModules;
     self::appendUserModules($this->mQueryPropModules, $wgAPIPropModules);
     self::appendUserModules($this->mQueryListModules, $wgAPIListModules);
     self::appendUserModules($this->mQueryMetaModules, $wgAPIMetaModules);
     $this->mPropModuleNames = array_keys($this->mQueryPropModules);
     $this->mListModuleNames = array_keys($this->mQueryListModules);
     $this->mMetaModuleNames = array_keys($this->mQueryMetaModules);
     $this->makeHelpMsgHelper($this->mQueryPropModules, 'prop');
     $this->makeHelpMsgHelper($this->mQueryListModules, 'list');
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:14,代码来源:ApiQuery.php

示例14: __construct

 /**
  * @param $main ApiMain
  * @param $action string
  */
 public function __construct($main, $action)
 {
     parent::__construct($main, $action);
     // Allow custom modules to be added in LocalSettings.php
     global $wgAPIPropModules, $wgAPIListModules, $wgAPIMetaModules, $wgAPIGeneratorModules;
     self::appendUserModules($this->mQueryPropModules, $wgAPIPropModules);
     self::appendUserModules($this->mQueryListModules, $wgAPIListModules);
     self::appendUserModules($this->mQueryMetaModules, $wgAPIMetaModules);
     self::appendUserModules($this->mQueryGenerators, $wgAPIGeneratorModules);
     $this->mPropModuleNames = array_keys($this->mQueryPropModules);
     $this->mListModuleNames = array_keys($this->mQueryListModules);
     $this->mMetaModuleNames = array_keys($this->mQueryMetaModules);
     $this->mAllowedGenerators = array_keys($this->mQueryGenerators);
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:18,代码来源:ApiQuery.php

示例15: __construct

 /**
  * If $format ends with 'fm', pretty-print the output in HTML.
  * @param ApiMain $main
  * @param string $format Format name
  */
 public function __construct(ApiMain $main, $format)
 {
     parent::__construct($main, $format);
     $this->mIsHtml = substr($format, -2, 2) === 'fm';
     // ends with 'fm'
     if ($this->mIsHtml) {
         $this->mFormat = substr($format, 0, -2);
         // remove ending 'fm'
         $this->mIsWrappedHtml = $this->getMain()->getCheck('wrappedhtml');
     } else {
         $this->mFormat = $format;
     }
     $this->mFormat = strtoupper($this->mFormat);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:19,代码来源:ApiFormatBase.php


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