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


PHP Action::getActionName方法代码示例

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


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

示例1: addModules

 /**
  * Hook: BeforePageDisplay
  */
 public static function addModules(OutputPage $out, Skin $skin)
 {
     global $wgContentTranslationEventLogging, $wgContentTranslationCampaigns;
     $title = $out->getTitle();
     $user = $out->getUser();
     // Check if CX is available for current user.
     if (!self::isEnabledForUser($user)) {
         if (!$title->exists() && $wgContentTranslationCampaigns['newarticle'] && !$out->getRequest()->getCookie('cx_campaign_newarticle_hide', '') && !$user->isAnon()) {
             $out->addModules('ext.cx.campaigns.newarticle.veloader');
             if ($wgContentTranslationEventLogging) {
                 $out->addModules('ext.cx.eventlogging');
             }
         }
         return;
     }
     // If EventLogging integration is enabled, load the event logging functions module
     if ($wgContentTranslationEventLogging) {
         $out->addModules('ext.cx.eventlogging');
     }
     if ($title->inNamespace(NS_MAIN) && Action::getActionName($out->getContext()) === 'view' && $title->exists()) {
         $out->addModules('ext.cx.interlanguagelink');
     }
     // Add a hover menu for the contributions link in personal toolbar
     $out->addModules('ext.cx.campaigns.contributionsmenu');
     // The current guided tours are only for the user namespace,
     // so load the module only there.
     // In the future there may be guided tours in other namespaces,
     // and then this condition should be changed.
     if (class_exists('GuidedTourHooks') && $title->inNamespace(NS_USER)) {
         $out->addModules('ext.guidedTour');
     }
 }
开发者ID:Wikia,项目名称:mediawiki-extensions-ContentTranslation,代码行数:35,代码来源:ContentTranslation.hooks.php

