本文整理汇总了PHP中Xml::escapeTagsOnly方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::escapeTagsOnly方法的具体用法?PHP Xml::escapeTagsOnly怎么用?PHP Xml::escapeTagsOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::escapeTagsOnly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEscapeTagsOnly
/**
* @covers Xml::escapeTagsOnly
*/
public function testEscapeTagsOnly()
{
$this->assertEquals('"><', Xml::escapeTagsOnly('"><'), 'replace " > and < with their HTML entitites');
}
示例2: renderPreTag
/**
* Tag hook handler for 'pre'.
*/
function renderPreTag($text, $attribs)
{
// Backwards-compatibility hack
$content = StringUtils::delimiterReplace('<nowiki>', '</nowiki>', '$1', $text, 'i');
$attribs = Sanitizer::validateTagAttributes($attribs, 'pre');
return Xml::openElement('pre', $attribs) . Xml::escapeTagsOnly($content) . '</pre>';
}
示例3: nowiki
/**
* Core parser tag hook function for 'nowiki'. Text within this section
* gets interpreted as a string of text with HTML-compatible character
* references, and wiki markup within it will not be expanded.
*
* Uses undocumented extended tag hook return values, introduced in r61913.
*
* @param string $content
* @param array $attributes
* @param Parser $parser
* @return array
*/
public static function nowiki($content, $attributes, $parser)
{
$content = strtr($content, array('-{' => '-{', '}-' => '}-'));
return array(Xml::escapeTagsOnly($content), 'markerType' => 'nowiki');
}
示例4: getTag
/**
* Custom tag implementation. This is called by efCategoryTreeParserHook, which is used to
* load CategoryTreeFunctions.php on demand.
* @param $parser Parser
* @param $category
* @param $hideroot bool
* @param $attr
* @param $depth int
* @param $allowMissing bool
* @return bool|string
*/
function getTag($parser, $category, $hideroot = false, $attr, $depth = 1, $allowMissing = false)
{
global $wgCategoryTreeDisableCache, $wgCategoryTreeDynamicTag;
static $uniq = 0;
$category = trim($category);
if ($category === '') {
return false;
}
if ($parser && $wgCategoryTreeDisableCache && !$wgCategoryTreeDynamicTag) {
$parser->disableCache();
}
$title = self::makeTitle($category);
if ($title === false || $title === null) {
return false;
}
if (isset($attr['class'])) {
$attr['class'] .= ' CategoryTreeTag';
} else {
$attr['class'] = ' CategoryTreeTag';
}
$attr['data-ct-mode'] = $this->mOptions['mode'];
$attr['data-ct-options'] = Xml::escapeTagsOnly($this->getOptionsAsJsStructure());
$html = '';
$html .= Xml::openElement('div', $attr);
if (!$allowMissing && !$title->getArticleID()) {
$html .= Xml::openElement('span', array('class' => 'CategoryTreeNotice'));
if ($parser) {
$html .= $parser->recursiveTagParse(wfMsgNoTrans('categorytree-not-found', $category));
} else {
$html .= wfMsgExt('categorytree-not-found', 'parseinline', htmlspecialchars($category));
}
$html .= Xml::closeElement('span');
} else {
if (!$hideroot) {
$html .= $this->renderNode($title, $depth, $wgCategoryTreeDynamicTag);
} elseif (!$wgCategoryTreeDynamicTag) {
$html .= $this->renderChildren($title, $depth);
} else {
$uniq += 1;
$load = 'ct-' . $uniq . '-' . mt_rand(1, 100000);
$html .= Xml::openElement('script', array('type' => 'text/javascript', 'id' => $load));
$html .= 'categoryTreeLoadChildren("' . Xml::escapeJsString($title->getDBkey()) . '", ' . $this->getOptionsAsJsStructure($depth) . ', document.getElementById("' . $load . '").parentNode);';
$html .= Xml::closeElement('script');
}
}
$html .= Xml::closeElement('div');
$html .= "\n\t\t";
return $html;
}
示例5: createSchemaXMLFromForm
/**
* Creates Page Schemas XML for form-wide information.
*/
public static function createSchemaXMLFromForm()
{
global $wgRequest;
$formName = null;
$xml = '';
$isStandardInputsOpen = false;
foreach ($wgRequest->getValues() as $var => $val) {
$val = str_replace(array('<', '>'), array('<', '>'), $val);
if ($var == 'sf_form_name') {
$formName = $val;
} elseif ($var == 'sf_page_name_formula') {
if (!empty($val)) {
$val = Xml::escapeTagsOnly($val);
$xml .= '<PageNameFormula>' . $val . '</PageNameFormula>';
}
} elseif ($var == 'sf_create_title') {
if (!empty($val)) {
$xml .= '<CreateTitle>' . $val . '</CreateTitle>';
}
} elseif ($var == 'sf_edit_title') {
if (!empty($val)) {
$xml .= '<EditTitle>' . $val . '</EditTitle>';
}
} elseif ($var == 'sf_fi_free_text_label') {
$isStandardInputsOpen = true;
$xml .= '<standardInputs ';
if (!empty($val)) {
$xml .= 'freeTextLabel="' . Xml::escapeTagsOnly($val) . '" ';
}
} elseif ($var == 'sf_fi_free_text') {
if (!empty($val)) {
$xml .= 'inputFreeText="' . $val . '" ';
}
} elseif ($var == 'sf_fi_summary') {
if (!empty($val)) {
$xml .= 'inputSummary="' . $val . '" ';
}
} elseif ($var == 'sf_fi_minor_edit') {
if (!empty($val)) {
$xml .= 'inputMinorEdit="' . $val . '" ';
}
} elseif ($var == 'sf_fi_watch') {
if (!empty($val)) {
$xml .= 'inputWatch="' . $val . '" ';
}
} elseif ($var == 'sf_fi_save') {
if (!empty($val)) {
$xml .= 'inputSave="' . $val . '" ';
}
} elseif ($var == 'sf_fi_preview') {
if (!empty($val)) {
$xml .= 'inputPreview="' . $val . '" ';
}
} elseif ($var == 'sf_fi_changes') {
if (!empty($val)) {
$xml .= 'inputChanges="' . $val . '" ';
}
} elseif ($var == 'sf_fi_cancel') {
if (!empty($val)) {
$xml .= 'inputCancel="' . $val . '"';
}
}
}
if ($isStandardInputsOpen) {
$isStandardInputsOpen = false;
$xml .= ' />';
}
$xml = '<semanticforms_Form name="' . $formName . '" >' . $xml;
$xml .= '</semanticforms_Form>';
return $xml;
}