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 +184 -0 2.7.42.13.0 View file →
@@ -1,0 +1,184 @@
1 +<?php
2 +/**
3 + * Plugin Name: aBlocks
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.8
6 + * Requires PHP: 7.4
7 + * Version: 2.13.0
8 + * Author: Kodezen LLC
9 + * Author URI: https://ablocks.pro/
10 + * License: GPL-3.0+
11 + * License URI: https://www.gnu.org/licenses/gpl-2.0.html
12 + * Text Domain: ablocks
13 + * Domain Path: /languages/
14 + */
15 +
16 +if ( ! defined( 'ABSPATH' ) ) {
17 + exit;
18 +}
19 +
20 +final class ABlocks {
21 + public function __construct() {
22 + // define constants
23 + $this->define_constants();
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();
28 + $this->load_cli();
29 + register_activation_hook( __FILE__, [ $this, 'activate' ] );
30 + register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
31 + $this->set_global_settings();
32 + add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ] );
33 + add_action( 'ablocks_loaded', [ $this, 'init_plugin' ] );
34 + }
35 +
36 + public static function init() {
37 + static $instance = false;
38 + if ( ! $instance ) {
39 + $instance = new self();
40 + }
41 + return $instance;
42 + }
43 +
44 + /**
45 + * Define the plugin constants
46 + */
47 + private function define_constants() {
48 + define( 'ABLOCKS_VERSION', '2.13.0' );
49 + define( 'ABLOCKS_PLUGIN_SLUG', 'ablocks' );
50 + define( 'ABLOCKS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
51 + define( 'ABLOCKS_ROOT_URL', plugin_dir_url( __FILE__ ) );
52 + define( 'ABLOCKS_ASSETS_URL', ABLOCKS_ROOT_URL . 'assets/' );
53 + define( 'ABLOCKS_ROOT_DIR_PATH', plugin_dir_path( __FILE__ ) );
54 + define( 'ABLOCKS_ASSETS_PATH', ABLOCKS_ROOT_DIR_PATH . 'assets/' );
55 + define( 'ABLOCKS_INCLUDES_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'includes/' );
56 + define( 'ABLOCKS_BLOCKS_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'includes/blocks/' );
57 + define( 'ABLOCKS_ADDONS_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'addons/' );
58 + define( 'ABLOCKS_BLOCKS_VISIBILITY_SETTINGS_NAME', 'ablocks_blocks' );
59 + define( 'ABLOCKS_FONTS_SETTINGS_NAME', 'ablocks_fonts' );
60 + define( 'ABLOCKS_REST_NAMESPACE', 'ablocks/v1' );
61 + define( 'ABLOCKS_SETTINGS_NAME', 'ablocks_settings' );
62 + define( 'ABLOCKS_FRONTEND_DASHBOARD_SUB_PAGES_SETTINGS_NAME', 'ablocks_frontend_dashboard_sub_pages' );
63 + define( 'ABLOCKS_ADDONS_SETTINGS_NAME', 'ablocks_addons' );
64 + define( 'ABLOCKS_TEMPLATE_LIB_HOST', 'template-kits.com' );
65 + }
66 +
67 + public function load_dependency() {
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 + }
89 + }
90 + public function load_cli() {
91 + if ( file_exists( ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php' ) ) {
92 + require_once ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php';
93 + }
94 + }
95 +
96 + public function set_global_settings() {
97 + $GLOBALS['ablocks_fonts'] = json_decode( get_option( ABLOCKS_FONTS_SETTINGS_NAME, '{}' ), true );
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 + );
106 + $GLOBALS['ablocks_settings'] = json_decode( get_option( ABLOCKS_SETTINGS_NAME, '{}' ) );
107 + $GLOBALS['ablocks_addons'] = json_decode( get_option( ABLOCKS_ADDONS_SETTINGS_NAME, '{}' ) );
108 + }
109 +
110 + /**
111 + * When WP has loaded all plugins, trigger the `ablocks_loaded` hook.
112 + *
113 + * This ensures `ablocks_loaded` is called only after all other plugins
114 + * are loaded, to avoid issues caused by plugin directory naming changing
115 + *
116 + * @since 1.0.0
117 + */
118 + public function on_plugins_loaded() {
119 + do_action( 'ablocks_loaded' );
120 + }
121 +
122 + public function init_plugin() {
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();
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();
136 + ABlocks\Blocks::init();
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();
153 + ABlocks\Ajax::init();
154 + ABlocks\API::init();
155 + if ( is_admin() ) {
156 + ABlocks\Admin::init();
157 + }
158 + ABlocks\Frontend::init();
159 +
160 + }
161 +
162 + public function activate() {
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();
175 + }
176 +}
177 +
178 +/**
179 + * Kickoff
180 +*/
181 +
182 +ABlocks::init();
183 +
184 +