@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 22 | 22 | |
| 23 | - unset( $field_options['search_filter'] ); |
|
| 23 | + unset( $field_options[ 'search_filter' ] ); |
|
| 24 | 24 | |
| 25 | - if( 'edit' === $context ) { |
|
| 25 | + if ( 'edit' === $context ) { |
|
| 26 | 26 | return $field_options; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $add_options['link_to_file'] = array( |
|
| 29 | + $add_options[ 'link_to_file' ] = array( |
|
| 30 | 30 | 'type' => 'checkbox', |
| 31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 33 | 33 | 'value' => false, |
| 34 | 34 | 'merge_tags' => false, |
| 35 | 35 | ); |
@@ -59,22 +59,22 @@ discard block |
||
| 59 | 59 | $output_arr = array(); |
| 60 | 60 | |
| 61 | 61 | // Get an array of file paths for the field. |
| 62 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 62 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 63 | 63 | |
| 64 | 64 | // Process each file path |
| 65 | - foreach( $file_paths as $file_path ) { |
|
| 65 | + foreach ( $file_paths as $file_path ) { |
|
| 66 | 66 | |
| 67 | 67 | // If the site is HTTPS, use HTTPS |
| 68 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
| 68 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
| 69 | 69 | |
| 70 | 70 | // This is from Gravity Forms's code |
| 71 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
| 71 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
| 72 | 72 | |
| 73 | 73 | // If the field is set to link to the single entry, link to it. |
| 74 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 74 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 75 | 75 | |
| 76 | 76 | // Get file path information |
| 77 | - $file_path_info = pathinfo($file_path); |
|
| 77 | + $file_path_info = pathinfo( $file_path ); |
|
| 78 | 78 | |
| 79 | 79 | $html_format = NULL; |
| 80 | 80 | |
@@ -83,30 +83,30 @@ discard block |
||
| 83 | 83 | $disable_wrapped_link = false; |
| 84 | 84 | |
| 85 | 85 | // Is this an image? |
| 86 | - $image = new GravityView_Image(array( |
|
| 86 | + $image = new GravityView_Image( array( |
|
| 87 | 87 | 'src' => $file_path, |
| 88 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
| 89 | - 'alt' => $field_settings['label'], |
|
| 90 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
| 91 | - )); |
|
| 88 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 89 | + 'alt' => $field_settings[ 'label' ], |
|
| 90 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
| 91 | + ) ); |
|
| 92 | 92 | |
| 93 | 93 | $content = $image->html(); |
| 94 | 94 | |
| 95 | 95 | // The new default content is the image, if it exists. If not, use the file name as the content. |
| 96 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
| 96 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
| 97 | 97 | |
| 98 | 98 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 99 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 99 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | - switch( true ) { |
|
| 102 | + switch ( true ) { |
|
| 103 | 103 | |
| 104 | 104 | // Audio file |
| 105 | 105 | case in_array( $extension, wp_get_audio_extensions() ): |
| 106 | 106 | |
| 107 | 107 | $disable_lightbox = true; |
| 108 | 108 | |
| 109 | - if( shortcode_exists( 'audio' ) ) { |
|
| 109 | + if ( shortcode_exists( 'audio' ) ) { |
|
| 110 | 110 | |
| 111 | 111 | $disable_wrapped_link = true; |
| 112 | 112 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 119 | 119 | 'src' => $file_path, |
| 120 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 121 | - )); |
|
| 120 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 121 | + ) ); |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Generate the audio shortcode |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $disable_lightbox = true; |
| 138 | 138 | |
| 139 | - if( shortcode_exists( 'video' ) ) { |
|
| 139 | + if ( shortcode_exists( 'video' ) ) { |
|
| 140 | 140 | |
| 141 | 141 | $disable_wrapped_link = true; |
| 142 | 142 | |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 149 | 149 | 'src' => $file_path, |
| 150 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 151 | - )); |
|
| 150 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 151 | + ) ); |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Generate the video shortcode |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | break; |
| 171 | 171 | |
| 172 | 172 | // if not image, do not set the lightbox (@since 1.5.3) |
| 173 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 173 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 174 | 174 | |
| 175 | 175 | $disable_lightbox = true; |
| 176 | 176 | |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // If using Link to File, override the content. |
| 182 | 182 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
| 183 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
| 183 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
| 184 | 184 | |
| 185 | 185 | // Force the content to be the file name |
| 186 | - $content = $file_path_info["basename"]; |
|
| 186 | + $content = $file_path_info[ "basename" ]; |
|
| 187 | 187 | |
| 188 | 188 | // Restore the wrapped link |
| 189 | 189 | $disable_wrapped_link = false; |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Whether to use lightbox or not |
| 194 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
| 194 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 195 | 195 | |
| 196 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
| 196 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
| 197 | 197 | |
| 198 | 198 | } else { |
| 199 | 199 | |
| 200 | 200 | $link_atts = array( |
| 201 | - 'rel' => sprintf( "%s-%s", $gv_class, $entry['id'] ), |
|
| 201 | + 'rel' => sprintf( "%s-%s", $gv_class, $entry[ 'id' ] ), |
|
| 202 | 202 | 'target' => '_blank', |
| 203 | 203 | 'class' => 'thickbox', |
| 204 | 204 | ); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
| 223 | 223 | |
| 224 | 224 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
| 225 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 225 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * Modify the link text (defaults to the file name) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $content = gravityview_get_link( $link, $content, $link_atts ); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - $output_arr[] = array( |
|
| 240 | + $output_arr[ ] = array( |
|
| 241 | 241 | 'file_path' => $file_path, |
| 242 | 242 | 'content' => $content |
| 243 | 243 | ); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 27 | 27 | |
| 28 | - if( 'edit' === $context ) { |
|
| 28 | + if ( 'edit' === $context ) { |
|
| 29 | 29 | return $field_options; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $field_options['trim_words'] = array( |
|
| 32 | + $field_options[ 'trim_words' ] = array( |
|
| 33 | 33 | 'type' => 'number', |
| 34 | 34 | 'merge_tags' => false, |
| 35 | 35 | 'value' => null, |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - $field_options['make_clickable'] = array( |
|
| 40 | + $field_options[ 'make_clickable' ] = array( |
|
| 41 | 41 | 'type' => 'checkbox', |
| 42 | 42 | 'merge_tags' => false, |
| 43 | 43 | 'value' => 0, |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 29 | 29 | |
| 30 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
| 30 | + unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
@@ -28,17 +28,17 @@ |
||
| 28 | 28 | |
| 29 | 29 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 30 | 30 | |
| 31 | - $field_options['number_format'] = array( |
|
| 31 | + $field_options[ 'number_format' ] = array( |
|
| 32 | 32 | 'type' => 'checkbox', |
| 33 | 33 | 'label' => __( 'Format number?', 'gravityview' ), |
| 34 | - 'desc' => __('Display numbers with thousands separators.', 'gravityview'), |
|
| 34 | + 'desc' => __( 'Display numbers with thousands separators.', 'gravityview' ), |
|
| 35 | 35 | 'value' => false, |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - $field_options['decimals'] = array( |
|
| 38 | + $field_options[ 'decimals' ] = array( |
|
| 39 | 39 | 'type' => 'number', |
| 40 | 40 | 'label' => __( 'Decimals', 'gravityview' ), |
| 41 | - 'desc' => __('Precision of the number of decimal places. Leave blank to use existing precision.', 'gravityview'), |
|
| 41 | + 'desc' => __( 'Precision of the number of decimal places. Leave blank to use existing precision.', 'gravityview' ), |
|
| 42 | 42 | 'value' => '', |
| 43 | 43 | 'merge_tags' => false, |
| 44 | 44 | ); |
@@ -24,20 +24,20 @@ |
||
| 24 | 24 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 25 | 25 | |
| 26 | 26 | // If this is NOT the full address field, return default options. |
| 27 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 27 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 28 | 28 | return $field_options; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if( 'edit' === $context ) { |
|
| 31 | + if ( 'edit' === $context ) { |
|
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $add_options = array(); |
| 36 | 36 | |
| 37 | - $add_options['show_map_link'] = array( |
|
| 37 | + $add_options[ 'show_map_link' ] = array( |
|
| 38 | 38 | 'type' => 'checkbox', |
| 39 | 39 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 40 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 40 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 41 | 41 | 'value' => true, |
| 42 | 42 | 'merge_tags' => false, |
| 43 | 43 | ); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 31 | 31 | |
| 32 | - $this->add_field_support('link_to_post', $field_options ); |
|
| 32 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
| 33 | 33 | |
| 34 | 34 | return $field_options; |
| 35 | 35 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | public function get_content( $output, $entry, $field_settings, $field ) { |
| 59 | 59 | |
| 60 | 60 | /** Overridden by a template. */ |
| 61 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 61 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 62 | 62 | |
| 63 | 63 | return $this->get_string_from_value( $output ); |
| 64 | 64 | } |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | switch ( intval( $value ) ) { |
| 78 | 78 | case self::NOT_FULFILLED: |
| 79 | 79 | default: |
| 80 | - $return = __('Not Fulfilled', 'gravityview'); |
|
| 80 | + $return = __( 'Not Fulfilled', 'gravityview' ); |
|
| 81 | 81 | break; |
| 82 | 82 | |
| 83 | 83 | case self::FULFILLED: |
| 84 | - $return = __('Fulfilled', 'gravityview'); |
|
| 84 | + $return = __( 'Fulfilled', 'gravityview' ); |
|
| 85 | 85 | break; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return string Original text if {is_fulfilled} isn't found. Otherwise, "Not Fulfilled" or "Fulfilled" |
| 103 | 103 | */ |
| 104 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 104 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 105 | 105 | |
| 106 | 106 | $return = $text; |
| 107 | 107 | |
| 108 | 108 | foreach ( $matches as $match ) { |
| 109 | 109 | |
| 110 | - $full_tag = $match[0]; |
|
| 110 | + $full_tag = $match[ 0 ]; |
|
| 111 | 111 | |
| 112 | 112 | $fulfilled = rgar( $entry, 'is_fulfilled' ); |
| 113 | 113 | |
@@ -25,13 +25,13 @@ |
||
| 25 | 25 | |
| 26 | 26 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 27 | 27 | |
| 28 | - if( 'edit' === $context ) { |
|
| 28 | + if ( 'edit' === $context ) { |
|
| 29 | 29 | return $field_options; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $this->add_field_support('link_to_post', $field_options ); |
|
| 32 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
| 33 | 33 | |
| 34 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 34 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 35 | 35 | |
| 36 | 36 | return $field_options; |
| 37 | 37 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 34 | 34 | |
| 35 | - if( 'edit' === $context ) { |
|
| 35 | + if ( 'edit' === $context ) { |
|
| 36 | 36 | return $field_options; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - $this->add_field_support('date_display', $field_options ); |
|
| 39 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 40 | 40 | |
| 41 | 41 | return $field_options; |
| 42 | 42 | } |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
| 59 | 59 | |
| 60 | 60 | /** Overridden by a template. */ |
| 61 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 61 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 62 | 62 | |
| 63 | - return GVCommon::format_date( $field['value'], 'format='.rgar( $field_settings, 'date_display' ) ); |
|
| 63 | + return GVCommon::format_date( $field[ 'value' ], 'format=' . rgar( $field_settings, 'date_display' ) ); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
| 80 | 80 | */ |
| 81 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 81 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 82 | 82 | |
| 83 | 83 | $return = $text; |
| 84 | 84 | |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | foreach ( $matches as $match ) { |
| 89 | 89 | |
| 90 | - $full_tag = $match[0]; |
|
| 91 | - $property = $match[1]; |
|
| 90 | + $full_tag = $match[ 0 ]; |
|
| 91 | + $property = $match[ 1 ]; |
|
| 92 | 92 | |
| 93 | 93 | $formatted_date = GravityView_Merge_Tags::format_date( $date_created, $property ); |
| 94 | 94 | |