@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | private function add_hooks() { |
38 | 38 | /** @see \GV\Field::get_value_filters */ |
39 | 39 | add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 ); |
40 | - add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 ); |
|
40 | + add_action( 'gravityview/template/after', array( $this, 'print_script' ), 10, 1 ); |
|
41 | 41 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
42 | 42 | } |
43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function add_default_field( $entry_default_fields = array(), $form = array(), $zone = '' ) { |
54 | 54 | |
55 | - if( 'edit' !== $zone ) { |
|
55 | + if ( 'edit' !== $zone ) { |
|
56 | 56 | $entry_default_fields[ $this->name ] = array( |
57 | 57 | 'label' => $this->label, |
58 | 58 | 'desc' => $this->description, |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function get_content( $output, $template ) { |
77 | 77 | $entry = $template->entry; |
78 | 78 | |
79 | - $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png'; |
|
79 | + $star_url = GFCommon::get_base_url() . '/images/star' . intval( $entry[ 'is_starred' ] ) . '.png'; |
|
80 | 80 | |
81 | 81 | $entry_id = ''; |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // if( $show_as_star ) |
88 | - $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'. intval( $entry['is_starred'] ) .'" src="'. esc_attr( $star_url ) .'" />'; |
|
88 | + $output = '<img class="gv-star-image" ' . $entry_id . ' data-is_starred="' . intval( $entry[ 'is_starred' ] ) . '" src="' . esc_attr( $star_url ) . '" />'; |
|
89 | 89 | |
90 | 90 | self::$has_star_field = true; |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function print_script( $context ) { |
104 | 104 | |
105 | - if( ! self::$has_star_field ) { |
|
105 | + if ( ! self::$has_star_field ) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | |
32 | 32 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
33 | 33 | |
34 | - if( 'edit' === $context ) { |
|
34 | + if ( 'edit' === $context ) { |
|
35 | 35 | return $field_options; |
36 | 36 | } |
37 | 37 | |
38 | - $this->add_field_support('date_display', $field_options ); |
|
38 | + $this->add_field_support( 'date_display', $field_options ); |
|
39 | 39 | |
40 | 40 | return $field_options; |
41 | 41 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
84 | 84 | |
85 | 85 | $date_field_output = ''; |
86 | - switch( $field_input_id ) { |
|
86 | + switch ( $field_input_id ) { |
|
87 | 87 | case 1: |
88 | 88 | $date_field_output = \GV\Utils::get( $parsed_date, 'day' ); |
89 | 89 | break; |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | |
25 | 25 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
26 | 26 | |
27 | - unset( $field_options['search_filter'] ); |
|
27 | + unset( $field_options[ 'search_filter' ] ); |
|
28 | 28 | |
29 | - if( 'edit' === $context ) { |
|
29 | + if ( 'edit' === $context ) { |
|
30 | 30 | return $field_options; |
31 | 31 | } |
32 | 32 | |
33 | - $add_options['link_to_file'] = array( |
|
33 | + $add_options[ 'link_to_file' ] = array( |
|
34 | 34 | 'type' => 'checkbox', |
35 | 35 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
36 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
36 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
37 | 37 | 'value' => false, |
38 | 38 | 'merge_tags' => false, |
39 | 39 | ); |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | $base_id = null; |
117 | 117 | |
118 | 118 | $is_single = gravityview_get_context() === 'single'; |
119 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
119 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
120 | 120 | $field_compat = $gravityview_view->getCurrentField(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $output_arr = array(); |
124 | 124 | |
125 | 125 | // Get an array of file paths for the field. |
126 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
126 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
127 | 127 | |
128 | 128 | // The $value JSON was probably truncated; let's check lead_detail_long. |
129 | 129 | if ( ! is_array( $file_paths ) ) { |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | // Process each file path |
140 | - foreach( $file_paths as $file_path ) { |
|
140 | + foreach ( $file_paths as $file_path ) { |
|
141 | 141 | |
142 | 142 | // If the site is HTTPS, use HTTPS |
143 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme( $file_path ); } |
|
143 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
144 | 144 | |
145 | 145 | // This is from Gravity Forms's code |
146 | 146 | $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $file_path_info = pathinfo( $file_path ); |
161 | 161 | |
162 | 162 | // If the field is set to link to the single entry, link to it. |
163 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field, $base_id ) : $file_path; |
|
163 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field, $base_id ) : $file_path; |
|
164 | 164 | |
165 | 165 | $html_format = NULL; |
166 | 166 | |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | |
171 | 171 | $image_atts = array( |
172 | 172 | 'src' => $file_path, |
173 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
174 | - 'alt' => $field_settings['label'], |
|
173 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
174 | + 'alt' => $field_settings[ 'label' ], |
|
175 | 175 | 'width' => ( $is_single ? NULL : 250 ) |
176 | 176 | ); |
177 | 177 | |
@@ -189,20 +189,20 @@ discard block |
||
189 | 189 | $content = $image->html(); |
190 | 190 | |
191 | 191 | // The new default content is the image, if it exists. If not, use the file name as the content. |
192 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
192 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
193 | 193 | |
194 | 194 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
195 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
195 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
196 | 196 | |
197 | 197 | |
198 | - switch( true ) { |
|
198 | + switch ( true ) { |
|
199 | 199 | |
200 | 200 | // Audio file |
201 | 201 | case in_array( $extension, wp_get_audio_extensions() ): |
202 | 202 | |
203 | 203 | $disable_lightbox = true; |
204 | 204 | |
205 | - if( shortcode_exists( 'audio' ) ) { |
|
205 | + if ( shortcode_exists( 'audio' ) ) { |
|
206 | 206 | |
207 | 207 | $disable_wrapped_link = true; |
208 | 208 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
217 | 217 | 'src' => $file_path, |
218 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
218 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
219 | 219 | ), $context ); |
220 | 220 | |
221 | 221 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | $disable_lightbox = true; |
236 | 236 | |
237 | - if( shortcode_exists( 'video' ) ) { |
|
237 | + if ( shortcode_exists( 'video' ) ) { |
|
238 | 238 | |
239 | 239 | $disable_wrapped_link = true; |
240 | 240 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
249 | 249 | 'src' => $file_path, |
250 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
250 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
251 | 251 | ), $context ); |
252 | 252 | |
253 | 253 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | break; |
271 | 271 | |
272 | 272 | // if not image, do not set the lightbox (@since 1.5.3) |
273 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
273 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
274 | 274 | |
275 | 275 | $disable_lightbox = true; |
276 | 276 | |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | // If using Link to File, override the content. |
282 | 282 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
283 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
283 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
284 | 284 | |
285 | 285 | // Force the content to be the file name |
286 | - $content = $file_path_info["basename"]; |
|
286 | + $content = $file_path_info[ "basename" ]; |
|
287 | 287 | |
288 | 288 | // Restore the wrapped link |
289 | 289 | $disable_wrapped_link = false; |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | // Whether to use lightbox or not |
294 | - if ( $disable_lightbox || ! $lightbox || ! empty( $field_settings['show_as_link'] ) ) { |
|
294 | + if ( $disable_lightbox || ! $lightbox || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
295 | 295 | |
296 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
296 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
297 | 297 | |
298 | 298 | } else { |
299 | 299 | |
300 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
300 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
301 | 301 | |
302 | 302 | $link_atts = array( |
303 | 303 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $field_compat, $context ); |
328 | 328 | |
329 | 329 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
330 | - if ( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
330 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
331 | 331 | |
332 | 332 | /** |
333 | 333 | * Modify the link text (defaults to the file name) |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $content = gravityview_get_link( $link, $content, $link_atts ); |
345 | 345 | } |
346 | 346 | |
347 | - $output_arr[] = array( |
|
347 | + $output_arr[ ] = array( |
|
348 | 348 | 'file_path' => $file_path, |
349 | 349 | 'content' => $content |
350 | 350 | ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
50 | 50 | |
51 | 51 | /** Overridden by a template. */ |
52 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
52 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
53 | 53 | |
54 | 54 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
55 | 55 | $return = GFCommon::to_money( $amount, \GV\Utils::get( $entry, 'currency' ) ); |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
90 | 90 | */ |
91 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
91 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
92 | 92 | |
93 | 93 | $return = $text; |
94 | 94 | |
95 | 95 | foreach ( $matches as $match ) { |
96 | 96 | |
97 | - $full_tag = $match[0]; |
|
98 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
97 | + $full_tag = $match[ 0 ]; |
|
98 | + $modifier = isset( $match[ 1 ] ) ? $match[ 1 ] : false; |
|
99 | 99 | |
100 | 100 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
101 | 101 |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | function add_default_field( $entry_default_fields, $form, $zone ) { |
94 | 94 | |
95 | - if( 'edit' !== $zone ) { |
|
95 | + if ( 'edit' !== $zone ) { |
|
96 | 96 | $entry_default_fields[ $this->name ] = array( |
97 | 97 | 'label' => $this->label, |
98 | 98 | 'desc' => $this->description, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $merge_tags = array( |
119 | 119 | array( |
120 | - 'label' => __('Approval Status', 'gravityview'), |
|
120 | + 'label' => __( 'Approval Status', 'gravityview' ), |
|
121 | 121 | 'tag' => '{approval_status}' |
122 | 122 | ), |
123 | 123 | ); |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | gravityview()->log->error( 'No entry data available. Returning empty string.' ); |
158 | 158 | $replacement = ''; |
159 | 159 | } else { |
160 | - $replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[1] ); |
|
160 | + $replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[ 1 ] ); |
|
161 | 161 | } |
162 | 162 | |
163 | - $return = str_replace( $match[0], $replacement, $return ); |
|
163 | + $return = str_replace( $match[ 0 ], $replacement, $return ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return $return; |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | |
169 | 169 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
170 | 170 | |
171 | - $field_options['approved_label'] = array( |
|
171 | + $field_options[ 'approved_label' ] = array( |
|
172 | 172 | 'type' => 'text', |
173 | 173 | 'label' => __( 'Approved Label', 'gravityview' ), |
174 | 174 | 'desc' => __( 'If the entry is approved, display this value', 'gravityview' ), |
175 | - 'placeholder' => GravityView_Entry_Approval_Status::get_label('approved'), |
|
175 | + 'placeholder' => GravityView_Entry_Approval_Status::get_label( 'approved' ), |
|
176 | 176 | ); |
177 | 177 | |
178 | - $field_options['disapproved_label'] = array( |
|
178 | + $field_options[ 'disapproved_label' ] = array( |
|
179 | 179 | 'type' => 'text', |
180 | 180 | 'label' => __( 'Disapproved Label', 'gravityview' ), |
181 | 181 | 'desc' => __( 'If the entry is not approved, display this value', 'gravityview' ), |
182 | - 'placeholder' => GravityView_Entry_Approval_Status::get_label('disapproved'), |
|
182 | + 'placeholder' => GravityView_Entry_Approval_Status::get_label( 'disapproved' ), |
|
183 | 183 | ); |
184 | 184 | |
185 | - $field_options['unapproved_label'] = array( |
|
185 | + $field_options[ 'unapproved_label' ] = array( |
|
186 | 186 | 'type' => 'text', |
187 | 187 | 'label' => __( 'Unapproved Label', 'gravityview' ), |
188 | 188 | 'desc' => __( 'If the entry has not yet been approved or disapproved, display this value', 'gravityview' ), |
189 | - 'placeholder' => GravityView_Entry_Approval_Status::get_label('unapproved'), |
|
189 | + 'placeholder' => GravityView_Entry_Approval_Status::get_label( 'unapproved' ), |
|
190 | 190 | ); |
191 | 191 | |
192 | 192 | return $field_options; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $this->label = esc_attr__( 'Approve Entries', 'gravityview' ); |
26 | 26 | |
27 | - $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
27 | + $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
28 | 28 | |
29 | 29 | $this->add_hooks(); |
30 | 30 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
48 | 48 | |
49 | - unset( $field_options['only_loggedin'] ); |
|
49 | + unset( $field_options[ 'only_loggedin' ] ); |
|
50 | 50 | |
51 | - unset( $field_options['new_window'] ); |
|
51 | + unset( $field_options[ 'new_window' ] ); |
|
52 | 52 | |
53 | - unset( $field_options['show_as_link'] ); |
|
53 | + unset( $field_options[ 'show_as_link' ] ); |
|
54 | 54 | |
55 | 55 | return $field_options; |
56 | 56 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | add_action( 'gravityview/field/approval/load_scripts', array( $this, 'enqueue_and_localize_script' ) ); |
72 | 72 | |
73 | - add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
73 | + add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
74 | 74 | |
75 | 75 | add_filter( 'gravityview_get_entries', array( $this, 'modify_search_parameters' ), 1000 ); |
76 | 76 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function maybe_prevent_field_render( $html, $args ) { |
93 | 93 | |
94 | 94 | // If the field is `entry_approval` type but the user doesn't have the moderate entries cap, don't render. |
95 | - if( $this->name === \GV\Utils::get( $args['field'], 'id' ) && ! GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
95 | + if ( $this->name === \GV\Utils::get( $args[ 'field' ], 'id' ) && ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
96 | 96 | return ''; |
97 | 97 | } |
98 | 98 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public function modify_search_parameters( $parameters ) { |
123 | 123 | |
124 | 124 | if ( $this->name === \GV\Utils::get( $parameters, 'sorting/key' ) ) { |
125 | - $parameters['sorting']['key'] = 'is_approved'; |
|
125 | + $parameters[ 'sorting' ][ 'key' ] = 'is_approved'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | return $parameters; |
@@ -138,18 +138,18 @@ discard block |
||
138 | 138 | function register_scripts_and_styles() { |
139 | 139 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
140 | 140 | |
141 | - wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval'.$script_debug.'.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
141 | + wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval' . $script_debug . '.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
142 | 142 | |
143 | 143 | $style_path = GRAVITYVIEW_DIR . 'templates/css/field-approval.css'; |
144 | 144 | |
145 | - if( class_exists( 'GravityView_View' ) ) { |
|
145 | + if ( class_exists( 'GravityView_View' ) ) { |
|
146 | 146 | /** |
147 | 147 | * Override CSS file by placing in your theme's /gravityview/css/ sub-directory. |
148 | 148 | */ |
149 | 149 | $style_path = GravityView_View::getInstance()->locate_template( 'css/field-approval.css', false ); |
150 | 150 | } |
151 | 151 | |
152 | - $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
152 | + $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * @filter `gravityview/field/approval/css_url` URL to the Approval field CSS file. |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | $style_url = apply_filters( 'gravityview/field/approval/css_url', $style_url ); |
160 | 160 | |
161 | - if( ! empty( $style_url ) ) { |
|
161 | + if ( ! empty( $style_url ) ) { |
|
162 | 162 | wp_register_style( 'gravityview-field-approval', $style_url, array( 'dashicons' ), GravityView_Plugin::version, 'screen' ); |
163 | 163 | } |
164 | 164 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function enqueue_and_localize_script() { |
174 | 174 | |
175 | 175 | // The script is already registered and enqueued |
176 | - if( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
176 | + if ( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | |
184 | 184 | wp_localize_script( 'gravityview-field-approval', 'gvApproval', array( |
185 | 185 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
186 | - 'nonce' => wp_create_nonce('gravityview_entry_approval'), |
|
186 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
187 | 187 | 'status' => GravityView_Entry_Approval_Status::get_all(), |
188 | - )); |
|
188 | + ) ); |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function filter_gravityview_entry_default_field( $entry_default_fields, $form, $context ) { |
204 | 204 | |
205 | - if ( ! isset( $entry_default_fields["{$this->name}"] ) && 'edit' !== $context ) { |
|
206 | - $entry_default_fields["{$this->name}"] = array( |
|
205 | + if ( ! isset( $entry_default_fields[ "{$this->name}" ] ) && 'edit' !== $context ) { |
|
206 | + $entry_default_fields[ "{$this->name}" ] = array( |
|
207 | 207 | 'label' => $this->label, |
208 | 208 | 'desc' => $this->description, |
209 | 209 | 'type' => $this->name, |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function get_content( $output, $entry = array(), $field_settings = array(), $field = array() ) { |
61 | 61 | |
62 | 62 | /** Overridden by a template. */ |
63 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
63 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
64 | 64 | |
65 | 65 | return $this->get_string_from_value( $output ); |
66 | 66 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | switch ( intval( $value ) ) { |
93 | 93 | case self::NOT_FULFILLED: |
94 | 94 | default: |
95 | - $return = __('Not Fulfilled', 'gravityview'); |
|
95 | + $return = __( 'Not Fulfilled', 'gravityview' ); |
|
96 | 96 | break; |
97 | 97 | |
98 | 98 | case self::FULFILLED: |
99 | - $return = __('Fulfilled', 'gravityview'); |
|
99 | + $return = __( 'Fulfilled', 'gravityview' ); |
|
100 | 100 | break; |
101 | 101 | } |
102 | 102 | |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return string Original text if {is_fulfilled} isn't found. Otherwise, "Not Fulfilled" or "Fulfilled" |
118 | 118 | */ |
119 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
119 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
120 | 120 | |
121 | 121 | $return = $text; |
122 | 122 | |
123 | 123 | foreach ( $matches as $match ) { |
124 | 124 | |
125 | - $full_tag = $match[0]; |
|
125 | + $full_tag = $match[ 0 ]; |
|
126 | 126 | |
127 | 127 | $fulfilled = \GV\Utils::get( $entry, 'is_fulfilled' ); |
128 | 128 |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | |
135 | 135 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
136 | 136 | |
137 | - if( $this->entry_meta_key ) { |
|
137 | + if ( $this->entry_meta_key ) { |
|
138 | 138 | add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) ); |
139 | 139 | add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 ); |
140 | 140 | } |
141 | 141 | |
142 | - if( $this->_custom_merge_tag ) { |
|
142 | + if ( $this->_custom_merge_tag ) { |
|
143 | 143 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
144 | 144 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
145 | 145 | } |
146 | 146 | |
147 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
147 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
148 | 148 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
149 | 149 | } |
150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Auto-assign label from Gravity Forms label, if exists |
153 | 153 | * @since 1.20 |
154 | 154 | */ |
155 | - if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
155 | + if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) { |
|
156 | 156 | $this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() ); |
157 | 157 | } |
158 | 158 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | 'type' => $this->name |
176 | 176 | ); |
177 | 177 | |
178 | - $fields["{$this->entry_meta_key}"] = $added_field; |
|
178 | + $fields[ "{$this->entry_meta_key}" ] = $added_field; |
|
179 | 179 | |
180 | 180 | return $fields; |
181 | 181 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
197 | 197 | |
198 | - if( $this->name === $field['field'] && '' === $label ) { |
|
198 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
199 | 199 | $label = esc_html( $this->default_search_label ); |
200 | 200 | } |
201 | 201 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
218 | 218 | */ |
219 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
219 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
220 | 220 | |
221 | 221 | // Is there is field merge tag? Strip whitespace off the ned, too. |
222 | 222 | preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER ); |
@@ -249,19 +249,19 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
251 | 251 | |
252 | - foreach( $matches as $match ) { |
|
252 | + foreach ( $matches as $match ) { |
|
253 | 253 | |
254 | - $full_tag = $match[0]; |
|
254 | + $full_tag = $match[ 0 ]; |
|
255 | 255 | |
256 | 256 | // Strip the Merge Tags |
257 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
257 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
258 | 258 | |
259 | 259 | // Replace the value from the entry, if exists |
260 | - if( isset( $entry[ $tag ] ) ) { |
|
260 | + if ( isset( $entry[ $tag ] ) ) { |
|
261 | 261 | |
262 | 262 | $value = $entry[ $tag ]; |
263 | 263 | |
264 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
264 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
265 | 265 | $value = $this->get_content( $value ); |
266 | 266 | } |
267 | 267 | |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function _filter_sortable_fields( $not_sortable ) { |
336 | 336 | |
337 | - if( ! $this->is_sortable ) { |
|
338 | - $not_sortable[] = $this->name; |
|
337 | + if ( ! $this->is_sortable ) { |
|
338 | + $not_sortable[ ] = $this->name; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | return $not_sortable; |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | function add_entry_meta( $entry_meta ) { |
354 | 354 | |
355 | - if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) { |
|
355 | + if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) { |
|
356 | 356 | |
357 | 357 | $added_meta = array( |
358 | 358 | 'label' => $this->label, |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | ); |
362 | 362 | |
363 | 363 | if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) { |
364 | - $added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback; |
|
364 | + $added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback; |
|
365 | 365 | } |
366 | 366 | |
367 | - $entry_meta["{$this->entry_meta_key}"] = $added_meta; |
|
367 | + $entry_meta[ "{$this->entry_meta_key}" ] = $added_meta; |
|
368 | 368 | |
369 | 369 | } else { |
370 | - gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta["{$this->entry_meta_key}"] ) ); |
|
370 | + gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' => $entry_meta[ "{$this->entry_meta_key}" ] ) ); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | return $entry_meta; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | 'date_display' => array( |
397 | 397 | 'type' => 'text', |
398 | 398 | 'label' => __( 'Override Date Format', 'gravityview' ), |
399 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
399 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
400 | 400 | /** |
401 | 401 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
402 | 402 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | $options = $this->field_support_options(); |
423 | 423 | |
424 | - if( isset( $options[ $key ] ) ) { |
|
424 | + if ( isset( $options[ $key ] ) ) { |
|
425 | 425 | $field_options[ $key ] = $options[ $key ]; |
426 | 426 | } |
427 | 427 | |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | $connected_form = \GV\Utils::_POST( 'form_id' ); |
486 | 486 | |
487 | 487 | // Otherwise, get the Form ID from the Post page |
488 | - if( empty( $connected_form ) ) { |
|
488 | + if ( empty( $connected_form ) ) { |
|
489 | 489 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
490 | 490 | } |
491 | 491 | |
492 | - if( empty( $connected_form ) ) { |
|
492 | + if ( empty( $connected_form ) ) { |
|
493 | 493 | gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) ); |
494 | 494 | return false; |
495 | 495 | } |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total. |
52 | 52 | */ |
53 | - public function add_to_blacklist( $blacklist = array(), $context = NULL ){ |
|
53 | + public function add_to_blacklist( $blacklist = array(), $context = NULL ) { |
|
54 | 54 | |
55 | - if( empty( $context ) || $context !== 'edit' ) { |
|
55 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
56 | 56 | return $blacklist; |
57 | 57 | } |
58 | 58 | |
59 | - $blacklist[] = 'total'; |
|
59 | + $blacklist[ ] = 'total'; |
|
60 | 60 | |
61 | 61 | return $blacklist; |
62 | 62 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
76 | 76 | |
77 | - $original_form = GFAPI::get_form( $form['id'] ); |
|
77 | + $original_form = GFAPI::get_form( $form[ 'id' ] ); |
|
78 | 78 | |
79 | 79 | $total_fields = GFCommon::get_fields_by_type( $original_form, 'total' ); |
80 | 80 | |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | |
86 | 86 | /** @var GF_Field_Total $total_field */ |
87 | 87 | foreach ( $total_fields as $total_field ) { |
88 | - $entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry ); |
|
88 | + $entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $return_entry = GFAPI::update_entry( $entry ); |
92 | 92 | |
93 | - if( is_wp_error( $return_entry ) ) { |
|
93 | + if ( is_wp_error( $return_entry ) ) { |
|
94 | 94 | gravityview()->log->error( 'Updating the entry total fields failed', array( 'data' => $return_entry ) ); |
95 | 95 | } else { |
96 | 96 | gravityview()->log->debug( 'Updating the entry total fields succeeded' ); |