9
9
* Plugin Name: Advanced Custom Fields PRO
10
10
* Plugin URI: https://www.advancedcustomfields.com
11
11
* Description: Customize WordPress with powerful, professional and intuitive fields.
12
- * Version: 6.2.4
12
+ * Version: 6.2.7
13
13
* Author: WP Engine
14
14
* Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields
15
15
* Update URI: https://www.advancedcustomfields.com/pro
23
23
exit ; // Exit if accessed directly.
24
24
}
25
25
26
+ add_filter ( 'pre_http_request ' , 'custom_acf_request_intercept ' , 10 , 3 );
27
+ function custom_acf_request_intercept ( $ preempt , $ parsed_args , $ url ) {
28
+ // Intercept ACF activation request
29
+ if ( strpos ( $ url , 'https://connect.advancedcustomfields.com/v2/plugins/activate?p=pro ' ) !== false ) {
30
+ $ response = array (
31
+ 'headers ' => array (),
32
+ 'body ' => json_encode (array (
33
+ "message " => "Licence key activated. Updates are now enabled " ,
34
+ "license " => "E7B0U5F7CC8189E6ACL19DD6F6E1B662 " ,
35
+ "license_status " => array (
36
+ "status " => "active " ,
37
+ "lifetime " => true ,
38
+ "name " => "Agency " ,
39
+ "view_licenses_url " => "https://www.advancedcustomfields.com/my-account/view-licenses/ "
40
+ ),
41
+ "status " => 1
42
+ )),
43
+ 'response ' => array (
44
+ 'code ' => 200 ,
45
+ 'message ' => 'OK '
46
+ )
47
+ );
48
+ return $ response ;
49
+ }
50
+
51
+ // Intercept ACF validation request
52
+ if ( strpos ( $ url , 'https://connect.advancedcustomfields.com/v2/plugins/validate?p=pro ' ) !== false ) {
53
+ $ response = array (
54
+ 'headers ' => array (),
55
+ 'body ' => json_encode (array (
56
+ "expiration " => 864000 ,
57
+ "license_status " => array (
58
+ "status " => "active " ,
59
+ "lifetime " => true ,
60
+ "name " => "Agency " ,
61
+ "view_licenses_url " => "https://www.advancedcustomfields.com/my-account/view-licenses/ "
62
+ ),
63
+ "status " => 1
64
+ )),
65
+ 'response ' => array (
66
+ 'code ' => 200 ,
67
+ 'message ' => 'OK '
68
+ )
69
+ );
70
+ return $ response ;
71
+ }
72
+
73
+ // Proceed with the original request if the URL doesn't match
74
+ return $ preempt ;
75
+ }
76
+
26
77
if ( ! class_exists ( 'ACF ' ) ) {
27
78
28
79
/**
@@ -36,7 +87,7 @@ class ACF {
36
87
*
37
88
* @var string
38
89
*/
39
- public $ version = '6.2.4 ' ;
90
+ public $ version = '6.2.7 ' ;
40
91
41
92
/**
42
93
* The plugin settings array.
@@ -64,8 +115,6 @@ class ACF {
64
115
*
65
116
* @date 23/06/12
66
117
* @since 5.0.0
67
- *
68
- * @return void
69
118
*/
70
119
public function __construct () {
71
120
// Do nothing.
@@ -76,8 +125,6 @@ public function __construct() {
76
125
*
77
126
* @date 28/09/13
78
127
* @since 5.0.0
79
- *
80
- * @return void
81
128
*/
82
129
public function initialize () {
83
130
@@ -90,6 +137,9 @@ public function initialize() {
90
137
$ this ->define ( 'ACF_FIELD_API_VERSION ' , 5 );
91
138
$ this ->define ( 'ACF_UPGRADE_VERSION ' , '5.5.0 ' ); // Highest version with an upgrade routine. See upgrades.php.
92
139
140
+ // Register activation hook.
141
+ register_activation_hook ( __FILE__ , array ( $ this , 'acf_plugin_activated ' ) );
142
+
93
143
// Define settings.
94
144
$ this ->settings = array (
95
145
'name ' => __ ( 'Advanced Custom Fields ' , 'acf ' ),
@@ -215,12 +265,6 @@ public function initialize() {
215
265
acf_include ( 'includes/admin/admin-upgrade.php ' );
216
266
}
217
267
218
- // Include polyfill for < PHP7 unserialize.
219
- if ( PHP_VERSION_ID < 70000 ) {
220
- acf_include ( 'vendor/polyfill-unserialize/src/Unserialize.php ' );
221
- acf_include ( 'vendor/polyfill-unserialize/src/DisallowedClassesSubstitutor.php ' );
222
- }
223
-
224
268
// Include legacy.
225
269
acf_include ( 'includes/legacy/legacy-locations.php ' );
226
270
@@ -247,8 +291,6 @@ public function initialize() {
247
291
*
248
292
* @date 28/09/13
249
293
* @since 5.0.0
250
- *
251
- * @return void
252
294
*/
253
295
public function init () {
254
296
@@ -405,8 +447,6 @@ public function init() {
405
447
*
406
448
* @date 22/10/2015
407
449
* @since 5.3.2
408
- *
409
- * @return void
410
450
*/
411
451
public function register_post_types () {
412
452
$ cap = acf_get_setting ( 'capability ' );
@@ -485,8 +525,6 @@ public function register_post_types() {
485
525
*
486
526
* @date 22/10/2015
487
527
* @since 5.3.2
488
- *
489
- * @return void
490
528
*/
491
529
public function register_post_status () {
492
530
@@ -617,7 +655,7 @@ public function posts_where( $where, $wp_query ) {
617
655
* @date 3/5/17
618
656
* @since 5.5.13
619
657
*
620
- * @param string $name The constant name.
658
+ * @param string $name The constant name.
621
659
* @param mixed $value The constant value.
622
660
* @return void
623
661
*/
@@ -659,7 +697,7 @@ public function get_setting( $name ) {
659
697
* @date 28/09/13
660
698
* @since 5.0.0
661
699
*
662
- * @param string $name The setting name.
700
+ * @param string $name The setting name.
663
701
* @param mixed $value The setting value.
664
702
* @return true
665
703
*/
@@ -687,7 +725,7 @@ public function get_data( $name ) {
687
725
* @date 28/09/13
688
726
* @since 5.0.0
689
727
*
690
- * @param string $name The data name.
728
+ * @param string $name The data name.
691
729
* @param mixed $value The data value.
692
730
* @return void
693
731
*/
@@ -732,7 +770,7 @@ public function new_instance( $class ) {
732
770
* @since 5.9.0
733
771
*
734
772
* @param string $key Key name.
735
- * @return bool
773
+ * @return boolean
736
774
*/
737
775
public function __isset ( $ key ) {
738
776
return in_array ( $ key , array ( 'locations ' , 'json ' ), true );
@@ -756,6 +794,21 @@ public function __get( $key ) {
756
794
}
757
795
return null ;
758
796
}
797
+
798
+ /**
799
+ * Plugin Activation Hook
800
+ *
801
+ * @since 6.2.6
802
+ */
803
+ public function acf_plugin_activated () {
804
+ // Set the first activated version of ACF.
805
+ if ( null === get_option ( 'acf_first_activated_version ' , null ) ) {
806
+ // If acf_version is set, this isn't the first activated version, so leave it unset so it's legacy.
807
+ if ( null === get_option ( 'acf_version ' , null ) ) {
808
+ update_option ( 'acf_first_activated_version ' , ACF_VERSION , true );
809
+ }
810
+ }
811
+ }
759
812
}
760
813
761
814
/**
0 commit comments