Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param string $id   The ID of the initializer
  * @param array  $data The configuration key/value pairs
  */
 public function __construct($id, $data)
 {
     parent::__construct($id, $data);
     $this->objectRegistry = Baobab::objectRegistry();
     $this->loadPsr4();
     Hooks::action('after_setup_theme', $this, 'instantiateClasses');
 }
Exemplo n.º 2
0
 /**
  * Apply the data to configure the theme
  */
 public function run()
 {
     parent::run();
     // Register image sizes
     $this->addImageSizes();
     // Add sizes to the media attachment settings dropdown list.
     Hooks::action('image_size_names_choose', $this, 'addSizesToDropDownList');
 }
Exemplo n.º 3
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     // Gather some variables from the child class
     $this->loadStaticChildClassMembers();
     // Load configuration
     $this->configuration = Configuration::create(static::$configurationMappings);
     // Load text domain
     Hooks::action('after_setup_theme', $this, 'setup', 5);
 }
Exemplo n.º 4
0
 /**
  * Constructor
  *
  * @param string $namespace The namespace to use for our ajax variables
  */
 function __construct($namespace)
 {
     $this->namespace = $namespace;
     if (is_admin()) {
         Hooks::action('admin_head', $this, 'printGlobalAjaxObject');
     } else {
         Hooks::action('wp_head', $this, 'printGlobalAjaxObject');
     }
 }
Exemplo n.º 5
0
 /**
  * Constructor
  *
  * @param string $id The ID of the initializer
  * @param array $data The configuration key/value pairs
  */
 public function __construct($id, $data)
 {
     parent::__construct($id, $data);
     // Boostrap Kirki
     Hooks::filter('kirki/config', $this, 'configureKirki');
     Hooks::filter('customize_register', $this, 'createPanels');
     Hooks::filter('kirki/controls', $this, 'registerControls');
     /** @noinspection PhpIncludeInspection */
     require_once Paths::vendors('aristath/kirki/kirki.php');
 }
Exemplo n.º 6
0
 /**
  * Constructor
  *
  * @param string $id   The ID of the initializer
  * @param array  $data The configuration key/value pairs
  */
 public function __construct($id, $data)
 {
     parent::__construct($id, $data);
     // If blade is enabled, include required files
     if ($this->isBladeEnabled()) {
         require_once Paths::vendors('autoload.php');
     }
     // Our themes should be properly structured, so we could also provide some common templates within a
     // different folder
     Hooks::filter('get_search_form', $this, 'suggestMoreSearchFormTemplates');
 }
Exemplo n.º 7
0
 /**
  * Hook into WordPress to execute our ajax callback
  */
 protected function registerHooks()
 {
     // Our callbacks are registered only on the admin side even for guest and frontend callbacks
     if (is_admin()) {
         switch ($this->accessType) {
             case 'guest':
                 Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
                 break;
             case 'logged':
                 Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
                 break;
             case 'any':
                 Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
                 Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
                 break;
             default:
                 throw new \InvalidArgumentException("Invalid value for the Ajax access type parameter: " . $this->accessType);
         }
     }
     // If we have global variables
     Hooks::filter('baobab/ajax/global_data', $this, 'addGlobalVariables');
 }
Exemplo n.º 8
0
 /**
  * Constructor
  *
  * @param string $id   The ID of the initializer
  * @param array  $data The configuration key/value pairs
  */
 public function __construct($id, $data)
 {
     parent::__construct($id, $data);
     require_once Paths::vendors('tgmpa/tgm-plugin-activation/class-tgm-plugin-activation.php');
     Hooks::action('tgmpa_register', $this, 'configureTgmPluginActivationLibrary');
 }
Exemplo n.º 9
0
 /**
  * Constructor
  *
  * @param string $id   The ID of the initializer
  * @param array  $data The configuration key/value pairs
  */
 public function __construct($id, $data)
 {
     parent::__construct($id, $data);
     Hooks::action('wp_enqueue_scripts', $this, 'registerAssets', 99);
     Hooks::action('wp_enqueue_scripts', $this, 'enqueueAssets', 100);
 }
Exemplo n.º 10
0
 /**
  * Register all hooks we may need
  */
 protected function registerHooks()
 {
     Hooks::action('init', $this, 'addEndPoint');
     Hooks::action('template_redirect', $this, 'onTemplateRedirect');
 }