本文整理汇总了PHP中AssetsManager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP AssetsManager::getInstance方法的具体用法?PHP AssetsManager::getInstance怎么用?PHP AssetsManager::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetsManager
的用法示例。
在下文中一共展示了AssetsManager::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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__);
}
示例2: __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;
}
}
示例3: 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;
}
示例4: init
public function init()
{
$this->assetsManager = AssetsManager::getInstance();
$this->skinTemplateObj = $this->app->getSkinTemplateObj();
$this->skin = RequestContext::getMain()->getSkin();
$skinVars = $this->skinTemplateObj->data;
// this should be re-viewed and removed if not nessesary
$this->pageTitle = $skinVars['pagetitle'];
$this->displayTitle = $skinVars['displaytitle'];
$this->mimeType = $skinVars['mimetype'];
$this->charset = $skinVars['charset'];
$this->dir = $skinVars['dir'];
$this->lang = $skinVars['lang'];
$this->pageClass = $skinVars['pageclass'];
$this->skinNameClass = $skinVars['skinnameclass'];
$this->pageCss = $this->getPageCss();
// ArticleComments are rendered via SkinAfterContent hook
$this->dataAfterContent = $skinVars['dataAfterContent'];
// initialize variables
$this->comScore = null;
$this->quantServe = null;
// TODO clean up wg variables inclusion in views (CON-1533)
global $wgOut;
$this->topScripts = $wgOut->topScripts;
}
示例5: 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__);
}
示例6: 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));
}
示例7: executeIndex
public function executeIndex()
{
wfProfileIn(__METHOD__);
$this->partnerId = "Wikia";
$this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/HuluVideoPanel.scss'));
wfProfileOut(__METHOD__);
}
示例8: 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;
}
}
示例9: wfLatestQuestionsAjaxAddScript
function wfLatestQuestionsAjaxAddScript(&$out)
{
global $wgJsMimeType, $wgExtensionsPath;
$out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/LatestQuestions/LatestQuestions.js\"></script>\n");
$out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/LatestQuestions/LatestQuestions.scss'));
return true;
}
示例10: 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'));
}
}
示例11: 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'));
}
}
示例12: pageNotFound
/**
* Page Not Found
*
* Get 20 most recent edited page
* get 5 images per page
*
* display random image on 404 page
* example:
*
* Open non existent page on any wiki
*
*/
function pageNotFound()
{
//setup all needed assets on 404 page
/**
* @var $out OutputPage
*/
$out = $this->request->getVal('out', $this->wg->Out);
$assetManager = AssetsManager::getInstance();
//add styles that belongs only to 404 page
$styles = $assetManager->getURL(array('wikiamobile_404_scss'));
//this is going to be additional call but at least it won't be loaded on every page
foreach ($styles as $s) {
$out->addStyle($s);
}
//this is mainly for tracking
$scipts = $assetManager->getURL(array('wikiamobile_404_js'));
foreach ($scipts as $s) {
$out->addScript('<script src="' . $s . '"></script>');
}
//suppress rendering stuff that is not to be on 404 page
WikiaMobileFooterService::setSkipRendering(true);
WikiaMobilePageHeaderService::setSkipRendering(true);
/**
* @var $wikiaMobileStatsModel WikiaMobileStatsModel
*/
$wikiaMobileStatsModel = new WikiaMobileStatsModel();
$ret = $wikiaMobileStatsModel->getRandomPopularPage();
$this->response->setVal('title', $this->wg->Out->getTitle());
$this->response->setVal('link', $ret[0]);
$this->response->setVal('img', $ret[1]);
}
示例13: 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;
}
示例14: execute
function execute($par)
{
global $wgOut, $wgCityId, $wgSuppressWikiHeader, $wgSuppressPageHeader, $wgShowMyToolsOnly, $wgExtensionsPath, $wgBlankImgUrl, $wgJsMimeType, $wgTitle, $wgUser, $wgRequest;
wfProfileIn(__METHOD__);
// redirect to www.wikia.com
if ($wgCityId == 177) {
$destServer = WikiFactory::getVarValueByName('wgServer', $this->destCityId);
$destArticlePath = WikiFactory::getVarValueByName('wgArticlePath', $this->destCityId);
$wgOut->redirect($destServer . str_replace('$1', 'Special:LandingPage', $destArticlePath));
return;
}
$this->setHeaders();
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/LandingPage/css/LandingPage.scss'));
// hide wiki and page header
$wgSuppressWikiHeader = true;
$wgSuppressPageHeader = true;
// only shown "My Tools" on floating toolbar
$wgShowMyToolsOnly = true;
// parse language links (RT #71622)
$languageLinks = array();
$parsedMsg = wfStringToArray(wfMsg('landingpage-language-links'), '*', 10);
foreach ($parsedMsg as $item) {
if ($item != '') {
list($text, $lang) = explode('|', $item);
$languageLinks[] = array('text' => $text, 'href' => $wgTitle->getLocalUrl("uselang={$lang}"));
}
}
// fetching the landingpage sites
$landingPageLinks = CorporatePageHelper::parseMsgImg('landingpage-sites', false, false);
// render HTML
$template = new EasyTemplate(dirname(__FILE__) . '/templates');
$template->set_vars(array('imagesPath' => $wgExtensionsPath . '/wikia/LandingPage/images/', 'languageLinks' => $languageLinks, 'wgBlankImgUrl' => $wgBlankImgUrl, 'wgTitle' => $wgTitle, 'landingPageLinks' => $landingPageLinks, 'landingPageSearch' => F::app()->getView("SearchController", "Index", array("placeholder" => "Search Wikia", "fulltext" => "0", "wgBlankImgUrl" => $wgBlankImgUrl, "wgTitle" => $wgTitle))));
$wgOut->addHTML($template->render('main'));
wfProfileOut(__METHOD__);
}
示例15: renderSpoilerControl
function renderSpoilerControl($input, $argv, $parser)
{
// check arguments
if (empty($argv['source'])) {
return;
}
$controlOptionsStr = wfMsg('wikiaspoiler-' . $argv['source']);
willdebug($controlOptionsStr);
if (empty($controlOptionsStr)) {
return;
}
$controlOptions = explode("\n", $controlOptionsStr);
$numOptions = sizeof($controlOptions);
// load assets
$extPath = F::app()->wg->extensionsPath;
F::app()->wg->out->addScript("<script src=\"{$extPath}/wikia/WikiaSpoiler/js/WikiaSpoiler.js\"></script>");
F::app()->wg->out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/WikiaSpoiler/css/WikiaSpoiler.scss'));
$output = '<form id="wikiaspoilercontrol" action="" onsubmit="return false;"><p>';
$output .= wfMsg('wikiaspoiler-control-heading');
$output .= '<select class="wikiaspoilerselect">';
$output .= '<option value="0">none</option>';
for ($i = 0; $i < $numOptions; $i++) {
$output .= '<option value="' . ($i + 1) . '">' . $controlOptions[$i] . '</option>';
}
willdebug($output);
$output .= '</select></p></form>';
return $output;
}