/** * 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'); }
/** * 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'); }
/** * 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); }
/** * 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'); } }
/** * 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'); }
/** * 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'); }
/** * 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); }
/** * Register all hooks we may need */ protected function registerHooks() { Hooks::action('init', $this, 'addEndPoint'); Hooks::action('template_redirect', $this, 'onTemplateRedirect'); }