| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* This file is read by WordPress to generate the plugin information in the plugin |
| 7 |
* admin area. This file also includes all of the dependencies used by the plugin, |
| 8 |
* registers the activation and deactivation functions, and defines a function |
| 9 |
* that starts the plugin. |
| 10 |
* |
| 11 |
* @link https://cozythemes.com/ |
| 12 |
* @since 1.0.0 |
| 13 |
* @package Cozy_Addons |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: Cozy Blocks |
| 17 |
* Plugin URI: https://cozythemes.com/cozy-addons |
| 18 |
* Description: Build stunning WordPress sites with 50+ advanced blocks, 500+ patterns, and 40+ templates—a fast, effortless website builder. |
| 19 |
* Version: 2.2.20 |
| 20 |
* Author: CozyThemes |
| 21 |
* Author URI: https://cozythemes.com/ |
| 22 |
* License: GPL-2.0+ |
| 23 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 |
* Text Domain: cozy-addons |
| 25 |
* Domain Path: /languages/ |
| 26 |
* Requires at least: 6.7 |
| 27 |
* Requires PHP: 7.4 |
| 28 |
*/ |
| 29 |
|
| 30 |
// If this file is called directly, abort. |
| 31 |
if ( ! defined( 'ABSPATH' ) ) { |
| 32 |
exit; |
| 33 |
} |
| 34 |
|
| 35 |
define( 'COZY_ADDONS_VERSION', '2.2.20' ); |
| 36 |
define( 'COZY_ADDONS_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) ); |
| 37 |
define( 'COZY_ADDONS_PLUGIN_URL', trailingslashit( plugins_url( '', __FILE__ ) ) ); |
| 38 |
|
| 39 |
require_once COZY_ADDONS_PLUGIN_DIR . 'autoload.php'; |
| 40 |
|
| 41 |
if ( ! function_exists( 'cc_fs' ) ) { |
| 42 |
// Create a helper function for easy SDK access. |
| 43 |
function cc_fs() { |
| 44 |
global $cc_fs; |
| 45 |
if ( ! isset( $cc_fs ) ) { |
| 46 |
// Include Freemius SDK. |
| 47 |
require_once __DIR__ . '/freemius/start.php'; |
| 48 |
|
| 49 |
$cc_fs = fs_dynamic_init( |
| 50 |
array( |
| 51 |
'id' => '12692', |
| 52 |
'slug' => 'cozy-addons', |
| 53 |
'premium_slug' => 'cozy-companions-premium', |
| 54 |
'type' => 'plugin', |
| 55 |
'public_key' => 'pk_fbca81b65cb25c89dcf0662ce4cc6', |
| 56 |
'is_premium' => true, |
| 57 |
'premium_suffix' => 'Pro', |
| 58 |
// If your plugin is a serviceware, set this option to false. |
| 59 |
'has_premium_version' => false, |
| 60 |
'has_addons' => false, |
| 61 |
'has_affiliation' => true, |
| 62 |
'has_paid_plans' => true, |
| 63 |
'menu' => array( |
| 64 |
'slug' => '_cozy_companions', |
| 65 |
'support' => false, |
| 66 |
), |
| 67 |
) |
| 68 |
); |
| 69 |
} |
| 70 |
|
| 71 |
return $cc_fs; |
| 72 |
} |
| 73 |
|
| 74 |
// Init Freemius. |
| 75 |
cc_fs(); |
| 76 |
// Signal that SDK was initiated. |
| 77 |
do_action( 'cc_fs_loaded' ); |
| 78 |
} |
| 79 |
|
| 80 |
if ( function_exists( 'cc_fs' ) ) { |
| 81 |
cc_fs()->skip_connection(); |
| 82 |
} |
| 83 |
|
| 84 |
if ( ! defined( 'CT_COMPANION_SDK_URL' ) ) { |
| 85 |
define( 'CT_COMPANION_SDK_URL', COZY_ADDONS_PLUGIN_URL . '/admin/ct-companions/' ); |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* The code that runs during plugin activation. |
| 90 |
* This action is documented in includes/class-cozy-addons-activator.php |
| 91 |
*/ |
| 92 |
function activate_cozy_addons() { |
| 93 |
\CozyAddons\Activator::activate(); |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* The code that runs during plugin deactivation. |
| 98 |
* This action is documented in includes/class-cozy-addons-deactivator.php |
| 99 |
*/ |
| 100 |
function deactivate_cozy_addons() { |
| 101 |
\CozyAddons\Deactivator::deactivate(); |
| 102 |
} |
| 103 |
|
| 104 |
register_activation_hook( __FILE__, 'activate_cozy_addons' ); |
| 105 |
register_deactivation_hook( __FILE__, 'deactivate_cozy_addons' ); |
| 106 |
|
| 107 |
if ( ! class_exists( 'Cozy_Addons' ) ) : |
| 108 |
final class Cozy_Addons { |
| 109 |
/** |
| 110 |
* Instance |
| 111 |
* |
| 112 |
* @since 1.0.0 |
| 113 |
* |
| 114 |
* @access private |
| 115 |
* @static |
| 116 |
* |
| 117 |
* @var Cozy_Addons The single instance of the class. |
| 118 |
*/ |
| 119 |
private static $instance = null; |
| 120 |
|
| 121 |
/** |
| 122 |
* Instance |
| 123 |
* |
| 124 |
* Ensures only one instance of the class is loaded or can be loaded. |
| 125 |
* |
| 126 |
* @since 1.0.0 |
| 127 |
* |
| 128 |
* @access public |
| 129 |
* @static |
| 130 |
* |
| 131 |
* @return Cozy_Addons An instance of the class. |
| 132 |
*/ |
| 133 |
public static function instance() { |
| 134 |
|
| 135 |
if ( is_null( self::$instance ) ) { |
| 136 |
self::$instance = new self(); |
| 137 |
} |
| 138 |
return self::$instance; |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* Constructor |
| 143 |
* |
| 144 |
* @since 1.0.0 |
| 145 |
* @access public |
| 146 |
*/ |
| 147 |
public function __construct() { |
| 148 |
\CozyAddons\Init::get_instance(); |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
// Instantiate Cozy Addons. |
| 153 |
Cozy_Addons::instance(); |
| 154 |
|
| 155 |
endif; |
| 156 |
|
| 157 |
|
| 158 |
/** |
| 159 |
* Clears the cached pattern-themes list when Cozy Addons is updated, |
| 160 |
* so a new remote file takes effect immediately instead of waiting |
| 161 |
* for the transient to expire. |
| 162 |
* |
| 163 |
* @param WP_Upgrader $upgrader Upgrader instance (unused here). |
| 164 |
* @param array $hook_extra Data about the upgrade action, including |
| 165 |
* the type ('plugin', 'theme', 'core') and, |
| 166 |
* for plugins, the list of updated plugin files. |
| 167 |
* @return void |
| 168 |
*/ |
| 169 |
add_action( |
| 170 |
'upgrader_process_complete', |
| 171 |
function ( $upgrader, $hook_extra ) { |
| 172 |
// Only care about plugin updates, not theme/core/translation updates. |
| 173 |
if ( ! isset( $hook_extra['type'] ) || 'plugin' !== $hook_extra['type'] ) { |
| 174 |
return; |
| 175 |
} |
| 176 |
|
| 177 |
// 'update' action can update several plugins in one go (bulk update), |
| 178 |
// so $hook_extra['plugins'] is an array of plugin basenames. |
| 179 |
if ( empty( $hook_extra['plugins'] ) || ! is_array( $hook_extra['plugins'] ) ) { |
| 180 |
return; |
| 181 |
} |
| 182 |
|
| 183 |
$plugin_basename = plugin_basename( 'cozy-addons/cozy-addons.php' ); // e.g. 'cozy-addons/cozy-addons.php'. |
| 184 |
|
| 185 |
if ( in_array( $plugin_basename, $hook_extra['plugins'], true ) ) { |
| 186 |
delete_transient( 'ca_pattern_themes' ); |
| 187 |
} |
| 188 |
}, |
| 189 |
10, |
| 190 |
2 |
| 191 |
); |
| 192 |
|