示例2: onEndShowHeadElements

 public function onEndShowHeadElements(Action $action)
 {
     switch ($action->getActionName()) {
         case 'attachment':
             $action->element('link', array('rel' => 'alternate', 'type' => 'application/json+oembed', 'href' => common_local_url('oembed', array(), array('format' => 'json', 'url' => common_local_url('attachment', array('attachment' => $action->attachment->id)))), 'title' => 'oEmbed'), null);
             $action->element('link', array('rel' => 'alternate', 'type' => 'text/xml+oembed', 'href' => common_local_url('oembed', array(), array('format' => 'xml', 'url' => common_local_url('attachment', array('attachment' => $action->attachment->id)))), 'title' => 'oEmbed'), null);
             break;
         case 'shownotice':
             try {
                 $action->element('link', array('rel' => 'alternate', 'type' => 'application/json+oembed', 'href' => common_local_url('oembed', array(), array('format' => 'json', 'url' => $action->notice->getUrl())), 'title' => 'oEmbed'), null);
                 $action->element('link', array('rel' => 'alternate', 'type' => 'text/xml+oembed', 'href' => common_local_url('oembed', array(), array('format' => 'xml', 'url' => $action->notice->getUrl())), 'title' => 'oEmbed'), null);
             } catch (InvalidUrlException $e) {
                 // The notice is probably a share or similar, which don't
                 // have a representational URL of their own.
             }
             break;
     }
     return true;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:19,代码来源:OembedPlugin.php

示例3: getHeadLinksArray


//.........这里部分代码省略.........
     }
     # OpenSearch description link
     $tags['opensearch'] = Html::element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml', 'href' => wfScript('opensearch_desc'), 'title' => $this->msg('opensearch-desc')->inContentLanguage()->text()));
     if ($config->get('EnableAPI')) {
         # Real Simple Discovery link, provides auto-discovery information
         # for the MediaWiki API (and potentially additional custom API
         # support such as WordPress or Twitter-compatible APIs for a
         # blogging extension, etc)
         $tags['rsd'] = Html::element('link', array('rel' => 'EditURI', 'type' => 'application/rsd+xml', 'href' => wfExpandUrl(wfAppendQuery(wfScript('api'), array('action' => 'rsd')), PROTO_RELATIVE)));
     }
     # Language variants
     if (!$config->get('DisableLangConversion')) {
         $lang = $this->getTitle()->getPageLanguage();
         if ($lang->hasVariants()) {
             $variants = $lang->getVariants();
             foreach ($variants as $_v) {
                 $tags["variant-{$_v}"] = Html::element('link', array('rel' => 'alternate', 'hreflang' => wfBCP47($_v), 'href' => $this->getTitle()->getLocalURL(array('variant' => $_v))));
             }
         }
         # x-default link per https://support.google.com/webmasters/answer/189077?hl=en
         $tags["variant-x-default"] = Html::element('link', array('rel' => 'alternate', 'hreflang' => 'x-default', 'href' => $this->getTitle()->getLocalURL()));
     }
     # Copyright
     if ($this->copyrightUrl !== null) {
         $copyright = $this->copyrightUrl;
     } else {
         $copyright = '';
         if ($config->get('RightsPage')) {
             $copy = Title::newFromText($config->get('RightsPage'));
             if ($copy) {
                 $copyright = $copy->getLocalURL();
             }
         }
         if (!$copyright && $config->get('RightsUrl')) {
             $copyright = $config->get('RightsUrl');
         }
     }
     if ($copyright) {
         $tags['copyright'] = Html::element('link', array('rel' => 'copyright', 'href' => $copyright));
     }
     # Feeds
     if ($config->get('Feed')) {
         foreach ($this->getSyndicationLinks() as $format => $link) {
             # Use the page name for the title.  In principle, this could
             # lead to issues with having the same name for different feeds
             # corresponding to the same page, but we can't avoid that at
             # this low a level.
             $tags[] = $this->feedLink($format, $link, $this->msg("page-{$format}-feed", $this->getTitle()->getPrefixedText())->text());
         }
         # Recent changes feed should appear on every page (except recentchanges,
         # that would be redundant). Put it after the per-page feed to avoid
         # changing existing behavior. It's still available, probably via a
         # menu in your browser. Some sites might have a different feed they'd
         # like to promote instead of the RC feed (maybe like a "Recent New Articles"
         # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
         # If so, use it instead.
         $sitename = $config->get('Sitename');
         if ($config->get('OverrideSiteFeed')) {
             foreach ($config->get('OverrideSiteFeed') as $type => $feedUrl) {
                 // Note, this->feedLink escapes the url.
                 $tags[] = $this->feedLink($type, $feedUrl, $this->msg("site-{$type}-feed", $sitename)->text());
             }
         } elseif (!$this->getTitle()->isSpecial('Recentchanges')) {
             $rctitle = SpecialPage::getTitleFor('Recentchanges');
             foreach ($config->get('AdvertisedFeedTypes') as $format) {
                 $tags[] = $this->feedLink($format, $rctitle->getLocalURL(array('feed' => $format)), $this->msg("site-{$format}-feed", $sitename)->text());
             }
         }
     }
     # Canonical URL
     if ($config->get('EnableCanonicalServerLink')) {
         if ($canonicalUrl !== false) {
             $canonicalUrl = wfExpandUrl($canonicalUrl, PROTO_CANONICAL);
         } else {
             if ($this->isArticleRelated()) {
                 // This affects all requests where "setArticleRelated" is true. This is
                 // typically all requests that show content (query title, curid, oldid, diff),
                 // and all wikipage actions (edit, delete, purge, info, history etc.).
                 // It does not apply to File pages and Special pages.
                 // 'history' and 'info' actions address page metadata rather than the page
                 // content itself, so they may not be canonicalized to the view page url.
                 // TODO: this ought to be better encapsulated in the Action class.
                 $action = Action::getActionName($this->getContext());
                 if (in_array($action, array('history', 'info'))) {
                     $query = "action={$action}";
                 } else {
                     $query = '';
                 }
                 $canonicalUrl = $this->getTitle()->getCanonicalURL($query);
             } else {
                 $reqUrl = $this->getRequest()->getRequestURL();
                 $canonicalUrl = wfExpandUrl($reqUrl, PROTO_CANONICAL);
             }
         }
     }
     if ($canonicalUrl !== false) {
         $tags[] = Html::element('link', array('rel' => 'canonical', 'href' => $canonicalUrl));
     }
     return $tags;
 }
