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.2.4
12+ * Version: 6.2.7
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: https://www.advancedcustomfields.com/pro
2323 exit ; // Exit if accessed directly.
2424}
2525
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+
2677if ( ! class_exists ( 'ACF ' ) ) {
2778
2879 /**
@@ -36,7 +87,7 @@ class ACF {
3687 *
3788 * @var string
3889 */
39- public $ version = '6.2.4 ' ;
90+ public $ version = '6.2.7 ' ;
4091
4192 /**
4293 * The plugin settings array.
@@ -64,8 +115,6 @@ class ACF {
64115 *
65116 * @date 23/06/12
66117 * @since 5.0.0
67- *
68- * @return void
69118 */
70119 public function __construct () {
71120 // Do nothing.
@@ -76,8 +125,6 @@ public function __construct() {
76125 *
77126 * @date 28/09/13
78127 * @since 5.0.0
79- *
80- * @return void
81128 */
82129 public function initialize () {
83130
@@ -90,6 +137,9 @@ public function initialize() {
90137 $ this ->define ( 'ACF_FIELD_API_VERSION ' , 5 );
91138 $ this ->define ( 'ACF_UPGRADE_VERSION ' , '5.5.0 ' ); // Highest version with an upgrade routine. See upgrades.php.
92139
140+ // Register activation hook.
141+ register_activation_hook ( __FILE__ , array ( $ this , 'acf_plugin_activated ' ) );
142+
93143 // Define settings.
94144 $ this ->settings = array (
95145 'name ' => __ ( 'Advanced Custom Fields ' , 'acf ' ),
@@ -215,12 +265,6 @@ public function initialize() {
215265 acf_include ( 'includes/admin/admin-upgrade.php ' );
216266 }
217267
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-
224268 // Include legacy.
225269 acf_include ( 'includes/legacy/legacy-locations.php ' );
226270
@@ -247,8 +291,6 @@ public function initialize() {
247291 *
248292 * @date 28/09/13
249293 * @since 5.0.0
250- *
251- * @return void
252294 */
253295 public function init () {
254296
@@ -405,8 +447,6 @@ public function init() {
405447 *
406448 * @date 22/10/2015
407449 * @since 5.3.2
408- *
409- * @return void
410450 */
411451 public function register_post_types () {
412452 $ cap = acf_get_setting ( 'capability ' );
@@ -485,8 +525,6 @@ public function register_post_types() {
485525 *
486526 * @date 22/10/2015
487527 * @since 5.3.2
488- *
489- * @return void
490528 */
491529 public function register_post_status () {
492530
@@ -617,7 +655,7 @@ public function posts_where( $where, $wp_query ) {
617655 * @date 3/5/17
618656 * @since 5.5.13
619657 *
620- * @param string $name The constant name.
658+ * @param string $name The constant name.
621659 * @param mixed $value The constant value.
622660 * @return void
623661 */
@@ -659,7 +697,7 @@ public function get_setting( $name ) {
659697 * @date 28/09/13
660698 * @since 5.0.0
661699 *
662- * @param string $name The setting name.
700+ * @param string $name The setting name.
663701 * @param mixed $value The setting value.
664702 * @return true
665703 */
@@ -687,7 +725,7 @@ public function get_data( $name ) {
687725 * @date 28/09/13
688726 * @since 5.0.0
689727 *
690- * @param string $name The data name.
728+ * @param string $name The data name.
691729 * @param mixed $value The data value.
692730 * @return void
693731 */
@@ -732,7 +770,7 @@ public function new_instance( $class ) {
732770 * @since 5.9.0
733771 *
734772 * @param string $key Key name.
735- * @return bool
773+ * @return boolean
736774 */
737775 public function __isset ( $ key ) {
738776 return in_array ( $ key , array ( 'locations ' , 'json ' ), true );
@@ -756,6 +794,21 @@ public function __get( $key ) {
756794 }
757795 return null ;
758796 }
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+ }
759812 }
760813
761814 /**
0 commit comments