Пример #1
0
 /**
  * Registers the required actions with WordPress
  */
 protected function __construct()
 {
     $this->term_transformer = Term::get_instance();
     $this->cache = new Cache('cache' . DIRECTORY_SEPARATOR . 'posts');
     add_action('edited_terms', [$this, 'clear_cache']);
     add_action('save_post', [$this, 'clear_cache']);
     if (!is_admin()) {
         add_filter('the_posts', [$this, 'prepare_collection'], 20, 2);
     }
 }
Пример #2
0
 /**
  * Initialize required classes and add them to the container
  *
  * @throws Exceptions\ContainerOverrideException
  * @throws Exceptions\NotStringException
  */
 public function boot()
 {
     $container = Container::get_instance();
     if (apply_filters($this->filter_base . 'core/register/prepare/post', true)) {
         $container->add('Xeeeveee\\Core\\WordPress\\Prepare\\Post', Post::get_instance());
     }
     if (apply_filters($this->filter_base . 'core/register/prepare/post', true)) {
         $container->add('Xeeeveee\\Core\\WordPress\\Prepare\\Term', Term::get_instance());
     }
     if (apply_filters($this->filter_base . 'core/register/prepare/post', true)) {
         $container->add('Xeeeveee\\Core\\WordPress\\Register\\Decorators\\PostDecorator', PostDecorator::get_instance());
     }
     if (apply_filters($this->filter_base . 'core/register/enqueue/admin_scripts', true)) {
         $container->add('Xeeeveee\\Core\\WordPress\\Enqueue\\Script\\AdminScripts', AdminMain::get_instance());
     }
     if (apply_filters($this->filter_base . 'core/register/enqueue/color_picker_styles', true)) {
         $container->add('Xeeeveee\\Core\\WordPress\\Enqueue\\Style\\ColorPicker', ColorPicker::get_instance());
     }
     if (apply_filters($this->filter_base . 'core/register/enqueue/jquery_ui_styles', true)) {
         $container->add('Xeeeveee\\Core\\WordPress\\Enqueue\\Style\\JQueryUi', JQueryUi::get_instance());
     }
 }