blocksy-companion
Last commit date
framework
1 year ago
languages
1 year ago
static
1 year ago
vendor
1 year ago
LICENSE.txt
7 years ago
blocksy-companion.php
1 year ago
plugin.php
1 year ago
readme.txt
1 year ago
blocksy-companion.php
127 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | Plugin Name: Blocksy Companion |
| 5 | Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active. |
| 6 | Version: 2.0.91 |
| 7 | Author: CreativeThemes |
| 8 | Author URI: https://creativethemes.com |
| 9 | Text Domain: blocksy-companion |
| 10 | Domain Path: /languages/ |
| 11 | License: GPLv2 or later |
| 12 | License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 13 | Requires at least: 6.5 |
| 14 | Requires PHP: 7.0 |
| 15 | */ |
| 16 | if ( !defined( 'ABSPATH' ) ) { |
| 17 | exit; |
| 18 | // Exit if accessed directly. |
| 19 | } |
| 20 | register_activation_hook( __FILE__, function () { |
| 21 | if ( class_exists( '\\Blocksy\\Plugin' ) && !function_exists( 'blc_fs' ) ) { |
| 22 | $to_deactivate = plugin_basename( str_replace( '-pro/', '/', __FILE__ ) ); |
| 23 | if ( is_plugin_active( $to_deactivate ) ) { |
| 24 | deactivate_plugins( $to_deactivate ); |
| 25 | } |
| 26 | } |
| 27 | if ( isset( $_REQUEST['action'] ) && 'activate-selected' === $_REQUEST['action'] && isset( $_POST['checked'] ) && count( $_POST['checked'] ) > 1 ) { |
| 28 | return; |
| 29 | } |
| 30 | add_option( 'blc_activation_redirect', wp_get_current_user()->ID ); |
| 31 | } ); |
| 32 | if ( function_exists( 'blc_fs' ) || class_exists( '\\Blocksy\\Plugin' ) ) { |
| 33 | if ( function_exists( 'blc_fs' ) ) { |
| 34 | blc_fs()->set_basename( false, __FILE__ ); |
| 35 | } |
| 36 | } else { |
| 37 | if ( !function_exists( 'blc_fs' ) && file_exists( dirname( __FILE__ ) . '/freemius/start.php' ) && (is_admin() || wp_doing_cron() || defined( 'WP_CLI' ) && WP_CLI) ) { |
| 38 | global $blc_fs; |
| 39 | if ( !isset( $blc_fs ) ) { |
| 40 | if ( !defined( 'WP_FS__PRODUCT_5115_MULTISITE' ) ) { |
| 41 | define( 'WP_FS__PRODUCT_5115_MULTISITE', true ); |
| 42 | } |
| 43 | require_once dirname( __FILE__ ) . '/freemius/start.php'; |
| 44 | $has_account = true; |
| 45 | $instance = \Freemius::instance( 5115, 'blocksy-companion', true ); |
| 46 | $blocksy_active_extensions = get_option( 'blocksy_active_extensions', [] ); |
| 47 | if ( !is_array( $blocksy_active_extensions ) ) { |
| 48 | $blocksy_active_extensions = []; |
| 49 | } |
| 50 | if ( in_array( 'white-label', $blocksy_active_extensions ) && ($instance->is_plan( 'agency' ) || $instance->is_plan( 'agency_v2' )) ) { |
| 51 | $settings = apply_filters( 'blocksy:ext:white-label:settings', get_option( 'blocksy_ext_white_label_settings', [] ) ); |
| 52 | if ( $settings && isset( $settings['hide_billing_account'] ) && $settings['hide_billing_account'] && !is_multisite() ) { |
| 53 | $has_account = false; |
| 54 | } |
| 55 | } |
| 56 | $blc_fs = fs_dynamic_init( array( |
| 57 | 'id' => '5115', |
| 58 | 'slug' => 'blocksy-companion', |
| 59 | 'premium_slug' => 'blocksy-companion-pro', |
| 60 | 'type' => 'plugin', |
| 61 | 'public_key' => 'pk_b00a5cbae90b2e948015a7d0710f5', |
| 62 | 'premium_suffix' => 'PRO', |
| 63 | 'is_premium' => false, |
| 64 | 'has_addons' => false, |
| 65 | 'has_paid_plans' => true, |
| 66 | 'menu' => ( true ? [ |
| 67 | 'slug' => 'ct-dashboard', |
| 68 | 'support' => false, |
| 69 | 'contact' => false, |
| 70 | 'pricing' => false, |
| 71 | 'account' => $has_account, |
| 72 | ] : [ |
| 73 | 'support' => false, |
| 74 | 'contact' => false, |
| 75 | 'pricing' => false, |
| 76 | 'account' => false, |
| 77 | ] ), |
| 78 | 'is_live' => true, |
| 79 | ) ); |
| 80 | function blc_fs() { |
| 81 | global $blc_fs; |
| 82 | // if (! is_admin()) { |
| 83 | // throw new Error('Called in frontend!'); |
| 84 | // } |
| 85 | return $blc_fs; |
| 86 | } |
| 87 | |
| 88 | blc_fs(); |
| 89 | do_action( 'blc_fs_loaded' ); |
| 90 | } |
| 91 | } |
| 92 | define( 'BLOCKSY__FILE__', __FILE__ ); |
| 93 | define( 'BLOCKSY_PLUGIN_BASE', plugin_basename( BLOCKSY__FILE__ ) ); |
| 94 | define( 'BLOCKSY_PATH', plugin_dir_path( BLOCKSY__FILE__ ) ); |
| 95 | define( 'BLOCKSY_URL', plugin_dir_url( BLOCKSY__FILE__ ) ); |
| 96 | if ( !version_compare( PHP_VERSION, '7.0', '>=' ) ) { |
| 97 | add_action( 'admin_notices', 'blc_fail_php_version' ); |
| 98 | } elseif ( !version_compare( get_bloginfo( 'version' ), '5.0', '>=' ) ) { |
| 99 | add_action( 'admin_notices', 'blc_fail_wp_version' ); |
| 100 | } else { |
| 101 | require BLOCKSY_PATH . 'plugin.php'; |
| 102 | } |
| 103 | /** |
| 104 | * Blocksy admin notice for minimum PHP version. |
| 105 | * |
| 106 | * Warning when the site doesn't have the minimum required PHP version. |
| 107 | */ |
| 108 | function blc_fail_php_version() { |
| 109 | /* translators: %s: PHP version */ |
| 110 | $message = sprintf( esc_html__( 'Blocksy requires PHP version %s+, plugin is currently NOT RUNNING.', 'blocksy-companion' ), '7.0' ); |
| 111 | $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); |
| 112 | echo wp_kses_post( $html_message ); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Blocksy admin notice for minimum WordPress version. |
| 117 | * |
| 118 | * Warning when the site doesn't have the minimum required WordPress version. |
| 119 | */ |
| 120 | function blc_fail_wp_version() { |
| 121 | /* translators: %s: WordPress version */ |
| 122 | $message = sprintf( esc_html__( 'Blocksy requires WordPress version %s+. Because you are using an earlier version, the plugin is currently NOT RUNNING.', 'blocksy-companion' ), '5.0' ); |
| 123 | $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); |
| 124 | echo wp_kses_post( $html_message ); |
| 125 | } |
| 126 | |
| 127 | } |