Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade plugins #188

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
79 changes: 53 additions & 26 deletions wp-content/plugins/advanced-custom-fields-pro/acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* Plugin Name: Advanced Custom Fields PRO
* Plugin URI: https://www.advancedcustomfields.com
* Description: Customize WordPress with powerful, professional and intuitive fields.
* Version: 6.2.1.1
* Version: 6.3.1
* Author: WP Engine
* Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields
* Update URI: https://www.advancedcustomfields.com/pro
* Text Domain: acf
* Domain Path: /lang
* Requires PHP: 7.0
* Requires at least: 5.8
* Requires PHP: 7.4
* Requires at least: 6.0
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -36,7 +36,7 @@ class ACF {
*
* @var string
*/
public $version = '6.2.1.1';
public $version = '6.3.1';

/**
* The plugin settings array.
Expand Down Expand Up @@ -64,8 +64,6 @@ class ACF {
*
* @date 23/06/12
* @since 5.0.0
*
* @return void
*/
public function __construct() {
// Do nothing.
Expand All @@ -76,8 +74,6 @@ public function __construct() {
*
* @date 28/09/13
* @since 5.0.0
*
* @return void
*/
public function initialize() {

Expand All @@ -90,6 +86,9 @@ public function initialize() {
$this->define( 'ACF_FIELD_API_VERSION', 5 );
$this->define( 'ACF_UPGRADE_VERSION', '5.5.0' ); // Highest version with an upgrade routine. See upgrades.php.

// Register activation hook.
register_activation_hook( __FILE__, array( $this, 'acf_plugin_activated' ) );

// Define settings.
$this->settings = array(
'name' => __( 'Advanced Custom Fields', 'acf' ),
Expand Down Expand Up @@ -130,6 +129,7 @@ public function initialize() {
'preload_blocks' => true,
'enable_shortcode' => true,
'enable_bidirection' => true,
'enable_block_bindings' => true,
);

// Include utility functions.
Expand All @@ -143,6 +143,7 @@ public function initialize() {
// Include classes.
acf_include( 'includes/class-acf-data.php' );
acf_include( 'includes/class-acf-internal-post-type.php' );
acf_include( 'includes/class-acf-site-health.php' );
acf_include( 'includes/fields/class-acf-field.php' );
acf_include( 'includes/locations/abstract-acf-legacy-location.php' );
acf_include( 'includes/locations/abstract-acf-location.php' );
Expand All @@ -164,6 +165,14 @@ public function initialize() {
acf_include( 'includes/acf-input-functions.php' );
acf_include( 'includes/acf-wp-functions.php' );

// Override the shortcode default value based on the version when installed.
$first_activated_version = acf_get_version_when_first_activated();

// Only enable shortcode by default for versions prior to 6.3
if ( $first_activated_version && version_compare( $first_activated_version, '6.3', '>=' ) ) {
$this->settings['enable_shortcode'] = false;
}

// Include core.
acf_include( 'includes/fields.php' );
acf_include( 'includes/locations.php' );
Expand All @@ -177,7 +186,6 @@ public function initialize() {
acf_include( 'includes/loop.php' );
acf_include( 'includes/media.php' );
acf_include( 'includes/revisions.php' );
acf_include( 'includes/updates.php' );
acf_include( 'includes/upgrades.php' );
acf_include( 'includes/validation.php' );
acf_include( 'includes/rest-api.php' );
Expand Down Expand Up @@ -216,18 +224,16 @@ public function initialize() {
acf_include( 'includes/admin/admin-upgrade.php' );
}

// Include polyfill for < PHP7 unserialize.
if ( PHP_VERSION_ID < 70000 ) {
acf_include( 'vendor/polyfill-unserialize/src/Unserialize.php' );
acf_include( 'vendor/polyfill-unserialize/src/DisallowedClassesSubstitutor.php' );
}

// Include legacy.
acf_include( 'includes/legacy/legacy-locations.php' );

// Include PRO.
acf_include( 'pro/acf-pro.php' );

if ( is_admin() && function_exists( 'acf_is_pro' ) && ! acf_is_pro() ) {
acf_include( 'includes/admin/admin-options-pages-preview.php' );
}

// Add actions.
add_action( 'init', array( $this, 'register_post_status' ), 4 );
add_action( 'init', array( $this, 'init' ), 5 );
Expand All @@ -244,8 +250,6 @@ public function initialize() {
*
* @date 28/09/13
* @since 5.0.0
*
* @return void
*/
public function init() {

Expand Down Expand Up @@ -310,6 +314,7 @@ public function init() {
acf_include( 'includes/fields/class-acf-field-date_time_picker.php' );
acf_include( 'includes/fields/class-acf-field-time_picker.php' );
acf_include( 'includes/fields/class-acf-field-color_picker.php' );
acf_include( 'includes/fields/class-acf-field-icon_picker.php' );
acf_include( 'includes/fields/class-acf-field-message.php' );
acf_include( 'includes/fields/class-acf-field-accordion.php' );
acf_include( 'includes/fields/class-acf-field-tab.php' );
Expand Down Expand Up @@ -386,6 +391,12 @@ public function init() {
*/
do_action( 'acf/include_taxonomies', ACF_MAJOR_VERSION );

// If we're on 6.5 or newer, load block bindings. This will move to an autoloader in 6.3.
if ( version_compare( get_bloginfo( 'version' ), '6.5-beta1', '>=' ) ) {
acf_include( 'includes/Blocks/Bindings.php' );
new ACF\Blocks\Bindings();
}

/**
* Fires after ACF is completely "initialized".
*
Expand All @@ -402,8 +413,6 @@ public function init() {
*
* @date 22/10/2015
* @since 5.3.2
*
* @return void
*/
public function register_post_types() {
$cap = acf_get_setting( 'capability' );
Expand Down Expand Up @@ -482,8 +491,6 @@ public function register_post_types() {
*
* @date 22/10/2015
* @since 5.3.2
*
* @return void
*/
public function register_post_status() {

Expand Down Expand Up @@ -614,7 +621,7 @@ public function posts_where( $where, $wp_query ) {
* @date 3/5/17
* @since 5.5.13
*
* @param string $name The constant name.
* @param string $name The constant name.
* @param mixed $value The constant value.
* @return void
*/
Expand Down Expand Up @@ -656,7 +663,7 @@ public function get_setting( $name ) {
* @date 28/09/13
* @since 5.0.0
*
* @param string $name The setting name.
* @param string $name The setting name.
* @param mixed $value The setting value.
* @return true
*/
Expand Down Expand Up @@ -684,7 +691,7 @@ public function get_data( $name ) {
* @date 28/09/13
* @since 5.0.0
*
* @param string $name The data name.
* @param string $name The data name.
* @param mixed $value The data value.
* @return void
*/
Expand Down Expand Up @@ -729,7 +736,7 @@ public function new_instance( $class ) {
* @since 5.9.0
*
* @param string $key Key name.
* @return bool
* @return boolean
*/
public function __isset( $key ) {
return in_array( $key, array( 'locations', 'json' ), true );
Expand All @@ -753,6 +760,27 @@ public function __get( $key ) {
}
return null;
}

/**
* Plugin Activation Hook
*
* @since 6.2.6
*/
public function acf_plugin_activated() {
// Set the first activated version of ACF.
if ( null === get_option( 'acf_first_activated_version', null ) ) {
// If acf_version is set, this isn't the first activated version, so leave it unset so it's legacy.
if ( null === get_option( 'acf_version', null ) ) {
update_option( 'acf_first_activated_version', ACF_VERSION, true );

do_action( 'acf/first_activated' );
}
}

if ( acf_is_pro() ) {
do_action( 'acf/activated_pro' );
}
}
}

/**
Expand All @@ -779,5 +807,4 @@ function acf() {

// Instantiate.
acf();

} // class_exists check
Loading