@@ -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; |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | private function add_hooks() { |
| 40 | 40 | |
| 41 | 41 | // in case entry is edited (on admin or frontend) |
| 42 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
| 42 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
| 43 | 43 | |
| 44 | 44 | // when using the User opt-in field, check on entry submission |
| 45 | 45 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
| 46 | 46 | |
| 47 | 47 | // process ajax approve entry requests |
| 48 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
| 48 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public static function get_entry_status( $entry, $value_or_label = 'label' ) { |
| 64 | 64 | |
| 65 | - $entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry ); |
|
| 65 | + $entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry ); |
|
| 66 | 66 | |
| 67 | 67 | $status = gform_get_meta( $entry_id, self::meta_key ); |
| 68 | 68 | |
| 69 | 69 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
| 70 | 70 | |
| 71 | - if( 'value' === $value_or_label ) { |
|
| 71 | + if ( 'value' === $value_or_label ) { |
|
| 72 | 72 | return $status; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function ajax_update_approved() { |
| 95 | 95 | |
| 96 | - $form_id = intval( rgpost('form_id') ); |
|
| 96 | + $form_id = intval( rgpost( 'form_id' ) ); |
|
| 97 | 97 | |
| 98 | - $entry_id = GVCommon::get_entry_id( rgpost('entry_slug') ); |
|
| 98 | + $entry_id = GVCommon::get_entry_id( rgpost( 'entry_slug' ) ); |
|
| 99 | 99 | |
| 100 | - $approval_status = rgpost('approved'); |
|
| 100 | + $approval_status = rgpost( 'approved' ); |
|
| 101 | 101 | |
| 102 | - $nonce = rgpost('nonce'); |
|
| 102 | + $nonce = rgpost( 'nonce' ); |
|
| 103 | 103 | |
| 104 | 104 | // Valid status |
| 105 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
| 105 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
| 106 | 106 | |
| 107 | 107 | do_action( 'gravityview_log_error', __METHOD__ . ': Invalid approval status', $_POST ); |
| 108 | 108 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 135 | 135 | |
| 136 | - $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
|
| 136 | + $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) ); |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @param $form array Gravity Forms form object |
| 167 | 167 | */ |
| 168 | 168 | public function after_submission( $entry, $form ) { |
| 169 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
| 169 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -180,18 +180,18 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
| 182 | 182 | |
| 183 | - $approved_column = self::get_approved_column( $form['id'] ); |
|
| 183 | + $approved_column = self::get_approved_column( $form[ 'id' ] ); |
|
| 184 | 184 | |
| 185 | 185 | /** |
| 186 | 186 | * If the form doesn't contain the approve field, don't assume anything. |
| 187 | 187 | */ |
| 188 | - if( empty( $approved_column ) ) { |
|
| 188 | + if ( empty( $approved_column ) ) { |
|
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $entry = GFAPI::get_entry( $entry_id ); |
| 193 | 193 | |
| 194 | - self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form['id'] ); |
|
| 194 | + self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form[ 'id' ] ); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $success = true; |
| 232 | 232 | foreach ( $entries as $entry_id ) { |
| 233 | - $update_success = self::update_approved( (int) $entry_id, $approved, $form_id, $approved_column_id ); |
|
| 233 | + $update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
|
| 234 | 234 | |
| 235 | 235 | if ( ! $update_success ) { |
| 236 | 236 | $success = false; |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
| 258 | 258 | |
| 259 | - if( !class_exists( 'GFAPI' ) ) { |
|
| 259 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
| 260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
| 261 | 261 | return false; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
| 264 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
| 265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ': Not a valid approval value.' ); |
| 266 | 266 | return false; |
| 267 | 267 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // If the form has an Approve/Reject field, update that value |
| 279 | 279 | $result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn ); |
| 280 | 280 | |
| 281 | - if( is_wp_error( $result ) ) { |
|
| 281 | + if ( is_wp_error( $result ) ) { |
|
| 282 | 282 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
| 283 | 283 | return false; |
| 284 | 284 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | // add note to entry if approval field updating worked or there was no approved field |
| 292 | 292 | // There's no validation for the meta |
| 293 | - if( true === $result ) { |
|
| 293 | + if ( true === $result ) { |
|
| 294 | 294 | |
| 295 | 295 | // Add an entry note |
| 296 | 296 | self::add_approval_status_updated_note( $entry_id, $approved ); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | $note_id = false; |
| 345 | 345 | |
| 346 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 346 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 347 | 347 | |
| 348 | 348 | $current_user = wp_get_current_user(); |
| 349 | 349 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) { |
| 367 | 367 | |
| 368 | - if( empty( $approvedcolumn ) ) { |
|
| 368 | + if ( empty( $approvedcolumn ) ) { |
|
| 369 | 369 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | private static function update_approved_meta( $entry_id, $status, $form_id = 0 ) { |
| 414 | 414 | |
| 415 | 415 | if ( ! GravityView_Entry_Approval_Status::is_valid( $status ) ) { |
| 416 | - do_action('gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
| 416 | + do_action( 'gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status ); |
|
| 417 | 417 | return; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
| 421 | 421 | |
| 422 | 422 | // update entry meta |
| 423 | - if( function_exists('gform_update_meta') ) { |
|
| 423 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
| 424 | 424 | |
| 425 | - if( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) { |
|
| 425 | + if ( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) { |
|
| 426 | 426 | gform_delete_meta( $entry_id, self::meta_key ); |
| 427 | 427 | } else { |
| 428 | 428 | gform_update_meta( $entry_id, self::meta_key, $status, $form_id ); |
@@ -445,11 +445,11 @@ discard block |
||
| 445 | 445 | * @since 1.18 Added "unapproved" |
| 446 | 446 | * @param int $entry_id ID of the Gravity Forms entry |
| 447 | 447 | */ |
| 448 | - do_action( 'gravityview/approve_entries/' . $action , $entry_id ); |
|
| 448 | + do_action( 'gravityview/approve_entries/' . $action, $entry_id ); |
|
| 449 | 449 | |
| 450 | 450 | } else { |
| 451 | 451 | |
| 452 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 452 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 453 | 453 | |
| 454 | 454 | } |
| 455 | 455 | } |
@@ -464,29 +464,29 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | static public function get_approved_column( $form ) { |
| 466 | 466 | |
| 467 | - if( empty( $form ) ) { |
|
| 467 | + if ( empty( $form ) ) { |
|
| 468 | 468 | return null; |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if( !is_array( $form ) ) { |
|
| 471 | + if ( ! is_array( $form ) ) { |
|
| 472 | 472 | $form = GVCommon::get_form( $form ); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - foreach( $form['fields'] as $key => $field ) { |
|
| 475 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
| 476 | 476 | |
| 477 | - $field = (array) $field; |
|
| 477 | + $field = (array)$field; |
|
| 478 | 478 | |
| 479 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
| 480 | - if( !empty($field['inputs'][0]['id']) ) { |
|
| 481 | - return $field['inputs'][0]['id']; |
|
| 479 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
| 480 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
| 481 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
| 486 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 487 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 488 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 489 | - return $input['id']; |
|
| 486 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
| 487 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
| 488 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
| 489 | + return $input[ 'id' ]; |
|
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | } |
@@ -419,10 +419,10 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function getPaging() { |
| 421 | 421 | |
| 422 | - $default_params = array( |
|
| 423 | - 'offset' => 0, |
|
| 424 | - 'page_size' => 20, |
|
| 425 | - ); |
|
| 422 | + $default_params = array( |
|
| 423 | + 'offset' => 0, |
|
| 424 | + 'page_size' => 20, |
|
| 425 | + ); |
|
| 426 | 426 | |
| 427 | 427 | return wp_parse_args( $this->paging, $default_params ); |
| 428 | 428 | } |
@@ -479,10 +479,10 @@ discard block |
||
| 479 | 479 | public function getSorting() { |
| 480 | 480 | |
| 481 | 481 | $defaults_params = array( |
| 482 | - 'sort_field' => 'date_created', |
|
| 483 | - 'sort_direction' => 'ASC', |
|
| 484 | - 'is_numeric' => false, |
|
| 485 | - ); |
|
| 482 | + 'sort_field' => 'date_created', |
|
| 483 | + 'sort_direction' => 'ASC', |
|
| 484 | + 'is_numeric' => false, |
|
| 485 | + ); |
|
| 486 | 486 | |
| 487 | 487 | return wp_parse_args( $this->sorting, $defaults_params ); |
| 488 | 488 | } |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | - * Uninstall all traces of GravityView |
|
| 126 | - * |
|
| 127 | - * Note: method is public because parent method is public |
|
| 128 | - * |
|
| 125 | + * Uninstall all traces of GravityView |
|
| 126 | + * |
|
| 127 | + * Note: method is public because parent method is public |
|
| 128 | + * |
|
| 129 | 129 | * @return bool |
| 130 | 130 | */ |
| 131 | 131 | public function uninstall() { |
@@ -137,53 +137,53 @@ discard block |
||
| 137 | 137 | $uninstaller->fire_everything(); |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | - * @see GFAddOn::uninstall_addon |
|
| 142 | - * @uses deactivate_plugins() |
|
| 143 | - */ |
|
| 140 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | + * @see GFAddOn::uninstall_addon |
|
| 142 | + * @uses deactivate_plugins() |
|
| 143 | + */ |
|
| 144 | 144 | $this->_path = GRAVITYVIEW_FILE; |
| 145 | 145 | |
| 146 | 146 | return true; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | - * |
|
| 152 | - * @since 1.17.5 |
|
| 153 | - * |
|
| 150 | + * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | + * |
|
| 152 | + * @since 1.17.5 |
|
| 153 | + * |
|
| 154 | 154 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
| 155 | 155 | */ |
| 156 | 156 | private function get_uninstall_reasons() { |
| 157 | 157 | |
| 158 | 158 | $reasons = array( |
| 159 | 159 | 'will-continue' => array( |
| 160 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | - ), |
|
| 160 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | + ), |
|
| 162 | 162 | 'no-longer-need' => array( |
| 163 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | - ), |
|
| 163 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | + ), |
|
| 165 | 165 | 'doesnt-work' => array( |
| 166 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | - ), |
|
| 166 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | + ), |
|
| 168 | 168 | 'found-other' => array( |
| 169 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | - ), |
|
| 169 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | + 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | + ), |
|
| 172 | 172 | 'other' => array( |
| 173 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | - ), |
|
| 173 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | + ), |
|
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | 177 | shuffle( $reasons ); |
| 178 | 178 | |
| 179 | 179 | return $reasons; |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * Display a feedback form when the plugin is uninstalled |
|
| 184 | - * |
|
| 185 | - * @since 1.17.5 |
|
| 186 | - * |
|
| 183 | + * Display a feedback form when the plugin is uninstalled |
|
| 184 | + * |
|
| 185 | + * @since 1.17.5 |
|
| 186 | + * |
|
| 187 | 187 | * @return string HTML of the uninstallation form |
| 188 | 188 | */ |
| 189 | 189 | public function uninstall_form() { |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
| 264 | 264 | <ul> |
| 265 | 265 | <?php |
| 266 | - $reasons = $this->get_uninstall_reasons(); |
|
| 266 | + $reasons = $this->get_uninstall_reasons(); |
|
| 267 | 267 | foreach ( $reasons as $reason ) { |
| 268 | 268 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', rgar( $reason, 'followup' ), rgar( $reason, 'label' ) ); |
| 269 | 269 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $license_key = self::getSetting('license_key'); |
| 432 | 432 | if( '' === $license_key ) { |
| 433 | 433 | $license_status = 'inactive'; |
| 434 | - } |
|
| 434 | + } |
|
| 435 | 435 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
| 436 | 436 | |
| 437 | 437 | $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
@@ -569,12 +569,12 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | public function app_settings_tab() { |
| 572 | - parent::app_settings_tab(); |
|
| 572 | + parent::app_settings_tab(); |
|
| 573 | 573 | |
| 574 | 574 | if ( $this->maybe_uninstall() ) { |
| 575 | - echo $this->uninstall_form(); |
|
| 575 | + echo $this->uninstall_form(); |
|
| 576 | 576 | } |
| 577 | - } |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | 579 | /** |
| 580 | 580 | * Make protected public |
@@ -697,8 +697,8 @@ discard block |
||
| 697 | 697 | type="' . $field['type'] . '" |
| 698 | 698 | name="' . esc_attr( $name ) . '" |
| 699 | 699 | value="' . $value . '" ' . |
| 700 | - implode( ' ', $attributes ) . |
|
| 701 | - ' />'; |
|
| 700 | + implode( ' ', $attributes ) . |
|
| 701 | + ' />'; |
|
| 702 | 702 | |
| 703 | 703 | if ( $echo ) { |
| 704 | 704 | echo $html; |
@@ -933,36 +933,36 @@ discard block |
||
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | |
| 936 | - $sections = array( |
|
| 937 | - array( |
|
| 938 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 939 | - 'fields' => $fields, |
|
| 940 | - ) |
|
| 941 | - ); |
|
| 936 | + $sections = array( |
|
| 937 | + array( |
|
| 938 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 939 | + 'fields' => $fields, |
|
| 940 | + ) |
|
| 941 | + ); |
|
| 942 | 942 | |
| 943 | - // custom 'update settings' button |
|
| 944 | - $button = array( |
|
| 945 | - 'class' => 'button button-primary button-hero', |
|
| 946 | - 'type' => 'save', |
|
| 947 | - ); |
|
| 943 | + // custom 'update settings' button |
|
| 944 | + $button = array( |
|
| 945 | + 'class' => 'button button-primary button-hero', |
|
| 946 | + 'type' => 'save', |
|
| 947 | + ); |
|
| 948 | 948 | |
| 949 | 949 | if( $disabled_attribute ) { |
| 950 | 950 | $button['disabled'] = $disabled_attribute; |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | |
| 954 | - /** |
|
| 955 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 956 | - * Extensions can tap in here to insert their own section and settings. |
|
| 957 | - * <code> |
|
| 958 | - * $sections[] = array( |
|
| 959 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 960 | - * 'fields' => $settings, |
|
| 961 | - * ); |
|
| 962 | - * </code> |
|
| 963 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
| 964 | - */ |
|
| 965 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 954 | + /** |
|
| 955 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 956 | + * Extensions can tap in here to insert their own section and settings. |
|
| 957 | + * <code> |
|
| 958 | + * $sections[] = array( |
|
| 959 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 960 | + * 'fields' => $settings, |
|
| 961 | + * ); |
|
| 962 | + * </code> |
|
| 963 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
| 964 | + */ |
|
| 965 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 966 | 966 | |
| 967 | 967 | // If there are extensions, add a section for them |
| 968 | 968 | if ( ! empty( $extension_sections ) ) { |
@@ -975,13 +975,13 @@ discard block |
||
| 975 | 975 | } |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | - $k = count( $extension_sections ) - 1 ; |
|
| 979 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 978 | + $k = count( $extension_sections ) - 1 ; |
|
| 979 | + $extension_sections[ $k ]['fields'][] = $button; |
|
| 980 | 980 | $sections = array_merge( $sections, $extension_sections ); |
| 981 | 981 | } else { |
| 982 | - // add the 'update settings' button to the general section |
|
| 983 | - $sections[0]['fields'][] = $button; |
|
| 984 | - } |
|
| 982 | + // add the 'update settings' button to the general section |
|
| 983 | + $sections[0]['fields'][] = $button; |
|
| 984 | + } |
|
| 985 | 985 | |
| 986 | 986 | return $sections; |
| 987 | 987 | } |