@@ -432,23 +432,17 @@ |
||
432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
433 | 433 | |
434 | 434 | $result = false; |
435 | - } |
|
436 | - |
|
437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
435 | + } else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
438 | 436 | |
439 | 437 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
440 | 438 | |
441 | 439 | $result = false; |
442 | - } |
|
443 | - |
|
444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
440 | + } else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
445 | 441 | |
446 | 442 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
447 | 443 | |
448 | 444 | $result = false; |
449 | - } |
|
450 | - |
|
451 | - else { |
|
445 | + } else { |
|
452 | 446 | |
453 | 447 | $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
454 | 448 |
@@ -1035,8 +1035,9 @@ |
||
1035 | 1035 | 'jquery-ui-autocomplete' |
1036 | 1036 | ); |
1037 | 1037 | |
1038 | - if ( wp_is_mobile() ) |
|
1039 | - $scripts[] = 'jquery-touch-punch'; |
|
1038 | + if ( wp_is_mobile() ) { |
|
1039 | + $scripts[] = 'jquery-touch-punch'; |
|
1040 | + } |
|
1040 | 1041 | |
1041 | 1042 | foreach ($scripts as $script) { |
1042 | 1043 | wp_enqueue_script( $script ); |
@@ -173,8 +173,7 @@ |
||
173 | 173 | if( !is_null( $notice['data'] ) ) { |
174 | 174 | $output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview' ).'</em>'; |
175 | 175 | } |
176 | - } |
|
177 | - else { |
|
176 | + } else { |
|
178 | 177 | $output .= sprintf( '<pre>%s</pre>', print_r($this->esc_html_recursive( $notice['data'] ), true) ); |
179 | 178 | } |
180 | 179 |
@@ -183,12 +183,10 @@ |
||
183 | 183 | if ( file_exists( $mofile_global ) ) { |
184 | 184 | // Look in global /wp-content/languages/[plugin-dir]/ folder |
185 | 185 | load_textdomain( $this->_text_domain, $mofile_global ); |
186 | - } |
|
187 | - elseif ( file_exists( $mofile_local ) ) { |
|
186 | + } elseif ( file_exists( $mofile_local ) ) { |
|
188 | 187 | // Look in local /wp-content/plugins/[plugin-dir]/languages/ folder |
189 | 188 | load_textdomain( $this->_text_domain, $mofile_local ); |
190 | - } |
|
191 | - else { |
|
189 | + } else { |
|
192 | 190 | // Load the default language files |
193 | 191 | load_plugin_textdomain( $this->_text_domain, false, $lang_dir ); |
194 | 192 | } |
@@ -441,8 +441,9 @@ |
||
441 | 441 | $field['name'] = 'gform-settings-save'; |
442 | 442 | $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
443 | 443 | |
444 | - if ( ! rgar( $field, 'value' ) ) |
|
445 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
444 | + if ( ! rgar( $field, 'value' ) ) { |
|
445 | + $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
446 | + } |
|
446 | 447 | |
447 | 448 | $output = $this->settings_submit( $field, false ); |
448 | 449 |
@@ -1519,9 +1519,7 @@ |
||
1519 | 1519 | // Verify |
1520 | 1520 | else if( ! $this->is_edit_entry() ) { |
1521 | 1521 | $valid = false; |
1522 | - } |
|
1523 | - |
|
1524 | - else { |
|
1522 | + } else { |
|
1525 | 1523 | $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
1526 | 1524 | } |
1527 | 1525 |
@@ -171,11 +171,13 @@ |
||
171 | 171 | $public_display['nickname'] = $profileuser->nickname; |
172 | 172 | $public_display['username'] = $profileuser->user_login; |
173 | 173 | |
174 | - if ( !empty($profileuser->first_name) ) |
|
175 | - $public_display['firstname'] = $profileuser->first_name; |
|
174 | + if ( !empty($profileuser->first_name) ) { |
|
175 | + $public_display['firstname'] = $profileuser->first_name; |
|
176 | + } |
|
176 | 177 | |
177 | - if ( !empty($profileuser->last_name) ) |
|
178 | - $public_display['lastname'] = $profileuser->last_name; |
|
178 | + if ( !empty($profileuser->last_name) ) { |
|
179 | + $public_display['lastname'] = $profileuser->last_name; |
|
180 | + } |
|
179 | 181 | |
180 | 182 | if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
181 | 183 | $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
@@ -4,7 +4,9 @@ |
||
4 | 4 | //set_site_transient( 'update_plugins', null ); |
5 | 5 | |
6 | 6 | // Exit if accessed directly |
7 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
7 | +if ( ! defined( 'ABSPATH' ) ) { |
|
8 | + exit; |
|
9 | +} |
|
8 | 10 | |
9 | 11 | /** |
10 | 12 | * Allows plugins to use their own update API. |
@@ -17,23 +17,26 @@ discard block |
||
17 | 17 | $result = $parser->parse( $file ); |
18 | 18 | |
19 | 19 | // If SimpleXML succeeds or this is an invalid WXR file then return the results |
20 | - if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() ) |
|
21 | - return $result; |
|
20 | + if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() ) { |
|
21 | + return $result; |
|
22 | + } |
|
22 | 23 | } else if ( extension_loaded( 'xml' ) ) { |
23 | 24 | $parser = new WXR_Parser_XML; |
24 | 25 | $result = $parser->parse( $file ); |
25 | 26 | |
26 | 27 | // If XMLParser succeeds or this is an invalid WXR file then return the results |
27 | - if ( ! is_wp_error( $result ) || 'XML_parse_error' != $result->get_error_code() ) |
|
28 | - return $result; |
|
28 | + if ( ! is_wp_error( $result ) || 'XML_parse_error' != $result->get_error_code() ) { |
|
29 | + return $result; |
|
30 | + } |
|
29 | 31 | } |
30 | 32 | |
31 | 33 | // We have a malformed XML file, so display the error and fallthrough to regex |
32 | 34 | if ( isset($result) && defined('IMPORT_DEBUG') && IMPORT_DEBUG ) { |
33 | 35 | echo '<pre>'; |
34 | 36 | if ( 'SimpleXML_parse_error' == $result->get_error_code() ) { |
35 | - foreach ( $result->get_error_data() as $error ) |
|
36 | - echo $error->line . ':' . $error->column . ' ' . esc_html( $error->message ) . "\n"; |
|
37 | + foreach ( $result->get_error_data() as $error ) { |
|
38 | + echo $error->line . ':' . $error->column . ' ' . esc_html( $error->message ) . "\n"; |
|
39 | + } |
|
37 | 40 | } else if ( 'XML_parse_error' == $result->get_error_code() ) { |
38 | 41 | $error = $result->get_error_data(); |
39 | 42 | echo $error[0] . ':' . $error[1] . ' ' . esc_html( $error[2] ); |
@@ -76,26 +79,31 @@ discard block |
||
76 | 79 | unset( $dom ); |
77 | 80 | |
78 | 81 | // halt if loading produces an error |
79 | - if ( ! $xml ) |
|
80 | - return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() ); |
|
82 | + if ( ! $xml ) { |
|
83 | + return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() ); |
|
84 | + } |
|
81 | 85 | |
82 | 86 | $wxr_version = $xml->xpath('/rss/channel/wp:wxr_version'); |
83 | - if ( ! $wxr_version ) |
|
84 | - return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
87 | + if ( ! $wxr_version ) { |
|
88 | + return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
89 | + } |
|
85 | 90 | |
86 | 91 | $wxr_version = (string) trim( $wxr_version[0] ); |
87 | 92 | // confirm that we are dealing with the correct file format |
88 | - if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) ) |
|
89 | - return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
93 | + if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) ) { |
|
94 | + return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
95 | + } |
|
90 | 96 | |
91 | 97 | $base_url = $xml->xpath('/rss/channel/wp:base_site_url'); |
92 | 98 | $base_url = isset($base_url[0]) ? (string) trim( $base_url[0] ) : ''; // Modified by GravityView: Check if base_url exists; the GV import files may exclude them. |
93 | 99 | |
94 | 100 | $namespaces = $xml->getDocNamespaces(); |
95 | - if ( ! isset( $namespaces['wp'] ) ) |
|
96 | - $namespaces['wp'] = 'http://wordpress.org/export/1.1/'; |
|
97 | - if ( ! isset( $namespaces['excerpt'] ) ) |
|
98 | - $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/'; |
|
101 | + if ( ! isset( $namespaces['wp'] ) ) { |
|
102 | + $namespaces['wp'] = 'http://wordpress.org/export/1.1/'; |
|
103 | + } |
|
104 | + if ( ! isset( $namespaces['excerpt'] ) ) { |
|
105 | + $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/'; |
|
106 | + } |
|
99 | 107 | |
100 | 108 | // grab authors |
101 | 109 | foreach ( $xml->xpath('/rss/channel/wp:author') as $author_arr ) { |
@@ -174,17 +182,19 @@ discard block |
||
174 | 182 | $post['post_password'] = (string) $wp->post_password; |
175 | 183 | $post['is_sticky'] = (int) $wp->is_sticky; |
176 | 184 | |
177 | - if ( isset($wp->attachment_url) ) |
|
178 | - $post['attachment_url'] = (string) $wp->attachment_url; |
|
185 | + if ( isset($wp->attachment_url) ) { |
|
186 | + $post['attachment_url'] = (string) $wp->attachment_url; |
|
187 | + } |
|
179 | 188 | |
180 | 189 | foreach ( $item->category as $c ) { |
181 | 190 | $att = $c->attributes(); |
182 | - if ( isset( $att['nicename'] ) ) |
|
183 | - $post['terms'][] = array( |
|
191 | + if ( isset( $att['nicename'] ) ) { |
|
192 | + $post['terms'][] = array( |
|
184 | 193 | 'name' => (string) $c, |
185 | 194 | 'slug' => (string) $att['nicename'], |
186 | 195 | 'domain' => (string) $att['domain'] |
187 | 196 | ); |
197 | + } |
|
188 | 198 | } |
189 | 199 | |
190 | 200 | foreach ( $wp->postmeta as $meta ) { |
@@ -275,8 +285,9 @@ discard block |
||
275 | 285 | } |
276 | 286 | xml_parser_free( $xml ); |
277 | 287 | |
278 | - if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) ) |
|
279 | - return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
288 | + if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) ) { |
|
289 | + return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
290 | + } |
|
280 | 291 | |
281 | 292 | return array( |
282 | 293 | 'authors' => $this->authors, |
@@ -308,7 +319,10 @@ discard block |
||
308 | 319 | } |
309 | 320 | break; |
310 | 321 | case 'item': $this->in_post = true; |
311 | - case 'title': if ( $this->in_post ) $this->in_tag = 'post_title'; break; |
|
322 | + case 'title': if ( $this->in_post ) { |
|
323 | + $this->in_tag = 'post_title'; |
|
324 | + } |
|
325 | + break; |
|
312 | 326 | case 'guid': $this->in_tag = 'guid'; break; |
313 | 327 | case 'dc:creator': $this->in_tag = 'post_author'; break; |
314 | 328 | case 'content:encoded': $this->in_tag = 'post_content'; break; |
@@ -321,8 +335,9 @@ discard block |
||
321 | 335 | } |
322 | 336 | |
323 | 337 | function cdata( $parser, $cdata ) { |
324 | - if ( ! trim( $cdata ) ) |
|
325 | - return; |
|
338 | + if ( ! trim( $cdata ) ) { |
|
339 | + return; |
|
340 | + } |
|
326 | 341 | |
327 | 342 | $this->cdata .= trim( $cdata ); |
328 | 343 | } |
@@ -331,8 +346,9 @@ discard block |
||
331 | 346 | switch ( $tag ) { |
332 | 347 | case 'wp:comment': |
333 | 348 | unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data |
334 | - if ( ! empty( $this->sub_data ) ) |
|
335 | - $this->data['comments'][] = $this->sub_data; |
|
349 | + if ( ! empty( $this->sub_data ) ) { |
|
350 | + $this->data['comments'][] = $this->sub_data; |
|
351 | + } |
|
336 | 352 | $this->sub_data = false; |
337 | 353 | break; |
338 | 354 | case 'wp:commentmeta': |
@@ -349,8 +365,9 @@ discard block |
||
349 | 365 | $this->sub_data = false; |
350 | 366 | break; |
351 | 367 | case 'wp:postmeta': |
352 | - if ( ! empty( $this->sub_data ) ) |
|
353 | - $this->data['postmeta'][] = $this->sub_data; |
|
368 | + if ( ! empty( $this->sub_data ) ) { |
|
369 | + $this->data['postmeta'][] = $this->sub_data; |
|
370 | + } |
|
354 | 371 | $this->sub_data = false; |
355 | 372 | break; |
356 | 373 | case 'item': |
@@ -365,8 +382,9 @@ discard block |
||
365 | 382 | $this->data = false; |
366 | 383 | break; |
367 | 384 | case 'wp:author': |
368 | - if ( ! empty($this->data['author_login']) ) |
|
369 | - $this->authors[$this->data['author_login']] = $this->data; |
|
385 | + if ( ! empty($this->data['author_login']) ) { |
|
386 | + $this->authors[$this->data['author_login']] = $this->data; |
|
387 | + } |
|
370 | 388 | $this->data = false; |
371 | 389 | break; |
372 | 390 | case 'wp:base_site_url': |
@@ -418,8 +436,9 @@ discard block |
||
418 | 436 | while ( ! $this->feof( $fp ) ) { |
419 | 437 | $importline = rtrim( $this->fgets( $fp ) ); |
420 | 438 | |
421 | - if ( ! $wxr_version && preg_match( '|<wp:wxr_version>(\d+\.\d+)</wp:wxr_version>|', $importline, $version ) ) |
|
422 | - $wxr_version = $version[1]; |
|
439 | + if ( ! $wxr_version && preg_match( '|<wp:wxr_version>(\d+\.\d+)</wp:wxr_version>|', $importline, $version ) ) { |
|
440 | + $wxr_version = $version[1]; |
|
441 | + } |
|
423 | 442 | |
424 | 443 | if ( false !== strpos( $importline, '<wp:base_site_url>' ) ) { |
425 | 444 | preg_match( '|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url ); |
@@ -465,8 +484,9 @@ discard block |
||
465 | 484 | $this->fclose($fp); |
466 | 485 | } |
467 | 486 | |
468 | - if ( ! $wxr_version ) |
|
469 | - return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
487 | + if ( ! $wxr_version ) { |
|
488 | + return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); |
|
489 | + } |
|
470 | 490 | |
471 | 491 | return array( |
472 | 492 | 'authors' => $this->authors, |
@@ -486,8 +506,9 @@ discard block |
||
486 | 506 | if ( strpos( $return[1], ']]]]><![CDATA[>' ) !== false ) { |
487 | 507 | preg_match_all( '|<!\[CDATA\[(.*?)\]\]>|s', $return[1], $matches ); |
488 | 508 | $return = ''; |
489 | - foreach( $matches[1] as $match ) |
|
490 | - $return .= $match; |
|
509 | + foreach( $matches[1] as $match ) { |
|
510 | + $return .= $match; |
|
511 | + } |
|
491 | 512 | } else { |
492 | 513 | $return = preg_replace( '|^<!\[CDATA\[(.*)\]\]>$|s', '$1', $return[1] ); |
493 | 514 | } |
@@ -574,8 +595,9 @@ discard block |
||
574 | 595 | ); |
575 | 596 | |
576 | 597 | $attachment_url = $this->get_tag( $post, 'wp:attachment_url' ); |
577 | - if ( $attachment_url ) |
|
578 | - $postdata['attachment_url'] = $attachment_url; |
|
598 | + if ( $attachment_url ) { |
|
599 | + $postdata['attachment_url'] = $attachment_url; |
|
600 | + } |
|
579 | 601 | |
580 | 602 | preg_match_all( '|<category domain="([^"]+?)" nicename="([^"]+?)">(.+?)</category>|is', $post, $terms, PREG_SET_ORDER ); |
581 | 603 | foreach ( $terms as $t ) { |
@@ -585,7 +607,9 @@ discard block |
||
585 | 607 | 'name' => str_replace( array( '<![CDATA[', ']]>' ), '', $t[3] ), |
586 | 608 | ); |
587 | 609 | } |
588 | - if ( ! empty( $post_terms ) ) $postdata['terms'] = $post_terms; |
|
610 | + if ( ! empty( $post_terms ) ) { |
|
611 | + $postdata['terms'] = $post_terms; |
|
612 | + } |
|
589 | 613 | |
590 | 614 | preg_match_all( '|<wp:comment>(.+?)</wp:comment>|is', $post, $comments ); |
591 | 615 | $comments = $comments[1]; |
@@ -618,7 +642,9 @@ discard block |
||
618 | 642 | ); |
619 | 643 | } |
620 | 644 | } |
621 | - if ( ! empty( $post_comments ) ) $postdata['comments'] = $post_comments; |
|
645 | + if ( ! empty( $post_comments ) ) { |
|
646 | + $postdata['comments'] = $post_comments; |
|
647 | + } |
|
622 | 648 | |
623 | 649 | preg_match_all( '|<wp:postmeta>(.+?)</wp:postmeta>|is', $post, $postmeta ); |
624 | 650 | $postmeta = $postmeta[1]; |
@@ -630,7 +656,9 @@ discard block |
||
630 | 656 | ); |
631 | 657 | } |
632 | 658 | } |
633 | - if ( ! empty( $post_postmeta ) ) $postdata['postmeta'] = $post_postmeta; |
|
659 | + if ( ! empty( $post_postmeta ) ) { |
|
660 | + $postdata['postmeta'] = $post_postmeta; |
|
661 | + } |
|
634 | 662 | |
635 | 663 | return $postdata; |
636 | 664 | } |
@@ -640,26 +668,30 @@ discard block |
||
640 | 668 | } |
641 | 669 | |
642 | 670 | function fopen( $filename, $mode = 'r' ) { |
643 | - if ( $this->has_gzip ) |
|
644 | - return gzopen( $filename, $mode ); |
|
671 | + if ( $this->has_gzip ) { |
|
672 | + return gzopen( $filename, $mode ); |
|
673 | + } |
|
645 | 674 | return fopen( $filename, $mode ); |
646 | 675 | } |
647 | 676 | |
648 | 677 | function feof( $fp ) { |
649 | - if ( $this->has_gzip ) |
|
650 | - return gzeof( $fp ); |
|
678 | + if ( $this->has_gzip ) { |
|
679 | + return gzeof( $fp ); |
|
680 | + } |
|
651 | 681 | return feof( $fp ); |
652 | 682 | } |
653 | 683 | |
654 | 684 | function fgets( $fp, $len = 8192 ) { |
655 | - if ( $this->has_gzip ) |
|
656 | - return gzgets( $fp, $len ); |
|
685 | + if ( $this->has_gzip ) { |
|
686 | + return gzgets( $fp, $len ); |
|
687 | + } |
|
657 | 688 | return fgets( $fp, $len ); |
658 | 689 | } |
659 | 690 | |
660 | 691 | function fclose( $fp ) { |
661 | - if ( $this->has_gzip ) |
|
662 | - return gzclose( $fp ); |
|
692 | + if ( $this->has_gzip ) { |
|
693 | + return gzclose( $fp ); |
|
694 | + } |
|
663 | 695 | return fclose( $fp ); |
664 | 696 | } |
665 | 697 | } |