| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: Customify |
| 4 | -Plugin URI: https://pixelgrade.com | |
| 4 | +Plugin URI: https://wordpress.org/plugins/customify/ | |
| 5 | 5 | Description: A Theme Customizer Booster |
| 6 | -Version: 1.4.2 | |
| 7 | -Author: PixelGrade | |
| 6 | +Version: 2.2.0 | |
| 7 | +Author: Pixelgrade | |
| 8 | 8 | Author URI: https://pixelgrade.com |
| 9 | 9 | Author Email: contact@pixelgrade.com |
| 10 | 10 | Text Domain: customify |
| 11 | 11 | License: GPL-2.0+ |
| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | Domain Path: /languages/ |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | // If this file is called directly, abort. |
| 17 | -if ( ! defined( 'WPINC' ) ) { | |
| 17 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 18 | 18 | die; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // ensure EXT is defined |
| @@ -22,46 +22,54 @@ | ||
| 22 | 22 | if ( ! defined('EXT')) { |
| 23 | 23 | define('EXT', '.php'); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -require 'core/bootstrap'.EXT; | |
| 26 | +require 'core/bootstrap.php'; | |
| 27 | 27 | |
| 28 | -$config = include 'plugin-config'.EXT; | |
| 28 | +// Include our helper array class. | |
| 29 | +require 'includes/lib/class-customify-array.php'; | |
| 29 | 30 | |
| 31 | +$config = include 'plugin-config.php'; | |
| 32 | + | |
| 30 | 33 | // set textdomain |
| 31 | -pixcustomify::settextdomain('customify'); | |
| 34 | +pixcustomify::settextdomain( 'customify' ); | |
| 32 | 35 | |
| 33 | 36 | // Ensure Test Data |
| 34 | 37 | // ---------------- |
| 35 | 38 | |
| 36 | -$defaults = include 'plugin-defaults'.EXT; | |
| 39 | +$defaults = include 'plugin-defaults.php'; | |
| 37 | 40 | |
| 38 | -$current_data = get_option($config['settings-key']); | |
| 41 | +$current_data = get_option( $config['settings-key'] ); | |
| 39 | 42 | |
| 40 | -if ($current_data === false) { | |
| 41 | - add_option($config['settings-key'], $defaults); | |
| 43 | +if ( $current_data === false ) { | |
| 44 | + add_option( $config['settings-key'], $defaults ); | |
| 45 | +} elseif ( count( array_diff_key( $defaults, $current_data ) ) != 0) { | |
| 46 | + $plugindata = array_merge( $defaults, $current_data ); | |
| 47 | + update_option( $config['settings-key'], $plugindata ); | |
| 42 | 48 | } |
| 43 | -else if (count(array_diff_key($defaults, $current_data)) != 0) { | |
| 44 | - $plugindata = array_merge($defaults, $current_data); | |
| 45 | - update_option($config['settings-key'], $plugindata); | |
| 46 | -} | |
| 47 | 49 | # else: data is available; do nothing |
| 48 | 50 | |
| 49 | -// Load Callbacks | |
| 50 | -// -------------- | |
| 51 | +/** | |
| 52 | + * Returns the main instance of PixCustomifyPlugin to prevent the need to use globals. | |
| 53 | + * | |
| 54 | + * @since 1.5.0 | |
| 55 | + * @return PixCustomifyPlugin | |
| 56 | + */ | |
| 57 | +function PixCustomifyPlugin() { | |
| 58 | + /** | |
| 59 | + * The core plugin class that is used to define internationalization, | |
| 60 | + * admin-specific hooks, and public-facing site hooks. | |
| 61 | + */ | |
| 62 | + require_once plugin_dir_path( __FILE__ ) . 'class-pixcustomify.php'; | |
| 51 | 63 | |
| 52 | -$basepath = dirname(__FILE__).DIRECTORY_SEPARATOR; | |
| 53 | -$callbackpath = $basepath.'callbacks'.DIRECTORY_SEPARATOR; | |
| 54 | -pixcustomify::require_all($callbackpath); | |
| 64 | + $instance = PixCustomifyPlugin::instance( __FILE__, '2.2.0' ); | |
| 55 | 65 | |
| 56 | -require_once( plugin_dir_path( __FILE__ ) . 'class-pixcustomify.php' ); | |
| 66 | + return $instance; | |
| 67 | +} | |
| 57 | 68 | |
| 58 | -// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. | |
| 59 | -register_activation_hook( __FILE__, array( 'PixCustomifyPlugin', 'activate' ) ); | |
| 60 | -//register_deactivation_hook( __FILE__, array( 'customifyPlugin', 'deactivate' ) ); | |
| 69 | +// Now get the party started | |
| 70 | +// We will keep this global variable for legacy | |
| 71 | +$pixcustomify_plugin = PixCustomifyPlugin(); | |
| 61 | 72 | |
| 62 | - | |
| 63 | -function customify_init_plugin () { | |
| 64 | - global $pixcustomify_plugin; | |
| 65 | - $pixcustomify_plugin = PixCustomifyPlugin::get_instance(); | |
| 66 | -} | |
| 67 | -add_action('plugins_loaded', 'customify_init_plugin', 20 ); | |
| 73 | +// Load custom modules | |
| 74 | +require_once( 'features/class-CSS_Editor.php' ); | |
| 75 | +require_once( 'features/class-Font_Selector.php' ); | |