本文整理汇总了PHP中Html::linkedScript方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::linkedScript方法的具体用法?PHP Html::linkedScript怎么用?PHP Html::linkedScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::linkedScript方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTML
public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args)
{
global $sfgTabIndex, $sfgFieldNum;
global $wgOut;
$scripts = array("https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false");
$scriptsHTML = '';
foreach ($scripts as $script) {
$scriptsHTML .= Html::linkedScript($script);
}
$wgOut->addHeadItem($scriptsHTML, $scriptsHTML);
$wgOut->addModules('ext.semanticforms.maps');
$parsedCurValue = SFOpenLayersInput::parseCoordinatesString($cur_value);
$coordsInput = Html::element('input', array('type' => 'text', 'class' => 'sfCoordsInput', 'name' => $input_name, 'value' => $parsedCurValue, 'size' => 40));
$mapUpdateButton = Html::element('input', array('type' => 'button', 'class' => 'sfUpdateMap', 'value' => wfMessage('sf-maps-setmarker')->parse()), null);
$addressLookupInput = Html::element('input', array('type' => 'text', 'class' => 'sfAddressInput', 'size' => 40, 'placeholder' => wfMessage('sf-maps-enteraddress')->parse()), null);
$addressLookupButton = Html::element('input', array('type' => 'button', 'class' => 'sfLookUpAddress', 'value' => wfMessage('sf-maps-lookupcoordinates')->parse()), null);
$mapCanvas = Html::element('div', array('class' => 'sfMapCanvas', 'style' => 'height: 500px; width: 500px;'), 'Map goes here...');
$fullInputHTML = <<<END
<div style="padding-bottom: 10px;">
{$coordsInput}
{$mapUpdateButton}
</div>
<div style="padding-bottom: 10px;">
{$addressLookupInput}
{$addressLookupButton}
</div>
{$mapCanvas}
END;
$text = Html::rawElement('div', array('class' => 'sfGoogleMapsInput'), $fullInputHTML);
return $text;
}
示例2: 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;
}
}
}
示例3: tooltip
static function tooltip( $parser, $tooltip = null, $text = null ) {
if ( !$text ) {
return;
}
$tooltip = Xml::tags( 'span',
array( 'style' => 'display: none', 'class' => 'mw-tooltip' ),
$tooltip );
$text .= "\n$tooltip";
$text = Xml::tags( 'span',
array( 'class' => 'mw-tooltip-text' ), $text );
// Script for hover behaviour hacked in by Andrew Garrett, 2010-08-09
static $scriptDone = false;
if ( ! $scriptDone ) {
$scriptDone = true;
global $wgOut, $IP, $wgScriptPath;
$output = $parser->getOutput();
// Figure out the web-accessible path to the extension.
$dir = dirname( __FILE__ );
if ( strpos( $dir, $IP ) === 0 ) {
$dir = substr( $dir, strlen($IP) );
$dir = $wgScriptPath . $dir;
$output->addHeadItem( "<link rel=\"stylesheet\" type=\"text/css\" href=\"$dir/jquery-tooltip/jquery.tooltip.css\"/>" );
$output->addHeadItem( Html::linkedScript( "$dir/jquery-tooltip/jquery.tooltip.pack.js" ) );
$output->addHeadItem( Html::linkedScript( "$dir/hover.js" ) );
}
}
return $text;
}
示例4: __construct
function __construct()
{
parent::__construct();
$this->classname = "leaflet";
$this->resourceModules[] = 'ext.MultiMaps.Leaflet';
$leafletPath = $GLOBALS['egMultiMapsScriptPath'] . '/services/Leaflet/leaflet';
$this->headerItem .= \Html::linkedStyle("{$leafletPath}/leaflet.css") . '<!--[if lte IE 8]>' . \Html::linkedStyle("{$leafletPath}/leaflet.ie.css") . '<![endif]-->' . \Html::linkedScript("{$leafletPath}/leaflet.js");
}
示例5: __construct
function __construct()
{
parent::__construct();
$this->classname = "google";
$this->resourceModules[] = 'ext.MultiMaps.Google';
$urlArgs = array();
$urlArgs['sensor'] = 'false';
$urlArgs['v'] = '3.10';
$this->headerItem .= \Html::linkedScript('//maps.googleapis.com/maps/api/js?' . wfArrayToCgi($urlArgs)) . "\n";
}
示例6: onSkinAfterBottomScripts
public static function onSkinAfterBottomScripts($skin, &$text)
{
if (WikiaPageType::isMainPage()) {
$scripts = AssetsManager::getInstance()->getURL('njord_js');
foreach ($scripts as $script) {
$text .= Html::linkedScript($script);
}
}
return true;
}
示例7: onSkinAfterBottomScripts
/**
* Adds assets on the bottom of the body tag for special maps page
*
* @param {String} $skin
* @param {String} $text
*
* @return bool
*/
public static function onSkinAfterBottomScripts($skin, &$text)
{
if (self::isSpecialMapsPage()) {
$scripts = AssetsManager::getInstance()->getURL('wikia_maps_special_page_js');
foreach ($scripts as $script) {
$text .= Html::linkedScript($script);
}
}
return true;
}
示例8: onSkinAfterBottomScripts
public static function onSkinAfterBottomScripts(Skin $skin, &$text)
{
$title = $skin->getTitle();
if (TemplateDraftHelper::allowedForTitle($title)) {
$scripts = AssetsManager::getInstance()->getURL('template_draft');
foreach ($scripts as $script) {
$text .= Html::linkedScript($script);
}
}
return true;
}
示例9: loadJs
/**
* Loads the needed JavaScript.
* Takes care of non-RL compatibility.
*
* @since 0.1
*/
protected static function loadJs()
{
global $wgOut;
// For backward compatibility with MW < 1.17.
if (is_callable(array($wgOut, 'addModules'))) {
$wgOut->addModules('ext.push.tab');
} else {
global $egPushScriptPath;
PushFunctions::addJSLocalisation();
$wgOut->addHeadItem('ext.push.tab', Html::linkedScript($egPushScriptPath . '/includes/ext.push.tab.js'));
}
}
示例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;
}
示例11: __construct
/**
* @param array $params experiment parameters
*/
function __construct(array $params)
{
$delay = $params['delay'];
// add a JS global variable with the defined delay
$this->on('WikiaSkinTopScripts', function (array &$vars) use($delay) {
$vars['wgPerfTestFrontEndDelay'] = intval($delay);
return true;
});
$this->on('BeforePageDisplay', function (\OutputPage $out, \Skin $skin) {
$out->addScript(\Html::linkedScript(\AssetsManager::getInstance()->getOneCommonURL('extensions/wikia/AbPerformanceTesting/js/FrontendDelay.js')));
return true;
});
}
示例12: 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" /> ' . $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);
}
示例13: elmEasyRefOutput
function elmEasyRefOutput(OutputPage $outputPage, $skin)
{
global $wgScriptPath;
// Options
global $wgElmEasyRefAddCSS, $wgElmEasyRefDebugMode, $wgElmEasyRefBodyContentId, $wgElmEasyRefAnimation, $wgElmEasyRefMetrics, $wgElmEasyRefNum_rp, $wgElmEasyRefNum_mt;
// Register css for popup field
$outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $wgScriptPath . '/extensions/ElmEasyRef/css/referencefield.css'));
// Additonal css if setted
if ($wgElmEasyRefAddCSS) {
$outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $wgElmEasyRefAddCSS));
}
// Register js-script file
$src = '/extensions/ElmEasyRef/js/elmEasyRef';
if (!$wgElmEasyRefDebugMode) {
$src .= '-min';
}
$outputPage->addScript(Html::linkedScript($wgScriptPath . $src . '.js'));
// Settings
$settings = '';
if ($wgElmEasyRefDebugMode) {
$settings .= 'elmEasyRef.debug = true;';
}
if ($wgElmEasyRefBodyContentId) {
$settings .= 'elmEasyRef.bodyContentId = ' . Xml::encodeJsVar($wgElmEasyRefBodyContentId) . ';';
}
if ($wgElmEasyRefNum_rp) {
$settings .= 'elmEasyRef.regRefNum_rp = /' . $wgElmEasyRefNum_rp . '/;';
}
if ($wgElmEasyRefNum_mt) {
$settings .= 'elmEasyRef.regRefNum_mt = /' . $wgElmEasyRefNum_mt . '/;';
}
if ($wgElmEasyRefAnimation) {
foreach ($wgElmEasyRefAnimation as $prop => $val) {
$settings .= 'elmEasyRef.animation.' . $prop . ' = ' . Xml::encodeJsVar($val) . ';';
}
}
if ($wgElmEasyRefMetrics) {
foreach ($wgElmEasyRefMetrics as $prop => $val) {
$settings .= 'elmEasyRef.fieldm.' . $prop . ' = ' . Xml::encodeJsVar($val) . ';';
}
}
$msg = wfMsgExt('elm-easyref-ref', 'parseinline');
$settings .= 'elmEasyRef.messages.elm_easyref_ref = ' . Xml::encodeJsVar($msg) . ';';
$msg = wfMsgExt('elm-easyref-close', 'parseinline');
$settings .= 'elmEasyRef.messages.elm_easyref_close = ' . Xml::encodeJsVar($msg) . ';';
$outputPage->addInlineScript('addOnloadHook( function() {' . $settings . 'elmEasyRef.prepare();' . '} );');
return true;
}
示例14: 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;
}
示例15: Inject_JS
public static function Inject_JS(OutputPage $out)
{
global $wgMathJaxJS, $wgMathJaxProcConf, $wgMathJaxLocConf;
if (self::$jsInserted === true) {
return true;
}
$userConfig = $wgMathJaxLocConf ?: self::$defaultCustomConfig;
$configContents = file_get_contents(__DIR__ . '/../../public' . $userConfig);
$out->addScript(\Html::rawElement('script', ['type' => 'text/x-mathjax-config'], "\n" . $configContents . "\n"));
$file = $wgMathJaxJS ?: self::$defaultMathJaxPath;
$config = $wgMathJaxProcConf ?: self::$defaultMathJaxConfig;
$url = $file . '?' . http_build_query(['config' => $config], NULL, '&');
$out->addScript(Html::linkedScript($url));
self::$jsInserted = true;
return true;
}