PluginProbe
Otter Blocks – Gutenberg Blocks, Page Builder for Gutenberg Editor & FSE / 3.2.4
Otter Blocks – Gutenberg Blocks, Page Builder for Gutenberg Editor & FSE v3.2.4
3.2.4 3.2.3 3.2.2 3.2.1 3.2.0 3.1.11 3.1.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 All 139 releases
otter-blocks / otter-blocks.php

otter-blocks.php in Otter Blocks – Gutenberg Blocks, Page Builder for Gutenberg Editor & FSE 3.2.4, at otter-blocks.php

142 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main file.
4 *
5 * @package OtterBlocks
6 *
7 * Plugin Name: Otter – Page Builder Blocks & Extensions for Gutenberg
8 * Plugin URI: https://themeisle.com/plugins/otter-blocks
9 * Description: Create beautiful and attracting posts, pages, and landing pages with Otter – Page Builder Blocks & Extensions for Gutenberg. Otter comes with dozens of Gutenberg blocks that are all you need to build beautiful pages.
10 * Version: 3.2.4
11 * Author: ThemeIsle
12 * Author URI: https://themeisle.com
13 * Requires at least: 6.6
14 * License: GPL-2.0+
15 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
16 * Text Domain: otter-blocks
17 * Domain Path: /languages
18 * WordPress Available: yes
19 * Requires License: no
20 */
21
22 // If this file is called directly, abort.
23 if ( ! defined( 'WPINC' ) ) {
24 die;
25 }
26
27 define( 'OTTER_BLOCKS_BASEFILE', __FILE__ );
28 define( 'OTTER_BLOCKS_URL', plugins_url( '/', __FILE__ ) );
29 define( 'OTTER_BLOCKS_PATH', __DIR__ );
30 define( 'OTTER_BLOCKS_VERSION', '3.2.4' );
31 define( 'OTTER_BLOCKS_PRO_SUPPORT', true );
32 define( 'OTTER_BLOCKS_SHOW_NOTICES', false );
33 define( 'OTTER_PRODUCT_SLUG', basename( OTTER_BLOCKS_PATH ) );
34
35 $vendor_file = OTTER_BLOCKS_PATH . '/vendor/autoload.php';
36
37 if ( is_readable( $vendor_file ) ) {
38 require_once $vendor_file;
39 }
40
41 $loader_file = OTTER_BLOCKS_PATH . '/inc/class-loader.php';
42
43 $loader_available = class_exists( '\ThemeIsle\GutenbergBlocks\Loader', false );
44 if ( ! $loader_available ) {
45 if ( ! is_file( $loader_file ) ) {
46 error_log( '[Otter Blocks] Not starting: ' . $loader_file . ' is missing.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
47 } elseif ( ! is_readable( $loader_file ) ) {
48 error_log( '[Otter Blocks] Not starting: ' . $loader_file . ' is not readable.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
49 } else {
50 try {
51 require_once $loader_file;
52 $loader_available = class_exists( '\ThemeIsle\GutenbergBlocks\Loader', false );
53
54 if ( ! $loader_available ) {
55 error_log( '[Otter Blocks] Not starting: ' . $loader_file . ' does not declare ThemeIsle\GutenbergBlocks\Loader.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
56 }
57 } catch ( \Throwable $e ) {
58 error_log( '[Otter Blocks] Not starting: ' . $loader_file . ' failed to load: ' . $e->getMessage() . '.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
59 }
60 }
61 }
62
63 // Everything downstream runs from Main, so boot it through Loader's throwable boundary.
64 if ( $loader_available ) {
65 \ThemeIsle\GutenbergBlocks\Loader::boot_singleton( '\ThemeIsle\GutenbergBlocks\Main' );
66 }
67
68 add_filter(
69 'themeisle_sdk_products',
70 function ( $products ) {
71 $products[] = __FILE__;
72
73 return $products;
74 }
75 );
76
77 add_filter(
78 'otter_blocks_welcome_metadata',
79 function () {
80 return [
81 'is_enabled' => ! defined( 'OTTER_PRO_VERSION' ),
82 'pro_name' => __( 'Otter Blocks Pro', 'otter-blocks' ),
83 'logo' => OTTER_BLOCKS_URL . '/assets/images/logo-alt.png',
84 'cta_link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/plugins/otter-blocks/upgrade/?discount=LOYALUSER583&dvalue=60#pricing', 'otter-welcome', 'notice' ) ),
85 ];
86 }
87 );
88
89 add_filter(
90 'themeisle_sdk_compatibilities/' . basename( OTTER_BLOCKS_PATH ),
91 function ( $compatibilities ) {
92 $compatibilities['OtterBlocksPRO'] = array(
93 'basefile' => defined( 'OTTER_PRO_BASEFILE' ) ? OTTER_PRO_BASEFILE : '',
94 'required' => '2.0',
95 'tested_up' => OTTER_BLOCKS_VERSION,
96 );
97 return $compatibilities;
98 }
99 );
100
101 add_action(
102 'plugin_action_links_' . plugin_basename( __FILE__ ),
103 function ( $links ) {
104 array_unshift(
105 $links,
106 sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=otter' ), __( 'Settings', 'otter-blocks' ) )
107 );
108 return $links;
109 }
110 );
111
112 add_filter( 'themeisle_sdk_enable_telemetry', '__return_true' );
113
114 add_filter(
115 'themeisle_sdk_telemetry_products',
116 function ( $products ) {
117 $already_registered = false;
118
119 $license = apply_filters( 'product_otter_license_key', 'free' );
120 $track_hash = 'free' === $license ? 'free' : wp_hash( $license );
121
122 foreach ( $products as &$product ) {
123 if ( strstr( $product['slug'], 'otter' ) !== false ) {
124 $already_registered = true;
125 $product['trackHash'] = $track_hash;
126 }
127 }
128
129 if ( $already_registered ) {
130 return $products;
131 }
132
133 // Add Otter Blocks to the list of products to track the usage of AI Block.
134 $products[] = array(
135 'slug' => 'otter',
136 'consent' => false,
137 'trackHash' => $track_hash,
138 );
139 return $products;
140 }
141 );
142