@@ -15,7 +15,7 @@ |
||
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 18 | + $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 19 | 19 | |
| 20 | 20 | ?> |
| 21 | 21 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 33 | - } |
|
| 34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 33 | + } |
|
| 34 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 35 | 35 | |
| 36 | 36 | ?> |
| 37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -28,14 +28,14 @@ |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | - $class = ' merge-tag-support mt-position-right '; |
|
| 33 | - |
|
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | - $class .= ' mt-hide_all_fields'; |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
| 31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | + $class = ' merge-tag-support mt-position-right '; |
|
| 33 | + |
|
| 34 | + if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | + $class .= ' mt-hide_all_fields'; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
| 39 | 39 | |
| 40 | 40 | ?> |
| 41 | 41 | <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | if( !GravityView_Compatibility::is_valid() ) { return; } |
| 16 | 16 | |
| 17 | - self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
| 17 | + self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
| 18 | 18 | |
| 19 | 19 | include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php'; |
| 20 | 20 | |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
| 229 | 229 | |
| 230 | 230 | if( isset( $form['id'] ) ) { |
| 231 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 231 | + $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 232 | 232 | |
| 233 | - // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
| 234 | - $_GET['id'] = $form['id']; |
|
| 233 | + // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
| 234 | + $_GET['id'] = $form['id']; |
|
| 235 | 235 | |
| 236 | 236 | } else { |
| 237 | - $form_script = 'var form = new Form();'; |
|
| 237 | + $form_script = 'var form = new Form();'; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Display the tab panels for the Settings metabox |
|
| 4 | - * |
|
| 5 | - * @package GravityView |
|
| 6 | - * @subpackage Gravityview/admin/metaboxes/views |
|
| 7 | - * @since 1.8 |
|
| 8 | - * |
|
| 9 | - * @global array $metaboxes |
|
| 10 | - * @global WP_Post $post |
|
| 11 | - */ |
|
| 3 | + * Display the tab panels for the Settings metabox |
|
| 4 | + * |
|
| 5 | + * @package GravityView |
|
| 6 | + * @subpackage Gravityview/admin/metaboxes/views |
|
| 7 | + * @since 1.8 |
|
| 8 | + * |
|
| 9 | + * @global array $metaboxes |
|
| 10 | + * @global WP_Post $post |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package GravityView |
|
| 4 | - * @subpackage Gravityview/admin/metaboxes/partials |
|
| 5 | - * @global WP_Post $post |
|
| 6 | - */ |
|
| 3 | + * @package GravityView |
|
| 4 | + * @subpackage Gravityview/admin/metaboxes/partials |
|
| 5 | + * @global WP_Post $post |
|
| 6 | + */ |
|
| 7 | 7 | global $post; |
| 8 | 8 | |
| 9 | 9 | $curr_form = gravityview_get_form_id( $post->ID ); |
@@ -432,23 +432,17 @@ |
||
| 432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
| 433 | 433 | |
| 434 | 434 | $result = false; |
| 435 | - } |
|
| 436 | - |
|
| 437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 435 | + } else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 438 | 436 | |
| 439 | 437 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
| 440 | 438 | |
| 441 | 439 | $result = false; |
| 442 | - } |
|
| 443 | - |
|
| 444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 440 | + } else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 445 | 441 | |
| 446 | 442 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 447 | 443 | |
| 448 | 444 | $result = false; |
| 449 | - } |
|
| 450 | - |
|
| 451 | - else { |
|
| 445 | + } else { |
|
| 452 | 446 | |
| 453 | 447 | $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
| 454 | 448 | |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | $approvedcolumn = self::get_approved_column( $form['id'] ); |
| 365 | 365 | |
| 366 | - /** |
|
| 367 | - * If the form doesn't contain the approve field, don't assume anything. |
|
| 368 | - */ |
|
| 369 | - if( empty( $approvedcolumn ) ) { |
|
| 370 | - return; |
|
| 371 | - } |
|
| 366 | + /** |
|
| 367 | + * If the form doesn't contain the approve field, don't assume anything. |
|
| 368 | + */ |
|
| 369 | + if( empty( $approvedcolumn ) ) { |
|
| 370 | + return; |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | $entry = GFAPI::get_entry( $entry_id ); |
| 374 | 374 | |
@@ -481,17 +481,17 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | static public function get_approved_column( $form ) { |
| 483 | 483 | |
| 484 | - if( empty( $form ) ) { |
|
| 485 | - return null; |
|
| 486 | - } |
|
| 484 | + if( empty( $form ) ) { |
|
| 485 | + return null; |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | - if( !is_array( $form ) ) { |
|
| 489 | - $form = GVCommon::get_form( $form ); |
|
| 490 | - } |
|
| 488 | + if( !is_array( $form ) ) { |
|
| 489 | + $form = GVCommon::get_form( $form ); |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | foreach( $form['fields'] as $key => $field ) { |
| 493 | 493 | |
| 494 | - $field = (array) $field; |
|
| 494 | + $field = (array) $field; |
|
| 495 | 495 | |
| 496 | 496 | if( !empty( $field['gravityview_approved'] ) ) { |
| 497 | 497 | if( !empty($field['inputs'][0]['id']) ) { |
@@ -499,14 +499,14 @@ discard block |
||
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
| 503 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 504 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 505 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 506 | - return $input['id']; |
|
| 507 | - } |
|
| 508 | - } |
|
| 509 | - } |
|
| 502 | + // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
|
| 503 | + if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 504 | + foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 505 | + if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 506 | + return $input['id']; |
|
| 507 | + } |
|
| 508 | + } |
|
| 509 | + } |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | return null; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // template areas |
| 138 | 138 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
| 139 | - $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' ); |
|
| 139 | + $template_areas_single = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'single' ); |
|
| 140 | 140 | |
| 141 | 141 | // widget areas |
| 142 | 142 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
@@ -328,40 +328,40 @@ discard block |
||
| 328 | 328 | // load file |
| 329 | 329 | $xmlstr = file_get_contents( $form_file ); |
| 330 | 330 | |
| 331 | - $options = array( |
|
| 332 | - "page" => array("unserialize_as_array" => true), |
|
| 333 | - "form"=> array("unserialize_as_array" => true), |
|
| 334 | - "field"=> array("unserialize_as_array" => true), |
|
| 335 | - "rule"=> array("unserialize_as_array" => true), |
|
| 336 | - "choice"=> array("unserialize_as_array" => true), |
|
| 337 | - "input"=> array("unserialize_as_array" => true), |
|
| 338 | - "routing_item"=> array("unserialize_as_array" => true), |
|
| 339 | - "creditCard"=> array("unserialize_as_array" => true), |
|
| 340 | - "routin"=> array("unserialize_as_array" => true), |
|
| 341 | - "confirmation" => array("unserialize_as_array" => true), |
|
| 342 | - "notification" => array("unserialize_as_array" => true) |
|
| 343 | - ); |
|
| 331 | + $options = array( |
|
| 332 | + "page" => array("unserialize_as_array" => true), |
|
| 333 | + "form"=> array("unserialize_as_array" => true), |
|
| 334 | + "field"=> array("unserialize_as_array" => true), |
|
| 335 | + "rule"=> array("unserialize_as_array" => true), |
|
| 336 | + "choice"=> array("unserialize_as_array" => true), |
|
| 337 | + "input"=> array("unserialize_as_array" => true), |
|
| 338 | + "routing_item"=> array("unserialize_as_array" => true), |
|
| 339 | + "creditCard"=> array("unserialize_as_array" => true), |
|
| 340 | + "routin"=> array("unserialize_as_array" => true), |
|
| 341 | + "confirmation" => array("unserialize_as_array" => true), |
|
| 342 | + "notification" => array("unserialize_as_array" => true) |
|
| 343 | + ); |
|
| 344 | 344 | |
| 345 | 345 | $xml = new RGXML($options); |
| 346 | - $forms = $xml->unserialize($xmlstr); |
|
| 346 | + $forms = $xml->unserialize($xmlstr); |
|
| 347 | 347 | |
| 348 | - if( !$forms ) { |
|
| 349 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
| 350 | - return false; |
|
| 351 | - } |
|
| 348 | + if( !$forms ) { |
|
| 349 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
| 350 | + return false; |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
| 354 | - $form = $forms[0]; |
|
| 355 | - } |
|
| 353 | + if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
| 354 | + $form = $forms[0]; |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - if( empty( $form ) ) { |
|
| 358 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
|
| 359 | - return false; |
|
| 360 | - } |
|
| 357 | + if( empty( $form ) ) { |
|
| 358 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
|
| 359 | + return false; |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
| 362 | + do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
| 363 | 363 | |
| 364 | - return $form; |
|
| 364 | + return $form; |
|
| 365 | 365 | |
| 366 | 366 | } |
| 367 | 367 | |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
| 215 | 215 | foreach ( $field['inputs'] as $input ) { |
| 216 | - /** |
|
| 217 | - * @hack |
|
| 218 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 219 | - */ |
|
| 220 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 221 | - continue; |
|
| 222 | - } |
|
| 216 | + /** |
|
| 217 | + * @hack |
|
| 218 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 219 | + */ |
|
| 220 | + if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 221 | + continue; |
|
| 222 | + } |
|
| 223 | 223 | $fields[ (string)$input['id'] ] = array( |
| 224 | 224 | 'label' => rgar( $input, 'label' ), |
| 225 | 225 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 467 | 467 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
| 468 | 468 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
| 469 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 469 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 470 | 470 | $criteria['context_view_id'] = null; |
| 471 | 471 | } |
| 472 | 472 | |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | ), |
| 1083 | 1083 | ); |
| 1084 | 1084 | |
| 1085 | - $fields = $date_created + $fields; |
|
| 1085 | + $fields = $date_created + $fields; |
|
| 1086 | 1086 | |
| 1087 | 1087 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1088 | 1088 | |
@@ -1094,13 +1094,13 @@ discard block |
||
| 1094 | 1094 | } |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | - /** |
|
| 1098 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1099 | - * @since 1.12 |
|
| 1100 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1101 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1102 | - */ |
|
| 1103 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1097 | + /** |
|
| 1098 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1099 | + * @since 1.12 |
|
| 1100 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1101 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1102 | + */ |
|
| 1103 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1104 | 1104 | |
| 1105 | 1105 | return $fields; |
| 1106 | 1106 | } |
@@ -1365,17 +1365,17 @@ discard block |
||
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | 1367 | |
| 1368 | - /** |
|
| 1369 | - * Display updated/error notice |
|
| 1370 | - * |
|
| 1371 | - * @param string $notice text/HTML of notice |
|
| 1372 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1373 | - * |
|
| 1374 | - * @return string |
|
| 1375 | - */ |
|
| 1376 | - public static function generate_notice( $notice, $class = '' ) { |
|
| 1377 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1378 | - } |
|
| 1368 | + /** |
|
| 1369 | + * Display updated/error notice |
|
| 1370 | + * |
|
| 1371 | + * @param string $notice text/HTML of notice |
|
| 1372 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1373 | + * |
|
| 1374 | + * @return string |
|
| 1375 | + */ |
|
| 1376 | + public static function generate_notice( $notice, $class = '' ) { |
|
| 1377 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1378 | + } |
|
| 1379 | 1379 | |
| 1380 | 1380 | |
| 1381 | 1381 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $has_poll_fields = true; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
| 293 | + if( GFCommon::is_product_field( $field['type'] ) ) { |
|
| 294 | 294 | $has_product_fields = true; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $fields = array(); |
| 375 | 375 | |
| 376 | - foreach ( $extra_fields as $key => $field ){ |
|
| 376 | + foreach ( $extra_fields as $key => $field ) { |
|
| 377 | 377 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
| 378 | 378 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
| 379 | 379 | } |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
| 914 | 914 | */ |
| 915 | 915 | public static function get_field( $form, $field_id ) { |
| 916 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 916 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 917 | 917 | return GFFormsModel::get_field( $form, $field_id ); |
| 918 | 918 | } else { |
| 919 | 919 | return null; |
@@ -960,7 +960,7 @@ discard block |
||
| 960 | 960 | $shortcodes = array(); |
| 961 | 961 | |
| 962 | 962 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 963 | - if ( empty( $matches ) ){ |
|
| 963 | + if ( empty( $matches ) ) { |
|
| 964 | 964 | return false; |
| 965 | 965 | } |
| 966 | 966 | |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
| 1424 | 1424 | $merged = $array1; |
| 1425 | 1425 | |
| 1426 | - foreach ( $array2 as $key => &$value ) { |
|
| 1426 | + foreach ( $array2 as $key => &$value ) { |
|
| 1427 | 1427 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1428 | 1428 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1429 | 1429 | } else { |