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


PHP wfRunHooks函数代码示例

本文整理汇总了PHP中wfRunHooks函数的典型用法代码示例。如果您正苦于以下问题:PHP wfRunHooks函数的具体用法?PHP wfRunHooks怎么用?PHP wfRunHooks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: onSetupAfterCache

 public static function onSetupAfterCache()
 {
     global $wgUploadDirectory, $wgUploadBaseUrl, $wgUploadPath, $wgHashedUploadDirectory, $wgThumbnailScriptPath, $wgGenerateThumbnailOnParse, $wgLocalFileRepo, $wgDeletedDirectory;
     $wgLocalFileRepo = array('class' => 'WikiaLocalRepo', 'name' => 'local', 'directory' => $wgUploadDirectory, 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath, 'hashLevels' => $wgHashedUploadDirectory ? 2 : 0, 'thumbScriptUrl' => $wgThumbnailScriptPath, 'transformVia404' => !$wgGenerateThumbnailOnParse, 'deletedDir' => $wgDeletedDirectory, 'deletedHashLevels' => $wgLocalFileRepo['deletedHashLevels'], 'backend' => 'local-backend');
     wfRunHooks('AfterSetupLocalFileRepo', [&$wgLocalFileRepo]);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:VideoHandlerHooks.class.php

示例2: execute

 function execute($par)
 {
     global $wgRequest, $wgUser, $wgOut, $wgSessionStarted;
     if (!$wgSessionStarted) {
         $wgUser->SetupSession();
     }
     $this->setHeaders();
     if ($wgUser->getID() != 0) {
         $this->templateAlreadyLoggedIn();
         return;
     }
     $facebook = new Facebook(MEDIAWIKI_AUTHFACEBOOK_APIKEY, MEDIAWIKI_AUTHFACEBOOK_SECRET);
     if (!$facebook) {
         $wgOut->errorpage('authfacebookrror', 'authfacebookerrortext');
         return;
     }
     $auth_token = $wgRequest->getText('auth_token');
     if (!$auth_token) {
         $this->templateDefaultPage();
         return;
     }
     try {
         $session_response = $facebook->api_client->auth_getSession($auth_token);
     } catch (Exception $e) {
         $this->templateDefaultPage('There was an error, please refresh the page and try again.');
         error_log($e);
         return;
     }
     $session_key = $session_response['session_key'];
     $session_expires = $session_response['expires'];
     $fb_userid = $session_response['uid'];
     try {
         $userinfo_response = $facebook->api_client->users_getInfo(array($fb_userid), array('name'));
     } catch (Exception $e) {
         $this->templateDefaultPage('There was an error, please refresh the page and try again.');
         error_log($e);
         return;
     }
     $fb_username = $userinfo_response[0]['name'];
     $user = $this->getUserFromFB($fb_userid);
     if (isset($user)) {
         $this->updateUser($fb_userid, $session_key, $session_expires, $fb_username);
     } else {
         # For easy names
         $name = $this->createName($fb_username);
         if ($name) {
             $user = $this->createUser($fb_userid, $fb_username, $session_key, $session_expires);
         }
     }
     if (!isset($user)) {
         $wgOut->errorpage('authfacebookrror', 'authfacebookerrortext');
     } else {
         $wgUser = $user;
         $wgUser->SetupSession();
         $wgUser->SetCookies();
         wfRunHooks('UserLoginComplete', array(&$wgUser));
         $this->setLoginCookie($fb_userid, $session_expires);
         $this->templateLoggedInPage();
     }
 }
开发者ID:ngerakines,项目名称:facebook_application_development_wrox,代码行数:60,代码来源:AuthFacebook.class.php

示例3: buildData

 public function buildData()
 {
     global $wgUser, $wgTitle;
     $page = SpecialPageFactory::getPage($this->name);
     if (!is_object($page)) {
         $this->buildExternalData();
         // BugId:22989 - we don't want the PageLayoutBuilder to be shown if disabled.
         if ('LayoutBuilder' == $this->name) {
             // do not show PLB if it's not available on the wiki
             $this->available = $this->enabled;
         }
         return;
     }
     $this->available = true;
     $this->enabled = $page->userCanExecute($wgUser);
     $this->caption = $page->getDescription();
     $this->description = $page->getDescription();
     $this->href = $page->getTitle()->getLocalUrl();
     switch ($this->name) {
         case 'RecentChangesLinked':
             $this->href .= '/' . $wgTitle->getPartialUrl();
             break;
         case 'Contributions':
             $this->href .= '/' . $wgUser->getTitleKey();
             break;
     }
     $specialPageName = $page->getName();
     $options = array();
     wfRunHooks("UserCommand::SpecialPage::{$specialPageName}", array($this, &$options));
     foreach ($options as $k => $v) {
         $this->{$k} = $v;
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:SpecialPageUserCommand.php

示例4: ArticleCommentCheck

 public static function ArticleCommentCheck($title = null)
 {
     global $wgRequest, $wgUser;
     wfProfileIn(__METHOD__);
     if ($title === null) {
         global $wgTitle;
         $title = $wgTitle;
     }
     if (is_null(self::$enable) && !empty($title)) {
         self::$enable = self::ArticleCommentCheckTitle($title);
         if (self::$enable && !is_null($wgRequest->getVal('diff'))) {
             self::$enable = false;
         }
         $action = $wgRequest->getVal('action', 'view');
         if (self::$enable && $action == 'purge' && $wgUser->isAnon() && !$wgRequest->wasPosted()) {
             self::$enable = false;
         }
         if (self::$enable && $action != 'view' && $action != 'purge') {
             self::$enable = false;
         }
         if (self::$enable && !wfRunHooks('ArticleCommentCheck', array($title))) {
             self::$enable = false;
         }
     }
     wfProfileOut(__METHOD__);
     return self::$enable;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:ArticleCommentInit.class.php

示例5: format_position

 public static function format_position($aConfig, $sNewId)
 {
     $aReturn = "";
     if ($aConfig->navigation == 'right') {
         $aReturn[] = "#bs-application{position: relative;}";
         $aReturn[] = "#bs-content-column{margin: 0 302px 0 0;}";
         $aReturn[] = "#bs-nav-sections{right: 0; top: 30px;}";
         $aReturn[] = "#footer{margin: 0px 302px 5px 0px}";
     }
     if ($aConfig->content != 'center') {
         $aReturn[] = "#bs-wrapper{margin-" . $aConfig->content . ":0;}";
     }
     if ($aConfig->fullWidth == 0) {
         $aReturn[] = "#bs-menu-top{width:" . (int) $aConfig->width . "px;}";
         $aReturn[] = "#bs-application{width:" . (int) $aConfig->width . "px;}";
         $aReturn[] = "#bs-wrapper{width:" . (int) $aConfig->width . "px;min-width:" . (int) $aConfig->width . "px;}";
         //$aReturn[] = "#bs-tools-container{width:" . ((int) $aConfig->width - 200 + 28) . "px;margin-left:-" . ((int) $aConfig->width - 246) . "px}";
     } else {
         $aReturn[] = "#bs-menu-top{width:100%;}";
         $aReturn[] = "#bs-application{width:100%;}";
         $aReturn[] = "#bs-wrapper{width:100%;min-width:100%;}";
     }
     wfRunHooks("BSFlexiskinFormatterPosition", array(&$aConfig, &$aReturn));
     return implode(" \n", $aReturn);
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:25,代码来源:FlexiskinFormatter.class.php

示例6: getConfig

 protected function getConfig($context)
 {
     global $wgLoadScript;
     $vars = array('wgLoadScript' => $wgLoadScript, 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'wgUserLanguage' => $context->getLanguage());
     wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
     return $vars;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:7,代码来源:MwEmbedResourceLoaderStartUpModule.php

示例7: replaceSection

 /**
  * @see Content::replaceSection()
  */
 public function replaceSection($section, Content $with, $sectionTitle = '')
 {
     wfProfileIn(__METHOD__);
     $myModelId = $this->getModel();
     $sectionModelId = $with->getModel();
     if ($sectionModelId != $myModelId) {
         wfProfileOut(__METHOD__);
         throw new MWException("Incompatible content model for section: " . "document uses {$myModelId} but " . "section uses {$sectionModelId}.");
     }
     $oldtext = $this->getNativeData();
     $text = $with->getNativeData();
     if ($section === '') {
         wfProfileOut(__METHOD__);
         return $with;
         # XXX: copy first?
     }
     if ($section == 'new') {
         # Inserting a new section
         $subject = $sectionTitle ? wfMessage('newsectionheaderdefaultlevel')->rawParams($sectionTitle)->inContentLanguage()->text() . "\n\n" : '';
         if (wfRunHooks('PlaceNewSection', array($this, $oldtext, $subject, &$text))) {
             $text = strlen(trim($oldtext)) > 0 ? "{$oldtext}\n\n{$subject}{$text}" : "{$subject}{$text}";
         }
     } else {
         # Replacing an existing section; roll out the big guns
         global $wgParser;
         $text = $wgParser->replaceSection($oldtext, $section, $text);
     }
     $newContent = new WikitextContent($text);
     wfProfileOut(__METHOD__);
     return $newContent;
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:34,代码来源:WikitextContent.php

示例8: AssetsManagerEntryPoint

function AssetsManagerEntryPoint()
{
    global $wgRequest;
    AssetsManagerServer::serve($wgRequest);
    wfRunHooks('RestInPeace');
    exit;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:AssetsManager_setup.php

示例9: parseFormData

 protected function parseFormData()
 {
     global $wgRequest;
     wfRunHooks('BlogsAlternateEdit', array(false));
     $this->mFormData['postBody'] = $wgRequest->getVal('wpTextbox1');
     $this->mFormData['postTitle'] = $wgRequest->getVal('postTitle');
     $this->mFormData['postEditSummary'] = $wgRequest->getVal('wpSummary');
     $this->mFormData['postCategories'] = $wgRequest->getVal('wpCategoryTextarea1');
     $postBody = trim($this->mFormData['postBody']);
     if (empty($postBody)) {
         $this->mFormErrors[] = wfMsg('createpage_empty_article_body_error');
     }
     if (empty($this->mFormData['postTitle'])) {
         $this->mFormErrors[] = wfMsg('createpage_empty_title_error');
     } else {
         $oPostTitle = Title::newFromText($this->mFormData['postTitle'], NS_MAIN);
         if (!$oPostTitle instanceof Title) {
             $this->mFormErrors[] = wfMsg('createpage_invalid_title_error');
         } else {
             $sFragment = $oPostTitle->getFragment();
             if (strlen($sFragment) > 0) {
                 $this->mFormErrors[] = wfMsg('createpage_invalid_title_error');
             } else {
                 $this->mPostArticle = new Article($oPostTitle, 0);
                 if ($this->mPostArticle->exists()) {
                     $this->mFormErrors[] = wfMsg('createpage_article_already_exists');
                 }
             }
         }
     }
     parent::parseFormData();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:SpecialCreatePage.class.php

示例10: setupSkinUserCss

 /**
  * Loads skin and user CSS files.
  * @param OutputPage $out
  */
 function setupSkinUserCss(OutputPage $out)
 {
     parent::setupSkinUserCss($out);
     $styles = array('skins.libre.styles');
     wfRunHooks('SkinLibreStyleModules', array($this, &$styles));
     $out->addModuleStyles($styles);
 }
开发者ID:NessunKim,项目名称:MW_Skins,代码行数:11,代码来源:SkinLibre.php

示例11: updateData

 /**
  * Does update. First deletes, then inserts.
  * @param $data
  */
 function updateData(SMWSemanticData $data)
 {
     $export = SMWExporter::makeExportData($data);
     $sparqlDeleteText = "";
     $sparqlUpdateText = "INSERT DATA {\n";
     // let other extensions add additional RDF data for this page (i.e. Semantic Internal Objects)
     //this code is based on the modifications made on SemanticMediaWiki/includes/export/SMW_OWLExport.php
     $additionalDataArray = array();
     $fullexport = true;
     $backlinks = false;
     wfRunHooks('smwAddToRDFExport', array($data->getSubject()->getTitle(), &$additionalDataArray, $fullexport, $backlinks));
     // this writes update text for each of the Semantic Internal Objects
     foreach ($additionalDataArray as $additionalData) {
         $subject_uri = SMWExporter::expandURI($additionalData->getSubject()->getName());
         // remove subject from triple store
         $sparqlDeleteText .= $this->writeDeleteText($subject_uri);
         //add new data associated with internal objects
         $sparqlUpdateText .= $this->writeUpdateText($additionalData->getTripleList());
     }
     $subject_uri = SMWExporter::expandURI($export->getSubject()->getName());
     // remove subject from triple store
     $sparqlDeleteText .= $this->writeDeleteText($subject_uri);
     $triple_list = $export->getTripleList();
     $sparqlUpdateText .= $this->writeUpdateText($triple_list);
     $sparqlUpdateText .= "}";
     //delete the old triples
     wfDebugLog('SPARQL_LOG', "#===DELETE===\n" . $sparqlDeleteText);
     $response = $this->do_joseki_post($sparqlDeleteText);
     //insert the new triples
     wfDebugLog('SPARQL_LOG', "#===INSERT===\n" . $sparqlUpdateText);
     $response = $this->do_joseki_post($sparqlUpdateText);
     //can the delete and insert statements be combined, or will this lead to concurrency issues?
     return parent::updateData($data);
 }
开发者ID:alfredas,项目名称:SparqlExtension,代码行数:38,代码来源:JosekiStore.php

示例12: execute

 public function execute()
 {
     global $wgUser;
     $params = $this->extractRequestParams();
     $page = Title::newFromText($params['page']);
     if (!$page) {
         throw new MWApiGetMarkAsHelpfulItemInvalidPageException('Invalid page!');
     }
     // check if current user has permission to mark the item,
     $isAbleToMark = false;
     // check if the page has permission to request the item
     $isAbleToShow = false;
     wfRunHooks('onMarkItemAsHelpful', array($params['type'], $params['item'], $wgUser, &$isAbleToMark, $page, &$isAbleToShow));
     if ($isAbleToShow) {
         $HelpfulUserList = MarkAsHelpfulItem::getMarkAsHelpfulList($params['type'], $params['item']);
         if ($params['prop'] == 'metadata') {
             $data = $HelpfulUserList;
             $format = 'metadata';
         } else {
             $data = MarkAsHelpfulUtil::getMarkAsHelpfulTemplate($wgUser, $isAbleToMark, $HelpfulUserList, $params['type'], $params['item']);
             $format = 'formatted';
         }
     } else {
         $data = '';
         if ($params['prop'] == 'metadata') {
             $format = 'metadata';
         } else {
             $format = 'formatted';
         }
     }
     $result = array('result' => 'success', $format => $data);
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:ApiGetMarkAsHelpfulItem.php

示例13: addResources

 /**
  * AjaxAddScript hook
  * Adds scripts
  */
 public static function addResources($out)
 {
     global $wgExtensionAssetsPath, $wgJsMimeType;
     global $wgUsabilityInitiativeResourceMode;
     global $wgEnableJS2system, $wgEditToolbarRunTests;
     global $wgStyleVersion;
     wfRunHooks('UsabilityInitiativeLoadModules');
     if (!self::$doOutput) {
         return true;
     }
     // Default to raw
     $mode = $wgUsabilityInitiativeResourceMode;
     // Just an alias
     if (!isset(self::$scriptFiles['base_sets'][$mode])) {
         $mode = 'raw';
     }
     // Include base-set of scripts
     self::$scripts = array_merge(self::$scriptFiles['base_sets'][$mode], self::$scriptFiles['modules'][$mode], self::$scripts);
     // Provide enough support to make things work, even when js2 is not
     // in use (eventually it will be standard, but right now it's not)
     if (!$wgEnableJS2system) {
         $out->includeJQuery();
     }
     // Include base-set of styles
     self::$styles = array_merge(self::$styleFiles['base_sets'][$mode], self::$styles);
     if ($wgEditToolbarRunTests) {
         // Include client side tests
         self::$scripts = array_merge(self::$scripts, self::$scriptFiles['tests']);
     }
     // Loops over each script
     foreach (self::$scripts as $script) {
         // Add javascript to document
         if ($script['src'][0] == '/') {
             // Path is relative to $wgScriptPath
             global $wgScriptPath;
             $src = "{$wgScriptPath}{$script['src']}";
         } else {
             // Path is relative to $wgExtensionAssetsPath
             $src = "{$wgExtensionAssetsPath}/UsabilityInitiative/{$script['src']}";
         }
         $version = isset($script['version']) ? $script['version'] : $wgStyleVersion;
         $out->addScriptFile($src, $version);
     }
     // Transforms messages into javascript object members
     foreach (self::$messages as $i => $message) {
         $escapedMessageValue = Xml::escapeJsString(wfMsg($message));
         $escapedMessageKey = Xml::escapeJsString($message);
         self::$messages[$i] = "'{$escapedMessageKey}':'{$escapedMessageValue}'";
     }
     // Add javascript to document
     if (count(self::$messages) > 0) {
         $out->addScript(Xml::tags('script', array('type' => $wgJsMimeType), 'mw.usability.addMessages({' . implode(',', self::$messages) . '});'));
     }
     // Loops over each style
     foreach (self::$styles as $style) {
         // Add css for various styles
         $out->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $wgExtensionAssetsPath . "/UsabilityInitiative/" . "{$style['src']}?{$style['version']}"));
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:swahili-dict,代码行数:64,代码来源:UsabilityInitiative.hooks.php

示例14: getConfigSettings

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 protected function getConfigSettings($context)
 {
     $hash = $context->getHash();
     if (isset($this->configVars[$hash])) {
         return $this->configVars[$hash];
     }
     global $wgContLang;
     $mainPage = Title::newMainPage();
     /**
      * Namespace related preparation
      * - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
      * - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
      */
     $namespaceIds = $wgContLang->getNamespaceIds();
     $caseSensitiveNamespaces = array();
     foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
         $namespaceIds[$wgContLang->lc($name)] = $index;
         if (!MWNamespace::isCapitalized($index)) {
             $caseSensitiveNamespaces[] = $index;
         }
     }
     $conf = $this->getConfig();
     // Build list of variables
     $vars = array('wgLoadScript' => wfScript('load'), 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $conf->get('StylePath'), 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $conf->get('ArticlePath'), 'wgScriptPath' => $conf->get('ScriptPath'), 'wgScriptExtension' => $conf->get('ScriptExtension'), 'wgScript' => wfScript(), 'wgSearchType' => $conf->get('SearchType'), 'wgVariantArticlePath' => $conf->get('VariantArticlePath'), 'wgActionPaths' => (object) $conf->get('ActionPaths'), 'wgServer' => $conf->get('Server'), 'wgServerName' => $conf->get('ServerName'), 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgVersion' => $conf->get('Version'), 'wgEnableAPI' => $conf->get('EnableAPI'), 'wgEnableWriteAPI' => $conf->get('EnableWriteAPI'), 'wgMainPageTitle' => $mainPage->getPrefixedText(), 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgContentNamespaces' => MWNamespace::getContentNamespaces(), 'wgSiteName' => $conf->get('Sitename'), 'wgFileExtensions' => array_values(array_unique($conf->get('FileExtensions'))), 'wgDBname' => $conf->get('DBname'), 'wgFileCanRotate' => SpecialUpload::rotationEnabled(), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $conf->get('ExtensionAssetsPath'), 'wgCookiePrefix' => $conf->get('CookiePrefix'), 'wgCookieDomain' => $conf->get('CookieDomain'), 'wgCookiePath' => $conf->get('CookiePath'), 'wgCookieExpiration' => $conf->get('CookieExpiration'), 'wgResourceLoaderMaxQueryLength' => $conf->get('ResourceLoaderMaxQueryLength'), 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass(Title::legalChars()), 'wgResourceLoaderStorageVersion' => $conf->get('ResourceLoaderStorageVersion'), 'wgResourceLoaderStorageEnabled' => $conf->get('ResourceLoaderStorageEnabled'));
     wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
     $this->configVars[$hash] = $vars;
     return $this->configVars[$hash];
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:32,代码来源:ResourceLoaderStartUpModule.php

示例15: factory

 /**
  * @throws MWException
  * @param string $collationName
  * @return Collation
  */
 static function factory($collationName)
 {
     switch ($collationName) {
         case 'uppercase':
             return new UppercaseCollation();
         case 'identity':
             return new IdentityCollation();
         case 'uca-default':
             return new IcuCollation('root');
         case 'xx-uca-ckb':
             return new CollationCkb();
         case 'xx-uca-et':
             return new CollationEt();
         default:
             $match = array();
             if (preg_match('/^uca-([a-z@=-]+)$/', $collationName, $match)) {
                 return new IcuCollation($match[1]);
             }
             # Provide a mechanism for extensions to hook in.
             $collationObject = null;
             wfRunHooks('Collation::factory', array($collationName, &$collationObject));
             if ($collationObject instanceof Collation) {
                 return $collationObject;
             }
             // If all else fails...
             throw new MWException(__METHOD__ . ": unknown collation type \"{$collationName}\"");
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:33,代码来源:Collation.php


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