PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.8.1
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.8.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 1.2.0 1.2.1 All 78 releases
ablocks / ablocks.php

ablocks.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.8.1, at ablocks.php

118 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.3
6 * Requires PHP: 7.4
7 * Version: 2.8.1
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 $this->load_cli();
26 register_activation_hook( __FILE__, [ $this, 'activate' ] );
27 $this->set_global_settings();
28 add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ] );
29 add_action( 'ablocks_loaded', [ $this, 'init_plugin' ] );
30 }
31
32 public static function init() {
33 static $instance = false;
34 if ( ! $instance ) {
35 $instance = new self();
36 }
37 return $instance;
38 }
39
40 /**
41 * Define the plugin constants
42 */
43 private function define_constants() {
44 define( 'ABLOCKS_VERSION', '2.8.1' );
45 define( 'ABLOCKS_PLUGIN_SLUG', 'ablocks' );
46 define( 'ABLOCKS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
47 define( 'ABLOCKS_ROOT_URL', plugin_dir_url( __FILE__ ) );
48 define( 'ABLOCKS_ASSETS_URL', ABLOCKS_ROOT_URL . 'assets/' );
49 define( 'ABLOCKS_ROOT_DIR_PATH', plugin_dir_path( __FILE__ ) );
50 define( 'ABLOCKS_ASSETS_PATH', ABLOCKS_ROOT_DIR_PATH . 'assets/' );
51 define( 'ABLOCKS_INCLUDES_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'includes/' );
52 define( 'ABLOCKS_BLOCKS_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'includes/blocks/' );
53 define( 'ABLOCKS_ADDONS_DIR_PATH', ABLOCKS_ROOT_DIR_PATH . 'addons/' );
54 define( 'ABLOCKS_BLOCKS_VISIBILITY_SETTINGS_NAME', 'ablocks_blocks' );
55 define( 'ABLOCKS_FONTS_SETTINGS_NAME', 'ablocks_fonts' );
56 define( 'ABLOCKS_REST_NAMESPACE', 'ablocks/v1' );
57 define( 'ABLOCKS_SETTINGS_NAME', 'ablocks_settings' );
58 define( 'ABLOCKS_FRONTEND_DASHBOARD_SUB_PAGES_SETTINGS_NAME', 'ablocks_frontend_dashboard_sub_pages' );
59 define( 'ABLOCKS_ADDONS_SETTINGS_NAME', 'ablocks_addons' );
60 define( 'ABLOCKS_TEMPLATE_LIB_HOST', 'template-kits.com' );
61 }
62
63 public function load_dependency() {
64 require_once ABLOCKS_INCLUDES_DIR_PATH . 'autoload.php';
65 }
66 public function load_cli() {
67 if ( file_exists( ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php' ) ) {
68 require_once ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php';
69 }
70 }
71
72 public function set_global_settings() {
73 $GLOBALS['ablocks_fonts'] = json_decode( get_option( ABLOCKS_FONTS_SETTINGS_NAME, '{}' ), true );
74 $GLOBALS['ablocks_blocks'] = json_decode( get_option( ABLOCKS_BLOCKS_VISIBILITY_SETTINGS_NAME, '{}' ) );
75 $GLOBALS['ablocks_settings'] = json_decode( get_option( ABLOCKS_SETTINGS_NAME, '{}' ) );
76 $GLOBALS['ablocks_addons'] = json_decode( get_option( ABLOCKS_ADDONS_SETTINGS_NAME, '{}' ) );
77 }
78
79 /**
80 * When WP has loaded all plugins, trigger the `ablocks_loaded` hook.
81 *
82 * This ensures `ablocks_loaded` is called only after all other plugins
83 * are loaded, to avoid issues caused by plugin directory naming changing
84 *
85 * @since 1.0.0
86 */
87 public function on_plugins_loaded() {
88 do_action( 'ablocks_loaded' );
89 }
90
91 public function init_plugin() {
92 ABlocks\Migration::init();
93 ABlocks\PermalinkRewrite::init();
94 ABlocks\Addons::init();
95 ABlocks\Blocks::init();
96 ABlocks\Assets::init();
97 ABlocks\Ajax::init();
98 ABlocks\API::init();
99 if ( is_admin() ) {
100 ABlocks\Admin::init();
101 }
102 ABlocks\Frontend::init();
103
104 }
105
106 public function activate() {
107 ABlocks\Installer::init();
108 }
109 }
110
111 /**
112 * Kickoff
113 */
114
115 ABlocks::init();
116
117
118