PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.13.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.13.0
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
← All changes | ablocks.php +76 -5 2.9.12.13.0 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: aBlocks
4 4 * Description: The WordPress plugin for creating beautiful and functional websites using the Gutenberg editor, with a variety of customizable blocks to design website pages.
5 - * Requires at least: 6.3
5 + * Requires at least: 6.8
6 6 * Requires PHP: 7.4
7 - * Version: 1.9.1
8 - * Author: Academy LMS
7 + * Version: 2.13.0
8 + * Author: Kodezen LLC
9 9 * Author URI: https://ablocks.pro/
10 10 * License: GPL-3.0+
11 11 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
12 12 * Text Domain: ablocks
@@ -21,10 +21,14 @@
21 21 public function __construct() {
22 22 // define constants
23 23 $this->define_constants();
24 24 $this->load_dependency();
25 + // Register the free product with the shared StoreEngine SDK (loaded in
26 + // load_dependency) so the SDK owns the deactivation popup + opt-in.
27 + \ABlocks\Admin\StoreLicense::init();
25 28 $this->load_cli();
26 29 register_activation_hook( __FILE__, [ $this, 'activate' ] );
30 + register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
27 31 $this->set_global_settings();
28 32 add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ] );
29 33 add_action( 'ablocks_loaded', [ $this, 'init_plugin' ] );
30 34 }
@@ -40,9 +44,9 @@
40 44 /**
41 45 * Define the plugin constants
42 46 */
43 47 private function define_constants() {
44 - define( 'ABLOCKS_VERSION', '1.9.1' );
48 + define( 'ABLOCKS_VERSION', '2.13.0' );
45 49 define( 'ABLOCKS_PLUGIN_SLUG', 'ablocks' );
46 50 define( 'ABLOCKS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
47 51 define( 'ABLOCKS_ROOT_URL', plugin_dir_url( __FILE__ ) );
48 52 define( 'ABLOCKS_ASSETS_URL', ABLOCKS_ROOT_URL . 'assets/' );
@@ -52,9 +56,11 @@
52 56 define( 'ABLOCKS_BLOCKS_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'includes/blocks/' );
53 57 define( 'ABLOCKS_ADDONS_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'addons/' );
54 58 define( 'ABLOCKS_BLOCKS_VISIBILITY_SETTINGS_NAME', 'ablocks_blocks' );
55 59 define( 'ABLOCKS_FONTS_SETTINGS_NAME', 'ablocks_fonts' );
60 + define( 'ABLOCKS_REST_NAMESPACE', 'ablocks/v1' );
56 61 define( 'ABLOCKS_SETTINGS_NAME', 'ablocks_settings' );
62 + define( 'ABLOCKS_FRONTEND_DASHBOARD_SUB_PAGES_SETTINGS_NAME', 'ablocks_frontend_dashboard_sub_pages' );
57 63 define( 'ABLOCKS_ADDONS_SETTINGS_NAME', 'ablocks_addons' );
58 64 define( 'ABLOCKS_TEMPLATE_LIB_HOST', 'template-kits.com' );
59 65 }
60 66
@@ -59,8 +65,28 @@
59 65 }
60 66
61 67 public function load_dependency() {
62 68 require_once ABLOCKS_INCLUDES_DIR_PATH . 'autoload.php';
69 +
70 + // Load the shared StoreEngine License Management Client SDK. aBlocks (free)
71 + // owns this version-managed library (Composer package
72 + // `storeengine/wordpress-sdk`); aBlocks Pro (and any add-on) reuses the
73 + // already-loaded SDK rather than bundling its own copy.
74 + if ( file_exists( ABLOCKS_ROOT_DIR_PATH . 'vendor/autoload.php' ) ) {
75 + require_once ABLOCKS_ROOT_DIR_PATH . 'vendor/autoload.php';
76 + }
77 +
78 + // Require the SDK bootstrap DIRECTLY, not only through Composer's files
79 + // autoload. Composer de-dupes the SDK's init.php by a package-stable hash,
80 + // so when several active plugins each bundle this SDK only the first one's
81 + // autoloader includes it and the rest never register their version. Loading
82 + // it here guarantees aBlocks' bundled SDK version always joins the
83 + // "newest version wins" election regardless of plugin load order. Requiring
84 + // init.php registers this SDK version and, on `plugins_loaded`, loads
85 + // functions.php (defining se_license_init()) and the SDK class autoloader.
86 + if ( file_exists( ABLOCKS_ROOT_DIR_PATH . 'vendor/storeengine/wordpress-sdk/init.php' ) ) {
87 + require_once ABLOCKS_ROOT_DIR_PATH . 'vendor/storeengine/wordpress-sdk/init.php';
88 + }
63 89 }
64 90 public function load_cli() {
65 91 if ( file_exists( ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php' ) ) {
66 92 require_once ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php';
@@ -68,9 +94,16 @@
68 94 }
69 95
70 96 public function set_global_settings() {
71 97 $GLOBALS['ablocks_fonts'] = json_decode( get_option( ABLOCKS_FONTS_SETTINGS_NAME, '{}' ), true );
72 - $GLOBALS['ablocks_blocks'] = json_decode( get_option( ABLOCKS_BLOCKS_VISIBILITY_SETTINGS_NAME, '{}' ) );
98 + // Merge the saved visibility over the default registry so blocks added in
99 + // a new version default to enabled (the user's saved toggles still win).
100 + $saved_blocks = json_decode( get_option( ABLOCKS_BLOCKS_VISIBILITY_SETTINGS_NAME, '{}' ), true );
101 + $default_blocks = \ABlocks\Admin\Settings\Blocks::get_default_data();
102 + $GLOBALS['ablocks_blocks'] = (object) array_merge(
103 + is_array( $default_blocks ) ? $default_blocks : [],
104 + is_array( $saved_blocks ) ? $saved_blocks : []
105 + );
73 106 $GLOBALS['ablocks_settings'] = json_decode( get_option( ABLOCKS_SETTINGS_NAME, '{}' ) );
74 107 $GLOBALS['ablocks_addons'] = json_decode( get_option( ABLOCKS_ADDONS_SETTINGS_NAME, '{}' ) );
75 108 }
76 109
@@ -87,12 +120,39 @@
87 120 }
88 121
89 122 public function init_plugin() {
90 123 ABlocks\Migration::init();
124 + // Before anything that registers a menu, an ajax action or a REST route,
125 + // so the capabilities those gate on already answer correctly.
126 + ABlocks\Permissions::init();
127 + ABlocks\PermalinkRewrite::init();
91 128 ABlocks\Addons::init();
129 + // Ahead of every block registration on `init` — aBlocks' own and any
130 + // other plugin's — so the attribute the editor adds to every block is
131 + // on the server's copy of it too.
132 + ABlocks\Classes\FlexItem::init();
133 + // Keeps the server-side previews of dynamic blocks rendering when another
134 + // plugin adds attributes to every block in JavaScript only.
135 + ABlocks\Classes\BlockRendererAttributes::init();
92 136 ABlocks\Blocks::init();
93 137 ABlocks\Assets::init();
138 + ABlocks\Classes\CoreFontRegistry::init();
139 + ABlocks\Classes\GlobalClasses::init();
140 + ABlocks\Classes\Breakpoints::init();
141 + ABlocks\Performance\Optimizations::init();
142 + ABlocks\Performance\DelayJs::init();
143 + ABlocks\Performance\DeferJs::init();
144 + ABlocks\Performance\ImageOptimizer::init();
145 + ABlocks\Performance\LcpPreload::init();
146 + ABlocks\Performance\TouchTargets::init();
147 + ABlocks\Performance\PageCache::init();
148 + ABlocks\Performance\StyleConsolidator::init();
149 + ABlocks\Performance\FragmentCache::init();
150 + ABlocks\Performance\TemplateCache::init();
151 + ABlocks\Performance\ImageTools::init();
152 + ABlocks\Classes\Images\UploadGuard::init();
94 153 ABlocks\Ajax::init();
154 + ABlocks\API::init();
95 155 if ( is_admin() ) {
96 156 ABlocks\Admin::init();
97 157 }
98 158 ABlocks\Frontend::init();
@@ -100,8 +160,19 @@
100 160 }
101 161
102 162 public function activate() {
103 163 ABlocks\Installer::init();
164 + }
165 +
166 + /**
167 + * Leave no scheduled work behind when the plugin is switched off.
168 + *
169 + * Cached files are deliberately left in place: deactivation is often
170 + * temporary, and re-activating should not mean rebuilding the whole cache.
171 + * They are removed on uninstall, or on demand from the Performance tab.
172 + */
173 + public function deactivate() {
174 + ABlocks\Classes\PageCache\Scheduler::clear_events();
104 175 }
105 176 }
106 177
107 178 /**