PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.4.6
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.4.6
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
← All changes | darkify.php +33 -67 1.2.41.4.6 View file →
@@ -13,11 +13,11 @@
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.4
19 + * Version: 1.4.6
20 20 * Author: ThemeAtelier
21 21 * Author URI: https://themeatelier.net/
22 22 * License: GPL-2.0+
23 23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@@ -26,86 +26,53 @@
26 26 */
27 27
28 28 // If this file is called directly, abort.
29 29 if (!defined('WPINC')) {
30 - die;
30 + die;
31 31 }
32 32
33 +require_once __DIR__ . '/vendor/autoload.php';
34 +
35 +use ThemeAtelier\Darkify\Darkify;
36 +
33 37 /**
34 38 * Currently plugin version.
35 39 * Start at version 1.0.0 and use SemVer - https://semver.org
36 40 * Rename this for your plugin and update it as you release new versions.
37 41 */
38 -define('DRK_LITE_VERSION', '1.2.4');
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__));
42 +define('DARKIFY_VERSION', '1.4.6');
43 +define('DARKIFY_FILE', __FILE__);
44 +define('DARKIFY_DIR_URL', plugin_dir_url(__FILE__));
45 +define('DARKIFY_BASENAME', plugin_basename(__FILE__));
46 +define('DARKIFY_PATH', plugin_dir_path(__FILE__));
42 47 define('DARKIFY_DIR_NAME', dirname(__FILE__));
43 48
44 -/**
45 - * The code that runs during plugin activation.
46 - * This action is documented in includes/class-darkify-activator.php
47 - */
48 -function darkify_activate()
49 -{
50 - require_once DRK_LITE_PATH . 'includes/class-darkify-activator.php';
51 - Darkify_Activator::activate();
52 -}
49 +include_once ABSPATH . 'wp-admin/includes/plugin.php';
50 +$pro_plugin_slug = 'darkify-pro/darkify-pro.php';
53 51
54 -/**
55 - * The code that runs during plugin deactivation.
56 - * This action is documented in includes/class-darkify-deactivator.php
57 - */
58 -function darkify_deactivate()
59 -{
60 - require_once DRK_LITE_PATH . 'includes/class-darkify-deactivator.php';
61 - Darkify_Deactivator::deactivate();
52 +// kick-off the plugin
53 +if (!is_plugin_active($pro_plugin_slug)) {
54 +
55 + function darkify_run()
56 + {
57 + // Launch the plugin.
58 + $darkify = new Darkify();
59 + $darkify->run();
60 + }
61 + darkify_run();
62 62 }
63 63
64 -register_activation_hook(__FILE__, 'darkify_activate');
65 -register_deactivation_hook(__FILE__, 'darkify_deactivate');
66 -
67 -require DRK_LITE_PATH . 'includes/class-darkify.php';
68 -
69 -
70 -function darkify_run()
64 +function darkify_redirect_to($plugin)
71 65 {
72 - $plugin = new Darkify();
73 - $plugin->run();
66 + if (DARKIFY_BASENAME === $plugin) {
67 + $redirect_url = esc_url(admin_url('admin.php?page=darkify'));
68 + exit(wp_kses_post(wp_safe_redirect($redirect_url)));
69 + }
74 70 }
75 -darkify_run();
76 71
77 -add_action('admin_menu', 'add_plugin_page');
78 -function add_plugin_page()
79 -{
80 - // This page will be under "Settings"
81 - add_menu_page(
82 - esc_html__('Darkify', 'darkify'),
83 - esc_html__('Darkify', 'darkify'),
84 - 'manage_options',
85 - 'darkify',
86 - 'darkify_settings',
87 - 'data:image/svg+xml;base64,' . base64_encode('<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M23.5 1.5C23.5 0.671573 22.8284 0 22 0C21.1716 0 20.5 0.671573 20.5 1.5V4.5C20.5 5.32843 21.1716 6 22 6C22.8284 6 23.5 5.32843 23.5 4.5V1.5Z" fill="white"/><path d="M34 22C34 28.6274 28.6274 34 22 34C15.3726 34 10 28.6274 10 22C10 15.3726 15.3726 10 22 10C28.6274 10 34 15.3726 34 22Z" fill="white"/><path d="M22 38C22.8284 38 23.5 38.6716 23.5 39.5V42.5C23.5 43.3284 22.8284 44 22 44C21.1716 44 20.5 43.3284 20.5 42.5V39.5C20.5 38.6716 21.1716 38 22 38Z" fill="white"/><path d="M10.6863 10.6863C10.1005 11.2721 9.15074 11.2721 8.56495 10.6863L6.44363 8.56498C5.85784 7.97919 5.85784 7.02945 6.44363 6.44366C7.02942 5.85787 7.97916 5.85787 8.56495 6.44366L10.6863 8.56498C11.2721 9.15077 11.2721 10.1005 10.6863 10.6863Z" fill="white"/><path d="M35.435 37.5564C36.0208 38.1421 36.9705 38.1421 37.5563 37.5564C38.1421 36.9706 38.1421 36.0208 37.5563 35.435L35.435 33.3137C34.8492 32.7279 33.8995 32.7279 33.3137 33.3137C32.7279 33.8995 32.7279 34.8493 33.3137 35.435L35.435 37.5564Z" fill="white"/><path d="M10.6863 33.3137C11.2721 33.8995 11.2721 34.8492 10.6863 35.435L8.56495 37.5563C7.97916 38.1421 7.02942 38.1421 6.44363 37.5563C5.85784 36.9706 5.85784 36.0208 6.44363 35.435L8.56495 33.3137C9.15074 32.7279 10.1005 32.7279 10.6863 33.3137Z" fill="white"/><path d="M37.5563 8.56496C38.1421 7.97918 38.1421 7.02943 37.5563 6.44364C36.9705 5.85786 36.0208 5.85786 35.435 6.44364L33.3137 8.56496C32.7279 9.15075 32.7279 10.1005 33.3137 10.6863C33.8995 11.2721 34.8492 11.2721 35.435 10.6863L37.5563 8.56496Z" fill="white"/><path d="M6 22C6 22.8284 5.32843 23.5 4.5 23.5H1.5C0.671573 23.5 0 22.8284 0 22C0 21.1716 0.671573 20.5 1.5 20.5H4.5C5.32843 20.5 6 21.1716 6 22Z" fill="white"/><path d="M42.5 23.5C43.3284 23.5 44 22.8284 44 22C44 21.1716 43.3284 20.5 42.5 20.5H39.5C38.6716 20.5 38 21.1716 38 22C38 22.8284 38.6716 23.5 39.5 23.5H42.5Z" fill="white"/></svg>'),
88 - 9
89 - );
90 - do_action('darkify_before_upgrade_pro_menu');
91 - add_submenu_page(
92 - 'darkify',
93 - __('👑 Upgrade to Pro!',
94 - 'darkify'),
95 - sprintf('<span style="color: #35b747;font-weight: bold;" class="darkify-get-pro-text">%s</span>', __('👑 Upgrade to Pro!', 'darkify')),
96 - 'manage_options',
97 - 'https://1.envato.market/darkify');
98 - do_action('darkify_after_upgrade_pro_menu');
99 -}
72 +add_action('activated_plugin', 'darkify_redirect_to');
100 73
101 74 /**
102 - * Options page callback
103 - */
104 -function darkify_settings() {}
105 -
106 -
107 -/**
108 75 * Initialize the plugin tracker
109 76 *
110 77 * @return void
111 78 */
@@ -110,15 +77,14 @@
110 77 * @return void
111 78 */
112 79 function darkify_appsero_init()
113 80 {
114 -
115 81 if (!class_exists('DarkifyAppSero\Insights')) {
116 - require_once DRK_LITE_PATH . 'admin/appsero/Client.php';
82 + require_once DARKIFY_PATH . 'src/Admin/appsero/Client.php';
117 83 }
118 84
119 - $client = new DarkifyAppSero\Client('d1635433-15b4-474b-98f8-0c0809dec2c1', 'Darkify', __FILE__);
85 + $client = new DarkifyAppSero\Client('16b2d91f-fd42-42d1-b199-5ae98213496a', 'Darkify Dark Mode', __FILE__);
120 86 // Active insights
121 87 $client->insights()->init();
122 88 }
123 89
124 -darkify_appsero_init();
90 +darkify_appsero_init();