@@ -135,7 +135,7 @@ |
||
135 | 135 | * @param bool $url_encode Whether to URL-encode output |
136 | 136 | * @param bool $esc_html Whether to apply `esc_html()` to output |
137 | 137 | * |
138 | - * @return mixed |
|
138 | + * @return string |
|
139 | 139 | */ |
140 | 140 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
141 | 141 |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
112 | 112 | |
113 | - if( $this->_custom_merge_tag ) { |
|
113 | + if ( $this->_custom_merge_tag ) { |
|
114 | 114 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
115 | 115 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
116 | 116 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
134 | 134 | */ |
135 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
135 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
136 | 136 | |
137 | 137 | /** |
138 | 138 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @see GFCommon::replace_variables_prepopulate() |
141 | 141 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
142 | 142 | */ |
143 | - if( false === $form ) { |
|
143 | + if ( false === $form ) { |
|
144 | 144 | return $text; |
145 | 145 | } |
146 | 146 | |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
175 | 175 | |
176 | - foreach( $matches as $match ) { |
|
176 | + foreach ( $matches as $match ) { |
|
177 | 177 | |
178 | - $full_tag = $match[0]; |
|
178 | + $full_tag = $match[ 0 ]; |
|
179 | 179 | |
180 | 180 | // Strip the Merge Tags |
181 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
181 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
182 | 182 | |
183 | 183 | // Replace the value from the entry, if exists |
184 | - if( isset( $entry[ $tag ] ) ) { |
|
184 | + if ( isset( $entry[ $tag ] ) ) { |
|
185 | 185 | |
186 | 186 | $value = $entry[ $tag ]; |
187 | 187 | |
188 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
188 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
189 | 189 | $value = $this->get_content( $value ); |
190 | 190 | } |
191 | 191 | |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function _filter_sortable_fields( $not_sortable ) { |
260 | 260 | |
261 | - if( ! $this->is_sortable ) { |
|
262 | - $not_sortable[] = $this->name; |
|
261 | + if ( ! $this->is_sortable ) { |
|
262 | + $not_sortable[ ] = $this->name; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | return $not_sortable; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | 'date_display' => array( |
289 | 289 | 'type' => 'text', |
290 | 290 | 'label' => __( 'Override Date Format', 'gravityview' ), |
291 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
291 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
292 | 292 | /** |
293 | 293 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
294 | 294 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | $options = $this->field_support_options(); |
315 | 315 | |
316 | - if( isset( $options[ $key ] ) ) { |
|
316 | + if ( isset( $options[ $key ] ) ) { |
|
317 | 317 | $field_options[ $key ] = $options[ $key ]; |
318 | 318 | } |
319 | 319 |
@@ -66,20 +66,20 @@ discard block |
||
66 | 66 | |
67 | 67 | /** Load common & connector functions */ |
68 | 68 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
69 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
70 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
69 | +require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
70 | +require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
71 | 71 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
72 | 72 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
73 | 73 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
74 | 74 | |
75 | 75 | /** Register Post Types and Rewrite Rules */ |
76 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
76 | +require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
77 | 77 | |
78 | 78 | /** Add Cache Class */ |
79 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
79 | +require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
80 | 80 | |
81 | 81 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
82 | -if( is_admin() ) { |
|
82 | +if ( is_admin() ) { |
|
83 | 83 | register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
84 | 84 | register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
85 | 85 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public static function getInstance() { |
102 | 102 | |
103 | - if( empty( self::$instance ) ) { |
|
103 | + if ( empty( self::$instance ) ) { |
|
104 | 104 | self::$instance = new self; |
105 | 105 | } |
106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function __construct() { |
111 | 111 | |
112 | 112 | |
113 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
113 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function include_files() { |
141 | 141 | |
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
143 | 143 | |
144 | 144 | // Load fields |
145 | 145 | include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' ); |
@@ -150,19 +150,19 @@ discard block |
||
150 | 150 | include_once( $gv_field_filename ); |
151 | 151 | } |
152 | 152 | |
153 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
154 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
153 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
154 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
155 | 155 | |
156 | 156 | // Load Extensions |
157 | 157 | // @todo: Convert to a scan of the directory or a method where this all lives |
158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
158 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
160 | 160 | |
161 | 161 | // Load WordPress Widgets |
162 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
162 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
163 | 163 | |
164 | 164 | // Load GravityView Widgets |
165 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
165 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
166 | 166 | |
167 | 167 | // Add oEmbed |
168 | 168 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-logging.php' ); |
172 | 172 | |
173 | 173 | include_once( GRAVITYVIEW_DIR . 'includes/class-ajax.php' ); |
174 | - include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php'); |
|
174 | + include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php' ); |
|
175 | 175 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
176 | 176 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
178 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
178 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
179 | 179 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
180 | 180 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
181 | 181 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return bool |
191 | 191 | */ |
192 | 192 | public static function is_network_activated() { |
193 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
193 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @since 1.7.5.1 |
256 | 256 | */ |
257 | 257 | public static function include_widget_class() { |
258 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
258 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | if ( ! $loaded ) { |
278 | 278 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
279 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
279 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
280 | 280 | load_textdomain( 'gravityview', $mofile ); |
281 | 281 | } |
282 | 282 | |
@@ -302,12 +302,12 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function frontend_actions() { |
304 | 304 | |
305 | - if( self::is_admin() ) { return; } |
|
305 | + if ( self::is_admin() ) { return; } |
|
306 | 306 | |
307 | 307 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
308 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
309 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
310 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
308 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
309 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
310 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
311 | 311 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
312 | 312 | |
313 | 313 | |
@@ -332,8 +332,8 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public static function get_default_widget_areas() { |
334 | 334 | $default_areas = array( |
335 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
336 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
335 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
336 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
337 | 337 | ); |
338 | 338 | |
339 | 339 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param mixed $data Additional data to display |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public static function log_debug( $message, $data = null ){ |
|
354 | + public static function log_debug( $message, $data = null ) { |
|
355 | 355 | /** |
356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
357 | 357 | * @param string $message Message to display |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @param string $message log message |
366 | 366 | * @return void |
367 | 367 | */ |
368 | - public static function log_error( $message, $data = null ){ |
|
368 | + public static function log_error( $message, $data = null ) { |
|
369 | 369 | /** |
370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
371 | 371 | * @param string $message Error message to display |
@@ -376,4 +376,4 @@ discard block |
||
376 | 376 | |
377 | 377 | } // end class GravityView_Plugin |
378 | 378 | |
379 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
379 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param mixed $data Additional data to display |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public static function log_debug( $message, $data = null ){ |
|
354 | + public static function log_debug( $message, $data = null ) { |
|
355 | 355 | /** |
356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
357 | 357 | * @param string $message Message to display |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @param string $message log message |
366 | 366 | * @return void |
367 | 367 | */ |
368 | - public static function log_error( $message, $data = null ){ |
|
368 | + public static function log_error( $message, $data = null ) { |
|
369 | 369 | /** |
370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
371 | 371 | * @param string $message Error message to display |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function get_instance() { |
35 | 35 | |
36 | - if( ! self::$instance ) { |
|
36 | + if ( ! self::$instance ) { |
|
37 | 37 | self::$instance = new self; |
38 | 38 | } |
39 | 39 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) ); |
57 | 57 | add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 ); |
58 | 58 | add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 ); |
59 | - add_action( 'admin_init', array( $this, 'add_caps') ); |
|
59 | + add_action( 'admin_init', array( $this, 'add_caps' ) ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) { |
78 | 78 | |
79 | 79 | // Empty caps_to_check array |
80 | - if( ! $usercaps || ! $caps ) { |
|
80 | + if ( ! $usercaps || ! $caps ) { |
|
81 | 81 | return $usercaps; |
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled |
86 | 86 | */ |
87 | - if( ! empty( $usercaps['gravityview_full_access'] ) ) { |
|
87 | + if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) { |
|
88 | 88 | |
89 | 89 | $all_gravityview_caps = self::all_caps(); |
90 | 90 | |
91 | - foreach( $all_gravityview_caps as $gv_cap ) { |
|
91 | + foreach ( $all_gravityview_caps as $gv_cap ) { |
|
92 | 92 | $usercaps[ $gv_cap ] = true; |
93 | 93 | } |
94 | 94 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $all = $administrator; |
305 | 305 | |
306 | 306 | // If role is set, return caps_to_check for just that role. |
307 | - if( $single_role ) { |
|
307 | + if ( $single_role ) { |
|
308 | 308 | $caps = isset( ${$single_role} ) ? ${$single_role} : false; |
309 | 309 | return $flat_array ? $caps : array( $single_role => $caps ); |
310 | 310 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | $has_cap = false; |
336 | 336 | |
337 | - if( empty( $caps_to_check ) ) { |
|
337 | + if ( empty( $caps_to_check ) ) { |
|
338 | 338 | return $has_cap; |
339 | 339 | } |
340 | 340 | |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | $caps_to_check = self::maybe_add_full_access_caps( $caps_to_check ); |
343 | 343 | |
344 | 344 | foreach ( $caps_to_check as $cap ) { |
345 | - if( ! is_null( $object_id ) ) { |
|
345 | + if ( ! is_null( $object_id ) ) { |
|
346 | 346 | $has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id ); |
347 | 347 | } else { |
348 | 348 | $has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap ); |
349 | 349 | } |
350 | 350 | // At the first successful response, stop checking |
351 | - if( $has_cap ) { |
|
351 | + if ( $has_cap ) { |
|
352 | 352 | break; |
353 | 353 | } |
354 | 354 | } |
@@ -372,15 +372,15 @@ discard block |
||
372 | 372 | $all_gravityview_caps = self::all_caps(); |
373 | 373 | |
374 | 374 | // Are there any $caps_to_check that are from GravityView? |
375 | - if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
376 | - $caps_to_check[] = 'gravityview_full_access'; |
|
375 | + if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
376 | + $caps_to_check[ ] = 'gravityview_full_access'; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | $all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array(); |
380 | 380 | |
381 | 381 | // Are there any $caps_to_check that are from Gravity Forms? |
382 | - if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
383 | - $caps_to_check[] = 'gform_full_access'; |
|
382 | + if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
383 | + $caps_to_check[ ] = 'gform_full_access'; |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | return array_unique( $caps_to_check ); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $capabilities = self::all_caps(); |
403 | 403 | |
404 | 404 | // Loop through each role and remove GV caps_to_check |
405 | - foreach( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
405 | + foreach ( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
406 | 406 | foreach ( $capabilities as $cap ) { |
407 | 407 | $wp_roles->remove_cap( $role_slug, $cap ); |
408 | 408 | } |
@@ -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 | } |