| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Gutenify - Visual Site Builder Blocks & Site Templates |
| 4 |
* Description: Gutenify - Visual Site Builder Blocks & Site Templates is a collection of Gutenberg Advance Fullsite Editing Blocks & site templates that is compatible with WordPress Full Site Editing to help you create the website you always wanted. |
| 5 |
* Author: Gutenify |
| 6 |
* Author URI: https://www.gutenify.com |
| 7 |
* Plugin URI: https://www.gutenify.com |
| 8 |
* Version: 1.6.1 |
| 9 |
* Text Domain: gutenify |
| 10 |
* Domain Path: /languages |
| 11 |
* Tested up to: 6.8 |
| 12 |
* Requires at least: 6.4 |
| 13 |
* Requires PHP: 5.5 |
| 14 |
* |
| 15 |
* Gutenify is free software: you can redistribute it and/or modify |
| 16 |
* it under the terms of the GNU General Public License as published by |
| 17 |
* the Free Software Foundation, either version 2 of the License, or |
| 18 |
* any later version. |
| 19 |
* |
| 20 |
* You should have received a copy of the GNU General Public License |
| 21 |
* along with Gutenify. If not, see <http://www.gnu.org/licenses/>. |
| 22 |
* |
| 23 |
* @package Gutenify |
| 24 |
*/ |
| 25 |
|
| 26 |
// Exit if accessed directly. |
| 27 |
defined( 'ABSPATH' ) || exit; |
| 28 |
|
| 29 |
// Define constants. |
| 30 |
define( 'GUTENIFY_VERSION', '1.6.1' ); |
| 31 |
define( 'GUTENIFY_BASE_DIR', plugin_dir_path( __FILE__ ) ); |
| 32 |
define( 'GUTENIFY_BASE_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) ); |
| 33 |
define( 'GUTENIFY_BASE_FILE', __FILE__ ); |
| 34 |
define( |
| 35 |
'GUTENIFY_BRAND_LOGO', |
| 36 |
'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDEwODAgMTA4MCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTA4MCAxMDgwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KICAuc3QwIHsNCiAgICBmaWxsOiAjRkZGRkZGOw0KICB9DQoNCiAgLnN0MSB7DQogICAgZmlsbDogIzY3QkM0NTsNCiAgfQ0KDQo8L3N0eWxlPg0KPGc+DQogIDxnPg0KICAgIDxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04MjguNSw1NTIuOWMtNi44LDE1Mi45LTEzMy4zLDI3NS4xLTI4Ny45LDI3NS4xYy0xNTguOSwwLTI4OC4yLTEyOS4zLTI4OC4yLTI4OC4yDQoJCSAgICAgIGMwLTE1MC42LDExNi4yLTI3NC41LDI2My41LTI4Ny4xVjAuNEMyMjkuMSwxMy4yLDAuNSwyNDkuOSwwLjUsNTM5LjljMCwyOTguMiwyNDEuNyw1NDAuMSw1NDAuMSw1NDAuMQ0KCQkgICAgICBjMjkzLjksMCw1MzMtMjM0LjgsNTM5LjgtNTI3SDgyOC41VjU1Mi45eiIgLz4NCiAgICA8cmVjdCB4PSI1MTguOSIgeT0iMjU0LjYiIGNsYXNzPSJzdDEiIHdpZHRoPSIzMDkuOCIgaGVpZ2h0PSIyOTguMiIgLz4NCiAgPC9nPg0KPC9nPg0KPC9zdmc+DQo=' |
| 37 |
); |
| 38 |
|
| 39 |
if ( ! class_exists( 'Gutenify' ) ) { |
| 40 |
|
| 41 |
final class Gutenify { |
| 42 |
|
| 43 |
/** |
| 44 |
* Holds the class instance. |
| 45 |
* |
| 46 |
* @var Gutenify |
| 47 |
*/ |
| 48 |
private static $instance = null; |
| 49 |
|
| 50 |
/** |
| 51 |
* Plugin base URL. |
| 52 |
* |
| 53 |
* @var string |
| 54 |
*/ |
| 55 |
private static $base_url = ''; |
| 56 |
|
| 57 |
/** |
| 58 |
* Get the singleton instance. |
| 59 |
* |
| 60 |
* @return Gutenify |
| 61 |
*/ |
| 62 |
public static function instance() { |
| 63 |
if ( is_null( self::$instance ) ) { |
| 64 |
self::$instance = new self(); |
| 65 |
} |
| 66 |
return self::$instance; |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* Gutenify constructor. |
| 71 |
*/ |
| 72 |
private function __construct() { |
| 73 |
self::$base_url = GUTENIFY_BASE_URL; |
| 74 |
$this->define_hooks(); |
| 75 |
$this->bootstrap(); |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Define plugin hooks. |
| 80 |
*/ |
| 81 |
private function define_hooks() { |
| 82 |
add_filter( 'gutenify_plugin_constants', array( $this, 'add_plugin_constants' ) ); |
| 83 |
// Uncomment if you want activation redirect. |
| 84 |
// add_action( 'activated_plugin', array( $this, 'activation_redirect' ) ); |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Provide plugin constants merged with args. |
| 89 |
* |
| 90 |
* @param array $args |
| 91 |
* @return array |
| 92 |
*/ |
| 93 |
public function add_plugin_constants( $args ) { |
| 94 |
return wp_parse_args( $args, $this->get_constants() ); |
| 95 |
} |
| 96 |
|
| 97 |
/** |
| 98 |
* Get all plugin constants as array. |
| 99 |
* |
| 100 |
* @return array |
| 101 |
*/ |
| 102 |
public function get_constants() { |
| 103 |
$title = 'Gutenify'; |
| 104 |
return array( |
| 105 |
'title' => $title, |
| 106 |
'prefix' => 'gutenify', |
| 107 |
'slug' => 'gutenify', |
| 108 |
'authorWebSite' => 'https://gutenify.com', |
| 109 |
'authorDemoWebSite' => 'https://demo.gutenify.com', |
| 110 |
'authorWebSiteProPage' => 'https://gutenify.com/pricing', |
| 111 |
'authorWebSiteSupport' => 'https://gutenify.com/product-support', |
| 112 |
'plugin_main_slug' => 'gutenify', |
| 113 |
'plugin_main_camel_case_name' => 'gutenify', |
| 114 |
'plugin_main_function_prefix' => 'gutenify', |
| 115 |
'plugin_main_base_url' => GUTENIFY_BASE_URL, |
| 116 |
'plugin_main_base_dir' => GUTENIFY_BASE_DIR, |
| 117 |
'plugin_main_version' => GUTENIFY_VERSION, |
| 118 |
'plugin_main_post_type_prefix' => 'gutenify', |
| 119 |
'plugin_main_site_domain' => 'gutenify.com', |
| 120 |
'core_base_dir' => GUTENIFY_BASE_DIR . 'core/', |
| 121 |
'core_base_url' => GUTENIFY_BASE_URL . 'core/', |
| 122 |
'brand_color' => '#2196f3', |
| 123 |
'pro_title' => $title . ' Pro', |
| 124 |
); |
| 125 |
} |
| 126 |
|
| 127 |
/** |
| 128 |
* Load bootstrap and pro if available. |
| 129 |
*/ |
| 130 |
private function bootstrap() { |
| 131 |
require_once GUTENIFY_BASE_DIR . 'core/inc/bootstrap.php'; |
| 132 |
if ( |
| 133 |
function_exists( 'gutenify_pro' ) |
| 134 |
&& defined( 'GUTENIFY_PRO_VERSION' ) |
| 135 |
&& version_compare( GUTENIFY_PRO_VERSION, '1.1.5', '>' ) |
| 136 |
) { |
| 137 |
gutenify_pro(); |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* Optionally redirect to Gutenify page on plugin activation. |
| 143 |
* |
| 144 |
* @param string $plugin Plugin basename. |
| 145 |
*/ |
| 146 |
public function activation_redirect( $plugin ) { |
| 147 |
if ( function_exists( 'get_current_screen' ) ) { |
| 148 |
$screen = get_current_screen(); |
| 149 |
if ( ! empty( $screen->id ) && 'appearance_page_tgmpa-install-plugins' === $screen->id ) { |
| 150 |
return false; |
| 151 |
} |
| 152 |
} |
| 153 |
if ( $plugin === plugin_basename( __FILE__ ) ) { |
| 154 |
wp_safe_redirect( admin_url( 'admin.php?page=gutenify' ) ); |
| 155 |
exit; |
| 156 |
} |
| 157 |
} |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 162 |
* Initialize the Gutenify plugin. |
| 163 |
*/ |
| 164 |
function gutenify() { |
| 165 |
return Gutenify::instance(); |
| 166 |
} |
| 167 |
|
| 168 |
// Initialize plugin immediately. |
| 169 |
gutenify(); |
| 170 |
|