@@ -55,7 +55,7 @@ |
||
55 | 55 | $value = esc_attr( sanitize_text_field( $value ) ); |
56 | 56 | |
57 | 57 | if ( in_array( $attribute, $accepted_attributes ) && ! empty( $value ) ) { |
58 | - $shortcode_attributes[] = "{$attribute}={$value}"; |
|
58 | + $shortcode_attributes[ ] = "{$attribute}={$value}"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -43,15 +43,15 @@ |
||
43 | 43 | $value = esc_attr( sanitize_text_field( $value ) ); |
44 | 44 | |
45 | 45 | if ( 'content' !== $attribute && in_array( $attribute, $accepted_attributes ) && ! empty( $value ) ) { |
46 | - $shortcode_attributes[] = "{$attribute}={$value}"; |
|
46 | + $shortcode_attributes[ ] = "{$attribute}={$value}"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - if ( ! empty( $attributes['content'] ) ) { |
|
50 | + if ( ! empty( $attributes[ 'content' ] ) ) { |
|
51 | 51 | $shortcode = sprintf( |
52 | 52 | '[gv_entry_link %s]%s[/gv_entry_link]', |
53 | 53 | implode( ' ', $shortcode_attributes ), |
54 | - wp_kses_post( $attributes['content'] ) |
|
54 | + wp_kses_post( $attributes[ 'content' ] ) |
|
55 | 55 | ); |
56 | 56 | } else { |
57 | 57 | $shortcode = sprintf( '[gv_entry_link %s/]', implode( ' ', $shortcode_attributes ) ); |
@@ -20,8 +20,8 @@ |
||
20 | 20 | global $wp_version; |
21 | 21 | |
22 | 22 | if ( ! class_exists( 'GravityView_Plugin' ) || |
23 | - ! function_exists( 'register_block_type' ) || |
|
24 | - version_compare( $wp_version, self::MIN_WP_VERSION, '<' ) |
|
23 | + ! function_exists( 'register_block_type' ) || |
|
24 | + version_compare( $wp_version, self::MIN_WP_VERSION, '<' ) |
|
25 | 25 | ) { |
26 | 26 | return; |
27 | 27 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | wp_enqueue_script( |
92 | 92 | self::ASSETS_HANDLE, |
93 | 93 | gravityview()->plugin->url() . $script, |
94 | - $asset_file['dependencies'], |
|
94 | + $asset_file[ 'dependencies' ], |
|
95 | 95 | filemtime( gravityview()->plugin->dir() . $script ) |
96 | 96 | ); |
97 | 97 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | ) |
110 | 110 | ); |
111 | 111 | |
112 | - $views_list_array = array_map( function ( $view ) { |
|
112 | + $views_list_array = array_map( function( $view ) { |
|
113 | 113 | |
114 | - $post_title = empty( $view->post_title ) ? __('(no title)', 'gk-gravityview') : $view->post_title; |
|
115 | - $post_title = esc_html( sprintf('%s #%d', $post_title, $view->ID ) ); |
|
114 | + $post_title = empty( $view->post_title ) ? __( '(no title)', 'gk-gravityview' ) : $view->post_title; |
|
115 | + $post_title = esc_html( sprintf( '%s #%d', $post_title, $view->ID ) ); |
|
116 | 116 | |
117 | 117 | return array( |
118 | 118 | 'value' => $view->ID, |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $value = esc_attr( sanitize_text_field( $value ) ); |
56 | 56 | |
57 | 57 | if ( in_array( $attribute, $accepted_attributes ) && ! empty( $value ) ) { |
58 | - $shortcode_attributes[] = "{$attribute}={$value}"; |
|
58 | + $shortcode_attributes[ ] = "{$attribute}={$value}"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $value = esc_attr( sanitize_text_field( $value ) ); |
56 | 56 | |
57 | 57 | if ( in_array( $attribute, $accepted_attributes ) && ! empty( $value ) ) { |
58 | - $shortcode_attributes[] = "{$attribute}={$value}"; |
|
58 | + $shortcode_attributes[ ] = "{$attribute}={$value}"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $value = esc_attr( sanitize_text_field( $value ) ); |
56 | 56 | |
57 | 57 | if ( in_array( $attribute, $accepted_attributes ) && ! empty( $value ) ) { |
58 | - $shortcode_attributes[] = "{$attribute}={$value}"; |
|
58 | + $shortcode_attributes[ ] = "{$attribute}={$value}"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $atts = shortcode_atts( self::$defaults, $atts ); |
77 | 77 | |
78 | - $atts['action'] = 'edit'; |
|
78 | + $atts[ 'action' ] = 'edit'; |
|
79 | 79 | |
80 | 80 | return $this->shortcode( $atts, $content, $context ); |
81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $atts = shortcode_atts( self::$defaults, $atts ); |
93 | 93 | |
94 | - $atts['action'] = 'delete'; |
|
94 | + $atts[ 'action' ] = 'delete'; |
|
95 | 95 | |
96 | 96 | return $this->shortcode( $atts, $content, $context ); |
97 | 97 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
133 | 133 | |
134 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
134 | + $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
135 | 135 | |
136 | 136 | if ( empty( $this->view_id ) ) { |
137 | 137 | gravityview()->log->error( 'A View ID was not defined and we are not inside a View' ); |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | return null; |
140 | 140 | } |
141 | 141 | |
142 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
142 | + $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
143 | 143 | |
144 | 144 | if ( empty( $this->entry ) ) { |
145 | - gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) ); |
|
145 | + gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) ); |
|
146 | 146 | |
147 | 147 | |
148 | 148 | return null; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) ); |
152 | 152 | |
153 | 153 | if ( ! $this->has_cap() ) { |
154 | - gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) ); |
|
154 | + gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) ); |
|
155 | 155 | return null; |
156 | 156 | } |
157 | 157 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // Get just the URL, not the tag |
167 | - if ( 'url' === $this->settings['return'] ) { |
|
167 | + if ( 'url' === $this->settings[ 'return' ] ) { |
|
168 | 168 | return $url; |
169 | 169 | } |
170 | 170 | |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | */ |
203 | 203 | private function get_link_atts() { |
204 | 204 | |
205 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
205 | + wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
206 | 206 | |
207 | - if ( 'delete' === $this->settings['action'] ) { |
|
208 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
207 | + if ( 'delete' === $this->settings[ 'action' ] ) { |
|
208 | + $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
209 | 209 | } |
210 | 210 | |
211 | - return (array) $link_atts; |
|
211 | + return (array)$link_atts; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | return do_shortcode( $content ); |
229 | 229 | } |
230 | 230 | |
231 | - switch ( $this->settings['action'] ) { |
|
231 | + switch ( $this->settings[ 'action' ] ) { |
|
232 | 232 | case 'edit': |
233 | 233 | $anchor_text = __( 'Edit Entry', 'gk-gravityview' ); |
234 | 234 | break; |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | private function get_url() { |
257 | 257 | |
258 | 258 | // if post_id is not defined, default to view_id |
259 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id']; |
|
259 | + $post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ]; |
|
260 | 260 | |
261 | - switch ( $this->settings['action'] ) { |
|
261 | + switch ( $this->settings[ 'action' ] ) { |
|
262 | 262 | case 'edit': |
263 | 263 | $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
264 | 264 | break; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | private function has_cap() { |
285 | 285 | |
286 | - switch ( $this->settings['action'] ) { |
|
286 | + switch ( $this->settings[ 'action' ] ) { |
|
287 | 287 | case 'edit': |
288 | 288 | $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
289 | 289 | break; |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | */ |
349 | 349 | private function maybe_add_field_values_query_args( $url ) { |
350 | 350 | |
351 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
351 | + if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
352 | 352 | |
353 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
353 | + wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
354 | 354 | |
355 | 355 | $url = add_query_arg( $field_values, $url ); |
356 | 356 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string $output |
35 | 35 | */ |
36 | - static function render( $block_attributes = [] ) { |
|
36 | + static function render( $block_attributes = [ ] ) { |
|
37 | 37 | $block_to_shortcode_attributes_map = [ |
38 | 38 | 'viewId' => 'id', |
39 | 39 | 'postId' => 'post_id', |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | 'backLinkLabel' => 'back_link_label', |
52 | 52 | ]; |
53 | 53 | |
54 | - $shortcode_attributes = []; |
|
54 | + $shortcode_attributes = [ ]; |
|
55 | 55 | |
56 | 56 | foreach ( $block_attributes as $attribute => $value ) { |
57 | 57 | $value = esc_attr( sanitize_text_field( $value ) ); |
58 | 58 | |
59 | 59 | if ( isset( $block_to_shortcode_attributes_map[ $attribute ] ) && ! empty( $value ) ) { |
60 | - $shortcode_attributes[] = "{$block_to_shortcode_attributes_map[$attribute]}={$value}"; |
|
60 | + $shortcode_attributes[ ] = "{$block_to_shortcode_attributes_map[ $attribute ]}={$value}"; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string $output |
35 | 35 | */ |
36 | - static function render( $block_attributes = [] ) { |
|
36 | + static function render( $block_attributes = [ ] ) { |
|
37 | 37 | $block_to_shortcode_attributes_map = [ |
38 | 38 | 'viewId' => 'view_id', |
39 | 39 | 'entryId' => 'entry_id', |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | 'fieldSettingOverrides' => 'field_setting_overrides', |
42 | 42 | ]; |
43 | 43 | |
44 | - $shortcode_attributes = []; |
|
44 | + $shortcode_attributes = [ ]; |
|
45 | 45 | |
46 | 46 | foreach ( $block_attributes as $attribute => $value ) { |
47 | 47 | $value = esc_attr( sanitize_text_field( $value ) ); |
48 | 48 | |
49 | 49 | if ( isset( $block_to_shortcode_attributes_map[ $attribute ] ) && ! empty( $value ) ) { |
50 | 50 | if ( 'field_setting_overrides' === $attribute ) { |
51 | - $shortcode_attributes[] = "{$value}"; |
|
51 | + $shortcode_attributes[ ] = "{$value}"; |
|
52 | 52 | } else { |
53 | - $shortcode_attributes[] = sprintf( '%s="%s"', $block_to_shortcode_attributes_map[ $attribute ], $value ); |
|
53 | + $shortcode_attributes[ ] = sprintf( '%s="%s"', $block_to_shortcode_attributes_map[ $attribute ], $value ); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |