本文整理匯總了PHP中ShortcodeParser::error_behavior方法的典型用法代碼示例。如果您正苦於以下問題:PHP ShortcodeParser::error_behavior方法的具體用法?PHP ShortcodeParser::error_behavior怎麽用?PHP ShortcodeParser::error_behavior使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ShortcodeParser
的用法示例。
在下文中一共展示了ShortcodeParser::error_behavior方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testNotRegisteredShortcode
/**
* Tests that valid short codes that have not been registered are not replaced.
*/
public function testNotRegisteredShortcode()
{
ShortcodeParser::$error_behavior = ShortcodeParser::STRIP;
$this->assertEquals('', $this->parser->parse('[not_shortcode]'));
$this->assertEquals('<img class="">', $this->parser->parse('<img class="[not_shortcode]">'));
ShortcodeParser::$error_behavior = ShortcodeParser::WARN;
$this->assertEquals('<strong class="warning">[not_shortcode]</strong>', $this->parser->parse('[not_shortcode]'));
ShortcodeParser::$error_behavior = ShortcodeParser::LEAVE;
$this->assertEquals('[not_shortcode]', $this->parser->parse('[not_shortcode]'));
$this->assertEquals('[not_shortcode /]', $this->parser->parse('[not_shortcode /]'));
$this->assertEquals('[not_shortcode,foo="bar"]', $this->parser->parse('[not_shortcode,foo="bar"]'));
$this->assertEquals('[not_shortcode]a[/not_shortcode]', $this->parser->parse('[not_shortcode]a[/not_shortcode]'));
$this->assertEquals('[/not_shortcode]', $this->parser->parse('[/not_shortcode]'));
$this->assertEquals('<img class="[not_shortcode]">', $this->parser->parse('<img class="[not_shortcode]">'));
}