| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | - * Plugin Name: Blockspare | |
| 4 | - * Plugin URI: https://blockspare.com | |
| 5 | - * Description: A stunning set of Gutenberg blocks to get you started with the new WordPress editor. You may design complicated layouts for your website in just a few minutes with our adaptable and inventive blocks. | |
| 6 | - * Version: 2.1.2 | |
| 3 | + * Plugin Name: Blockspare | |
| 4 | + * Plugin URI: https://profiles.wordpress.org/blockspare | |
| 5 | + * Description: Beautiful Page Building Blocks for WordPress | |
| 6 | + * Version: 1.2.1 | |
| 7 | 7 | * Author: Blockspare |
| 8 | 8 | * Author URI: https://blockspare.com |
| 9 | 9 | * Text Domain: blockspare |
| 10 | 10 | * License: GPL-2.0+ |
| @@ -12,9 +12,36 @@ | ||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | defined('ABSPATH') or die('No script kiddies please!'); // prevent direct access |
| 15 | 15 | |
| 16 | - /** | |
| 16 | + if (!class_exists('Blockspare')) : | |
| 17 | + | |
| 18 | + class Blockspare | |
| 19 | + { | |
| 20 | + | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * Plugin version. | |
| 24 | + * | |
| 25 | + * @var string | |
| 26 | + */ | |
| 27 | + const VERSION = '1.2.1'; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * Instance of this class. | |
| 31 | + * | |
| 32 | + * @var object | |
| 33 | + */ | |
| 34 | + protected static $instance = null; | |
| 35 | + | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Initialize the plugin. | |
| 39 | + */ | |
| 40 | + public function __construct() | |
| 41 | + { | |
| 42 | + | |
| 43 | + /** | |
| 17 | 44 | * Define global constants |
| 18 | 45 | **/ |
| 19 | 46 | defined('BLOCKSPARE_BASE_FILE') or define('BLOCKSPARE_BASE_FILE', __FILE__); |
| 20 | 47 | defined('BLOCKSPARE_BASE_DIR') or define('BLOCKSPARE_BASE_DIR', dirname(BLOCKSPARE_BASE_FILE)); |
| @@ -21,40 +48,35 @@ | ||
| 21 | 48 | defined('BLOCKSPARE_PLUGIN_URL') or define('BLOCKSPARE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 22 | 49 | defined('BLOCKSPARE_PLUGIN_DIR') or define('BLOCKSPARE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 23 | 50 | |
| 24 | 51 | defined( 'BLOCKSPARE_SHOW_PRO_NOTICES' ) || define( 'BLOCKSPARE_SHOW_PRO_NOTICES', true ); |
| 25 | - defined( 'BLOCKSPARE_VERSION' ) || define( 'BLOCKSPARE_VERSION', '2.1.2' ); | |
| 52 | + defined( 'BLOCKSPARE_VERSION' ) || define( 'BLOCKSPARE_VERSION', '1.2.0' ); | |
| 26 | 53 | |
| 54 | + | |
| 55 | + | |
| 56 | + include_once 'src/init.php'; | |
| 57 | + include_once 'src/welcome.php'; | |
| 58 | + include_once 'src/fonts.php'; | |
| 27 | 59 | |
| 28 | - if ( ! version_compare( PHP_VERSION, '5.6', '>=' ) ) { | |
| 29 | - add_action( 'admin_notices', 'aft_fail_php_version' ); | |
| 30 | - } elseif ( ! version_compare( get_bloginfo( 'version' ), '4.7', '>=' ) ) { | |
| 31 | - add_action( 'admin_notices', 'aftfail_wp_version' ); | |
| 32 | - } else { | |
| 33 | - /** | |
| 34 | - * Freemius. | |
| 35 | - */ | |
| 36 | - require_once(BLOCKSPARE_PLUGIN_DIR.'/freemius.php'); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * Plugin init and welcome. | |
| 40 | - */ | |
| 60 | + } // end of contructor | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Return an instance of this class. | |
| 64 | + * | |
| 65 | + * @return object A single instance of this class. | |
| 66 | + */ | |
| 67 | + public static function get_instance() | |
| 68 | + { | |
| 41 | 69 | |
| 42 | - include_once BLOCKSPARE_PLUGIN_DIR. 'inc/init.php'; | |
| 43 | - include_once BLOCKSPARE_PLUGIN_DIR.'inc/welcome.php'; | |
| 44 | - include_once BLOCKSPARE_PLUGIN_DIR.'inc/fonts.php'; | |
| 70 | + // If the single instance hasn't been set, set it now. | |
| 71 | + if (null == self::$instance) { | |
| 72 | + self::$instance = new self; | |
| 45 | 73 | } |
| 46 | - | |
| 47 | - | |
| 48 | - function aft_fail_php_version() { | |
| 49 | - /* translators: %s: PHP version */ | |
| 50 | - $message = sprintf( esc_html__( 'Blockspare for Gutenberg requires PHP version %s+, plugin is currently NOT RUNNING.', 'blockspare' ), '5.6' ); | |
| 51 | - $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); | |
| 52 | - echo wp_kses_post( $html_message ); | |
| 53 | - } | |
| 54 | - | |
| 55 | - function aft_fail_wp_version() { | |
| 56 | - /* translators: %s: WordPress version */ | |
| 57 | - $message = sprintf( esc_html__( 'Blockspare for Gutenberg requires WordPress version %s+. Because you are using an earlier version, the plugin is currently NOT RUNNING.', 'blockspare' ), '4.7' ); | |
| 58 | - $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); | |
| 59 | - echo wp_kses_post( $html_message ); | |
| 60 | - } | |
| 74 | + return self::$instance; | |
| 75 | + } | |
| 76 | + | |
| 77 | + | |
| 78 | + }// end of the class | |
| 79 | + | |
| 80 | + add_action('plugins_loaded', array('Blockspare', 'get_instance'), 0); | |
| 81 | + | |
| 82 | + endif; | |