本文整理汇总了PHP中utils::jsEncode方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::jsEncode方法的具体用法?PHP utils::jsEncode怎么用?PHP utils::jsEncode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::jsEncode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHtml
public function toHtml()
{
if ($this->cfg->mode == 'view') {
return $this->getValue();
}
$options = $this->tinyMce;
if (is_array($this->cfg->tinyBrowser) && $this->cfg->getInArray('tinyBrowser', 'active')) {
$tinyBrowser = $this->cfg->tinyBrowser;
$options['file_browser_callback'] = 'function(field_name, url, type, win) {
tinyMCE.activeEditor.windowManager.open({
file : "' . $tinyBrowser['url'] . '?' . session::getInstance()->getSessIdForce() . '=' . urlencode(session_id()) . '&type=" + type' . ($tinyBrowser['subdir'] ? '+"&subdir=' . $tinyBrowser['subdir'] . '"' : '') . ',
title : "' . $tinyBrowser['title'] . '",
width : ' . $tinyBrowser['width'] . ',
height : ' . $tinyBrowser['height'] . ',
resizable : "yes",
scrollbars : "yes",
inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
close_previous : "no"
}, {
window : win,
input : field_name
});
return false;
}';
} else {
if (is_array($this->cfg->nyroBrowser) && $this->cfg->getInArray('nyroBrowser', 'active')) {
$nyroBrowser = $this->cfg->nyroBrowser;
$options['file_browser_callback'] = 'function(field_name, url, type, win) {
tinyMCE.activeEditor.windowManager.open({
file : "' . $nyroBrowser['url'] . '?' . session::getInstance()->getSessIdForce() . '=' . urlencode(session_id()) . '&type="+type+"&config=' . $nyroBrowser['config'] . '&",
title : "' . $nyroBrowser['title'] . '",
width : ' . $nyroBrowser['width'] . ',
height : ' . $nyroBrowser['height'] . ',
resizable : "yes",
scrollbars : "yes",
inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
close_previous : "no"
}, {
window : win,
input : field_name
});
return false;
}';
}
}
if (array_key_exists('content_css', $options) && $options['content_css']) {
$contentCss = $options['content_css'];
$options['setup'] = 'function(ed) {ed.onInit.add(function(ed) {setTimeout(function() {ed.dom.add(ed.dom.select("head"), "link", {rel : "stylesheet", href : "' . $contentCss . '"});}, 5);});}';
}
unset($options['content_css']);
$resp = response::getInstance()->getProxy();
$resp->addJs('jquery.tinymce');
$resp->blockjQuery('$("#' . $this->id . '").tinymce(' . utils::jsEncode($options) . ');');
return utils::htmlTag($this->htmlTagName, array_merge($this->html, array('name' => $this->name, 'id' => $this->id)), utils::htmlOut($this->getValue()));
}
示例2: toHtml
public function toHtml()
{
if ($this->cfg->mode == 'view') {
return $this->date->format('date', 'short2');
}
if ($this->cfg->useJs) {
$resp = response::getInstance();
$resp->addJs('jqueryui');
$resp->blockJquery('$("#' . $this->id . '").datepicker(' . utils::jsEncode($this->jsPrm) . ');');
}
return utils::htmlTag($this->htmlTagName, array_merge($this->html, array('name' => $this->name, 'id' => $this->id, 'value' => $this->date->format('date', 'short2'))));
}
示例3: toHtml
public function toHtml()
{
if ($this->cfg->useJs) {
$this->cfg->setInArray('html', 'class', $this->cfg->getInArray('html', 'class') . ' date');
$resp = response::getInstance();
$resp->addJs('jqueryui');
if (($lang = request::get('lang')) != 'en') {
$resp->addJs('i18n_ui.datepicker-' . $lang);
}
$jsPrmMin = $this->cfg->jsPrm;
$jsPrmMax = $this->cfg->jsPrm;
$minId = $this->makeId($this->name . '[0]');
$maxId = $this->makeId($this->name . '[1]');
$minDate = $this->dates['min']->getJs(null);
$maxDate = $this->dates['max']->getJs(null);
$jsPrmMin['onSelect'] = 'function(dateText) {$("#' . $maxId . '").datepicker("option", "minDate", $("#' . $minId . '").datepicker("getDate"));}';
if ($maxDate) {
$jsPrmMin['maxDate'] = $maxDate;
}
$jsPrmMax['onSelect'] = 'function(dateText) {$("#' . $minId . '").datepicker("option", "maxDate", $("#' . $maxId . '").datepicker("getDate"));}';
if ($minDate) {
$jsPrmMax['minDate'] = $minDate;
}
$resp->blockJquery('
$("#' . $minId . '").datepicker(' . utils::jsEncode($jsPrmMin) . ');
$("#' . $maxId . '").datepicker(' . utils::jsEncode($jsPrmMax) . ');
');
}
return parent::toHtml();
}
示例4: plupload
/**
* Make the field plupload for asynchronous upload.
*
* @param array $opts Plupload options
* @param boolean $hideSubmit Indicate if the submit button should be hide by JavaScript
*/
public function plupload(array $opts = array(), $hideSubmit = true)
{
$resp = response::getInstance();
$resp->addJs('jquery');
$resp->addJs('plupload');
$resp->addJs('nyroPlupload');
$resp->addCss('plupload');
$pluploadOpts = $this->cfg->plupload;
if (count($opts)) {
factory::mergeCfg($pluploadOpts, $opts);
}
$pluploadOpts['file_data_name'] = $this->name;
$resp->blockjQuery('$("#' . $this->id . '").nyroPlupload(' . utils::jsEncode($pluploadOpts) . ');');
if ($hideSubmit) {
$resp->blockjQuery('$("#' . $this->id . '").closest("form").find("fieldset.submit").hide();');
}
}
示例5: unset
<?php
unset($this->vars['response']);
echo utils::jsEncode($this->vars);
?>
示例6:
<?php echo utils::jsEncode(array('content'=>$content)); ?>