| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Themebeez Toolkit |
| 4 |
* Plugin URI: https://wordpress.org/plugins/themebeez-toolkit/ |
| 5 |
* Description: A essential toolkit for themes made by www.themebeez.com. This plugin extends themes made by themebeez & adds functionality to import demo data in just a click. |
| 6 |
* Version: 1.3.2 |
| 7 |
* Requires at least: 5.6 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Tested up to: 6.7.1 |
| 10 |
* Author: themebeez |
| 11 |
* Author URI: https://themebeez.com |
| 12 |
* License: GPL-2.0+ |
| 13 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 14 |
* Text Domain: themebeez-toolkit |
| 15 |
* Domain Path: /languages |
| 16 |
* |
| 17 |
* @package Themebeez_Toolkit |
| 18 |
*/ |
| 19 |
|
| 20 |
// If this file is called directly, abort. |
| 21 |
if ( ! defined( 'WPINC' ) ) { |
| 22 |
die; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Currently plugin version. |
| 27 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 28 |
* Rename this for your plugin and update it as you release new versions. |
| 29 |
*/ |
| 30 |
define( 'THEMEBEEZTOOLKIT_VERSION', '1.3.2' ); |
| 31 |
|
| 32 |
// Define THEMEBEEZTOOLKIT_PLUGIN_FILE. |
| 33 |
if ( ! defined( 'THEMEBEEZTOOLKIT_PLUGIN_FILE' ) ) { |
| 34 |
define( 'THEMEBEEZTOOLKIT_PLUGIN_FILE', __FILE__ ); |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
if ( ! defined( 'THEMEBEEZ_TOOLKIT_THEME_PATH' ) ) { |
| 39 |
define( 'THEMEBEEZ_TOOLKIT_THEME_PATH', get_parent_theme_file_path() ); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* The code that runs during plugin activation. |
| 44 |
* This action is documented in includes/class-themebeez-toolkit-activator.php |
| 45 |
*/ |
| 46 |
function activate_themebeez_toolkit() { |
| 47 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-themebeez-toolkit-activator.php'; |
| 48 |
Themebeez_Toolkit_Activator::activate(); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* The code that runs during plugin deactivation. |
| 53 |
* This action is documented in includes/class-themebeez-toolkit-deactivator.php |
| 54 |
*/ |
| 55 |
function deactivate_themebeez_toolkit() { |
| 56 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-themebeez-toolkit-deactivator.php'; |
| 57 |
Themebeez_Toolkit_Deactivator::deactivate(); |
| 58 |
} |
| 59 |
|
| 60 |
register_activation_hook( __FILE__, 'activate_themebeez_toolkit' ); |
| 61 |
register_deactivation_hook( __FILE__, 'deactivate_themebeez_toolkit' ); |
| 62 |
|
| 63 |
/** |
| 64 |
* The core plugin class that is used to define internationalization, |
| 65 |
* admin-specific hooks, and public-facing site hooks. |
| 66 |
*/ |
| 67 |
require plugin_dir_path( __FILE__ ) . 'includes/class-themebeez-toolkit.php'; |
| 68 |
|
| 69 |
/** |
| 70 |
* Begins execution of the plugin. |
| 71 |
* |
| 72 |
* Since everything within the plugin is registered via hooks, |
| 73 |
* then kicking off the plugin from this point in the file does |
| 74 |
* not affect the page life cycle. |
| 75 |
* |
| 76 |
* @since 1.0.0 |
| 77 |
*/ |
| 78 |
function run_themebeez_toolkit() { |
| 79 |
|
| 80 |
$plugin = new Themebeez_Toolkit(); |
| 81 |
$plugin->run(); |
| 82 |
} |
| 83 |
run_themebeez_toolkit(); |
| 84 |
|
| 85 |
|
| 86 |
// Include the main Demo Importer class. |
| 87 |
if ( ! class_exists( 'Themebeez_Demo_Importer' ) ) { |
| 88 |
include_once __DIR__ . '/includes/demo-importer/class-themebeez-demo-importer.php'; |
| 89 |
} |
| 90 |
|
| 91 |
/** |
| 92 |
* Main instance of Themebeez_Demo_Importer. |
| 93 |
* |
| 94 |
* Returns the main instance of TET to prevent the need to use globals. |
| 95 |
* |
| 96 |
* @since 1.0.0 |
| 97 |
* @return Themebeez_Demo_Importer |
| 98 |
*/ |
| 99 |
function themebeez_demo_importer_init() { |
| 100 |
|
| 101 |
return Themebeez_Demo_Importer::instance(); |
| 102 |
} |
| 103 |
|
| 104 |
$theme = themebeez_toolkit_theme(); |
| 105 |
|
| 106 |
$themes = themebeez_toolkit_theme_array(); |
| 107 |
|
| 108 |
if ( $theme->get( 'Author' ) === 'themebeez' && in_array( $theme->get( 'TextDomain' ), $themes, true ) ) { |
| 109 |
|
| 110 |
// Global for backwards compatibility. |
| 111 |
$GLOBALS['themebeez-demo-importer'] = themebeez_demo_importer_init(); |
| 112 |
} |
| 113 |
|