當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SkinTemplate::msg方法代碼示例

本文整理匯總了PHP中SkinTemplate::msg方法的典型用法代碼示例。如果您正苦於以下問題:PHP SkinTemplate::msg方法的具體用法?PHP SkinTemplate::msg怎麽用?PHP SkinTemplate::msg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SkinTemplate的用法示例。


在下文中一共展示了SkinTemplate::msg方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addMarkButton

 public static function addMarkButton(SkinTemplate &$sktemplate, array &$links)
 {
     $title = $sktemplate->getRelevantTitle();
     $user = $sktemplate->getUser();
     if ($user->isAllowedAll('changetags', 'markmajorchange')) {
         $urlParams = array('action' => 'markmajorchange');
         $links['actions']['markmajorchange'] = array('text' => $sktemplate->msg('markmajorchanges-mark-btn')->text(), 'href' => $title->getLocalURL($urlParams));
     }
 }
開發者ID:kolzchut,項目名稱:mediawiki-extensions-MarkMajorChanges,代碼行數:9,代碼來源:MarkMajorChanges.hooks.php

示例2: onSkinTemplateNavigation

 /**
  * Changes the Edit tab and adds the VisualEditor tab.
  *
  * This is attached to the MediaWiki 'SkinTemplateNavigation' hook.
  *
  * @param SkinTemplate $skin
  * @param array $links Navigation links
  * @return boolean
  */
 public static function onSkinTemplateNavigation(SkinTemplate &$skin, array &$links)
 {
     // Only do this if the user has VE enabled
     if (!$skin->getUser()->getOption('visualeditor-enable') || $skin->getUser()->getOption('visualeditor-betatempdisable')) {
         return true;
     }
     $config = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor');
     if (!isset($links['views']['edit'])) {
         // There's no edit link, nothing to do
         return true;
     }
     $title = $skin->getRelevantTitle();
     if (defined('EP_NS') && $title->inNamespace(EP_NS)) {
         return true;
     }
     $tabMessages = $config->get('VisualEditorTabMessages');
     // Rebuild the $links['views'] array and inject the VisualEditor tab before or after
     // the edit tab as appropriate. We have to rebuild the array because PHP doesn't allow
     // us to splice into the middle of an associative array.
     $newViews = array();
     foreach ($links['views'] as $action => $data) {
         if ($action === 'edit') {
             // Build the VisualEditor tab
             $existing = $title->exists() || $title->inNamespace(NS_MEDIAWIKI) && $title->getDefaultMessageText() !== false;
             $action = $existing ? 'edit' : 'create';
             $veParams = $skin->editUrlOptions();
             unset($veParams['action']);
             // Remove action=edit
             $veParams['veaction'] = 'edit';
             // Set veaction=edit
             $veTabMessage = $tabMessages[$action];
             $veTabText = $veTabMessage === null ? $data['text'] : $skin->msg($veTabMessage)->text();
             $veTab = array('href' => $title->getLocalURL($veParams), 'text' => $veTabText, 'primary' => true, 'class' => '');
             // Alter the edit tab
             $editTab = $data;
             if ($title->inNamespace(NS_FILE) && WikiPage::factory($title) instanceof WikiFilePage && !WikiPage::factory($title)->isLocal()) {
                 $editTabMessage = $tabMessages[$action . 'localdescriptionsource'];
             } else {
                 $editTabMessage = $tabMessages[$action . 'source'];
             }
             if ($editTabMessage !== null) {
                 $editTab['text'] = $skin->msg($editTabMessage)->text();
             }
             // Inject the VE tab before or after the edit tab
             if ($config->get('VisualEditorTabPosition') === 'before') {
                 $editTab['class'] .= ' collapsible';
                 $newViews['ve-edit'] = $veTab;
                 $newViews['edit'] = $editTab;
             } else {
                 $veTab['class'] .= ' collapsible';
                 $newViews['edit'] = $editTab;
                 $newViews['ve-edit'] = $veTab;
             }
         } else {
             // Just pass through
             $newViews[$action] = $data;
         }
     }
     $links['views'] = $newViews;
     return true;
 }
開發者ID:brandonphuong,項目名稱:mediawiki,代碼行數:70,代碼來源:VisualEditor.hooks.php

