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


PHP Xml::encodeJsCall方法代码示例

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


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

示例1: makeRedirectContent

 /**
  * Create a redirect that is also valid JavaScript
  *
  * @param Title $destination
  * @param string $text ignored
  * @return JavaScriptContent
  */
 public function makeRedirectContent(Title $destination, $text = '')
 {
     // The parameters are passed as a string so the / is not url-encoded by wfArrayToCgi
     $url = $destination->getFullURL('action=raw&ctype=text/javascript', false, PROTO_RELATIVE);
     $class = $this->getContentClass();
     return new $class('/* #REDIRECT */' . Xml::encodeJsCall('mw.loader.load', [$url]));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:JavaScriptContentHandler.php

示例2: getScript

 /**
  * @param ResourceLoaderContext $context
  * @return string JavaScript code
  */
 public function getScript(ResourceLoaderContext $context)
 {
     $fileScript = parent::getScript($context);
     $tagData = Sanitizer::getRecognizedTagData();
     $parserDefaults = array();
     $parserDefaults['allowedHtmlElements'] = array_merge(array_keys($tagData['htmlpairs']), array_diff(array_keys($tagData['htmlsingle']), array_keys($tagData['htmlsingleonly'])));
     $dataScript = Xml::encodeJsCall('mw.jqueryMsg.setParserDefaults', array($parserDefaults));
     return $fileScript . $dataScript;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:13,代码来源:ResourceLoaderJqueryMsgModule.php

示例3: getScript

 /**
  * @param $context ResourceLoaderContext
  * @return string
  */
 public function getScript(ResourceLoaderContext $context)
 {
     global $wgUser;
     /* Wikia change begin - @author: macbre */
     $options = $wgUser->getOptions();
     wfRunHooks('ResourceLoaderUserOptionsModuleGetOptions', array($context, &$options));
     /* Wikia change end */
     return Xml::encodeJsCall('mw.user.options.set', array($options));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:ResourceLoaderUserOptionsModule.php

示例4: addParsedMessages

 /**
  * Processes messages which have been marked as needing parsing
  *
  * @return string JavaScript code
  */
 public function addParsedMessages()
 {
     $js = "\n";
     foreach ($this->parsedMessages as $key) {
         $value = wfMessage($key)->parse();
         $js .= Xml::encodeJsCall('mw.messages.set', array($key, $value));
     }
     return $js;
 }
开发者ID:jdlrobson,项目名称:MinervaNeue,代码行数:14,代码来源:MinervaResourceLoaderParsedMessageModule.php

示例5: getEditToolbar

 /**
  * Shows a bulletin board style toolbar for common editing functions.
  * It can be disabled in the user preferences.
  *
  * @param $title Title object for the page being edited (optional)
  * @return string
  */
 static function getEditToolbar($title = null)
 {
     global $wgContLang, $wgOut;
     global $wgEnableUploads, $wgForeignFileRepos;
     $imagesAvailable = $wgEnableUploads || count($wgForeignFileRepos);
     $showSignature = true;
     if ($title) {
         $showSignature = MWNamespace::wantSignatures($title->getNamespace());
     }
     /**
      * $toolarray is an array of arrays each of which includes the
      * opening tag, the closing tag, optionally a sample text that is
      * inserted between the two when no selection is highlighted
      * and.  The tip text is shown when the user moves the mouse
      * over the button.
      *
      * Images are defined in ResourceLoaderEditToolbarModule.
      */
     $toolarray = array(array('id' => 'mw-editbutton-bold', 'open' => '\'\'\'', 'close' => '\'\'\'', 'sample' => wfMessage('bold_sample')->text(), 'tip' => wfMessage('bold_tip')->text()), array('id' => 'mw-editbutton-italic', 'open' => '\'\'', 'close' => '\'\'', 'sample' => wfMessage('italic_sample')->text(), 'tip' => wfMessage('italic_tip')->text()), array('id' => 'mw-editbutton-link', 'open' => '[[', 'close' => ']]', 'sample' => wfMessage('link_sample')->text(), 'tip' => wfMessage('link_tip')->text()), array('id' => 'mw-editbutton-extlink', 'open' => '[', 'close' => ']', 'sample' => wfMessage('extlink_sample')->text(), 'tip' => wfMessage('extlink_tip')->text()), array('id' => 'mw-editbutton-headline', 'open' => "\n== ", 'close' => " ==\n", 'sample' => wfMessage('headline_sample')->text(), 'tip' => wfMessage('headline_tip')->text()), $imagesAvailable ? array('id' => 'mw-editbutton-image', 'open' => '[[' . $wgContLang->getNsText(NS_FILE) . ':', 'close' => ']]', 'sample' => wfMessage('image_sample')->text(), 'tip' => wfMessage('image_tip')->text()) : false, $imagesAvailable ? array('id' => 'mw-editbutton-media', 'open' => '[[' . $wgContLang->getNsText(NS_MEDIA) . ':', 'close' => ']]', 'sample' => wfMessage('media_sample')->text(), 'tip' => wfMessage('media_tip')->text()) : false, array('id' => 'mw-editbutton-nowiki', 'open' => "<nowiki>", 'close' => "</nowiki>", 'sample' => wfMessage('nowiki_sample')->text(), 'tip' => wfMessage('nowiki_tip')->text()), $showSignature ? array('id' => 'mw-editbutton-signature', 'open' => '--~~~~', 'close' => '', 'sample' => '', 'tip' => wfMessage('sig_tip')->text()) : false, array('id' => 'mw-editbutton-hr', 'open' => "\n----\n", 'close' => '', 'sample' => '', 'tip' => wfMessage('hr_tip')->text()));
     $script = 'mw.loader.using("mediawiki.toolbar", function () {';
     foreach ($toolarray as $tool) {
         if (!$tool) {
             continue;
         }
         $params = array(false, $tool['tip'], $tool['open'], $tool['close'], $tool['sample'], $tool['id']);
         $script .= Xml::encodeJsCall('mw.toolbar.addButton', $params, ResourceLoader::inDebugMode());
     }
     $script .= '});';
     $wgOut->addScript(ResourceLoader::makeInlineScript($script));
     $toolbar = '<div id="toolbar"></div>';
     Hooks::run('EditPageBeforeEditToolbar', array(&$toolbar));
     return $toolbar;
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:40,代码来源:EditPage.php

示例6: getEditToolbar

 /**
  * Shows a bulletin board style toolbar for common editing functions.
  * It can be disabled in the user preferences.
  * The necessary JavaScript code can be found in skins/common/edit.js.
  *
  * @return string
  */
 static function getEditToolbar()
 {
     global $wgStylePath, $wgContLang, $wgLang, $wgOut;
     global $wgUseTeX, $wgEnableUploads, $wgForeignFileRepos;
     $imagesAvailable = $wgEnableUploads || count($wgForeignFileRepos);
     /**
      * $toolarray is an array of arrays each of which includes the
      * filename of the button image (without path), the opening
      * tag, the closing tag, optionally a sample text that is
      * inserted between the two when no selection is highlighted
      * and.  The tip text is shown when the user moves the mouse
      * over the button.
      *
      * Also here: accesskeys (key), which are not used yet until
      * someone can figure out a way to make them work in
      * IE. However, we should make sure these keys are not defined
      * on the edit page.
      */
     $toolarray = array(array('image' => $wgLang->getImageFile('button-bold'), 'id' => 'mw-editbutton-bold', 'open' => '\'\'\'', 'close' => '\'\'\'', 'sample' => wfMsg('bold_sample'), 'tip' => wfMsg('bold_tip'), 'key' => 'B'), array('image' => $wgLang->getImageFile('button-italic'), 'id' => 'mw-editbutton-italic', 'open' => '\'\'', 'close' => '\'\'', 'sample' => wfMsg('italic_sample'), 'tip' => wfMsg('italic_tip'), 'key' => 'I'), array('image' => $wgLang->getImageFile('button-link'), 'id' => 'mw-editbutton-link', 'open' => '[[', 'close' => ']]', 'sample' => wfMsg('link_sample'), 'tip' => wfMsg('link_tip'), 'key' => 'L'), array('image' => $wgLang->getImageFile('button-extlink'), 'id' => 'mw-editbutton-extlink', 'open' => '[', 'close' => ']', 'sample' => wfMsg('extlink_sample'), 'tip' => wfMsg('extlink_tip'), 'key' => 'X'), array('image' => $wgLang->getImageFile('button-headline'), 'id' => 'mw-editbutton-headline', 'open' => "\n== ", 'close' => " ==\n", 'sample' => wfMsg('headline_sample'), 'tip' => wfMsg('headline_tip'), 'key' => 'H'), $imagesAvailable ? array('image' => $wgLang->getImageFile('button-image'), 'id' => 'mw-editbutton-image', 'open' => '[[' . $wgContLang->getNsText(NS_FILE) . ':', 'close' => ']]', 'sample' => wfMsg('image_sample'), 'tip' => wfMsg('image_tip'), 'key' => 'D') : false, $imagesAvailable ? array('image' => $wgLang->getImageFile('button-media'), 'id' => 'mw-editbutton-media', 'open' => '[[' . $wgContLang->getNsText(NS_MEDIA) . ':', 'close' => ']]', 'sample' => wfMsg('media_sample'), 'tip' => wfMsg('media_tip'), 'key' => 'M') : false, $wgUseTeX ? array('image' => $wgLang->getImageFile('button-math'), 'id' => 'mw-editbutton-math', 'open' => "<math>", 'close' => "</math>", 'sample' => wfMsg('math_sample'), 'tip' => wfMsg('math_tip'), 'key' => 'C') : false, array('image' => $wgLang->getImageFile('button-nowiki'), 'id' => 'mw-editbutton-nowiki', 'open' => "<nowiki>", 'close' => "</nowiki>", 'sample' => wfMsg('nowiki_sample'), 'tip' => wfMsg('nowiki_tip'), 'key' => 'N'), array('image' => $wgLang->getImageFile('button-sig'), 'id' => 'mw-editbutton-signature', 'open' => '--~~~~', 'close' => '', 'sample' => '', 'tip' => wfMsg('sig_tip'), 'key' => 'Y'), array('image' => $wgLang->getImageFile('button-hr'), 'id' => 'mw-editbutton-hr', 'open' => "\n----\n", 'close' => '', 'sample' => '', 'tip' => wfMsg('hr_tip'), 'key' => 'R'));
     $script = 'mw.loader.using("mediawiki.action.edit", function() {';
     foreach ($toolarray as $tool) {
         if (!$tool) {
             continue;
         }
         $params = array($image = $wgStylePath . '/common/images/' . $tool['image'], $tip = $tool['tip'], $open = $tool['open'], $close = $tool['close'], $sample = $tool['sample'], $cssId = $tool['id']);
         $script .= Xml::encodeJsCall('mw.toolbar.addButton', $params);
     }
     // This used to be called on DOMReady from mediawiki.action.edit, which
     // ended up causing race conditions with the setup code above.
     $script .= "\n" . "// Create button bar\n" . "\$(function() { mw.toolbar.init(); } );\n";
     $script .= '});';
     $wgOut->addScript(Html::inlineScript(ResourceLoader::makeLoaderConditionalScript($script)));
     $toolbar = '<div id="toolbar"></div>';
     wfRunHooks('EditPageBeforeEditToolbar', array(&$toolbar));
     return $toolbar;
 }
开发者ID:slackfaith,项目名称:deadbrain_site,代码行数:43,代码来源:EditPage.php

示例7: getScript

 /**
  * @param ResourceLoaderContext $context
  * @return string
  */
 public function getScript(ResourceLoaderContext $context)
 {
     return Xml::encodeJsCall('mw.user.options.set', [$context->getUserObj()->getOptions(User::GETOPTIONS_EXCLUDE_DEFAULTS)], ResourceLoader::inDebugMode());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:ResourceLoaderUserOptionsModule.php

示例8: getScript

 /**
  * @param ResourceLoaderContext $context
  * @return string
  */
 public function getScript(ResourceLoaderContext $context)
 {
     return Xml::encodeJsCall('mw.user.options.set', array(User::getDefaultOptions()), ResourceLoader::inDebugMode());
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:8,代码来源:ResourceLoaderUserDefaultsModule.php

示例9: getScript

 /**
  * @param ResourceLoaderContext $context
  * @return string
  */
 public function getScript(ResourceLoaderContext $context)
 {
     global $IP, $wgLegacyJavaScriptGlobals;
     $out = file_get_contents("{$IP}/resources/src/startup.js");
     if ($context->getOnly() === 'scripts') {
         // Startup function
         $configuration = $this->getConfig($context);
         $registrations = self::getModuleRegistrations($context);
         // Fix indentation
         $registrations = str_replace("\n", "\n\t", trim($registrations));
         $out .= "var startUp = function () {\n" . "\tmw.config = new " . Xml::encodeJsCall('mw.Map', array($wgLegacyJavaScriptGlobals)) . "\n" . "\t{$registrations}\n" . "\t" . Xml::encodeJsCall('mw.config.set', array($configuration)) . "};\n";
         // Conditional script injection
         $scriptTag = Html::linkedScript(self::getStartupModulesUrl($context));
         $out .= "if ( isCompatible() ) {\n" . "\t" . Xml::encodeJsCall('document.write', array($scriptTag)) . "}";
     }
     return $out;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:21,代码来源:ResourceLoaderStartUpModule.php

示例10: makeConfigSetScript

 /**
  * Returns JS code which will set the MediaWiki configuration array to
  * the given value.
  *
  * @param $configuration Array: List of configuration values keyed by variable name
  *
  * @return string
  */
 public static function makeConfigSetScript(array $configuration)
 {
     return Xml::encodeJsCall('mw.config.set', array($configuration));
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:12,代码来源:ResourceLoader.php

示例11: makeConfigSetScript

 /**
  * Returns JS code which will set the MediaWiki configuration array to
  * the given value.
  *
  * @param array $configuration List of configuration values keyed by variable name
  * @return string
  */
 public static function makeConfigSetScript(array $configuration)
 {
     return Xml::encodeJsCall('mw.config.set', array($configuration), ResourceLoader::inDebugMode()) . ResourceLoader::FILTER_NOMIN;
 }
开发者ID:agothro,项目名称:mediawiki,代码行数:11,代码来源:ResourceLoader.php

示例12: dirname

<?php 
// This is a stub entry point to load.php This is need to support valid paths for the stand alone 
// mwEmbed module html test files. 

// This is useful for running stand alone test of mwEmbed components in the TimedMediaHandler
// extension. ( ie MwEmbedModules/EmbedPlayer/tests/*.html files )

$_GET['modules'] = 'startup';
$_GET['only'] = 'scripts';

// NOTE this won't work so well with symbolic links
$loaderPath = dirname(__FILE__) . '/../../load.php';
if( is_file( $loaderPath ) ){	
	chdir( dirname( $loaderPath ) );
	include_once( $loaderPath );
} else {
	print "if( console && typeof console.log == 'function' ){ console.log('Error can't find load.php for stand alone tests' ) }";
}
// Bootstrap some js code to make the "loader" work in stand alone tests: 
// Note this has to be wrapped in a document.write to run after other document.writes
$pageStartupScript = Html::inlineScript(
	ResourceLoader::makeLoaderConditionalScript(
		Xml::encodeJsCall( 'mw.loader.go', array() )
	)
);
echo Xml::encodeJsCall( 'document.write', array( $pageStartupScript ) );
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:26,代码来源:mwEmbedLoader.php

示例13: getScript

 /**
  * @param $context ResourceLoaderContext
  * @return string JavaScript code
  */
 public function getScript(ResourceLoaderContext $context)
 {
     return Xml::encodeJsCall('mw.language.setData', array($context->getLanguage(), 'languageNames', $this->getData($context)));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:8,代码来源:ResourceLoaderLanguageNamesModule.php

示例14: wfEditPageBeforeEditToolbar

function wfEditPageBeforeEditToolbar(&$toolbar)
{
    global $wgStylePath, $wgOut, $wgLanguageCode;
    $params = array($image = $wgStylePath . '/owl/images/1x1_transparent.gif', $tip = 'Weave links', $open = '', $close = '', $sample = '', $cssId = 'weave_button');
    $script = Xml::encodeJsCall('mw.toolbar.addButton', $params);
    $wgOut->addScript(Html::inlineScript(ResourceLoader::makeLoaderConditionalScript($script)));
    $params = array($image = $wgStylePath . '/owl/images/1x1_transparent.gif', $tip = 'Add Image', $open = '', $close = '', $sample = '', $cssId = 'easyimageupload_button', $onclick = "easyImageUpload.doEIUModal('advanced');return false;");
    $script = Xml::encodeJsCall('mw.toolbar.addButton', $params);
    $wgOut->addScript(Html::inlineScript(ResourceLoader::makeLoaderConditionalScript($script)));
    $wgOut->addJScode('advj');
    $wgOut->addJScode('eiuj');
    if (in_array($wgLanguageCode, array('en', 'de', 'es', 'pt'))) {
        $popbox = PopBox::getPopBoxJSAdvanced() . PopBox::getPopBoxCSS();
        $popbox_div = PopBox::getPopBoxDiv();
        $wgOut->addHTML($popbox_div . $popbox);
        $wgOut->addHTML(Easyimageupload::getUploadBoxJS(true));
    }
    return true;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:19,代码来源:WikihowHooks.php

示例15: getScript

 /**
  * @param $context ResourceLoaderContext
  * @return string
  */
 public function getScript(ResourceLoaderContext $context)
 {
     global $wgUser;
     return Xml::encodeJsCall('mw.user.options.set', array($wgUser->getOptions()));
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:9,代码来源:ResourceLoaderUserOptionsModule.php


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