Skip to content

Commit 195059b

Browse files
authored
Fix PHP8.2 deprecations, shorthand array notation (#122)
* Fix PHP8.2 deprecations, shorthand array notation * Add parent attribute to Layout class * Echo the output of acf_esc_attrs * Fix type, remove unused variables
1 parent a416c34 commit 195059b

15 files changed

+181
-71
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
[Unreleased]
88

9+
### Fixed
10+
- Fix PHP 8.2 deprecations (no dynamic properties, string interpolation {$var} instead of ${var}).
11+
- Replace deprecated acf_esc_attr_e with acf_esc_attrs.
12+
- Use shorthand array notation.
13+
914
## [1.39.0]
1015

1116
### Added

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,11 @@
3535
},
3636
"require-dev": {
3737
"victorjonsson/markdowndocs": "^1.3"
38+
},
39+
"config": {
40+
"allow-plugins": {
41+
"composer/installers": true,
42+
"dealerdirect/phpcodesniffer-composer-installer": true
43+
}
3844
}
3945
}

composer.lock

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Field.php

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,48 @@ abstract class Field {
3737
*/
3838
protected $instructions;
3939

40+
/**
41+
* Field type.
42+
*
43+
* @var string
44+
*/
45+
protected $type;
46+
47+
/**
48+
* Field wrapper.
49+
*
50+
* @var array
51+
*/
52+
protected $wrapper = [];
53+
54+
/**
55+
* Registered.
56+
*
57+
* @var string
58+
*/
59+
protected $registered;
60+
61+
/**
62+
* No key.
63+
*
64+
* @var boolean
65+
*/
66+
protected $no_key;
67+
68+
/**
69+
* Parent.
70+
*
71+
* @var mixed
72+
*/
73+
protected $parent;
74+
75+
/**
76+
* Fields var.
77+
*
78+
* @var mixed
79+
*/
80+
protected $fields_var;
81+
4082
/**
4183
* Field required status.
4284
*
@@ -135,6 +177,13 @@ abstract class Field {
135177
*/
136178
protected $redipress_field_type = 'Text';
137179

180+
/**
181+
* Codifier unique ID.
182+
*
183+
* @var string
184+
*/
185+
protected $codifier_unique_id;
186+
138187
/**
139188
* Store registered field keys to warn if there are duplicates.
140189
*
@@ -841,10 +890,10 @@ public function redipress_add_queryable(
841890
return $this;
842891
}
843892

844-
$this->redipress_add_queryable = true;
845-
$this->redipress_add_queryable_field_name = $field_name;
846-
$this->redipress_add_queryable_weight = $weight;
847-
$this->redipress_add_queryable_method = $method;
893+
$this->redipress_add_queryable = true;
894+
$this->redipress_add_queryable_field_name = $field_name;
895+
$this->redipress_add_queryable_field_weight = $weight;
896+
$this->redipress_add_queryable_method = $method;
848897

849898
add_action( 'codifier/export/key=' . $this->key, \Closure::fromCallable( [ $this, 'redipress_add_queryable_internal' ] ) );
850899

@@ -855,8 +904,6 @@ public function redipress_add_queryable(
855904
* An internal function to be run with the add queryable functionality.
856905
*/
857906
private function redipress_add_queryable_internal() {
858-
$field_name = $this->redipress_add_queryable_field_name;
859-
$weight = $this->redipress_add_queryable_weight;
860907
$method = $this->redipress_add_queryable_method;
861908

862909
if ( ! $method ) {
@@ -973,7 +1020,7 @@ private function redipress_add_queryable_internal() {
9731020
];
9741021

9751022
if ( $this->redipress_field_type === 'Text' ) {
976-
$field_args['weight'] = $this->redipress_add_queryable_weight;
1023+
$field_args['weight'] = $this->redipress_add_queryable_field_weight;
9771024
}
9781025

9791026
if ( class_exists( $type ) ) {

src/Field/Accordion.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ class Accordion extends GroupableField implements PseudoGroupableField {
1616
*/
1717
protected $type = 'accordion';
1818

19+
/**
20+
* Field layout
21+
*
22+
* @var string
23+
*/
24+
protected $layout;
25+
1926
/**
2027
* Fields inside the tab
2128
*

src/Field/Flexible/Layout.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ class Layout implements GroupableInterface {
4646
*/
4747
protected $name;
4848

49+
/**
50+
* Field group parent.
51+
*
52+
* @var mixed
53+
*/
54+
protected $parent;
55+
56+
/**
57+
* Layout active
58+
*
59+
* @var integer
60+
*/
61+
protected $active;
62+
4963
/**
5064
* Layout subfields
5165
*

src/Field/Tab.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ class Tab extends GroupableField implements PseudoGroupableField {
1616
*/
1717
protected $type = 'tab';
1818

19+
/**
20+
* Field layout.
21+
*
22+
* @var string
23+
*/
24+
protected $layout;
25+
1926
/**
2027
* Fields inside the tab
2128
*

src/Field/Taxonomy.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ class Taxonomy extends \Geniem\ACF\Field {
6363
*/
6464
protected $add_term;
6565

66+
/**
67+
* Return format.
68+
*
69+
* @var string
70+
*/
71+
protected $return_format;
72+
6673
/**
6774
* Set taxonomy
6875
*

src/Fields/CodifierWysiwyg.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ public function initialize() {
1919

2020
$this->name = 'extended_wysiwyg';
2121
$this->label = 'ACF Codifier Extended Wysiwyg Editor';
22-
$this->defaults = array(
22+
$this->defaults = [
2323
'tabs' => 'all',
2424
'toolbar' => 'full',
2525
'media_upload' => 1,
2626
'default_value' => '',
2727
'delay' => 0,
2828
'height' => 300,
29-
);
29+
];
3030
}
3131

3232
/**
@@ -44,7 +44,7 @@ public function render_field( $field ) {
4444
$height = acf_get_user_setting( 'wysiwyg_height', 300 );
4545
$height = max( $height, 300 );
4646

47-
echo str_replace( "height:${height}px;", 'height:'. $field['height'] . 'px;', $return );
47+
echo str_replace( "height:{$height}px;", 'height:'. $field['height'] . 'px;', $return );
4848

4949
static $min_height_zero = false;
5050

@@ -70,4 +70,4 @@ public function input_admin_enqueue_scripts() {
7070
}
7171

7272
new ACF_Field_Extended_Wysiwyg();
73-
});
73+
});

src/Fields/MultisitePostObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function input_admin_enqueue_scripts() {
5959
*
6060
* @return mixed
6161
*/
62-
public function get_ajax_query( $options = array() ) {
62+
public function get_ajax_query( $options = [] ) {
6363
$field = acf_get_field( $options['field_key'] );
6464
$blog_id = $field['blog_id'];
6565

0 commit comments

Comments
 (0)