/** *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]); } } } }