Skip to content

Commit 1520424

Browse files
authored
Merge pull request #26 from visual-framework/plugins-update
Plugins update
2 parents 49aa72d + 0745e75 commit 1520424

1,203 files changed

Lines changed: 223745 additions & 108569 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

advanced-custom-fields-pro/acf.php

Lines changed: 86 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Plugin Name: Advanced Custom Fields PRO
1010
* Plugin URI: https://www.advancedcustomfields.com
1111
* Description: Customize WordPress with powerful, professional and intuitive fields.
12-
* Version: 6.3.8
12+
* Version: 6.3.11
1313
* Author: WP Engine
1414
* Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields
1515
* Update URI: false
@@ -36,7 +36,7 @@ class ACF {
3636
*
3737
* @var string
3838
*/
39-
public $version = '6.3.8';
39+
public $version = '6.3.11';
4040

4141
/**
4242
* The plugin settings array.
@@ -130,6 +130,7 @@ public function initialize() {
130130
'enable_shortcode' => true,
131131
'enable_bidirection' => true,
132132
'enable_block_bindings' => true,
133+
'enable_meta_box_cb_edit' => true,
133134
);
134135

135136
// Include utility functions.
@@ -227,15 +228,13 @@ public function initialize() {
227228
// Include legacy.
228229
acf_include( 'includes/legacy/legacy-locations.php' );
229230

231+
// Include updater.
232+
acf_include( 'includes/Updater/Updater.php' );
233+
230234
// Include PRO.
231235
acf_include( 'pro/acf-pro.php' );
232236

233237
if ( is_admin() && function_exists( 'acf_is_pro' ) && ! acf_is_pro() ) {
234-
235-
// Include WPE update system.
236-
acf_include( 'includes/class-PluginUpdater.php' );
237-
acf_include( 'includes/acf-upgrades.php' );
238-
239238
acf_include( 'includes/admin/admin-options-pages-preview.php' );
240239
}
241240

@@ -396,12 +395,24 @@ public function init() {
396395
*/
397396
do_action( 'acf/include_taxonomies', ACF_MAJOR_VERSION );
398397

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

404+
// If we're ACF free, register the updater.
405+
if ( function_exists( 'acf_is_pro' ) && ! acf_is_pro() ) {
406+
acf_register_plugin_update(
407+
array(
408+
'id' => 'acf',
409+
'slug' => acf_get_setting( 'slug' ),
410+
'basename' => acf_get_setting( 'basename' ),
411+
'version' => acf_get_setting( 'version' ),
412+
)
413+
);
414+
}
415+
405416
/**
406417
* Fires after ACF is completely "initialized".
407418
*
@@ -788,6 +799,73 @@ public function acf_plugin_activated() {
788799
}
789800
}
790801

802+
if ( ! class_exists( 'ACF_Updates' ) ) {
803+
/**
804+
* The main function responsible for returning the acf_updates singleton.
805+
* Use this function like you would a global variable, except without needing to declare the global.
806+
*
807+
* Example: <?php $acf_updates = acf_updates(); ?>
808+
*
809+
* @since 5.5.12
810+
*
811+
* @return ACF\Updater The singleton instance of Updater.
812+
*/
813+
function acf_updates() {
814+
global $acf_updates;
815+
if ( ! isset( $acf_updates ) ) {
816+
$acf_updates = new ACF\Updater();
817+
}
818+
return $acf_updates;
819+
}
820+
821+
/**
822+
* Alias of acf_updates()->add_plugin().
823+
*
824+
* @since 5.5.10
825+
*
826+
* @param array $plugin Plugin data array.
827+
*/
828+
function acf_register_plugin_update( $plugin ) {
829+
acf_updates()->add_plugin( $plugin );
830+
}
831+
832+
/**
833+
* Register a dummy ACF_Updates class for back compat.
834+
*/
835+
class ACF_Updates {} //phpcs:ignore -- Back compat.
836+
}
837+
838+
/**
839+
* An ACF specific getter to replace `home_url` in our license checks to ensure we can avoid third party filters.
840+
*
841+
* @since 6.0.1
842+
* @since 6.2.8 - Renamed to acf_pro_get_home_url to match pro exclusive function naming.
843+
* @since 6.3.10 - Renamed to acf_get_home_url now updater logic applies to free.
844+
*
845+
* @return string $home_url The output from home_url, sans known third party filters which cause license activation issues.
846+
*/
847+
function acf_get_home_url() {
848+
if ( acf_is_pro() ) {
849+
// Disable WPML and TranslatePress's home url overrides for our license check.
850+
add_filter( 'wpml_get_home_url', 'acf_pro_license_ml_intercept', 99, 2 );
851+
add_filter( 'trp_home_url', 'acf_pro_license_ml_intercept', 99, 2 );
852+
853+
if ( acf_pro_is_legacy_multisite() && acf_is_multisite_sub_site() ) {
854+
$home_url = get_home_url( get_main_site_id() );
855+
} else {
856+
$home_url = home_url();
857+
}
858+
859+
// Re-enable WPML and TranslatePress's home url overrides.
860+
remove_filter( 'wpml_get_home_url', 'acf_pro_license_ml_intercept', 99 );
861+
remove_filter( 'trp_home_url', 'acf_pro_license_ml_intercept', 99 );
862+
} else {
863+
$home_url = home_url();
864+
}
865+
866+
return $home_url;
867+
}
868+
791869
/**
792870
* The main function responsible for returning the one true acf Instance to functions everywhere.
793871
* Use this function like you would a global variable, except without needing to declare the global.

0 commit comments

Comments
 (0)