示例3: onSkinTemplateNavigation

 /**
  * Changes the Edit tab and adds the VisualEditor tab.
  *
  * This is attached to the MediaWiki 'SkinTemplateNavigation' hook.
  *
  * @param SkinTemplate $skin
  * @param array $links Navigation links
  * @return boolean
  */
 public static function onSkinTemplateNavigation(SkinTemplate &$skin, array &$links)
 {
     $config = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor');
     // Exit if the user doesn't have VE enabled
     if (!$skin->getUser()->getOption('visualeditor-enable') || $skin->getUser()->getOption('visualeditor-betatempdisable') || $config->get('VisualEditorDisableForAnons') && $skin->getUser()->isAnon()) {
         return true;
     }
     // Exit if there's no edit link for whatever reason (e.g. protected page)
     if (!isset($links['views']['edit'])) {
         return true;
     }
     $availableNamespaces = $config->get('VisualEditorAvailableNamespaces');
     $title = $skin->getRelevantTitle();
     $namespaceEnabled = $title->inNamespaces(array_keys(array_filter($availableNamespaces)));
     $pageContentModel = $title->getContentModel();
     // Don't exit if this page isn't VE-enabled, since we should still
     // change "Edit" to "Edit source".
     $isAvailable = $namespaceEnabled && $pageContentModel === CONTENT_MODEL_WIKITEXT;
     // HACK: Exit if we're in the Education Program namespace (even though it's content)
     if (defined('EP_NS') && $title->inNamespace(EP_NS)) {
         return true;
     }
     $tabMessages = $config->get('VisualEditorTabMessages');
     // Rebuild the $links['views'] array and inject the VisualEditor tab before or after
     // the edit tab as appropriate. We have to rebuild the array because PHP doesn't allow
     // us to splice into the middle of an associative array.
     $newViews = array();
     foreach ($links['views'] as $action => $data) {
         if ($action === 'edit') {
             // Build the VisualEditor tab
             $existing = $title->exists() || $title->inNamespace(NS_MEDIAWIKI) && $title->getDefaultMessageText() !== false;
             $action = $existing ? 'edit' : 'create';
             $veParams = $skin->editUrlOptions();
             unset($veParams['action']);
             // Remove action=edit
             $veParams['veaction'] = 'edit';
             // Set veaction=edit
             $veTabMessage = $tabMessages[$action];
             $veTabText = $veTabMessage === null ? $data['text'] : $skin->msg($veTabMessage)->text();
             $veTab = array('href' => $title->getLocalURL($veParams), 'text' => $veTabText, 'primary' => true, 'class' => '');
             // Alter the edit tab
             $editTab = $data;
             if ($title->inNamespace(NS_FILE) && WikiPage::factory($title) instanceof WikiFilePage && !WikiPage::factory($title)->isLocal()) {
                 $editTabMessage = $tabMessages[$action . 'localdescriptionsource'];
             } else {
                 $editTabMessage = $tabMessages[$action . 'source'];
             }
             if ($editTabMessage !== null) {
                 $editTab['text'] = $skin->msg($editTabMessage)->text();
             }
             if ($isAvailable) {
                 // Inject the VE tab before or after the edit tab
                 if ($config->get('VisualEditorTabPosition') === 'before') {
                     $editTab['class'] .= ' collapsible';
                     $newViews['ve-edit'] = $veTab;
                     $newViews['edit'] = $editTab;
                 } else {
                     $veTab['class'] .= ' collapsible';
                     $newViews['edit'] = $editTab;
                     $newViews['ve-edit'] = $veTab;
                 }
             } else {
                 // Don't add ve-edit, but do update the edit tab (e.g. "Edit source").
                 $newViews['edit'] = $editTab;
             }
         } else {
             // Just pass through
             $newViews[$action] = $data;
         }
     }
     $links['views'] = $newViews;
     return true;
 }
開發者ID:eliagbayani,項目名稱:eoearth,代碼行數:82,代碼來源:VisualEditor.hooks.php

示例4: onPersonalUrls

 /**
  * Handler for PersonalUrls hook.
  * Add a "Notifications" item to the user toolbar ('personal URLs').
  * @see http://www.mediawiki.org/wiki/Manual:Hooks/PersonalUrls
  * @param &$personal_urls Array of URLs to append to.
  * @param &$title Title of page being visited.
  * @param SkinTemplate $sk
  * @return bool true in all cases
  */
 static function onPersonalUrls(&$personal_urls, &$title, $sk)
 {
     global $wgEchoNewMsgAlert;
     $user = $sk->getUser();
     if ($user->isAnon() || self::isEchoDisabled($user)) {
         return true;
     }
     // Add a "My notifications" item to personal URLs
     if ($user->getOption('echo-notify-show-link')) {
         $notificationCount = MWEchoNotifUser::newFromUser($user)->getNotificationCount();
         $text = EchoNotificationController::formatNotificationCount($notificationCount);
         $url = SpecialPage::getTitleFor('Notifications')->getLocalURL();
         if ($notificationCount == 0) {
             $linkClasses = array('mw-echo-notifications-badge');
         } else {
             $linkClasses = array('mw-echo-unread-notifications', 'mw-echo-notifications-badge');
         }
         $notificationsLink = array('href' => $url, 'text' => $text, 'active' => $url == $title->getLocalUrl(), 'class' => $linkClasses);
         $insertUrls = array('notifications' => $notificationsLink);
         $personal_urls = wfArrayInsertAfter($personal_urls, $insertUrls, 'userpage');
     }
     // If the user has new messages, display a talk page alert
     if ($wgEchoNewMsgAlert && $user->getOption('echo-show-alert') && $user->getNewtalk()) {
         $personal_urls['mytalk']['text'] = $sk->msg('echo-new-messages')->text();
         $personal_urls['mytalk']['class'] = array('mw-echo-alert');
         $sk->getOutput()->addModuleStyles('ext.echo.alert');
     }
     return true;
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:38,代碼來源:Hooks.php

示例5: addAssignButton

 public static function addAssignButton(SkinTemplate &$sktemplate, array &$links)
 {
     $title = $sktemplate->getRelevantTitle();
     $user = $sktemplate->getUser();
     if ($title->quickUserCan('assigntoproject', $user)) {
         /* This is somewhat a replication of code from SkinTemplate::buildContentNavigationUrls() */
         $onPage = $title->equals($sktemplate->getTitle());
         $request = $sktemplate->getRequest();
         $action = $request->getVal('action', 'view');
         /* /Code Replication */
         $isAssigned = ApprovedRevs::isAssignedToProject($title);
         $isAssigning = $onPage && $action == 'assigntoproject';
         $msg = $isAssigned ? 'btn-reassigntoproject' : 'btn-assigntoproject';
         $links['actions']['assigntoproject'] = array('text' => $sktemplate->msg($msg)->text(), 'href' => $title->getLocalURL('action=assigntoproject'), 'class' => $isAssigning ? 'selected' : '');
     }
     return true;
 }
開發者ID:kolzchut,項目名稱:mediawiki-extensions-WRApprovedRevs,代碼行數:17,代碼來源:ApprovedRevs.hooks.php


注:本文中的SkinTemplate::msg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。