/** * Class constructor * * @throws \SilverWp\ShortCode\Exception */ public function __construct() { parent::__construct(); if (SingletonAbstract::isImplemented(get_called_class(), 'SilverWp\\ShortCode\\Vp\\Menu\\Element\\AttributesInterface')) { $this->createAttributes(); } }
/** * Class constructor * * @throws Exception * @access protected */ public function __construct() { $child_class = get_called_class(); if (\is_null($this->tag_base)) { throw new Exception(Translate::translate('Property %s is required and can\'t be empty.', $child_class . '::tag_base')); } //if class implemetns SilverWp\Interfaces\EnqueueScripts enqueue scripts if (SingletonAbstract::isImplemented($child_class, 'SilverWp\\Interfaces\\EnqueueScripts')) { add_action('wp_enqueue_scripts', array($this, 'enqueueScripts')); } if (SingletonAbstract::isImplemented($child_class, 'SilverWp\\ShortCode\\SaveOccurencesInterface')) { //save short code occurennces in posts add_action('save_post', array($this, 'saveOccurrencesPostsIds'), 10, 1); } $this->register(); }
/** * Render view * * @param array $attributes * @param string $content * * @return string * * @access protected */ protected function render(array $attributes, $content = '') { if (isset($this->settings['php_class_name']) && class_exists($this->settings['php_class_name']) && SingletonAbstract::isImplemented($this->settings['php_class_name'], '\\SilverWp\\ShortCode\\Vc\\View\\ViewInterface')) { $view = new $this->settings['php_class_name']($this->settings); } else { $view = new ViewAbstract($this->settings); } $view->setQueryArgs($this->query_args); $output = $view->output($attributes, $content); return $output; }