当前位置: 首页>>代码示例>>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;未经允许,请勿转载。