@@ -63,7 +63,6 @@ |
||
| 63 | 63 | * Initializer. |
| 64 | 64 | * |
| 65 | 65 | * @param \GV\View $view The View connected to this template. |
| 66 | - * @param \GV\Entry_Collection $entries A collection of entries for this view. |
|
| 67 | 66 | * @param \GV\Request $request The request context. |
| 68 | 67 | */ |
| 69 | 68 | public function __construct( Entry $entry, View $view, Request $request ) { |
@@ -113,18 +113,18 @@ |
||
| 113 | 113 | global $post; |
| 114 | 114 | |
| 115 | 115 | if ( ! $this->request->is_view() && $post ) { |
| 116 | - $specifics []= sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 117 | - $specifics []= sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
| 118 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 119 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 116 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 117 | + $specifics [ ] = sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
| 118 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 119 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $specifics []= sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 123 | - $specifics []= sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
| 124 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 125 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 122 | + $specifics [ ] = sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 123 | + $specifics [ ] = sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
| 124 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 125 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 126 | 126 | |
| 127 | - $specifics []= sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
| 127 | + $specifics [ ] = sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
| 128 | 128 | |
| 129 | 129 | return array_merge( $specifics, $templates ); |
| 130 | 130 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | * @param \GV\Field $field The Field. |
| 52 | 52 | * @param \GV\Request $request The request. |
| 53 | 53 | * |
| 54 | - * @return void |
|
| 54 | + * @return string|null |
|
| 55 | 55 | */ |
| 56 | 56 | public function __construct( \GV\View $view, \GV\Entry $entry = null, \GV\Field $field = null, \GV\Request $request = null ) { |
| 57 | 57 | add_filter( $this->filter_prefix . '_get_template_part', array( $this, 'add_id_specific_templates' ), 10, 3 ); |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | $additional = array(); |
| 99 | 99 | |
| 100 | 100 | // form-19-table-body.php |
| 101 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
| 101 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
| 102 | 102 | |
| 103 | 103 | // view-3-table-body.php |
| 104 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
| 104 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
| 105 | 105 | |
| 106 | 106 | global $post; |
| 107 | 107 | if ( $post ) { |
| 108 | 108 | // page-19-table-body.php |
| 109 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
| 109 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | // Combine with existing table-body.php and table.php |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ob_start(); |
| 131 | 131 | |
| 132 | 132 | $request = new Mock_Request(); |
| 133 | - $request->returns['is_view'] = $this->view; |
|
| 133 | + $request->returns[ 'is_view' ] = $this->view; |
|
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | 136 | * You got one shot. One opportunity. To render all the widgets you have ever wanted. |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | global $wp_filter; |
| 144 | 144 | foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) { |
| 145 | - foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) { |
|
| 145 | + foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
| 146 | 146 | if ( strpos( $function_key, 'render_widget_hooks' ) ) { |
| 147 | - unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] ); |
|
| 147 | + unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] ); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | if ( $this->entry ) { |
| 156 | 156 | |
| 157 | - $request->returns['is_entry'] = $this->entry; |
|
| 157 | + $request->returns[ 'is_entry' ] = $this->entry; |
|
| 158 | 158 | |
| 159 | 159 | global $post; |
| 160 | 160 | |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | * This allows us to fake it till we make it. |
| 189 | 189 | */ |
| 190 | 190 | $parameters = $this->view->settings->as_atts(); |
| 191 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
| 191 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
| 192 | 192 | $has_multisort = true; |
| 193 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
| 194 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
| 195 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
| 193 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
| 194 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
| 195 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | 'fields' => $this->view->fields->by_visible( $this->view ), |
| 212 | 212 | 'in_the_loop' => true, |
| 213 | 213 | ), empty( $parameters ) ? array() : array( |
| 214 | - 'paging' => $parameters['paging'], |
|
| 215 | - 'sorting' => $parameters['sorting'], |
|
| 214 | + 'paging' => $parameters[ 'paging' ], |
|
| 215 | + 'sorting' => $parameters[ 'sorting' ], |
|
| 216 | 216 | ), $post ? array( |
| 217 | 217 | 'post' => $post, |
| 218 | 218 | ) : array() ) ); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @param GF_Field|false $field |
| 185 | 185 | * @param string $value |
| 186 | 186 | * |
| 187 | - * @return mixed|string |
|
| 187 | + * @return string |
|
| 188 | 188 | */ |
| 189 | 189 | private static function maybe_urlencode( $field = false, $value = '' ) { |
| 190 | 190 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * @param bool $url_encode Whether to URL-encode output |
| 350 | 350 | * @param bool $esc_html Whether to apply `esc_html()` to output |
| 351 | 351 | * |
| 352 | - * @return mixed |
|
| 352 | + * @return string |
|
| 353 | 353 | */ |
| 354 | 354 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 355 | 355 | |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | // matching regex => the value is the method to call to replace the value. |
| 53 | 53 | $gv_modifiers = array( |
| 54 | 54 | 'maxwords:(\d+)' => 'modifier_maxwords', /** @see modifier_maxwords */ |
| 55 | - 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
| 55 | + 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
| 56 | 56 | 'explode' => 'modifier_explode', /** @see modifier_explode */ |
| 57 | 57 | |
| 58 | 58 | /** @see modifier_strings */ |
| 59 | 59 | 'urlencode' => 'modifier_strings', |
| 60 | 60 | 'wpautop' => 'modifier_strings', |
| 61 | - 'esc_html' => 'modifier_strings', |
|
| 62 | - 'sanitize_html_class' => 'modifier_strings', |
|
| 61 | + 'esc_html' => 'modifier_strings', |
|
| 62 | + 'sanitize_html_class' => 'modifier_strings', |
|
| 63 | 63 | 'sanitize_title' => 'modifier_strings', |
| 64 | 64 | 'strtolower' => 'modifier_strings', |
| 65 | 65 | 'strtoupper' => 'modifier_strings', |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | $atts = array( |
| 459 | 459 | 'format' => self::get_format_from_modifiers( $exploded, false ), |
| 460 | - 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
| 460 | + 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
| 461 | 461 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
| 462 | 462 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
| 463 | 463 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $non_gv_modifiers = array_diff( $modifiers, array_keys( $gv_modifiers ) ); |
| 80 | 80 | |
| 81 | - $return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false); |
|
| 81 | + $return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false ); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | foreach ( $modifiers as $passed_modifier ) { |
| 85 | 85 | |
| 86 | - foreach( $gv_modifiers as $gv_modifier => $method ) { |
|
| 86 | + foreach ( $gv_modifiers as $gv_modifier => $method ) { |
|
| 87 | 87 | |
| 88 | 88 | // Uses ^ to only match the first modifier, to enforce same order as passed by GF |
| 89 | 89 | preg_match( '/^' . $gv_modifier . '/ism', $passed_modifier, $matches ); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private static function modifier_timestamp( $raw_value, $matches ) { |
| 134 | 134 | |
| 135 | - if( empty( $matches[0] ) ) { |
|
| 135 | + if ( empty( $matches[ 0 ] ) ) { |
|
| 136 | 136 | return $raw_value; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | private static function modifier_maxwords( $raw_value, $matches, $field = null ) { |
| 163 | 163 | |
| 164 | - if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
| 164 | + if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
| 165 | 165 | return $raw_value; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $max = intval( $matches[1] ); |
|
| 168 | + $max = intval( $matches[ 1 ] ); |
|
| 169 | 169 | |
| 170 | 170 | $more_placeholder = '[GVMORE]'; |
| 171 | 171 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | private static function modifier_explode( $raw_value, $matches, $value, $field = null ) { |
| 235 | 235 | |
| 236 | 236 | // For JSON-encoded arrays |
| 237 | - if( $json_array = json_decode( $raw_value, true ) ) { |
|
| 237 | + if ( $json_array = json_decode( $raw_value, true ) ) { |
|
| 238 | 238 | return implode( ' ', $json_array ); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | private static function modifier_strings( $raw_value, $matches, $value = '', $field = null ) { |
| 257 | 257 | |
| 258 | - if( empty( $matches[0] ) ) { |
|
| 258 | + if ( empty( $matches[ 0 ] ) ) { |
|
| 259 | 259 | return $raw_value; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $return = $raw_value; |
| 263 | 263 | |
| 264 | - switch( $matches[0] ) { |
|
| 264 | + switch ( $matches[ 0 ] ) { |
|
| 265 | 265 | case 'urlencode': |
| 266 | 266 | $return = urlencode( $raw_value ); |
| 267 | 267 | break; |
@@ -348,9 +348,9 @@ discard block |
||
| 348 | 348 | * @internal Fixed $form['title'] in Gravity Forms |
| 349 | 349 | * @see https://github.com/gravityforms/gravityforms/pull/27/files |
| 350 | 350 | */ |
| 351 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
| 352 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
| 353 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
| 351 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
| 352 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
| 353 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
| 354 | 354 | |
| 355 | 355 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data ); |
| 356 | 356 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | $site_url = get_site_url(); |
| 420 | 420 | |
| 421 | - if( $url_encode ) { |
|
| 421 | + if ( $url_encode ) { |
|
| 422 | 422 | $site_url = urlencode( $site_url ); |
| 423 | 423 | } |
| 424 | 424 | |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | // Is there is {gv_entry_link} or {gv_entry_link:[post id]} or {gv_entry_link:[post id]:[action]} merge tag? |
| 446 | 446 | preg_match_all( "/{gv_entry_link(?:\:(\d+)\:?(.*?))?}/ism", $original_text, $matches, PREG_SET_ORDER ); |
| 447 | 447 | |
| 448 | - if( empty( $matches ) ) { |
|
| 448 | + if ( empty( $matches ) ) { |
|
| 449 | 449 | return $original_text; |
| 450 | 450 | } |
| 451 | 451 | |
@@ -466,18 +466,18 @@ discard block |
||
| 466 | 466 | * } |
| 467 | 467 | */ |
| 468 | 468 | foreach ( $matches as $match ) { |
| 469 | - $full_tag = $match[0]; |
|
| 469 | + $full_tag = $match[ 0 ]; |
|
| 470 | 470 | |
| 471 | 471 | $link_args = array( |
| 472 | 472 | 'return' => 'url', |
| 473 | - 'entry_id' => $entry['id'], |
|
| 473 | + 'entry_id' => $entry[ 'id' ], |
|
| 474 | 474 | 'post_id' => \GV\Utils::get( $match, 1, null ), |
| 475 | 475 | 'action' => \GV\Utils::get( $match, 2, 'read' ), |
| 476 | 476 | ); |
| 477 | 477 | |
| 478 | 478 | $entry_link = $Shortcode->read_shortcode( $link_args, null, 'gv_entry_link_merge_tag' ); |
| 479 | 479 | |
| 480 | - if( $url_encode ) { |
|
| 480 | + if ( $url_encode ) { |
|
| 481 | 481 | $entry_link = urlencode( $entry_link ); |
| 482 | 482 | } |
| 483 | 483 | |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
| 515 | 515 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
| 516 | 516 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
| 517 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
| 517 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
| 518 | 518 | ); |
| 519 | 519 | |
| 520 | 520 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | return $original_text; |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - foreach ( (array) $matches as $match ) { |
|
| 595 | - $full_tag = $match[0]; |
|
| 594 | + foreach ( (array)$matches as $match ) { |
|
| 595 | + $full_tag = $match[ 0 ]; |
|
| 596 | 596 | $modifier = \GV\Utils::get( $match, 2, 'permalink' ); |
| 597 | 597 | |
| 598 | 598 | $replacement = false; |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | $replacement = esc_html( $replacement ); |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - if( $url_encode ) { |
|
| 613 | + if ( $url_encode ) { |
|
| 614 | 614 | $replacement = urlencode( $replacement ); |
| 615 | 615 | } |
| 616 | 616 | |
@@ -650,14 +650,14 @@ discard block |
||
| 650 | 650 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
| 651 | 651 | |
| 652 | 652 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
| 653 | - if( empty( $matches ) ) { |
|
| 653 | + if ( empty( $matches ) ) { |
|
| 654 | 654 | return $text; |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | foreach ( $matches as $match ) { |
| 658 | 658 | |
| 659 | - $full_tag = $match[0]; |
|
| 660 | - $property = $match[1]; |
|
| 659 | + $full_tag = $match[ 0 ]; |
|
| 660 | + $property = $match[ 1 ]; |
|
| 661 | 661 | |
| 662 | 662 | $value = stripslashes_deep( \GV\Utils::_GET( $property ) ); |
| 663 | 663 | |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | * @since 1.15 |
| 682 | 682 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
| 683 | 683 | */ |
| 684 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
| 684 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
| 685 | 685 | |
| 686 | 686 | $value = $esc_html ? esc_html( $value ) : $value; |
| 687 | 687 | |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | * @param[in] array $form Gravity Forms form array |
| 693 | 693 | * @param[in] array $entry Entry array |
| 694 | 694 | */ |
| 695 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
| 695 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
| 696 | 696 | |
| 697 | 697 | $text = str_replace( $full_tag, $value, $text ); |
| 698 | 698 | } |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class GV_License_Handler extends \GV\License_Handler { |
| 11 | 11 | /** |
| 12 | - * @param \GV\Addon_Settings $GFAddOn |
|
| 13 | 12 | * |
| 14 | 13 | * @deprecated Use \GV\License_Handler::get instead |
| 15 | 14 | * |
@@ -219,6 +219,9 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | + /** |
|
| 223 | + * @param string $key |
|
| 224 | + */ |
|
| 222 | 225 | public function getCurrentFieldSetting( $key ) { |
| 223 | 226 | $settings = $this->getCurrentField('field_settings'); |
| 224 | 227 | |
@@ -725,6 +728,7 @@ discard block |
||
| 725 | 728 | * |
| 726 | 729 | * @inheritdoc |
| 727 | 730 | * @see Gamajo_Template_Loader::locate_template() |
| 731 | + * @param string $template_names |
|
| 728 | 732 | * @return null|string NULL: Template not found; String: path to template |
| 729 | 733 | */ |
| 730 | 734 | function locate_template( $template_names, $load = false, $require_once = true ) { |
@@ -328,34 +328,34 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
| 331 | - * Get the fields for a specific context |
|
| 332 | - * |
|
| 333 | - * @since 1.19.2 |
|
| 334 | - * |
|
| 331 | + * Get the fields for a specific context |
|
| 332 | + * |
|
| 333 | + * @since 1.19.2 |
|
| 334 | + * |
|
| 335 | 335 | * @param string $context [Optional] "directory", "single", or "edit" |
| 336 | 336 | * |
| 337 | 337 | * @return array Array of GravityView field layout configurations |
| 338 | 338 | */ |
| 339 | 339 | public function getContextFields( $context = '' ) { |
| 340 | 340 | |
| 341 | - if( '' === $context ) { |
|
| 342 | - $context = $this->getContext(); |
|
| 343 | - } |
|
| 341 | + if( '' === $context ) { |
|
| 342 | + $context = $this->getContext(); |
|
| 343 | + } |
|
| 344 | 344 | |
| 345 | 345 | $fields = $this->getFields(); |
| 346 | 346 | |
| 347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 347 | + foreach ( (array) $fields as $key => $context_fields ) { |
|
| 348 | 348 | |
| 349 | - // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 350 | - $matches = explode( '_', $key ); |
|
| 349 | + // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 350 | + $matches = explode( '_', $key ); |
|
| 351 | 351 | |
| 352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | - return $context_fields; |
|
| 354 | - } |
|
| 355 | - } |
|
| 352 | + if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | + return $context_fields; |
|
| 354 | + } |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | 357 | return array(); |
| 358 | - } |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * @param array $fields |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | public function getPaging() { |
| 450 | 450 | |
| 451 | - $default_params = array( |
|
| 452 | - 'offset' => 0, |
|
| 453 | - 'page_size' => 20, |
|
| 454 | - ); |
|
| 451 | + $default_params = array( |
|
| 452 | + 'offset' => 0, |
|
| 453 | + 'page_size' => 20, |
|
| 454 | + ); |
|
| 455 | 455 | |
| 456 | 456 | return wp_parse_args( $this->paging, $default_params ); |
| 457 | 457 | } |
@@ -508,10 +508,10 @@ discard block |
||
| 508 | 508 | public function getSorting() { |
| 509 | 509 | |
| 510 | 510 | $defaults_params = array( |
| 511 | - 'sort_field' => 'date_created', |
|
| 512 | - 'sort_direction' => 'ASC', |
|
| 513 | - 'is_numeric' => false, |
|
| 514 | - ); |
|
| 511 | + 'sort_field' => 'date_created', |
|
| 512 | + 'sort_direction' => 'ASC', |
|
| 513 | + 'is_numeric' => false, |
|
| 514 | + ); |
|
| 515 | 515 | |
| 516 | 516 | return wp_parse_args( $this->sorting, $defaults_params ); |
| 517 | 517 | } |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | */ |
| 838 | 838 | public function render_widget_hooks( $view_id_or_context ) { |
| 839 | 839 | |
| 840 | - /** |
|
| 840 | + /** |
|
| 841 | 841 | * @deprecated Numeric argument is deprecated. Pass a \GV\Template_Context instead. |
| 842 | 842 | */ |
| 843 | 843 | if ( is_numeric( $view_id_or_context ) ) { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | die; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
| 19 | +if ( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
| 20 | 20 | require( GRAVITYVIEW_DIR . 'future/lib/class-gamajo-template-loader.php' ); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | 'atts' => NULL, |
| 158 | 158 | ) ); |
| 159 | 159 | |
| 160 | - foreach ($atts as $key => $value) { |
|
| 161 | - if( is_null( $value ) ) { |
|
| 160 | + foreach ( $atts as $key => $value ) { |
|
| 161 | + if ( is_null( $value ) ) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | $this->{$key} = $value; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | static function getInstance( $passed_post = NULL ) { |
| 190 | 190 | |
| 191 | - if( empty( self::$instance ) ) { |
|
| 191 | + if ( empty( self::$instance ) ) { |
|
| 192 | 192 | self::$instance = new self( $passed_post ); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function getCurrentField( $key = NULL ) { |
| 203 | 203 | |
| 204 | - if( !empty( $key ) ) { |
|
| 205 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
| 204 | + if ( ! empty( $key ) ) { |
|
| 205 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
| 206 | 206 | return $this->_current_field[ $key ]; |
| 207 | 207 | } |
| 208 | 208 | return NULL; |
@@ -213,16 +213,16 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | public function setCurrentFieldSetting( $key, $value ) { |
| 215 | 215 | |
| 216 | - if( !empty( $this->_current_field ) ) { |
|
| 217 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
| 216 | + if ( ! empty( $this->_current_field ) ) { |
|
| 217 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function getCurrentFieldSetting( $key ) { |
| 223 | - $settings = $this->getCurrentField('field_settings'); |
|
| 223 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
| 224 | 224 | |
| 225 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
| 225 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
| 226 | 226 | return $settings[ $key ]; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function getAtts( $key = NULL ) { |
| 255 | 255 | |
| 256 | - if( !empty( $key ) ) { |
|
| 257 | - if( isset( $this->atts[ $key ] ) ) { |
|
| 256 | + if ( ! empty( $key ) ) { |
|
| 257 | + if ( isset( $this->atts[ $key ] ) ) { |
|
| 258 | 258 | return $this->atts[ $key ]; |
| 259 | 259 | } |
| 260 | 260 | return NULL; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
| 322 | 322 | |
| 323 | - if( $fields && !empty( $key ) ) { |
|
| 323 | + if ( $fields && ! empty( $key ) ) { |
|
| 324 | 324 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -338,18 +338,18 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public function getContextFields( $context = '' ) { |
| 340 | 340 | |
| 341 | - if( '' === $context ) { |
|
| 341 | + if ( '' === $context ) { |
|
| 342 | 342 | $context = $this->getContext(); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | $fields = $this->getFields(); |
| 346 | 346 | |
| 347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 347 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
| 348 | 348 | |
| 349 | 349 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
| 350 | 350 | $matches = explode( '_', $key ); |
| 351 | 351 | |
| 352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 352 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
| 353 | 353 | return $context_fields; |
| 354 | 354 | } |
| 355 | 355 | } |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function getField( $key ) { |
| 372 | 372 | |
| 373 | - if( !empty( $key ) ) { |
|
| 374 | - if( isset( $this->fields[ $key ] ) ) { |
|
| 373 | + if ( ! empty( $key ) ) { |
|
| 374 | + if ( isset( $this->fields[ $key ] ) ) { |
|
| 375 | 375 | return $this->fields[ $key ]; |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -477,8 +477,8 @@ discard block |
||
| 477 | 477 | public function getPaginationCounts() { |
| 478 | 478 | |
| 479 | 479 | $paging = $this->getPaging(); |
| 480 | - $offset = $paging['offset']; |
|
| 481 | - $page_size = $paging['page_size']; |
|
| 480 | + $offset = $paging[ 'offset' ]; |
|
| 481 | + $page_size = $paging[ 'page_size' ]; |
|
| 482 | 482 | $total = $this->getTotalEntries(); |
| 483 | 483 | |
| 484 | 484 | if ( empty( $total ) ) { |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | */ |
| 500 | 500 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
| 501 | 501 | |
| 502 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
| 502 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -595,16 +595,16 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function getCurrentEntry() { |
| 597 | 597 | |
| 598 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
| 598 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
| 599 | 599 | $entries = $this->getEntries(); |
| 600 | - $entry = $entries[0]; |
|
| 600 | + $entry = $entries[ 0 ]; |
|
| 601 | 601 | } else { |
| 602 | 602 | $entry = $this->_current_entry; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | /** @since 1.16 Fixes DataTables empty entry issue */ |
| 606 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
| 607 | - $entry = $this->_current_field['entry']; |
|
| 606 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
| 607 | + $entry = $this->_current_field[ 'entry' ]; |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | return $entry; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
| 645 | 645 | |
| 646 | 646 | if ( empty( $zone ) ) { |
| 647 | - gravityview()->log->error( 'No zone defined.'); |
|
| 647 | + gravityview()->log->error( 'No zone defined.' ); |
|
| 648 | 648 | return NULL; |
| 649 | 649 | } |
| 650 | 650 | |
@@ -653,16 +653,16 @@ discard block |
||
| 653 | 653 | 'context' => $this->getContext(), |
| 654 | 654 | 'entry' => $this->getCurrentEntry(), |
| 655 | 655 | 'form' => $this->getForm(), |
| 656 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
| 656 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
| 657 | 657 | ); |
| 658 | 658 | |
| 659 | 659 | $final_atts = wp_parse_args( $atts, $defaults ); |
| 660 | 660 | |
| 661 | 661 | $output = ''; |
| 662 | 662 | |
| 663 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
| 663 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
| 664 | 664 | |
| 665 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
| 665 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
| 666 | 666 | |
| 667 | 667 | // Backward compatibility |
| 668 | 668 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -672,19 +672,19 @@ discard block |
||
| 672 | 672 | * @param \GravityView_View $this |
| 673 | 673 | * @deprecated Use `gravityview/template/table/fields` |
| 674 | 674 | */ |
| 675 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
| 675 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | if ( empty( $fields ) ) { |
| 679 | 679 | |
| 680 | - gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
| 680 | + gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
| 681 | 681 | |
| 682 | 682 | return NULL; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | $field_output = ''; |
| 686 | 686 | foreach ( $fields as $field ) { |
| 687 | - $final_atts['field'] = $field; |
|
| 687 | + $final_atts[ 'field' ] = $field; |
|
| 688 | 688 | |
| 689 | 689 | $field_output .= gravityview_field_output( $final_atts ); |
| 690 | 690 | } |
@@ -701,17 +701,17 @@ discard block |
||
| 701 | 701 | return NULL; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 705 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
| 704 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 705 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | $output .= $field_output; |
| 709 | 709 | |
| 710 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 710 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 711 | 711 | $output .= '</div>'; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - if( $echo ) { |
|
| 714 | + if ( $echo ) { |
|
| 715 | 715 | echo $output; |
| 716 | 716 | } |
| 717 | 717 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | */ |
| 730 | 730 | function locate_template( $template_names, $load = false, $require_once = true ) { |
| 731 | 731 | |
| 732 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 732 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 733 | 733 | |
| 734 | 734 | $located = $this->located_templates[ $template_names ]; |
| 735 | 735 | |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | // Set $load to always false so we handle it here. |
| 739 | 739 | $located = parent::locate_template( $template_names, false, $require_once ); |
| 740 | 740 | |
| 741 | - if( is_string( $template_names ) ) { |
|
| 741 | + if ( is_string( $template_names ) ) { |
|
| 742 | 742 | $this->located_templates[ $template_names ] = $located; |
| 743 | 743 | } |
| 744 | 744 | } |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | * @return mixed|null The stored data. |
| 757 | 757 | */ |
| 758 | 758 | public function __get( $name ) { |
| 759 | - if( isset( $this->{$name} ) ) { |
|
| 759 | + if ( isset( $this->{$name} ) ) { |
|
| 760 | 760 | return $this->{$name}; |
| 761 | 761 | } else { |
| 762 | 762 | return NULL; |
@@ -785,17 +785,17 @@ discard block |
||
| 785 | 785 | $additional = array(); |
| 786 | 786 | |
| 787 | 787 | // form-19-table-body.php |
| 788 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 788 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 789 | 789 | |
| 790 | - if( $view_id = $this->getViewId() ) { |
|
| 790 | + if ( $view_id = $this->getViewId() ) { |
|
| 791 | 791 | // view-3-table-body.php |
| 792 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
| 792 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - if( $this->getPostId() ) { |
|
| 795 | + if ( $this->getPostId() ) { |
|
| 796 | 796 | |
| 797 | 797 | // page-19-table-body.php |
| 798 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 798 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | // Combine with existing table-body.php and table.php |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
| 819 | 819 | |
| 820 | - if( !empty( $template_file) ) { |
|
| 820 | + if ( ! empty( $template_file ) ) { |
|
| 821 | 821 | |
| 822 | 822 | if ( $require_once ) { |
| 823 | 823 | require_once( $template_file ); |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | // Prevent being called twice |
| 894 | 894 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
| 895 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
| 895 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
| 896 | 896 | return; |
| 897 | 897 | } |
| 898 | 898 | |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | * @param string $zone Current widget zone, either `header` or `footer` |
| 915 | 915 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
| 916 | 916 | */ |
| 917 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
| 917 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
| 918 | 918 | |
| 919 | 919 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 920 | 920 | |
@@ -922,15 +922,15 @@ discard block |
||
| 922 | 922 | ?> |
| 923 | 923 | <div class="<?php echo $css_class; ?>"> |
| 924 | 924 | <?php |
| 925 | - foreach( $rows as $row ) { |
|
| 926 | - foreach( $row as $col => $areas ) { |
|
| 925 | + foreach ( $rows as $row ) { |
|
| 926 | + foreach ( $row as $col => $areas ) { |
|
| 927 | 927 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
| 928 | 928 | ?> |
| 929 | 929 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 930 | 930 | <?php |
| 931 | 931 | if ( ! empty( $areas ) ) { |
| 932 | 932 | foreach ( $areas as $area ) { |
| 933 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
| 933 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
| 934 | 934 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
| 935 | 935 | } |
| 936 | 936 | } |
@@ -45,7 +45,6 @@ discard block |
||
| 45 | 45 | * Trick the GF fileupload field to render with the proper HTML ID to enable the plupload JS to work properly |
| 46 | 46 | * |
| 47 | 47 | * @param array $form The Form Object currently being processed. |
| 48 | - * @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
|
| 49 | 48 | * @param null|array $entry Null or the Entry Object currently being edited. |
| 50 | 49 | * @param GF_Field_FileUpload $field Gravity Forms field |
| 51 | 50 | * |
@@ -74,6 +73,7 @@ discard block |
||
| 74 | 73 | * |
| 75 | 74 | * @since 2.0 |
| 76 | 75 | * @param \GV\Template_Context The context. |
| 76 | + * @param GV\Template_Context $context |
|
| 77 | 77 | * |
| 78 | 78 | * @return array Array of file output, with `file_path` and `html` keys (see comments above) |
| 79 | 79 | */ |
@@ -26,21 +26,21 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 28 | 28 | |
| 29 | - unset( $field_options['search_filter'] ); |
|
| 29 | + unset( $field_options[ 'search_filter' ] ); |
|
| 30 | 30 | |
| 31 | - if( 'edit' === $context ) { |
|
| 31 | + if ( 'edit' === $context ) { |
|
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $add_options['link_to_file'] = array( |
|
| 35 | + $add_options[ 'link_to_file' ] = array( |
|
| 36 | 36 | 'type' => 'checkbox', |
| 37 | 37 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 38 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 38 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 39 | 39 | 'value' => false, |
| 40 | 40 | 'merge_tags' => false, |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - $add_options['image_width'] = array( |
|
| 43 | + $add_options[ 'image_width' ] = array( |
|
| 44 | 44 | 'type' => 'text', |
| 45 | 45 | 'label' => __( 'Custom Width:', 'gravityview' ), |
| 46 | 46 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | $base_id = null; |
| 130 | 130 | |
| 131 | 131 | $is_single = gravityview_get_context() === 'single'; |
| 132 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 132 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 133 | 133 | $field_compat = $gravityview_view->getCurrentField(); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $output_arr = array(); |
| 137 | 137 | |
| 138 | 138 | // Get an array of file paths for the field. |
| 139 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 139 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 140 | 140 | |
| 141 | 141 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 142 | 142 | if ( ! is_array( $file_paths ) ) { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $rendered = null; |
| 157 | 157 | |
| 158 | 158 | // If the site is HTTPS, use HTTPS |
| 159 | - if ( function_exists('set_url_scheme') ) { |
|
| 159 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 160 | 160 | $file_path = set_url_scheme( $file_path ); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | $file_path_info = pathinfo( $file_path ); |
| 168 | 168 | |
| 169 | 169 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 170 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 171 | - $basename = $file_path_info['basename']; |
|
| 170 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 171 | + $basename = $file_path_info[ 'basename' ]; |
|
| 172 | 172 | |
| 173 | 173 | // Get the secure download URL |
| 174 | 174 | $is_secure = false; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 210 | 210 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 211 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 211 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 212 | 212 | ), $context ); |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 246 | 246 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 247 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 247 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 248 | 248 | ), $context ); |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -275,20 +275,20 @@ discard block |
||
| 275 | 275 | $file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path ); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - $field_settings['link_to_file'] = true; |
|
| 278 | + $field_settings[ 'link_to_file' ] = true; |
|
| 279 | 279 | |
| 280 | 280 | // Images |
| 281 | 281 | } else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) { |
| 282 | 282 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
| 283 | 283 | $image_atts = array( |
| 284 | 284 | 'src' => $file_path, |
| 285 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 286 | - 'alt' => $field_settings['label'], |
|
| 287 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
| 285 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 286 | + 'alt' => $field_settings[ 'label' ], |
|
| 287 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | 290 | if ( $is_secure ) { |
| 291 | - $image_atts['validate_src'] = false; |
|
| 291 | + $image_atts[ 'validate_src' ] = false; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | unset( $gv_entry ); |
| 311 | 311 | |
| 312 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
| 312 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 313 | 313 | $lightbox_link_atts = array( |
| 314 | 314 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 315 | 315 | 'class' => '', |
@@ -323,13 +323,13 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Show as link should render the image regardless. |
| 326 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
| 326 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 327 | 327 | $text = $rendered; |
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | // For all other non-media file types (ZIP, for example), always show as a link regardless of setting. |
| 331 | 331 | else { |
| 332 | - $field_settings['link_to_file'] = true; |
|
| 332 | + $field_settings[ 'link_to_file' ] = true; |
|
| 333 | 333 | $disable_lightbox = true; |
| 334 | 334 | } |
| 335 | 335 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 346 | 346 | |
| 347 | 347 | // Output textualized content where |
| 348 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
| 348 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 349 | 349 | /** |
| 350 | 350 | * Modify the link text (defaults to the file name) |
| 351 | 351 | * |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
| 360 | 360 | |
| 361 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
| 361 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 362 | 362 | /** |
| 363 | 363 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
| 364 | 364 | * @since 2.0 Added $context |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $content = empty( $rendered ) ? $text : $rendered; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - $output_arr[] = array( |
|
| 382 | + $output_arr[ ] = array( |
|
| 383 | 383 | 'file_path' => $file_path, |
| 384 | 384 | 'content' => $content |
| 385 | 385 | ); |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | * |
| 73 | 73 | * @param mixed $value The value in. |
| 74 | 74 | * |
| 75 | - * @return mixed The value out. |
|
| 75 | + * @return string The value out. |
|
| 76 | 76 | */ |
| 77 | 77 | public function get_value( $value ) { |
| 78 | 78 | return $this->get_string_from_value( $value ); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function get_content( $output, $entry = array(), $field_settings = array(), $field = array() ) { |
| 61 | 61 | |
| 62 | 62 | /** Overridden by a template. */ |
| 63 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 63 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 64 | 64 | |
| 65 | 65 | return $this->get_string_from_value( $output ); |
| 66 | 66 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | switch ( intval( $value ) ) { |
| 93 | 93 | case self::NOT_FULFILLED: |
| 94 | 94 | default: |
| 95 | - $return = __('Not Fulfilled', 'gravityview'); |
|
| 95 | + $return = __( 'Not Fulfilled', 'gravityview' ); |
|
| 96 | 96 | break; |
| 97 | 97 | |
| 98 | 98 | case self::FULFILLED: |
| 99 | - $return = __('Fulfilled', 'gravityview'); |
|
| 99 | + $return = __( 'Fulfilled', 'gravityview' ); |
|
| 100 | 100 | break; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return string Original text if {is_fulfilled} isn't found. Otherwise, "Not Fulfilled" or "Fulfilled" |
| 118 | 118 | */ |
| 119 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 119 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 120 | 120 | |
| 121 | 121 | $return = $text; |
| 122 | 122 | |
| 123 | 123 | foreach ( $matches as $match ) { |
| 124 | 124 | |
| 125 | - $full_tag = $match[0]; |
|
| 125 | + $full_tag = $match[ 0 ]; |
|
| 126 | 126 | |
| 127 | 127 | $fulfilled = \GV\Utils::get( $entry, 'is_fulfilled' ); |
| 128 | 128 | |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * @param \GV\Entry $entry The entry. |
| 70 | 70 | * @param \GV\Request $request The request context. |
| 71 | 71 | * |
| 72 | - * @return mixed $value The filtered value. |
|
| 72 | + * @return string $value The filtered value. |
|
| 73 | 73 | */ |
| 74 | 74 | public function get_value( $value, $field, $view, $source, $entry, $request ) { |
| 75 | 75 | return $this->get_content( $value, $entry->as_entry(), $field->as_configuration() ); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
| 50 | 50 | |
| 51 | 51 | /** Overridden by a template. */ |
| 52 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 52 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 53 | 53 | |
| 54 | 54 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
| 55 | 55 | $return = GFCommon::to_money( $amount, \GV\Utils::get( $entry, 'currency' ) ); |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
| 90 | 90 | */ |
| 91 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 91 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 92 | 92 | |
| 93 | 93 | $return = $text; |
| 94 | 94 | |
| 95 | 95 | foreach ( $matches as $match ) { |
| 96 | 96 | |
| 97 | - $full_tag = $match[0]; |
|
| 98 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
| 97 | + $full_tag = $match[ 0 ]; |
|
| 98 | + $modifier = isset( $match[ 1 ] ) ? $match[ 1 ] : false; |
|
| 99 | 99 | |
| 100 | 100 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
| 101 | 101 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | printf( '<body style="padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">' ); |
| 26 | 26 | printf( '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" alt="The GravityView Astronaut Says:" style="float: left; height: 60px; margin-right : 10px;" />' ); |
| 27 | 27 | printf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), |
| 28 | - '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_MIN_PHP_VERSION , "</h3>\n\n", $version ); |
|
| 28 | + '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_MIN_PHP_VERSION, "</h3>\n\n", $version ); |
|
| 29 | 29 | printf( '</body>' ); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ |
| 37 | -if ( version_compare( phpversion(), '5.3.0' , '<' ) ) { |
|
| 37 | +if ( version_compare( phpversion(), '5.3.0', '<' ) ) { |
|
| 38 | 38 | require GRAVITYVIEW_DIR . 'future/_stubs.php'; |
| 39 | 39 | |
| 40 | 40 | /** All looks fine. */ |