PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.1
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.1
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
ablocks / ablocks.php

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

114 lines 3.4 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: 1.9.1
8 * Author: Academy LMS
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', '1.9.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_SETTINGS_NAME', 'ablocks_settings' );
57 define( 'ABLOCKS_ADDONS_SETTINGS_NAME', 'ablocks_addons' );
58 define( 'ABLOCKS_TEMPLATE_LIB_HOST', 'template-kits.com' );
59 }
60
61 public function load_dependency() {
62 require_once ABLOCKS_INCLUDES_DIR_PATH . 'autoload.php';
63 }
64 public function load_cli() {
65 if ( file_exists( ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php' ) ) {
66 require_once ABLOCKS_ROOT_DIR_PATH . 'dev-cli.php';
67 }
68 }
69
70 public function set_global_settings() {
71 $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, '{}' ) );
73 $GLOBALS['ablocks_settings'] = json_decode( get_option( ABLOCKS_SETTINGS_NAME, '{}' ) );
74 $GLOBALS['ablocks_addons'] = json_decode( get_option( ABLOCKS_ADDONS_SETTINGS_NAME, '{}' ) );
75 }
76
77 /**
78 * When WP has loaded all plugins, trigger the `ablocks_loaded` hook.
79 *
80 * This ensures `ablocks_loaded` is called only after all other plugins
81 * are loaded, to avoid issues caused by plugin directory naming changing
82 *
83 * @since 1.0.0
84 */
85 public function on_plugins_loaded() {
86 do_action( 'ablocks_loaded' );
87 }
88
89 public function init_plugin() {
90 ABlocks\Migration::init();
91 ABlocks\Addons::init();
92 ABlocks\Blocks::init();
93 ABlocks\Assets::init();
94 ABlocks\Ajax::init();
95 if ( is_admin() ) {
96 ABlocks\Admin::init();
97 }
98 ABlocks\Frontend::init();
99
100 }
101
102 public function activate() {
103 ABlocks\Installer::init();
104 }
105 }
106
107 /**
108 * Kickoff
109 */
110
111 ABlocks::init();
112
113
114