PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.4
Pods – Custom Content Types and Fields v3.3.4
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 9 months ago components 11 months ago deprecated 2 years ago includes 9 months ago sql 2 years ago src 9 months ago ui 9 months ago vendor 11 months ago changelog.txt 9 months ago init.php 9 months ago license.txt 10 years ago readme.txt 9 months ago
init.php
185 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.4
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 * Plugin ID: did:plc:e3rm6t7cspgpzaf47kn3nnsl
24 */
25
26 /*
27 * This program is free software: you can redistribute it and/or modify
28 * it under the terms of the GNU General Public License as published by
29 * the Free Software Foundation, either version 2 of the License, or
30 * any later version.
31 *
32 * This program is distributed in the hope that it will be useful,
33 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 * GNU General Public License for more details.
36 *
37 * You should have received a copy of the GNU General Public License
38 * along with this program. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
39 */
40
41 if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
42 // Prevent conflicts with Pods 1.x and Pods UI plugins.
43 add_action( 'init', 'pods_deactivate_pods_duplicate' );
44 add_action( 'init', 'pods_deactivate_pods_ui' );
45 } else {
46 // Current version.
47 define( 'PODS_VERSION', '3.3.4' );
48
49 // Current database version, this is the last version the database changed.
50 define( 'PODS_DB_VERSION', '2.3.5' );
51
52 /**
53 * We aim to keep this as recent as possible to avoid ongoing React/Gutenberg compatibility problems.
54 *
55 * This should always be -2 versions behind the latest WP release. Example: 5.5 if 5.7 is current.
56 *
57 * To be updated each Major x.x Pods release.
58 *
59 * Next planned minimum WP version: 6.6
60 */
61 if ( ! defined( 'PODS_WP_VERSION_MINIMUM' ) ) {
62 $pods_wp_version_minimum = getenv( 'PODS_WP_VERSION_MINIMUM' ) ?: '6.3';
63 define( 'PODS_WP_VERSION_MINIMUM', $pods_wp_version_minimum );
64 }
65
66 /**
67 * This should match minimum WP requirements or usage of 90%+.
68 *
69 * Found at: https://wordpress.org/about/stats/
70 *
71 * Next planned minimum PHP version: 7.3
72 */
73 if ( ! defined( 'PODS_PHP_VERSION_MINIMUM' ) ) {
74 define( 'PODS_PHP_VERSION_MINIMUM', '7.2' );
75 }
76
77 /**
78 * This should match minimum WP requirements or usage of 90%+.
79 *
80 * Found at: https://wordpress.org/about/stats/
81 *
82 * Next planned minimum MySQL version: 5.6
83 */
84 if ( ! defined( 'PODS_MYSQL_VERSION_MINIMUM' ) ) {
85 define( 'PODS_MYSQL_VERSION_MINIMUM', '5.5' );
86 }
87
88 define( 'PODS_FILE', __FILE__ );
89 define( 'PODS_SLUG', plugin_basename( __FILE__ ) );
90 define( 'PODS_URL', plugin_dir_url( __FILE__ ) );
91 define( 'PODS_DIR', plugin_dir_path( __FILE__ ) );
92
93 // Prevent conflicts with old Pods UI plugin
94 if ( function_exists( 'pods_ui_manage' ) ) {
95 add_action( 'init', 'pods_deactivate_pods_ui' );
96 } else {
97 // If there was an install/update failure and the sub directories do not exist. Bail to avoid fatal errors.
98 if (
99 ! file_exists( PODS_DIR . 'classes/PodsInit.php' )
100 || ! file_exists( PODS_DIR . 'vendor/vendor-prefixed/autoload.php' )
101 ) {
102 return;
103 }
104
105 global $pods, $pods_init, $pods_form;
106
107 // Init custom autoloader.
108 require_once PODS_DIR . 'classes/PodsInit.php';
109
110 spl_autoload_register( array( 'PodsInit', 'autoload_class' ) );
111
112 require_once PODS_DIR . 'vendor/vendor-prefixed/autoload.php';
113
114 // Include global functions.
115 require_once PODS_DIR . 'includes/access.php';
116 require_once PODS_DIR . 'includes/classes.php';
117 require_once PODS_DIR . 'includes/data.php';
118 require_once PODS_DIR . 'includes/forms.php';
119 require_once PODS_DIR . 'includes/general.php';
120
121 // Maybe include media functions.
122 if ( ! defined( 'PODS_MEDIA' ) || PODS_MEDIA ) {
123 require_once PODS_DIR . 'includes/media.php';
124 }
125
126 // Maybe run full init.
127 if ( ! defined( 'SHORTINIT' ) || ! SHORTINIT ) {
128 // Maybe include deprecated classes / functions.
129 if ( pods_allow_deprecated() ) {
130 require_once PODS_DIR . 'deprecated/deprecated.php';
131 }
132
133 // Check if minimum required versions are met.
134 if ( false !== pods_compatibility_check() ) {
135 $pods_form = pods_form();
136
137 // If not on network admin, run full init.
138 if ( ! is_network_admin() ) {
139 $pods_init = pods_init();
140 }
141 }
142 }
143 }
144 }
145
146 /**
147 * Deactivate this version of Pods if Pods is already included.
148 *
149 * @since 2.8.0
150 */
151 function pods_deactivate_pods_duplicate() {
152 if ( defined( 'PODS_VERSION' ) && defined( 'PODS_DIR' ) && file_exists( untrailingslashit( PODS_DIR ) . '/init.php' ) ) {
153 if ( ! function_exists( 'deactivate_plugins' ) ) {
154 include_once ABSPATH . 'wp-admin/includes/plugin.php';
155 }
156
157 deactivate_plugins( realpath( untrailingslashit( PODS_DIR ) . '/init.php' ) );
158
159 if ( ! headers_sent() && ( ! function_exists( 'pods_ui_manage' ) && ! file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) ) {
160 wp_redirect( $_SERVER['REQUEST_URI'] );
161 die();
162 }
163 }
164 }
165
166 /**
167 * Deactivate Pods UI plugin if already included.
168 *
169 * @since 2.0.0
170 */
171 function pods_deactivate_pods_ui() {
172 if ( function_exists( 'pods_ui_manage' ) && file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) {
173 if ( ! function_exists( 'deactivate_plugins' ) ) {
174 include_once ABSPATH . 'wp-admin/includes/plugin.php';
175 }
176
177 deactivate_plugins( realpath( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) );
178
179 if ( ! headers_sent() ) {
180 wp_redirect( $_SERVER['REQUEST_URI'] );
181 die();
182 }
183 }
184 }
185