@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @since 1.7.4.1 |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - private static $search_parameters = array( 'gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*' ); |
|
23 | + private static $search_parameters = array('gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*'); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Is the currently viewed post a `gravityview` post type? |
@@ -85,18 +85,18 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
88 | + add_action('wp', array($this, 'parse_content'), 11); |
|
89 | + add_action('template_redirect', array($this, 'set_entry_data'), 1); |
|
90 | 90 | |
91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
92 | - add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
|
92 | + add_action('wp_enqueue_scripts', array($this, 'add_scripts_and_styles'), 20); |
|
93 | 93 | |
94 | 94 | // Enqueue and print styles in the footer. Added 1 priorty so stuff gets printed at 10 priority. |
95 | - add_action( 'wp_print_footer_scripts', array( $this, 'add_scripts_and_styles' ), 1 ); |
|
95 | + add_action('wp_print_footer_scripts', array($this, 'add_scripts_and_styles'), 1); |
|
96 | 96 | |
97 | - add_filter( 'the_title', array( $this, 'single_entry_title' ), 1, 2 ); |
|
98 | - add_filter( 'the_content', array( $this, 'insert_view_in_content' ) ); |
|
99 | - add_filter( 'comments_open', array( $this, 'comments_open' ), 10, 2 ); |
|
97 | + add_filter('the_title', array($this, 'single_entry_title'), 1, 2); |
|
98 | + add_filter('the_content', array($this, 'insert_view_in_content')); |
|
99 | + add_filter('comments_open', array($this, 'comments_open'), 10, 2); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public static function getInstance() { |
107 | 107 | |
108 | - if ( empty( self::$instance ) ) { |
|
108 | + if (empty(self::$instance)) { |
|
109 | 109 | self::$instance = new self; |
110 | 110 | self::$instance->initialize(); |
111 | 111 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | /** |
124 | 124 | * @param GravityView_View_Data $gv_output_data |
125 | 125 | */ |
126 | - public function setGvOutputData( $gv_output_data ) { |
|
126 | + public function setGvOutputData($gv_output_data) { |
|
127 | 127 | $this->gv_output_data = $gv_output_data; |
128 | 128 | } |
129 | 129 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * @param boolean $is_search |
139 | 139 | */ |
140 | - public function setIsSearch( $is_search ) { |
|
140 | + public function setIsSearch($is_search) { |
|
141 | 141 | $this->is_search = $is_search; |
142 | 142 | } |
143 | 143 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Sets the single entry ID and also the entry |
153 | 153 | * @param bool|int $single_entry |
154 | 154 | */ |
155 | - public function setSingleEntry( $single_entry ) { |
|
155 | + public function setSingleEntry($single_entry) { |
|
156 | 156 | |
157 | 157 | $this->single_entry = $single_entry; |
158 | 158 | |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | * Set the current entry |
170 | 170 | * @param array|int $entry Entry array or entry ID |
171 | 171 | */ |
172 | - public function setEntry( $entry ) { |
|
172 | + public function setEntry($entry) { |
|
173 | 173 | |
174 | - if ( ! is_array( $entry ) ) { |
|
175 | - $entry = GVCommon::get_entry( $entry ); |
|
174 | + if (!is_array($entry)) { |
|
175 | + $entry = GVCommon::get_entry($entry); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | $this->entry = $entry; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | /** |
189 | 189 | * @param int $post_id |
190 | 190 | */ |
191 | - public function setPostId( $post_id ) { |
|
191 | + public function setPostId($post_id) { |
|
192 | 192 | $this->post_id = $post_id; |
193 | 193 | } |
194 | 194 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | /** |
203 | 203 | * @param boolean $post_has_shortcode |
204 | 204 | */ |
205 | - public function setPostHasShortcode( $post_has_shortcode ) { |
|
205 | + public function setPostHasShortcode($post_has_shortcode) { |
|
206 | 206 | $this->post_has_shortcode = $post_has_shortcode; |
207 | 207 | } |
208 | 208 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | /** |
217 | 217 | * @param boolean $is_gravityview_post_type |
218 | 218 | */ |
219 | - public function setIsGravityviewPostType( $is_gravityview_post_type ) { |
|
219 | + public function setIsGravityviewPostType($is_gravityview_post_type) { |
|
220 | 220 | $this->is_gravityview_post_type = $is_gravityview_post_type; |
221 | 221 | } |
222 | 222 | |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @param null $view_id |
229 | 229 | */ |
230 | - public function set_context_view_id( $view_id = null ) { |
|
230 | + public function set_context_view_id($view_id = null) { |
|
231 | 231 | |
232 | - if ( ! empty( $view_id ) ) { |
|
232 | + if (!empty($view_id)) { |
|
233 | 233 | |
234 | 234 | $this->context_view_id = $view_id; |
235 | 235 | |
236 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
236 | + } elseif (isset($_GET['gvid']) && $this->getGvOutputData()->has_multiple_views()) { |
|
237 | 237 | /** |
238 | 238 | * used on a has_multiple_views context |
239 | 239 | * @see GravityView_API::entry_link |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | */ |
242 | 242 | $this->context_view_id = $_GET['gvid']; |
243 | 243 | |
244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
245 | - $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
|
246 | - $this->context_view_id = array_pop( $array_keys ); |
|
247 | - unset( $array_keys ); |
|
244 | + } elseif (!$this->getGvOutputData()->has_multiple_views()) { |
|
245 | + $array_keys = array_keys($this->getGvOutputData()->get_views()); |
|
246 | + $this->context_view_id = array_pop($array_keys); |
|
247 | + unset($array_keys); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | } |
@@ -265,31 +265,31 @@ discard block |
||
265 | 265 | * @param array $wp Passed in the `wp` hook. Not used. |
266 | 266 | * @return void |
267 | 267 | */ |
268 | - function parse_content( $wp = array() ) { |
|
268 | + function parse_content($wp = array()) { |
|
269 | 269 | global $post; |
270 | 270 | |
271 | 271 | // If in admin and NOT AJAX request, get outta here. |
272 | - if ( GravityView_Plugin::is_admin() ) { |
|
272 | + if (GravityView_Plugin::is_admin()) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | // Calculate requested Views |
277 | - $this->setGvOutputData( GravityView_View_Data::getInstance( $post ) ); |
|
277 | + $this->setGvOutputData(GravityView_View_Data::getInstance($post)); |
|
278 | 278 | |
279 | 279 | // !important: we need to run this before getting single entry (to kick the advanced filter) |
280 | 280 | $this->set_context_view_id(); |
281 | 281 | |
282 | - $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
|
282 | + $this->setIsGravityviewPostType(get_post_type($post) === 'gravityview'); |
|
283 | 283 | |
284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
285 | - $this->setPostId( $post_id ); |
|
286 | - $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
|
287 | - $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
|
284 | + $post_id = $this->getPostId() ? $this->getPostId() : (isset($post) ? $post->ID : null); |
|
285 | + $this->setPostId($post_id); |
|
286 | + $post_has_shortcode = !empty($post->post_content) ? gravityview_has_shortcode_r($post->post_content, 'gravityview') : false; |
|
287 | + $this->setPostHasShortcode($this->isGravityviewPostType() ? null : !empty($post_has_shortcode)); |
|
288 | 288 | |
289 | 289 | // check if the View is showing search results (only for multiple entries View) |
290 | - $this->setIsSearch( $this->is_searching() ); |
|
290 | + $this->setIsSearch($this->is_searching()); |
|
291 | 291 | |
292 | - unset( $entry, $post_id, $post_has_shortcode ); |
|
292 | + unset($entry, $post_id, $post_has_shortcode); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function set_entry_data() { |
299 | 299 | $entry_id = self::is_single_entry(); |
300 | - $this->setSingleEntry( $entry_id ); |
|
301 | - $this->setEntry( $entry_id ); |
|
300 | + $this->setSingleEntry($entry_id); |
|
301 | + $this->setEntry($entry_id); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -311,31 +311,31 @@ discard block |
||
311 | 311 | function is_searching() { |
312 | 312 | |
313 | 313 | // It's a single entry, not search |
314 | - if ( $this->getSingleEntry() ) { |
|
314 | + if ($this->getSingleEntry()) { |
|
315 | 315 | return false; |
316 | 316 | } |
317 | 317 | |
318 | 318 | // No $_GET parameters |
319 | - if ( empty( $_GET ) || ! is_array( $_GET ) ) { |
|
319 | + if (empty($_GET) || !is_array($_GET)) { |
|
320 | 320 | return false; |
321 | 321 | } |
322 | 322 | |
323 | 323 | // Remove empty values |
324 | - $get = array_filter( $_GET ); |
|
324 | + $get = array_filter($_GET); |
|
325 | 325 | |
326 | 326 | // If the $_GET parameters are empty, it's no search. |
327 | - if ( empty( $get ) ) { |
|
327 | + if (empty($get)) { |
|
328 | 328 | return false; |
329 | 329 | } |
330 | 330 | |
331 | - $search_keys = array_keys( $get ); |
|
331 | + $search_keys = array_keys($get); |
|
332 | 332 | |
333 | - $search_match = implode( '|', self::$search_parameters ); |
|
333 | + $search_match = implode('|', self::$search_parameters); |
|
334 | 334 | |
335 | - foreach ( $search_keys as $search_key ) { |
|
335 | + foreach ($search_keys as $search_key) { |
|
336 | 336 | |
337 | 337 | // Analyze the search key $_GET parameter and see if it matches known GV args |
338 | - if ( preg_match( '/(' . $search_match . ')/i', $search_key ) ) { |
|
338 | + if (preg_match('/('.$search_match.')/i', $search_key)) { |
|
339 | 339 | return true; |
340 | 340 | } |
341 | 341 | } |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | * @param int $passed_post_id Post ID |
351 | 351 | * @return string (modified) title |
352 | 352 | */ |
353 | - public function single_entry_title( $title, $passed_post_id = null ) { |
|
353 | + public function single_entry_title($title, $passed_post_id = null) { |
|
354 | 354 | global $post; |
355 | 355 | |
356 | 356 | // If this is the directory view, return. |
357 | - if ( ! $this->getSingleEntry() ) { |
|
357 | + if (!$this->getSingleEntry()) { |
|
358 | 358 | return $title; |
359 | 359 | } |
360 | 360 | |
@@ -365,44 +365,44 @@ discard block |
||
365 | 365 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
366 | 366 | * @param array $entry Current entry |
367 | 367 | */ |
368 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
368 | + $apply_outside_loop = apply_filters('gravityview/single/title/out_loop', in_the_loop(), $entry); |
|
369 | 369 | |
370 | - if ( ! $apply_outside_loop ) { |
|
370 | + if (!$apply_outside_loop) { |
|
371 | 371 | return $title; |
372 | 372 | } |
373 | 373 | |
374 | 374 | // User reported WooCommerce doesn't pass two args. |
375 | - if ( empty( $passed_post_id ) ) { |
|
375 | + if (empty($passed_post_id)) { |
|
376 | 376 | return $title; |
377 | 377 | } |
378 | 378 | |
379 | 379 | // Don't modify the title for anything other than the current view/post. |
380 | 380 | // This is true for embedded shortcodes and Views. |
381 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
381 | + if (is_object($post) && (int)$post->ID !== (int)$passed_post_id) { |
|
382 | 382 | return $title; |
383 | 383 | } |
384 | 384 | |
385 | 385 | $context_view_id = $this->get_context_view_id(); |
386 | 386 | |
387 | - if ( $this->getGvOutputData()->has_multiple_views() && ! empty( $context_view_id ) ) { |
|
388 | - $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
|
387 | + if ($this->getGvOutputData()->has_multiple_views() && !empty($context_view_id)) { |
|
388 | + $view_meta = $this->getGvOutputData()->get_view($context_view_id); |
|
389 | 389 | } else { |
390 | - foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
|
391 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
390 | + foreach ($this->getGvOutputData()->get_views() as $view_id => $view_data) { |
|
391 | + if (intval($view_data['form_id']) === intval($entry['form_id'])) { |
|
392 | 392 | $view_meta = $view_data; |
393 | 393 | break; |
394 | 394 | } |
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
398 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
398 | + if (!empty($view_meta['atts']['single_title'])) { |
|
399 | 399 | |
400 | 400 | $title = $view_meta['atts']['single_title']; |
401 | 401 | |
402 | 402 | // We are allowing HTML in the fields, so no escaping the output |
403 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
403 | + $title = GravityView_API::replace_variables($title, $view_meta['form'], $entry); |
|
404 | 404 | |
405 | - $title = do_shortcode( $title ); |
|
405 | + $title = do_shortcode($title); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | return $title; |
@@ -417,38 +417,38 @@ discard block |
||
417 | 417 | * @param mixed $content |
418 | 418 | * @return string Add the View output into View CPT content |
419 | 419 | */ |
420 | - public function insert_view_in_content( $content ) { |
|
420 | + public function insert_view_in_content($content) { |
|
421 | 421 | |
422 | 422 | // Plugins may run through the content in the header. WP SEO does this for its OpenGraph functionality. |
423 | - if ( ! did_action( 'loop_start' ) ) { |
|
423 | + if (!did_action('loop_start')) { |
|
424 | 424 | |
425 | - do_action( 'gravityview_log_debug', '[insert_view_in_content] Not processing yet: loop_start hasn\'t run yet. Current action:', current_filter() ); |
|
425 | + do_action('gravityview_log_debug', '[insert_view_in_content] Not processing yet: loop_start hasn\'t run yet. Current action:', current_filter()); |
|
426 | 426 | |
427 | 427 | return $content; |
428 | 428 | } |
429 | 429 | |
430 | 430 | // We don't want this filter to run infinite loop on any post content fields |
431 | - remove_filter( 'the_content', array( $this, 'insert_view_in_content' ) ); |
|
431 | + remove_filter('the_content', array($this, 'insert_view_in_content')); |
|
432 | 432 | |
433 | 433 | // Otherwise, this is called on the Views page when in Excerpt mode. |
434 | - if ( is_admin() ) { |
|
434 | + if (is_admin()) { |
|
435 | 435 | return $content; |
436 | 436 | } |
437 | 437 | |
438 | - if ( $this->isGravityviewPostType() ) { |
|
438 | + if ($this->isGravityviewPostType()) { |
|
439 | 439 | |
440 | 440 | /** @since 1.7.4 */ |
441 | - if ( is_preview() && ! gravityview_get_form_id( $this->post_id ) ) { |
|
442 | - $content .= __( 'When using a Start Fresh template, you must save the View before a Preview is available.', 'gravityview' ); |
|
441 | + if (is_preview() && !gravityview_get_form_id($this->post_id)) { |
|
442 | + $content .= __('When using a Start Fresh template, you must save the View before a Preview is available.', 'gravityview'); |
|
443 | 443 | } else { |
444 | - foreach ( $this->getGvOutputData()->get_views() as $view_id => $data ) { |
|
445 | - $content .= $this->render_view( array( 'id' => $view_id ) ); |
|
444 | + foreach ($this->getGvOutputData()->get_views() as $view_id => $data) { |
|
445 | + $content .= $this->render_view(array('id' => $view_id)); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | } |
449 | 449 | |
450 | 450 | // Add the filter back in |
451 | - add_filter( 'the_content', array( $this, 'insert_view_in_content' ) ); |
|
451 | + add_filter('the_content', array($this, 'insert_view_in_content')); |
|
452 | 452 | |
453 | 453 | return $content; |
454 | 454 | } |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | * @param int $post_id Post ID |
460 | 460 | * @return boolean |
461 | 461 | */ |
462 | - public function comments_open( $open, $post_id ) { |
|
462 | + public function comments_open($open, $post_id) { |
|
463 | 463 | |
464 | - if ( $this->isGravityviewPostType() ) { |
|
464 | + if ($this->isGravityviewPostType()) { |
|
465 | 465 | $open = false; |
466 | 466 | } |
467 | 467 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @param boolean $open Open or closed status |
472 | 472 | * @param int $post_id Post ID to set comment status for |
473 | 473 | */ |
474 | - $open = apply_filters( 'gravityview/comments_open', $open, $post_id ); |
|
474 | + $open = apply_filters('gravityview/comments_open', $open, $post_id); |
|
475 | 475 | |
476 | 476 | return $open; |
477 | 477 | } |
@@ -498,55 +498,55 @@ discard block |
||
498 | 498 | * |
499 | 499 | * @return string|null HTML output of a View, NULL if View isn't found |
500 | 500 | */ |
501 | - public function render_view( $passed_args ) { |
|
501 | + public function render_view($passed_args) { |
|
502 | 502 | |
503 | 503 | // validate attributes |
504 | - if ( empty( $passed_args['id'] ) ) { |
|
505 | - do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
|
504 | + if (empty($passed_args['id'])) { |
|
505 | + do_action('gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args); |
|
506 | 506 | return null; |
507 | 507 | } |
508 | 508 | |
509 | 509 | // Solve problem when loading content via admin-ajax.php |
510 | 510 | // @hack |
511 | - if ( ! $this->getGvOutputData() ) { |
|
511 | + if (!$this->getGvOutputData()) { |
|
512 | 512 | |
513 | - do_action( 'gravityview_log_error', '[render_view] gv_output_data not defined; parsing content.', $passed_args ); |
|
513 | + do_action('gravityview_log_error', '[render_view] gv_output_data not defined; parsing content.', $passed_args); |
|
514 | 514 | |
515 | 515 | $this->parse_content(); |
516 | 516 | } |
517 | 517 | |
518 | 518 | // Make 100% sure that we're dealing with a properly called situation |
519 | - if ( ! is_object( $this->getGvOutputData() ) || ! is_callable( array( $this->getGvOutputData(), 'get_view' ) ) ) { |
|
519 | + if (!is_object($this->getGvOutputData()) || !is_callable(array($this->getGvOutputData(), 'get_view'))) { |
|
520 | 520 | |
521 | - do_action( 'gravityview_log_error', '[render_view] gv_output_data not an object or get_view not callable.', $this->getGvOutputData() ); |
|
521 | + do_action('gravityview_log_error', '[render_view] gv_output_data not an object or get_view not callable.', $this->getGvOutputData()); |
|
522 | 522 | |
523 | 523 | return null; |
524 | 524 | } |
525 | 525 | |
526 | 526 | $view_id = $passed_args['id']; |
527 | 527 | |
528 | - $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
|
528 | + $view_data = $this->getGvOutputData()->get_view($view_id, $passed_args); |
|
529 | 529 | |
530 | - do_action( 'gravityview_log_debug', '[render_view] View Data: ', $view_data ); |
|
530 | + do_action('gravityview_log_debug', '[render_view] View Data: ', $view_data); |
|
531 | 531 | |
532 | - do_action( 'gravityview_log_debug', '[render_view] Init View. Arguments: ', $passed_args ); |
|
532 | + do_action('gravityview_log_debug', '[render_view] Init View. Arguments: ', $passed_args); |
|
533 | 533 | |
534 | 534 | // The passed args were always winning, even if they were NULL. |
535 | 535 | // This prevents that. Filters NULL, FALSE, and empty strings. |
536 | - $passed_args = array_filter( $passed_args, 'strlen' ); |
|
536 | + $passed_args = array_filter($passed_args, 'strlen'); |
|
537 | 537 | |
538 | 538 | //Override shortcode args over View template settings |
539 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
539 | + $atts = wp_parse_args($passed_args, $view_data['atts']); |
|
540 | 540 | |
541 | - do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
|
541 | + do_action('gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts); |
|
542 | 542 | |
543 | 543 | // It's password protected and you need to log in. |
544 | - if ( post_password_required( $view_id ) ) { |
|
544 | + if (post_password_required($view_id)) { |
|
545 | 545 | |
546 | - do_action( 'gravityview_log_error', sprintf( '[render_view] Returning: View %d is password protected.', $view_id ) ); |
|
546 | + do_action('gravityview_log_error', sprintf('[render_view] Returning: View %d is password protected.', $view_id)); |
|
547 | 547 | |
548 | 548 | // If we're in an embed or on an archive page, show the password form |
549 | - if ( get_the_ID() !== $view_id ) { |
|
549 | + if (get_the_ID() !== $view_id) { |
|
550 | 550 | return get_the_password_form(); |
551 | 551 | } |
552 | 552 | |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | * Don't render View if user isn't allowed to see it |
559 | 559 | * @since 1.15 |
560 | 560 | */ |
561 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
561 | + if (is_user_logged_in() && false === GVCommon::has_cap('read_gravityview', $view_id)) { |
|
562 | 562 | return null; |
563 | 563 | } |
564 | 564 | |
565 | - if( $this->isGravityviewPostType() ) { |
|
565 | + if ($this->isGravityviewPostType()) { |
|
566 | 566 | |
567 | 567 | /** |
568 | 568 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | * @param[in,out] boolean `true`: allow Views to be accessible directly. `false`: Only allow Views to be embedded via shortcode. Default: `true` |
573 | 573 | * @param int $view_id The ID of the View currently being requested. `0` for general setting |
574 | 574 | */ |
575 | - $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
|
575 | + $direct_access = apply_filters('gravityview_direct_access', true, $view_id); |
|
576 | 576 | |
577 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
577 | + $embed_only = !empty($atts['embed_only']); |
|
578 | 578 | |
579 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
580 | - return __( 'You are not allowed to view this content.', 'gravityview' ); |
|
579 | + if (!$direct_access || ($embed_only && !GVCommon::has_cap('read_private_gravityviews'))) { |
|
580 | + return __('You are not allowed to view this content.', 'gravityview'); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
@@ -589,137 +589,137 @@ discard block |
||
589 | 589 | */ |
590 | 590 | global $gravityview_view; |
591 | 591 | |
592 | - $gravityview_view = new GravityView_View( $view_data ); |
|
592 | + $gravityview_view = new GravityView_View($view_data); |
|
593 | 593 | |
594 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
594 | + $post_id = !empty($atts['post_id']) ? intval($atts['post_id']) : $this->getPostId(); |
|
595 | 595 | |
596 | - $gravityview_view->setPostId( $post_id ); |
|
596 | + $gravityview_view->setPostId($post_id); |
|
597 | 597 | |
598 | - if ( ! $this->getSingleEntry() ) { |
|
598 | + if (!$this->getSingleEntry()) { |
|
599 | 599 | |
600 | 600 | // user requested Directory View |
601 | - do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
|
601 | + do_action('gravityview_log_debug', '[render_view] Executing Directory View'); |
|
602 | 602 | |
603 | 603 | //fetch template and slug |
604 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
604 | + $view_slug = apply_filters('gravityview_template_slug_'.$view_data['template_id'], 'table', 'directory'); |
|
605 | 605 | |
606 | - do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
|
606 | + do_action('gravityview_log_debug', '[render_view] View template slug: ', $view_slug); |
|
607 | 607 | |
608 | 608 | /** |
609 | 609 | * Disable fetching initial entries for views that don't need it (DataTables) |
610 | 610 | */ |
611 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
611 | + $get_entries = apply_filters('gravityview_get_view_entries_'.$view_slug, true); |
|
612 | 612 | |
613 | 613 | /** |
614 | 614 | * Hide View data until search is performed |
615 | 615 | * @since 1.5.4 |
616 | 616 | */ |
617 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
618 | - $gravityview_view->setHideUntilSearched( true ); |
|
617 | + if (!empty($atts['hide_until_searched']) && !$this->isSearch()) { |
|
618 | + $gravityview_view->setHideUntilSearched(true); |
|
619 | 619 | $get_entries = false; |
620 | 620 | } |
621 | 621 | |
622 | 622 | |
623 | - if ( $get_entries ) { |
|
623 | + if ($get_entries) { |
|
624 | 624 | |
625 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
625 | + if (!empty($atts['sort_columns'])) { |
|
626 | 626 | // add filter to enable column sorting |
627 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
627 | + add_filter('gravityview/template/field_label', array($this, 'add_columns_sort_links'), 100, 3); |
|
628 | 628 | } |
629 | 629 | |
630 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
630 | + $view_entries = self::get_view_entries($atts, $view_data['form_id']); |
|
631 | 631 | |
632 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
632 | + do_action('gravityview_log_debug', sprintf('[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof($view_entries['entries']))); |
|
633 | 633 | |
634 | 634 | } else { |
635 | 635 | |
636 | - $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
|
636 | + $view_entries = array('count' => null, 'entries' => null, 'paging' => null); |
|
637 | 637 | |
638 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
638 | + do_action('gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false'); |
|
639 | 639 | } |
640 | 640 | |
641 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
642 | - $gravityview_view->setContext( 'directory' ); |
|
643 | - $sections = array( 'header', 'body', 'footer' ); |
|
641 | + $gravityview_view->setPaging($view_entries['paging']); |
|
642 | + $gravityview_view->setContext('directory'); |
|
643 | + $sections = array('header', 'body', 'footer'); |
|
644 | 644 | |
645 | 645 | } else { |
646 | 646 | |
647 | 647 | // user requested Single Entry View |
648 | - do_action( 'gravityview_log_debug', '[render_view] Executing Single View' ); |
|
648 | + do_action('gravityview_log_debug', '[render_view] Executing Single View'); |
|
649 | 649 | |
650 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
650 | + do_action('gravityview_render_entry_'.$view_data['id']); |
|
651 | 651 | |
652 | 652 | $entry = $this->getEntry(); |
653 | 653 | |
654 | 654 | // You are not permitted to view this entry. |
655 | - if ( empty( $entry ) || ! self::is_entry_approved( $entry, $atts ) ) { |
|
655 | + if (empty($entry) || !self::is_entry_approved($entry, $atts)) { |
|
656 | 656 | |
657 | - do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
|
657 | + do_action('gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.'); |
|
658 | 658 | |
659 | 659 | /** |
660 | 660 | * @since 1.6 |
661 | 661 | */ |
662 | - echo esc_attr( apply_filters( 'gravityview/render/entry/not_visible', __( 'You have attempted to view an entry that is not visible or may not exist.', 'gravityview' ) ) ); |
|
662 | + echo esc_attr(apply_filters('gravityview/render/entry/not_visible', __('You have attempted to view an entry that is not visible or may not exist.', 'gravityview'))); |
|
663 | 663 | |
664 | 664 | return null; |
665 | 665 | } |
666 | 666 | |
667 | 667 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
668 | 668 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
669 | - if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
|
670 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
669 | + if ($this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id()) { |
|
670 | + do_action('gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '.$view_id); |
|
671 | 671 | return null; |
672 | 672 | } |
673 | 673 | |
674 | 674 | //fetch template and slug |
675 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
676 | - do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
|
675 | + $view_slug = apply_filters('gravityview_template_slug_'.$view_data['template_id'], 'table', 'single'); |
|
676 | + do_action('gravityview_log_debug', '[render_view] View single template slug: ', $view_slug); |
|
677 | 677 | |
678 | 678 | //fetch entry detail |
679 | 679 | $view_entries['count'] = 1; |
680 | 680 | $view_entries['entries'][] = $entry; |
681 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
681 | + do_action('gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries']); |
|
682 | 682 | |
683 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
683 | + $back_link_label = isset($atts['back_link_label']) ? $atts['back_link_label'] : null; |
|
684 | 684 | |
685 | 685 | // set back link label |
686 | - $gravityview_view->setBackLinkLabel( $back_link_label ); |
|
687 | - $gravityview_view->setContext( 'single' ); |
|
688 | - $sections = array( 'single' ); |
|
686 | + $gravityview_view->setBackLinkLabel($back_link_label); |
|
687 | + $gravityview_view->setContext('single'); |
|
688 | + $sections = array('single'); |
|
689 | 689 | |
690 | 690 | } |
691 | 691 | |
692 | 692 | // add template style |
693 | - self::add_style( $view_data['template_id'] ); |
|
693 | + self::add_style($view_data['template_id']); |
|
694 | 694 | |
695 | 695 | // Prepare to render view and set vars |
696 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
697 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
696 | + $gravityview_view->setEntries($view_entries['entries']); |
|
697 | + $gravityview_view->setTotalEntries($view_entries['count']); |
|
698 | 698 | |
699 | 699 | // If Edit |
700 | - if ( 'edit' === gravityview_get_context() ) { |
|
700 | + if ('edit' === gravityview_get_context()) { |
|
701 | 701 | |
702 | - do_action( 'gravityview_log_debug', '[render_view] Edit Entry ' ); |
|
702 | + do_action('gravityview_log_debug', '[render_view] Edit Entry '); |
|
703 | 703 | |
704 | - do_action( 'gravityview_edit_entry', $this->getGvOutputData() ); |
|
704 | + do_action('gravityview_edit_entry', $this->getGvOutputData()); |
|
705 | 705 | |
706 | 706 | return ob_get_clean(); |
707 | 707 | |
708 | 708 | } else { |
709 | 709 | // finaly we'll render some html |
710 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
710 | + $sections = apply_filters('gravityview_render_view_sections', $sections, $view_data['template_id']); |
|
711 | 711 | |
712 | - do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
|
713 | - foreach ( $sections as $section ) { |
|
714 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
715 | - $gravityview_view->render( $view_slug, $section, false ); |
|
712 | + do_action('gravityview_log_debug', '[render_view] Sections to render: ', $sections); |
|
713 | + foreach ($sections as $section) { |
|
714 | + do_action('gravityview_log_debug', '[render_view] Rendering '.$section.' section.'); |
|
715 | + $gravityview_view->render($view_slug, $section, false); |
|
716 | 716 | } |
717 | 717 | } |
718 | 718 | |
719 | 719 | //@todo: check why we need the IF statement vs. print the view id always. |
720 | - if ( $this->isGravityviewPostType() || $this->isPostHasShortcode() ) { |
|
720 | + if ($this->isGravityviewPostType() || $this->isPostHasShortcode()) { |
|
721 | 721 | // Print the View ID to enable proper cookie pagination |
722 | - echo '<input type="hidden" class="gravityview-view-id" value="' . esc_attr( $view_id ) . '">'; |
|
722 | + echo '<input type="hidden" class="gravityview-view-id" value="'.esc_attr($view_id).'">'; |
|
723 | 723 | } |
724 | 724 | $output = ob_get_clean(); |
725 | 725 | |
@@ -741,23 +741,23 @@ discard block |
||
741 | 741 | * @param array $search_criteria Search being performed, if any |
742 | 742 | * @return array Modified `$search_criteria` array |
743 | 743 | */ |
744 | - public static function process_search_dates( $args, $search_criteria = array() ) { |
|
744 | + public static function process_search_dates($args, $search_criteria = array()) { |
|
745 | 745 | |
746 | 746 | $return_search_criteria = $search_criteria; |
747 | 747 | |
748 | - foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
748 | + foreach (array('start_date', 'end_date') as $key) { |
|
749 | 749 | |
750 | 750 | |
751 | 751 | // Is the start date or end date set in the view or shortcode? |
752 | 752 | // If so, we want to make sure that the search doesn't go outside the bounds defined. |
753 | - if ( ! empty( $args[ $key ] ) ) { |
|
753 | + if (!empty($args[$key])) { |
|
754 | 754 | |
755 | 755 | // Get a timestamp and see if it's a valid date format |
756 | - $date = strtotime( $args[ $key ] ); |
|
756 | + $date = strtotime($args[$key]); |
|
757 | 757 | |
758 | 758 | // The date was invalid |
759 | - if ( empty( $date ) ) { |
|
760 | - do_action( 'gravityview_log_error', __METHOD__ . ' Invalid ' . $key . ' date format: ' . $args[ $key ] ); |
|
759 | + if (empty($date)) { |
|
760 | + do_action('gravityview_log_error', __METHOD__.' Invalid '.$key.' date format: '.$args[$key]); |
|
761 | 761 | continue; |
762 | 762 | } |
763 | 763 | |
@@ -765,12 +765,12 @@ discard block |
||
765 | 765 | $datetime_format = 'Y-m-d H:i:s'; |
766 | 766 | $search_is_outside_view_bounds = false; |
767 | 767 | |
768 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
768 | + if (!empty($search_criteria[$key])) { |
|
769 | 769 | |
770 | - $search_date = strtotime( $search_criteria[ $key ] ); |
|
770 | + $search_date = strtotime($search_criteria[$key]); |
|
771 | 771 | |
772 | 772 | // The search is for entries before the start date defined by the settings |
773 | - switch ( $key ) { |
|
773 | + switch ($key) { |
|
774 | 774 | case 'end_date': |
775 | 775 | /** |
776 | 776 | * If the end date is formatted as 'Y-m-d', it should be formatted without hours and seconds |
@@ -780,28 +780,28 @@ discard block |
||
780 | 780 | * |
781 | 781 | * @see GFFormsModel::get_date_range_where |
782 | 782 | */ |
783 | - $datetime_format = gravityview_is_valid_datetime( $args[ $key ] ) ? 'Y-m-d' : 'Y-m-d H:i:s'; |
|
784 | - $search_is_outside_view_bounds = ( $search_date > $date ); |
|
783 | + $datetime_format = gravityview_is_valid_datetime($args[$key]) ? 'Y-m-d' : 'Y-m-d H:i:s'; |
|
784 | + $search_is_outside_view_bounds = ($search_date > $date); |
|
785 | 785 | break; |
786 | 786 | case 'start_date': |
787 | - $search_is_outside_view_bounds = ( $search_date < $date ); |
|
787 | + $search_is_outside_view_bounds = ($search_date < $date); |
|
788 | 788 | break; |
789 | 789 | } |
790 | 790 | } |
791 | 791 | |
792 | 792 | // If there is no search being performed, or if there is a search being performed that's outside the bounds |
793 | - if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
|
793 | + if (empty($search_criteria[$key]) || $search_is_outside_view_bounds) { |
|
794 | 794 | |
795 | 795 | // Then we override the search and re-set the start date |
796 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
796 | + $return_search_criteria[$key] = date_i18n($datetime_format, $date, true); |
|
797 | 797 | } |
798 | 798 | } |
799 | 799 | } |
800 | 800 | |
801 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
801 | + if (isset($return_search_criteria['start_date']) && isset($return_search_criteria['end_date'])) { |
|
802 | 802 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
803 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
804 | - do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
|
803 | + if (strtotime($return_search_criteria['start_date']) > strtotime($return_search_criteria['end_date'])) { |
|
804 | + do_action('gravityview_log_error', __METHOD__.' Invalid search: the start date is after the end date.', $return_search_criteria); |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | |
@@ -816,13 +816,13 @@ discard block |
||
816 | 816 | * @param array $search_criteria Search being performed, if any |
817 | 817 | * @return array Modified `$search_criteria` array |
818 | 818 | */ |
819 | - public static function process_search_only_approved( $args, $search_criteria ) { |
|
819 | + public static function process_search_only_approved($args, $search_criteria) { |
|
820 | 820 | |
821 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
822 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
821 | + if (!empty($args['show_only_approved'])) { |
|
822 | + $search_criteria['field_filters'][] = array('key' => 'is_approved', 'value' => 'Approved'); |
|
823 | 823 | $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
824 | 824 | |
825 | - do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
|
825 | + do_action('gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria); |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | return $search_criteria; |
@@ -842,16 +842,16 @@ discard block |
||
842 | 842 | * |
843 | 843 | * @return bool |
844 | 844 | */ |
845 | - public static function is_entry_approved( $entry, $args = array() ) { |
|
845 | + public static function is_entry_approved($entry, $args = array()) { |
|
846 | 846 | |
847 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
847 | + if (empty($entry['id']) || (array_key_exists('show_only_approved', $args) && !$args['show_only_approved'])) { |
|
848 | 848 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
849 | 849 | return true; |
850 | 850 | } |
851 | 851 | |
852 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
852 | + $is_approved = gform_get_meta($entry['id'], 'is_approved'); |
|
853 | 853 | |
854 | - if ( $is_approved ) { |
|
854 | + if ($is_approved) { |
|
855 | 855 | return true; |
856 | 856 | } |
857 | 857 | |
@@ -872,47 +872,47 @@ discard block |
||
872 | 872 | * @param int $form_id Gravity Forms form ID |
873 | 873 | * @return array Array of search parameters, formatted in Gravity Forms mode, using `status` key set to "active" by default, `field_filters` array with `key`, `value` and `operator` keys. |
874 | 874 | */ |
875 | - public static function get_search_criteria( $args, $form_id ) { |
|
875 | + public static function get_search_criteria($args, $form_id) { |
|
876 | 876 | |
877 | 877 | // Search Criteria |
878 | - $search_criteria = apply_filters( 'gravityview_fe_search_criteria', array( 'field_filters' => array() ), $form_id ); |
|
878 | + $search_criteria = apply_filters('gravityview_fe_search_criteria', array('field_filters' => array()), $form_id); |
|
879 | 879 | |
880 | 880 | $original_search_criteria = $search_criteria; |
881 | 881 | |
882 | - do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
|
882 | + do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria); |
|
883 | 883 | |
884 | 884 | // implicity search |
885 | - if ( ! empty( $args['search_value'] ) ) { |
|
885 | + if (!empty($args['search_value'])) { |
|
886 | 886 | |
887 | 887 | // Search operator options. Options: `is` or `contains` |
888 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
888 | + $operator = !empty($args['search_operator']) && in_array($args['search_operator'], array('is', 'isnot', '>', '<', 'contains')) ? $args['search_operator'] : 'contains'; |
|
889 | 889 | |
890 | 890 | $search_criteria['field_filters'][] = array( |
891 | - 'key' => rgget( 'search_field', $args ), // The field ID to search |
|
892 | - 'value' => esc_attr( $args['search_value'] ), // The value to search |
|
891 | + 'key' => rgget('search_field', $args), // The field ID to search |
|
892 | + 'value' => esc_attr($args['search_value']), // The value to search |
|
893 | 893 | 'operator' => $operator, |
894 | 894 | ); |
895 | 895 | } |
896 | 896 | |
897 | - if( $search_criteria !== $original_search_criteria ) { |
|
898 | - do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
|
897 | + if ($search_criteria !== $original_search_criteria) { |
|
898 | + do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria); |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | // Handle setting date range |
902 | - $search_criteria = self::process_search_dates( $args, $search_criteria ); |
|
902 | + $search_criteria = self::process_search_dates($args, $search_criteria); |
|
903 | 903 | |
904 | - if( $search_criteria !== $original_search_criteria ) { |
|
905 | - do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
|
904 | + if ($search_criteria !== $original_search_criteria) { |
|
905 | + do_action('gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | // remove not approved entries |
909 | - $search_criteria = self::process_search_only_approved( $args, $search_criteria ); |
|
909 | + $search_criteria = self::process_search_only_approved($args, $search_criteria); |
|
910 | 910 | |
911 | 911 | /** |
912 | 912 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
913 | 913 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
914 | 914 | */ |
915 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
915 | + $search_criteria['status'] = apply_filters('gravityview_status', 'active', $args); |
|
916 | 916 | |
917 | 917 | return $search_criteria; |
918 | 918 | } |
@@ -946,29 +946,29 @@ discard block |
||
946 | 946 | * @param int $form_id Gravity Forms Form ID |
947 | 947 | * @return array Associative array with `count`, `entries`, and `paging` keys. `count` has the total entries count, `entries` is an array with Gravity Forms full entry data, `paging` is an array with `offset` and `page_size` keys |
948 | 948 | */ |
949 | - public static function get_view_entries( $args, $form_id ) { |
|
949 | + public static function get_view_entries($args, $form_id) { |
|
950 | 950 | |
951 | - do_action( 'gravityview_log_debug', '[get_view_entries] init' ); |
|
951 | + do_action('gravityview_log_debug', '[get_view_entries] init'); |
|
952 | 952 | // start filters and sorting |
953 | 953 | |
954 | 954 | /** |
955 | 955 | * Process search parameters |
956 | 956 | * @var array |
957 | 957 | */ |
958 | - $search_criteria = self::get_search_criteria( $args, $form_id ); |
|
958 | + $search_criteria = self::get_search_criteria($args, $form_id); |
|
959 | 959 | |
960 | 960 | // Paging & offset |
961 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
961 | + $page_size = !empty($args['page_size']) ? intval($args['page_size']) : apply_filters('gravityview_default_page_size', 25); |
|
962 | 962 | |
963 | 963 | if ( -1 === $page_size ) { |
964 | 964 | $page_size = PHP_INT_MAX; |
965 | 965 | } |
966 | 966 | |
967 | - if ( isset( $args['offset'] ) ) { |
|
968 | - $offset = intval( $args['offset'] ); |
|
967 | + if (isset($args['offset'])) { |
|
968 | + $offset = intval($args['offset']); |
|
969 | 969 | } else { |
970 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
971 | - $offset = ( $curr_page - 1 ) * $page_size; |
|
970 | + $curr_page = empty($_GET['pagenum']) ? 1 : intval($_GET['pagenum']); |
|
971 | + $offset = ($curr_page - 1) * $page_size; |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | $paging = array( |
@@ -976,16 +976,16 @@ discard block |
||
976 | 976 | 'page_size' => $page_size, |
977 | 977 | ); |
978 | 978 | |
979 | - do_action( 'gravityview_log_debug', '[get_view_entries] Paging: ', $paging ); |
|
979 | + do_action('gravityview_log_debug', '[get_view_entries] Paging: ', $paging); |
|
980 | 980 | |
981 | 981 | // Sorting |
982 | - $sorting = self::updateViewSorting( $args, $form_id ); |
|
982 | + $sorting = self::updateViewSorting($args, $form_id); |
|
983 | 983 | |
984 | 984 | $parameters = array( |
985 | 985 | 'search_criteria' => $search_criteria, |
986 | 986 | 'sorting' => $sorting, |
987 | 987 | 'paging' => $paging, |
988 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
988 | + 'cache' => isset($args['cache']) ? $args['cache'] : true, |
|
989 | 989 | ); |
990 | 990 | |
991 | 991 | /** |
@@ -1003,22 +1003,22 @@ discard block |
||
1003 | 1003 | * } |
1004 | 1004 | * @param int $form_id ID of Gravity Forms form |
1005 | 1005 | */ |
1006 | - $parameters = apply_filters( 'gravityview_get_entries', $parameters, $args, $form_id ); |
|
1006 | + $parameters = apply_filters('gravityview_get_entries', $parameters, $args, $form_id); |
|
1007 | 1007 | |
1008 | 1008 | /** |
1009 | 1009 | * @filter `gravityview_get_entries_{View ID}` Filter get entries criteria |
1010 | 1010 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1011 | 1011 | * @param array $args View configuration args. |
1012 | 1012 | */ |
1013 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1013 | + $parameters = apply_filters('gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id); |
|
1014 | 1014 | |
1015 | - do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters ); |
|
1015 | + do_action('gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters); |
|
1016 | 1016 | |
1017 | 1017 | //fetch entries |
1018 | 1018 | $count = 0; |
1019 | - $entries = gravityview_get_entries( $form_id, $parameters, $count ); |
|
1019 | + $entries = gravityview_get_entries($form_id, $parameters, $count); |
|
1020 | 1020 | |
1021 | - do_action( 'gravityview_log_debug', sprintf( '[get_view_entries] Get Entries. Found: %s entries', $count ), $entries ); |
|
1021 | + do_action('gravityview_log_debug', sprintf('[get_view_entries] Get Entries. Found: %s entries', $count), $entries); |
|
1022 | 1022 | |
1023 | 1023 | /** |
1024 | 1024 | * @filter `gravityview_view_entries` Filter the entries output to the View |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | * @param array $args View settings associative array |
1027 | 1027 | * @var array |
1028 | 1028 | */ |
1029 | - $entries = apply_filters( 'gravityview_view_entries', $entries, $args ); |
|
1029 | + $entries = apply_filters('gravityview_view_entries', $entries, $args); |
|
1030 | 1030 | |
1031 | 1031 | /** |
1032 | 1032 | * @filter `gravityview/view/entries` Filter the entries output to the View |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | * @param array $args View settings associative array |
1035 | 1035 | * @since 1.5.2 |
1036 | 1036 | */ |
1037 | - return apply_filters( 'gravityview/view/entries', compact( 'count', 'entries', 'paging' ), $args ); |
|
1037 | + return apply_filters('gravityview/view/entries', compact('count', 'entries', 'paging'), $args); |
|
1038 | 1038 | |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1048,24 +1048,24 @@ discard block |
||
1048 | 1048 | * @param int $form_id The ID of the form used to sort |
1049 | 1049 | * @return array $sorting Array with `key`, `direction` and `is_numeric` keys |
1050 | 1050 | */ |
1051 | - public static function updateViewSorting( $args, $form_id ) { |
|
1051 | + public static function updateViewSorting($args, $form_id) { |
|
1052 | 1052 | $sorting = array(); |
1053 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1054 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1053 | + $sort_field_id = isset($_GET['sort']) ? $_GET['sort'] : rgar($args, 'sort_field'); |
|
1054 | + $sort_direction = isset($_GET['dir']) ? $_GET['dir'] : rgar($args, 'sort_direction'); |
|
1055 | 1055 | |
1056 | - $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
|
1056 | + $sort_field_id = self::_override_sorting_id_by_field_type($sort_field_id, $form_id); |
|
1057 | 1057 | |
1058 | - if ( ! empty( $sort_field_id ) ) { |
|
1058 | + if (!empty($sort_field_id)) { |
|
1059 | 1059 | $sorting = array( |
1060 | 1060 | 'key' => $sort_field_id, |
1061 | - 'direction' => strtolower( $sort_direction ), |
|
1062 | - 'is_numeric' => GVCommon::is_field_numeric( $form_id, $sort_field_id ) |
|
1061 | + 'direction' => strtolower($sort_direction), |
|
1062 | + 'is_numeric' => GVCommon::is_field_numeric($form_id, $sort_field_id) |
|
1063 | 1063 | ); |
1064 | 1064 | } |
1065 | 1065 | |
1066 | - GravityView_View::getInstance()->setSorting( $sorting ); |
|
1066 | + GravityView_View::getInstance()->setSorting($sorting); |
|
1067 | 1067 | |
1068 | - do_action( 'gravityview_log_debug', '[updateViewSorting] Sort Criteria : ', $sorting ); |
|
1068 | + do_action('gravityview_log_debug', '[updateViewSorting] Sort Criteria : ', $sorting); |
|
1069 | 1069 | |
1070 | 1070 | return $sorting; |
1071 | 1071 | |
@@ -1085,17 +1085,17 @@ discard block |
||
1085 | 1085 | * |
1086 | 1086 | * @return string Possibly modified sorting ID |
1087 | 1087 | */ |
1088 | - private static function _override_sorting_id_by_field_type( $sort_field_id, $form_id ) { |
|
1088 | + private static function _override_sorting_id_by_field_type($sort_field_id, $form_id) { |
|
1089 | 1089 | |
1090 | - $form = gravityview_get_form( $form_id ); |
|
1090 | + $form = gravityview_get_form($form_id); |
|
1091 | 1091 | |
1092 | - $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
|
1092 | + $sort_field = GFFormsModel::get_field($form, $sort_field_id); |
|
1093 | 1093 | |
1094 | - switch ( $sort_field['type'] ) { |
|
1094 | + switch ($sort_field['type']) { |
|
1095 | 1095 | |
1096 | 1096 | case 'address': |
1097 | 1097 | // Sorting by full address |
1098 | - if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) { |
|
1098 | + if (floatval($sort_field_id) === floor($sort_field_id)) { |
|
1099 | 1099 | |
1100 | 1100 | /** |
1101 | 1101 | * Override how to sort when sorting address |
@@ -1106,9 +1106,9 @@ discard block |
||
1106 | 1106 | * @param string $sort_field_id Field used for sorting |
1107 | 1107 | * @param int $form_id GF Form ID |
1108 | 1108 | */ |
1109 | - $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
|
1109 | + $address_part = apply_filters('gravityview/sorting/address', 'city', $sort_field_id, $form_id); |
|
1110 | 1110 | |
1111 | - switch( strtolower( $address_part ) ){ |
|
1111 | + switch (strtolower($address_part)) { |
|
1112 | 1112 | case 'street': |
1113 | 1113 | $sort_field_id .= '.1'; |
1114 | 1114 | break; |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | break; |
1135 | 1135 | case 'name': |
1136 | 1136 | // Sorting by full name, not first, last, etc. |
1137 | - if ( floatval( $sort_field_id ) === floor( $sort_field_id ) ) { |
|
1137 | + if (floatval($sort_field_id) === floor($sort_field_id)) { |
|
1138 | 1138 | /** |
1139 | 1139 | * @filter `gravityview/sorting/full-name` Override how to sort when sorting full name. |
1140 | 1140 | * @since 1.7.4 |
@@ -1142,9 +1142,9 @@ discard block |
||
1142 | 1142 | * @param[in] string $sort_field_id Field used for sorting |
1143 | 1143 | * @param[in] int $form_id GF Form ID |
1144 | 1144 | */ |
1145 | - $name_part = apply_filters( 'gravityview/sorting/full-name', 'first', $sort_field_id, $form_id ); |
|
1145 | + $name_part = apply_filters('gravityview/sorting/full-name', 'first', $sort_field_id, $form_id); |
|
1146 | 1146 | |
1147 | - if ( 'last' === strtolower( $name_part ) ) { |
|
1147 | + if ('last' === strtolower($name_part)) { |
|
1148 | 1148 | $sort_field_id .= '.6'; |
1149 | 1149 | } else { |
1150 | 1150 | $sort_field_id .= '.3'; |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @param[in,out] string $name_part Field used for sorting |
1164 | 1164 | * @param[in] int $form_id GF Form ID |
1165 | 1165 | */ |
1166 | - $sort_field_id = apply_filters( 'gravityview/sorting/time', $sort_field_id, $form_id ); |
|
1166 | + $sort_field_id = apply_filters('gravityview/sorting/time', $sort_field_id, $form_id); |
|
1167 | 1167 | break; |
1168 | 1168 | } |
1169 | 1169 | |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | |
1179 | 1179 | $var_name = GravityView_Post_Types::get_entry_var_name(); |
1180 | 1180 | |
1181 | - $single_entry = get_query_var( $var_name ); |
|
1181 | + $single_entry = get_query_var($var_name); |
|
1182 | 1182 | |
1183 | 1183 | /** |
1184 | 1184 | * Modify the entry that is being displayed. |
@@ -1186,9 +1186,9 @@ discard block |
||
1186 | 1186 | * @internal Should only be used by things like the oEmbed functionality. |
1187 | 1187 | * @since 1.6 |
1188 | 1188 | */ |
1189 | - $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
|
1189 | + $single_entry = apply_filters('gravityview/is_single_entry', $single_entry); |
|
1190 | 1190 | |
1191 | - if ( empty( $single_entry ) ){ |
|
1191 | + if (empty($single_entry)) { |
|
1192 | 1192 | return false; |
1193 | 1193 | } else { |
1194 | 1194 | return $single_entry; |
@@ -1205,38 +1205,38 @@ discard block |
||
1205 | 1205 | public function add_scripts_and_styles() { |
1206 | 1206 | global $post, $posts; |
1207 | 1207 | // enqueue template specific styles |
1208 | - if ( $this->getGvOutputData() ) { |
|
1208 | + if ($this->getGvOutputData()) { |
|
1209 | 1209 | |
1210 | 1210 | $views = $this->getGvOutputData()->get_views(); |
1211 | 1211 | |
1212 | - foreach ( $views as $view_id => $data ) { |
|
1212 | + foreach ($views as $view_id => $data) { |
|
1213 | 1213 | |
1214 | 1214 | /** |
1215 | 1215 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1216 | 1216 | * @since 1.15 |
1217 | 1217 | */ |
1218 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1218 | + if (is_user_logged_in() && false === GVCommon::has_cap('read_gravityview', $view_id)) { |
|
1219 | 1219 | continue; |
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | // By default, no thickbox |
1223 | - $js_dependencies = array( 'jquery', 'gravityview-jquery-cookie' ); |
|
1223 | + $js_dependencies = array('jquery', 'gravityview-jquery-cookie'); |
|
1224 | 1224 | $css_dependencies = array(); |
1225 | 1225 | |
1226 | 1226 | // If the thickbox is enqueued, add dependencies |
1227 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1227 | + if (!empty($data['atts']['lightbox'])) { |
|
1228 | 1228 | |
1229 | 1229 | /** |
1230 | 1230 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1231 | 1231 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1232 | 1232 | */ |
1233 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1233 | + $js_dependencies[] = apply_filters('gravity_view_lightbox_script', 'thickbox'); |
|
1234 | 1234 | |
1235 | 1235 | /** |
1236 | 1236 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1237 | 1237 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1238 | 1238 | */ |
1239 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1239 | + $css_dependencies[] = apply_filters('gravity_view_lightbox_style', 'thickbox'); |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | /** |
@@ -1244,34 +1244,34 @@ discard block |
||
1244 | 1244 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1245 | 1245 | * @since 1.15 |
1246 | 1246 | */ |
1247 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1247 | + if (gravityview_view_has_single_checkbox_or_radio($data['form'], $data['fields'])) { |
|
1248 | 1248 | $css_dependencies[] = 'dashicons'; |
1249 | 1249 | } |
1250 | 1250 | |
1251 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1251 | + wp_register_script('gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version, true); |
|
1252 | 1252 | |
1253 | - $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1253 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1254 | 1254 | |
1255 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1255 | + wp_register_script('gravityview-fe-view', plugins_url('assets/js/fe-views'.$script_debug.'.js', GRAVITYVIEW_FILE), apply_filters('gravityview_js_dependencies', $js_dependencies), GravityView_Plugin::version, true); |
|
1256 | 1256 | |
1257 | - wp_enqueue_script( 'gravityview-fe-view' ); |
|
1257 | + wp_enqueue_script('gravityview-fe-view'); |
|
1258 | 1258 | |
1259 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1260 | - wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
|
1259 | + if (!empty($data['atts']['sort_columns'])) { |
|
1260 | + wp_enqueue_style('gravityview_font', plugins_url('assets/css/font.css', GRAVITYVIEW_FILE), $css_dependencies, GravityView_Plugin::version, 'all'); |
|
1261 | 1261 | } |
1262 | 1262 | |
1263 | - wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
|
1263 | + wp_enqueue_style('gravityview_default_style', plugins_url('templates/css/gv-default-styles.css', GRAVITYVIEW_FILE), $css_dependencies, GravityView_Plugin::version, 'all'); |
|
1264 | 1264 | |
1265 | - self::add_style( $data['template_id'] ); |
|
1265 | + self::add_style($data['template_id']); |
|
1266 | 1266 | |
1267 | 1267 | } |
1268 | 1268 | |
1269 | - if ( 'wp_print_footer_scripts' === current_filter() ) { |
|
1269 | + if ('wp_print_footer_scripts' === current_filter()) { |
|
1270 | 1270 | |
1271 | 1271 | $js_localization = array( |
1272 | 1272 | 'cookiepath' => COOKIEPATH, |
1273 | - 'clear' => _x( 'Clear', 'Clear all data from the form', 'gravityview' ), |
|
1274 | - 'reset' => _x( 'Reset', 'Reset the search form to the state that existed on page load', 'gravityview' ), |
|
1273 | + 'clear' => _x('Clear', 'Clear all data from the form', 'gravityview'), |
|
1274 | + 'reset' => _x('Reset', 'Reset the search form to the state that existed on page load', 'gravityview'), |
|
1275 | 1275 | ); |
1276 | 1276 | |
1277 | 1277 | /** |
@@ -1279,9 +1279,9 @@ discard block |
||
1279 | 1279 | * @param array $js_localization The data padded to the Javascript file |
1280 | 1280 | * @param array $views Array of View data arrays with View settings |
1281 | 1281 | */ |
1282 | - $js_localization = apply_filters( 'gravityview_js_localization', $js_localization, $views ); |
|
1282 | + $js_localization = apply_filters('gravityview_js_localization', $js_localization, $views); |
|
1283 | 1283 | |
1284 | - wp_localize_script( 'gravityview-fe-view', 'gvGlobals', $js_localization ); |
|
1284 | + wp_localize_script('gravityview-fe-view', 'gvGlobals', $js_localization); |
|
1285 | 1285 | } |
1286 | 1286 | } |
1287 | 1287 | } |
@@ -1290,15 +1290,15 @@ discard block |
||
1290 | 1290 | * Add template extra style if exists |
1291 | 1291 | * @param string $template_id |
1292 | 1292 | */ |
1293 | - public static function add_style( $template_id ) { |
|
1293 | + public static function add_style($template_id) { |
|
1294 | 1294 | |
1295 | - if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) { |
|
1296 | - do_action( 'gravityview_log_debug', sprintf( '[add_style] Adding extra template style for %s', $template_id ) ); |
|
1297 | - wp_enqueue_style( 'gravityview_style_' . $template_id ); |
|
1298 | - } elseif ( empty( $template_id ) ) { |
|
1299 | - do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
|
1295 | + if (!empty($template_id) && wp_style_is('gravityview_style_'.$template_id, 'registered')) { |
|
1296 | + do_action('gravityview_log_debug', sprintf('[add_style] Adding extra template style for %s', $template_id)); |
|
1297 | + wp_enqueue_style('gravityview_style_'.$template_id); |
|
1298 | + } elseif (empty($template_id)) { |
|
1299 | + do_action('gravityview_log_error', '[add_style] Cannot add template style; template_id is empty'); |
|
1300 | 1300 | } else { |
1301 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1301 | + do_action('gravityview_log_error', sprintf('[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id)); |
|
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | } |
@@ -1317,17 +1317,17 @@ discard block |
||
1317 | 1317 | * |
1318 | 1318 | * @return string Field Label |
1319 | 1319 | */ |
1320 | - public function add_columns_sort_links( $label = '', $field, $form ) { |
|
1320 | + public function add_columns_sort_links($label = '', $field, $form) { |
|
1321 | 1321 | |
1322 | 1322 | /** |
1323 | 1323 | * Not a table-based template; don't add sort icons |
1324 | 1324 | * @since 1.12 |
1325 | 1325 | */ |
1326 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1326 | + if (!preg_match('/table/ism', GravityView_View::getInstance()->getTemplatePartSlug())) { |
|
1327 | 1327 | return $label; |
1328 | 1328 | } |
1329 | 1329 | |
1330 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1330 | + if (!$this->is_field_sortable($field['id'], $form)) { |
|
1331 | 1331 | return $label; |
1332 | 1332 | } |
1333 | 1333 | |
@@ -1335,16 +1335,16 @@ discard block |
||
1335 | 1335 | |
1336 | 1336 | $class = 'gv-sort icon'; |
1337 | 1337 | |
1338 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1338 | + $sort_field_id = self::_override_sorting_id_by_field_type($field['id'], $form['id']); |
|
1339 | 1339 | |
1340 | 1340 | $sort_args = array( |
1341 | 1341 | 'sort' => $field['id'], |
1342 | 1342 | 'dir' => 'asc', |
1343 | 1343 | ); |
1344 | 1344 | |
1345 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1345 | + if (!empty($sorting['key']) && (string)$sort_field_id === (string)$sorting['key']) { |
|
1346 | 1346 | //toggle sorting direction. |
1347 | - if ( 'asc' === $sorting['direction'] ) { |
|
1347 | + if ('asc' === $sorting['direction']) { |
|
1348 | 1348 | $sort_args['dir'] = 'desc'; |
1349 | 1349 | $class .= ' gv-icon-sort-desc'; |
1350 | 1350 | } else { |
@@ -1355,9 +1355,9 @@ discard block |
||
1355 | 1355 | $class .= ' gv-icon-caret-up-down'; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1358 | + $url = add_query_arg($sort_args, remove_query_arg(array('pagenum'))); |
|
1359 | 1359 | |
1360 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1360 | + return '<a href="'.esc_url_raw($url).'" class="'.$class.'" ></a> '.$label; |
|
1361 | 1361 | |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1371,12 +1371,12 @@ discard block |
||
1371 | 1371 | * |
1372 | 1372 | * @return bool True: Yes, field is sortable; False: not sortable |
1373 | 1373 | */ |
1374 | - public function is_field_sortable( $field_id = '', $form = array() ) { |
|
1374 | + public function is_field_sortable($field_id = '', $form = array()) { |
|
1375 | 1375 | |
1376 | 1376 | $field_type = $field_id; |
1377 | 1377 | |
1378 | - if( is_numeric( $field_id ) ) { |
|
1379 | - $field = GFFormsModel::get_field( $form, $field_id ); |
|
1378 | + if (is_numeric($field_id)) { |
|
1379 | + $field = GFFormsModel::get_field($form, $field_id); |
|
1380 | 1380 | $field_type = $field->type; |
1381 | 1381 | } |
1382 | 1382 | |
@@ -1392,13 +1392,13 @@ discard block |
||
1392 | 1392 | * @param string $field_type Field type to check whether the field is sortable |
1393 | 1393 | * @param array $form Gravity Forms form |
1394 | 1394 | */ |
1395 | - $not_sortable = apply_filters( 'gravityview/sortable/field_blacklist', $not_sortable, $field_type, $form ); |
|
1395 | + $not_sortable = apply_filters('gravityview/sortable/field_blacklist', $not_sortable, $field_type, $form); |
|
1396 | 1396 | |
1397 | - if ( in_array( $field_type, $not_sortable ) ) { |
|
1397 | + if (in_array($field_type, $not_sortable)) { |
|
1398 | 1398 | return false; |
1399 | 1399 | } |
1400 | 1400 | |
1401 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1401 | + return apply_filters("gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters("gravityview/sortable/field_{$field_id}", true, $form)); |
|
1402 | 1402 | |
1403 | 1403 | } |
1404 | 1404 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * |
70 | 70 | * @since 1.16 |
71 | 71 | * |
72 | - * @param int|string $value Number value for the field |
|
72 | + * @param string $value Number value for the field |
|
73 | 73 | * |
74 | 74 | * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription" |
75 | 75 | */ |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'in', 'not in' ); |
|
17 | + var $search_operators = array('is', 'isnot', 'in', 'not in'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * GravityView_Field_Transaction_Type constructor. |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - $this->label = esc_html__( 'Transaction Type', 'gravityview' ); |
|
38 | - $this->description = esc_html__( 'The type of the order: one-time payment or subscription', 'gravityview' ); |
|
37 | + $this->label = esc_html__('Transaction Type', 'gravityview'); |
|
38 | + $this->description = esc_html__('The type of the order: one-time payment or subscription', 'gravityview'); |
|
39 | 39 | |
40 | - add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 ); |
|
40 | + add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4); |
|
41 | 41 | |
42 | 42 | parent::__construct(); |
43 | 43 | } |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return String values for this field based on the numeric values used by Gravity Forms |
58 | 58 | */ |
59 | - public function get_content( $output, $entry, $field_settings, $field ) { |
|
59 | + public function get_content($output, $entry, $field_settings, $field) { |
|
60 | 60 | |
61 | 61 | /** Overridden by a template. */ |
62 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
62 | + if (!empty($field['field_path'])) { return $output; } |
|
63 | 63 | |
64 | - return $this->get_string_from_value( $output ); |
|
64 | + return $this->get_string_from_value($output); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription" |
75 | 75 | */ |
76 | - private function get_string_from_value( $value ) { |
|
76 | + private function get_string_from_value($value) { |
|
77 | 77 | |
78 | - switch ( intval( $value ) ) { |
|
78 | + switch (intval($value)) { |
|
79 | 79 | case self::ONE_TIME_PAYMENT: |
80 | 80 | default: |
81 | 81 | $return = __('One-Time Payment', 'gravityview'); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * We could do this in a cleaner fashion, but this prevents a lot of code duplication, checking for URL structure, etc. |
30 | 30 | * |
31 | - * @param int|WP_Post $id Optional. Post ID or post object. Default current post. |
|
31 | + * @param integer $id Optional. Post ID or post object. Default current post. |
|
32 | 32 | * |
33 | 33 | * @return array URL args, if exists. Empty array if not. |
34 | 34 | */ |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @since 1.15 Added $object param |
136 | 136 | * |
137 | 137 | * @param string $file_path Full path to a file |
138 | - * @param mixed $object Pass pseudo-global to the included file |
|
138 | + * @param GravityView_Edit_Entry_Render $object Pass pseudo-global to the included file |
|
139 | 139 | * @return string Included file contents |
140 | 140 | */ |
141 | 141 | function gravityview_ob_include( $file_path, $object = NULL ) { |
@@ -310,7 +310,6 @@ discard block |
||
310 | 310 | * Do a _very_ basic match for second-level TLD domains, like `.co.uk` |
311 | 311 | * |
312 | 312 | * Ideally, we'd use https://github.com/jeremykendall/php-domain-parser to check for this, but it's too much work for such a basic functionality. Maybe if it's needed more in the future. So instead, we use [Basic matching regex](http://stackoverflow.com/a/12372310). |
313 | - * @param string $domain Domain to check if it's a TLD or subdomain |
|
314 | 313 | * @return string Extracted domain if it has a subdomain |
315 | 314 | */ |
316 | 315 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @return bool true: $mixed is *not* an empty string; false: $mixed *is* an empty string |
17 | 17 | */ |
18 | -function gravityview_is_not_empty_string( $mixed = '' ) { |
|
19 | - return ( $mixed !== '' ); |
|
18 | +function gravityview_is_not_empty_string($mixed = '') { |
|
19 | + return ($mixed !== ''); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return array URL args, if exists. Empty array if not. |
34 | 34 | */ |
35 | -function gravityview_get_permalink_query_args( $id = 0 ) { |
|
35 | +function gravityview_get_permalink_query_args($id = 0) { |
|
36 | 36 | |
37 | - $parsed_permalink = parse_url( get_permalink( $id ) ); |
|
37 | + $parsed_permalink = parse_url(get_permalink($id)); |
|
38 | 38 | |
39 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
39 | + $permalink_args = isset($parsed_permalink['query']) ? $parsed_permalink['query'] : false; |
|
40 | 40 | |
41 | - if( empty( $permalink_args ) ) { |
|
41 | + if (empty($permalink_args)) { |
|
42 | 42 | return array(); |
43 | 43 | } |
44 | 44 | |
45 | - parse_str( $permalink_args, $args ); |
|
45 | + parse_str($permalink_args, $args); |
|
46 | 46 | |
47 | 47 | return $args; |
48 | 48 | } |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string html attribute or empty string |
62 | 62 | */ |
63 | -function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
|
63 | +function gv_selected($value, $current, $echo = true, $type = 'selected') { |
|
64 | 64 | |
65 | 65 | $output = ''; |
66 | - if( is_array( $current ) ) { |
|
67 | - if( in_array( $value, $current ) ) { |
|
68 | - $output = __checked_selected_helper( true, true, false, $type ); |
|
66 | + if (is_array($current)) { |
|
67 | + if (in_array($value, $current)) { |
|
68 | + $output = __checked_selected_helper(true, true, false, $type); |
|
69 | 69 | } |
70 | 70 | } else { |
71 | - $output = __checked_selected_helper( $value, $current, false, $type ); |
|
71 | + $output = __checked_selected_helper($value, $current, false, $type); |
|
72 | 72 | } |
73 | 73 | |
74 | - if( $echo ) { |
|
74 | + if ($echo) { |
|
75 | 75 | echo $output; |
76 | 76 | } |
77 | 77 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
82 | +if (!function_exists('gravityview_sanitize_html_class')) { |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -90,22 +90,22 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return string Sanitized CSS string |
92 | 92 | */ |
93 | - function gravityview_sanitize_html_class( $classes ) { |
|
93 | + function gravityview_sanitize_html_class($classes) { |
|
94 | 94 | |
95 | - if ( is_string( $classes ) ) { |
|
96 | - $classes = explode( ' ', $classes ); |
|
95 | + if (is_string($classes)) { |
|
96 | + $classes = explode(' ', $classes); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // If someone passes something not string or array, we get outta here. |
100 | - if ( ! is_array( $classes ) ) { |
|
100 | + if (!is_array($classes)) { |
|
101 | 101 | return $classes; |
102 | 102 | } |
103 | 103 | |
104 | - $classes = array_map( 'trim', $classes ); |
|
105 | - $classes = array_map( 'sanitize_html_class', $classes ); |
|
106 | - $classes = array_filter( $classes ); |
|
104 | + $classes = array_map('trim', $classes); |
|
105 | + $classes = array_map('sanitize_html_class', $classes); |
|
106 | + $classes = array_filter($classes); |
|
107 | 107 | |
108 | - return implode( ' ', $classes ); |
|
108 | + return implode(' ', $classes); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string Stripped string! |
125 | 125 | */ |
126 | -function gravityview_strip_whitespace( $string ) { |
|
127 | - $string = normalize_whitespace( $string ); |
|
128 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
126 | +function gravityview_strip_whitespace($string) { |
|
127 | + $string = normalize_whitespace($string); |
|
128 | + return preg_replace('/[\r\n\t ]+/', ' ', $string); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | * @param mixed $object Pass pseudo-global to the included file |
139 | 139 | * @return string Included file contents |
140 | 140 | */ |
141 | -function gravityview_ob_include( $file_path, $object = NULL ) { |
|
142 | - if( ! file_exists( $file_path ) ) { |
|
143 | - do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path ); |
|
141 | +function gravityview_ob_include($file_path, $object = NULL) { |
|
142 | + if (!file_exists($file_path)) { |
|
143 | + do_action('gravityview_log_error', __FUNCTION__.': File path does not exist. ', $file_path); |
|
144 | 144 | return ''; |
145 | 145 | } |
146 | 146 | ob_start(); |
147 | - include( $file_path ); |
|
147 | + include($file_path); |
|
148 | 148 | return ob_get_clean(); |
149 | 149 | } |
150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | function gravityview_get_floaty() { |
157 | 157 | |
158 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
158 | + if (function_exists('is_rtl') && is_rtl()) { |
|
159 | 159 | $style = 'margin:10px 10px 10px 0;'; |
160 | 160 | $class = 'alignright'; |
161 | 161 | } else { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $class = 'alignleft'; |
164 | 164 | } |
165 | 165 | |
166 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
166 | + return '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -183,21 +183,21 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return string Converted number in string format. |
185 | 185 | */ |
186 | -function gravityview_number_format( $number, $decimals = '' ) { |
|
186 | +function gravityview_number_format($number, $decimals = '') { |
|
187 | 187 | global $wp_locale; |
188 | 188 | |
189 | - if( '' === $decimals ) { |
|
189 | + if ('' === $decimals) { |
|
190 | 190 | |
191 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
191 | + $decimal_point = isset($wp_locale) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Calculate the position of the decimal point in the number |
195 | 195 | * @see http://stackoverflow.com/a/2430144/480856 |
196 | 196 | */ |
197 | - $decimals = strlen( substr( strrchr( $number, $decimal_point ), 1 ) ); |
|
197 | + $decimals = strlen(substr(strrchr($number, $decimal_point), 1)); |
|
198 | 198 | } |
199 | 199 | |
200 | - $number = number_format_i18n( $number, (int)$decimals ); |
|
200 | + $number = number_format_i18n($number, (int)$decimals); |
|
201 | 201 | |
202 | 202 | return $number; |
203 | 203 | } |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | * @param string $value Existing URL |
212 | 212 | * @return string If parse_url doesn't find a 'host', returns original value. Otherwise, returns formatted link. |
213 | 213 | */ |
214 | -function gravityview_format_link( $value = null ) { |
|
214 | +function gravityview_format_link($value = null) { |
|
215 | 215 | |
216 | 216 | |
217 | - $parts = parse_url( $value ); |
|
217 | + $parts = parse_url($value); |
|
218 | 218 | |
219 | 219 | // No domain? Strange...show the original text. |
220 | - if( empty( $parts['host'] ) ) { |
|
220 | + if (empty($parts['host'])) { |
|
221 | 221 | return $value; |
222 | 222 | } |
223 | 223 | |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
231 | 231 | * If true: `http://example.com => example.com` |
232 | 232 | */ |
233 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
233 | + if (false === apply_filters('gravityview_anchor_text_striphttp', true)) { |
|
234 | 234 | |
235 | - if( isset( $parts['scheme'] ) ) { |
|
235 | + if (isset($parts['scheme'])) { |
|
236 | 236 | $return .= $parts['scheme']; |
237 | 237 | } |
238 | 238 | |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
248 | 248 | * If true: `www.example.com => example.com` |
249 | 249 | */ |
250 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
250 | + $strip_www = apply_filters('gravityview_anchor_text_stripwww', true); |
|
251 | 251 | |
252 | - if( $strip_www ) { |
|
253 | - $domain = str_replace('www.', '', $domain ); |
|
252 | + if ($strip_www) { |
|
253 | + $domain = str_replace('www.', '', $domain); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | */ |
263 | 263 | $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
264 | 264 | |
265 | - if( $strip_subdomains ) { |
|
265 | + if ($strip_subdomains) { |
|
266 | 266 | |
267 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
267 | + $domain = _gravityview_strip_subdomain($parts['host']); |
|
268 | 268 | |
269 | 269 | } |
270 | 270 | |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | */ |
281 | 281 | $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
282 | 282 | |
283 | - if( empty( $root_only ) ) { |
|
283 | + if (empty($root_only)) { |
|
284 | 284 | |
285 | - if( isset( $parts['path'] ) ) { |
|
285 | + if (isset($parts['path'])) { |
|
286 | 286 | $return .= $parts['path']; |
287 | 287 | } |
288 | 288 | } |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
294 | 294 | * If true: `http://example.com/?query=example => example.com` |
295 | 295 | */ |
296 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
296 | + $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true); |
|
297 | 297 | |
298 | - if( empty( $strip_query_string ) ) { |
|
298 | + if (empty($strip_query_string)) { |
|
299 | 299 | |
300 | - if( isset( $parts['query'] ) ) { |
|
300 | + if (isset($parts['query'])) { |
|
301 | 301 | $return .= '?'.$parts['query']; |
302 | 302 | } |
303 | 303 | |
@@ -313,9 +313,9 @@ discard block |
||
313 | 313 | * @param string $domain Domain to check if it's a TLD or subdomain |
314 | 314 | * @return string Extracted domain if it has a subdomain |
315 | 315 | */ |
316 | -function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
|
316 | +function _gravityview_strip_subdomain($string_maybe_has_subdomain) { |
|
317 | 317 | |
318 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
318 | + if (preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches)) { |
|
319 | 319 | return $matches['domain']; |
320 | 320 | } else { |
321 | 321 | return $string_maybe_has_subdomain; |
@@ -335,37 +335,37 @@ discard block |
||
335 | 335 | * @param boolean $allow_string_booleans Whether to check if 'yes', 'true' => `true` and 'no', 'false' => `false` |
336 | 336 | * @return boolean True: empty; false: not empty |
337 | 337 | */ |
338 | -function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) { |
|
338 | +function gv_empty($value, $zero_is_empty = true, $allow_string_booleans = true) { |
|
339 | 339 | |
340 | - if( |
|
341 | - ! isset( $value ) // If it's not set, it's empty! |
|
340 | + if ( |
|
341 | + !isset($value) // If it's not set, it's empty! |
|
342 | 342 | || false === $value |
343 | 343 | || null === $value |
344 | 344 | || '' === $value // Empty string |
345 | 345 | || array() === $value // Empty array |
346 | - || ( is_object( $value ) && ! get_object_vars( $value ) ) // Empty object |
|
346 | + || (is_object($value) && !get_object_vars($value)) // Empty object |
|
347 | 347 | ) { |
348 | 348 | return true; |
349 | 349 | } |
350 | 350 | |
351 | - if( is_string( $value ) && $allow_string_booleans ) { |
|
351 | + if (is_string($value) && $allow_string_booleans) { |
|
352 | 352 | |
353 | - $value = trim( $value ); |
|
354 | - $value = strtolower( $value ); |
|
353 | + $value = trim($value); |
|
354 | + $value = strtolower($value); |
|
355 | 355 | |
356 | - if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
|
356 | + if (in_array($value, array('yes', 'true'), true)) { |
|
357 | 357 | $value = true; |
358 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
358 | + } else if (in_array($value, array('no', 'false'), true)) { |
|
359 | 359 | $value = false; |
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | 363 | // If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false. |
364 | - if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
364 | + if (!$zero_is_empty && is_numeric($value) && empty($value)) { |
|
365 | 365 | return false; |
366 | 366 | } |
367 | 367 | |
368 | - return empty( $value ); |
|
368 | + return empty($value); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -378,17 +378,17 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @return bool True: it's a valid datetime, formatted as expected. False: it's not a date formatted as expected. |
380 | 380 | */ |
381 | -function gravityview_is_valid_datetime( $datetime, $expected_format = 'Y-m-d' ) { |
|
381 | +function gravityview_is_valid_datetime($datetime, $expected_format = 'Y-m-d') { |
|
382 | 382 | |
383 | 383 | /** |
384 | 384 | * @var bool|DateTime False if not a valid date, (like a relative date). DateTime if a date was created. |
385 | 385 | */ |
386 | - $formatted_date = DateTime::createFromFormat( $expected_format, $datetime ); |
|
386 | + $formatted_date = DateTime::createFromFormat($expected_format, $datetime); |
|
387 | 387 | |
388 | 388 | /** |
389 | 389 | * @see http://stackoverflow.com/a/19271434/480856 |
390 | 390 | */ |
391 | - return ( $formatted_date && $formatted_date->format( $expected_format ) === $datetime ); |
|
391 | + return ($formatted_date && $formatted_date->format($expected_format) === $datetime); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @return array Multidimensional array with `text` (Category Name) and `value` (Category ID) keys. |
408 | 408 | */ |
409 | -function gravityview_get_terms_choices( $args = array() ) { |
|
409 | +function gravityview_get_terms_choices($args = array()) { |
|
410 | 410 | |
411 | 411 | $defaults = array( |
412 | 412 | 'type' => 'post', |
@@ -420,21 +420,21 @@ discard block |
||
420 | 420 | 'fields' => 'id=>name', |
421 | 421 | ); |
422 | 422 | |
423 | - $args = wp_parse_args( $args, $defaults ); |
|
423 | + $args = wp_parse_args($args, $defaults); |
|
424 | 424 | |
425 | 425 | /** |
426 | 426 | * @filter `gravityview_get_terms_choices_args` Modify the arguments passed to `get_terms()` |
427 | 427 | * @see get_terms() |
428 | 428 | * @since 1.15.3 |
429 | 429 | */ |
430 | - $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
|
430 | + $args = apply_filters('gravityview_get_terms_choices_args', $args); |
|
431 | 431 | |
432 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
432 | + $terms = get_terms($args['taxonomy'], $args); |
|
433 | 433 | |
434 | 434 | $choices = array(); |
435 | 435 | |
436 | - if ( is_array( $terms ) ) { |
|
437 | - foreach ( $terms as $term_id => $term_name ) { |
|
436 | + if (is_array($terms)) { |
|
437 | + foreach ($terms as $term_id => $term_name) { |
|
438 | 438 | $choices[] = array( |
439 | 439 | 'text' => $term_name, |
440 | 440 | 'value' => $term_id |
@@ -8,6 +8,6 @@ |
||
8 | 8 | |
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | -extract( $gravityview_view->getCurrentField() ); |
|
11 | +extract($gravityview_view->getCurrentField()); |
|
12 | 12 | |
13 | -echo GVCommon::format_date( $value, 'format=' . rgar( $field_settings, 'date_display' ) ); |
|
14 | 13 | \ No newline at end of file |
14 | +echo GVCommon::format_date($value, 'format='.rgar($field_settings, 'date_display')); |
|
15 | 15 | \ No newline at end of file |
@@ -122,7 +122,7 @@ |
||
122 | 122 | |
123 | 123 | $atts = array( |
124 | 124 | 'format' => self::get_format_from_modifiers( $exploded, false ), |
125 | - 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
125 | + 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
126 | 126 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
127 | 127 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
128 | 128 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | private function add_hooks() { |
21 | 21 | |
22 | 22 | /** @see GFCommon::replace_variables_prepopulate **/ |
23 | - add_filter( 'gform_replace_merge_tags', array( 'GravityView_Merge_Tags', 'replace_gv_merge_tags' ), 10, 7 ); |
|
23 | + add_filter('gform_replace_merge_tags', array('GravityView_Merge_Tags', 'replace_gv_merge_tags'), 10, 7); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param bool $esc_html Pass return value through `esc_html()` |
42 | 42 | * @return string Text with variables maybe replaced |
43 | 43 | */ |
44 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
44 | + public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param[in] array $form GF Form array |
54 | 54 | * @param[in] array $entry GF Entry array |
55 | 55 | */ |
56 | - $do_replace_variables = apply_filters( 'gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry ); |
|
56 | + $do_replace_variables = apply_filters('gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry); |
|
57 | 57 | |
58 | - if ( strpos( $text, '{' ) === false || ! $do_replace_variables ) { |
|
58 | + if (strpos($text, '{') === false || !$do_replace_variables) { |
|
59 | 59 | return $text; |
60 | 60 | } |
61 | 61 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @internal Reported to GF Support on 12/3 |
66 | 66 | */ |
67 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
68 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
69 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
67 | + $form['title'] = isset($form['title']) ? $form['title'] : ''; |
|
68 | + $form['id'] = isset($form['id']) ? $form['id'] : ''; |
|
69 | + $form['fields'] = isset($form['fields']) ? $form['fields'] : array(); |
|
70 | 70 | |
71 | - return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html ); |
|
71 | + return GFCommon::replace_variables($text, $form, $entry, $url_encode, $esc_html); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
89 | + public static function replace_gv_merge_tags($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * @see GFCommon::replace_variables_prepopulate() |
95 | 95 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
96 | 96 | */ |
97 | - if( false === $form ) { |
|
97 | + if (false === $form) { |
|
98 | 98 | return $text; |
99 | 99 | } |
100 | 100 | |
101 | - $text = self::replace_get_variables( $text, $form, $entry, $url_encode ); |
|
101 | + $text = self::replace_get_variables($text, $form, $entry, $url_encode); |
|
102 | 102 | |
103 | 103 | return $text; |
104 | 104 | } |
@@ -115,21 +115,21 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return int|string If timestamp requested, timestamp int. Otherwise, string output. |
117 | 117 | */ |
118 | - public static function format_date( $date_created = '', $property = '' ) { |
|
118 | + public static function format_date($date_created = '', $property = '') { |
|
119 | 119 | |
120 | 120 | // Expand all modifiers, skipping escaped colons. str_replace worked better than preg_split( "/(?<!\\):/" ) |
121 | - $exploded = explode( ':', str_replace( '\:', '|COLON|', $property ) ); |
|
121 | + $exploded = explode(':', str_replace('\:', '|COLON|', $property)); |
|
122 | 122 | |
123 | 123 | $atts = array( |
124 | - 'format' => self::get_format_from_modifiers( $exploded, false ), |
|
125 | - 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
126 | - 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
|
127 | - 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
|
128 | - 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
|
129 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
124 | + 'format' => self::get_format_from_modifiers($exploded, false), |
|
125 | + 'human' => in_array('human', $exploded), // {date_created:human} |
|
126 | + 'diff' => in_array('diff', $exploded), // {date_created:diff} |
|
127 | + 'raw' => in_array('raw', $exploded), // {date_created:raw} |
|
128 | + 'timestamp' => in_array('timestamp', $exploded), // {date_created:timestamp} |
|
129 | + 'time' => in_array('time', $exploded), // {date_created:time} |
|
130 | 130 | ); |
131 | 131 | |
132 | - $formatted_date = GVCommon::format_date( $date_created, $atts ); |
|
132 | + $formatted_date = GVCommon::format_date($date_created, $atts); |
|
133 | 133 | |
134 | 134 | return $formatted_date; |
135 | 135 | } |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @return string If format is found, the passed format. Otherwise, the backup. |
149 | 149 | */ |
150 | - private static function get_format_from_modifiers( $exploded, $backup = '' ) { |
|
150 | + private static function get_format_from_modifiers($exploded, $backup = '') { |
|
151 | 151 | |
152 | 152 | $return = $backup; |
153 | 153 | |
154 | - $format_key_index = array_search( 'format', $exploded ); |
|
154 | + $format_key_index = array_search('format', $exploded); |
|
155 | 155 | |
156 | 156 | // If there's a "format:[php date format string]" date format, grab it |
157 | - if ( false !== $format_key_index && isset( $exploded[ $format_key_index + 1 ] ) ) { |
|
157 | + if (false !== $format_key_index && isset($exploded[$format_key_index + 1])) { |
|
158 | 158 | // Return escaped colons placeholder |
159 | - $return = str_replace( '|COLON|', ':', $exploded[ $format_key_index + 1 ] ); |
|
159 | + $return = str_replace('|COLON|', ':', $exploded[$format_key_index + 1]); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $return; |
@@ -183,22 +183,22 @@ discard block |
||
183 | 183 | * @param array $entry Entry array |
184 | 184 | * @param bool $url_encode Whether to URL-encode output |
185 | 185 | */ |
186 | - public static function replace_get_variables( $text, $form = array(), $entry = array(), $url_encode = false ) { |
|
186 | + public static function replace_get_variables($text, $form = array(), $entry = array(), $url_encode = false) { |
|
187 | 187 | |
188 | 188 | // Is there is {get:[xyz]} merge tag? |
189 | - preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
|
189 | + preg_match_all("/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER); |
|
190 | 190 | |
191 | 191 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
192 | - if( empty( $matches ) ) { |
|
192 | + if (empty($matches)) { |
|
193 | 193 | return $text; |
194 | 194 | } |
195 | 195 | |
196 | - foreach ( $matches as $match ) { |
|
196 | + foreach ($matches as $match) { |
|
197 | 197 | |
198 | 198 | $full_tag = $match[0]; |
199 | 199 | $property = $match[1]; |
200 | 200 | |
201 | - $value = stripslashes_deep( rgget( $property ) ); |
|
201 | + $value = stripslashes_deep(rgget($property)); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * @filter `gravityview/merge_tags/get/glue/` Modify the glue used to convert an array of `{get}` values from an array to string |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | * @param[in,out] string $glue String used to `implode()` $_GET values Default: ', ' |
207 | 207 | * @param[in] string $property The current name of the $_GET parameter being combined |
208 | 208 | */ |
209 | - $glue = apply_filters( 'gravityview/merge_tags/get/glue/', ', ', $property ); |
|
209 | + $glue = apply_filters('gravityview/merge_tags/get/glue/', ', ', $property); |
|
210 | 210 | |
211 | - $value = is_array( $value ) ? implode( $glue, $value ) : $value; |
|
211 | + $value = is_array($value) ? implode($glue, $value) : $value; |
|
212 | 212 | |
213 | - $value = $url_encode ? urlencode( $value ) : $value; |
|
213 | + $value = $url_encode ? urlencode($value) : $value; |
|
214 | 214 | |
215 | 215 | /** |
216 | 216 | * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Disable esc_html() from running on `{get}` merge tag |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | * @since 1.15 |
221 | 221 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
222 | 222 | */ |
223 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
223 | + $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/'.$property, true); |
|
224 | 224 | |
225 | - $value = $esc_html ? esc_html( $value ) : $value; |
|
225 | + $value = $esc_html ? esc_html($value) : $value; |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Modify the value of the `{get}` replacement before being used |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | * @param[in] array $form Gravity Forms form array |
232 | 232 | * @param[in] array $entry Entry array |
233 | 233 | */ |
234 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
234 | + $value = apply_filters('gravityview/merge_tags/get/value/'.$property, $value, $text, $form, $entry); |
|
235 | 235 | |
236 | - $text = str_replace( $full_tag, $value, $text ); |
|
236 | + $text = str_replace($full_tag, $value, $text); |
|
237 | 237 | } |
238 | 238 | |
239 | - unset( $value, $glue, $matches ); |
|
239 | + unset($value, $glue, $matches); |
|
240 | 240 | |
241 | 241 | return $text; |
242 | 242 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = false; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot' ); |
|
17 | + var $search_operators = array('is', 'isnot'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * GravityView_Field_Is_Fulfilled constructor. |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - $this->label = esc_html__( 'Is Fulfilled', 'gravityview' ); |
|
37 | + $this->label = esc_html__('Is Fulfilled', 'gravityview'); |
|
38 | 38 | |
39 | - add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 ); |
|
39 | + add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4); |
|
40 | 40 | |
41 | 41 | parent::__construct(); |
42 | 42 | } |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return String values for this field based on the numeric values used by Gravity Forms |
57 | 57 | */ |
58 | - public function get_content( $output, $entry, $field_settings, $field ) { |
|
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 | - return $this->get_string_from_value( $output ); |
|
63 | + return $this->get_string_from_value($output); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string |
74 | 74 | */ |
75 | - private function get_string_from_value( $value ) { |
|
75 | + private function get_string_from_value($value) { |
|
76 | 76 | |
77 | - switch ( intval( $value ) ) { |
|
77 | + switch (intval($value)) { |
|
78 | 78 | case self::NOT_FULFILLED: |
79 | 79 | default: |
80 | 80 | $return = __('Not Fulfilled', 'gravityview'); |
@@ -101,22 +101,22 @@ 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 | - foreach ( $matches as $match ) { |
|
108 | + foreach ($matches as $match) { |
|
109 | 109 | |
110 | 110 | $full_tag = $match[0]; |
111 | 111 | |
112 | - $fulfilled = rgar( $entry, 'is_fulfilled' ); |
|
112 | + $fulfilled = rgar($entry, 'is_fulfilled'); |
|
113 | 113 | |
114 | - $value = $this->get_string_from_value( $fulfilled ); |
|
114 | + $value = $this->get_string_from_value($fulfilled); |
|
115 | 115 | |
116 | - $return = str_replace( $full_tag, $value, $return ); |
|
116 | + $return = str_replace($full_tag, $value, $return); |
|
117 | 117 | } |
118 | 118 | |
119 | - unset( $formatted_amount, $value, $amount, $full_tag, $matches ); |
|
119 | + unset($formatted_amount, $value, $amount, $full_tag, $matches); |
|
120 | 120 | |
121 | 121 | return $return; |
122 | 122 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = false; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot' ); |
|
17 | + var $search_operators = array('is', 'isnot'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | * GravityView_Field_Date_Created constructor. |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - $this->label = esc_attr__( 'Payment Method', 'gravityview' ); |
|
28 | - $this->description = esc_html( 'The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview' ); |
|
27 | + $this->label = esc_attr__('Payment Method', 'gravityview'); |
|
28 | + $this->description = esc_html('The way the entry was paid for (ie "Credit Card", "PayPal", etc.)', 'gravityview'); |
|
29 | 29 | parent::__construct(); |
30 | 30 | } |
31 | 31 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | var $is_numeric = true; |
16 | 16 | |
17 | - var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than', 'contains' ); |
|
17 | + var $search_operators = array('is', 'isnot', 'greater_than', 'less_than', 'contains'); |
|
18 | 18 | |
19 | 19 | var $group = 'pricing'; |
20 | 20 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * GravityView_Field_Payment_Amount constructor. |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - $this->label = esc_attr__( 'Payment Amount', 'gravityview' ); |
|
27 | + $this->label = esc_attr__('Payment Amount', 'gravityview'); |
|
28 | 28 | |
29 | - add_filter( 'gravityview_field_entry_value_' . $this->name . '_pre_link', array( $this, 'get_content' ), 10, 4 ); |
|
29 | + add_filter('gravityview_field_entry_value_'.$this->name.'_pre_link', array($this, 'get_content'), 10, 4); |
|
30 | 30 | |
31 | 31 | parent::__construct(); |
32 | 32 | } |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return String values for this field based on the numeric values used by Gravity Forms |
47 | 47 | */ |
48 | - public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
|
48 | + public function get_content($output = '', $entry = array(), $field_settings = array(), $field = array()) { |
|
49 | 49 | |
50 | 50 | /** Overridden by a template. */ |
51 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
51 | + if (!empty($field['field_path'])) { return $output; } |
|
52 | 52 | |
53 | - $amount = rgar( $entry, 'payment_amount' ); |
|
54 | - $return = GFCommon::to_money( $amount, rgar( $entry, 'currency' ) ); |
|
53 | + $amount = rgar($entry, 'payment_amount'); |
|
54 | + $return = GFCommon::to_money($amount, rgar($entry, 'currency')); |
|
55 | 55 | |
56 | 56 | return $return; |
57 | 57 | } |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
71 | 71 | */ |
72 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
72 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
73 | 73 | |
74 | 74 | $return = $text; |
75 | 75 | |
76 | - foreach ( $matches as $match ) { |
|
76 | + foreach ($matches as $match) { |
|
77 | 77 | |
78 | 78 | $full_tag = $match[0]; |
79 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
79 | + $modifier = isset($match[1]) ? $match[1] : false; |
|
80 | 80 | |
81 | - $amount = rgar( $entry, 'payment_amount' ); |
|
81 | + $amount = rgar($entry, 'payment_amount'); |
|
82 | 82 | |
83 | - $formatted_amount = ( 'raw' === $modifier ) ? $amount : GFCommon::to_money( $amount, rgar( $entry, 'currency' ) ); |
|
83 | + $formatted_amount = ('raw' === $modifier) ? $amount : GFCommon::to_money($amount, rgar($entry, 'currency')); |
|
84 | 84 | |
85 | - $return = str_replace( $full_tag, $formatted_amount, $return ); |
|
85 | + $return = str_replace($full_tag, $formatted_amount, $return); |
|
86 | 86 | } |
87 | 87 | |
88 | - unset( $formatted_amount, $amount, $full_tag, $matches ); |
|
88 | + unset($formatted_amount, $amount, $full_tag, $matches); |
|
89 | 89 | |
90 | 90 | return $return; |
91 | 91 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | var $is_searchable = true; |
14 | 14 | |
15 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot' ); |
|
15 | + var $search_operators = array('is', 'in', 'not in', 'isnot'); |
|
16 | 16 | |
17 | 17 | var $group = 'pricing'; |
18 | 18 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * GravityView_Field_Payment_Status constructor. |
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | - $this->label = esc_html__( 'Payment Status', 'gravityview' ); |
|
26 | - $this->description = esc_html__('The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' ); |
|
25 | + $this->label = esc_html__('Payment Status', 'gravityview'); |
|
26 | + $this->description = esc_html__('The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview'); |
|
27 | 27 | parent::__construct(); |
28 | 28 | } |
29 | 29 | } |