@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic |
| 362 | - * @since 1.22.2 |
|
| 363 | - * @param bool $unset_hidden_field_values Default: true |
|
| 364 | - * @param GravityView_Edit_Entry_Render $this This object |
|
| 362 | + * @since 1.22.2 |
|
| 363 | + * @param bool $unset_hidden_field_values Default: true |
|
| 364 | + * @param GravityView_Edit_Entry_Render $this This object |
|
| 365 | 365 | */ |
| 366 | 366 | $unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this ); |
| 367 | 367 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | return; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
|
| 372 | + if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
|
| 373 | 373 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
| 374 | 374 | $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
| 375 | 375 | } else { |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | |
| 1289 | 1289 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
| 1290 | 1290 | if( ! isset( $field->visibility ) && ! isset( $field->adminOnly ) ) { |
| 1291 | - $field->adminOnly = NULL; |
|
| 1291 | + $field->adminOnly = NULL; |
|
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | switch( RGFormsModel::get_input_type( $field ) ) { |
@@ -1771,8 +1771,8 @@ discard block |
||
| 1771 | 1771 | * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. |
| 1772 | 1772 | * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions |
| 1773 | 1773 | * @since 1.9.1 |
| 1774 | - * @since 1.22.6 Deprecated |
|
| 1775 | - * @deprecated Use gravityview/edit_entry/use_gf_visibility_setting instead |
|
| 1774 | + * @since 1.22.6 Deprecated |
|
| 1775 | + * @deprecated Use gravityview/edit_entry/use_gf_visibility_setting instead |
|
| 1776 | 1776 | * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions. |
| 1777 | 1777 | * @param array $form GF Form array |
| 1778 | 1778 | * @param int $view_id View ID |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | unset( $fields[ $k ] ); |
| 1799 | 1799 | } |
| 1800 | 1800 | } else{ |
| 1801 | - if( 'administrative' === $field->visibility ) { |
|
| 1801 | + if( 'administrative' === $field->visibility ) { |
|
| 1802 | 1802 | unset( $fields[ $k ] ); |
| 1803 | 1803 | } |
| 1804 | 1804 | } |
@@ -1808,25 +1808,25 @@ discard block |
||
| 1808 | 1808 | |
| 1809 | 1809 | foreach( $fields as &$field ) { |
| 1810 | 1810 | |
| 1811 | - // TODO: Remove when minimum GF Version is 2.0.6.5 |
|
| 1812 | - if( ! isset( $field->visibility ) ) { |
|
| 1811 | + // TODO: Remove when minimum GF Version is 2.0.6.5 |
|
| 1812 | + if( ! isset( $field->visibility ) ) { |
|
| 1813 | 1813 | |
| 1814 | - $field->adminOnly = false; |
|
| 1814 | + $field->adminOnly = false; |
|
| 1815 | 1815 | |
| 1816 | - } else { |
|
| 1816 | + } else { |
|
| 1817 | 1817 | |
| 1818 | - /** |
|
| 1819 | - * @filter `gravityview/edit_entry/make_all_fields_visible` Set field visibility to "visible" for all fields |
|
| 1820 | - * @since 1.22.6 |
|
| 1821 | - * |
|
| 1822 | - * @param string $visibility 'visible' by default. Default options are 'hidden', 'visible', and 'administrative' |
|
| 1823 | - * @param GF_Field $field Form field being modified |
|
| 1824 | - * @param int $view_id Current View ID |
|
| 1825 | - */ |
|
| 1826 | - $visibility = apply_filters( 'gravityview/edit_entry/field_visibility', 'visible', $field, $view_id ); |
|
| 1818 | + /** |
|
| 1819 | + * @filter `gravityview/edit_entry/make_all_fields_visible` Set field visibility to "visible" for all fields |
|
| 1820 | + * @since 1.22.6 |
|
| 1821 | + * |
|
| 1822 | + * @param string $visibility 'visible' by default. Default options are 'hidden', 'visible', and 'administrative' |
|
| 1823 | + * @param GF_Field $field Form field being modified |
|
| 1824 | + * @param int $view_id Current View ID |
|
| 1825 | + */ |
|
| 1826 | + $visibility = apply_filters( 'gravityview/edit_entry/field_visibility', 'visible', $field, $view_id ); |
|
| 1827 | 1827 | |
| 1828 | - $field->visibility = $visibility; |
|
| 1829 | - } |
|
| 1828 | + $field->visibility = $visibility; |
|
| 1829 | + } |
|
| 1830 | 1830 | } |
| 1831 | 1831 | |
| 1832 | 1832 | return $fields; |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | function load() { |
| 107 | 107 | |
| 108 | 108 | /** @define "GRAVITYVIEW_DIR" "../../../" */ |
| 109 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
| 109 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
| 110 | 110 | |
| 111 | 111 | // Don't display an embedded form when editing an entry |
| 112 | 112 | add_action( 'wp_head', array( $this, 'prevent_render_form' ) ); |
| 113 | 113 | add_action( 'wp_footer', array( $this, 'prevent_render_form' ) ); |
| 114 | 114 | |
| 115 | 115 | // Stop Gravity Forms processing what is ours! |
| 116 | - add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 ); |
|
| 116 | + add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 ); |
|
| 117 | 117 | |
| 118 | - add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') ); |
|
| 118 | + add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) ); |
|
| 119 | 119 | |
| 120 | 120 | add_action( 'gravityview_edit_entry', array( $this, 'init' ) ); |
| 121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 ); |
| 127 | 127 | |
| 128 | 128 | // Add fields expected by GFFormDisplay::validate() |
| 129 | - add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') ); |
|
| 129 | + add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) ); |
|
| 130 | 130 | |
| 131 | 131 | // Fix multiselect value for GF 2.2 |
| 132 | 132 | add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 ); |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @return void |
| 144 | 144 | */ |
| 145 | 145 | public function prevent_render_form() { |
| 146 | - if( $this->is_edit_entry() ) { |
|
| 147 | - if( 'wp_head' === current_filter() ) { |
|
| 146 | + if ( $this->is_edit_entry() ) { |
|
| 147 | + if ( 'wp_head' === current_filter() ) { |
|
| 148 | 148 | add_filter( 'gform_shortcode_form', '__return_empty_string' ); |
| 149 | 149 | } else { |
| 150 | 150 | remove_filter( 'gform_shortcode_form', '__return_empty_string' ); |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function prevent_maybe_process_form() { |
| 161 | 161 | |
| 162 | - if( ! empty( $_POST ) ) { |
|
| 162 | + if ( ! empty( $_POST ) ) { |
|
| 163 | 163 | do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if( $this->is_edit_entry_submission() ) { |
|
| 167 | - remove_action( 'wp', array( 'RGForms', 'maybe_process_form'), 9 ); |
|
| 168 | - remove_action( 'wp', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
| 166 | + if ( $this->is_edit_entry_submission() ) { |
|
| 167 | + remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 ); |
|
| 168 | + remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 ); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function is_edit_entry() { |
| 177 | 177 | |
| 178 | - $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] ); |
|
| 178 | + $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] ); |
|
| 179 | 179 | |
| 180 | 180 | return ( $is_edit_entry || $this->is_edit_entry_submission() ); |
| 181 | 181 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @return boolean |
| 187 | 187 | */ |
| 188 | 188 | public function is_edit_entry_submission() { |
| 189 | - return !empty( $_POST[ self::$nonce_field ] ); |
|
| 189 | + return ! empty( $_POST[ self::$nonce_field ] ); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | |
| 199 | 199 | $entries = $gravityview_view->getEntries(); |
| 200 | - self::$original_entry = $entries[0]; |
|
| 201 | - $this->entry = $entries[0]; |
|
| 200 | + self::$original_entry = $entries[ 0 ]; |
|
| 201 | + $this->entry = $entries[ 0 ]; |
|
| 202 | 202 | |
| 203 | 203 | self::$original_form = $gravityview_view->getForm(); |
| 204 | 204 | $this->form = $gravityview_view->getForm(); |
| 205 | 205 | $this->form_id = $gravityview_view->getFormId(); |
| 206 | 206 | $this->view_id = $gravityview_view->getViewId(); |
| 207 | 207 | |
| 208 | - self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] ); |
|
| 208 | + self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] ); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | // Multiple Views embedded, don't proceed if nonce fails |
| 228 | 228 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $gv_data->has_multiple_views(); |
| 229 | - if( $multiple_views && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) { |
|
| 230 | - do_action('gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' ); |
|
| 229 | + if ( $multiple_views && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) { |
|
| 230 | + do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' ); |
|
| 231 | 231 | return; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Sorry, you're not allowed here. |
| 235 | - if( false === $this->user_can_edit_entry( true ) ) { |
|
| 236 | - do_action('gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry ); |
|
| 235 | + if ( false === $this->user_can_edit_entry( true ) ) { |
|
| 236 | + do_action( 'gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry ); |
|
| 237 | 237 | return; |
| 238 | 238 | } |
| 239 | 239 | |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | private function print_scripts() { |
| 254 | 254 | $gravityview_view = GravityView_View::getInstance(); |
| 255 | 255 | |
| 256 | - wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
| 256 | + wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
| 257 | 257 | |
| 258 | - GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false); |
|
| 258 | + GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false ); |
|
| 259 | 259 | |
| 260 | 260 | // Sack is required for images |
| 261 | 261 | wp_print_scripts( array( 'sack', 'gform_gravityforms' ) ); |
@@ -267,32 +267,32 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | private function process_save() { |
| 269 | 269 | |
| 270 | - if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) { |
|
| 270 | + if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) { |
|
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Make sure the entry, view, and form IDs are all correct |
| 275 | 275 | $valid = $this->verify_nonce(); |
| 276 | 276 | |
| 277 | - if( !$valid ) { |
|
| 278 | - do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' ); |
|
| 277 | + if ( ! $valid ) { |
|
| 278 | + do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' ); |
|
| 279 | 279 | return; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if( $this->entry['id'] !== $_POST['lid'] ) { |
|
| 283 | - do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' ); |
|
| 282 | + if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) { |
|
| 283 | + do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' ); |
|
| 284 | 284 | return; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - do_action('gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
| 287 | + do_action( 'gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
| 288 | 288 | |
| 289 | 289 | $this->process_save_process_files( $this->form_id ); |
| 290 | 290 | |
| 291 | 291 | $this->validate(); |
| 292 | 292 | |
| 293 | - if( $this->is_valid ) { |
|
| 293 | + if ( $this->is_valid ) { |
|
| 294 | 294 | |
| 295 | - do_action('gravityview_log_debug', __METHOD__ . ': Submission is valid.' ); |
|
| 295 | + do_action( 'gravityview_log_debug', __METHOD__ . ': Submission is valid.' ); |
|
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @hack This step is needed to fix field visibility, to add the calculation fields |
@@ -302,22 +302,22 @@ discard block |
||
| 302 | 302 | /** |
| 303 | 303 | * @hack to avoid the capability validation of the method save_lead for GF 1.9+ |
| 304 | 304 | */ |
| 305 | - unset( $_GET['page'] ); |
|
| 305 | + unset( $_GET[ 'page' ] ); |
|
| 306 | 306 | |
| 307 | - $date_created = $this->entry['date_created']; |
|
| 307 | + $date_created = $this->entry[ 'date_created' ]; |
|
| 308 | 308 | |
| 309 | 309 | /** |
| 310 | 310 | * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead() |
| 311 | 311 | * @since 1.17.2 |
| 312 | 312 | */ |
| 313 | - unset( $this->entry['date_created'] ); |
|
| 313 | + unset( $this->entry[ 'date_created' ] ); |
|
| 314 | 314 | |
| 315 | 315 | GFFormsModel::save_lead( $form, $this->entry ); |
| 316 | 316 | |
| 317 | 317 | // Delete the values for hidden inputs |
| 318 | 318 | $this->unset_hidden_field_values(); |
| 319 | 319 | |
| 320 | - $this->entry['date_created'] = $date_created; |
|
| 320 | + $this->entry[ 'date_created' ] = $date_created; |
|
| 321 | 321 | |
| 322 | 322 | // Process calculation fields |
| 323 | 323 | $this->update_calculation_fields(); |
@@ -337,10 +337,10 @@ discard block |
||
| 337 | 337 | * @param string $entry_id Numeric ID of the entry that was updated |
| 338 | 338 | * @param GravityView_Edit_Entry_Render $this This object |
| 339 | 339 | */ |
| 340 | - do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this ); |
|
| 340 | + do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this ); |
|
| 341 | 341 | |
| 342 | 342 | } else { |
| 343 | - do_action('gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry ); |
|
| 343 | + do_action( 'gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry ); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | } // process_save |
@@ -365,16 +365,16 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | $unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this ); |
| 367 | 367 | |
| 368 | - if( ! $unset_hidden_field_values ) { |
|
| 368 | + if ( ! $unset_hidden_field_values ) { |
|
| 369 | 369 | return; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
| 373 | 373 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
| 374 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
|
| 374 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) ); |
|
| 375 | 375 | } else { |
| 376 | 376 | $lead_detail_table = GFFormsModel::get_lead_details_table_name(); |
| 377 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) ); |
|
| 377 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) ); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | foreach ( $this->entry as $input_id => $field_value ) { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** No file is being uploaded. */ |
| 458 | - if ( empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 458 | + if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
| 459 | 459 | /** So return the original upload */ |
| 460 | 460 | return $entry[ $input_id ]; |
| 461 | 461 | } |
@@ -473,11 +473,11 @@ discard block |
||
| 473 | 473 | * @return mixed |
| 474 | 474 | */ |
| 475 | 475 | public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) { |
| 476 | - if( ! $this->is_edit_entry() ) { |
|
| 476 | + if ( ! $this->is_edit_entry() ) { |
|
| 477 | 477 | return $plupload_init; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - $plupload_init['gf_vars']['max_files'] = 0; |
|
| 480 | + $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0; |
|
| 481 | 481 | |
| 482 | 482 | return $plupload_init; |
| 483 | 483 | } |
@@ -492,22 +492,22 @@ discard block |
||
| 492 | 492 | $form = $this->form; |
| 493 | 493 | |
| 494 | 494 | /** @var GF_Field $field */ |
| 495 | - foreach( $form['fields'] as $k => &$field ) { |
|
| 495 | + foreach ( $form[ 'fields' ] as $k => &$field ) { |
|
| 496 | 496 | |
| 497 | 497 | /** |
| 498 | 498 | * Remove the fields with calculation formulas before save to avoid conflicts with GF logic |
| 499 | 499 | * @since 1.16.3 |
| 500 | 500 | * @var GF_Field $field |
| 501 | 501 | */ |
| 502 | - if( $field->has_calculation() ) { |
|
| 503 | - unset( $form['fields'][ $k ] ); |
|
| 502 | + if ( $field->has_calculation() ) { |
|
| 503 | + unset( $form[ 'fields' ][ $k ] ); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | $field->adminOnly = false; |
| 507 | 507 | |
| 508 | - if( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
| 509 | - foreach( $field->inputs as $key => $input ) { |
|
| 510 | - $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
| 508 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
| 509 | + foreach ( $field->inputs as $key => $input ) { |
|
| 510 | + $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ]; |
|
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | } |
@@ -521,21 +521,21 @@ discard block |
||
| 521 | 521 | $update = false; |
| 522 | 522 | |
| 523 | 523 | // get the most up to date entry values |
| 524 | - $entry = GFAPI::get_entry( $this->entry['id'] ); |
|
| 524 | + $entry = GFAPI::get_entry( $this->entry[ 'id' ] ); |
|
| 525 | 525 | |
| 526 | - if( !empty( $this->fields_with_calculation ) ) { |
|
| 526 | + if ( ! empty( $this->fields_with_calculation ) ) { |
|
| 527 | 527 | $update = true; |
| 528 | 528 | foreach ( $this->fields_with_calculation as $calc_field ) { |
| 529 | 529 | $inputs = $calc_field->get_entry_inputs(); |
| 530 | 530 | if ( is_array( $inputs ) ) { |
| 531 | 531 | foreach ( $inputs as $input ) { |
| 532 | - $input_name = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
| 532 | + $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] ); |
|
| 533 | 533 | list( $prefix, $field_id, $input_id ) = rgexplode( '_', $input_name, 3 ); |
| 534 | 534 | |
| 535 | 535 | switch ( $input_id ) { |
| 536 | 536 | case 1: |
| 537 | 537 | /** Never void the labels. */ |
| 538 | - $value = $entry[ $input['id'] ]; |
|
| 538 | + $value = $entry[ $input[ 'id' ] ]; |
|
| 539 | 539 | break; |
| 540 | 540 | case 2: |
| 541 | 541 | /** Always recalcualte the final price. */ |
@@ -543,25 +543,25 @@ discard block |
||
| 543 | 543 | break; |
| 544 | 544 | case 3: |
| 545 | 545 | /** Fetch the quantity form the request. */ |
| 546 | - $value = rgpost( $input_name, $entry[ $input['id'] ] ); |
|
| 546 | + $value = rgpost( $input_name, $entry[ $input[ 'id' ] ] ); |
|
| 547 | 547 | break; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, $value, $input_name, $entry['id'], $entry ); |
|
| 550 | + $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, $value, $input_name, $entry[ 'id' ], $entry ); |
|
| 551 | 551 | } |
| 552 | 552 | } else { |
| 553 | - $input_name = 'input_' . str_replace( '.', '_', $calc_field->id); |
|
| 554 | - $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
| 553 | + $input_name = 'input_' . str_replace( '.', '_', $calc_field->id ); |
|
| 554 | + $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry ); |
|
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - if( $update ) { |
|
| 560 | + if ( $update ) { |
|
| 561 | 561 | |
| 562 | 562 | $return_entry = GFAPI::update_entry( $entry ); |
| 563 | 563 | |
| 564 | - if( is_wp_error( $return_entry ) ) { |
|
| 564 | + if ( is_wp_error( $return_entry ) ) { |
|
| 565 | 565 | do_action( 'gravityview_log_error', 'Updating the entry calculation fields failed', $return_entry ); |
| 566 | 566 | } else { |
| 567 | 567 | do_action( 'gravityview_log_debug', 'Updating the entry calculation fields succeeded' ); |
@@ -592,19 +592,19 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | $input_name = 'input_' . $field_id; |
| 594 | 594 | |
| 595 | - if ( !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 595 | + if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
| 596 | 596 | |
| 597 | 597 | // We have a new image |
| 598 | 598 | |
| 599 | - $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] ); |
|
| 599 | + $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] ); |
|
| 600 | 600 | |
| 601 | 601 | $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); |
| 602 | 602 | $ary = stripslashes_deep( $ary ); |
| 603 | 603 | $img_url = rgar( $ary, 0 ); |
| 604 | 604 | |
| 605 | - $img_title = count( $ary ) > 1 ? $ary[1] : ''; |
|
| 606 | - $img_caption = count( $ary ) > 2 ? $ary[2] : ''; |
|
| 607 | - $img_description = count( $ary ) > 3 ? $ary[3] : ''; |
|
| 605 | + $img_title = count( $ary ) > 1 ? $ary[ 1 ] : ''; |
|
| 606 | + $img_caption = count( $ary ) > 2 ? $ary[ 2 ] : ''; |
|
| 607 | + $img_description = count( $ary ) > 3 ? $ary[ 3 ] : ''; |
|
| 608 | 608 | |
| 609 | 609 | $image_meta = array( |
| 610 | 610 | 'post_excerpt' => $img_caption, |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | |
| 614 | 614 | //adding title only if it is not empty. It will default to the file name if it is not in the array |
| 615 | 615 | if ( ! empty( $img_title ) ) { |
| 616 | - $image_meta['post_title'] = $img_title; |
|
| 616 | + $image_meta[ 'post_title' ] = $img_title; |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | /** |
@@ -627,11 +627,11 @@ discard block |
||
| 627 | 627 | set_post_thumbnail( $post_id, $media_id ); |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - } elseif ( !empty( $_POST[ $input_name ] ) && is_array( $value ) ) { |
|
| 630 | + } elseif ( ! empty( $_POST[ $input_name ] ) && is_array( $value ) ) { |
|
| 631 | 631 | |
| 632 | 632 | $img_url = rgpost( $input_name ); |
| 633 | - $img_title = rgpost( $input_name . '_1' ); |
|
| 634 | - $img_caption = rgpost( $input_name . '_4' ); |
|
| 633 | + $img_title = rgpost( $input_name . '_1' ); |
|
| 634 | + $img_caption = rgpost( $input_name . '_4' ); |
|
| 635 | 635 | $img_description = rgpost( $input_name . '_7' ); |
| 636 | 636 | |
| 637 | 637 | $value = ! empty( $img_url ) ? $img_url . "|:|" . $img_title . "|:|" . $img_caption . "|:|" . $img_description : ''; |
@@ -670,16 +670,16 @@ discard block |
||
| 670 | 670 | */ |
| 671 | 671 | private function maybe_update_post_fields( $form ) { |
| 672 | 672 | |
| 673 | - if( empty( $this->entry['post_id'] ) ) { |
|
| 673 | + if ( empty( $this->entry[ 'post_id' ] ) ) { |
|
| 674 | 674 | do_action( 'gravityview_log_debug', __METHOD__ . ': This entry has no post fields. Continuing...' ); |
| 675 | 675 | return; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | - $post_id = $this->entry['post_id']; |
|
| 678 | + $post_id = $this->entry[ 'post_id' ]; |
|
| 679 | 679 | |
| 680 | 680 | // Security check |
| 681 | - if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
| 682 | - do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id ); |
|
| 681 | + if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
| 682 | + do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id ); |
|
| 683 | 683 | return; |
| 684 | 684 | } |
| 685 | 685 | |
@@ -691,25 +691,25 @@ discard block |
||
| 691 | 691 | |
| 692 | 692 | $field = RGFormsModel::get_field( $form, $field_id ); |
| 693 | 693 | |
| 694 | - if( ! $field ) { |
|
| 694 | + if ( ! $field ) { |
|
| 695 | 695 | continue; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
| 698 | + if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
| 699 | 699 | |
| 700 | 700 | // Get the value of the field, including $_POSTed value |
| 701 | 701 | $value = RGFormsModel::get_field_value( $field ); |
| 702 | 702 | |
| 703 | 703 | // Use temporary entry variable, to make values available to fill_post_template() and update_post_image() |
| 704 | 704 | $entry_tmp = $this->entry; |
| 705 | - $entry_tmp["{$field_id}"] = $value; |
|
| 705 | + $entry_tmp[ "{$field_id}" ] = $value; |
|
| 706 | 706 | |
| 707 | - switch( $field->type ) { |
|
| 707 | + switch ( $field->type ) { |
|
| 708 | 708 | |
| 709 | 709 | case 'post_title': |
| 710 | 710 | $post_title = $value; |
| 711 | - if( rgar( $form, 'postTitleTemplateEnabled' ) ) { |
|
| 712 | - $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
| 711 | + if ( rgar( $form, 'postTitleTemplateEnabled' ) ) { |
|
| 712 | + $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp ); |
|
| 713 | 713 | } |
| 714 | 714 | $updated_post->post_title = $post_title; |
| 715 | 715 | $updated_post->post_name = $post_title; |
@@ -718,8 +718,8 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | case 'post_content': |
| 720 | 720 | $post_content = $value; |
| 721 | - if( rgar( $form, 'postContentTemplateEnabled' ) ) { |
|
| 722 | - $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
| 721 | + if ( rgar( $form, 'postContentTemplateEnabled' ) ) { |
|
| 722 | + $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true ); |
|
| 723 | 723 | } |
| 724 | 724 | $updated_post->post_content = $post_content; |
| 725 | 725 | unset( $post_content ); |
@@ -737,12 +737,12 @@ discard block |
||
| 737 | 737 | $value = $value[ $field_id ]; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
| 740 | + if ( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
| 741 | 741 | $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) { |
| 745 | - $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value ); |
|
| 745 | + $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value ); |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | // update entry after |
| 758 | - $this->entry["{$field_id}"] = $value; |
|
| 758 | + $this->entry[ "{$field_id}" ] = $value; |
|
| 759 | 759 | |
| 760 | 760 | $update_entry = true; |
| 761 | 761 | |
@@ -764,25 +764,25 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | - if( $update_entry ) { |
|
| 767 | + if ( $update_entry ) { |
|
| 768 | 768 | |
| 769 | 769 | $return_entry = GFAPI::update_entry( $this->entry ); |
| 770 | 770 | |
| 771 | - if( is_wp_error( $return_entry ) ) { |
|
| 771 | + if ( is_wp_error( $return_entry ) ) { |
|
| 772 | 772 | do_action( 'gravityview_log_error', 'Updating the entry post fields failed', array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ); |
| 773 | 773 | } else { |
| 774 | - do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' ); |
|
| 774 | + do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' ); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | $return_post = wp_update_post( $updated_post, true ); |
| 780 | 780 | |
| 781 | - if( is_wp_error( $return_post ) ) { |
|
| 781 | + if ( is_wp_error( $return_post ) ) { |
|
| 782 | 782 | $return_post->add_data( $updated_post, '$updated_post' ); |
| 783 | 783 | do_action( 'gravityview_log_error', 'Updating the post content failed', compact( 'updated_post', 'return_post' ) ); |
| 784 | 784 | } else { |
| 785 | - do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded', $updated_post ); |
|
| 785 | + do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded', $updated_post ); |
|
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | 788 | |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | $input_type = RGFormsModel::get_input_type( $field ); |
| 801 | 801 | |
| 802 | 802 | // Only certain custom field types are supported |
| 803 | - switch( $input_type ) { |
|
| 803 | + switch ( $input_type ) { |
|
| 804 | 804 | case 'fileupload': |
| 805 | 805 | case 'list': |
| 806 | 806 | case 'multiselect': |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false ); |
| 838 | 838 | |
| 839 | 839 | // replace conditional shortcodes |
| 840 | - if( $do_shortcode ) { |
|
| 840 | + if ( $do_shortcode ) { |
|
| 841 | 841 | $output = do_shortcode( $output ); |
| 842 | 842 | } |
| 843 | 843 | |
@@ -856,19 +856,19 @@ discard block |
||
| 856 | 856 | */ |
| 857 | 857 | private function after_update() { |
| 858 | 858 | |
| 859 | - do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry ); |
|
| 860 | - do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry ); |
|
| 859 | + do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry ); |
|
| 860 | + do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry ); |
|
| 861 | 861 | |
| 862 | 862 | // Re-define the entry now that we've updated it. |
| 863 | - $entry = RGFormsModel::get_lead( $this->entry['id'] ); |
|
| 863 | + $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] ); |
|
| 864 | 864 | |
| 865 | 865 | $entry = GFFormsModel::set_entry_meta( $entry, $this->form ); |
| 866 | 866 | |
| 867 | 867 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) { |
| 868 | 868 | // We need to clear the cache because Gravity Forms caches the field values, which |
| 869 | 869 | // we have just updated. |
| 870 | - foreach ($this->form['fields'] as $key => $field) { |
|
| 871 | - GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id ); |
|
| 870 | + foreach ( $this->form[ 'fields' ] as $key => $field ) { |
|
| 871 | + GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id ); |
|
| 872 | 872 | } |
| 873 | 873 | } |
| 874 | 874 | |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | |
| 888 | 888 | <div class="gv-edit-entry-wrapper"><?php |
| 889 | 889 | |
| 890 | - $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this ); |
|
| 890 | + $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this ); |
|
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | 893 | * Fixes weird wpautop() issue |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | * @param string $edit_entry_title Modify the "Edit Entry" title |
| 904 | 904 | * @param GravityView_Edit_Entry_Render $this This object |
| 905 | 905 | */ |
| 906 | - $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
| 906 | + $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this ); |
|
| 907 | 907 | |
| 908 | 908 | echo esc_attr( $edit_entry_title ); |
| 909 | 909 | ?></span> |
@@ -949,20 +949,20 @@ discard block |
||
| 949 | 949 | */ |
| 950 | 950 | private function maybe_print_message() { |
| 951 | 951 | |
| 952 | - if( rgpost('action') === 'update' ) { |
|
| 952 | + if ( rgpost( 'action' ) === 'update' ) { |
|
| 953 | 953 | |
| 954 | 954 | $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) ); |
| 955 | 955 | |
| 956 | - if( ! $this->is_valid ){ |
|
| 956 | + if ( ! $this->is_valid ) { |
|
| 957 | 957 | |
| 958 | 958 | // Keeping this compatible with Gravity Forms. |
| 959 | - $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>"; |
|
| 960 | - $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form); |
|
| 959 | + $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>"; |
|
| 960 | + $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form ); |
|
| 961 | 961 | |
| 962 | - echo GVCommon::generate_notice( $message , 'gv-error' ); |
|
| 962 | + echo GVCommon::generate_notice( $message, 'gv-error' ); |
|
| 963 | 963 | |
| 964 | 964 | } else { |
| 965 | - $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' ); |
|
| 965 | + $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' ); |
|
| 966 | 966 | |
| 967 | 967 | /** |
| 968 | 968 | * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link) |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | * @param array $entry Gravity Forms entry array |
| 973 | 973 | * @param string $back_link URL to return to the original entry. @since 1.6 |
| 974 | 974 | */ |
| 975 | - $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link ); |
|
| 975 | + $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link ); |
|
| 976 | 976 | |
| 977 | 977 | echo GVCommon::generate_notice( $message ); |
| 978 | 978 | } |
@@ -996,21 +996,21 @@ discard block |
||
| 996 | 996 | */ |
| 997 | 997 | do_action( 'gravityview/edit-entry/render/before', $this ); |
| 998 | 998 | |
| 999 | - add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 ); |
|
| 1000 | - add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') ); |
|
| 999 | + add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 ); |
|
| 1000 | + add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) ); |
|
| 1001 | 1001 | add_filter( 'gform_disable_view_counter', '__return_true' ); |
| 1002 | 1002 | |
| 1003 | 1003 | add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 ); |
| 1004 | 1004 | add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 ); |
| 1005 | 1005 | |
| 1006 | 1006 | // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin. |
| 1007 | - unset( $_GET['page'] ); |
|
| 1007 | + unset( $_GET[ 'page' ] ); |
|
| 1008 | 1008 | |
| 1009 | 1009 | // TODO: Verify multiple-page forms |
| 1010 | 1010 | |
| 1011 | 1011 | ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic |
| 1012 | 1012 | |
| 1013 | - $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry ); |
|
| 1013 | + $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry ); |
|
| 1014 | 1014 | |
| 1015 | 1015 | ob_get_clean(); |
| 1016 | 1016 | |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | * @return string |
| 1037 | 1037 | */ |
| 1038 | 1038 | public function render_form_buttons() { |
| 1039 | - return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this ); |
|
| 1039 | + return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this ); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | |
@@ -1056,10 +1056,10 @@ discard block |
||
| 1056 | 1056 | public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) { |
| 1057 | 1057 | |
| 1058 | 1058 | // In case we have validated the form, use it to inject the validation results into the form render |
| 1059 | - if( isset( $this->form_after_validation ) ) { |
|
| 1059 | + if ( isset( $this->form_after_validation ) ) { |
|
| 1060 | 1060 | $form = $this->form_after_validation; |
| 1061 | 1061 | } else { |
| 1062 | - $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
| 1062 | + $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | $form = $this->filter_conditional_logic( $form ); |
@@ -1067,8 +1067,8 @@ discard block |
||
| 1067 | 1067 | $form = $this->prefill_conditional_logic( $form ); |
| 1068 | 1068 | |
| 1069 | 1069 | // for now we don't support Save and Continue feature. |
| 1070 | - if( ! self::$supports_save_and_continue ) { |
|
| 1071 | - unset( $form['save'] ); |
|
| 1070 | + if ( ! self::$supports_save_and_continue ) { |
|
| 1071 | + unset( $form[ 'save' ] ); |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | return $form; |
@@ -1089,29 +1089,29 @@ discard block |
||
| 1089 | 1089 | */ |
| 1090 | 1090 | public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) { |
| 1091 | 1091 | |
| 1092 | - if( GFCommon::is_post_field( $field ) ) { |
|
| 1092 | + if ( GFCommon::is_post_field( $field ) ) { |
|
| 1093 | 1093 | |
| 1094 | 1094 | $message = null; |
| 1095 | 1095 | |
| 1096 | 1096 | // First, make sure they have the capability to edit the post. |
| 1097 | - if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) { |
|
| 1097 | + if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) { |
|
| 1098 | 1098 | |
| 1099 | 1099 | /** |
| 1100 | 1100 | * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post |
| 1101 | 1101 | * @param string $message The existing "You don't have permission..." text |
| 1102 | 1102 | */ |
| 1103 | - $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don’t have permission to edit this post.', 'gravityview') ); |
|
| 1103 | + $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don’t have permission to edit this post.', 'gravityview' ) ); |
|
| 1104 | 1104 | |
| 1105 | - } elseif( null === get_post( $this->entry['post_id'] ) ) { |
|
| 1105 | + } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) { |
|
| 1106 | 1106 | /** |
| 1107 | 1107 | * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists |
| 1108 | 1108 | * @param string $message The existing "This field is not editable; the post no longer exists." text |
| 1109 | 1109 | */ |
| 1110 | - $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
| 1110 | + $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | - if( $message ) { |
|
| 1114 | - $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
| 1113 | + if ( $message ) { |
|
| 1114 | + $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | } |
| 1117 | 1117 | |
@@ -1136,8 +1136,8 @@ discard block |
||
| 1136 | 1136 | |
| 1137 | 1137 | // If the form has been submitted, then we don't need to pre-fill the values, |
| 1138 | 1138 | // Except for fileupload type and when a field input is overridden- run always!! |
| 1139 | - if( |
|
| 1140 | - ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
| 1139 | + if ( |
|
| 1140 | + ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
| 1141 | 1141 | && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) |
| 1142 | 1142 | && ! GFCommon::is_product_field( $field->type ) |
| 1143 | 1143 | || ! empty( $field_content ) |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | $return = null; |
| 1158 | 1158 | |
| 1159 | 1159 | /** @var GravityView_Field $gv_field */ |
| 1160 | - if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
| 1160 | + if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
| 1161 | 1161 | $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field ); |
| 1162 | 1162 | } else { |
| 1163 | 1163 | $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | // If there was output, it's an error |
| 1167 | 1167 | $warnings = ob_get_clean(); |
| 1168 | 1168 | |
| 1169 | - if( !empty( $warnings ) ) { |
|
| 1169 | + if ( ! empty( $warnings ) ) { |
|
| 1170 | 1170 | do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value ); |
| 1171 | 1171 | } |
| 1172 | 1172 | |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field ); |
| 1192 | 1192 | |
| 1193 | 1193 | // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs) |
| 1194 | - if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
| 1194 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
| 1195 | 1195 | |
| 1196 | 1196 | $field_value = array(); |
| 1197 | 1197 | |
@@ -1200,10 +1200,10 @@ discard block |
||
| 1200 | 1200 | |
| 1201 | 1201 | foreach ( (array)$field->inputs as $input ) { |
| 1202 | 1202 | |
| 1203 | - $input_id = strval( $input['id'] ); |
|
| 1203 | + $input_id = strval( $input[ 'id' ] ); |
|
| 1204 | 1204 | |
| 1205 | 1205 | if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) { |
| 1206 | - $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
| 1206 | + $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
| 1207 | 1207 | $allow_pre_populated = false; |
| 1208 | 1208 | } |
| 1209 | 1209 | |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | |
| 1212 | 1212 | $pre_value = $field->get_value_submission( array(), false ); |
| 1213 | 1213 | |
| 1214 | - $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
| 1214 | + $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
| 1215 | 1215 | |
| 1216 | 1216 | } else { |
| 1217 | 1217 | |
@@ -1222,13 +1222,13 @@ discard block |
||
| 1222 | 1222 | |
| 1223 | 1223 | // saved field entry value (if empty, fallback to the pre-populated value, if exists) |
| 1224 | 1224 | // or pre-populated value if not empty and set to override saved value |
| 1225 | - $field_value = !gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
| 1225 | + $field_value = ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
| 1226 | 1226 | |
| 1227 | 1227 | // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs. |
| 1228 | - if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) { |
|
| 1228 | + if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) { |
|
| 1229 | 1229 | $categories = array(); |
| 1230 | 1230 | foreach ( explode( ',', $field_value ) as $cat_string ) { |
| 1231 | - $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
| 1231 | + $categories[ ] = GFCommon::format_post_category( $cat_string, true ); |
|
| 1232 | 1232 | } |
| 1233 | 1233 | $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories ); |
| 1234 | 1234 | } |
@@ -1256,7 +1256,7 @@ discard block |
||
| 1256 | 1256 | * @param GF_Field $field Gravity Forms field object |
| 1257 | 1257 | * @param GravityView_Edit_Entry_Render $this Current object |
| 1258 | 1258 | */ |
| 1259 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
| 1259 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this ); |
|
| 1260 | 1260 | |
| 1261 | 1261 | return $field_value; |
| 1262 | 1262 | } |
@@ -1273,12 +1273,12 @@ discard block |
||
| 1273 | 1273 | */ |
| 1274 | 1274 | public function gform_pre_validation( $form ) { |
| 1275 | 1275 | |
| 1276 | - if( ! $this->verify_nonce() ) { |
|
| 1276 | + if ( ! $this->verify_nonce() ) { |
|
| 1277 | 1277 | return $form; |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | // Fix PHP warning regarding undefined index. |
| 1281 | - foreach ( $form['fields'] as &$field) { |
|
| 1281 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
| 1282 | 1282 | |
| 1283 | 1283 | // This is because we're doing admin form pretending to be front-end, so Gravity Forms |
| 1284 | 1284 | // expects certain field array items to be set. |
@@ -1287,11 +1287,11 @@ discard block |
||
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
| 1290 | - if( ! isset( $field->visibility ) && ! isset( $field->adminOnly ) ) { |
|
| 1290 | + if ( ! isset( $field->visibility ) && ! isset( $field->adminOnly ) ) { |
|
| 1291 | 1291 | $field->adminOnly = NULL; |
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | - switch( RGFormsModel::get_input_type( $field ) ) { |
|
| 1294 | + switch ( RGFormsModel::get_input_type( $field ) ) { |
|
| 1295 | 1295 | |
| 1296 | 1296 | /** |
| 1297 | 1297 | * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend. |
@@ -1305,37 +1305,37 @@ discard block |
||
| 1305 | 1305 | // Set the previous value |
| 1306 | 1306 | $entry = $this->get_entry(); |
| 1307 | 1307 | |
| 1308 | - $input_name = 'input_'.$field->id; |
|
| 1309 | - $form_id = $form['id']; |
|
| 1308 | + $input_name = 'input_' . $field->id; |
|
| 1309 | + $form_id = $form[ 'id' ]; |
|
| 1310 | 1310 | |
| 1311 | 1311 | $value = NULL; |
| 1312 | 1312 | |
| 1313 | 1313 | // Use the previous entry value as the default. |
| 1314 | - if( isset( $entry[ $field->id ] ) ) { |
|
| 1314 | + if ( isset( $entry[ $field->id ] ) ) { |
|
| 1315 | 1315 | $value = $entry[ $field->id ]; |
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | // If this is a single upload file |
| 1319 | - if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 1320 | - $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
| 1321 | - $value = $file_path['url']; |
|
| 1319 | + if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
| 1320 | + $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] ); |
|
| 1321 | + $value = $file_path[ 'url' ]; |
|
| 1322 | 1322 | |
| 1323 | 1323 | } else { |
| 1324 | 1324 | |
| 1325 | 1325 | // Fix PHP warning on line 1498 of form_display.php for post_image fields |
| 1326 | 1326 | // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
| 1327 | - $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
| 1327 | + $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' ); |
|
| 1328 | 1328 | |
| 1329 | 1329 | } |
| 1330 | 1330 | |
| 1331 | - if( rgar($field, "multipleFiles") ) { |
|
| 1331 | + if ( rgar( $field, "multipleFiles" ) ) { |
|
| 1332 | 1332 | |
| 1333 | 1333 | // If there are fresh uploads, process and merge them. |
| 1334 | 1334 | // Otherwise, use the passed values, which should be json-encoded array of URLs |
| 1335 | - if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) { |
|
| 1335 | + if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
| 1336 | 1336 | $value = empty( $value ) ? '[]' : $value; |
| 1337 | 1337 | $value = stripslashes_deep( $value ); |
| 1338 | - $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array()); |
|
| 1338 | + $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() ); |
|
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | 1341 | } else { |
@@ -1353,8 +1353,8 @@ discard block |
||
| 1353 | 1353 | |
| 1354 | 1354 | case 'number': |
| 1355 | 1355 | // Fix "undefined index" issue at line 1286 in form_display.php |
| 1356 | - if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
| 1357 | - $_POST['input_'.$field->id ] = NULL; |
|
| 1356 | + if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) { |
|
| 1357 | + $_POST[ 'input_' . $field->id ] = NULL; |
|
| 1358 | 1358 | } |
| 1359 | 1359 | break; |
| 1360 | 1360 | } |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | * You can enter whatever you want! |
| 1397 | 1397 | * We try validating, and customize the results using `self::custom_validation()` |
| 1398 | 1398 | */ |
| 1399 | - add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4); |
|
| 1399 | + add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 ); |
|
| 1400 | 1400 | |
| 1401 | 1401 | // Needed by the validate funtion |
| 1402 | 1402 | $failed_validation_page = NULL; |
@@ -1404,14 +1404,14 @@ discard block |
||
| 1404 | 1404 | |
| 1405 | 1405 | // Prevent entry limit from running when editing an entry, also |
| 1406 | 1406 | // prevent form scheduling from preventing editing |
| 1407 | - unset( $this->form['limitEntries'], $this->form['scheduleForm'] ); |
|
| 1407 | + unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] ); |
|
| 1408 | 1408 | |
| 1409 | 1409 | // Hide fields depending on Edit Entry settings |
| 1410 | - $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
| 1410 | + $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
| 1411 | 1411 | |
| 1412 | 1412 | $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page ); |
| 1413 | 1413 | |
| 1414 | - remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
| 1414 | + remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
| 1415 | 1415 | remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'user_registration_validation' ), 10 ); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | $user_registration = GF_User_Registration::get_instance(); |
| 1429 | 1429 | |
| 1430 | 1430 | $entry = $this->get_entry(); |
| 1431 | - $form = $validation_results['form']; |
|
| 1431 | + $form = $validation_results[ 'form' ]; |
|
| 1432 | 1432 | |
| 1433 | 1433 | if ( ! $feed = $user_registration->get_single_submission_feed( $entry, $form ) ) { |
| 1434 | 1434 | return $validation_results; |
@@ -1444,18 +1444,18 @@ discard block |
||
| 1444 | 1444 | if ( $user_email != $value && email_exists( $value ) ) { |
| 1445 | 1445 | $email_field->failed_validation = 1; |
| 1446 | 1446 | $email_field->validation_message = __( 'This email is already in use', 'gravityview' ); |
| 1447 | - $validation_results['is_valid'] = false; |
|
| 1447 | + $validation_results[ 'is_valid' ] = false; |
|
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | 1450 | $value = RGFormsModel::get_field_value( $username_field ); |
| 1451 | 1451 | if ( $username != $value ) { |
| 1452 | 1452 | $username_field->failed_validation = 1; |
| 1453 | 1453 | $username_field->validation_message = __( 'Usernames cannot be changed', 'gravityview' ); |
| 1454 | - $validation_results['is_valid'] = false; |
|
| 1454 | + $validation_results[ 'is_valid' ] = false; |
|
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | 1457 | // We'll need this result when rendering the form ( on GFFormDisplay::get_form ) |
| 1458 | - $this->form_after_validation = $validation_results['form']; |
|
| 1458 | + $this->form_after_validation = $validation_results[ 'form' ]; |
|
| 1459 | 1459 | |
| 1460 | 1460 | return $validation_results; |
| 1461 | 1461 | } |
@@ -1473,13 +1473,13 @@ discard block |
||
| 1473 | 1473 | */ |
| 1474 | 1474 | public function custom_validation( $validation_results ) { |
| 1475 | 1475 | |
| 1476 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results ); |
|
| 1476 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results ); |
|
| 1477 | 1477 | |
| 1478 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
| 1478 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) ); |
|
| 1479 | 1479 | |
| 1480 | 1480 | $gv_valid = true; |
| 1481 | 1481 | |
| 1482 | - foreach ( $validation_results['form']['fields'] as $key => &$field ) { |
|
| 1482 | + foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) { |
|
| 1483 | 1483 | |
| 1484 | 1484 | $value = RGFormsModel::get_field_value( $field ); |
| 1485 | 1485 | $field_type = RGFormsModel::get_input_type( $field ); |
@@ -1492,35 +1492,35 @@ discard block |
||
| 1492 | 1492 | case 'post_image': |
| 1493 | 1493 | |
| 1494 | 1494 | // in case nothing is uploaded but there are already files saved |
| 1495 | - if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) { |
|
| 1495 | + if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) { |
|
| 1496 | 1496 | $field->failed_validation = false; |
| 1497 | 1497 | unset( $field->validation_message ); |
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | // validate if multi file upload reached max number of files [maxFiles] => 2 |
| 1501 | - if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) { |
|
| 1501 | + if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) { |
|
| 1502 | 1502 | |
| 1503 | 1503 | $input_name = 'input_' . $field->id; |
| 1504 | 1504 | //uploaded |
| 1505 | - $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array(); |
|
| 1505 | + $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array(); |
|
| 1506 | 1506 | |
| 1507 | 1507 | //existent |
| 1508 | 1508 | $entry = $this->get_entry(); |
| 1509 | 1509 | $value = NULL; |
| 1510 | - if( isset( $entry[ $field->id ] ) ) { |
|
| 1510 | + if ( isset( $entry[ $field->id ] ) ) { |
|
| 1511 | 1511 | $value = json_decode( $entry[ $field->id ], true ); |
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | 1514 | // count uploaded files and existent entry files |
| 1515 | 1515 | $count_files = count( $file_names ) + count( $value ); |
| 1516 | 1516 | |
| 1517 | - if( $count_files > $field->maxFiles ) { |
|
| 1517 | + if ( $count_files > $field->maxFiles ) { |
|
| 1518 | 1518 | $field->validation_message = __( 'Maximum number of files reached', 'gravityview' ); |
| 1519 | 1519 | $field->failed_validation = 1; |
| 1520 | 1520 | $gv_valid = false; |
| 1521 | 1521 | |
| 1522 | 1522 | // in case of error make sure the newest upload files are removed from the upload input |
| 1523 | - GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null; |
|
| 1523 | + GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null; |
|
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | } |
@@ -1531,7 +1531,7 @@ discard block |
||
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | 1533 | // This field has failed validation. |
| 1534 | - if( !empty( $field->failed_validation ) ) { |
|
| 1534 | + if ( ! empty( $field->failed_validation ) ) { |
|
| 1535 | 1535 | |
| 1536 | 1536 | do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) ); |
| 1537 | 1537 | |
@@ -1549,32 +1549,32 @@ discard block |
||
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | // You can't continue inside a switch, so we do it after. |
| 1552 | - if( empty( $field->failed_validation ) ) { |
|
| 1552 | + if ( empty( $field->failed_validation ) ) { |
|
| 1553 | 1553 | continue; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | // checks if the No Duplicates option is not validating entry against itself, since |
| 1557 | 1557 | // we're editing a stored entry, it would also assume it's a duplicate. |
| 1558 | - if( !empty( $field->noDuplicates ) ) { |
|
| 1558 | + if ( ! empty( $field->noDuplicates ) ) { |
|
| 1559 | 1559 | |
| 1560 | 1560 | $entry = $this->get_entry(); |
| 1561 | 1561 | |
| 1562 | 1562 | // If the value of the entry is the same as the stored value |
| 1563 | 1563 | // Then we can assume it's not a duplicate, it's the same. |
| 1564 | - if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
| 1564 | + if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
| 1565 | 1565 | //if value submitted was not changed, then don't validate |
| 1566 | 1566 | $field->failed_validation = false; |
| 1567 | 1567 | |
| 1568 | 1568 | unset( $field->validation_message ); |
| 1569 | 1569 | |
| 1570 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry ); |
|
| 1570 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry ); |
|
| 1571 | 1571 | |
| 1572 | 1572 | continue; |
| 1573 | 1573 | } |
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | // if here then probably we are facing the validation 'At least one field must be filled out' |
| 1577 | - if( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
| 1577 | + if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
| 1578 | 1578 | unset( $field->validation_message ); |
| 1579 | 1579 | $field->validation_message = false; |
| 1580 | 1580 | continue; |
@@ -1586,12 +1586,12 @@ discard block |
||
| 1586 | 1586 | |
| 1587 | 1587 | } |
| 1588 | 1588 | |
| 1589 | - $validation_results['is_valid'] = $gv_valid; |
|
| 1589 | + $validation_results[ 'is_valid' ] = $gv_valid; |
|
| 1590 | 1590 | |
| 1591 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results ); |
|
| 1591 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results ); |
|
| 1592 | 1592 | |
| 1593 | 1593 | // We'll need this result when rendering the form ( on GFFormDisplay::get_form ) |
| 1594 | - $this->form_after_validation = $validation_results['form']; |
|
| 1594 | + $this->form_after_validation = $validation_results[ 'form' ]; |
|
| 1595 | 1595 | |
| 1596 | 1596 | return $validation_results; |
| 1597 | 1597 | } |
@@ -1604,7 +1604,7 @@ discard block |
||
| 1604 | 1604 | */ |
| 1605 | 1605 | public function get_entry() { |
| 1606 | 1606 | |
| 1607 | - if( empty( $this->entry ) ) { |
|
| 1607 | + if ( empty( $this->entry ) ) { |
|
| 1608 | 1608 | // Get the database value of the entry that's being edited |
| 1609 | 1609 | $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() ); |
| 1610 | 1610 | } |
@@ -1639,10 +1639,10 @@ discard block |
||
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | // If edit tab not yet configured, show all fields |
| 1642 | - $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL; |
|
| 1642 | + $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL; |
|
| 1643 | 1643 | |
| 1644 | 1644 | // Hide fields depending on admin settings |
| 1645 | - $fields = $this->filter_fields( $form['fields'], $edit_fields ); |
|
| 1645 | + $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields ); |
|
| 1646 | 1646 | |
| 1647 | 1647 | // If Edit Entry fields are configured, remove hidden/administrative field settings. Otherwise, don't. |
| 1648 | 1648 | $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
@@ -1674,7 +1674,7 @@ discard block |
||
| 1674 | 1674 | */ |
| 1675 | 1675 | private function filter_fields( $fields, $configured_fields ) { |
| 1676 | 1676 | |
| 1677 | - if( empty( $fields ) || !is_array( $fields ) ) { |
|
| 1677 | + if ( empty( $fields ) || ! is_array( $fields ) ) { |
|
| 1678 | 1678 | return $fields; |
| 1679 | 1679 | } |
| 1680 | 1680 | |
@@ -1687,18 +1687,18 @@ discard block |
||
| 1687 | 1687 | |
| 1688 | 1688 | // Remove the fields that have calculation properties and keep them to be used later |
| 1689 | 1689 | // @since 1.16.2 |
| 1690 | - if( $field->has_calculation() ) { |
|
| 1691 | - $this->fields_with_calculation[] = $field; |
|
| 1690 | + if ( $field->has_calculation() ) { |
|
| 1691 | + $this->fields_with_calculation[ ] = $field; |
|
| 1692 | 1692 | // don't remove the calculation fields on form render. |
| 1693 | 1693 | } |
| 1694 | 1694 | |
| 1695 | - if( in_array( $field->type, $field_type_blacklist ) ) { |
|
| 1695 | + if ( in_array( $field->type, $field_type_blacklist ) ) { |
|
| 1696 | 1696 | unset( $fields[ $key ] ); |
| 1697 | 1697 | } |
| 1698 | 1698 | } |
| 1699 | 1699 | |
| 1700 | 1700 | // The Edit tab has not been configured, so we return all fields by default. |
| 1701 | - if( empty( $configured_fields ) ) { |
|
| 1701 | + if ( empty( $configured_fields ) ) { |
|
| 1702 | 1702 | return $fields; |
| 1703 | 1703 | } |
| 1704 | 1704 | |
@@ -1708,8 +1708,8 @@ discard block |
||
| 1708 | 1708 | /** @var GF_Field $field */ |
| 1709 | 1709 | foreach ( $fields as $field ) { |
| 1710 | 1710 | |
| 1711 | - if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
| 1712 | - $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
| 1711 | + if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
| 1712 | + $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field ); |
|
| 1713 | 1713 | break; |
| 1714 | 1714 | } |
| 1715 | 1715 | |
@@ -1732,14 +1732,14 @@ discard block |
||
| 1732 | 1732 | |
| 1733 | 1733 | $return_field = $field; |
| 1734 | 1734 | |
| 1735 | - if( empty( $field_setting['show_label'] ) ) { |
|
| 1735 | + if ( empty( $field_setting[ 'show_label' ] ) ) { |
|
| 1736 | 1736 | $return_field->label = ''; |
| 1737 | - } elseif ( !empty( $field_setting['custom_label'] ) ) { |
|
| 1738 | - $return_field->label = $field_setting['custom_label']; |
|
| 1737 | + } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) { |
|
| 1738 | + $return_field->label = $field_setting[ 'custom_label' ]; |
|
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | - if( !empty( $field_setting['custom_class'] ) ) { |
|
| 1742 | - $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] ); |
|
| 1741 | + if ( ! empty( $field_setting[ 'custom_class' ] ) ) { |
|
| 1742 | + $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] ); |
|
| 1743 | 1743 | } |
| 1744 | 1744 | |
| 1745 | 1745 | /** |
@@ -1790,15 +1790,15 @@ discard block |
||
| 1790 | 1790 | */ |
| 1791 | 1791 | $use_gf_visibility_setting = apply_filters( 'gravityview/edit_entry/use_gf_visibility_setting', empty( $edit_fields ), $form, $view_id ); |
| 1792 | 1792 | |
| 1793 | - if( $use_gf_adminonly_setting && $use_gf_visibility_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
| 1794 | - foreach( $fields as $k => $field ) { |
|
| 1793 | + if ( $use_gf_adminonly_setting && $use_gf_visibility_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) { |
|
| 1794 | + foreach ( $fields as $k => $field ) { |
|
| 1795 | 1795 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
| 1796 | - if( ! isset( $field->visibility ) ) { |
|
| 1797 | - if( $field->adminOnly ) { |
|
| 1796 | + if ( ! isset( $field->visibility ) ) { |
|
| 1797 | + if ( $field->adminOnly ) { |
|
| 1798 | 1798 | unset( $fields[ $k ] ); |
| 1799 | 1799 | } |
| 1800 | - } else{ |
|
| 1801 | - if( 'administrative' === $field->visibility ) { |
|
| 1800 | + } else { |
|
| 1801 | + if ( 'administrative' === $field->visibility ) { |
|
| 1802 | 1802 | unset( $fields[ $k ] ); |
| 1803 | 1803 | } |
| 1804 | 1804 | } |
@@ -1806,10 +1806,10 @@ discard block |
||
| 1806 | 1806 | return $fields; |
| 1807 | 1807 | } |
| 1808 | 1808 | |
| 1809 | - foreach( $fields as &$field ) { |
|
| 1809 | + foreach ( $fields as &$field ) { |
|
| 1810 | 1810 | |
| 1811 | 1811 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
| 1812 | - if( ! isset( $field->visibility ) ) { |
|
| 1812 | + if ( ! isset( $field->visibility ) ) { |
|
| 1813 | 1813 | |
| 1814 | 1814 | $field->adminOnly = false; |
| 1815 | 1815 | |
@@ -1849,22 +1849,22 @@ discard block |
||
| 1849 | 1849 | */ |
| 1850 | 1850 | function prefill_conditional_logic( $form ) { |
| 1851 | 1851 | |
| 1852 | - if( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
| 1852 | + if ( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
| 1853 | 1853 | return $form; |
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | // Have Conditional Logic pre-fill fields as if the data were default values |
| 1857 | 1857 | /** @var GF_Field $field */ |
| 1858 | - foreach ( $form['fields'] as &$field ) { |
|
| 1858 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
| 1859 | 1859 | |
| 1860 | - if( 'checkbox' === $field->type ) { |
|
| 1860 | + if ( 'checkbox' === $field->type ) { |
|
| 1861 | 1861 | foreach ( $field->get_entry_inputs() as $key => $input ) { |
| 1862 | - $input_id = $input['id']; |
|
| 1862 | + $input_id = $input[ 'id' ]; |
|
| 1863 | 1863 | $choice = $field->choices[ $key ]; |
| 1864 | 1864 | $value = rgar( $this->entry, $input_id ); |
| 1865 | 1865 | $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
| 1866 | - if( $match ) { |
|
| 1867 | - $field->choices[ $key ]['isSelected'] = true; |
|
| 1866 | + if ( $match ) { |
|
| 1867 | + $field->choices[ $key ][ 'isSelected' ] = true; |
|
| 1868 | 1868 | } |
| 1869 | 1869 | } |
| 1870 | 1870 | } else { |
@@ -1872,15 +1872,15 @@ discard block |
||
| 1872 | 1872 | // We need to run through each field to set the default values |
| 1873 | 1873 | foreach ( $this->entry as $field_id => $field_value ) { |
| 1874 | 1874 | |
| 1875 | - if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
| 1875 | + if ( floatval( $field_id ) === floatval( $field->id ) ) { |
|
| 1876 | 1876 | |
| 1877 | - if( 'list' === $field->type ) { |
|
| 1877 | + if ( 'list' === $field->type ) { |
|
| 1878 | 1878 | $list_rows = maybe_unserialize( $field_value ); |
| 1879 | 1879 | |
| 1880 | 1880 | $list_field_value = array(); |
| 1881 | - foreach ( (array) $list_rows as $row ) { |
|
| 1882 | - foreach ( (array) $row as $column ) { |
|
| 1883 | - $list_field_value[] = $column; |
|
| 1881 | + foreach ( (array)$list_rows as $row ) { |
|
| 1882 | + foreach ( (array)$row as $column ) { |
|
| 1883 | + $list_field_value[ ] = $column; |
|
| 1884 | 1884 | } |
| 1885 | 1885 | } |
| 1886 | 1886 | |
@@ -1915,16 +1915,16 @@ discard block |
||
| 1915 | 1915 | */ |
| 1916 | 1916 | $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form ); |
| 1917 | 1917 | |
| 1918 | - if( $use_conditional_logic ) { |
|
| 1918 | + if ( $use_conditional_logic ) { |
|
| 1919 | 1919 | return $form; |
| 1920 | 1920 | } |
| 1921 | 1921 | |
| 1922 | - foreach( $form['fields'] as &$field ) { |
|
| 1922 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
| 1923 | 1923 | /* @var GF_Field $field */ |
| 1924 | 1924 | $field->conditionalLogic = null; |
| 1925 | 1925 | } |
| 1926 | 1926 | |
| 1927 | - unset( $form['button']['conditionalLogic'] ); |
|
| 1927 | + unset( $form[ 'button' ][ 'conditionalLogic' ] ); |
|
| 1928 | 1928 | |
| 1929 | 1929 | return $form; |
| 1930 | 1930 | |
@@ -1941,7 +1941,7 @@ discard block |
||
| 1941 | 1941 | */ |
| 1942 | 1942 | public function manage_conditional_logic( $has_conditional_logic, $form ) { |
| 1943 | 1943 | |
| 1944 | - if( ! $this->is_edit_entry() ) { |
|
| 1944 | + if ( ! $this->is_edit_entry() ) { |
|
| 1945 | 1945 | return $has_conditional_logic; |
| 1946 | 1946 | } |
| 1947 | 1947 | |
@@ -1973,44 +1973,44 @@ discard block |
||
| 1973 | 1973 | * 2. There are two entries embedded using oEmbed |
| 1974 | 1974 | * 3. One of the entries has just been saved |
| 1975 | 1975 | */ |
| 1976 | - if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) { |
|
| 1976 | + if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) { |
|
| 1977 | 1977 | |
| 1978 | 1978 | $error = true; |
| 1979 | 1979 | |
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | - if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) { |
|
| 1982 | + if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) { |
|
| 1983 | 1983 | |
| 1984 | 1984 | $error = true; |
| 1985 | 1985 | |
| 1986 | - } elseif( ! $this->verify_nonce() ) { |
|
| 1986 | + } elseif ( ! $this->verify_nonce() ) { |
|
| 1987 | 1987 | |
| 1988 | 1988 | /** |
| 1989 | 1989 | * If the Entry is embedded, there may be two entries on the same page. |
| 1990 | 1990 | * If that's the case, and one is being edited, the other should fail gracefully and not display an error. |
| 1991 | 1991 | */ |
| 1992 | - if( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
| 1992 | + if ( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
| 1993 | 1993 | $error = true; |
| 1994 | 1994 | } else { |
| 1995 | - $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview'); |
|
| 1995 | + $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' ); |
|
| 1996 | 1996 | } |
| 1997 | 1997 | |
| 1998 | 1998 | } |
| 1999 | 1999 | |
| 2000 | - if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
| 2001 | - $error = __( 'You do not have permission to edit this entry.', 'gravityview'); |
|
| 2000 | + if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
| 2001 | + $error = __( 'You do not have permission to edit this entry.', 'gravityview' ); |
|
| 2002 | 2002 | } |
| 2003 | 2003 | |
| 2004 | - if( $this->entry['status'] === 'trash' ) { |
|
| 2005 | - $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
| 2004 | + if ( $this->entry[ 'status' ] === 'trash' ) { |
|
| 2005 | + $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
| 2006 | 2006 | } |
| 2007 | 2007 | |
| 2008 | 2008 | // No errors; everything's fine here! |
| 2009 | - if( empty( $error ) ) { |
|
| 2009 | + if ( empty( $error ) ) { |
|
| 2010 | 2010 | return true; |
| 2011 | 2011 | } |
| 2012 | 2012 | |
| 2013 | - if( $echo && $error !== true ) { |
|
| 2013 | + if ( $echo && $error !== true ) { |
|
| 2014 | 2014 | |
| 2015 | 2015 | $error = esc_html( $error ); |
| 2016 | 2016 | |
@@ -2018,13 +2018,13 @@ discard block |
||
| 2018 | 2018 | * @since 1.9 |
| 2019 | 2019 | */ |
| 2020 | 2020 | if ( ! empty( $this->entry ) ) { |
| 2021 | - $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
| 2021 | + $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
| 2022 | 2022 | } |
| 2023 | 2023 | |
| 2024 | - echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error'); |
|
| 2024 | + echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' ); |
|
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error ); |
|
| 2027 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error ); |
|
| 2028 | 2028 | |
| 2029 | 2029 | return false; |
| 2030 | 2030 | } |
@@ -2041,20 +2041,20 @@ discard block |
||
| 2041 | 2041 | |
| 2042 | 2042 | $error = NULL; |
| 2043 | 2043 | |
| 2044 | - if( ! $this->check_user_cap_edit_field( $field ) ) { |
|
| 2045 | - $error = __( 'You do not have permission to edit this field.', 'gravityview'); |
|
| 2044 | + if ( ! $this->check_user_cap_edit_field( $field ) ) { |
|
| 2045 | + $error = __( 'You do not have permission to edit this field.', 'gravityview' ); |
|
| 2046 | 2046 | } |
| 2047 | 2047 | |
| 2048 | 2048 | // No errors; everything's fine here! |
| 2049 | - if( empty( $error ) ) { |
|
| 2049 | + if ( empty( $error ) ) { |
|
| 2050 | 2050 | return true; |
| 2051 | 2051 | } |
| 2052 | 2052 | |
| 2053 | - if( $echo ) { |
|
| 2054 | - echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error'); |
|
| 2053 | + if ( $echo ) { |
|
| 2054 | + echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' ); |
|
| 2055 | 2055 | } |
| 2056 | 2056 | |
| 2057 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error ); |
|
| 2057 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error ); |
|
| 2058 | 2058 | |
| 2059 | 2059 | return false; |
| 2060 | 2060 | |
@@ -2072,15 +2072,15 @@ discard block |
||
| 2072 | 2072 | private function check_user_cap_edit_field( $field ) { |
| 2073 | 2073 | |
| 2074 | 2074 | // If they can edit any entries (as defined in Gravity Forms), we're good. |
| 2075 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
| 2075 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
| 2076 | 2076 | return true; |
| 2077 | 2077 | } |
| 2078 | 2078 | |
| 2079 | - $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false; |
|
| 2079 | + $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false; |
|
| 2080 | 2080 | |
| 2081 | 2081 | // If the field has custom editing capaibilities set, check those |
| 2082 | - if( $field_cap ) { |
|
| 2083 | - return GVCommon::has_cap( $field['allow_edit_cap'] ); |
|
| 2082 | + if ( $field_cap ) { |
|
| 2083 | + return GVCommon::has_cap( $field[ 'allow_edit_cap' ] ); |
|
| 2084 | 2084 | } |
| 2085 | 2085 | |
| 2086 | 2086 | return false; |
@@ -2094,17 +2094,17 @@ discard block |
||
| 2094 | 2094 | public function verify_nonce() { |
| 2095 | 2095 | |
| 2096 | 2096 | // Verify form submitted for editing single |
| 2097 | - if( $this->is_edit_entry_submission() ) { |
|
| 2097 | + if ( $this->is_edit_entry_submission() ) { |
|
| 2098 | 2098 | $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field ); |
| 2099 | 2099 | } |
| 2100 | 2100 | |
| 2101 | 2101 | // Verify |
| 2102 | - else if( ! $this->is_edit_entry() ) { |
|
| 2102 | + else if ( ! $this->is_edit_entry() ) { |
|
| 2103 | 2103 | $valid = false; |
| 2104 | 2104 | } |
| 2105 | 2105 | |
| 2106 | 2106 | else { |
| 2107 | - $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
|
| 2107 | + $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ); |
|
| 2108 | 2108 | } |
| 2109 | 2109 | |
| 2110 | 2110 | /** |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | |
| 954 | 954 | $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) ); |
| 955 | 955 | |
| 956 | - if( ! $this->is_valid ){ |
|
| 956 | + if( ! $this->is_valid ) { |
|
| 957 | 957 | |
| 958 | 958 | // Keeping this compatible with Gravity Forms. |
| 959 | 959 | $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>"; |
@@ -1797,7 +1797,7 @@ discard block |
||
| 1797 | 1797 | if( $field->adminOnly ) { |
| 1798 | 1798 | unset( $fields[ $k ] ); |
| 1799 | 1799 | } |
| 1800 | - } else{ |
|
| 1800 | + } else { |
|
| 1801 | 1801 | if( 'administrative' === $field->visibility ) { |
| 1802 | 1802 | unset( $fields[ $k ] ); |
| 1803 | 1803 | } |
@@ -2101,9 +2101,7 @@ discard block |
||
| 2101 | 2101 | // Verify |
| 2102 | 2102 | else if( ! $this->is_edit_entry() ) { |
| 2103 | 2103 | $valid = false; |
| 2104 | - } |
|
| 2105 | - |
|
| 2106 | - else { |
|
| 2104 | + } else { |
|
| 2107 | 2105 | $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
| 2108 | 2106 | } |
| 2109 | 2107 | |