/** * Main GenLib Instance * * Insures that only one instance of GenLib exists in memory at any one * time. Also prevents needing to define globals all over the place. * * @since 0.1.0 * @static * @uses GenLib::includes() Include the required files * @return GenLib */ public static function instance() { if (!isset(self::$instance) && !self::$instance instanceof GenLib) { self::$instance = new GenLib(); self::$instance->dir = plugin_dir_path(__FILE__); self::$instance->uri = plugin_dir_url(__FILE__); self::$instance->prefix = sanitize_key(apply_filters('genlib_prefix', 'genlib')); self::$instance->load_textdomain(); spl_autoload_register(array(self::$instance, 'autoloader')); self::$instance->includes(); self::$instance->build('GenLib_Factory'); } return self::$instance; }
/** * Grab an instance of the main library class. If you need to reference a * method in the class for some reason, do it using this function. * * Example: * * <?php genlib()->style_builder->build(); ?> * * @since 0.1.0 * @return object GenLib */ function genlib() { return GenLib::instance(); }