PluginProbe
Spectra Blocks – AI Website Builder for the Block Editor / 1.0.7
Spectra Blocks – AI Website Builder for the Block Editor v1.0.7
1.0.7 1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.9 1.0.0
spectra-blocks / spectra-blocks.php

spectra-blocks.php in Spectra Blocks – AI Website Builder for the Block Editor 1.0.7, at spectra-blocks.php

81 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Spectra Blocks
4 * Plugin URI: https://wpspectra.com
5 * Author: Brainstorm Force
6 * Author URI: https://www.brainstormforce.com
7 * Version: 1.0.7
8 * Description: A fresh, clean Gutenberg block plugin built on Spectra V3 with modern standards.
9 * Text Domain: spectra-blocks
10 * Domain Path: /languages
11 * Requires PHP: 8.1
12 * Requires at least: 6.6
13 * Tested up to: 7.1
14 * License: GPL-2.0-or-later
15 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
16 *
17 * @package SpectraBlocks
18 */
19
20 defined( 'ABSPATH' ) || exit;
21
22 // Plugin constants.
23 define( 'SPECTRA_BLOCKS_FILE', __FILE__ );
24 define( 'SPECTRA_BLOCKS_DIR', plugin_dir_path( SPECTRA_BLOCKS_FILE ) );
25 define( 'SPECTRA_BLOCKS_URL', plugins_url( '/', SPECTRA_BLOCKS_FILE ) );
26 define( 'SPECTRA_BLOCKS_VER', '1.0.7' );
27 define( 'SPECTRA_BLOCKS_SLUG', 'spectra-blocks' );
28 define( 'SPECTRA_BLOCKS_ZIP_AI_PLUGIN_SLUG', 'zip-ai' );
29 define( 'SPECTRA_BLOCKS_ZIP_AI_PLUGIN_FILE', 'zip-ai/zip-ai.php' );
30 define( 'SPECTRA_BLOCKS_ZIP_AI_PLUGIN_URL', 'https://downloads.wordpress.org/plugin/zip-ai.zip' );
31 define( 'SPECTRA_BLOCKS_ZIPWP_MIDDLEWARE', 'https://app.zipwp.com/auth/' );
32 define( 'SPECTRA_BLOCKS_ZIPWP_CREDIT_SERVER', 'https://credits.startertemplates.com/api/' );
33
34 // PHP version check.
35 if ( ! version_compare( PHP_VERSION, '8.1', '>=' ) ) {
36 add_action( 'admin_notices', 'spectra_blocks_fail_php_version' );
37 return;
38 }
39
40 // WP version check.
41 if ( ! version_compare( get_bloginfo( 'version' ), '6.6', '>=' ) ) {
42 add_action( 'admin_notices', 'spectra_blocks_fail_wp_version' );
43 return;
44 }
45
46 // Conflict guard: UAGB's spectra-v3 (spectra-3-base branch) registers the same
47 // Spectra\ PHP namespace and block names. Running both simultaneously causes
48 // duplicate block registration fatal errors. Show an admin notice instead.
49 if ( defined( 'SPECTRA_3_FILE' ) ) {
50 add_action( 'admin_notices', 'spectra_blocks_fail_uagb_conflict' );
51 return;
52 }
53
54 require_once SPECTRA_BLOCKS_DIR . 'classes/class-spectra-blocks-loader.php';
55
56 /**
57 * Admin notice: PHP version too low.
58 */
59 function spectra_blocks_fail_php_version() {
60 /* translators: %s: PHP version */
61 $message = sprintf( esc_html__( 'Spectra Blocks requires PHP version %s+. The plugin is currently NOT RUNNING.', 'spectra-blocks' ), '8.1' );
62 printf( '<div class="notice notice-error"><p>%s</p></div>', wp_kses_post( wpautop( $message ) ) );
63 }
64
65 /**
66 * Admin notice: WP version too low.
67 */
68 function spectra_blocks_fail_wp_version() {
69 /* translators: %s: WordPress version */
70 $message = sprintf( esc_html__( 'Spectra Blocks requires WordPress version %s+. The plugin is currently NOT RUNNING.', 'spectra-blocks' ), '6.6' );
71 printf( '<div class="notice notice-error"><p>%s</p></div>', wp_kses_post( wpautop( $message ) ) );
72 }
73
74 /**
75 * Admin notice: conflict with UAGB spectra-v3.
76 */
77 function spectra_blocks_fail_uagb_conflict() {
78 $message = esc_html__( 'Spectra Blocks cannot run alongside the Spectra V3 blocks bundled in UAGB (spectra-3-base). Both plugins register the same PHP namespace and block names. Please deactivate one of them.', 'spectra-blocks' );
79 printf( '<div class="notice notice-error"><p>%s</p></div>', wp_kses_post( wpautop( $message ) ) );
80 }
81