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


PHP AssetsManager类代码示例

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


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

示例1: sassProcessing

 private function sassProcessing()
 {
     global $IP, $wgSassExecutable, $wgDevelEnvironment;
     wfProfileIn(__METHOD__);
     $tempDir = sys_get_temp_dir();
     //replace \ to / is needed because escapeshellcmd() replace \ into spaces (?!!)
     $tempOutFile = str_replace('\\', '/', tempnam($tempDir, 'Sass'));
     $tempDir = str_replace('\\', '/', $tempDir);
     $params = urldecode(http_build_query($this->mParams, '', ' '));
     $cmd = "{$wgSassExecutable} {$IP}/{$this->mOid} {$tempOutFile} --cache-location {$tempDir}/sass -r {$IP}/extensions/wikia/SASS/wikia_sass.rb {$params}";
     $escapedCmd = escapeshellcmd($cmd) . " 2>&1";
     $sassResult = shell_exec($escapedCmd);
     if ($sassResult != '') {
         Wikia::log(__METHOD__, false, "commandline error: " . $sassResult . " -- Full commandline was: {$escapedCmd}", true);
         Wikia::log(__METHOD__, false, "Full commandline was: {$escapedCmd}", true);
         Wikia::log(__METHOD__, false, AssetsManager::getRequestDetails(), true);
         if (file_exists($tempOutFile)) {
             unlink($tempOutFile);
         }
         if (!empty($wgDevelEnvironment)) {
             $exceptionMsg = "Problem with SASS processing: {$sassResult}";
         } else {
             $exceptionMsg = 'Problem with SASS processing. Check the PHP error log for more info.';
         }
         throw new Exception("/* {$exceptionMsg} */");
     }
     $this->mContent = file_get_contents($tempOutFile);
     unlink($tempOutFile);
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:AssetsManagerSassBuilder.class.php

示例2: testGeneral

 public function testGeneral()
 {
     $manager = new AssetsManager();
     $manager->getDescription();
     $manager->getUrl('/test');
     $manager->title()->add('temporary');
     $manager->setTitle(new Title());
     $manager->requirejs()->renderConfig();
     $manager->requirejs()->renderConfigHtml();
     $manager->requirejs()->renderScript();
     $manager->requirejs()->renderScriptHtml();
 }
开发者ID:kendolabdev,项目名称:kendoplatform,代码行数:12,代码来源:ManagerTest.php

示例3: __construct

 /**
  * WikiaSkin constructor
  *
  * @param String $templateClassName Mame of the QuickTemplate subclass to associate to this skin
  * @param String $skinName Name of the skin (lowercase)
  * @param String $styleName The style name, will use $skinName if not specified
  * @param null $themeName The theme name, will use $skinName if not specified
  */
 function __construct($templateClassName = null, $skinName = null, $themeName = null, $styleName = null)
 {
     $this->app = F::app();
     $this->wg = $this->app->wg;
     $this->wf = $this->app->wf;
     $this->assetsManager = AssetsManager::getInstance();
     /**
      * old skins initialize template, skinname, stylename and themename statically in the class declaration,
      * we need to support them too so, that's what the following checks are meant for
      */
     if ($templateClassName !== null) {
         $this->template = $templateClassName;
     }
     if ($skinName !== null) {
         $this->skinname = $skinName;
     }
     if ($styleName !== null) {
         $this->stylename = $styleName;
     } elseif (!isset($this->stylename)) {
         $this->stylename = $this->skinname;
     }
     if ($themeName !== null) {
         $this->themename = $themeName;
     } elseif (!isset($this->themename)) {
         $this->themename = $this->skinname;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:WikiaSkin.class.php

示例4: execute

 public function execute()
 {
     global $wgUser, $wgOut, $wgExtensionsPath, $wgEnableUserLoginExt;
     wfProfileIn(__METHOD__);
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if (!$wgUser->isAllowed('createnewwiki')) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     $wgOut->setPageTitle(wfMsg('cnw-title'));
     $wgOut->addHtml(F::app()->renderView('CreateNewWiki', 'Index'));
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/CreateNewWiki/css/CreateNewWiki.scss'));
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/ThemeDesigner/js/ThemeDesigner.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/AjaxLogin/AjaxLogin.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/CreateNewWiki/js/CreateNewWiki.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/CreateNewWiki/js/CreateNewWikiSupplemental.js"></script>');
     if ($wgEnableUserLoginExt) {
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/UserLogin/css/UserLoginModal.scss'));
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:25,代码来源:SpecialCreateNewWiki.class.php

示例5: onBeforePageDisplay

 /**
  * Add JS and CSS to File Page (except mobile skin - see onWikiaMobileAssetsPackages)
  *
  * @param OutputPage $out
  * @param $skin
  * @return bool
  */
 public static function onBeforePageDisplay(OutputPage $out, $skin)
 {
     global $wgEnableVideoPageRedesign;
     $app = F::app();
     wfProfileIn(__METHOD__);
     if ($app->wg->Title->getNamespace() == NS_FILE) {
         $assetsManager = AssetsManager::getInstance();
         $wikiaFilePageJs = 'wikia_file_page_js';
         foreach ($assetsManager->getURL($wikiaFilePageJs) as $url) {
             $out->addScript("<script src=\"{$url}\"></script>");
         }
         // load assets when File Page redesign is enabled
         if ($app->checkSkin('oasis') && !empty($wgEnableVideoPageRedesign)) {
             $filePageTabbedCss = 'file_page_tabbed_css';
             $filePageTabbedJs = 'file_page_tabbed_js';
             foreach ($assetsManager->getURL($filePageTabbedCss) as $url) {
                 $out->addStyle($url);
             }
             foreach ($assetsManager->getURL($filePageTabbedJs) as $url) {
                 $out->addScript("<script src=\"{$url}\"></script>");
             }
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:33,代码来源:FilePageHooks.class.php

示例6: __construct

 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     global $IP;
     if (strpos($this->mOid, '..') !== false) {
         throw new Exception('File path must not contain \'..\'.');
     }
     if (endsWith($this->mOid, '.js', false)) {
         $this->mContentType = AssetsManager::TYPE_JS;
     } else {
         if (endsWith($this->mOid, '.css', false)) {
             $this->mContentType = AssetsManager::TYPE_CSS;
         } else {
             throw new Exception('Requested file must be .css or .js.');
         }
     }
     $filePath = $IP . '/' . $this->mOid;
     if (file_exists($filePath)) {
         $this->mContent = file_get_contents($filePath);
     } else {
         $requestDetails = AssetsManager::getRequestDetails();
         Wikia::log(__METHOD__, false, "file '{$filePath}' doesn't exist ({$requestDetails})", true);
         throw new Exception('File does not exist');
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:AssetsManagerOneBuilder.class.php

示例7: __construct

 function __construct($message)
 {
     // add referer and user agent info to the exception message
     $details = AssetsManager::getRequestDetails();
     $message .= " ({$details})";
     parent::__construct($message);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:AssetsManagerException.class.php

示例8: view

 /**
  * Render Quiz namespace page
  */
 public function view()
 {
     global $wgOut, $wgUser, $wgTitle, $wgRequest;
     wfProfileIn(__METHOD__);
     // let MW handle basic stuff
     parent::view();
     // don't override history pages
     $action = $wgRequest->getVal('action');
     if (in_array($action, array('history', 'historysubmit'))) {
         wfProfileOut(__METHOD__);
         return;
     }
     // quiz doesn't exist
     if (!$wgTitle->exists() || empty($this->mQuiz)) {
         wfProfileOut(__METHOD__);
         return;
     }
     // set page title
     $title = $this->mQuiz->getTitle();
     $wgOut->setPageTitle($title);
     // add CSS/JS
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
     // render quiz page
     $wgOut->clearHTML();
     $wgOut->addHTML($this->mQuiz->render());
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:WikiaQuizIndexArticle.class.php

示例9: execute

 public function execute($subpage)
 {
     global $wgOut, $wgUser, $wgExtensionsPath, $wgResourceBasePath;
     // Boilerplate special page permissions
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (!$wgUser->isAllowed('wikiaquiz')) {
         $this->displayRestrictionError();
         return;
     }
     if (wfReadOnly() && !wfAutomaticReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     $wgOut->addScript('<script src="' . $wgResourceBasePath . '/resources/wikia/libraries/jquery-ui/jquery-ui-1.8.14.custom.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/WikiaQuiz/js/CreateWikiaQuizArticle.js"></script>');
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
     if ($subpage != '') {
         // We came here from the edit link, go into edit mode
         $wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'EditQuizArticle', array('title' => $subpage)));
     } else {
         $wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'CreateQuizArticle'));
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:25,代码来源:SpecialCreateWikiaQuizArticle.class.php

示例10: execute

 public function execute($subpage)
 {
     global $wgOut;
     $this->checkPermission();
     if ($this->getUser()->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (!$this->getUser()->isAllowed('videoupload')) {
         $wgOut->addHTML(wfMessage('videos-error-admin-only')->plain());
         return;
     }
     // Add css for form
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/VideoEmbedTool/css/WikiaVideoAdd.scss'));
     $this->mTitle = Title::makeTitle(NS_SPECIAL, 'WikiaVideoAdd');
     $wgOut->setRobotpolicy('noindex,nofollow');
     $wgOut->setPageTitle("WikiaVideoAdd");
     $wgOut->setArticleRelated(false);
     $this->mAction = $this->getRequest()->getVal("action");
     $this->mPosted = $this->getRequest()->wasPosted();
     switch ($this->mAction) {
         case 'submit':
             if ($this->mPosted) {
                 $this->mAction = $this->doSubmit();
             }
             break;
         default:
             $this->showForm();
             break;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:WikiaVideoAdd_body.php

示例11: executeIndex

 public function executeIndex($params)
 {
     $page_owner = User::newFromName($this->wg->Title->getText());
     if (!is_object($page_owner) || $page_owner->getId() == 0) {
         // do not show module if page owner does not exist or is an anonymous user
         return false;
     }
     // add CSS for this module
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/FollowedPages.scss"));
     $showDeletedPages = isset($params['showDeletedPages']) ? (bool) $params['showDeletedPages'] : true;
     // get 6 followed pages
     $watchlist = FollowModel::getWatchList($page_owner->getId(), 0, 6, null, $showDeletedPages);
     $data = array();
     // weird.  why is this an array of one element?
     foreach ($watchlist as $unused_id => $item) {
         $pagelist = $item['data'];
         foreach ($pagelist as $page) {
             $data[] = $page;
         }
     }
     // only display  your own page
     if ($page_owner->getId() == $this->wg->User->getId()) {
         $this->follow_all_link = Wikia::specialPageLink('Following', 'oasis-wikiafollowedpages-special-seeall', 'more');
     }
     $this->data = $data;
     $this->max_followed_pages = min(self::MAX_FOLLOWED_PAGES, count($this->data));
 }
开发者ID:yusufchang,项目名称:app,代码行数:27,代码来源:FollowedPagesController.class.php

示例12: executeIndex

 public function executeIndex()
 {
     $maxBadgesToDisplay = 6;
     // Could make this a global if we want
     wfProfileIn(__METHOD__);
     // include oasis.css override
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/AchievementsII/css/oasis.scss'));
     // This code was taken from SpecialLeaderboard so it can be used by both the module and the old Monaco .tmpl
     $rankingService = new AchRankingService();
     // ignore welcome badges
     $blackList = array(BADGE_WELCOME);
     $awardedBadges = $rankingService->getRecentAwardedBadges(null, $maxBadgesToDisplay, 3, $blackList);
     $recents = array();
     $count = 1;
     // getRecentAwardedBadges can sometimes return more than $max items
     foreach ($awardedBadges as $badgeData) {
         //$level = $badgeData['badge']->getLevel();
         $recents[] = $badgeData;
         if ($count++ >= $maxBadgesToDisplay) {
             break;
         }
     }
     $this->recents = $recents;
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:25,代码来源:LatestEarnedBadgesController.class.php

示例13: executeIndex

 public function executeIndex()
 {
     wfProfileIn(__METHOD__);
     $this->partnerId = "Wikia";
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/HuluVideoPanel.scss'));
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:HuluVideoPanelController.class.php

示例14: execute

 public function execute($subpage)
 {
     global $wgOut, $wgUser, $wgExtensionsPath, $wgResourceBasePath;
     // Boilerplate special page permissions
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (wfReadOnly() && !wfAutomaticReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if (!$wgUser->isAllowed('createpage') || !$wgUser->isAllowed('edit')) {
         $this->displayRestrictionError();
         return;
     }
     $wgOut->addModules("wikia.jquery.ui");
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/WikiaPoll/js/CreateWikiaPoll.js"></script>');
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/WikiaPoll/css/CreateWikiaPoll.scss'));
     if ($subpage != '') {
         // We came here from the edit link, go into edit mode
         $wgOut->addHtml(F::app()->renderView('WikiaPoll', 'SpecialPageEdit', array('title' => $subpage)));
     } else {
         $wgOut->addHtml(F::app()->renderView('WikiaPoll', 'SpecialPage'));
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:SpecialCreateWikiaPoll.class.php

示例15: index

 public function index()
 {
     if (!$this->wg->User->isAllowed('gameguidescontent')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $title = $this->wf->Msg('wikiagameguides-content-title');
     $this->wg->Out->setPageTitle($title);
     $this->wg->Out->setHTMLTitle($title);
     $this->wg->Out->addModules('jquery.autocomplete');
     $assetManager = AssetsManager::getInstance();
     $styles = $assetManager->getUrl('extensions/wikia/GameGuides/css/GameGuidesContentManagmentTool.scss');
     foreach ($styles as $s) {
         $this->wg->Out->addStyle($s);
     }
     $scripts = $assetManager->getURL('extensions/wikia/GameGuides/js/GameGuidesContentManagmentTool.js');
     foreach ($scripts as $s) {
         $this->wg->Out->addScriptFile($s);
     }
     F::build('JSMessages')->enqueuePackage('GameGuidesContentMsg', JSMessages::INLINE);
     $tags = WikiFactory::getVarValueByName('wgWikiaGameGuidesContent', $this->wg->CityId);
     $this->response->setVal('tags', $tags);
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:25,代码来源:GameGuidesSpecialContentController.class.php


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