/** * Main JJ_404_to_301 Instance. * * Insures that only one instance of JJ_404_to_301 exists in memory * at any one time. * Also prevents needing to define globals all over the place. * * @since 3.0.0 * @access public * @staticvar array $instance * * @return JJ_404_to_301|object */ public static function instance() { if (!isset(self::$instance) && !self::$instance instanceof JJ_404_to_301) { // Main plugin class. self::$instance = new JJ_404_to_301(); // Include required files. self::$instance->includes(); // Run activation actions. self::$instance->activate(); // Load translation support. self::$instance->locale(); // Required only when admin. if (is_admin()) { // Init admin class.. self::$instance->admin = new JJ4T3_Admin(); } // Required only when not admin. if (!is_admin()) { // Init 404 class. self::$instance->actions = new JJ4T3_404_Actions(); } } return self::$instance; }
/** * The main function for that returns JJ_404_to_301 * * The main function responsible for returning the one true JJ_404_to_301 * instance to functions everywhere. * * Use this function like you would a global variable, except without needing * to declare the global. * * Example: <?php $jj4t3 = JJ_404_to_301(); ?> * * @since 3.0.0 * * @return JJ_404_to_301|object */ function JJ_404_to_301() { jj4t3_set_constants(); return JJ_404_to_301::instance(); }