| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: CookieAdmin - Cookie Consent Banner |
| 4 | 4 | Plugin URI: https://cookieadmin.net |
| 5 | 5 | Description: CookieAdmin provides easy to configure cookie consent banner with GDPR and CCPA law support. |
| 6 | -Version: 1.0.4 | |
| 6 | +Version: 1.2.3 | |
| 7 | 7 | Author: Softaculous |
| 8 | 8 | Author URI: https://www.softaculous.com |
| 9 | 9 | License: LGPL v2.1 |
| 10 | 10 | License URI: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html |
| @@ -34,18 +34,49 @@ | ||
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | define('COOKIEADMIN_FILE', __FILE__); |
| 38 | +define('COOKIEADMIN_BASE', plugin_basename(COOKIEADMIN_FILE)); | |
| 39 | +define('COOKIEADMIN_DIR', plugin_dir_path(__FILE__)); | |
| 40 | +define('COOKIEADMIN_VERSION', '1.2.3'); | |
| 41 | +define('COOKIEADMIN_URL', plugins_url('', COOKIEADMIN_FILE)); | |
| 42 | +define('COOKIEADMIN_PLUGIN_URL', plugin_dir_url(__FILE__)); | |
| 43 | +define('COOKIEADMIN_PRO_URL', 'https://cookieadmin.net/pricing?from=plugin'); | |
| 44 | +define('COOKIEADMIN_WWW_URL', 'https://cookieadmin.net/'); | |
| 38 | 45 | |
| 46 | +include_once(COOKIEADMIN_DIR.'includes/functions.php'); | |
| 47 | + | |
| 39 | 48 | //we need to load textdomain for language translation |
| 40 | 49 | function cookieadmin_load_textdomain() { |
| 41 | 50 | load_plugin_textdomain( 'cookieadmin', false, dirname(plugin_basename( __FILE__ ) ) . '/languages/'); |
| 42 | 51 | } |
| 52 | +add_action( 'plugins_loaded', 'cookieadmin_load_textdomain', 9 ); | |
| 43 | 53 | |
| 44 | -add_action( 'plugins_loaded', 'cookieadmin_load_textdomain' ); | |
| 54 | +//Auto-loader | |
| 55 | +function cookieadmin_autoloader($class){ | |
| 56 | + | |
| 57 | + if(!preg_match('/^CookieAdmin\\\(.*)/is', $class, $m)){ | |
| 58 | + return; | |
| 59 | + } | |
| 45 | 60 | |
| 46 | -include_once(dirname(__FILE__).'/init.php'); | |
| 61 | + $m[1] = str_replace('\\', '/', $m[1]); | |
| 62 | + | |
| 63 | + if(file_exists(COOKIEADMIN_DIR.'includes/'.strtolower($m[1]).'.php')){ | |
| 64 | + include_once(COOKIEADMIN_DIR.'includes/'.strtolower($m[1]).'.php'); | |
| 65 | + } | |
| 66 | +} | |
| 47 | 67 | |
| 68 | +spl_autoload_register(__NAMESPACE__.'\cookieadmin_autoloader'); | |
| 69 | + | |
| 70 | + | |
| 71 | +if(!class_exists('CookieAdmin')){ | |
| 72 | +#[\AllowDynamicProperties] | |
| 73 | +class CookieAdmin{ | |
| 74 | +} | |
| 75 | +} | |
| 76 | + | |
| 77 | +add_action('plugins_loaded', 'cookieadmin_load_plugin'); | |
| 78 | + | |
| 48 | 79 | // Activation & Deactivation Hooks |
| 49 | 80 | register_activation_hook(__FILE__, 'cookieadmin_activate'); |
| 50 | 81 | register_deactivation_hook(__FILE__, 'cookieadmin_deactivate'); |
| 51 | 82 | |
| @@ -50,8 +81,15 @@ | ||
| 50 | 81 | register_deactivation_hook(__FILE__, 'cookieadmin_deactivate'); |
| 51 | 82 | |
| 52 | 83 | function cookieadmin_activate() { |
| 53 | 84 | |
| 85 | + // Setting Defaults | |
| 86 | + $settings = get_option('cookieadmin_settings', []); | |
| 87 | + if(!isset($settings['block_scripts'])){ | |
| 88 | + $settings['block_scripts'] = true; | |
| 89 | + update_option('cookieadmin_settings', $settings); | |
| 90 | + } | |
| 91 | + | |
| 54 | 92 | add_option('cookieadmin_version', COOKIEADMIN_VERSION); |
| 55 | 93 | |
| 56 | 94 | include_once(COOKIEADMIN_DIR . 'includes/database.php'); |
| 57 | 95 | |
| @@ -60,9 +98,7 @@ | ||
| 60 | 98 | return true; |
| 61 | 99 | } |
| 62 | 100 | |
| 63 | 101 | function cookieadmin_deactivate() { |
| 64 | - | |
| 65 | - | |
| 66 | 102 | return true; |
| 67 | 103 | } |
| 68 | 104 | |