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