Completed
Branch BUG-9467-never-double-install-... (7d31d4)
by
unknown
358:28 queued 341:17
created
core/libraries/rest_api/changes/Changes_In_4_8_36.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@  discard block
 block discarded – undo
15 15
 		//set a hook to remove the "calculate" query param
16 16
 		add_filter(
17 17
 			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
18
-			array( $this, 'remove_calculate_query_param' ),
18
+			array($this, 'remove_calculate_query_param'),
19 19
 			10,
20 20
 			3
21 21
 		);
22 22
 		//don't add the _calculated_fields either
23 23
 		add_filter(
24 24
 			'FHEE__Read__create_entity_from_wpdb_results__entity_before_inaccessible_field_removal',
25
-			array( $this, 'remove_calculated_fields_from_response' ),
25
+			array($this, 'remove_calculated_fields_from_response'),
26 26
 			10,
27 27
 			5
28 28
 		);
29 29
 		//and also don't add the count headers
30 30
 		add_filter(
31 31
 			'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_response_headers',
32
-			array( $this, 'remove_headers_new_in_this_version' ),
32
+			array($this, 'remove_headers_new_in_this_version'),
33 33
 			10,
34 34
 			3
35 35
 		);
36 36
 		//remove the old featured_image part of the response...
37 37
 		add_filter(
38 38
 			'FHEE__Read__create_entity_from_wpdb_results__entity_before_inaccessible_field_removal',
39
-			array( $this, 'remove_old_featured_image_part_of_cpt_entities' ),
39
+			array($this, 'remove_old_featured_image_part_of_cpt_entities'),
40 40
 			10,
41 41
 			5
42 42
 		);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		//before this, infinity was -1, now it's null
47 47
 		add_filter(
48 48
 			'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api',
49
-			array( $this, 'use_negative_one_for_infinity_before_this_version' ),
49
+			array($this, 'use_negative_one_for_infinity_before_this_version'),
50 50
 			10,
51 51
 			4
52 52
 		);
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 * @param string $version
60 60
 	 * @return array
61 61
 	 */
62
-	public function remove_calculate_query_param( $query_params, \EEM_Base $model, $version ) {
63
-		if( $this->applies_to_version( $version ) ) {
64
-			unset( $query_params[ 'calculate' ] );
62
+	public function remove_calculate_query_param($query_params, \EEM_Base $model, $version) {
63
+		if ($this->applies_to_version($version)) {
64
+			unset($query_params['calculate']);
65 65
 		}
66 66
 		return $query_params;
67 67
 	}
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 		\WP_REST_Request $request,
83 83
 		Read $controller
84 84
 	) {
85
-		if( $this->applies_to_version( $controller->get_model_version_info()->requested_version() ) ) {
86
-			unset( $entity_response_array[ '_calculated_fields' ] );
85
+		if ($this->applies_to_version($controller->get_model_version_info()->requested_version())) {
86
+			unset($entity_response_array['_calculated_fields']);
87 87
 		}
88 88
 		return $entity_response_array;
89 89
 	}
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 		Base $controller,
102 102
 		$version
103 103
 	) {
104
-		if( $this->applies_to_version( $version ) ) {
104
+		if ($this->applies_to_version($version)) {
105 105
 			$headers = array_diff_key(
106 106
 				$headers,
107 107
 				array_flip(
108 108
 					array(
109
-						Base::header_prefix_for_wp . 'Total',
110
-						Base::header_prefix_for_wp . 'TotalPages',
111
-						Base::header_prefix_for_wp . 'PageSize'
109
+						Base::header_prefix_for_wp.'Total',
110
+						Base::header_prefix_for_wp.'TotalPages',
111
+						Base::header_prefix_for_wp.'PageSize'
112 112
 					)));
113 113
 		}
114 114
 		return $headers;
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
 		\WP_REST_Request $request,
131 131
 		Read $controller
132 132
 	) {
133
-		if( $this->applies_to_version( $controller->get_model_version_info()->requested_version() )
133
+		if ($this->applies_to_version($controller->get_model_version_info()->requested_version())
134 134
 			&& $model instanceof \EEM_CPT_Base
135 135
 		) {
136 136
 			$attachment = wp_get_attachment_image_src(
137
-				get_post_thumbnail_id( $entity_response_array[ $model->primary_key_name() ] ),
137
+				get_post_thumbnail_id($entity_response_array[$model->primary_key_name()]),
138 138
 				'full'
139 139
 			);
140
-			$entity_response_array[ 'featured_image_url' ] = !empty( $attachment ) ? $attachment[ 0 ] : null;
140
+			$entity_response_array['featured_image_url'] = ! empty($attachment) ? $attachment[0] : null;
141 141
 		}
142 142
 		return $entity_response_array;
143 143
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 * @param string $requested_value
153 153
 	 * @return mixed
154 154
 	 */
155
-	public function use_negative_one_for_infinity_before_this_version( $new_value, $field_obj, $original_value, $requested_value ) {
156
-		if( $this->applies_to_version( $requested_value )
157
-			&& $original_value === EE_INF ) {
155
+	public function use_negative_one_for_infinity_before_this_version($new_value, $field_obj, $original_value, $requested_value) {
156
+		if ($this->applies_to_version($requested_value)
157
+			&& $original_value === EE_INF) {
158 158
 			//return the old representation of infinity in the JSON
159 159
 			return -1;
160 160
 		}
Please login to merge, or discard this patch.