开发者ID:GoProjectOwner,项目名称:mediawiki,代码行数:101,代码来源:OutputPage.php

示例4: getJSVars

 /**
  * Get an array containing the variables to be set in mw.config in JavaScript.
  *
  * DO NOT CALL THIS FROM OUTSIDE OF THIS CLASS OR Skin::makeGlobalVariablesScript().
  * This is only public until that function is removed. You have been warned.
  *
  * Do not add things here which can be evaluated in ResourceLoaderStartUpModule
  * - in other words, page-independent/site-wide variables (without state).
  * You will only be adding bloat to the html page and causing page caches to
  * have to be purged on configuration changes.
  * @return array
  */
 public function getJSVars()
 {
     global $wgContLang;
     $curRevisionId = 0;
     $articleId = 0;
     $canonicalSpecialPageName = false;
     # bug 21115
     $title = $this->getTitle();
     $ns = $title->getNamespace();
     $canonicalNamespace = MWNamespace::exists($ns) ? MWNamespace::getCanonicalName($ns) : $title->getNsText();
     $sk = $this->getSkin();
     // Get the relevant title so that AJAX features can use the correct page name
     // when making API requests from certain special pages (bug 34972).
     $relevantTitle = $sk->getRelevantTitle();
     $relevantUser = $sk->getRelevantUser();
     if ($ns == NS_SPECIAL) {
         list($canonicalSpecialPageName, ) = SpecialPageFactory::resolveAlias($title->getDBkey());
     } elseif ($this->canUseWikiPage()) {
         $wikiPage = $this->getWikiPage();
         $curRevisionId = $wikiPage->getLatest();
         $articleId = $wikiPage->getId();
     }
     $lang = $title->getPageLanguage();
     // Pre-process information
     $separatorTransTable = $lang->separatorTransformTable();
     $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
     $compactSeparatorTransTable = array(implode("\t", array_keys($separatorTransTable)), implode("\t", $separatorTransTable));
     $digitTransTable = $lang->digitTransformTable();
     $digitTransTable = $digitTransTable ? $digitTransTable : array();
     $compactDigitTransTable = array(implode("\t", array_keys($digitTransTable)), implode("\t", $digitTransTable));
     $user = $this->getUser();
     $vars = array('wgCanonicalNamespace' => $canonicalNamespace, 'wgCanonicalSpecialPageName' => $canonicalSpecialPageName, 'wgNamespaceNumber' => $title->getNamespace(), 'wgPageName' => $title->getPrefixedDBkey(), 'wgTitle' => $title->getText(), 'wgCurRevisionId' => $curRevisionId, 'wgRevisionId' => (int) $this->getRevisionId(), 'wgArticleId' => $articleId, 'wgIsArticle' => $this->isArticle(), 'wgIsRedirect' => $title->isRedirect(), 'wgAction' => Action::getActionName($this->getContext()), 'wgUserName' => $user->isAnon() ? null : $user->getName(), 'wgUserGroups' => $user->getEffectiveGroups(), 'wgCategories' => $this->getCategories(), 'wgBreakFrames' => $this->getFrameOptions() == 'DENY', 'wgPageContentLanguage' => $lang->getCode(), 'wgPageContentModel' => $title->getContentModel(), 'wgSeparatorTransformTable' => $compactSeparatorTransTable, 'wgDigitTransformTable' => $compactDigitTransTable, 'wgDefaultDateFormat' => $lang->getDefaultDateFormat(), 'wgMonthNames' => $lang->getMonthNamesArray(), 'wgMonthNamesShort' => $lang->getMonthAbbreviationsArray(), 'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey());
     if ($user->isLoggedIn()) {
         $vars['wgUserId'] = $user->getId();
         $vars['wgUserEditCount'] = $user->getEditCount();
         $userReg = wfTimestampOrNull(TS_UNIX, $user->getRegistration());
         $vars['wgUserRegistration'] = $userReg !== null ? $userReg * 1000 : null;
         // Get the revision ID of the oldest new message on the user's talk
         // page. This can be used for constructing new message alerts on
         // the client side.
         $vars['wgUserNewMsgRevisionId'] = $user->getNewMessageRevisionId();
     }
     if ($wgContLang->hasVariants()) {
         $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
     }
     // Same test as SkinTemplate
     $vars['wgIsProbablyEditable'] = $title->quickUserCan('edit', $user) && ($title->exists() || $title->quickUserCan('create', $user));
     foreach ($title->getRestrictionTypes() as $type) {
         $vars['wgRestriction' . ucfirst($type)] = $title->getRestrictions($type);
     }
     if ($title->isMainPage()) {
         $vars['wgIsMainPage'] = true;
     }
     if ($this->mRedirectedFrom) {
         $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
     }
     if ($relevantUser) {
         $vars['wgRelevantUserName'] = $relevantUser->getName();
     }
     // Allow extensions to add their custom variables to the mw.config map.
     // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
     // page-dependant but site-wide (without state).
     // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
     wfRunHooks('MakeGlobalVariablesScript', array(&$vars, $this));
     // Merge in variables from addJsConfigVars last
     return array_merge($vars, $this->getJsConfigVars());
 }
开发者ID:spring,项目名称:spring-website,代码行数:79,代码来源:OutputPage.php

示例5: getAction

 /**
  * Returns the name of the action that will be executed.
  *
  * @return string: action
  */
 public function getAction()
 {
     static $action = null;
     if ($action === null) {
         $action = Action::getActionName($this->context);
     }
     return $action;
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:13,代码来源:Wiki.php

示例6: buildContentNavigationUrls


//.........这里部分代码省略.........
                 // article doesn't exist or is deleted
                 if ($user->isAllowed('deletedhistory')) {
                     $n = $title->isDeleted();
                     if ($n) {
                         $undelTitle = SpecialPage::getTitleFor('Undelete', $title->getPrefixedDBkey());
                         // If the user can't undelete but can view deleted
                         // history show them a "View .. deleted" tab instead.
                         $msgKey = $user->isAllowed('undelete') ? 'undelete' : 'viewdeleted';
                         $content_navigation['actions']['undelete'] = array('class' => $this->getTitle()->isSpecial('Undelete') ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-{$msgKey}", "{$msgKey}_short")->setContext($this->getContext())->numParams($n)->text(), 'href' => $undelTitle->getLocalURL());
                     }
                 }
             }
             if ($title->quickUserCan('protect', $user) && $title->getRestrictionTypes() && MWNamespace::getRestrictionLevels($title->getNamespace(), $user) !== array('')) {
                 $mode = $title->isProtected() ? 'unprotect' : 'protect';
                 $content_navigation['actions'][$mode] = array('class' => $onPage && $action == $mode ? 'selected' : false, 'text' => wfMessageFallback("{$skname}-action-{$mode}", $mode)->setContext($this->getContext())->text(), 'href' => $title->getLocalURL("action={$mode}"));
             }
             // Checks if the user is logged in
             if ($this->loggedin && $user->isAllowedAll('viewmywatchlist', 'editmywatchlist')) {
                 /**
                  * The following actions use messages which, if made particular to
                  * the any specific skins, would break the Ajax code which makes this
                  * action happen entirely inline. OutputPage::getJSVars
                  * defines a set of messages in a javascript object - and these
                  * messages are assumed to be global for all skins. Without making
                  * a change to that procedure these messages will have to remain as
                  * the global versions.
                  */
                 $mode = $user->isWatched($title) ? 'unwatch' : 'watch';
                 $token = WatchAction::getWatchToken($title, $user, $mode);
                 $content_navigation['actions'][$mode] = array('class' => $onPage && ($action == 'watch' || $action == 'unwatch') ? 'selected' : false, 'text' => $this->msg($mode)->text(), 'href' => $title->getLocalURL(array('action' => $mode, 'token' => $token)));
             }
         }
         Hooks::run('SkinTemplateNavigation', array(&$this, &$content_navigation));
         if ($userCanRead && !$wgDisableLangConversion) {
             $pageLang = $title->getPageLanguage();
             // Gets list of language variants
             $variants = $pageLang->getVariants();
             // Checks that language conversion is enabled and variants exist
             // And if it is not in the special namespace
             if (count($variants) > 1) {
                 // Gets preferred variant (note that user preference is
                 // only possible for wiki content language variant)
                 $preferred = $pageLang->getPreferredVariant();
                 if (Action::getActionName($this) === 'view') {
                     $params = $request->getQueryValues();
                     unset($params['title']);
                 } else {
                     $params = array();
                 }
                 // Loops over each variant
                 foreach ($variants as $code) {
                     // Gets variant name from language code
                     $varname = $pageLang->getVariantname($code);
                     // Appends variant link
                     $content_navigation['variants'][] = array('class' => $code == $preferred ? 'selected' : false, 'text' => $varname, 'href' => $title->getLocalURL(array('variant' => $code) + $params), 'lang' => wfBCP47($code), 'hreflang' => wfBCP47($code));
                 }
             }
         }
     } else {
         // If it's not content, it's got to be a special page
         $content_navigation['namespaces']['special'] = array('class' => 'selected', 'text' => $this->msg('nstab-special')->text(), 'href' => $request->getRequestURL(), 'context' => 'subject');
         Hooks::run('SkinTemplateNavigation::SpecialPage', array(&$this, &$content_navigation));
     }
     // Equiv to SkinTemplateContentActions
     Hooks::run('SkinTemplateNavigation::Universal', array(&$this, &$content_navigation));
     // Setup xml ids and tooltip info
     foreach ($content_navigation as $section => &$links) {
         foreach ($links as $key => &$link) {
             $xmlID = $key;
             if (isset($link['context']) && $link['context'] == 'subject') {
                 $xmlID = 'ca-nstab-' . $xmlID;
             } elseif (isset($link['context']) && $link['context'] == 'talk') {
                 $xmlID = 'ca-talk';
             } elseif ($section == 'variants') {
                 $xmlID = 'ca-varlang-' . $xmlID;
             } else {
                 $xmlID = 'ca-' . $xmlID;
             }
             $link['id'] = $xmlID;
         }
     }
     # We don't want to give the watch tab an accesskey if the
     # page is being edited, because that conflicts with the
     # accesskey on the watch checkbox.  We also don't want to
     # give the edit tab an accesskey, because that's fairly
     # superfluous and conflicts with an accesskey (Ctrl-E) often
     # used for editing in Safari.
     if (in_array($action, array('edit', 'submit'))) {
         if (isset($content_navigation['views']['edit'])) {
             $content_navigation['views']['edit']['tooltiponly'] = true;
         }
         if (isset($content_navigation['actions']['watch'])) {
             $content_navigation['actions']['watch']['tooltiponly'] = true;
         }
         if (isset($content_navigation['actions']['unwatch'])) {
             $content_navigation['actions']['unwatch']['tooltiponly'] = true;
         }
     }
     return $content_navigation;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:101,代码来源:SkinTemplate.php

