@@ -102,7 +102,7 @@ |
||
| 102 | 102 | $field_data = array( |
| 103 | 103 | 'label' => rgar( $edit_field, 'custom_label' ), |
| 104 | 104 | 'customLabel' => rgar( $edit_field, 'custom_label' ), |
| 105 | - 'content' => rgar( $edit_field, 'content' ), |
|
| 105 | + 'content' => rgar( $edit_field, 'content' ), |
|
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | // Replace merge tags in the content |
@@ -329,34 +329,34 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | - * Get the fields for a specific context |
|
| 333 | - * |
|
| 334 | - * @since 1.19.2 |
|
| 335 | - * |
|
| 332 | + * Get the fields for a specific context |
|
| 333 | + * |
|
| 334 | + * @since 1.19.2 |
|
| 335 | + * |
|
| 336 | 336 | * @param string $context [Optional] "directory", "single", or "edit" |
| 337 | 337 | * |
| 338 | 338 | * @return array Array of GravityView field layout configurations |
| 339 | 339 | */ |
| 340 | 340 | public function getContextFields( $context = '' ) { |
| 341 | 341 | |
| 342 | - if( '' === $context ) { |
|
| 343 | - $context = $this->getContext(); |
|
| 344 | - } |
|
| 342 | + if( '' === $context ) { |
|
| 343 | + $context = $this->getContext(); |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | 346 | $fields = $this->getFields(); |
| 347 | 347 | |
| 348 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 348 | + foreach ( (array) $fields as $key => $context_fields ) { |
|
| 349 | 349 | |
| 350 | - // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 351 | - $matches = explode( '_', $key ); |
|
| 350 | + // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 351 | + $matches = explode( '_', $key ); |
|
| 352 | 352 | |
| 353 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 354 | - return $context_fields; |
|
| 355 | - } |
|
| 356 | - } |
|
| 353 | + if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 354 | + return $context_fields; |
|
| 355 | + } |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | 358 | return array(); |
| 359 | - } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | 361 | /** |
| 362 | 362 | * @param array $fields |
@@ -449,10 +449,10 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | public function getPaging() { |
| 451 | 451 | |
| 452 | - $default_params = array( |
|
| 453 | - 'offset' => 0, |
|
| 454 | - 'page_size' => 20, |
|
| 455 | - ); |
|
| 452 | + $default_params = array( |
|
| 453 | + 'offset' => 0, |
|
| 454 | + 'page_size' => 20, |
|
| 455 | + ); |
|
| 456 | 456 | |
| 457 | 457 | return wp_parse_args( $this->paging, $default_params ); |
| 458 | 458 | } |
@@ -509,10 +509,10 @@ discard block |
||
| 509 | 509 | public function getSorting() { |
| 510 | 510 | |
| 511 | 511 | $defaults_params = array( |
| 512 | - 'sort_field' => 'date_created', |
|
| 513 | - 'sort_direction' => 'ASC', |
|
| 514 | - 'is_numeric' => false, |
|
| 515 | - ); |
|
| 512 | + 'sort_field' => 'date_created', |
|
| 513 | + 'sort_direction' => 'ASC', |
|
| 514 | + 'is_numeric' => false, |
|
| 515 | + ); |
|
| 516 | 516 | |
| 517 | 517 | return wp_parse_args( $this->sorting, $defaults_params ); |
| 518 | 518 | } |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
| 255 | - * @hack |
|
| 256 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 257 | - */ |
|
| 255 | + * @hack |
|
| 256 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 257 | + */ |
|
| 258 | 258 | if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
| 259 | - continue; |
|
| 260 | - } |
|
| 259 | + continue; |
|
| 260 | + } |
|
| 261 | 261 | $fields["{$input['id']}"] = array( |
| 262 | 262 | 'label' => rgar( $input, 'label' ), |
| 263 | 263 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 435 | 435 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
| 436 | 436 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
| 437 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 437 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 438 | 438 | $criteria['context_view_id'] = null; |
| 439 | 439 | } |
| 440 | 440 | |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | ), |
| 1197 | 1197 | ); |
| 1198 | 1198 | |
| 1199 | - $fields = $date_created + $fields; |
|
| 1199 | + $fields = $date_created + $fields; |
|
| 1200 | 1200 | |
| 1201 | 1201 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1202 | 1202 | |
@@ -1208,13 +1208,13 @@ discard block |
||
| 1208 | 1208 | } |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | - /** |
|
| 1212 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1213 | - * @since 1.12 |
|
| 1214 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1215 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1216 | - */ |
|
| 1217 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1211 | + /** |
|
| 1212 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1213 | + * @since 1.12 |
|
| 1214 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1215 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1216 | + */ |
|
| 1217 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1218 | 1218 | |
| 1219 | 1219 | return $fields; |
| 1220 | 1220 | } |
@@ -1506,26 +1506,26 @@ discard block |
||
| 1506 | 1506 | } |
| 1507 | 1507 | |
| 1508 | 1508 | |
| 1509 | - /** |
|
| 1510 | - * Display updated/error notice |
|
| 1511 | - * |
|
| 1512 | - * @since 1.19.2 Added $cap and $object_id parameters |
|
| 1513 | - * |
|
| 1514 | - * @param string $notice text/HTML of notice |
|
| 1515 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1516 | - * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
| 1517 | - * |
|
| 1518 | - * @return string |
|
| 1519 | - */ |
|
| 1520 | - public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
| 1521 | - |
|
| 1522 | - // If $cap is defined, only show notice if user has capability |
|
| 1523 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
| 1524 | - return ''; |
|
| 1525 | - } |
|
| 1526 | - |
|
| 1527 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1528 | - } |
|
| 1509 | + /** |
|
| 1510 | + * Display updated/error notice |
|
| 1511 | + * |
|
| 1512 | + * @since 1.19.2 Added $cap and $object_id parameters |
|
| 1513 | + * |
|
| 1514 | + * @param string $notice text/HTML of notice |
|
| 1515 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1516 | + * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps. |
|
| 1517 | + * |
|
| 1518 | + * @return string |
|
| 1519 | + */ |
|
| 1520 | + public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
|
| 1521 | + |
|
| 1522 | + // If $cap is defined, only show notice if user has capability |
|
| 1523 | + if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
| 1524 | + return ''; |
|
| 1525 | + } |
|
| 1526 | + |
|
| 1527 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1528 | + } |
|
| 1529 | 1529 | |
| 1530 | 1530 | /** |
| 1531 | 1531 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |