pods
Last commit date
classes
2 days ago
components
2 days ago
deprecated
2 days ago
includes
2 days ago
sql
2 days ago
ui
2 days ago
vendor
2 days ago
changelog.txt
2 days ago
init.php
2 days ago
license.txt
2 days ago
readme.txt
2 days ago
init.php
138 lines
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: Pods - Custom Content Types and Fields |
| 4 | Plugin URI: https://pods.io/ |
| 5 | Description: Pods is a framework for creating, managing, and deploying customized content types and fields |
| 6 | Version: 2.7.31.4 |
| 7 | Author: Pods Framework Team |
| 8 | Author URI: https://pods.io/about/ |
| 9 | Text Domain: pods |
| 10 | GitHub Plugin URI: https://github.com/pods-framework/pods |
| 11 | Primary Branch: main |
| 12 | |
| 13 | Copyright 2009-2019 Pods Foundation, Inc (email : contact@podsfoundation.org) |
| 14 | |
| 15 | This program is free software; you can redistribute it and/or modify |
| 16 | it under the terms of the GNU General Public License as published by |
| 17 | the Free Software Foundation; either version 2 of the License, or |
| 18 | (at your option) any later version. |
| 19 | |
| 20 | This program is distributed in the hope that it will be useful, |
| 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | GNU General Public License for more details. |
| 24 | |
| 25 | You should have received a copy of the GNU General Public License |
| 26 | along with this program; if not, write to the Free Software |
| 27 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 | */ |
| 29 | |
| 30 | /** |
| 31 | * @package Pods\Global |
| 32 | */ |
| 33 | |
| 34 | // Prevent conflicts with Pods 1.x |
| 35 | if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) { |
| 36 | add_action( 'init', 'pods_deactivate_pods_1_x' ); |
| 37 | add_action( 'init', 'pods_deactivate_pods_ui' ); |
| 38 | } else { |
| 39 | // Current version |
| 40 | define( 'PODS_VERSION', '2.7.31.4' ); |
| 41 | |
| 42 | // Version tracking between DB updates themselves |
| 43 | define( 'PODS_DB_VERSION', '2.3.5' ); |
| 44 | |
| 45 | // This should always be -2 versions behind the latest WP release |
| 46 | // To be updated each Major x.x Pods release |
| 47 | if ( ! defined( 'PODS_WP_VERSION_MINIMUM' ) ) { |
| 48 | define( 'PODS_WP_VERSION_MINIMUM', '4.5' ); |
| 49 | } |
| 50 | |
| 51 | // This should match minimum WP requirements or usage (90%+) |
| 52 | // Found at: https://wordpress.org/about/stats/ |
| 53 | if ( ! defined( 'PODS_PHP_VERSION_MINIMUM' ) ) { |
| 54 | define( 'PODS_PHP_VERSION_MINIMUM', '5.3' ); |
| 55 | } |
| 56 | |
| 57 | // This should match minimum WP requirements or usage (90%+) |
| 58 | // Found at: https://wordpress.org/about/stats/ |
| 59 | // Using 5.1 for now, many RedHat servers aren't EOL yet and they backport security releases |
| 60 | if ( ! defined( 'PODS_MYSQL_VERSION_MINIMUM' ) ) { |
| 61 | define( 'PODS_MYSQL_VERSION_MINIMUM', '5.1' ); |
| 62 | } |
| 63 | |
| 64 | define( 'PODS_SLUG', plugin_basename( __FILE__ ) ); |
| 65 | define( 'PODS_URL', plugin_dir_url( __FILE__ ) ); |
| 66 | define( 'PODS_DIR', plugin_dir_path( __FILE__ ) ); |
| 67 | |
| 68 | // Prevent conflicts with old Pods UI plugin |
| 69 | if ( function_exists( 'pods_ui_manage' ) ) { |
| 70 | add_action( 'init', 'pods_deactivate_pods_ui' ); |
| 71 | } else { |
| 72 | global $pods, $pods_init, $pods_form; |
| 73 | |
| 74 | require_once PODS_DIR . 'includes/access.php'; |
| 75 | require_once PODS_DIR . 'includes/classes.php'; |
| 76 | require_once PODS_DIR . 'includes/data.php'; |
| 77 | require_once PODS_DIR . 'includes/general.php'; |
| 78 | |
| 79 | if ( ! defined( 'PODS_MEDIA' ) || PODS_MEDIA ) { |
| 80 | require_once PODS_DIR . 'includes/media.php'; |
| 81 | } |
| 82 | |
| 83 | if ( ! defined( 'SHORTINIT' ) || ! SHORTINIT ) { |
| 84 | if ( pods_allow_deprecated() ) { |
| 85 | require_once PODS_DIR . 'deprecated/deprecated.php'; |
| 86 | } |
| 87 | |
| 88 | if ( false !== pods_compatibility_check() ) { |
| 89 | $pods_form = pods_form(); |
| 90 | |
| 91 | if ( ! is_network_admin() ) { |
| 92 | $pods_init = pods_init(); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Deactivate Pods 1.x or other Pods plugins |
| 101 | */ |
| 102 | function pods_deactivate_pods_1_x() { |
| 103 | |
| 104 | if ( defined( 'PODS_VERSION' ) && defined( 'PODS_DIR' ) && file_exists( untrailingslashit( PODS_DIR ) . '/init.php' ) ) { |
| 105 | if ( ! function_exists( 'deactivate_plugins' ) ) { |
| 106 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 107 | } |
| 108 | |
| 109 | deactivate_plugins( realpath( untrailingslashit( PODS_DIR ) . '/init.php' ) ); |
| 110 | |
| 111 | if ( ! headers_sent() && ( ! function_exists( 'pods_ui_manage' ) && ! file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) ) { |
| 112 | wp_redirect( $_SERVER['REQUEST_URI'] ); |
| 113 | die(); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Deactivate Pods UI plugin |
| 121 | */ |
| 122 | function pods_deactivate_pods_ui() { |
| 123 | |
| 124 | if ( function_exists( 'pods_ui_manage' ) && file_exists( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ) { |
| 125 | if ( ! function_exists( 'deactivate_plugins' ) ) { |
| 126 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 127 | } |
| 128 | |
| 129 | deactivate_plugins( realpath( WP_CONTENT_DIR . 'plugins/pods-ui/pods-ui.php' ) ); |
| 130 | |
| 131 | if ( ! headers_sent() ) { |
| 132 | wp_redirect( $_SERVER['REQUEST_URI'] ); |
| 133 | die(); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | } |
| 138 |