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


PHP Html::inlineScript方法代码示例

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


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

示例1: getLazySuggestionBox

 /**
  * @return null|string
  */
 public function getLazySuggestionBox()
 {
     $this->mustBeKnownMessage();
     if (!$this->handle->getCode()) {
         return null;
     }
     $url = SpecialPage::getTitleFor('Translate', 'editpage')->getLocalUrl(array('suggestions' => 'only', 'page' => $this->handle->getTitle()->getPrefixedDbKey(), 'loadgroup' => $this->group->getId()));
     $url = Xml::encodeJsVar($url);
     $id = Sanitizer::escapeId('tm-lazysug-' . $this->dialogID());
     $target = self::jQueryPathId($id);
     $script = Html::inlineScript("jQuery({$target}).load({$url})");
     $spinner = Html::element('div', array('class' => 'mw-ajax-loader'));
     return Html::rawElement('div', array('id' => $id), $script . $spinner);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:17,代码来源:TranslationHelpers.php

示例2: getLiftiumOptionsScript

 public static function getLiftiumOptionsScript()
 {
     wfProfileIn(__METHOD__);
     global $wgDBname, $wgTitle, $wgLang, $wgDartCustomKeyValues, $wgCityId;
     // See Liftium.js for documentation on options
     $options = array();
     $options['pubid'] = 999;
     $options['baseUrl'] = '/__varnish_liftium/';
     $options['kv_wgDBname'] = $wgDBname;
     if (is_object($wgTitle)) {
         $options['kv_article_id'] = $wgTitle->getArticleID();
         $options['kv_wpage'] = $wgTitle->getPartialURL();
     }
     $hub = WikiFactoryHub::getInstance();
     $options['kv_Hub'] = $hub->getCategoryName($wgCityId);
     $options['kv_skin'] = RequestContext::getMain()->getSkin()->getSkinName();
     $options['kv_user_lang'] = $wgLang->getCode();
     $options['kv_cont_lang'] = $GLOBALS['wgLanguageCode'];
     $options['kv_isMainPage'] = WikiaPageType::isMainPage();
     $options['kv_page_type'] = WikiaPageType::getPageType();
     $options['geoUrl'] = "http://geoiplookup.wikia.com/";
     if (!empty($wgDartCustomKeyValues)) {
         $options['kv_dart'] = $wgDartCustomKeyValues;
     }
     $options['kv_domain'] = $_SERVER['HTTP_HOST'];
     $options['hasMoreCalls'] = true;
     $options['isCalledAfterOnload'] = true;
     $options['maxLoadDelay'] = 6000;
     $js = "LiftiumOptions = " . json_encode($options) . ";\n";
     $out = "\n<!-- Liftium options -->\n";
     $out .= Html::inlineScript($js) . "\n";
     wfProfileOut(__METHOD__);
     return $out;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:AdEngine2Controller.class.php

示例3: makeVariablesScript

 private static function makeVariablesScript($data)
 {
     if ($data) {
         return \Html::inlineScript(ResourceLoader::makeLoaderConditionalScript(ResourceLoader::makeConfigSetScript($data)));
     }
     return '';
 }
开发者ID:paladox,项目名称:SemanticFormsSelect,代码行数:7,代码来源:Output.php

示例4: getResultText

 /**
  * Return serialised results in specified format.
  * Implemented by subclasses.
  */
 protected function getResultText(SMWQueryResult $res, $outputmode)
 {
     $html = '';
     $id = uniqid();
     // build an array of article IDs contained in the result set
     $objects = array();
     foreach ($res->getResults() as $key => $object) {
         $objects[] = array($object->getTitle()->getArticleId());
         $html .= $key . ': ' . $object->getSerialization() . "<br>\n";
     }
     // build an array of data about the printrequests
     $printrequests = array();
     foreach ($res->getPrintRequests() as $key => $printrequest) {
         $data = $printrequest->getData();
         if ($data instanceof SMWPropertyValue) {
             $name = $data->getDataItem()->getKey();
         } else {
             $name = null;
         }
         $printrequests[] = array($printrequest->getMode(), $printrequest->getLabel(), $name, $printrequest->getOutputFormat(), $printrequest->getParameters());
     }
     // write out results and query params into JS arrays
     // Define the srf_filtered_values array
     SMWOutputs::requireScript('srf_slideshow', Html::inlineScript('srf_slideshow = {};'));
     SMWOutputs::requireScript('srf_slideshow' . $id, Html::inlineScript('srf_slideshow["' . $id . '"] = ' . json_encode(array($objects, $this->params['template'], $this->params['delay'] * 1000, $this->params['height'], $this->params['width'], $this->params['nav controls'], $this->params['effect'], json_encode($printrequests))) . ';'));
     SMWOutputs::requireResource('ext.srf.slideshow');
     if ($this->params['nav controls']) {
         SMWOutputs::requireResource('jquery.ui.slider');
     }
     return Html::element('div', array('id' => $id, 'class' => 'srf-slideshow ' . $id . ' ' . $this->params['class']));
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:35,代码来源:SRF_SlideShow.php

示例5: loadJs

 /**
  * Loads the needed JavaScript.
  * Takes care of non-RL compatibility.
  * 
  * @since 0.1
  */
 public static function loadJs()
 {
     global $wgOut;
     $wgOut->addScript(Html::inlineScript('var ltDebugMessages = ' . FormatJson::encode($GLOBALS['egLiveTranslateDebugJS']) . ';'));
     // For backward compatibility with MW < 1.17.
     if (is_callable(array($wgOut, 'addModules'))) {
         $modules = array('ext.livetranslate');
         switch ($GLOBALS['egLiveTranslateService']) {
             case LTS_GOOGLE:
                 $modules[] = 'ext.lt.google';
                 $wgOut->addHeadItem('ext.lt.google.jsapi', Html::linkedScript('https://www.google.com/jsapi?key=' . htmlspecialchars($GLOBALS['egGoogleApiKey'])));
                 break;
             case LTS_MS:
                 $modules[] = 'ext.lt.ms';
                 $wgOut->addScript(Html::inlineScript('var ltMsAppId = ' . FormatJson::encode($GLOBALS['egLiveTranslateMSAppId']) . ';'));
                 break;
         }
         $wgOut->addModules($modules);
     } else {
         global $egLiveTranslateScriptPath;
         self::addJSLocalisation();
         $wgOut->includeJQuery();
         $wgOut->addHeadItem('ext.livetranslate', Html::linkedScript($egLiveTranslateScriptPath . '/includes/ext.livetranslate.js') . Html::linkedScript($egLiveTranslateScriptPath . '/includes/ext.lt.tm.js') . Html::linkedScript($egLiveTranslateScriptPath . '/includes/jquery.replaceText.js') . Html::linkedScript($egLiveTranslateScriptPath . '/includes/jquery.liveTranslate.js'));
         switch ($GLOBALS['egLiveTranslateService']) {
             case LTS_GOOGLE:
                 $wgOut->addHeadItem('ext.lt.google.jsapi', Html::linkedScript('https://www.google.com/jsapi?key=' . htmlspecialchars($GLOBALS['egGoogleApiKey'])));
                 $wgOut->addHeadItem('ext.lt.google', Html::linkedScript($egLiveTranslateScriptPath . '/includes/ext.lt.google.js'));
                 break;
             case LTS_MS:
                 $wgOut->addScript(Html::inlineScript('var ltMsAppId = ' . FormatJson::encode($GLOBALS['egLiveTranslateMSAppId']) . ';'));
                 $wgOut->addHeadItem('ext.lt.ms', Html::linkedScript($egLiveTranslateScriptPath . '/includes/ext.lt.ms.js'));
                 break;
         }
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:41,代码来源:LiveTranslate_Functions.php

示例6: getForm

 /**
  * Displays the reCAPTCHA widget.
  * If $this->recaptcha_error is set, it will display an error in the widget.
  *
  */
 function getForm()
 {
     global $wgReCaptchaPublicKey, $wgReCaptchaTheme;
     $useHttps = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
     $js = 'var RecaptchaOptions = ' . Xml::encodeJsVar(array('theme' => $wgReCaptchaTheme, 'tabindex' => 1));
     return Html::inlineScript($js) . recaptcha_get_html($wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps);
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:12,代码来源:ReCaptcha.class.php

示例7: addJSVars

 public function addJSVars($data)
 {
     global $wgOut;
     $text = "";
     foreach ($data as $key => $val) {
         $text = $text . "var " . $key . " = " . json_encode($val) . ";";
     }
     $wgOut->addHTML(Html::inlineScript("\n{$text}\n") . "\n");
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:9,代码来源:InterfaceElements.php

示例8: wfJSVariablesTopScripts

/**
 * @param array $vars JS variables to be added at the top of the page
 * @param array $scripts JS scripts to add to the top of the page
 * @return bool return true - it's a hook
 */
function wfJSVariablesTopScripts(array &$vars, &$scripts)
{
    $wg = F::app()->wg;
    $title = $wg->Title;
    $out = $wg->Out;
    // ads need it
    $vars['wgAfterContentAndJS'] = array();
    if (is_array($wg->WikiFactoryTags)) {
        $vars['wgWikiFactoryTagIds'] = array_keys($wg->WikiFactoryTags);
        $vars['wgWikiFactoryTagNames'] = array_values($wg->WikiFactoryTags);
    }
    $vars['wgCdnRootUrl'] = $wg->CdnRootUrl;
    $vars['wgCdnApiUrl'] = $wg->CdnApiUrl;
    // analytics needs it (from here till the end of the function)
    $vars['wgDBname'] = $wg->DBname;
    $vars['wgCityId'] = $wg->CityId;
    // c&p from OutputPage::getJSVars with an old 1.16 name
    $vars['wgContentLanguage'] = $title->getPageLanguage()->getCode();
    // c&p from OutputPage::getJSVars, it's needed earlier
    $user = $wg->User;
    /** @var $user User */
    if ($user->isAnon()) {
        $vars['wgUserName'] = null;
    } else {
        $vars['wgUserName'] = $user->getName();
        /*
         * Remove when SOC-217 ABTest is finished
         */
        $vars['wgNotConfirmedEmail'] = $user->getGlobalAttribute(UserLoginSpecialController::NOT_CONFIRMED_LOGIN_OPTION_NAME);
        /*
         * End remove
         */
    }
    if ($out->isArticle()) {
        $vars['wgArticleId'] = $out->getWikiPage()->getId();
    }
    $vars['wgCategories'] = $out->getCategories();
    $vars['wgPageName'] = $title->getPrefixedDBKey();
    $vars['wikiaPageType'] = WikiaPageType::getPageType();
    $vars['wikiaPageIsCorporate'] = WikiaPageType::isCorporatePage();
    $vars['wgArticleType'] = WikiaPageType::getArticleType();
    // missing in 1.19
    $skin = RequestContext::getMain()->getSkin();
    $vars['skin'] = $skin->getSkinName();
    // for Google Analytics
    $vars['_gaq'] = array();
    $vars['wgIsGASpecialWiki'] = $wg->IsGASpecialWiki;
    // PER-58: moved wgStyleVersion to <head>
    $vars['wgStyleVersion'] = (string) $wg->StyleVersion;
    $wg->NoExternals = $wg->Request->getBool('noexternals', $wg->NoExternals);
    if (!empty($wg->NoExternals)) {
        $vars["wgNoExternals"] = $wg->NoExternals;
    }
    $vars['wgTransactionContext'] = Transaction::getAttributes();
    $scripts .= Html::inlineScript("var wgNow = new Date();") . "\n";
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:62,代码来源:JSVariables.php

示例9: setup

 /**
  * Static setup method for input type "menuselect".
  * Adds the Javascript code and css used by all menuselects.
  */
 private static function setup()
 {
     global $wgOut, $wgLang;
     static $hasRun = false;
     if (!$hasRun) {
         $hasRun = true;
         // set localized messages (use MW i18n, not jQuery i18n)
         $jstext = "jQuery(function(){mw.loader.using('jquery.ui.datepicker', function(){\n" . "\tjQuery.datepicker.regional['wiki'] = {\n" . "\t\tcloseText: '" . Xml::escapeJsString(wfMsg('semanticformsinputs-close')) . "',\n" . "\t\tprevText: '" . Xml::escapeJsString(wfMsg('semanticformsinputs-prev')) . "',\n" . "\t\tnextText: '" . Xml::escapeJsString(wfMsg('semanticformsinputs-next')) . "',\n" . "\t\tcurrentText: '" . Xml::escapeJsString(wfMsg('semanticformsinputs-today')) . "',\n" . "\t\tmonthNames: ['" . Xml::escapeJsString(wfMsg('january')) . "','" . Xml::escapeJsString(wfMsg('february')) . "','" . Xml::escapeJsString(wfMsg('march')) . "','" . Xml::escapeJsString(wfMsg('april')) . "','" . Xml::escapeJsString(wfMsg('may_long')) . "','" . Xml::escapeJsString(wfMsg('june')) . "','" . Xml::escapeJsString(wfMsg('july')) . "','" . Xml::escapeJsString(wfMsg('august')) . "','" . Xml::escapeJsString(wfMsg('september')) . "','" . Xml::escapeJsString(wfMsg('october')) . "','" . Xml::escapeJsString(wfMsg('november')) . "','" . Xml::escapeJsString(wfMsg('december')) . "'],\n" . "\t\tmonthNamesShort: ['" . Xml::escapeJsString(wfMsg('jan')) . "','" . Xml::escapeJsString(wfMsg('feb')) . "','" . Xml::escapeJsString(wfMsg('mar')) . "','" . Xml::escapeJsString(wfMsg('apr')) . "','" . Xml::escapeJsString(wfMsg('may')) . "','" . Xml::escapeJsString(wfMsg('jun')) . "','" . Xml::escapeJsString(wfMsg('jul')) . "','" . Xml::escapeJsString(wfMsg('aug')) . "','" . Xml::escapeJsString(wfMsg('sep')) . "','" . Xml::escapeJsString(wfMsg('oct')) . "','" . Xml::escapeJsString(wfMsg('nov')) . "','" . Xml::escapeJsString(wfMsg('dec')) . "'],\n" . "\t\tdayNames: ['" . Xml::escapeJsString(wfMsg('sunday')) . "','" . Xml::escapeJsString(wfMsg('monday')) . "','" . Xml::escapeJsString(wfMsg('tuesday')) . "','" . Xml::escapeJsString(wfMsg('wednesday')) . "','" . Xml::escapeJsString(wfMsg('thursday')) . "','" . Xml::escapeJsString(wfMsg('friday')) . "','" . Xml::escapeJsString(wfMsg('saturday')) . "'],\n" . "\t\tdayNamesShort: ['" . Xml::escapeJsString(wfMsg('sun')) . "','" . Xml::escapeJsString(wfMsg('mon')) . "','" . Xml::escapeJsString(wfMsg('tue')) . "','" . Xml::escapeJsString(wfMsg('wed')) . "','" . Xml::escapeJsString(wfMsg('thu')) . "','" . Xml::escapeJsString(wfMsg('fri')) . "','" . Xml::escapeJsString(wfMsg('sat')) . "'],\n" . "\t\tdayNamesMin: ['" . Xml::escapeJsString($wgLang->firstChar(wfMsg('sun'))) . "','" . Xml::escapeJsString($wgLang->firstChar(wfMsg('mon'))) . "','" . Xml::escapeJsString($wgLang->firstChar(wfMsg('tue'))) . "','" . Xml::escapeJsString($wgLang->firstChar(wfMsg('wed'))) . "','" . Xml::escapeJsString($wgLang->firstChar(wfMsg('thu'))) . "','" . Xml::escapeJsString($wgLang->firstChar(wfMsg('fri'))) . "','" . Xml::escapeJsString($wgLang->firstChar(wfMsg('sat'))) . "'],\n" . "\t\tweekHeader: '',\n" . "\t\tdateFormat: '" . Xml::escapeJsString(wfMsg('semanticformsinputs-dateformatshort')) . "',\n" . "\t\tfirstDay: '" . Xml::escapeJsString(wfMsg('semanticformsinputs-firstdayofweek')) . "',\n" . "\t\tisRTL: " . ($wgLang->isRTL() ? "true" : "false") . ",\n" . "\t\tshowMonthAfterYear: false,\n" . "\t\tyearSuffix: ''};\n" . "\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['wiki']);\n" . "});});\n";
         $wgOut->addScript(Html::inlineScript($jstext));
     }
 }
开发者ID:rduecyg,项目名称:OU,代码行数:15,代码来源:SFI_DatePicker.php

示例10: getForm

    function getForm()
    {
        global $wgAsirraEnlargedPosition, $wgAsirraCellsPerRow, $wgOut, $wgLang;
        $wgOut->addModules('ext.confirmedit.asirra');
        $js = Html::linkedScript($this->asirra_clientscript);
        $message = Xml::encodeJsVar(wfMessage('asirra-createaccount-fail')->plain());
        $js .= Html::inlineScript(<<<JAVASCRIPT
var asirra_js_failed = '{$message}';
JAVASCRIPT
);
        $js .= '<noscript>' . wfMessage('asirra-nojs')->parse() . '</noscript>';
        return $js;
    }
开发者ID:yusufchang,项目名称:app,代码行数:13,代码来源:Asirra.class.php

示例11: getFrom

    /**
     * Returns the HTML for a storysubmission form.
     * 
     * @param Parser $parser
     * @param array $args
     * 
     * @return HTML
     */
    private static function getFrom(Parser $parser, array $args)
    {
        global $wgUser, $wgStyleVersion, $wgScriptPath, $wgStylePath;
        global $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen;
        $maxLen = array_key_exists('maxlength', $args) && is_int($args['maxlength']) ? $args['maxlength'] : $egStoryboardMaxStoryLen;
        $minLen = array_key_exists('minlength', $args) && is_int($args['minlength']) ? $args['minlength'] : $egStoryboardMinStoryLen;
        efStoryboardAddJSLocalisation($parser);
        // Loading a seperate JS file would be overkill for just these 3 lines, and be bad for performance.
        $parser->getOutput()->addHeadItem(Html::linkedStyle("{$egStoryboardScriptPath}/storyboard.css?{$wgStyleVersion}") . Html::linkedScript("{$egStoryboardScriptPath}/storyboard.js?{$wgStyleVersion}") . Html::linkedScript("{$wgStylePath}/common/jquery.min.js?{$wgStyleVersion}") . Html::linkedScript("{$egStoryboardScriptPath}/jquery/jquery.validate.js?{$wgStyleVersion}") . Html::inlineScript(<<<EOT
\$(function() {
\tdocument.getElementById( 'storysubmission-button' ).disabled = true;
\tstbValidateStory( document.getElementById('storytext'), {$minLen}, {$maxLen}, 'storysubmission-charlimitinfo', 'storysubmission-button' )
\t\$("#storyform").validate({
\t\tmessages: {
\t\t\tstorytitle: {
\t\t\t\tremote: jQuery.validator.format( stbMsg( 'storyboard-alreadyexistschange' ) )
\t\t\t}
\t\t}
\t});\t\t
});\t\t\t
EOT
));
        $fieldSize = 50;
        $width = StoryboardUtils::getDimension($args, 'width', $egStorysubmissionWidth);
        $formBody = "<table width='{$width}'>";
        $defaultName = '';
        $defaultEmail = '';
        if ($wgUser->isLoggedIn()) {
            $defaultName = $wgUser->getRealName() !== '' ? $wgUser->getRealName() : $wgUser->getName();
            $defaultEmail = $wgUser->getEmail();
        }
        $formBody .= '<tr>' . Html::element('td', array('width' => '100%'), wfMsg('storyboard-yourname')) . '<td>' . Html::input('name', $defaultName, 'text', array('size' => $fieldSize, 'class' => 'required', 'maxlength' => 255, 'minlength' => 2)) . '</td></tr>';
        $formBody .= '<tr>' . Html::element('td', array('width' => '100%'), wfMsg('storyboard-location')) . '<td>' . Html::input('location', '', 'text', array('size' => $fieldSize, 'maxlength' => 255, 'minlength' => 2)) . '</td></tr>';
        $formBody .= '<tr>' . Html::element('td', array('width' => '100%'), wfMsg('storyboard-occupation')) . '<td>' . Html::input('occupation', '', 'text', array('size' => $fieldSize, 'maxlength' => 255, 'minlength' => 4)) . '</td></tr>';
        $formBody .= '<tr>' . Html::element('td', array('width' => '100%'), wfMsg('storyboard-email')) . '<td>' . Html::input('email', $defaultEmail, 'text', array('size' => $fieldSize, 'class' => 'required email', 'size' => $fieldSize, 'maxlength' => 255)) . '</td></tr>';
        $formBody .= '<tr>' . Html::element('td', array('width' => '100%'), wfMsg('storyboard-storytitle')) . '<td>' . Html::input('storytitle', '', 'text', array('size' => $fieldSize, 'class' => 'required storytitle', 'maxlength' => 255, 'minlength' => 2, 'remote' => "{$wgScriptPath}/api.php?format=json&action=storyexists")) . '</td></tr>';
        $formBody .= '<tr><td colspan="2">' . wfMsg('storyboard-story') . Html::element('div', array('class' => 'storysubmission-charcount', 'id' => 'storysubmission-charlimitinfo'), wfMsgExt('storyboard-charsneeded', 'parsemag', $minLen)) . '<br />' . Html::element('textarea', array('id' => 'storytext', 'name' => 'storytext', 'rows' => 7, 'class' => 'required', 'onkeyup' => "stbValidateStory( this, {$minLen}, {$maxLen}, 'storysubmission-charlimitinfo', 'storysubmission-button' )"), null) . '</td></tr>';
        // TODO: add upload functionality
        $formBody .= '<tr><td colspan="2"><input type="checkbox" id="storyboard-agreement" />&#160;' . $parser->recursiveTagParse(htmlspecialchars(wfMsg('storyboard-agreement'))) . '</td></tr>';
        $formBody .= '<tr><td colspan="2">' . Html::input('storysubmission-button', wfMsg('htmlform-submit'), 'submit', array('id' => 'storysubmission-button')) . '</td></tr>';
        $formBody .= '</table>';
        $formBody .= Html::hidden('wpStoryEditToken', $wgUser->editToken());
        if (!array_key_exists('language', $args) || !array_key_exists($args['language'], Language::getLanguageNames())) {
            global $wgContLanguageCode;
            $args['language'] = $wgContLanguageCode;
        }
        $formBody .= Html::hidden('lang', $args['language']);
        return Html::rawElement('form', array('id' => 'storyform', 'name' => 'storyform', 'method' => 'post', 'action' => SpecialPage::getTitleFor('StorySubmission')->getFullURL(), 'onsubmit' => 'return stbValidateSubmission( "storyboard-agreement" );'), $formBody);
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:57,代码来源:Storysubmission_body.php

示例12: wfWikimediaMobileAddJs

function wfWikimediaMobileAddJs( &$outputPage, &$skin ) {
	global $wgOut, $wgExtensionAssetsPath, $wgWikimediaMobileVersion;

	global $wgTitle, $wgRequest, $wgWikimediaMobileUrl;
	$ns = $wgTitle->getNamespace();
	$action = FormatJson::encode( $wgRequest->getVal( 'action', 'view' ) );
	$page = FormatJson::encode( $wgTitle->getPrefixedDBkey() );
	$mainpage = Title::newMainPage();
	$mp = FormatJson::encode( $mainpage ? $mainpage->getPrefixedText() : null );
	$url = FormatJson::encode( $wgWikimediaMobileUrl );
	$wgOut->addHeadItem( 'mobileredirectvars', Html::inlineScript( "wgNamespaceNumber=$ns;wgAction=$action;wgPageName=$page;wgMainPageTitle=$mp;wgWikimediaMobileUrl=$url;" ) );
	$wgOut->addHeadItem( 'mobileredirect', Html::linkedScript(
		"$wgExtensionAssetsPath/WikimediaMobile/MobileRedirect.js?$wgWikimediaMobileVersion"
	) );
	return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:16,代码来源:WikimediaMobile.php

示例13: onSkinGetHeadScripts

 /**
  * Add inline JS in <head> section
  *
  * @param string $scripts inline JS scripts
  * @return boolean return true
  */
 public function onSkinGetHeadScripts(&$scripts)
 {
     // used for page load time tracking
     $scripts .= "\n\n<!-- Used for page load time tracking -->\n" . Html::inlineScript("var wgNow = new Date();") . "\n";
     // Create a small stub which will spool up any event calls that happen before the real code is loaded.
     $scripts .= "\n\n<!-- Spool any early event-tracking calls -->\n" . Html::inlineScript(self::getTrackerSpoolingJs()) . "\n";
     // debug
     /**
     		$scripts .= Html::inlineScript(<<<JS
     _wtq.push('/1_wikia/foo/bar');
     _wtq.push(['/1_wikia/foo/bar', 'profil1']);
     _wtq.push([['1_wikia', 'user', 'foo', 'bar'], 'profil1']);
     JS
     );
     		**/
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:23,代码来源:WikiaTrackerController.class.php

示例14: render

 /**
  * Renders the storyboard tag.
  * 
  * @param $input
  * @param array $args
  * @param Parser $parser
  * @param $frame
  * 
  * @return array
  */
 public static function render($input, array $args, Parser $parser, $frame)
 {
     global $wgScriptPath, $wgStylePath, $wgStyleVersion, $wgContLanguageCode;
     global $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight;
     efStoryboardAddJSLocalisation($parser);
     // TODO: Combine+minfiy JS files, add switch to use combined+minified version
     $parser->getOutput()->addHeadItem(Html::linkedStyle("{$egStoryboardScriptPath}/storyboard.css?{$wgStyleVersion}") . Html::linkedScript("{$wgStylePath}/common/jquery.min.js?{$wgStyleVersion}") . Html::linkedScript("{$egStoryboardScriptPath}/jquery/jquery.ajaxscroll.js?{$wgStyleVersion}") . Html::linkedScript("{$egStoryboardScriptPath}/tags/Storyboard/storyboard.js?{$wgStyleVersion}") . Html::linkedScript("{$egStoryboardScriptPath}/storyboard.js?{$wgStyleVersion}"));
     $width = StoryboardUtils::getDimension($args, 'width', $egStoryboardWidth);
     $height = StoryboardUtils::getDimension($args, 'height', $egStoryboardHeight);
     $languages = Language::getLanguageNames();
     if (array_key_exists('language', $args) && array_key_exists($args['language'], $languages)) {
         $language = $args['language'];
     } else {
         $language = $wgContLanguageCode;
     }
     $parser->getOutput()->addHeadItem(Html::inlineScript("var storyboardLanguage = '{$language}';"));
     $output = Html::element('div', array('class' => 'storyboard', 'style' => "height: {$height}; width: {$width};"));
     return array($output, 'noparse' => true, 'isHTML' => true);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:29,代码来源:Storyboard_body.php

示例15: testGetScriptsWithCombinedGroups

 /**
  * Test for WikiaSkin::getScriptsWithCombinedGroups
  */
 public function testGetScriptsWithCombinedGroups()
 {
     global $wgStyleVersion, $wgCdnRootUrl;
     $cb = $wgStyleVersion;
     $inlineScripts = ['var inlineScript = true;'];
     $groups = ['tracker_js', 'oasis_jquery'];
     $singleAssets = ['/extensions/wikia/Foo/js/bar.js'];
     $skin = new DummySkin();
     $out = $skin->getOutput();
     // add the stuff the output
     foreach ($inlineScripts as $item) {
         $out->addScript(\Html::inlineScript($item));
     }
     foreach ($groups as $item) {
         \Wikia::addAssetsToOutput($item);
     }
     foreach ($singleAssets as $item) {
         \Wikia::addAssetsToOutput($item);
     }
     $jsGroups = ['jquery'];
     $combinedScripts = $skin->getScriptsWithCombinedGroups($jsGroups);
     // assert that single AM groups are not requested
     foreach ($groups as $item) {
         $this->assertNotContains("/__am/{$cb}/group/-/{$item}", $combinedScripts, "'{$item}' group should not be loaded separately");
     }
     // assert that single static files are still requested
     foreach ($singleAssets as $item) {
         $this->assertContains("/{$item}", $combinedScripts, "'{$item}' asset should still be loaded separately");
     }
     // assert that inline scripts are still there
     foreach ($inlineScripts as $item) {
         $this->assertContains(\Html::inlineScript($item), $combinedScripts, "Inline scripts should be kept");
     }
     // assert that combined AM groups <script> tag is the first one
     $items = join(',', array_merge(['jquery'], $groups));
     $this->assertStringStartsWith("<script src='{$wgCdnRootUrl}/__am/{$cb}/groups/-/{$items}", $combinedScripts, "'{$items}' groups should be loaded in a single request");
     // $jsGroups should be updated with the full list of combined groups
     $this->assertEquals($jsGroups, array_merge(['jquery'], $groups), '$jsGroups should contain the list of combined groups');
 }
开发者ID:yusufchang,项目名称:app,代码行数:42,代码来源:WikiaSkinTest.php


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