@@ -59,8 +59,8 @@ |
||
59 | 59 | |
60 | 60 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
61 | 61 | |
62 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
63 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
62 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
63 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
64 | 64 | |
65 | 65 | $sql = $wpdb->prepare( " |
66 | 66 | DELETE FROM $notes_table |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | * |
222 | 222 | * If the user doesn't have the `gravityview_support_port` capability, returns false; then |
223 | 223 | * If global setting is "hide", returns false; then |
224 | - * If user preference is not set, return global setting; then |
|
225 | - * If user preference is set, return that setting. |
|
224 | + * If user preference is not set, return global setting; then |
|
225 | + * If user preference is set, return that setting. |
|
226 | 226 | * |
227 | 227 | * @since 1.15 |
228 | - * @since 1.17.5 Changed behavior to respect global setting |
|
228 | + * @since 1.17.5 Changed behavior to respect global setting |
|
229 | 229 | * |
230 | 230 | * @param int $user Optional. ID of the user to check, defaults to 0 for current user. |
231 | 231 | * |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $global_setting = GravityView_Settings::getSetting( 'support_port' ); |
241 | 241 | |
242 | 242 | if ( empty( $global_setting ) ) { |
243 | - return false; |
|
243 | + return false; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // Get the per-user Support Port setting |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * Modifies the output of profile.php to add GravityView Support preference |
277 | 277 | * |
278 | 278 | * @since 1.15 |
279 | - * @since 1.17.5 Only show if global setting is active |
|
279 | + * @since 1.17.5 Only show if global setting is active |
|
280 | 280 | * |
281 | 281 | * @param WP_User $user Current user info |
282 | 282 | * |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $global_setting = GravityView_Settings::getSetting( 'support_port' ); |
288 | 288 | |
289 | 289 | if ( empty( $global_setting ) ) { |
290 | - return; |
|
290 | + return; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | ) ); |
108 | 108 | |
109 | 109 | // This is just HTML we don't need. |
110 | - unset( $response['message'] ); |
|
110 | + unset( $response[ 'message' ] ); |
|
111 | 111 | |
112 | - switch ( intval( $response['license_limit'] ) ) { |
|
112 | + switch ( intval( $response[ 'license_limit' ] ) ) { |
|
113 | 113 | case 1: |
114 | 114 | $package = 'Sol'; |
115 | 115 | break; |
@@ -120,24 +120,24 @@ discard block |
||
120 | 120 | $package = 'Interstellar'; |
121 | 121 | break; |
122 | 122 | default: |
123 | - $package = sprintf( '%d-Site License', $response['license_limit'] ); |
|
123 | + $package = sprintf( '%d-Site License', $response[ 'license_limit' ] ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | $data = array( |
127 | 127 | 'email' => GravityView_Settings::getSetting( 'support-email' ), |
128 | - 'name' => $response['customer_name'], |
|
129 | - 'Valid License?' => ucwords( $response['license'] ), |
|
130 | - 'License Key' => $response['license_key'], |
|
128 | + 'name' => $response[ 'customer_name' ], |
|
129 | + 'Valid License?' => ucwords( $response[ 'license' ] ), |
|
130 | + 'License Key' => $response[ 'license_key' ], |
|
131 | 131 | 'License Level' => $package, |
132 | 132 | 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
133 | 133 | 'Support Email' => GravityView_Settings::getSetting( 'support-email' ), |
134 | - 'License Limit' => $response['license_limit'], |
|
135 | - 'Site Count' => $response['site_count'], |
|
136 | - 'License Expires' => $response['expires'], |
|
137 | - 'Activations Left' => $response['activations_left'], |
|
138 | - 'Payment ID' => $response['payment_id'], |
|
139 | - 'Payment Name' => $response['customer_name'], |
|
140 | - 'Payment Email' => $response['customer_email'], |
|
134 | + 'License Limit' => $response[ 'license_limit' ], |
|
135 | + 'Site Count' => $response[ 'site_count' ], |
|
136 | + 'License Expires' => $response[ 'expires' ], |
|
137 | + 'Activations Left' => $response[ 'activations_left' ], |
|
138 | + 'Payment ID' => $response[ 'payment_id' ], |
|
139 | + 'Payment Name' => $response[ 'customer_name' ], |
|
140 | + 'Payment Email' => $response[ 'customer_email' ], |
|
141 | 141 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
142 | 142 | 'PHP Version' => phpversion(), |
143 | 143 | 'GravityView Version' => GravityView_Plugin::version, |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
265 | + if( GFCommon::is_product_field( $field['type'] ) ) { |
|
266 | 266 | $has_product_fields = true; |
267 | 267 | } |
268 | 268 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | $fields = array(); |
324 | 324 | |
325 | - foreach ( $extra_fields as $key => $field ){ |
|
325 | + foreach ( $extra_fields as $key => $field ) { |
|
326 | 326 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
327 | 327 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
328 | 328 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
889 | 889 | */ |
890 | 890 | public static function get_field( $form, $field_id ) { |
891 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
891 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
892 | 892 | return GFFormsModel::get_field( $form, $field_id ); |
893 | 893 | } else { |
894 | 894 | return null; |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | $shortcodes = array(); |
936 | 936 | |
937 | 937 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
938 | - if ( empty( $matches ) ){ |
|
938 | + if ( empty( $matches ) ) { |
|
939 | 939 | return false; |
940 | 940 | } |
941 | 941 |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * Return array of fields' id and label, for a given Form ID |
218 | 218 | * |
219 | 219 | * @access public |
220 | - * @param string|array $form_id (default: '') or $form object |
|
220 | + * @param string|array $form (default: '') or $form object |
|
221 | 221 | * @param bool $add_default_properties |
222 | 222 | * @param bool $include_parent_field |
223 | 223 | * @return array |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | * |
883 | 883 | * @param array $form Gravity Forms form array |
884 | 884 | * @param string $field_id ID of the field. If an input, full input ID (like `1.3`) |
885 | - * @param string|array $field_value Raw value of the field. |
|
885 | + * @param string $field_value Raw value of the field. |
|
886 | 886 | * @return string |
887 | 887 | */ |
888 | 888 | public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) { |
@@ -1514,6 +1514,7 @@ discard block |
||
1514 | 1514 | * @param string $notice text/HTML of notice |
1515 | 1515 | * @param string $class CSS class for notice (`updated` or `error`) |
1516 | 1516 | * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
1517 | + * @param integer $object_id |
|
1517 | 1518 | * |
1518 | 1519 | * @return string |
1519 | 1520 | */ |
@@ -1557,9 +1558,9 @@ discard block |
||
1557 | 1558 | * @param string $message Message body (required) |
1558 | 1559 | * @param string $from_name Displayed name of the sender |
1559 | 1560 | * @param string $message_format If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html". |
1560 | - * @param string|array $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
1561 | + * @param string $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
1561 | 1562 | * @param array|false $entry Gravity Forms entry array, related to the email. Default: false. |
1562 | - * @param array|false $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
1563 | + * @param boolean $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
1563 | 1564 | */ |
1564 | 1565 | public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) { |
1565 | 1566 |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @hack |
|
256 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
257 | - */ |
|
255 | + * @hack |
|
256 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
257 | + */ |
|
258 | 258 | if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
259 | - continue; |
|
260 | - } |
|
259 | + continue; |
|
260 | + } |
|
261 | 261 | $fields["{$input['id']}"] = array( |
262 | 262 | 'label' => rgar( $input, 'label' ), |
263 | 263 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
435 | 435 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
436 | 436 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
437 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
437 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
438 | 438 | $criteria['context_view_id'] = null; |
439 | 439 | } |
440 | 440 | |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | ), |
1197 | 1197 | ); |
1198 | 1198 | |
1199 | - $fields = $date_created + $fields; |
|
1199 | + $fields = $date_created + $fields; |
|
1200 | 1200 | |
1201 | 1201 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1202 | 1202 | |
@@ -1208,13 +1208,13 @@ discard block |
||
1208 | 1208 | } |
1209 | 1209 | } |
1210 | 1210 | |
1211 | - /** |
|
1212 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1213 | - * @since 1.12 |
|
1214 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
1215 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
1216 | - */ |
|
1217 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1211 | + /** |
|
1212 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1213 | + * @since 1.12 |
|
1214 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
1215 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
1216 | + */ |
|
1217 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1218 | 1218 | |
1219 | 1219 | return $fields; |
1220 | 1220 | } |
@@ -1506,26 +1506,26 @@ discard block |
||
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | |
1509 | - /** |
|
1510 | - * Display updated/error notice |
|
1511 | - * |
|
1512 | - * @since 1.19.2 Added $cap and $object_id parameters |
|
1513 | - * |
|
1514 | - * @param string $notice text/HTML of notice |
|
1515 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
1516 | - * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1517 | - * |
|
1518 | - * @return string |
|
1519 | - */ |
|
1520 | - public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1521 | - |
|
1522 | - // If $cap is defined, only show notice if user has capability |
|
1523 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1524 | - return ''; |
|
1525 | - } |
|
1526 | - |
|
1527 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1528 | - } |
|
1509 | + /** |
|
1510 | + * Display updated/error notice |
|
1511 | + * |
|
1512 | + * @since 1.19.2 Added $cap and $object_id parameters |
|
1513 | + * |
|
1514 | + * @param string $notice text/HTML of notice |
|
1515 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
1516 | + * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
1517 | + * |
|
1518 | + * @return string |
|
1519 | + */ |
|
1520 | + public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
1521 | + |
|
1522 | + // If $cap is defined, only show notice if user has capability |
|
1523 | + if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1524 | + return ''; |
|
1525 | + } |
|
1526 | + |
|
1527 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1528 | + } |
|
1529 | 1529 | |
1530 | 1530 | /** |
1531 | 1531 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | |
127 | 127 | $form = false; |
128 | 128 | |
129 | - if( $entry ) { |
|
130 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
129 | + if ( $entry ) { |
|
130 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $form; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
188 | 188 | |
189 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
189 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
190 | 190 | |
191 | 191 | return $result; |
192 | 192 | } |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
205 | 205 | */ |
206 | - public static function get_forms( $active = true, $trash = false ) { |
|
206 | + public static function get_forms( $active = true, $trash = false ) { |
|
207 | 207 | $forms = array(); |
208 | 208 | if ( class_exists( 'GFAPI' ) ) { |
209 | - if( 'any' === $active ) { |
|
209 | + if ( 'any' === $active ) { |
|
210 | 210 | $active_forms = GFAPI::get_forms( true, $trash ); |
211 | 211 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
212 | 212 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | $has_post_fields = false; |
238 | 238 | |
239 | 239 | if ( $form ) { |
240 | - foreach ( $form['fields'] as $field ) { |
|
241 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
242 | - $fields["{$field['id']}"] = array( |
|
240 | + foreach ( $form[ 'fields' ] as $field ) { |
|
241 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
242 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
243 | 243 | 'label' => rgar( $field, 'label' ), |
244 | 244 | 'parent' => null, |
245 | 245 | 'type' => rgar( $field, 'type' ), |
@@ -248,10 +248,10 @@ discard block |
||
248 | 248 | ); |
249 | 249 | } |
250 | 250 | |
251 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
252 | - foreach ( $field['inputs'] as $input ) { |
|
251 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
252 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
253 | 253 | |
254 | - if( ! empty( $input['isHidden'] ) ) { |
|
254 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
255 | 255 | continue; |
256 | 256 | } |
257 | 257 | |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | * @hack |
260 | 260 | * In case of email/email confirmation, the input for email has the same id as the parent field |
261 | 261 | */ |
262 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
262 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
263 | 263 | continue; |
264 | 264 | } |
265 | - $fields["{$input['id']}"] = array( |
|
265 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
266 | 266 | 'label' => rgar( $input, 'label' ), |
267 | 267 | 'customLabel' => rgar( $input, 'customLabel' ), |
268 | 268 | 'parent' => $field, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | |
277 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
277 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
278 | 278 | $has_product_fields = true; |
279 | 279 | } |
280 | 280 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @since 1.7 |
289 | 289 | */ |
290 | 290 | if ( $has_post_fields ) { |
291 | - $fields['post_id'] = array( |
|
291 | + $fields[ 'post_id' ] = array( |
|
292 | 292 | 'label' => __( 'Post ID', 'gravityview' ), |
293 | 293 | 'type' => 'post_id', |
294 | 294 | ); |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
300 | 300 | |
301 | 301 | foreach ( $payment_fields as $payment_field ) { |
302 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
302 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
303 | 303 | continue; |
304 | 304 | } |
305 | - $fields["{$payment_field->name}"] = array( |
|
305 | + $fields[ "{$payment_field->name}" ] = array( |
|
306 | 306 | 'label' => $payment_field->label, |
307 | 307 | 'desc' => $payment_field->description, |
308 | 308 | 'type' => $payment_field->name, |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | |
335 | 335 | $fields = array(); |
336 | 336 | |
337 | - foreach ( $extra_fields as $key => $field ){ |
|
338 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
339 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
337 | + foreach ( $extra_fields as $key => $field ) { |
|
338 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
339 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
@@ -376,32 +376,32 @@ discard block |
||
376 | 376 | 'search_criteria' => null, |
377 | 377 | 'sorting' => null, |
378 | 378 | 'paging' => null, |
379 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
379 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
380 | 380 | ); |
381 | 381 | |
382 | 382 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
383 | 383 | |
384 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
385 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
384 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
385 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
386 | 386 | |
387 | 387 | if ( ! is_array( $filter ) ) { |
388 | 388 | continue; |
389 | 389 | } |
390 | 390 | |
391 | 391 | // By default, we want searches to be wildcard for each field. |
392 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
392 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
393 | 393 | |
394 | 394 | /** |
395 | 395 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
396 | 396 | * @param string $operator Existing search operator |
397 | 397 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
398 | 398 | */ |
399 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
399 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | // don't send just the [mode] without any field filter. |
403 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
404 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
403 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
404 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | } |
@@ -412,21 +412,21 @@ discard block |
||
412 | 412 | * Prepare date formats to be in Gravity Forms DB format; |
413 | 413 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
414 | 414 | */ |
415 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
415 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
416 | 416 | |
417 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
417 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
418 | 418 | |
419 | 419 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
420 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
420 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
421 | 421 | |
422 | 422 | if ( $date ) { |
423 | 423 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
424 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
424 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
425 | 425 | } else { |
426 | 426 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
427 | - unset( $criteria['search_criteria'][ $key ] ); |
|
427 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
428 | 428 | |
429 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
429 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | } |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | |
435 | 435 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
436 | 436 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
437 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
437 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
438 | 438 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
439 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
440 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
439 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
440 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
441 | 441 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
442 | - $criteria['context_view_id'] = null; |
|
442 | + $criteria[ 'context_view_id' ] = null; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @param array $form_ids Forms to search |
449 | 449 | * @param int $view_id ID of the view being used to search |
450 | 450 | */ |
451 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
451 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
452 | 452 | |
453 | 453 | return (array)$criteria; |
454 | 454 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | /** Reduce # of database calls */ |
480 | 480 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
481 | 481 | |
482 | - if ( ! empty( $criteria['cache'] ) ) { |
|
482 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
483 | 483 | |
484 | 484 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
485 | 485 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | |
488 | 488 | // Still update the total count when using cached results |
489 | 489 | if ( ! is_null( $total ) ) { |
490 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
490 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | $return = $entries; |
@@ -507,9 +507,9 @@ discard block |
||
507 | 507 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
508 | 508 | |
509 | 509 | // No entries returned from gravityview_before_get_entries |
510 | - if( is_null( $entries ) ) { |
|
510 | + if ( is_null( $entries ) ) { |
|
511 | 511 | |
512 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
512 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
513 | 513 | |
514 | 514 | if ( is_wp_error( $entries ) ) { |
515 | 515 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
521 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
521 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
522 | 522 | |
523 | 523 | // Cache results |
524 | 524 | $Cache->set( $entries, 'entries' ); |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | */ |
624 | 624 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
625 | 625 | |
626 | - if( $check_entry_display ) { |
|
626 | + if ( $check_entry_display ) { |
|
627 | 627 | // Is the entry allowed |
628 | 628 | $entry = self::check_entry_display( $entry ); |
629 | 629 | } |
@@ -656,12 +656,12 @@ discard block |
||
656 | 656 | |
657 | 657 | $value = false; |
658 | 658 | |
659 | - if( 'context' === $val1 ) { |
|
659 | + if ( 'context' === $val1 ) { |
|
660 | 660 | |
661 | 661 | $matching_contexts = array( $val2 ); |
662 | 662 | |
663 | 663 | // We allow for non-standard contexts. |
664 | - switch( $val2 ) { |
|
664 | + switch ( $val2 ) { |
|
665 | 665 | // Check for either single or edit |
666 | 666 | case 'singular': |
667 | 667 | $matching_contexts = array( 'single', 'edit' ); |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | return false; |
722 | 722 | } |
723 | 723 | |
724 | - if ( empty( $entry['form_id'] ) ) { |
|
724 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
725 | 725 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
726 | 726 | return false; |
727 | 727 | } |
@@ -729,26 +729,26 @@ discard block |
||
729 | 729 | $criteria = self::calculate_get_entries_criteria(); |
730 | 730 | |
731 | 731 | // Make sure the current View is connected to the same form as the Entry |
732 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
733 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
732 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
733 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
734 | 734 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
735 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
736 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
735 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
736 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
737 | 737 | return false; |
738 | 738 | } |
739 | 739 | } |
740 | 740 | |
741 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
741 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
742 | 742 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
743 | 743 | return $entry; |
744 | 744 | } |
745 | 745 | |
746 | - $search_criteria = $criteria['search_criteria']; |
|
746 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
747 | 747 | unset( $criteria ); |
748 | 748 | |
749 | 749 | // check entry status |
750 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
751 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
750 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
751 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
752 | 752 | return false; |
753 | 753 | } |
754 | 754 | |
@@ -756,40 +756,40 @@ discard block |
||
756 | 756 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
757 | 757 | |
758 | 758 | // field_filters |
759 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
759 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
760 | 760 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
761 | 761 | return $entry; |
762 | 762 | } |
763 | 763 | |
764 | - $filters = $search_criteria['field_filters']; |
|
764 | + $filters = $search_criteria[ 'field_filters' ]; |
|
765 | 765 | unset( $search_criteria ); |
766 | 766 | |
767 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
768 | - unset( $filters['mode'] ); |
|
767 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
768 | + unset( $filters[ 'mode' ] ); |
|
769 | 769 | |
770 | - $form = self::get_form( $entry['form_id'] ); |
|
770 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
771 | 771 | |
772 | 772 | foreach ( $filters as $filter ) { |
773 | 773 | |
774 | - if ( ! isset( $filter['key'] ) ) { |
|
774 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
775 | 775 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter ); |
776 | 776 | continue; |
777 | 777 | } |
778 | 778 | |
779 | - $k = $filter['key']; |
|
779 | + $k = $filter[ 'key' ]; |
|
780 | 780 | |
781 | 781 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
782 | 782 | $field_value = $entry[ $k ]; |
783 | 783 | $field = null; |
784 | 784 | } else { |
785 | 785 | $field = self::get_field( $form, $k ); |
786 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
786 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
787 | 787 | // If it's a complex field, then fetch the input's value |
788 | 788 | $field_value = is_array( $field_value ) ? rgar( $field_value, $k ) : $field_value; |
789 | 789 | } |
790 | 790 | |
791 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
792 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
791 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
792 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
793 | 793 | |
794 | 794 | // verify if we are already free to go! |
795 | 795 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -847,18 +847,18 @@ discard block |
||
847 | 847 | * Gravity Forms code to adjust date to locally-configured Time Zone |
848 | 848 | * @see GFCommon::format_date() for original code |
849 | 849 | */ |
850 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
850 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
851 | 851 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
852 | 852 | |
853 | - $format = rgar( $atts, 'format' ); |
|
854 | - $is_human = ! empty( $atts['human'] ); |
|
855 | - $is_diff = ! empty( $atts['diff'] ); |
|
856 | - $is_raw = ! empty( $atts['raw'] ); |
|
857 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
858 | - $include_time = ! empty( $atts['time'] ); |
|
853 | + $format = rgar( $atts, 'format' ); |
|
854 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
855 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
856 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
857 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
858 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
859 | 859 | |
860 | 860 | // If we're using time diff, we want to have a different default format |
861 | - if( empty( $format ) ) { |
|
861 | + if ( empty( $format ) ) { |
|
862 | 862 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
863 | 863 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
864 | 864 | } |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | // If raw was specified, don't modify the stored value |
867 | 867 | if ( $is_raw ) { |
868 | 868 | $formatted_date = $date_string; |
869 | - } elseif( $is_timestamp ) { |
|
869 | + } elseif ( $is_timestamp ) { |
|
870 | 870 | $formatted_date = $date_local_timestamp; |
871 | 871 | } elseif ( $is_diff ) { |
872 | 872 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | |
901 | 901 | $label = rgar( $field, 'label' ); |
902 | 902 | |
903 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
903 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
904 | 904 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
905 | 905 | } |
906 | 906 | |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $form = GFAPI::get_form( $form ); |
929 | 929 | } |
930 | 930 | |
931 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
931 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
932 | 932 | return GFFormsModel::get_field( $form, $field_id ); |
933 | 933 | } else { |
934 | 934 | return null; |
@@ -975,19 +975,19 @@ discard block |
||
975 | 975 | $shortcodes = array(); |
976 | 976 | |
977 | 977 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
978 | - if ( empty( $matches ) ){ |
|
978 | + if ( empty( $matches ) ) { |
|
979 | 979 | return false; |
980 | 980 | } |
981 | 981 | |
982 | 982 | foreach ( $matches as $shortcode ) { |
983 | - if ( $tag === $shortcode[2] ) { |
|
983 | + if ( $tag === $shortcode[ 2 ] ) { |
|
984 | 984 | |
985 | 985 | // Changed this to $shortcode instead of true so we get the parsed atts. |
986 | - $shortcodes[] = $shortcode; |
|
986 | + $shortcodes[ ] = $shortcode; |
|
987 | 987 | |
988 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
989 | - foreach( $results as $result ) { |
|
990 | - $shortcodes[] = $result; |
|
988 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
989 | + foreach ( $results as $result ) { |
|
990 | + $shortcodes[ ] = $result; |
|
991 | 991 | } |
992 | 992 | } |
993 | 993 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | public static function get_directory_fields( $post_id, $apply_filter = true ) { |
1132 | 1132 | $fields = get_post_meta( $post_id, '_gravityview_directory_fields', true ); |
1133 | 1133 | |
1134 | - if( $apply_filter ) { |
|
1134 | + if ( $apply_filter ) { |
|
1135 | 1135 | /** |
1136 | 1136 | * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
1137 | 1137 | * @since 1.6.5 |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | * @return string html |
1155 | 1155 | */ |
1156 | 1156 | public static function get_sortable_fields( $formid, $current = '' ) { |
1157 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1157 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1158 | 1158 | |
1159 | 1159 | if ( empty( $formid ) ) { |
1160 | 1160 | return $output; |
@@ -1167,11 +1167,11 @@ discard block |
||
1167 | 1167 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1168 | 1168 | |
1169 | 1169 | foreach ( $fields as $id => $field ) { |
1170 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1170 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1171 | 1171 | continue; |
1172 | 1172 | } |
1173 | 1173 | |
1174 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1174 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1175 | 1175 | } |
1176 | 1176 | } |
1177 | 1177 | |
@@ -1206,9 +1206,9 @@ discard block |
||
1206 | 1206 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1207 | 1207 | |
1208 | 1208 | // TODO: Convert to using array_filter |
1209 | - foreach( $fields as $id => $field ) { |
|
1209 | + foreach ( $fields as $id => $field ) { |
|
1210 | 1210 | |
1211 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1211 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1212 | 1212 | unset( $fields[ $id ] ); |
1213 | 1213 | } |
1214 | 1214 | } |
@@ -1249,14 +1249,14 @@ discard block |
||
1249 | 1249 | * @param int|array $field field key or field array |
1250 | 1250 | * @return boolean |
1251 | 1251 | */ |
1252 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1252 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1253 | 1253 | |
1254 | 1254 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1255 | 1255 | $form = self::get_form( $form ); |
1256 | 1256 | } |
1257 | 1257 | |
1258 | 1258 | // If entry meta, it's a string. Otherwise, numeric |
1259 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1259 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1260 | 1260 | $type = $field; |
1261 | 1261 | } else { |
1262 | 1262 | $type = self::get_field_type( $form, $field ); |
@@ -1270,9 +1270,9 @@ discard block |
||
1270 | 1270 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1271 | 1271 | |
1272 | 1272 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1273 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1274 | - if( true === $gv_field->is_numeric ) { |
|
1275 | - $numeric_types[] = $gv_field->is_numeric; |
|
1273 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1274 | + if ( true === $gv_field->is_numeric ) { |
|
1275 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | |
@@ -1422,18 +1422,18 @@ discard block |
||
1422 | 1422 | $final_atts = array_filter( $final_atts ); |
1423 | 1423 | |
1424 | 1424 | // If the href wasn't passed as an attribute, use the value passed to the function |
1425 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1426 | - $final_atts['href'] = $href; |
|
1425 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1426 | + $final_atts[ 'href' ] = $href; |
|
1427 | 1427 | } |
1428 | 1428 | |
1429 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1429 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1430 | 1430 | |
1431 | 1431 | /** |
1432 | 1432 | * Fix potential security issue with target=_blank |
1433 | 1433 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1434 | 1434 | */ |
1435 | - if( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1436 | - $final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1435 | + if ( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1436 | + $final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | // Sort the attributes alphabetically, to help testing |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1446 | 1446 | } |
1447 | 1447 | |
1448 | - if( '' !== $output ) { |
|
1448 | + if ( '' !== $output ) { |
|
1449 | 1449 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1450 | 1450 | } |
1451 | 1451 | |
@@ -1472,7 +1472,7 @@ discard block |
||
1472 | 1472 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1473 | 1473 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1474 | 1474 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1475 | - $merged[] = $value; |
|
1475 | + $merged[ ] = $value; |
|
1476 | 1476 | } else { |
1477 | 1477 | $merged[ $key ] = $value; |
1478 | 1478 | } |
@@ -1505,7 +1505,7 @@ discard block |
||
1505 | 1505 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1506 | 1506 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1507 | 1507 | */ |
1508 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1508 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1509 | 1509 | |
1510 | 1510 | return get_users( $get_users_settings ); |
1511 | 1511 | } |
@@ -1525,11 +1525,11 @@ discard block |
||
1525 | 1525 | public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
1526 | 1526 | |
1527 | 1527 | // If $cap is defined, only show notice if user has capability |
1528 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1528 | + if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1529 | 1529 | return ''; |
1530 | 1530 | } |
1531 | 1531 | |
1532 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1532 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
267 | 267 | * @access public |
268 | - * @return void|boolean |
|
268 | + * @return false|null |
|
269 | 269 | */ |
270 | 270 | public function process_bulk_action() { |
271 | 271 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
363 | 363 | * @see GravityView_Entry_Approval::get_approved_column |
364 | 364 | * |
365 | - * @param mixed $form GF Form or Form ID |
|
365 | + * @param integer $form GF Form or Form ID |
|
366 | 366 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
367 | 367 | */ |
368 | 368 | static public function get_approved_column( $form ) { |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | /** |
347 | 347 | * update_approved function. |
348 | 348 | * |
349 | - * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
349 | + * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
350 | 350 | * @see GravityView_Entry_Approval::update_approved |
351 | - * |
|
351 | + * |
|
352 | 352 | * @param int $entry_id (default: 0) |
353 | 353 | * @param int $approved (default: 0) |
354 | 354 | * @param int $form_id (default: 0) |
355 | 355 | * @param int $approvedcolumn (default: 0) |
356 | - * |
|
356 | + * |
|
357 | 357 | * @return boolean True: It worked; False: it failed |
358 | 358 | */ |
359 | 359 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | /** |
364 | 364 | * Calculate the approve field.input id |
365 | 365 | * |
366 | - * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
367 | - * @see GravityView_Entry_Approval::get_approved_column |
|
368 | - * |
|
366 | + * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
367 | + * @see GravityView_Entry_Approval::get_approved_column |
|
368 | + * |
|
369 | 369 | * @param mixed $form GF Form or Form ID |
370 | 370 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
371 | 371 | */ |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
488 | 488 | 'bulk_message' => $this->bulk_update_message, |
489 | 489 | 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
490 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
490 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
491 | 491 | 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
492 | 492 | 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
493 | 493 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
@@ -496,11 +496,11 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | /** |
499 | - * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
500 | - * |
|
501 | - * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
502 | - * numeric, but it does group the approved entries together. |
|
503 | - * |
|
499 | + * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
500 | + * |
|
501 | + * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
502 | + * numeric, but it does group the approved entries together. |
|
503 | + * |
|
504 | 504 | * @param int $form_id |
505 | 505 | * |
506 | 506 | * @return string Sorting link |
@@ -510,20 +510,20 @@ discard block |
||
510 | 510 | $approved_column_id = self::get_approved_column( $form_id ); |
511 | 511 | |
512 | 512 | if( ! $approved_column_id ) { |
513 | - return ''; |
|
514 | - } |
|
513 | + return ''; |
|
514 | + } |
|
515 | 515 | |
516 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
516 | + $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
517 | 517 | |
518 | - $args = array( |
|
519 | - 'orderby' => $approved_column_id, |
|
520 | - 'order' => $order, |
|
521 | - ); |
|
518 | + $args = array( |
|
519 | + 'orderby' => $approved_column_id, |
|
520 | + 'order' => $order, |
|
521 | + ); |
|
522 | 522 | |
523 | - $link = add_query_arg( $args ); |
|
523 | + $link = add_query_arg( $args ); |
|
524 | 524 | |
525 | 525 | return $link; |
526 | - } |
|
526 | + } |
|
527 | 527 | |
528 | 528 | /** |
529 | 529 | * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** gf_entries page - entries table screen */ |
45 | 45 | |
46 | 46 | // capture bulk actions |
47 | - add_action( 'gform_loaded', array( $this, 'process_bulk_action') ); |
|
47 | + add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) ); |
|
48 | 48 | |
49 | 49 | // add hidden field with approve status |
50 | 50 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
53 | 53 | |
54 | 54 | // adding styles and scripts |
55 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
55 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
56 | 56 | // bypass Gravity Forms no-conflict mode |
57 | 57 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
58 | 58 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
82 | 82 | * @param array $form GF Form object of current form |
83 | 83 | */ |
84 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
84 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
85 | 85 | return $filter_links; |
86 | 86 | } |
87 | 87 | |
@@ -102,19 +102,19 @@ discard block |
||
102 | 102 | $approved_count = $disapproved_count = 0; |
103 | 103 | |
104 | 104 | // Only count if necessary |
105 | - if( $include_counts ) { |
|
106 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
107 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
105 | + if ( $include_counts ) { |
|
106 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
107 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
108 | 108 | } |
109 | 109 | |
110 | - $filter_links[] = array( |
|
110 | + $filter_links[ ] = array( |
|
111 | 111 | 'id' => 'gv_approved', |
112 | 112 | 'field_filters' => $field_filters_approved, |
113 | 113 | 'count' => $approved_count, |
114 | 114 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ), |
115 | 115 | ); |
116 | 116 | |
117 | - $filter_links[] = array( |
|
117 | + $filter_links[ ] = array( |
|
118 | 118 | 'id' => 'gv_disapproved', |
119 | 119 | 'field_filters' => $field_filters_disapproved, |
120 | 120 | 'count' => $disapproved_count, |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | */ |
134 | 134 | function tooltips( $tooltips ) { |
135 | 135 | |
136 | - $tooltips['form_gravityview_fields'] = array( |
|
137 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
138 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
136 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
137 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
138 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
139 | 139 | ); |
140 | 140 | |
141 | 141 | return $tooltips; |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | |
247 | 247 | $gv_bulk_action = false; |
248 | 248 | |
249 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
250 | - $bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2'); |
|
249 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
250 | + $bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' ); |
|
251 | 251 | } else { |
252 | 252 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
253 | - $bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2'); |
|
253 | + $bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
257 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
257 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
258 | 258 | $gv_bulk_action = $bulk_action; |
259 | 259 | } |
260 | 260 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // gforms_entry_list is the nonce that confirms we're on the right page |
281 | 281 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
282 | - if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) { |
|
282 | + if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
283 | 283 | |
284 | 284 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
285 | 285 | |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | // All entries are set to be updated, not just the visible ones |
300 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
300 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
301 | 301 | |
302 | 302 | // Convert the current entry search into GF-formatted search criteria |
303 | 303 | $search = array( |
304 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
305 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
306 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
304 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
305 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
306 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
307 | 307 | ); |
308 | 308 | |
309 | 309 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | } else { |
315 | 315 | |
316 | 316 | // Changed from 'lead' to 'entry' in 2.0 |
317 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
317 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
318 | 318 | |
319 | 319 | } |
320 | 320 | |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
327 | 327 | |
328 | 328 | switch ( $approved_status ) { |
329 | - case $this->bulk_action_prefixes['approve']: |
|
329 | + case $this->bulk_action_prefixes[ 'approve' ]: |
|
330 | 330 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id ); |
331 | 331 | $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
332 | 332 | break; |
333 | - case $this->bulk_action_prefixes['unapprove']: |
|
333 | + case $this->bulk_action_prefixes[ 'unapprove' ]: |
|
334 | 334 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id ); |
335 | 335 | $this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count ); |
336 | 336 | break; |
337 | - case $this->bulk_action_prefixes['disapprove']: |
|
337 | + case $this->bulk_action_prefixes[ 'disapprove' ]: |
|
338 | 338 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id ); |
339 | 339 | $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
340 | 340 | break; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @return boolean True: It worked; False: it failed |
358 | 358 | */ |
359 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
359 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
360 | 360 | return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn ); |
361 | 361 | } |
362 | 362 | |
@@ -386,20 +386,20 @@ discard block |
||
386 | 386 | * |
387 | 387 | * @return void |
388 | 388 | */ |
389 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
389 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
390 | 390 | |
391 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
391 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
392 | 392 | return; |
393 | 393 | } |
394 | 394 | |
395 | - if( empty( $entry['id'] ) ) { |
|
395 | + if ( empty( $entry[ 'id' ] ) ) { |
|
396 | 396 | return; |
397 | 397 | } |
398 | 398 | |
399 | 399 | $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' ); |
400 | 400 | |
401 | - if( $status_value ) { |
|
402 | - echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />'; |
|
401 | + if ( $status_value ) { |
|
402 | + echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />'; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -412,10 +412,10 @@ discard block |
||
412 | 412 | */ |
413 | 413 | private function get_form_id() { |
414 | 414 | |
415 | - $form_id = GFForms::get('id'); |
|
415 | + $form_id = GFForms::get( 'id' ); |
|
416 | 416 | |
417 | 417 | // If there are no forms identified, use the first form. That's how GF does it. |
418 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
418 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
419 | 419 | $form_id = $this->get_first_form_id(); |
420 | 420 | } |
421 | 421 | |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | |
436 | 436 | $forms = RGFormsModel::get_forms( null, 'title' ); |
437 | 437 | |
438 | - if( ! isset( $forms[0] ) ) { |
|
438 | + if ( ! isset( $forms[ 0 ] ) ) { |
|
439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' ); |
440 | 440 | return 0; |
441 | 441 | } |
442 | 442 | |
443 | - $first_form = $forms[0]; |
|
443 | + $first_form = $forms[ 0 ]; |
|
444 | 444 | |
445 | - $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id']; |
|
445 | + $form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ]; |
|
446 | 446 | |
447 | 447 | return intval( $form_id ); |
448 | 448 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | function add_scripts_and_styles( $hook ) { |
452 | 452 | |
453 | - if( ! class_exists( 'RGForms' ) ) { |
|
453 | + if ( ! class_exists( 'RGForms' ) ) { |
|
454 | 454 | |
455 | 455 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
456 | 456 | |
@@ -459,26 +459,26 @@ discard block |
||
459 | 459 | |
460 | 460 | // enqueue styles & scripts gf_entries |
461 | 461 | // But only if we're on the main Entries page, not on reports pages |
462 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
462 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
463 | 463 | return; |
464 | 464 | } |
465 | 465 | |
466 | 466 | $form_id = $this->get_form_id(); |
467 | 467 | |
468 | 468 | // Things are broken; no forms were found |
469 | - if( empty( $form_id ) ) { |
|
469 | + if ( empty( $form_id ) ) { |
|
470 | 470 | return; |
471 | 471 | } |
472 | 472 | |
473 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
473 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
474 | 474 | |
475 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
475 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
476 | 476 | |
477 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
477 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
478 | 478 | |
479 | 479 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
480 | - 'nonce' => wp_create_nonce( 'gravityview_entry_approval'), |
|
481 | - 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'), |
|
480 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
481 | + 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ), |
|
482 | 482 | 'form_id' => $form_id, |
483 | 483 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
484 | 484 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | 'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED, |
488 | 488 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
489 | 489 | 'bulk_message' => $this->bulk_update_message, |
490 | - 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
|
491 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
492 | - 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
|
493 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
490 | + 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ), |
|
491 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ), |
|
492 | + 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ), |
|
493 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
494 | 494 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
495 | 495 | ) ); |
496 | 496 | |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | |
511 | 511 | $approved_column_id = self::get_approved_column( $form_id ); |
512 | 512 | |
513 | - if( ! $approved_column_id ) { |
|
513 | + if ( ! $approved_column_id ) { |
|
514 | 514 | return ''; |
515 | 515 | } |
516 | 516 | |
517 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
517 | + $order = ( 'desc' === rgget( 'order' ) ) ? 'asc' : 'desc'; |
|
518 | 518 | |
519 | 519 | $args = array( |
520 | 520 | 'orderby' => $approved_column_id, |
@@ -540,16 +540,16 @@ discard block |
||
540 | 540 | $bulk_actions = array( |
541 | 541 | 'GravityView' => array( |
542 | 542 | array( |
543 | - 'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'), |
|
544 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ), |
|
543 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ), |
|
544 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ), |
|
545 | 545 | ), |
546 | 546 | array( |
547 | - 'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'), |
|
548 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ), |
|
547 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ), |
|
548 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ), |
|
549 | 549 | ), |
550 | 550 | array( |
551 | - 'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'), |
|
552 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ), |
|
551 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ), |
|
552 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
553 | 553 | ), |
554 | 554 | ), |
555 | 555 | ); |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | // Sanitize the values, just to be sure. |
567 | 567 | foreach ( $bulk_actions as $key => $group ) { |
568 | 568 | foreach ( $group as $i => $action ) { |
569 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
570 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
569 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
570 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
@@ -592,13 +592,13 @@ discard block |
||
592 | 592 | * @since 1.7.2 |
593 | 593 | * @param boolean $hide_if_no_connections |
594 | 594 | */ |
595 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
595 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
596 | 596 | |
597 | - if( $hide_if_no_connections ) { |
|
597 | + if ( $hide_if_no_connections ) { |
|
598 | 598 | |
599 | 599 | $connected_views = gravityview_get_connected_views( $form_id ); |
600 | 600 | |
601 | - if( empty( $connected_views ) ) { |
|
601 | + if ( empty( $connected_views ) ) { |
|
602 | 602 | $show_approve_column = false; |
603 | 603 | } |
604 | 604 | } |
@@ -608,18 +608,18 @@ discard block |
||
608 | 608 | * @param boolean $show_approve_column Whether the column will be shown |
609 | 609 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
610 | 610 | */ |
611 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
611 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
612 | 612 | |
613 | 613 | return $show_approve_column; |
614 | 614 | } |
615 | 615 | |
616 | 616 | function register_gform_noconflict_script( $scripts ) { |
617 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
617 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
618 | 618 | return $scripts; |
619 | 619 | } |
620 | 620 | |
621 | 621 | function register_gform_noconflict_style( $styles ) { |
622 | - $styles[] = 'gravityview_entries_list'; |
|
622 | + $styles[ ] = 'gravityview_entries_list'; |
|
623 | 623 | return $styles; |
624 | 624 | } |
625 | 625 |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
91 | + if ( empty( $views ) ) { |
|
92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
93 | 93 | return; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | $new_value = $old_value; |
114 | 114 | |
115 | 115 | // Meta value does not exist yet |
116 | - if( false === $old_value ) { |
|
116 | + if ( false === $old_value ) { |
|
117 | 117 | return self::UNAPPROVED; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Meta value does not exist yet |
121 | - if( true === $old_value ) { |
|
121 | + if ( true === $old_value ) { |
|
122 | 122 | return self::APPROVED; |
123 | 123 | } |
124 | 124 | |
125 | - switch ( (string) $old_value ) { |
|
125 | + switch ( (string)$old_value ) { |
|
126 | 126 | |
127 | 127 | // Approved values |
128 | 128 | case 'Approved': |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | foreach ( $choices as $key => $choice ) { |
248 | 248 | |
249 | 249 | // Is the passed status value the same as the choice value or key? |
250 | - if ( $status === $choice['value'] || $status === $key ) { |
|
250 | + if ( $status === $choice[ 'value' ] || $status === $key ) { |
|
251 | 251 | |
252 | - if( 'key' === $attr_key ) { |
|
252 | + if ( 'key' === $attr_key ) { |
|
253 | 253 | return $key; |
254 | 254 | } else { |
255 | 255 | return rgar( $choice, $attr_key, false ); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | // Load even when invalid to allow for export |
20 | 20 | add_action( 'init', array( 'GravityView_Post_Types', 'init_post_types' ) ); |
21 | 21 | |
22 | - if( GravityView_Compatibility::is_valid() ) { |
|
22 | + if ( GravityView_Compatibility::is_valid() ) { |
|
23 | 23 | add_action( 'init', array( 'GravityView_Post_Types', 'init_rewrite' ) ); |
24 | 24 | } |
25 | 25 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | $supports = array( 'title', 'revisions' ); |
45 | 45 | |
46 | - if( $is_hierarchical ) { |
|
47 | - $supports[] = 'page-attributes'; |
|
46 | + if ( $is_hierarchical ) { |
|
47 | + $supports[ ] = 'page-attributes'; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
81 | 81 | */ |
82 | - foreach( $this->lead_db_columns as $column ) { |
|
82 | + foreach ( $this->lead_db_columns as $column ) { |
|
83 | 83 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
84 | 84 | } |
85 | 85 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
115 | + do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
116 | 116 | |
117 | - $this->blacklist_add( $entry['form_id'] ); |
|
117 | + $this->blacklist_add( $entry[ 'form_id' ] ); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function entry_updated( $form, $lead_id ) { |
129 | 129 | |
130 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
130 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
131 | 131 | |
132 | - $this->blacklist_add( $form['id'] ); |
|
132 | + $this->blacklist_add( $form[ 'id' ] ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function entry_created( $entry, $form ) { |
146 | 146 | |
147 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' ); |
|
147 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' ); |
|
148 | 148 | |
149 | - $this->blacklist_add( $form['id'] ); |
|
149 | + $this->blacklist_add( $form[ 'id' ] ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // Normally just one form, but supports multiple forms |
166 | 166 | // |
167 | 167 | // Array of IDs 12, 5, 14 would result in `f-12f-5f-14` |
168 | - $forms = 'f:' . implode( '&f:', (array) $form_ids ); |
|
168 | + $forms = 'f:' . implode( '&f:', (array)$form_ids ); |
|
169 | 169 | |
170 | 170 | // Prefix for transient keys |
171 | 171 | // Now the prefix would be: `gv-cache-f-12f-5f-14` |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | ) ); |
223 | 223 | |
224 | 224 | // Add the passed form IDs |
225 | - $blacklist = array_merge( (array) $blacklist, $form_ids ); |
|
225 | + $blacklist = array_merge( (array)$blacklist, $form_ids ); |
|
226 | 226 | |
227 | 227 | // Don't duplicate |
228 | 228 | $blacklist = array_unique( $blacklist ); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() ); |
244 | 244 | |
245 | - $updated_list = array_diff( $blacklist, (array) $form_ids ); |
|
245 | + $updated_list = array_diff( $blacklist, (array)$form_ids ); |
|
246 | 246 | |
247 | 247 | do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array( |
248 | 248 | '$form_ids' => $form_ids, |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | |
278 | - foreach ( (array) $form_ids as $form_id ) { |
|
278 | + foreach ( (array)$form_ids as $form_id ) { |
|
279 | 279 | |
280 | 280 | if ( in_array( $form_id, $blacklist ) ) { |
281 | 281 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
348 | 348 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
349 | 349 | */ |
350 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
350 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
351 | 351 | |
352 | 352 | do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' ); |
353 | 353 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | return; |
384 | 384 | } |
385 | 385 | |
386 | - foreach ( (array) $form_ids as $form_id ) { |
|
386 | + foreach ( (array)$form_ids as $form_id ) { |
|
387 | 387 | |
388 | 388 | $key = $this->get_cache_key_prefix( $form_id ); |
389 | 389 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | |
498 | 498 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
499 | 499 | |
500 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
500 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
501 | 501 | |
502 | 502 | do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' ); |
503 | 503 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | */ |
527 | 527 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
528 | 528 | |
529 | - return (boolean) $use_cache; |
|
529 | + return (boolean)$use_cache; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts ); |
50 | 50 | |
51 | 51 | // Get details about the current View |
52 | - if( !empty( $passed_atts['detail'] ) ) { |
|
53 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
52 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
53 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
87 | 87 | |
88 | 88 | // Only keep the passed attributes after making sure that they're valid pairs |
89 | - $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array) $passed_atts, $filtered_atts ) : $filtered_atts; |
|
89 | + $filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array)$passed_atts, $filtered_atts ) : $filtered_atts; |
|
90 | 90 | |
91 | 91 | $atts = array(); |
92 | 92 | |
93 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
93 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
94 | 94 | |
95 | 95 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
96 | 96 | $passed_value = GravityView_Merge_Tags::replace_variables( $passed_value ); |
97 | 97 | |
98 | - switch( $defaults[ $key ]['type'] ) { |
|
98 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Make sure number fields are numeric. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
104 | 104 | */ |
105 | 105 | case 'number': |
106 | - if( is_numeric( $passed_value ) ) { |
|
106 | + if ( is_numeric( $passed_value ) ) { |
|
107 | 107 | $atts[ $key ] = ( $passed_value + 0 ); |
108 | 108 | } |
109 | 109 | break; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | case 'select': |
120 | 120 | case 'radio': |
121 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
122 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
121 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
122 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
123 | 123 | $atts[ $key ] = $passed_value; |
124 | 124 | } |
125 | 125 | break; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $gravityview_view = GravityView_View::getInstance(); |
149 | 149 | $return = ''; |
150 | 150 | |
151 | - switch( $detail ) { |
|
151 | + switch ( $detail ) { |
|
152 | 152 | case 'total_entries': |
153 | 153 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
154 | 154 | break; |