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


PHP OutputPage::addScriptFile方法代碼示例

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


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

示例1: onBeforePageDisplay

 /**
  * Check if article is in insights flow and init script to show banner with message and next steps
  */
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     global $wgRequest;
     $subpage = $wgRequest->getVal('insights', null);
     // Load scripts for pages in insights loop
     if (InsightsHelper::isInsightPage($subpage)) {
         $out->addScriptFile('/extensions/wikia/Insights/scripts/LoopNotification.js');
         $out->addScriptFile('/extensions/wikia/Insights/scripts/InsightsLoopNotificationTracking.js');
     }
     return true;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:14,代碼來源:InsightsHooks.class.php

示例2: AjaxLoginJS

/**
 * Adds required JavaScript & CSS files to the HTML output of a page if AjaxLogin is enabled
 *
 * @param $out OutputPage object
 * @return true
 */
function AjaxLoginJS(OutputPage $out)
{
    global $wgEnableAjaxLogin, $wgScriptPath;
    # Don't load anything if AjaxLogin isn't enabled or if we're on login page
    if (!isset($wgEnableAjaxLogin) || $out->getTitle()->isSpecial('Userlogin')) {
        return true;
    }
    // Our custom CSS
    $out->addExtensionStyle($wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.css');
    // jQuery and JQModal scripts
    $out->includeJQuery();
    $out->addScriptFile($wgScriptPath . '/extensions/AjaxLogin/jqModal.js');
    $out->addScriptFile($wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.js');
    return true;
}
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:21,代碼來源:AjaxLogin.php

示例3: applyScript

 /**
  * Adds one legacy script to output.
  *
  * @param string $page Unprefixed page title
  * @param OutputPage $out
  */
 private static function applyScript($page, $out)
 {
     global $wgJsMimeType;
     # bug 22929: disable gadgets on sensitive pages.  Scripts loaded through the
     # ResourceLoader handle this in OutputPage::getModules()
     # TODO: make this extension load everything via RL, then we don't need to worry
     # about any of this.
     if ($out->getAllowedModules(ResourceLoaderModule::TYPE_SCRIPTS) < ResourceLoaderModule::ORIGIN_USER_SITEWIDE) {
         return;
     }
     $t = Title::makeTitleSafe(NS_MEDIAWIKI, $page);
     if (!$t) {
         return;
     }
     $u = $t->getLocalURL('action=raw&ctype=' . $wgJsMimeType);
     $out->addScriptFile($u, $t->getLatestRevID());
 }
開發者ID:Grprashanthkumar,項目名稱:ColfusionWeb,代碼行數:23,代碼來源:Gadgets_body.php

示例4: onBeforePageDisplay

 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     $out->addScriptFile(F::app()->wg->ExtensionsPath . '/wikia/ContentWarning/js/ContentWarning.js');
     $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/ContentWarning/css/ContentWarning.scss'));
     return true;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:6,代碼來源:ContentWarningHooks.class.php

示例5: renderFormHeader

 /**
  * Print extra field for 'title'
  *
  * @param OutputPage $wgOut
  */
 public function renderFormHeader($wgOut)
 {
     global $wgRequest;
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("formErrors" => $this->mFormErrors, "formData" => $this->mFormData, "isReload" => $wgRequest->getVal('wpIsReload', 0) == 1, "editIntro" => $wgOut->parse($this->mEditIntro)));
     $wgOut->setPageTitle(wfMsg("createpage"));
     $wgOut->addScriptFile('edit.js');
     if ($this->mPreviewTitle == null) {
         $wgOut->addHTML('<div id="custom_createpagetext">');
         $wgOut->addWikiText(wfMsgForContent('newarticletext'));
         $wgOut->addHTML('</div>');
     }
     $wgOut->addHTML($oTmpl->render("createFormHeader"));
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:19,代碼來源:SpecialCreatePage.class.php

示例6: onBeforePageDisplay

 /**
  * add resources needed by chat
  * as chat entry points or links can appear on any page,
  * we really need them everywhere
  */
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     global $wgExtensionsPath, $wgTitle, $wgResourceBasePath;
     wfProfileIn(__METHOD__);
     $sp = array('Contributions', 'Log', 'Recentchanges');
     foreach ($sp as $value) {
         if ($wgTitle->isSpecial($value)) {
             // For Chat2 (doesn't exist in Chat(1))
             $srcs = F::build('AssetsManager', array(), 'getInstance')->getGroupCommonURL('chat_ban_js', array());
             foreach ($srcs as $val) {
                 $out->addScript('<script src="' . $val . '"></script>');
             }
             F::build('JSMessages')->enqueuePackage('ChatBanModal', JSMessages::EXTERNAL);
             $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatModal.scss'));
             break;
         }
     }
     // don't load ChatEntryPoint on edit pages (perf optimization)
     if (F::app()->checkSkin('oasis') && !BodyController::isEditPage()) {
         // TODO: move these to asset manager when we release chat globally
         $out->addScriptFile($wgResourceBasePath . '/resources/wikia/libraries/bootstrap/popover.js');
         $out->addScriptFile($wgExtensionsPath . '/wikia/Chat2/js/ChatEntryPoint.js');
         $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('resources/wikia/libraries/bootstrap/popover.scss'));
         $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatEntryPoint.scss'));
     }
     wfProfileOut(__METHOD__);
     return true;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:33,代碼來源:ChatHelper.php


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