pods
Last commit date
classes
18 hours ago
components
18 hours ago
deprecated
18 hours ago
includes
18 hours ago
sql
18 hours ago
src
18 hours ago
tribe-common
18 hours ago
ui
18 hours ago
.env.testing.tric
18 hours ago
changelog.txt
18 hours ago
codeception.tric.yml
18 hours ago
init.php
18 hours ago
license.txt
18 hours ago
readme.txt
18 hours ago
init.php
169 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Pods - Custom Content Types and Fields |
| 4 | * |
| 5 | * @package Pods |
| 6 | * @author Pods Framework Team |
| 7 | * @copyright 2023 Pods Foundation, Inc |
| 8 | * @license GPL v2 or later |
| 9 | * |
| 10 | * Plugin Name: Pods - Custom Content Types and Fields |
| 11 | * Plugin URI: https://pods.io/ |
| 12 | * Description: Pods is a framework for creating, managing, and deploying customized content types and fields |
| 13 | * Version: 2.8.23.5 |
| 14 | * Author: Pods Framework Team |
| 15 | * Author URI: https://pods.io/about/ |
| 16 | * Text Domain: pods |
| 17 | * License: GPL v2 or later |
| 18 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 19 | * Requires at least: 5.5 |
| 20 | * Requires PHP: 5.6 |
| 21 | * GitHub Plugin URI: https://github.com/pods-framework/pods |
| 22 | * Primary Branch: main |
| 23 | */ |
| 24 | |
| 25 | /* |
| 26 | * This program is free software: you can redistribute it and/or modify |
| 27 | * it under the terms of the GNU General Public License as published by |
| 28 | * the Free Software Foundation, either version 2 of the License, or |
| 29 | * any later version. |
| 30 | * |
| 31 | * This program is distributed in the hope that it will be useful, |
| 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 34 | * GNU General Public License for more details. |
| 35 | * |
| 36 | * You should have received a copy of the GNU General Public License |
| 37 | * along with this program. If not, see https://www.gnu.org/licenses/gpl-2.0.html. |
| 38 | */ |
| 39 | |
| 40 | if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) { |
| 41 | // Prevent conflicts with Pods 1.x and Pods UI plugins. |
| 42 | add_action( 'init', 'pods_deactivate_pods_duplicate' ); |
| 43 | add_action( 'init', 'pods_deactivate_pods_ui' ); |
| 44 | } else { |
| 45 | // Current version. |
| 46 | define( 'PODS_VERSION', '2.8.23.5' ); |
| 47 | |
| 48 | // Current database version, this is the last version we had a database migration added in the /sql/ directory. |
| 49 | define( 'PODS_DB_VERSION', '2.3.5' ); |
| 50 | |
| 51 | /** |
| 52 | * We aim to keep this as recent as possible to avoid ongoing React/Gutenberg compatibility problems. |
| 53 | * |
| 54 | * This should always be -2 versions behind the latest WP release. Example: 5.5 if 5.7 is current. |
| 55 | * |
| 56 | * To be updated each Major x.x Pods release. |
| 57 | */ |
| 58 | if ( ! defined( 'PODS_WP_VERSION_MINIMUM' ) ) { |
| 59 | define( 'PODS_WP_VERSION_MINIMUM', '5.5' ); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * This should match minimum WP requirements or usage of 90%+. |
| 64 | * |
| 65 | * Found at: https://wordpress.org/about/stats/ |
| 66 | * |
| 67 | * Next planned minimum PHP version: 7.2 (to match WooCommerce and others pushing WP forward). |
| 68 | */ |
| 69 | if ( ! defined( 'PODS_PHP_VERSION_MINIMUM' ) ) { |
| 70 | define( 'PODS_PHP_VERSION_MINIMUM', '5.6' ); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * This should match minimum WP requirements or usage of 90%+. |
| 75 | * |
| 76 | * Found at: https://wordpress.org/about/stats/ |
| 77 | */ |
| 78 | if ( ! defined( 'PODS_MYSQL_VERSION_MINIMUM' ) ) { |
| 79 | define( 'PODS_MYSQL_VERSION_MINIMUM', '5.5' ); |
| 80 | } |
| 81 | |
| 82 | define( 'PODS_FILE', __FILE__ ); |
| 83 | define( 'PODS_SLUG', plugin_basename( __FILE__ ) ); |
| 84 | define( 'PODS_URL', plugin_dir_url( __FILE__ ) ); |
| 85 | define( 'PODS_DIR', plugin_dir_path( __FILE__ ) ); |
| 86 | |
| 87 | // Prevent conflicts with old Pods UI plugin |
| 88 | if ( function_exists( 'pods_ui_manage' ) ) { |
| 89 | add_action( 'init', 'pods_deactivate_pods_ui' ); |
| 90 | } else { |
| 91 | global $pods, $pods_init, $pods_form; |
| 92 | |
| 93 | // Init custom autoloader. |
| 94 | require_once PODS_DIR . 'classes/PodsInit.php'; |
| 95 | |
| 96 | spl_autoload_register( array( 'PodsInit', 'autoload_class' ) ); |
| 97 | |
| 98 | // Include global functions. |
| 99 | require_once PODS_DIR . 'includes/access.php'; |
| 100 | require_once PODS_DIR . 'includes/classes.php'; |
| 101 | require_once PODS_DIR . 'includes/data.php'; |
| 102 | require_once PODS_DIR . 'includes/forms.php'; |
| 103 | require_once PODS_DIR . 'includes/general.php'; |
| 104 | |
| 105 | // Maybe include media functions. |
| 106 | if ( ! defined( 'PODS_MEDIA' ) || PODS_MEDIA ) { |
| 107 | require_once PODS_DIR . 'includes/media.php'; |
| 108 | } |
| 109 | |
| 110 | // Maybe run full init. |
| 111 | if ( ! defined( 'SHORTINIT' ) || ! SHORTINIT ) { |
| 112 | // Maybe include deprecated classes / functions. |
| 113 | if ( pods_allow_deprecated() ) { |
| 114 | require_once PODS_DIR . 'deprecated/deprecated.php'; |
| 115 | } |
| 116 | |
| 117 | // Check if minimum required versions are met. |
| 118 | if ( false !== pods_compatibility_check() ) { |
| 119 | $pods_form = pods_form(); |
| 120 | |
| 121 | // If not on network admin, run full init. |
| 122 | if ( ! is_network_admin() ) { |
| 123 | $pods_init = pods_init(); |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Deactivate this version of Pods if Pods is already included. |
| 132 | * |
| 133 | * @since 2.8.0 |
| 134 | */ |
| 135 | function pods_deactivate_pods_duplicate() { |
| 136 | if ( defined( 'PODS_VERSION' ) && defined( 'PODS_DIR' ) && file_exists( untrailingslashit( PODS_DIR ) . '/init.php' ) ) { |
| 137 | if ( ! function_exists( 'deactivate_plugins' ) ) { |
| 138 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 139 | } |
| 140 | |
| 141 | deactivate_plugins( realpath( untrailingslashit( PODS_DIR ) . '/init.php' ) ); |
| 142 | |
| 143 | if ( ! headers_sent() && ( ! function_exists( 'pods_ui_manage' ) && ! file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) ) { |
| 144 | wp_redirect( $_SERVER['REQUEST_URI'] ); |
| 145 | die(); |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Deactivate Pods UI plugin if already included. |
| 152 | * |
| 153 | * @since 2.0.0 |
| 154 | */ |
| 155 | function pods_deactivate_pods_ui() { |
| 156 | if ( function_exists( 'pods_ui_manage' ) && file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) { |
| 157 | if ( ! function_exists( 'deactivate_plugins' ) ) { |
| 158 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 159 | } |
| 160 | |
| 161 | deactivate_plugins( realpath( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ); |
| 162 | |
| 163 | if ( ! headers_sent() ) { |
| 164 | wp_redirect( $_SERVER['REQUEST_URI'] ); |
| 165 | die(); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 |