本文整理汇总了PHP中JsonHelper::removeComments方法的典型用法代码示例。如果您正苦于以下问题:PHP JsonHelper::removeComments方法的具体用法?PHP JsonHelper::removeComments怎么用?PHP JsonHelper::removeComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonHelper
的用法示例。
在下文中一共展示了JsonHelper::removeComments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInputHtml
/**
* @inheritDoc IFieldType::getInputHtml()
*
* @param string $name
* @param mixed $value
*
* @return string
*/
public function getInputHtml($name, $value)
{
$configJs = $this->_getConfigJson();
$this->_includeFieldResources($configJs);
$id = craft()->templates->formatInputId($name);
$localeId = isset($this->element) ? $this->element->locale : craft()->language;
$settings = array('id' => craft()->templates->namespaceInputId($id), 'linkOptions' => $this->_getLinkOptions(), 'assetSources' => $this->_getAssetSources(), 'transforms' => $this->_getTransforms(), 'elementLocale' => $localeId, 'redactorConfig' => JsonHelper::decode(JsonHelper::removeComments($configJs)), 'redactorLang' => static::$_redactorLang);
if (isset($this->model) && $this->model->translatable) {
// Explicitly set the text direction
$locale = craft()->i18n->getLocaleData($localeId);
$settings['direction'] = $locale->getOrientation();
}
craft()->templates->includeJs('new Craft.RedactorIInput(' . JsonHelper::encode($settings) . ');');
if ($value instanceof RichTextData) {
$value = $value->getRawContent();
}
if (strpos($value, '{') !== false) {
// Preserve the ref tags with hashes {type:id:url} => {type:id:url}#type:id
$value = preg_replace_callback('/(href=|src=)([\'"])(\\{(\\w+\\:\\d+\\:' . HandleValidator::$handlePattern . ')\\})(#[^\'"#]+)?\\2/', function ($matches) {
return $matches[1] . $matches[2] . $matches[3] . (!empty($matches[5]) ? $matches[5] : '') . '#' . $matches[4] . $matches[2];
}, $value);
// Now parse 'em
$value = craft()->elements->parseRefs($value);
}
// Swap any <!--pagebreak-->'s with <hr>'s
$value = str_replace('<!--pagebreak-->', '<hr class="redactor_pagebreak" style="display:none" unselectable="on" contenteditable="false" />', $value);
return '<textarea id="' . $id . '" name="' . $name . '" style="display: none">' . htmlentities($value, ENT_NOQUOTES, 'UTF-8') . '</textarea>';
}