@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return GravityView_Compatibility |
77 | 77 | */ |
78 | 78 | public static function getInstance() { |
79 | - if( self::$instance ) { |
|
79 | + if ( self::$instance ) { |
|
80 | 80 | return self::$instance; |
81 | 81 | } |
82 | 82 | return new self; |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
139 | 139 | // show the notice, but not load any post types or process shortcodes. |
140 | 140 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
141 | - if( ! self::is_valid() ) { |
|
141 | + if ( ! self::is_valid() ) { |
|
142 | 142 | |
143 | 143 | // If the plugin's not loaded, might as well hide the shortcode for people. |
144 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
144 | + add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) ); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | } |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
169 | 169 | |
170 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
170 | + if ( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
171 | 171 | return null; |
172 | 172 | } |
173 | 173 | |
174 | 174 | $notices = self::get_notices(); |
175 | 175 | |
176 | - $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>'; |
|
177 | - foreach( (array)$notices as $notice ) { |
|
178 | - $message .= wpautop( $notice['message'] ); |
|
176 | + $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>'; |
|
177 | + foreach ( (array)$notices as $notice ) { |
|
178 | + $message .= wpautop( $notice[ 'message' ] ); |
|
179 | 179 | } |
180 | 180 | $message .= '</div>'; |
181 | 181 | |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | |
196 | 196 | if ( ! gravityview()->plugin->is_compatible_php() ) { |
197 | 197 | |
198 | - self::$notices['php_version'] = array( |
|
198 | + self::$notices[ 'php_version' ] = array( |
|
199 | 199 | 'class' => 'error', |
200 | - 'message' => sprintf( __( "%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' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
200 | + 'message' => sprintf( __( "%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' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
201 | 201 | 'cap' => 'manage_options', |
202 | 202 | 'dismiss' => 'php_version', |
203 | 203 | ); |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | if ( ! gravityview()->plugin->is_compatible_future_php() ) { |
209 | 209 | |
210 | 210 | // Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking. |
211 | - $key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
211 | + $key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
212 | 212 | |
213 | 213 | self::$notices[ $key ] = array( |
214 | 214 | 'class' => 'error', |
215 | - 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
215 | + 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
216 | 216 | 'cap' => 'manage_options', |
217 | 217 | 'dismiss' => $key, |
218 | 218 | ); |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | |
234 | 234 | if ( ! gravityview()->plugin->is_compatible_wordpress() ) { |
235 | 235 | |
236 | - self::$notices['wp_version'] = array( |
|
236 | + self::$notices[ 'wp_version' ] = array( |
|
237 | 237 | 'class' => 'error', |
238 | - 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
|
238 | + 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ), |
|
239 | 239 | 'cap' => 'update_core', |
240 | 240 | 'dismiss' => 'wp_version', |
241 | 241 | ); |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | public static function check_gravityforms() { |
259 | 259 | |
260 | 260 | // Bypass other checks: if the class exists |
261 | - if( class_exists( 'GFCommon' ) ) { |
|
261 | + if ( class_exists( 'GFCommon' ) ) { |
|
262 | 262 | |
263 | 263 | // Does the version meet future requirements? |
264 | - if( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
264 | + if ( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
265 | 265 | return true; |
266 | 266 | } |
267 | 267 | |
268 | 268 | // Does it meet minimum requirements? |
269 | 269 | $meets_minimum = gravityview()->plugin->is_compatible_gravityforms(); |
270 | 270 | |
271 | - if( $meets_minimum ) { |
|
271 | + if ( $meets_minimum ) { |
|
272 | 272 | /* translators: first placeholder is the future required version of Gravity Forms. The second placeholder is the current version of Gravity Forms. */ |
273 | 273 | $title = __( 'In the future, GravityView will require Gravity Forms Version %s or newer.', 'gravityview' ); |
274 | 274 | $version = GV_FUTURE_MIN_GF_VERSION; |
@@ -283,14 +283,14 @@ discard block |
||
283 | 283 | $message = '<h3>' . esc_html( sprintf( $title, $version ) ) . '</h3>'; |
284 | 284 | |
285 | 285 | /* translators: the placeholder is the current version of Gravity Forms. */ |
286 | - $message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>' ) . '</p>'; |
|
286 | + $message .= '<p>' . sprintf( esc_html__( "You're using Version %s. Please update your Gravity Forms or purchase a license.", 'gravityview' ), '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>' ) . '</p>'; |
|
287 | 287 | |
288 | 288 | /* translators: In this context, "get" means purchase */ |
289 | 289 | $message .= '<p><a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' . esc_html__( 'Get the Latest Gravity Forms', 'gravityview' ) . '</a></p>'; |
290 | 290 | |
291 | 291 | |
292 | 292 | // Show the notice even if the future version requirements aren't met |
293 | - self::$notices['gf_version'] = array( |
|
293 | + self::$notices[ 'gf_version' ] = array( |
|
294 | 294 | 'class' => $class, |
295 | 295 | 'message' => $message, |
296 | 296 | 'cap' => 'update_plugins', |
@@ -308,42 +308,42 @@ discard block |
||
308 | 308 | * OR |
309 | 309 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
310 | 310 | */ |
311 | - if( true === $gf_status || is_network_admin() ) { |
|
311 | + if ( true === $gf_status || is_network_admin() ) { |
|
312 | 312 | return true; |
313 | 313 | } |
314 | 314 | |
315 | 315 | // If GFCommon doesn't exist, assume GF not active |
316 | 316 | $return = false; |
317 | 317 | |
318 | - switch( $gf_status ) { |
|
318 | + switch ( $gf_status ) { |
|
319 | 319 | case 'inactive': |
320 | 320 | |
321 | 321 | // Required for multisite |
322 | - if( ! function_exists('wp_create_nonce') ) { |
|
322 | + if ( ! function_exists( 'wp_create_nonce' ) ) { |
|
323 | 323 | require_once ABSPATH . WPINC . '/pluggable.php'; |
324 | 324 | } |
325 | 325 | |
326 | 326 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
327 | - if( is_multisite() ) { |
|
327 | + if ( is_multisite() ) { |
|
328 | 328 | wp_cookie_constants(); |
329 | 329 | } |
330 | 330 | |
331 | 331 | $return = false; |
332 | 332 | |
333 | - $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">'; |
|
333 | + $button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">'; |
|
334 | 334 | |
335 | - self::$notices['gf_inactive'] = array( |
|
335 | + self::$notices[ 'gf_inactive' ] = array( |
|
336 | 336 | 'class' => 'error', |
337 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ), |
|
337 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ), |
|
338 | 338 | 'cap' => 'activate_plugins', |
339 | 339 | 'dismiss' => 'gf_inactive', |
340 | 340 | ); |
341 | 341 | |
342 | 342 | break; |
343 | 343 | default: |
344 | - self::$notices['gf_installed'] = array( |
|
344 | + self::$notices[ 'gf_installed' ] = array( |
|
345 | 345 | 'class' => 'error', |
346 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
346 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
347 | 347 | 'cap' => 'install_plugins', |
348 | 348 | 'dismiss' => 'gf_installed', |
349 | 349 | ); |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | */ |
361 | 361 | private static function check_gf_directory() { |
362 | 362 | |
363 | - if( class_exists( 'GFDirectory' ) ) { |
|
364 | - self::$notices['gf_directory'] = array( |
|
363 | + if ( class_exists( 'GFDirectory' ) ) { |
|
364 | + self::$notices[ 'gf_directory' ] = array( |
|
365 | 365 | 'class' => 'error is-dismissible', |
366 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
366 | + 'title' => __( 'Potential Conflict', 'gravityview' ), |
|
367 | 367 | 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
368 | 368 | 'dismiss' => 'gf_directory', |
369 | 369 | 'cap' => 'activate_plugins', |
@@ -382,21 +382,21 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public static function get_plugin_status( $location = '' ) { |
384 | 384 | |
385 | - if( ! function_exists('is_plugin_active') ) { |
|
385 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
386 | 386 | include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
387 | 387 | } |
388 | 388 | |
389 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
389 | + if ( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
390 | 390 | return true; |
391 | 391 | } |
392 | 392 | |
393 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
393 | + if ( ! is_network_admin() && is_plugin_active( $location ) ) { |
|
394 | 394 | return true; |
395 | 395 | } |
396 | 396 | |
397 | - if( |
|
398 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
399 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
397 | + if ( |
|
398 | + ! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
399 | + ! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
400 | 400 | ) { |
401 | 401 | return false; |
402 | 402 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
91 | + if ( empty( $views ) ) { |
|
92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
93 | 93 | return; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | private function add_hooks() { |
38 | 38 | /** @see \GV\Field::get_value_filters */ |
39 | 39 | add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 ); |
40 | - add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 ); |
|
40 | + add_action( 'gravityview/template/after', array( $this, 'print_script' ), 10, 1 ); |
|
41 | 41 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
42 | 42 | } |
43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function add_default_field( $entry_default_fields = array(), $form = array(), $zone = '' ) { |
54 | 54 | |
55 | - if( 'edit' !== $zone ) { |
|
55 | + if ( 'edit' !== $zone ) { |
|
56 | 56 | $entry_default_fields[ $this->name ] = array( |
57 | 57 | 'label' => $this->label, |
58 | 58 | 'desc' => $this->description, |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function get_content( $output, $template ) { |
77 | 77 | $entry = $template->entry; |
78 | 78 | |
79 | - $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png'; |
|
79 | + $star_url = GFCommon::get_base_url() . '/images/star' . intval( $entry[ 'is_starred' ] ) . '.png'; |
|
80 | 80 | |
81 | 81 | $entry_id = ''; |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // if( $show_as_star ) |
88 | - $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'. intval( $entry['is_starred'] ) .'" src="'. esc_attr( $star_url ) .'" />'; |
|
88 | + $output = '<img class="gv-star-image" ' . $entry_id . ' data-is_starred="' . intval( $entry[ 'is_starred' ] ) . '" src="' . esc_attr( $star_url ) . '" />'; |
|
89 | 89 | |
90 | 90 | self::$has_star_field = true; |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function print_script( $context ) { |
104 | 104 | |
105 | - if( ! self::$has_star_field ) { |
|
105 | + if ( ! self::$has_star_field ) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 |
@@ -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 |
@@ -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 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | global $post; |
35 | 35 | |
36 | 36 | if ( $post ) { |
37 | - $context['post'] = $post; |
|
37 | + $context[ 'post' ] = $post; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | \GV\Mocks\Legacy_Context::push( $context ); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @var array |
87 | 87 | */ |
88 | - private $template_data_var_names = array('data'); |
|
88 | + private $template_data_var_names = array( 'data' ); |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Clean up template data. |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | public function set_template_data( $data, $var_name = 'data' ) { |
139 | 139 | global $wp_query; |
140 | 140 | |
141 | - $wp_query->query_vars[ $var_name ] = (object) $data; |
|
141 | + $wp_query->query_vars[ $var_name ] = (object)$data; |
|
142 | 142 | |
143 | 143 | // Add $var_name to custom variable store if not default value |
144 | - if( $var_name !== 'data' ) { |
|
145 | - $this->template_data_var_names[] = $var_name; |
|
144 | + if ( $var_name !== 'data' ) { |
|
145 | + $this->template_data_var_names[ ] = $var_name; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $this; |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | |
166 | 166 | // Remove each custom data reference from $wp_query |
167 | 167 | foreach ( $custom_var_names as $var ) { |
168 | - if ( isset( $wp_query->query_vars[$var] ) ) { |
|
169 | - unset( $wp_query->query_vars[$var] ); |
|
168 | + if ( isset( $wp_query->query_vars[ $var ] ) ) { |
|
169 | + unset( $wp_query->query_vars[ $var ] ); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | protected function get_template_file_names( $slug, $name ) { |
187 | 187 | $templates = array(); |
188 | 188 | if ( isset( $name ) ) { |
189 | - $templates[] = $slug . '-' . $name . '.php'; |
|
189 | + $templates[ ] = $slug . '-' . $name . '.php'; |
|
190 | 190 | } |
191 | - $templates[] = $slug . '.php'; |
|
191 | + $templates[ ] = $slug . '.php'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Allow template choices to be filtered. |
@@ -224,18 +224,18 @@ discard block |
||
224 | 224 | public function locate_template( $template_names, $load = false, $require_once = true ) { |
225 | 225 | |
226 | 226 | // Use $template_names as a cache key - either first element of array or the variable itself if it's a string |
227 | - $cache_key = is_array( $template_names ) ? $template_names[0] : $template_names; |
|
227 | + $cache_key = is_array( $template_names ) ? $template_names[ 0 ] : $template_names; |
|
228 | 228 | |
229 | 229 | // If the key is in the cache array, we've already located this file. |
230 | - if ( isset( $this->template_path_cache[$cache_key] ) ) { |
|
231 | - $located = $this->template_path_cache[$cache_key]; |
|
230 | + if ( isset( $this->template_path_cache[ $cache_key ] ) ) { |
|
231 | + $located = $this->template_path_cache[ $cache_key ]; |
|
232 | 232 | } else { |
233 | 233 | |
234 | 234 | // No file found yet. |
235 | 235 | $located = false; |
236 | 236 | |
237 | 237 | // Remove empty entries. |
238 | - $template_names = array_filter( (array) $template_names ); |
|
238 | + $template_names = array_filter( (array)$template_names ); |
|
239 | 239 | $template_paths = $this->get_template_paths(); |
240 | 240 | |
241 | 241 | // Try to find a template file. |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | if ( file_exists( $template_path . $template_name ) ) { |
249 | 249 | $located = $template_path . $template_name; |
250 | 250 | // Store the template path in the cache |
251 | - $this->template_path_cache[$cache_key] = $located; |
|
251 | + $this->template_path_cache[ $cache_key ] = $located; |
|
252 | 252 | break 2; |
253 | 253 | } |
254 | 254 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | // Only add this conditionally, so non-child themes don't redundantly check active theme twice. |
285 | 285 | if ( get_stylesheet_directory() !== get_template_directory() ) { |
286 | - $file_paths[1] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
286 | + $file_paths[ 1 ] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -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; |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | * @internal Fixed $form['title'] in Gravity Forms |
344 | 344 | * @see https://github.com/gravityforms/gravityforms/pull/27/files |
345 | 345 | */ |
346 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
347 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
348 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
346 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
347 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
348 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
349 | 349 | |
350 | 350 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data ); |
351 | 351 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | // Is there is {gv_entry_link} or {gv_entry_link:[post id]} or {gv_entry_link:[post id]:[action]} merge tag? |
407 | 407 | preg_match_all( "/{gv_entry_link(?:\:(\d+)\:?(.*?))?}/ism", $original_text, $matches, PREG_SET_ORDER ); |
408 | 408 | |
409 | - if( empty( $matches ) ) { |
|
409 | + if ( empty( $matches ) ) { |
|
410 | 410 | return $original_text; |
411 | 411 | } |
412 | 412 | |
@@ -427,18 +427,18 @@ discard block |
||
427 | 427 | * } |
428 | 428 | */ |
429 | 429 | foreach ( $matches as $match ) { |
430 | - $full_tag = $match[0]; |
|
430 | + $full_tag = $match[ 0 ]; |
|
431 | 431 | |
432 | 432 | $link_args = array( |
433 | 433 | 'return' => 'url', |
434 | - 'entry_id' => $entry['id'], |
|
434 | + 'entry_id' => $entry[ 'id' ], |
|
435 | 435 | 'post_id' => \GV\Utils::get( $match, 1, null ), |
436 | 436 | 'action' => \GV\Utils::get( $match, 2, 'read' ), |
437 | 437 | ); |
438 | 438 | |
439 | 439 | $entry_link = $Shortcode->read_shortcode( $link_args, null, 'gv_entry_link_merge_tag' ); |
440 | 440 | |
441 | - if( $url_encode ) { |
|
441 | + if ( $url_encode ) { |
|
442 | 442 | $entry_link = urlencode( $entry_link ); |
443 | 443 | } |
444 | 444 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
476 | 476 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
477 | 477 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
478 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
478 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
479 | 479 | ); |
480 | 480 | |
481 | 481 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | return $original_text; |
553 | 553 | } |
554 | 554 | |
555 | - foreach ( (array) $matches as $match ) { |
|
556 | - $full_tag = $match[0]; |
|
555 | + foreach ( (array)$matches as $match ) { |
|
556 | + $full_tag = $match[ 0 ]; |
|
557 | 557 | $modifier = \GV\Utils::get( $match, 2, 'permalink' ); |
558 | 558 | |
559 | 559 | $replacement = false; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $replacement = esc_html( $replacement ); |
572 | 572 | } |
573 | 573 | |
574 | - if( $url_encode ) { |
|
574 | + if ( $url_encode ) { |
|
575 | 575 | $replacement = urlencode( $replacement ); |
576 | 576 | } |
577 | 577 | |
@@ -611,14 +611,14 @@ discard block |
||
611 | 611 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
612 | 612 | |
613 | 613 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
614 | - if( empty( $matches ) ) { |
|
614 | + if ( empty( $matches ) ) { |
|
615 | 615 | return $text; |
616 | 616 | } |
617 | 617 | |
618 | 618 | foreach ( $matches as $match ) { |
619 | 619 | |
620 | - $full_tag = $match[0]; |
|
621 | - $property = $match[1]; |
|
620 | + $full_tag = $match[ 0 ]; |
|
621 | + $property = $match[ 1 ]; |
|
622 | 622 | |
623 | 623 | $value = stripslashes_deep( \GV\Utils::_GET( $property ) ); |
624 | 624 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @since 1.15 |
643 | 643 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
644 | 644 | */ |
645 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
645 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
646 | 646 | |
647 | 647 | $value = $esc_html ? esc_html( $value ) : $value; |
648 | 648 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * @param[in] array $form Gravity Forms form array |
654 | 654 | * @param[in] array $entry Entry array |
655 | 655 | */ |
656 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
656 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
657 | 657 | |
658 | 658 | $text = str_replace( $full_tag, $value, $text ); |
659 | 659 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
83 | 83 | */ |
84 | - foreach( $this->lead_db_columns as $column ) { |
|
84 | + foreach ( $this->lead_db_columns as $column ) { |
|
85 | 85 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
86 | 86 | } |
87 | 87 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{lead_id} was deleted', array( 'form_id' => $entry['form_id'], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
117 | + gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{lead_id} was deleted', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
118 | 118 | |
119 | - $this->blacklist_add( $entry['form_id'] ); |
|
119 | + $this->blacklist_add( $entry[ 'form_id' ] ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function entry_updated( $form, $lead_id ) { |
131 | 131 | |
132 | - gravityview()->log->debug(' adding form {form_id} to blacklist because entry #{entry_id} was updated', array( 'form_id' => $form['id'], 'entry_id' => $lead_id ) ); |
|
132 | + gravityview()->log->debug( ' adding form {form_id} to blacklist because entry #{entry_id} was updated', array( 'form_id' => $form[ 'id' ], 'entry_id' => $lead_id ) ); |
|
133 | 133 | |
134 | - $this->blacklist_add( $form['id'] ); |
|
134 | + $this->blacklist_add( $form[ 'id' ] ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function entry_created( $entry, $form ) { |
148 | 148 | |
149 | - gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was created', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
149 | + gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was created', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
150 | 150 | |
151 | - $this->blacklist_add( $form['id'] ); |
|
151 | + $this->blacklist_add( $form[ 'id' ] ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was added', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
167 | + gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was added', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
168 | 168 | |
169 | - $this->blacklist_add( $form['id'] ); |
|
169 | + $this->blacklist_add( $form[ 'id' ] ); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // Normally just one form, but supports multiple forms |
186 | 186 | // |
187 | 187 | // Array of IDs 12, 5, 14 would result in `f:12-f:5-f:14` |
188 | - $forms = 'f:' . implode( '-f:', (array) $form_ids ); |
|
188 | + $forms = 'f:' . implode( '-f:', (array)$form_ids ); |
|
189 | 189 | |
190 | 190 | // Prefix for transient keys |
191 | 191 | // Now the prefix would be: `gv-cache-f:12-f:5-f:14-` |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ) ) ); |
243 | 243 | |
244 | 244 | // Add the passed form IDs |
245 | - $blacklist = array_merge( (array) $blacklist, $form_ids ); |
|
245 | + $blacklist = array_merge( (array)$blacklist, $form_ids ); |
|
246 | 246 | |
247 | 247 | // Don't duplicate |
248 | 248 | $blacklist = array_unique( $blacklist ); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | $blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() ); |
267 | 267 | |
268 | - $updated_list = array_diff( $blacklist, (array) $form_ids ); |
|
268 | + $updated_list = array_diff( $blacklist, (array)$form_ids ); |
|
269 | 269 | |
270 | 270 | gravityview()->log->debug( 'Removing form IDs from cache blacklist', array( 'data' => array( |
271 | 271 | '$form_ids' => $form_ids, |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | return false; |
299 | 299 | } |
300 | 300 | |
301 | - foreach ( (array) $form_ids as $form_id ) { |
|
301 | + foreach ( (array)$form_ids as $form_id ) { |
|
302 | 302 | |
303 | 303 | if ( in_array( $form_id, $blacklist ) ) { |
304 | 304 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
371 | 371 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
372 | 372 | */ |
373 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
373 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
374 | 374 | |
375 | 375 | gravityview()->log->debug( 'Setting cache with transient key {key} for {cache_time} seconds', array( 'key' => $this->key, 'cache_time' => $cache_time ) ); |
376 | 376 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | return; |
407 | 407 | } |
408 | 408 | |
409 | - foreach ( (array) $form_ids as $form_id ) { |
|
409 | + foreach ( (array)$form_ids as $form_id ) { |
|
410 | 410 | |
411 | 411 | $key = '_transient_gv-cache-'; |
412 | 412 | |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | public function use_cache() { |
523 | 523 | |
524 | 524 | // Exit early if debugging (unless running PHPUnit) |
525 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined('DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
525 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
526 | 526 | return apply_filters( 'gravityview_use_cache', false, $this ); |
527 | 527 | } |
528 | 528 | |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | |
531 | 531 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
532 | 532 | |
533 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
533 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
534 | 534 | |
535 | 535 | gravityview()->log->debug( 'Not using cache: ?cache or ?nocache is in the URL' ); |
536 | 536 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | */ |
558 | 558 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
559 | 559 | |
560 | - return (boolean) $use_cache; |
|
560 | + return (boolean)$use_cache; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | } |