本文整理汇总了PHP中ShortcodeHelper::nested_shortcodes方法的典型用法代码示例。如果您正苦于以下问题:PHP ShortcodeHelper::nested_shortcodes方法的具体用法?PHP ShortcodeHelper::nested_shortcodes怎么用?PHP ShortcodeHelper::nested_shortcodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShortcodeHelper
的用法示例。
在下文中一共展示了ShortcodeHelper::nested_shortcodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createShortcode
/**
*automatically load all child classes of the aviaShortcodeTemplate class and create an instance
**/
public function createShortcode()
{
$children = array();
foreach (get_declared_classes() as $class) {
if (is_subclass_of($class, 'aviaShortcodeTemplate')) {
$allow = false;
$children[] = $class;
$this->shortcode_class[$class] = new $class($this);
$shortcode = $this->shortcode_class[$class]->config['shortcode'];
//check if the shortcode is allowed. if so init the shortcode, otherwise unset the item
if (empty(ShortcodeHelper::$manually_allowed_shortcodes) && empty(ShortcodeHelper::$manually_disallowed_shortcodes)) {
$allow = true;
}
if (!$allow && !empty(ShortcodeHelper::$manually_allowed_shortcodes) && in_array($shortcode, ShortcodeHelper::$manually_allowed_shortcodes)) {
$allow = true;
}
if (!$allow && !empty(ShortcodeHelper::$manually_disallowed_shortcodes) && !in_array($shortcode, ShortcodeHelper::$manually_disallowed_shortcodes)) {
$allow = true;
}
if ($allow) {
$this->shortcode_class[$class]->init();
$this->shortcode[$this->shortcode_class[$class]->config['shortcode']] = $class;
//save shortcode as allowed by default. if we only want to display the shortcode in tinymce remove it from the list but keep the class instance alive
if (empty($this->shortcode_class[$class]->config['tinyMCE']['tiny_only'])) {
ShortcodeHelper::$allowed_shortcodes[] = $this->shortcode_class[$class]->config['shortcode'];
}
//save nested shortcodes if they exist
if (isset($this->shortcode_class[$class]->config['shortcode_nested'])) {
ShortcodeHelper::$nested_shortcodes = array_merge(ShortcodeHelper::$nested_shortcodes, $this->shortcode_class[$class]->config['shortcode_nested']);
}
} else {
unset($this->shortcode_class[$class]);
}
}
}
}