示例7: addHelpLink

 /**
  * Adds help link with an icon via page indicators.
  * Link target can be overridden by a local message containing a wikilink:
  * the message key is: lowercase action name + '-helppage'.
  * @param string $to Target MediaWiki.org page title or encoded URL.
  * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o.
  * @since 1.25
  */
 public function addHelpLink($to, $overrideBaseUrl = false)
 {
     global $wgContLang;
     $msg = wfMessage($wgContLang->lc(Action::getActionName($this->getContext())) . '-helppage');
     if (!$msg->isDisabled()) {
         $helpUrl = Skin::makeUrl($msg->plain());
         $this->getOutput()->addHelpLink($helpUrl, true);
     } else {
         $this->getOutput()->addHelpLink($to, $overrideBaseUrl);
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:19,代码来源:Action.php

示例8: getAction

 /**
  * Returns the name of the action that will be executed.
  *
  * @return string Action
  */
 public function getAction()
 {
     if ($this->action === null) {
         $this->action = Action::getActionName($this->context);
     }
     return $this->action;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:12,代码来源:MediaWiki.php

示例9: getHistoryLinkHtml

 /**
  * Returns the 'Last edited' message, e.g. 'Last edited on...'
  * @param array $data Data used to build the page
  * @return string
  */
 protected function getHistoryLinkHtml($data)
 {
     $action = Action::getActionName(RequestContext::getMain());
     if (isset($data['historyLink']) && $action === 'view') {
         $historyLink = $data['historyLink'];
         $args = array('isMainPage' => $this->getSkin()->getTitle()->isMainPage(), 'link' => $historyLink['href'], 'text' => $historyLink['text'], 'username' => $historyLink['data-user-name'], 'userGender' => $historyLink['data-user-gender'], 'timestamp' => $historyLink['data-timestamp']);
         $templateParser = new TemplateParser(__DIR__);
         return $templateParser->processTemplate('history', $args);
     } else {
         return '';
     }
 }
开发者ID:paladox,项目名称:mediawiki-extensions-MobileFrontend,代码行数:17,代码来源:MinervaTemplate.php

示例10: testDisabledAction_isNotResolved

 public function testDisabledAction_isNotResolved()
 {
     $context = $this->getContext('disabled');
     $actionName = Action::getActionName($context);
     $this->assertEquals('nosuchaction', $actionName);
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:6,代码来源:ActionTest.php

示例11: manuscriptIsInViewMode

 private function manuscriptIsInViewMode(OutputPage $out)
 {
     $context = $out->getContext();
     if (Action::getActionName($context) !== 'view') {
         return false;
     }
     return true;
 }
开发者ID:akvankorlaar,项目名称:manuscriptdesk,代码行数:8,代码来源:NewManuscript.hooks.php

示例12: getJSVars

 /**
  * Get an array containing the variables to be set in mw.config in JavaScript.
  *
  * DO NOT CALL THIS FROM OUTSIDE OF THIS CLASS OR Skin::makeGlobalVariablesScript().
  * This is only public until that function is removed. You have been warned.
  *
  * Do not add things here which can be evaluated in ResourceLoaderStartupScript
  * - in other words, page-independent/site-wide variables (without state).
  * You will only be adding bloat to the html page and causing page caches to
  * have to be purged on configuration changes.
  * @return array
  */
 public function getJSVars()
 {
     global $wgUseAjax, $wgEnableMWSuggest;
     $latestRevID = 0;
     $pageID = 0;
     $canonicalName = false;
     # bug 21115
     $title = $this->getTitle();
     $ns = $title->getNamespace();
     $nsname = MWNamespace::exists($ns) ? MWNamespace::getCanonicalName($ns) : $title->getNsText();
     // Get the relevant title so that AJAX features can use the correct page name
     // when making API requests from certain special pages (bug 34972).
     $relevantTitle = $this->getSkin()->getRelevantTitle();
     if ($ns == NS_SPECIAL) {
         list($canonicalName, ) = SpecialPageFactory::resolveAlias($title->getDBkey());
     } elseif ($this->canUseWikiPage()) {
         $wikiPage = $this->getWikiPage();
         $latestRevID = $wikiPage->getLatest();
         $pageID = $wikiPage->getId();
     }
     $lang = $title->getPageLanguage();
     // Pre-process information
     $separatorTransTable = $lang->separatorTransformTable();
     $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
     $compactSeparatorTransTable = array(implode("\t", array_keys($separatorTransTable)), implode("\t", $separatorTransTable));
     $digitTransTable = $lang->digitTransformTable();
     $digitTransTable = $digitTransTable ? $digitTransTable : array();
     $compactDigitTransTable = array(implode("\t", array_keys($digitTransTable)), implode("\t", $digitTransTable));
     $vars = array('wgCanonicalNamespace' => $nsname, 'wgCanonicalSpecialPageName' => $canonicalName, 'wgNamespaceNumber' => $title->getNamespace(), 'wgPageName' => $title->getPrefixedDBKey(), 'wgTitle' => $title->getText(), 'wgCurRevisionId' => $latestRevID, 'wgArticleId' => $pageID, 'wgIsArticle' => $this->isArticle(), 'wgAction' => Action::getActionName($this->getContext()), 'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(), 'wgUserGroups' => $this->getUser()->getEffectiveGroups(), 'wgCategories' => $this->getCategories(), 'wgBreakFrames' => $this->getFrameOptions() == 'DENY', 'wgPageContentLanguage' => $lang->getCode(), 'wgSeparatorTransformTable' => $compactSeparatorTransTable, 'wgDigitTransformTable' => $compactDigitTransTable, 'wgRelevantPageName' => $relevantTitle->getPrefixedDBKey());
     if ($lang->hasVariants()) {
         $vars['wgUserVariant'] = $lang->getPreferredVariant();
     }
     foreach ($title->getRestrictionTypes() as $type) {
         $vars['wgRestriction' . ucfirst($type)] = $title->getRestrictions($type);
     }
     if ($wgUseAjax && $wgEnableMWSuggest && !$this->getUser()->getOption('disablesuggest', false)) {
         $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces($this->getUser());
     }
     if ($title->isMainPage()) {
         $vars['wgIsMainPage'] = true;
     }
     if ($this->mRedirectedFrom) {
         $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBKey();
     }
     // Allow extensions to add their custom variables to the mw.config map.
     // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
     // page-dependant but site-wide (without state).
     // Alternatively, you may want to use OutputPage->addJsConfigVars() instead.
     wfRunHooks('MakeGlobalVariablesScript', array(&$vars, $this));
     // Merge in variables from addJsConfigVars last
     return array_merge($vars, $this->mJsConfigVars);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:64,代码来源:OutputPage.php

示例13: getAction

 /**
  * Returns the name of the action that will be executed.
  *
  * @return string: action
  */
 public function getAction()
 {
     static $action = null;
     if ($action === null) {
         // Wikia change - begin
         // @author macbre
         wfRunHooks('MediaWikiGetAction', array($this, $this->context));
         // Wikia change - end
         $action = Action::getActionName($this->context);
     }
     return $action;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:17,代码来源:Wiki.php

示例14: onEndAccountSettingsNav

 /**
  * Menu item for ChooseTheme
  *
  * @param Action $action action being executed
  *
  * @return boolean hook return
  */
 function onEndAccountSettingsNav(Action $action)
 {
     $action_name = $action->getActionName();
     $action->menuItem(common_local_url('choosethemesettings'), _m('MENU', 'Theme'), _m('Choose Theme'), $action_name === 'themesettings');
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:13,代码来源:ChooseThemePlugin.php

示例15: renderApiResponse

 protected function renderApiResponse(array $apiResponse)
 {
     // Render the flow-component wrapper
     if (empty($apiResponse['blocks'])) {
         return array();
     }
     $out = $this->getOutput();
     // Add JSON blob for OOUI widgets
     $out->addHTML(Html::inlineScript('mw.flow = mw.flow || {}; mw.flow.data = ' . FormatJson::encode($apiResponse) . ';'));
     $renderedBlocks = array();
     foreach ($apiResponse['blocks'] as $block) {
         // @todo find a better way to do this; potentially make all blocks their own components
         switch ($block['type']) {
             case 'board-history':
                 $flowComponent = 'boardHistory';
                 $page = 'history';
                 break;
             case 'topic':
                 if ($block['submitted']['action'] === 'history') {
                     $page = 'history';
                     $flowComponent = 'boardHistory';
                 } else {
                     $page = 'topic';
                     $flowComponent = 'board';
                 }
                 break;
             default:
                 $flowComponent = 'board';
                 $page = 'board';
         }
         // Don't re-render a block type twice in one page
         if (isset($renderedBlocks[$flowComponent])) {
             continue;
         }
         $renderedBlocks[$flowComponent] = true;
         // Get the block loop template
         $template = $this->lightncandy->getTemplate('flow_block_loop');
         $classes = array('flow-component', "{$page}-page");
         // Add mw-content-{ltr,rtl} text if necessary (MW core doesn't add it for non-view actions
         if (\Action::getActionName($this) !== 'view') {
             $title = Title::newFromText($apiResponse['title']);
             $classes[] = 'mw-content-' . $title->getPageViewLanguage()->getDir();
         }
         // Output the component, with the rendered blocks inside it
         $out->addHTML(Html::rawElement('div', array('class' => implode(' ', $classes), 'data-flow-component' => $flowComponent, 'data-flow-id' => $apiResponse['workflow']), $template($apiResponse)));
     }
 }
开发者ID:TarLocesilion,项目名称:mediawiki-extensions-Flow,代码行数:47,代码来源:View.php


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