| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Xpro Elementor Theme Builder |
| 4 |
* Plugin URI: https://elementor.wpxpro.com/theme-builder/ |
| 5 |
* Description: Free Theme Builder for Elementor with 50+ widgets. Now create theme parts like header, footer, singular, archive, woocommerce stores & more. |
| 6 |
* Author: Xpro |
| 7 |
* Author URI: https://www.wpxpro.com/ |
| 8 |
* Version: 1.2.12 |
| 9 |
* Developer: Xpro Team |
| 10 |
* Text Domain: xpro-theme-builder |
| 11 |
* Elementor tested up to: 4.1.4 |
| 12 |
* License: GPLv2 |
| 13 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 14 |
* |
| 15 |
* @package xpro-theme-builder |
| 16 |
*/ |
| 17 |
|
| 18 |
define( 'XPRO_THEME_BUILDER_VER', '1.2.12' ); |
| 19 |
define( 'XPRO_THEME_BUILDER_FILE', __FILE__ ); |
| 20 |
define( 'XPRO_THEME_BUILDER_BASE', plugin_basename( __FILE__ ) ); |
| 21 |
define( 'XPRO_THEME_BUILDER_DIR', plugin_dir_path( XPRO_THEME_BUILDER_FILE ) ); |
| 22 |
define( 'XPRO_THEME_BUILDER_URL', plugins_url( '/', __FILE__ ) ); |
| 23 |
|
| 24 |
|
| 25 |
final class Xpro_Theme_Builder { |
| 26 |
|
| 27 |
/** |
| 28 |
* Constructor |
| 29 |
* |
| 30 |
* @since 1.0.0 |
| 31 |
* @access public |
| 32 |
*/ |
| 33 |
public function __construct() { |
| 34 |
|
| 35 |
// Load translation |
| 36 |
add_action( 'init', array( $this, 'i18n' ) ); |
| 37 |
|
| 38 |
// Init Plugin |
| 39 |
add_action( 'plugins_loaded', array( $this, 'init' ) ); |
| 40 |
|
| 41 |
//Fires when Xpro Theme Builder was fully loaded |
| 42 |
do_action( 'xpro_theme_builder_loaded' ); |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Load Textdomain |
| 48 |
* |
| 49 |
* Load plugin localization files. |
| 50 |
* Fired by `init` action hook. |
| 51 |
* |
| 52 |
* @since 1.0.0 |
| 53 |
* @access public |
| 54 |
*/ |
| 55 |
public function i18n() { |
| 56 |
load_plugin_textdomain( |
| 57 |
'xpro-theme-builder', |
| 58 |
false, |
| 59 |
dirname( plugin_basename( XPRO_THEME_BUILDER_FILE ) ) . '/language/' |
| 60 |
); |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Initialize the plugin |
| 65 |
* |
| 66 |
* Validates that Elementor is already loaded. |
| 67 |
* Checks for basic plugin requirements, if one check fail don't continue, |
| 68 |
* if all check have passed include the plugin class. |
| 69 |
* |
| 70 |
* Fired by `plugins_loaded` action hook. |
| 71 |
* |
| 72 |
* @since 1.0.0 |
| 73 |
* @access public |
| 74 |
*/ |
| 75 |
public function init() { |
| 76 |
|
| 77 |
// Check if Xpro Elementor Addons installed and activated |
| 78 |
if ( ! did_action( 'xpro_elementor_addons_loaded' ) ) { |
| 79 |
add_action( 'admin_notices', array( $this, 'admin_notice_missing_xpro_elementor_addons' ) ); |
| 80 |
return; |
| 81 |
} |
| 82 |
|
| 83 |
// Once we get here, We have passed all validation checks so we can safely include our plugin |
| 84 |
require_once plugin_dir_path( __FILE__ ) . 'plugin.php'; |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* Admin notice |
| 90 |
* |
| 91 |
* Warning when the site doesn't have Elementor installed or activated. |
| 92 |
* |
| 93 |
* @since 1.0.0 |
| 94 |
* @access public |
| 95 |
*/ |
| 96 |
public function admin_notice_missing_xpro_elementor_addons() { |
| 97 |
|
| 98 |
if ( isset( $_GET['activate'] ) ) { |
| 99 |
unset( $_GET['activate'] ); |
| 100 |
} |
| 101 |
|
| 102 |
$screen = get_current_screen(); |
| 103 |
|
| 104 |
if ( 'plugins' === $screen->base ) { |
| 105 |
if ( file_exists( WP_PLUGIN_DIR . '/xpro-elementor-addons/xpro-elementor-addons.php' ) ) { |
| 106 |
$message = sprintf( |
| 107 |
/* translators: 1: Plugin name 2: URL */ |
| 108 |
esc_html__( '"%1$s" requires "%2$s" to be activated. %3$s', 'xpro-theme-builder' ), |
| 109 |
'<strong>' . esc_html__( 'Xpro Elementor Theme Builder', 'xpro-theme-builder' ) . '</strong>', |
| 110 |
'<strong>' . esc_html__( 'Xpro Elementor Addons', 'xpro-theme-builder' ) . '</strong>', |
| 111 |
'<p><a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=xpro-elementor-addons/xpro-elementor-addons.php', 'activate-plugin_xpro-elementor-addons/xpro-elementor-addons.php' ) . '" class="button-primary">' . esc_html__( 'Activate', 'xpro-theme-builder' ) . '</a></p>' |
| 112 |
); |
| 113 |
} else { |
| 114 |
$message = sprintf( |
| 115 |
/* translators: 1: Plugin name 2: URL */ |
| 116 |
esc_html__( '"%1$s" requires "%2$s" to be installed. %3$s', 'xpro-theme-builder' ), |
| 117 |
'<strong>' . esc_html__( 'Xpro Elementor Theme Builder', 'xpro-theme-builder' ) . '</strong>', |
| 118 |
'<strong>' . esc_html__( 'Xpro Elementor Addons', 'xpro-theme-builder' ) . '</strong>', |
| 119 |
'<p><a href="' . wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=xpro-elementor-addons' ), 'install-plugin_xpro-elementor-addons' ) . '" class="button-primary">' . esc_html__( 'Install', 'xpro-theme-builder' ) . '</a></p>' |
| 120 |
); |
| 121 |
} |
| 122 |
|
| 123 |
printf( '<div class="notice notice-warning"><p>%1$s</p></div>', $message ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 124 |
|
| 125 |
} |
| 126 |
} |
| 127 |
|
| 128 |
} |
| 129 |
|
| 130 |
// Instantiate Xpro_Theme_Builder. |
| 131 |
new Xpro_Theme_Builder(); |
| 132 |
|