| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * Plugin Name: PixTypes |
|---|
| 4 | * Plugin URI: https://wordpress.org/plugins/pixtypes/ |
|---|
| 5 | * Description: Theme-driven post types, taxonomies & custom fields. |
|---|
| 6 | * Version: 2.0.0 |
|---|
| 7 | * Author: Pixelgrade |
|---|
| 8 | * Author URI: https://pixelgrade.com |
|---|
| 9 | * Author Email: contact@pixelgrade.com |
|---|
| 10 | * Requires at least: 6.0 |
|---|
| 11 | * Tested up to: 6.7 |
|---|
| 12 | * Requires PHP: 7.4 |
|---|
| 13 | * Text Domain: pixtypes |
|---|
| 14 | * License: GPL-2.0 or later. |
|---|
| 15 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
|---|
| 16 | * Domain Path: /lang |
|---|
| 17 | */ |
|---|
| 18 | |
|---|
| 19 | // If this file is called directly, abort. |
|---|
| 20 | if ( ! defined( 'WPINC' ) ) { |
|---|
| 21 | die; |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | // ensure PIXTYPES_EXT is defined |
|---|
| 25 | if ( ! defined( 'PIXTYPES_EXT' ) ) { |
|---|
| 26 | define( 'PIXTYPES_EXT', '.php' ); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | require 'core/bootstrap' . PIXTYPES_EXT; |
|---|
| 30 | |
|---|
| 31 | $config = include 'plugin-config' . PIXTYPES_EXT; |
|---|
| 32 | // set textdomain |
|---|
| 33 | pixtypes::settextdomain( $config['textdomain'] ); |
|---|
| 34 | |
|---|
| 35 | // Ensure Test Data |
|---|
| 36 | // ---------------- |
|---|
| 37 | |
|---|
| 38 | $defaults = include 'plugin-defaults' . PIXTYPES_EXT; |
|---|
| 39 | |
|---|
| 40 | $current_data = get_option( $config['settings-key'] ); |
|---|
| 41 | |
|---|
| 42 | if ( $current_data === false ) { |
|---|
| 43 | add_option( $config['settings-key'], $defaults ); |
|---|
| 44 | } else if ( count( array_diff_key( $defaults, $current_data ) ) != 0 ) { |
|---|
| 45 | $plugindata = array_merge( $defaults, $current_data ); |
|---|
| 46 | update_option( $config['settings-key'], $plugindata ); |
|---|
| 47 | } |
|---|
| 48 | # else: data is available; do nothing |
|---|
| 49 | |
|---|
| 50 | // Load Callbacks |
|---|
| 51 | // -------------- |
|---|
| 52 | |
|---|
| 53 | $basepath = trailingslashit( dirname( __FILE__ ) ); |
|---|
| 54 | $callbackpath = trailingslashit( $basepath . 'callbacks' ); |
|---|
| 55 | pixtypes::require_all( $callbackpath ); |
|---|
| 56 | |
|---|
| 57 | require_once( plugin_dir_path( __FILE__ ) . 'class-pixtypes.php' ); |
|---|
| 58 | |
|---|
| 59 | // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. |
|---|
| 60 | register_activation_hook( __FILE__, array( 'PixTypesPlugin', 'activate' ) ); |
|---|
| 61 | //register_deactivation_hook( __FILE__, array( 'PixTypesPlugin', 'deactivate' ) ); |
|---|
| 62 | |
|---|
| 63 | global $pixtypes_plugin; |
|---|
| 64 | $pixtypes_plugin = PixTypesPlugin::get_instance( '2.0.0' ); |
|---|