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


PHP Xml::encodeJsVar方法代码示例

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


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

示例1: 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

示例2: execute

 /**
  * Show the special page
  *
  * @param $par String: name of the user to sudo into
  */
 public function execute($par)
 {
     global $wgOut, $wgExtensionAssetsPath;
     $this->mSkin = new ThemeDesignerDummySkin();
     $this->setHeaders();
     if (function_exists("OutputPage::includeJQuery")) {
         $wgOut->includeJQuery();
     }
     $wgOut->addExtensionStyle("{$wgExtensionAssetsPath}/ThemeDesigner/frame/style/main.css");
     // Yes, the following is ugly... though I still haven't decided if I want to become completely ResourceLoader dependant
     // While 1.16 is still stable.
     $varScript = array();
     foreach (array('leavewarning', 'resizertext') as $msgName) {
         $varScript[] = 'msg' . ucfirst($msgName) . ' = ' . Xml::encodeJsVar((string) wfMsg("themedesigner-{$msgName}"));
     }
     $varScript = 'var ' . implode(", ", $varScript) . ';';
     $wgOut->addInlineScript($varScript);
     $wgOut->addScriptFile("{$wgExtensionAssetsPath}/ThemeDesigner/frame/designer.js");
     echo $wgOut->headElement($this->mSkin);
     $wgOut->sendCacheControl();
     $wgOut->disable();
     // We've collected our html building into a separate file for readability
     require dirname(__FILE__) . '/frame/layout.php';
     echo $this->mSkin->bottomScripts($wgOut);
     echo Html::closeElement('body');
     echo Html::closeElement('html');
 }
开发者ID:yusufchang,项目名称:app,代码行数:32,代码来源:SpecialThemeDesigner.php

