| @@ -13,11 +13,13 @@ | ||
| 13 | 13 | * @package Darkify |
| 14 | 14 | * |
| 15 | 15 | * @wordpress-plugin |
| 16 | 16 | * Plugin Name: Darkify |
| 17 | - * Plugin URI: https://wp-plugins.themeatelier.net/ | |
| 17 | + * Plugin URI: https://darkifywp.com/ | |
| 18 | 18 | * Description: Darkify is for a stylish, modern darkmode look that people love. |
| 19 | - * Version: 1.2.0 | |
| 19 | + * Requires at least: 5.5 | |
| 20 | + * Requires PHP: 7.1 | |
| 21 | + * Version: 2.1.3 | |
| 20 | 22 | * Author: ThemeAtelier |
| 21 | 23 | * Author URI: https://themeatelier.net/ |
| 22 | 24 | * License: GPL-2.0+ |
| 23 | 25 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| @@ -26,49 +28,76 @@ | ||
| 26 | 28 | */ |
| 27 | 29 | |
| 28 | 30 | // If this file is called directly, abort. |
| 29 | 31 | if (!defined('WPINC')) { |
| 30 | - die; | |
| 32 | + die; | |
| 31 | 33 | } |
| 32 | 34 | |
| 35 | +require_once __DIR__ . '/vendor/autoload.php'; | |
| 36 | + | |
| 37 | +use ThemeAtelier\Darkify\Includes\Darkify; | |
| 38 | + | |
| 33 | 39 | /** |
| 34 | 40 | * Currently plugin version. |
| 35 | 41 | * Start at version 1.0.0 and use SemVer - https://semver.org |
| 36 | 42 | * Rename this for your plugin and update it as you release new versions. |
| 37 | 43 | */ |
| 38 | -define('DRK_LITE_VERSION', '1.2.0'); | |
| 39 | -define('DRK_LITE_DIR_URL', plugin_dir_url(__FILE__)); | |
| 40 | -define('DRK_LITE_BASENAME', plugin_basename(__FILE__)); | |
| 41 | -define('DRK_LITE_PATH', plugin_dir_path(__FILE__)); | |
| 44 | +if (!defined('DARKIFY_VERSION')) { | |
| 45 | + define('DARKIFY_VERSION', '2.1.3'); | |
| 46 | +} | |
| 47 | +if (!defined('DARKIFY_FILE')) { | |
| 48 | + define('DARKIFY_FILE', __FILE__); | |
| 49 | +} | |
| 50 | +if (!defined('DARKIFY_DIR_URL')) { | |
| 51 | + define('DARKIFY_DIR_URL', plugin_dir_url(__FILE__)); | |
| 52 | +} | |
| 53 | +if (!defined('DARKIFY_BASENAME')) { | |
| 54 | + define('DARKIFY_BASENAME', plugin_basename(__FILE__)); | |
| 55 | +} | |
| 56 | +if (!defined('DARKIFY_PATH')) { | |
| 57 | + define('DARKIFY_PATH', plugin_dir_path(__FILE__)); | |
| 58 | +} | |
| 59 | +if (!defined('DARKIFY_DIR_NAME')) { | |
| 60 | + define('DARKIFY_DIR_NAME', dirname(__FILE__)); | |
| 61 | +} | |
| 62 | +if (!defined('DARKIFY_DEMO_URL')) { | |
| 63 | + define('DARKIFY_DEMO_URL', 'https://darkifywp.com/'); | |
| 64 | +} | |
| 65 | +if (!defined('DARKIFY_DOCS_URL')) { | |
| 66 | + define('DARKIFY_DOCS_URL', 'https://darkifywp.com/docs/'); | |
| 67 | +} | |
| 42 | 68 | |
| 43 | -/** | |
| 44 | - * The code that runs during plugin activation. | |
| 45 | - * This action is documented in includes/class-darkify-activator.php | |
| 46 | - */ | |
| 47 | -function darkify_activate() | |
| 69 | +function darkify_run() | |
| 48 | 70 | { |
| 49 | - require_once DRK_LITE_PATH . 'includes/class-darkify-activator.php'; | |
| 50 | - Darkify_Activator::activate(); | |
| 71 | + // Launch the plugin. | |
| 72 | + $darkify = new Darkify(); | |
| 73 | + $darkify->run(); | |
| 51 | 74 | } |
| 52 | 75 | |
| 53 | 76 | /** |
| 54 | - * The code that runs during plugin deactivation. | |
| 55 | - * This action is documented in includes/class-darkify-deactivator.php | |
| 77 | + * Pro version check. | |
| 78 | + * | |
| 79 | + * @return boolean | |
| 56 | 80 | */ |
| 57 | -function darkify_deactivate() | |
| 58 | -{ | |
| 59 | - require_once DRK_LITE_PATH . 'includes/class-darkify-deactivator.php'; | |
| 60 | - Darkify_Deactivator::deactivate(); | |
| 81 | +include_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 82 | +if (! (is_plugin_active('darkify-pro/darkify-pro.php') || is_plugin_active_for_network('darkify-pro/darkify-pro.php'))) { | |
| 83 | + darkify_run(); | |
| 61 | 84 | } |
| 62 | 85 | |
| 63 | -register_activation_hook(__FILE__, 'darkify_activate'); | |
| 64 | -register_deactivation_hook(__FILE__, 'darkify_deactivate'); | |
| 65 | 86 | |
| 66 | -require DRK_LITE_PATH . 'includes/class-darkify.php'; | |
| 87 | +/** | |
| 88 | + * Initialize the plugin tracker | |
| 89 | + * | |
| 90 | + * @return void | |
| 91 | + */ | |
| 92 | +function darkify_appsero_init() | |
| 93 | +{ | |
| 94 | + if (!class_exists('DarkifyAppSero\Insights')) { | |
| 95 | + require_once DARKIFY_PATH . 'src/Admin/appsero/Client.php'; | |
| 96 | + } | |
| 67 | 97 | |
| 98 | + $client = new DarkifyAppSero\Client('16b2d91f-fd42-42d1-b199-5ae98213496a', 'Darkify Dark Mode', __FILE__); | |
| 99 | + // Active insights | |
| 100 | + $client->insights()->init(); | |
| 101 | +} | |
| 68 | 102 | |
| 69 | -function darkify_run() | |
| 70 | -{ | |
| 71 | - $plugin = new Darkify(); | |
| 72 | - $plugin->run(); | |
| 73 | -} | |
| 74 | -darkify_run(); | |
| 103 | +add_action('plugins_loaded', 'darkify_appsero_init'); | |