Awesome_Support::init PHP Method

init() private method

Instantiate the plugin
Since: 3.3
private init ( ) : void
return void
        private function init()
        {
            // First of all we need the constants
            self::$instance->setup_constants();
            // Make sure the WordPress version is recent enough
            if (!self::$instance->is_version_compatible()) {
                self::$instance->add_error(sprintf(__('Awesome Support requires WordPress version %s or above. Please update WordPress to run this plugin.', 'awesome-support'), self::$instance->wordpress_version_required));
            }
            // Make sure we have a version of PHP that's not too old
            if (!self::$instance->is_php_version_enough()) {
                self::$instance->add_error(sprintf(__('Awesome Support requires PHP version %s or above. Read more information about <a %s>how you can update</a>.', 'awesome-support'), self::$instance->wordpress_version_required, 'a href="http://www.wpupdatephp.com/update/" target="_blank"'));
            }
            // Check that the vendor directory is present
            if (!self::$instance->dependencies_loaded()) {
                self::$instance->add_error(sprintf(__('Awesome Support dependencies are missing. The plugin can’t be loaded properly. Please run %s before anything else. If you don’t know what this is you should <a href="%s" class="thickbox">install the production version</a> of this plugin instead.', 'awesome-support'), '<a href="https://getcomposer.org/doc/00-intro.md#using-composer" target="_blank"><code>composer install</code></a>', esc_url(add_query_arg(array('tab' => 'plugin-information', 'plugin' => 'awesome-support', 'TB_iframe' => 'true', 'width' => '772', 'height' => '935'), admin_url('plugin-install.php')))));
            }
            // If we have any error, don't load the plugin
            if (is_a(self::$instance->error, 'WP_Error')) {
                add_action('admin_notices', array(self::$instance, 'display_error'), 10, 0);
                return;
            }
            self::$instance->includes();
            self::$instance->session = new WPAS_Session();
            self::$instance->custom_fields = new WPAS_Custom_Fields();
            self::$instance->maybe_setup();
            if (is_admin()) {
                self::$instance->includes_admin();
                self::$instance->admin_notices = new AS_Admin_Notices();
                if (!defined('DOING_AJAX') || !DOING_AJAX) {
                    /**
                     * Redirect to about page.
                     *
                     * We don't use the 'was_setup' option for the redirection as
                     * if the install fails the first time this will create a redirect loop
                     * on the about page.
                     */
                    if (true === boolval(get_option('wpas_redirect_about', false))) {
                        add_action('init', array(self::$instance, 'redirect_to_about'));
                    }
                    add_action('plugins_loaded', array('WPAS_Upgrade', 'get_instance'), 11, 0);
                    add_action('plugins_loaded', array('WPAS_Tickets_List', 'get_instance'), 11, 0);
                    add_action('plugins_loaded', array('WPAS_User', 'get_instance'), 11, 0);
                    add_action('plugins_loaded', array('WPAS_Titan', 'get_instance'), 11, 0);
                    add_action('plugins_loaded', array('WPAS_Help', 'get_instance'), 11, 0);
                }
            }
            add_action('plugins_loaded', array('WPAS_File_Upload', 'get_instance'), 11, 0);
            add_action('plugins_loaded', array(self::$instance, 'load_plugin_textdomain'));
            add_action('init', array(self::$instance, 'load_theme_functions'));
            add_action('plugins_loaded', array(self::$instance, 'remote_notifications'), 15, 0);
        }