示例3: __construct

 function __construct($special)
 {
     $this->special = $special;
     $this->editable = $special->editable;
     parent::__construct();
     // Override paging defaults
     list($this->mLimit, ) = $this->mRequest->getLimitOffset(20, '');
     $this->mLimitsShown = array(20, 50, 100);
     $msg = Xml::encodeJsVar(wfMsg('centralnotice-confirm-delete'));
     $this->onRemoveChange = "if( this.checked ) { this.checked = confirm( {$msg} ) }";
     $this->viewPage = SpecialPage::getTitleFor('NoticeTemplate', 'view');
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:12,代码来源:TemplatePager.php

示例4: getRegisterJS

function getRegisterJS()
{
    $response = new AjaxResponse();
    $response->addText(AjaxLoginForm::getRegisterJS());
    $response->addText(file_get_contents(dirname(__FILE__) . '/AjaxLogin.js') . "\n\n");
    $vars = array('prefs_help_birthmesg' => wfMsg('prefs-help-birthmesg'), 'prefs_help_birthinfo' => wfMsg('prefs-help-birthinfo'), 'prefs_help_mailmesg' => wfMsg('prefs-help-mailmesg'), 'prefs_help_email' => wfMsg('prefs-help-email'), 'prefs_help_blurmesg' => wfMsg('prefs-help-blurmesg'), 'prefs_help_blurinfo' => wfMsgExt('captchahelp-text', array('parse')));
    foreach ($vars as $key => $value) {
        $response->addText("var " . $key . " = " . Xml::encodeJsVar($value) . ";\n");
    }
    header("X-Pass-Cache-Control: s-maxage=315360000, max-age=315360000");
    $response->setCacheDuration(3600 * 24 * 365);
    return $response;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:13,代码来源:ComboAjaxLogin.php

示例5: 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

示例6: __construct

 function __construct($special, $filter = '')
 {
     $this->special = $special;
     $this->editable = $special->editable;
     $this->filter = $filter;
     parent::__construct();
     // Override paging defaults
     list($this->mLimit, ) = $this->mRequest->getLimitOffset(20, '');
     $this->mLimitsShown = array(20, 50, 100);
     $msg = Xml::encodeJsVar($this->msg('promoter-confirm-delete')->text());
     $this->onRemoveChange = "if( this.checked ) { this.checked = confirm( {$msg} ) }";
     $this->viewPage = SpecialPage::getTitleFor('CampaignAd', 'view');
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-Promoter,代码行数:13,代码来源:AdPager.php

示例7: efAddPiwik

function efAddPiwik( $title ) {
	global $wgPiwikIDSite, $wgPiwikURL, $wgPiwikIgnoreSysops, $wgPiwikIgnoreBots, $wgUser, $wgScriptPath, $wgPiwikCustomJS, $wgPiwikActionName, $wgPiwikUsePageTitle;
	if ( !$wgUser->isAllowed( 'bot' ) || !$wgPiwikIgnoreBots ) {
		if ( !$wgUser->isAllowed( 'protect' ) || !$wgPiwikIgnoreSysops ) {
			if ( !empty( $wgPiwikIDSite ) AND !empty( $wgPiwikURL ) ) {
				if ( $wgPiwikUsePageTitle ) {
					$wgPiwikPageTitle = $title->getPrefixedText();

					$wgPiwikFinalActionName = $wgPiwikActionName;
					$wgPiwikFinalActionName .= $wgPiwikPageTitle;
				} else {
					$wgPiwikFinalActionName = $wgPiwikActionName;
				}
				// Stop xss since page title's can have " and stuff in them.
				$wgPiwikFinalActionName = Xml::encodeJsVar( $wgPiwikFinalActionName );
				$funcOutput = <<<PIWIK
<!-- Piwik -->
<script type="text/javascript">
/* <![CDATA[ */
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$wgPiwikURL}" : "http://{$wgPiwikURL}");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
/* ]]> */
</script>
<script type="text/javascript">
/* <![CDATA[ */
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$wgPiwikIDSite});
piwikTracker.setDocumentTitle({$wgPiwikFinalActionName});
piwikTracker.setIgnoreClasses("image");
{$wgPiwikCustomJS}
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
/* ]]> */
</script><noscript><p><img src="http://{$wgPiwikURL}piwik.php?idsite={$wgPiwikIDSite}" style="border:0" alt=""/></p></noscript>
<!-- /Piwik -->
PIWIK;
			} else {
				$funcOutput = "\n<!-- You need to set the settings for Piwik -->";
			}
		} else {
			$funcOutput = "\n<!-- Piwik tracking is disabled for users with 'protect' rights (i.e., sysops) -->";
		}
	} else {
		$funcOutput = "\n<!-- Piwik tracking is disabled for bots -->";
	}

	return $funcOutput;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:49,代码来源:Piwik.php

示例8: 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;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:48,代码来源:ElmEasyRef.php

示例9: efFundraiserPortalLoader

function efFundraiserPortalLoader($out, $skin)
{
    global $wgOut, $wgContLang;
    global $wgFundraiserPortalShow, $wgFundraiserPortalProject, $wgFundraiserPortalPath;
    // Only proceed if we are configured to show the portal
    if (!$wgFundraiserPortalShow) {
        return true;
    }
    // Pull in our loader
    $lang = $wgContLang->getCode();
    // note: this is English-only for now
    $fundraiserLoader = "{$wgFundraiserPortalProject}/{$lang}/fundraiserportal.js";
    $encFundraiserLoader = Xml::encodeJsVar("{$wgFundraiserPortalPath}/{$fundraiserLoader}");
    $wgOut->addInlineScript("var wgFundraiserPortal='', wgFundraiserPortalCSS='';\n" . "mediaWiki.loader.load({$encFundraiserLoader});\n");
    return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:16,代码来源:FundraiserPortal.php

示例10: AddLinkSuggest

function AddLinkSuggest($a, $b, $c, $d)
{
    global $wgOut, $wgExtensionsPath, $wgUser, $wgHooks;
    wfProfileIn(__METHOD__);
    if ($wgUser->getOption('disablelinksuggest') != true) {
        $js = "{$wgExtensionsPath}/wikia/LinkSuggest/LinkSuggest.js";
        // load YUI for Oasis - TODO: Refactor LinkSuggest.js to not use YUI.  Look in /trunk/skins/oasis/js/Search.js for an example of using LinkSuggest with jQuery.
        if (F::app()->checkSkin('oasis')) {
            $wgOut->addHTML('<script type="text/javascript">$(function() {$.loadYUI(function() {$.getScript(' . Xml::encodeJsVar($js) . ')})})</script>');
        } else {
            $wgOut->addScript('<script type="text/javascript" src="' . $js . '"></script>');
        }
        // add global JS variables only when LinkSuggest is really loaded (BugId:20958)
        $wgHooks['MakeGlobalVariablesScript'][] = 'wfLinkSuggestSetupVars';
    }
    wfProfileOut(__METHOD__);
    return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:18,代码来源:LinkSuggest.php

示例11: getJavaScriptDefinition

    /**
     * @see MapsLayer::getJavaScriptDefinition
     * 
     * @since 0.7.2
     * 
     * @return string
     */
    public function getJavaScriptDefinition()
    {
        foreach ($this->properties as $name => $value) {
            ${$name} = MapsMapper::encodeJsVar($value);
        }
        $options = array('extractStyles' => true, 'extractAttributes' => true, 'maxDepth' => $maxdepth);
        $options = Xml::encodeJsVar((object) $options);
        return <<<EOT
\tnew OpenLayers.Layer.GML(
\t\t{$label},
\t\t{$source},
\t\t{
\t\t\tformat: OpenLayers.Format.KML, 
\t\t\tformatOptions: {$options}
\t\t}
\t)
EOT;
    }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:25,代码来源:Maps_KMLLayer.php

示例12: execute

 public function execute()
 {
     // Pop up a dialog box, to make it difficult for the user to forget
     // to download the file
     $lsUrl = $this->getVar('wgServer') . $this->parent->getUrl(['localsettings' => 1]);
     if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
         // JS appears to be the only method that works consistently with IE7+
         $this->addHTML("\n<script>jQuery( function () { location.href = " . Xml::encodeJsVar($lsUrl) . "; } );</script>\n");
     } else {
         $this->parent->request->response()->header("Refresh: 0;url={$lsUrl}");
     }
     $this->startForm();
     $this->parent->disableLinkPopups();
     $this->addHTML($this->parent->getInfoBox(wfMessage('config-install-done', $lsUrl, $this->getVar('wgServer') . $this->getVar('wgScriptPath') . '/index.php', '<downloadlink/>')->plain(), 'tick-32.png'));
     $this->addHTML($this->parent->getInfoBox(wfMessage('config-extension-link')->text()));
     $this->parent->restoreLinkPopups();
     $this->endForm(false, false);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:18,代码来源:WebInstallerComplete.php

示例13: lfPiwikScript

function lfPiwikScript($skin, &$text = '')
{
    global $wmgPiwikSiteID, $wgUser;
    if (!$wmgPiwikSiteID) {
        $text .= "<!-- Piwik not enabled -->\n";
        return true;
    }
    // Disabled Piwik admin blacklisting below Kudu 12/11/13
    /* if ( $wgUser->isAllowed('noanalytics') ) {
    		$text .= "<!-- Piwik code omitted -->\n";
    		return true;
    	} */
    $id = strval($wmgPiwikSiteID);
    $title = $skin->getRelevantTitle();
    $jstitle = Xml::encodeJsVar($title->getPrefixedText());
    $urltitle = $title->getPrefixedURL();
    $userType = $wgUser->isLoggedIn() ? "User" : "Anonymous";
    $text .= <<<SCRIPT
<!-- Piwik -->
<script type="text/javascript">
\tvar _paq = _paq || [];
\t_paq.push(["trackPageView"]);
\t_paq.push(["enableLinkTracking"]);

\t(function() {
\t\tvar u=(("https:" == document.location.protocol) ? "https" : "http") + "://bits.orain.org/piwik/";
\t\t_paq.push(["setTrackerUrl", u+"piwik.php"]);
\t\t_paq.push(['setDocumentTitle', {$jstitle}]);
\t\t_paq.push(["setSiteId", "{$id}"]);
\t\t_paq.push(["setCustomVariable", 1, "userType", "{$userType}", "visit"]);
\t\tvar d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
\t\tg.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
\t})();
</script>
<!-- End Piwik Code -->
<!-- Piwik Image Tracker -->
<noscript>
<img src="//bits.orain.org/piwik/piwik.php?idsite={$id}&amp;rec=1&amp;action_name={$urltitle}" style="border:0" alt="" />
</noscript>
<!-- End Piwik -->
SCRIPT;
    return true;
}
开发者ID:Agent-Isai,项目名称:ansible-playbook,代码行数:43,代码来源:LocalPiwik.php

示例14: getJavaScriptDefinition

    /**
     * @see MapsLayer::getJavaScriptDefinition
     * 
     * @since 0.7.2
     * 
     * @return string
     */
    public function getJavaScriptDefinition()
    {
        foreach ($this->properties as $name => $value) {
            ${$name} = MapsMapper::encodeJsVar($value);
        }
        $options = array('isImage' => true);
        if ($zoomlevels !== false) {
            $options['numZoomLevels'] = $zoomlevels;
        }
        $options = Xml::encodeJsVar((object) $options);
        return <<<EOT
\tnew OpenLayers.Layer.Image(
\t\t{$label},
\t\t{$source},
\t\tnew OpenLayers.Bounds({$leftbound}, {$lowerbound}, {$rightbound}, {$upperbound}),
\t\tnew OpenLayers.Size({$width}, {$height}),
\t\t{$options}
\t)
EOT;
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:Maps_ImageLayer.php

示例15: toHtml

 function toHtml($options = array())
 {
     global $wgOut, $wgPDBHandlerUseWebGL;
     if ($wgPDBHandlerUseWebGL && self::$serial == 0) {
         $wgOut->addModules('ext.PDBHandler');
     }
     self::$serial++;
     $id = sprintf('glmol_%d', self::$serial);
     $ret = '';
     // parameters
     if ($wgPDBHandlerUseWebGL) {
         $ret .= '<script type="text/javascript">';
         $ret .= 'if (pdbHandlerParams == undefined) var pdbHandlerParams = {};';
         $ret .= sprintf('pdbHandlerParams[\'%s\'] = %s;', $id, Xml::encodeJsVar($this->file->getUrl()));
         $ret .= '</script>';
     }
     // canvas
     $ret .= sprintf('<div id="%s" style="width:%dpx;height:%dpx;display:inline-block;">%s</div>', $id, $this->width, $this->height, parent::toHTML($options));
     return $ret;
 }
开发者ID:neuroinformatics,项目名称:mediawiki-extensions-PDBHandler,代码行数:20,代码来源:PDBHandlerTransformOutput.php


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