PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.2
Pods – Custom Content Types and Fields v3.3.2
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / init.php
pods Last commit date
classes 11 months ago components 11 months ago deprecated 2 years ago includes 11 months ago sql 2 years ago src 11 months ago ui 11 months ago vendor 11 months ago changelog.txt 11 months ago init.php 11 months ago license.txt 10 years ago readme.txt 11 months ago
init.php
184 lines
1 <?php
2 /**
3 * Pods - Custom Content Types and Fields
4 *
5 * @package Pods
6 * @author Pods Framework Team
7 * @copyright 2025 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: 3.3.2
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: 6.0
20 * Requires PHP: 7.2
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', '3.3.2' );
47
48 // Current database version, this is the last version the database changed.
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 * Next planned minimum WP version: 6.6
59 */
60 if ( ! defined( 'PODS_WP_VERSION_MINIMUM' ) ) {
61 $pods_wp_version_minimum = getenv( 'PODS_WP_VERSION_MINIMUM' ) ?: '6.3';
62 define( 'PODS_WP_VERSION_MINIMUM', $pods_wp_version_minimum );
63 }
64
65 /**
66 * This should match minimum WP requirements or usage of 90%+.
67 *
68 * Found at: https://wordpress.org/about/stats/
69 *
70 * Next planned minimum PHP version: 7.3
71 */
72 if ( ! defined( 'PODS_PHP_VERSION_MINIMUM' ) ) {
73 define( 'PODS_PHP_VERSION_MINIMUM', '7.2' );
74 }
75
76 /**
77 * This should match minimum WP requirements or usage of 90%+.
78 *
79 * Found at: https://wordpress.org/about/stats/
80 *
81 * Next planned minimum MySQL version: 5.6
82 */
83 if ( ! defined( 'PODS_MYSQL_VERSION_MINIMUM' ) ) {
84 define( 'PODS_MYSQL_VERSION_MINIMUM', '5.5' );
85 }
86
87 define( 'PODS_FILE', __FILE__ );
88 define( 'PODS_SLUG', plugin_basename( __FILE__ ) );
89 define( 'PODS_URL', plugin_dir_url( __FILE__ ) );
90 define( 'PODS_DIR', plugin_dir_path( __FILE__ ) );
91
92 // Prevent conflicts with old Pods UI plugin
93 if ( function_exists( 'pods_ui_manage' ) ) {
94 add_action( 'init', 'pods_deactivate_pods_ui' );
95 } else {
96 // If there was an install/update failure and the sub directories do not exist. Bail to avoid fatal errors.
97 if (
98 ! file_exists( PODS_DIR . 'classes/PodsInit.php' )
99 || ! file_exists( PODS_DIR . 'vendor/vendor-prefixed/autoload.php' )
100 ) {
101 return;
102 }
103
104 global $pods, $pods_init, $pods_form;
105
106 // Init custom autoloader.
107 require_once PODS_DIR . 'classes/PodsInit.php';
108
109 spl_autoload_register( array( 'PodsInit', 'autoload_class' ) );
110
111 require_once PODS_DIR . 'vendor/vendor-prefixed/autoload.php';
112
113 // Include global functions.
114 require_once PODS_DIR . 'includes/access.php';
115 require_once PODS_DIR . 'includes/classes.php';
116 require_once PODS_DIR . 'includes/data.php';
117 require_once PODS_DIR . 'includes/forms.php';
118 require_once PODS_DIR . 'includes/general.php';
119
120 // Maybe include media functions.
121 if ( ! defined( 'PODS_MEDIA' ) || PODS_MEDIA ) {
122 require_once PODS_DIR . 'includes/media.php';
123 }
124
125 // Maybe run full init.
126 if ( ! defined( 'SHORTINIT' ) || ! SHORTINIT ) {
127 // Maybe include deprecated classes / functions.
128 if ( pods_allow_deprecated() ) {
129 require_once PODS_DIR . 'deprecated/deprecated.php';
130 }
131
132 // Check if minimum required versions are met.
133 if ( false !== pods_compatibility_check() ) {
134 $pods_form = pods_form();
135
136 // If not on network admin, run full init.
137 if ( ! is_network_admin() ) {
138 $pods_init = pods_init();
139 }
140 }
141 }
142 }
143 }
144
145 /**
146 * Deactivate this version of Pods if Pods is already included.
147 *
148 * @since 2.8.0
149 */
150 function pods_deactivate_pods_duplicate() {
151 if ( defined( 'PODS_VERSION' ) && defined( 'PODS_DIR' ) && file_exists( untrailingslashit( PODS_DIR ) . '/init.php' ) ) {
152 if ( ! function_exists( 'deactivate_plugins' ) ) {
153 include_once ABSPATH . 'wp-admin/includes/plugin.php';
154 }
155
156 deactivate_plugins( realpath( untrailingslashit( PODS_DIR ) . '/init.php' ) );
157
158 if ( ! headers_sent() && ( ! function_exists( 'pods_ui_manage' ) && ! file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) ) {
159 wp_redirect( $_SERVER['REQUEST_URI'] );
160 die();
161 }
162 }
163 }
164
165 /**
166 * Deactivate Pods UI plugin if already included.
167 *
168 * @since 2.0.0
169 */
170 function pods_deactivate_pods_ui() {
171 if ( function_exists( 'pods_ui_manage' ) && file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) {
172 if ( ! function_exists( 'deactivate_plugins' ) ) {
173 include_once ABSPATH . 'wp-admin/includes/plugin.php';
174 }
175
176 deactivate_plugins( realpath( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) );
177
178 if ( ! headers_sent() ) {
179 wp_redirect( $_SERVER['REQUEST_URI'] );
180 die();
181 }
182 }
183 }
184