define_hooks(); $this->bootstrap(); } /** * Define plugin hooks. */ private function define_hooks() { add_filter('gutenify_plugin_constants', array($this, 'add_plugin_constants')); // Uncomment if you want activation redirect. // add_action( 'activated_plugin', array( $this, 'activation_redirect' ) ); } /** * Provide plugin constants merged with args. * * @param array $args * @return array */ public function add_plugin_constants($args) { return wp_parse_args($args, $this->get_constants()); } /** * Get all plugin constants as array. * * @return array */ public function get_constants() { $title = 'Gutenify'; return array( 'title' => $title, 'prefix' => 'gutenify', 'slug' => 'gutenify', 'authorWebSite' => 'https://gutenify.com', 'authorDemoWebSite' => 'https://demo.gutenify.com', 'authorWebSiteProPage' => 'https://gutenify.com/pricing', 'authorWebSiteSupport' => 'https://gutenify.com/product-support', 'plugin_main_slug' => 'gutenify', 'plugin_main_camel_case_name' => 'gutenify', 'plugin_main_function_prefix' => 'gutenify', 'plugin_main_base_url' => GUTENIFY_BASE_URL, 'plugin_main_base_dir' => GUTENIFY_BASE_DIR, 'plugin_main_version' => GUTENIFY_VERSION, 'plugin_main_post_type_prefix' => 'gutenify', 'plugin_main_site_domain' => 'gutenify.com', 'core_base_dir' => GUTENIFY_BASE_DIR . 'core/', 'core_base_url' => GUTENIFY_BASE_URL . 'core/', 'brand_color' => '#2196f3', 'pro_title' => $title . ' Pro', ); } /** * Load bootstrap and pro if available. */ private function bootstrap() { require_once GUTENIFY_BASE_DIR . 'core/inc/bootstrap.php'; if ( function_exists('gutenify_pro') && defined('GUTENIFY_PRO_VERSION') && version_compare(GUTENIFY_PRO_VERSION, '1.1.5', '>') ) { gutenify_pro(); } } /** * Optionally redirect to Gutenify page on plugin activation. * * @param string $plugin Plugin basename. */ public function activation_redirect($plugin) { if (function_exists('get_current_screen')) { $screen = get_current_screen(); if (!empty($screen->id) && 'appearance_page_tgmpa-install-plugins' === $screen->id) { return false; } } if ($plugin === plugin_basename(__FILE__)) { wp_safe_redirect(admin_url('admin.php?page=gutenify')); exit; } } } } /** * Initialize the Gutenify plugin. */ function gutenify() { return Gutenify::instance(); } // Initialize plugin immediately. gutenify();