@@ -103,6 +103,10 @@ |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | + /** |
|
107 | + * @param string $email_address |
|
108 | + * @param integer $page |
|
109 | + */ |
|
106 | 110 | public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
107 | 111 | global $wpdb; |
108 | 112 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Erasers Class. |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param int $page Review page. |
23 | 23 | * @return array |
24 | 24 | */ |
25 | - public static function review_data_eraser( $email_address, $page ) { |
|
25 | + public static function review_data_eraser($email_address, $page) { |
|
26 | 26 | global $wpdb; |
27 | 27 | |
28 | 28 | $response = array( |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'done' => true, |
33 | 33 | ); |
34 | 34 | |
35 | - if ( empty( $email_address ) ) { |
|
35 | + if (empty($email_address)) { |
|
36 | 36 | return $response; |
37 | 37 | } |
38 | 38 | |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | $items_removed = false; |
41 | 41 | $items_retained = false; |
42 | 42 | |
43 | - $reviews = self::reviews_by_author( $email_address, $page ); |
|
43 | + $reviews = self::reviews_by_author($email_address, $page); |
|
44 | 44 | |
45 | - if ( empty( $reviews ) ) { |
|
45 | + if (empty($reviews)) { |
|
46 | 46 | return $response; |
47 | 47 | } |
48 | 48 | |
49 | - $messages = array(); |
|
49 | + $messages = array(); |
|
50 | 50 | |
51 | - foreach ( $reviews as $review ) { |
|
51 | + foreach ($reviews as $review) { |
|
52 | 52 | $anonymized_review = array(); |
53 | 53 | $anonymized_review['user_id'] = 0; |
54 | - $anonymized_review['rating_ip'] = wp_privacy_anonymize_data( 'ip', $review->rating_ip ); |
|
54 | + $anonymized_review['rating_ip'] = wp_privacy_anonymize_data('ip', $review->rating_ip); |
|
55 | 55 | |
56 | 56 | $review_id = (int) $review->id; |
57 | 57 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @param object $review Review object. |
66 | 66 | * @param array $anonymized_review Anonymized review data. |
67 | 67 | */ |
68 | - $anon_message = apply_filters( 'geodir_anonymize_post_review', true, $review, $anonymized_review ); |
|
68 | + $anon_message = apply_filters('geodir_anonymize_post_review', true, $review, $anonymized_review); |
|
69 | 69 | |
70 | - if ( true !== $anon_message ) { |
|
71 | - if ( $anon_message && is_string( $anon_message ) ) { |
|
72 | - $messages[] = esc_html( $anon_message ); |
|
70 | + if (true !== $anon_message) { |
|
71 | + if ($anon_message && is_string($anon_message)) { |
|
72 | + $messages[] = esc_html($anon_message); |
|
73 | 73 | } else { |
74 | 74 | /* translators: %d: Review ID */ |
75 | - $messages[] = sprintf( __( 'Review %d contains personal data but could not be anonymized.', 'geodirectory' ), $review_id ); |
|
75 | + $messages[] = sprintf(__('Review %d contains personal data but could not be anonymized.', 'geodirectory'), $review_id); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $items_retained = true; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | 'id' => $review_id, |
85 | 85 | ); |
86 | 86 | |
87 | - $updated = $wpdb->update( GEODIR_REVIEW_TABLE, $anonymized_review, $args ); |
|
87 | + $updated = $wpdb->update(GEODIR_REVIEW_TABLE, $anonymized_review, $args); |
|
88 | 88 | |
89 | - if ( $updated ) { |
|
89 | + if ($updated) { |
|
90 | 90 | $items_removed = true; |
91 | 91 | } else { |
92 | 92 | $items_retained = true; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - $done = count( $reviews ) < $number; |
|
96 | + $done = count($reviews) < $number; |
|
97 | 97 | |
98 | 98 | return array( |
99 | 99 | 'items_removed' => $items_removed, |
@@ -103,28 +103,28 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) { |
|
106 | + public static function reviews_by_author($email_address, $page, $posts_per_page = 10) { |
|
107 | 107 | global $wpdb; |
108 | 108 | |
109 | - if ( empty( $email_address ) || empty( $page ) ) { |
|
109 | + if (empty($email_address) || empty($page)) { |
|
110 | 110 | return array(); |
111 | 111 | } |
112 | 112 | |
113 | - $user = get_user_by( 'email', $email_address ); |
|
114 | - if ( empty( $user ) ) { |
|
113 | + $user = get_user_by('email', $email_address); |
|
114 | + if (empty($user)) { |
|
115 | 115 | return array(); |
116 | 116 | } |
117 | 117 | |
118 | - if ( absint( $page ) < 1 ) { |
|
118 | + if (absint($page) < 1) { |
|
119 | 119 | $page = 1; |
120 | 120 | } |
121 | 121 | |
122 | - $limit = absint( ( $page - 1 ) * $posts_per_page ) . ", " . $posts_per_page; |
|
122 | + $limit = absint(($page - 1) * $posts_per_page).", ".$posts_per_page; |
|
123 | 123 | |
124 | - $query = $wpdb->prepare( "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d ORDER BY comment_id ASC LIMIT " . $limit, array( $user->ID ) ); |
|
124 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d ORDER BY comment_id ASC LIMIT ".$limit, array($user->ID)); |
|
125 | 125 | |
126 | - $reviews = $wpdb->get_results( $query ); |
|
126 | + $reviews = $wpdb->get_results($query); |
|
127 | 127 | |
128 | - return apply_filters( 'geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page ); |
|
128 | + return apply_filters('geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page); |
|
129 | 129 | } |
130 | 130 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy Class. |
@@ -24,40 +24,40 @@ discard block |
||
24 | 24 | * Init - hook into events. |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - parent::__construct( __( 'GeoDirectory', 'geodirectory' ) ); |
|
27 | + parent::__construct(__('GeoDirectory', 'geodirectory')); |
|
28 | 28 | |
29 | - if ( ! self::$background_process ) { |
|
29 | + if (!self::$background_process) { |
|
30 | 30 | self::$background_process = new GeoDir_Privacy_Background_Process(); |
31 | 31 | } |
32 | 32 | |
33 | 33 | // Include supporting classes. |
34 | - include_once( 'class-geodir-privacy-erasers.php' ); |
|
35 | - include_once( 'class-geodir-privacy-exporters.php' ); |
|
34 | + include_once('class-geodir-privacy-erasers.php'); |
|
35 | + include_once('class-geodir-privacy-exporters.php'); |
|
36 | 36 | |
37 | - $gd_post_types = geodir_get_posttypes( 'object' ); |
|
37 | + $gd_post_types = geodir_get_posttypes('object'); |
|
38 | 38 | |
39 | - if ( ! empty( $gd_post_types ) ) { |
|
40 | - foreach ( $gd_post_types as $post_type => $info ) { |
|
39 | + if (!empty($gd_post_types)) { |
|
40 | + foreach ($gd_post_types as $post_type => $info) { |
|
41 | 41 | $name = $info->labels->name; |
42 | 42 | |
43 | - if ( self::allow_export_post_type_data( $post_type ) ) { |
|
43 | + if (self::allow_export_post_type_data($post_type)) { |
|
44 | 44 | // This hook registers GeoDirectory data exporters. |
45 | - $this->add_exporter( 'geodirectory-post-' . $post_type, wp_sprintf( __( 'User %s', 'geodirectory' ), $name ), array( 'GeoDir_Privacy_Exporters', 'post_data_exporter' ) ); |
|
45 | + $this->add_exporter('geodirectory-post-'.$post_type, wp_sprintf(__('User %s', 'geodirectory'), $name), array('GeoDir_Privacy_Exporters', 'post_data_exporter')); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | 50 | // Handles custom anonomization types not included in core. |
51 | - add_filter( 'wp_privacy_anonymize_data', array( $this, 'anonymize_custom_data_types' ), 10, 3 ); |
|
51 | + add_filter('wp_privacy_anonymize_data', array($this, 'anonymize_custom_data_types'), 10, 3); |
|
52 | 52 | |
53 | - if ( self::allow_export_reviews_data() ) { |
|
53 | + if (self::allow_export_reviews_data()) { |
|
54 | 54 | // Review data export |
55 | - add_filter( 'wp_privacy_personal_data_export_page', array( 'GeoDir_Privacy_Exporters', 'review_data_exporter' ), 10, 7 ); |
|
55 | + add_filter('wp_privacy_personal_data_export_page', array('GeoDir_Privacy_Exporters', 'review_data_exporter'), 10, 7); |
|
56 | 56 | } |
57 | 57 | |
58 | - if ( self::allow_erase_reviews_data() ) { |
|
58 | + if (self::allow_erase_reviews_data()) { |
|
59 | 59 | // Review data erase |
60 | - $this->add_eraser( 'geodirectory-post-reviews', __( 'User Listing Reviews', 'geodirectory' ), array( 'GeoDir_Privacy_Erasers', 'review_data_eraser' ) ); |
|
60 | + $this->add_eraser('geodirectory-post-reviews', __('User Listing Reviews', 'geodirectory'), array('GeoDir_Privacy_Erasers', 'review_data_eraser')); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -75,89 +75,89 @@ discard block |
||
75 | 75 | $content .= |
76 | 76 | '<div class="geodir-privacy-text">'; |
77 | 77 | $content .= |
78 | - '<h2>' . __( 'Who we are' ) . '</h2>'; |
|
78 | + '<h2>'.__('Who we are').'</h2>'; |
|
79 | 79 | $content .= |
80 | - '<p>' . __( 'GeoDirectory is the only WordPress directory plugin on the market that can scale to millions of listings and withstand the battering of traffic that comes along with that.' ) . '</p>'; |
|
80 | + '<p>'.__('GeoDirectory is the only WordPress directory plugin on the market that can scale to millions of listings and withstand the battering of traffic that comes along with that.').'</p>'; |
|
81 | 81 | |
82 | - '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>'; |
|
82 | + '<h2>'.__('What personal data we collect and why we collect it').'</h2>'; |
|
83 | 83 | $content .= |
84 | - '<p>' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '</p>' . |
|
85 | - '<p>' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '</p>' . |
|
86 | - '<p>' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '</p>' . |
|
87 | - '<p>' . __( 'Personal data is not just created by a user’s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '</p>' . |
|
88 | - '<p>' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '</p>'; |
|
84 | + '<p>'.__('In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.').'</p>'. |
|
85 | + '<p>'.__('You should also note any collection and retention of sensitive personal data, such as data concerning health.').'</p>'. |
|
86 | + '<p>'.__('In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.').'</p>'. |
|
87 | + '<p>'.__('Personal data is not just created by a user’s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.').'</p>'. |
|
88 | + '<p>'.__('By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.').'</p>'; |
|
89 | 89 | |
90 | 90 | $content .= |
91 | - '<h3>' . __( 'Posts' ) . '</h3>'; |
|
91 | + '<h3>'.__('Posts').'</h3>'; |
|
92 | 92 | $content .= |
93 | - '<p>' . __( 'In this subsection you should note what information is captured through posts. We have noted the data which WordPress collects by default.' ) . '</p>' . |
|
94 | - '<p>' . __( 'When users add posts on the site we collect the data shown in the posts form, and also the visitor’s IP address and browser user agent string to help spam detection.' ) . '</p>' . |
|
95 | - '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your post, your profile picture is visible to the public in the context of your post.' ) . '</p>'; |
|
93 | + '<p>'.__('In this subsection you should note what information is captured through posts. We have noted the data which WordPress collects by default.').'</p>'. |
|
94 | + '<p>'.__('When users add posts on the site we collect the data shown in the posts form, and also the visitor’s IP address and browser user agent string to help spam detection.').'</p>'. |
|
95 | + '<p>'.__('An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your post, your profile picture is visible to the public in the context of your post.').'</p>'; |
|
96 | 96 | |
97 | 97 | $content .= |
98 | - '<h3>' . __( 'Reviews' ) . '</h3>'; |
|
98 | + '<h3>'.__('Reviews').'</h3>'; |
|
99 | 99 | $content .= |
100 | - '<p>' . __( 'In this subsection you should note what information is captured through reviews. We have noted the data which WordPress collects by default.' ) . '</p>' . |
|
101 | - '<p>' . __( 'When visitors leave reviews on the site we collect the data shown in the reviews form, and also the visitor’s IP address and browser user agent string to help spam detection.' ) . '</p>' . |
|
102 | - '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your review, your profile picture is visible to the public in the context of your review.' ) . '</p>'; |
|
100 | + '<p>'.__('In this subsection you should note what information is captured through reviews. We have noted the data which WordPress collects by default.').'</p>'. |
|
101 | + '<p>'.__('When visitors leave reviews on the site we collect the data shown in the reviews form, and also the visitor’s IP address and browser user agent string to help spam detection.').'</p>'. |
|
102 | + '<p>'.__('An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your review, your profile picture is visible to the public in the context of your review.').'</p>'; |
|
103 | 103 | |
104 | 104 | $content .= |
105 | - '<h3>' . __( 'Media' ) . '</h3>'; |
|
105 | + '<h3>'.__('Media').'</h3>'; |
|
106 | 106 | $content .= |
107 | - '<p>' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>' . |
|
108 | - '<p>' . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>'; |
|
107 | + '<p>'.__('In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.').'</p>'. |
|
108 | + '<p>'.__('If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.').'</p>'; |
|
109 | 109 | |
110 | 110 | $content .= |
111 | - '<h2>' . __( 'How long we retain your data' ) . '</h2>'; |
|
111 | + '<h2>'.__('How long we retain your data').'</h2>'; |
|
112 | 112 | $content .= |
113 | - '<p>' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '</p>' . |
|
114 | - '<p>' . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>' . |
|
115 | - '<p>' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>' . |
|
113 | + '<p>'.__('In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.').'</p>'. |
|
114 | + '<p>'.__('If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.').'</p>'. |
|
115 | + '<p>'.__('For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.').'</p>'. |
|
116 | 116 | |
117 | - '<h2>' . __( 'What rights you have over your data' ) . '</h2>'; |
|
117 | + '<h2>'.__('What rights you have over your data').'</h2>'; |
|
118 | 118 | $content .= |
119 | - '<p>' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '</p>' . |
|
120 | - '<p>' . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>'; |
|
119 | + '<p>'.__('In this section you should explain what rights your users have over their data and how they can invoke those rights.').'</p>'. |
|
120 | + '<p>'.__('If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.').'</p>'; |
|
121 | 121 | |
122 | 122 | $content .= |
123 | - '<h2>' . __( 'Where we send your data' ) . '</h2>'; |
|
123 | + '<h2>'.__('Where we send your data').'</h2>'; |
|
124 | 124 | $content .= |
125 | - '<p>' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '</p>' . |
|
126 | - '<p>' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '</p>' . |
|
127 | - '<p>' . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>'; |
|
125 | + '<p>'.__('In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.').'</p>'. |
|
126 | + '<p>'.__('European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.').'</p>'. |
|
127 | + '<p>'.__('Visitor comments may be checked through an automated spam detection service.').'</p>'; |
|
128 | 128 | |
129 | 129 | $content .= |
130 | - '<h2>' . __( 'Additional information' ) . '</h2>'; |
|
130 | + '<h2>'.__('Additional information').'</h2>'; |
|
131 | 131 | $content .= |
132 | - '<p>' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '</p>'; |
|
132 | + '<p>'.__('If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.').'</p>'; |
|
133 | 133 | |
134 | 134 | $content .= |
135 | - '<h3>' . __( 'How we protect your data' ) . '</h3>'; |
|
135 | + '<h3>'.__('How we protect your data').'</h3>'; |
|
136 | 136 | $content .= |
137 | - '<p>' . __( 'In this section you should explain what measures you have taken to protect your users’ data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '</p>'; |
|
137 | + '<p>'.__('In this section you should explain what measures you have taken to protect your users’ data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.').'</p>'; |
|
138 | 138 | |
139 | 139 | $content .= |
140 | - '<h3>' . __( 'What data breach procedures we have in place' ) . '</h3>'; |
|
140 | + '<h3>'.__('What data breach procedures we have in place').'</h3>'; |
|
141 | 141 | $content .= |
142 | - '<p>' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '</p>'; |
|
142 | + '<p>'.__('In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.').'</p>'; |
|
143 | 143 | |
144 | 144 | $content .= |
145 | - '<h3>' . __( 'What third parties we receive data from' ) . '</h3>'; |
|
145 | + '<h3>'.__('What third parties we receive data from').'</h3>'; |
|
146 | 146 | $content .= |
147 | - '<p>' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '</p>'; |
|
147 | + '<p>'.__('If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.').'</p>'; |
|
148 | 148 | |
149 | 149 | $content .= |
150 | - '<h3>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h3>'; |
|
150 | + '<h3>'.__('What automated decision making and/or profiling we do with user data').'</h3>'; |
|
151 | 151 | $content .= |
152 | - '<p>' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '</p>'; |
|
152 | + '<p>'.__('If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.').'</p>'; |
|
153 | 153 | |
154 | 154 | $content .= |
155 | - '<h3>' . __( 'Industry regulatory disclosure requirements' ) . '</h3>'; |
|
155 | + '<h3>'.__('Industry regulatory disclosure requirements').'</h3>'; |
|
156 | 156 | $content .= |
157 | - '<p>' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '</p>' . |
|
157 | + '<p>'.__('If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.').'</p>'. |
|
158 | 158 | '</div>'; |
159 | 159 | |
160 | - return apply_filters( 'geodir_privacy_policy_content', $content ); |
|
160 | + return apply_filters('geodir_privacy_policy_content', $content); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | * @param string $data The data being anonymized. |
169 | 169 | * @return string Anonymized string. |
170 | 170 | */ |
171 | - public function anonymize_custom_data_types( $anonymous, $type, $data ) { |
|
172 | - switch ( $type ) { |
|
171 | + public function anonymize_custom_data_types($anonymous, $type, $data) { |
|
172 | + switch ($type) { |
|
173 | 173 | case 'phone': |
174 | - $anonymous = preg_replace( '/\d/u', '0', $data ); |
|
174 | + $anonymous = preg_replace('/\d/u', '0', $data); |
|
175 | 175 | break; |
176 | 176 | case 'numeric_id': |
177 | 177 | $anonymous = 0; |
@@ -184,46 +184,46 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | public static function personal_data_exporter_key() { |
187 | - if ( ! wp_doing_ajax() ) { |
|
187 | + if (!wp_doing_ajax()) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
191 | - if ( empty( $_POST['id'] ) ) { |
|
191 | + if (empty($_POST['id'])) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | $request_id = (int) $_POST['id']; |
195 | 195 | |
196 | - if ( $request_id < 1 ) { |
|
196 | + if ($request_id < 1) { |
|
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | - if ( ! current_user_can( 'export_others_personal_data' ) ) { |
|
200 | + if (!current_user_can('export_others_personal_data')) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
204 | 204 | // Get the request data. |
205 | - $request = wp_get_user_request_data( $request_id ); |
|
205 | + $request = wp_get_user_request_data($request_id); |
|
206 | 206 | |
207 | - if ( ! $request || 'export_personal_data' !== $request->action_name ) { |
|
207 | + if (!$request || 'export_personal_data' !== $request->action_name) { |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 | |
211 | 211 | $email_address = $request->email; |
212 | - if ( ! is_email( $email_address ) ) { |
|
212 | + if (!is_email($email_address)) { |
|
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | |
216 | - if ( ! isset( $_POST['exporter'] ) ) { |
|
216 | + if (!isset($_POST['exporter'])) { |
|
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | $exporter_index = (int) $_POST['exporter']; |
220 | 220 | |
221 | - if ( ! isset( $_POST['page'] ) ) { |
|
221 | + if (!isset($_POST['page'])) { |
|
222 | 222 | return false; |
223 | 223 | } |
224 | 224 | $page = (int) $_POST['page']; |
225 | 225 | |
226 | - $send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false; |
|
226 | + $send_as_email = isset($_POST['sendAsEmail']) ? ('true' === $_POST['sendAsEmail']) : false; |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Filters the array of exporter callbacks. |
@@ -244,37 +244,37 @@ discard block |
||
244 | 244 | * } |
245 | 245 | * } |
246 | 246 | */ |
247 | - $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); |
|
247 | + $exporters = apply_filters('wp_privacy_personal_data_exporters', array()); |
|
248 | 248 | |
249 | - if ( ! is_array( $exporters ) ) { |
|
249 | + if (!is_array($exporters)) { |
|
250 | 250 | return false; |
251 | 251 | } |
252 | 252 | |
253 | 253 | // Do we have any registered exporters? |
254 | - if ( 0 < count( $exporters ) ) { |
|
255 | - if ( $exporter_index < 1 ) { |
|
254 | + if (0 < count($exporters)) { |
|
255 | + if ($exporter_index < 1) { |
|
256 | 256 | return false; |
257 | 257 | } |
258 | 258 | |
259 | - if ( $exporter_index > count( $exporters ) ) { |
|
259 | + if ($exporter_index > count($exporters)) { |
|
260 | 260 | return false; |
261 | 261 | } |
262 | 262 | |
263 | - if ( $page < 1 ) { |
|
263 | + if ($page < 1) { |
|
264 | 264 | return false; |
265 | 265 | } |
266 | 266 | |
267 | - $exporter_keys = array_keys( $exporters ); |
|
268 | - $exporter_key = $exporter_keys[ $exporter_index - 1 ]; |
|
269 | - $exporter = $exporters[ $exporter_key ]; |
|
267 | + $exporter_keys = array_keys($exporters); |
|
268 | + $exporter_key = $exporter_keys[$exporter_index - 1]; |
|
269 | + $exporter = $exporters[$exporter_key]; |
|
270 | 270 | |
271 | - if ( ! is_array( $exporter ) || empty( $exporter_key ) ) { |
|
271 | + if (!is_array($exporter) || empty($exporter_key)) { |
|
272 | 272 | return false; |
273 | 273 | } |
274 | - if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) { |
|
274 | + if (!array_key_exists('exporter_friendly_name', $exporter)) { |
|
275 | 275 | return false; |
276 | 276 | } |
277 | - if ( ! array_key_exists( 'callback', $exporter ) ) { |
|
277 | + if (!array_key_exists('callback', $exporter)) { |
|
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param int $request_id The privacy request post ID associated with this request. |
293 | 293 | * @param bool $send_as_email Whether the final results of the export should be emailed to the user. |
294 | 294 | */ |
295 | - $exporter_key = apply_filters( 'geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email ); |
|
295 | + $exporter_key = apply_filters('geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email); |
|
296 | 296 | |
297 | 297 | return $exporter_key; |
298 | 298 | } |
@@ -300,39 +300,39 @@ discard block |
||
300 | 300 | public static function exporter_post_type() { |
301 | 301 | $exporter_key = self::personal_data_exporter_key(); |
302 | 302 | |
303 | - if ( empty( $exporter_key ) ) { |
|
303 | + if (empty($exporter_key)) { |
|
304 | 304 | return false; |
305 | 305 | } |
306 | 306 | |
307 | - if ( strpos( $exporter_key, 'geodirectory-post-' ) !== 0 ) { |
|
307 | + if (strpos($exporter_key, 'geodirectory-post-') !== 0) { |
|
308 | 308 | return false; |
309 | 309 | } |
310 | 310 | |
311 | - $post_type = str_replace( 'geodirectory-post-', '', $exporter_key ); |
|
311 | + $post_type = str_replace('geodirectory-post-', '', $exporter_key); |
|
312 | 312 | |
313 | - if ( $post_type != '' && in_array( $post_type, geodir_get_posttypes() ) ) { |
|
313 | + if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) { |
|
314 | 314 | return $post_type; |
315 | 315 | } |
316 | 316 | |
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | |
320 | - public static function allow_export_post_type_data( $post_type ) { |
|
320 | + public static function allow_export_post_type_data($post_type) { |
|
321 | 321 | $allow = true; |
322 | 322 | |
323 | - return apply_filters( 'geodir_privacy_allow_export_post_type_data', $allow, $post_type ); |
|
323 | + return apply_filters('geodir_privacy_allow_export_post_type_data', $allow, $post_type); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | public static function allow_export_reviews_data() { |
327 | 327 | $allow = true; |
328 | 328 | |
329 | - return apply_filters( 'geodir_privacy_allow_export_reviews_data', $allow ); |
|
329 | + return apply_filters('geodir_privacy_allow_export_reviews_data', $allow); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | public static function allow_erase_reviews_data() { |
333 | 333 | $allow = true; |
334 | 334 | |
335 | - return apply_filters( 'geodir_privacy_allow_erase_reviews_data', $allow ); |
|
335 | + return apply_filters('geodir_privacy_allow_erase_reviews_data', $allow); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 |
@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | * @since 1.2.26 |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | -if ( ! class_exists( 'GeoDir_Background_Process', false ) ) { |
|
12 | - include_once( 'class-geodir-background-process.php' ); |
|
11 | +if (!class_exists('GeoDir_Background_Process', false)) { |
|
12 | + include_once('class-geodir-background-process.php'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | 24 | // Uses unique prefix per blog so each blog has separate queue. |
25 | - $this->prefix = 'wp_' . get_current_blog_id(); |
|
25 | + $this->prefix = 'wp_'.get_current_blog_id(); |
|
26 | 26 | $this->action = 'geodir_privacy_cleanup'; |
27 | 27 | parent::__construct(); |
28 | 28 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param string $item Queue item to iterate over. |
34 | 34 | * @return bool |
35 | 35 | */ |
36 | - protected function task( $item ) { |
|
37 | - if ( ! $item || empty( $item['task'] ) ) { |
|
36 | + protected function task($item) { |
|
37 | + if (!$item || empty($item['task'])) { |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Exporters Class. |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | * @param int $page Page. |
24 | 24 | * @return array An array of personal data in name value pairs |
25 | 25 | */ |
26 | - public static function post_data_exporter( $email_address, $page ) { |
|
27 | - $post_type = GeoDir_Privacy::exporter_post_type(); |
|
26 | + public static function post_data_exporter($email_address, $page) { |
|
27 | + $post_type = GeoDir_Privacy::exporter_post_type(); |
|
28 | 28 | |
29 | 29 | $done = false; |
30 | 30 | $page = (int) $page; |
31 | 31 | $data_to_export = array(); |
32 | 32 | |
33 | - $posts = self::posts_by_author( $email_address, $post_type, $page ); |
|
33 | + $posts = self::posts_by_author($email_address, $post_type, $page); |
|
34 | 34 | |
35 | - if ( 0 < count( $posts ) ) { |
|
36 | - $obj_post_type = get_post_type_object( $post_type ); |
|
35 | + if (0 < count($posts)) { |
|
36 | + $obj_post_type = get_post_type_object($post_type); |
|
37 | 37 | |
38 | - foreach ( $posts as $post_ID ) { |
|
39 | - $gd_post = geodir_get_post_info( $post_ID ); |
|
40 | - if ( empty( $gd_post ) ) { |
|
38 | + foreach ($posts as $post_ID) { |
|
39 | + $gd_post = geodir_get_post_info($post_ID); |
|
40 | + if (empty($gd_post)) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $data_to_export[] = array( |
45 | - 'group_id' => 'geodirectory-post-' . $post_type, |
|
46 | - 'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ), |
|
47 | - 'item_id' => 'post-' . $post_ID, |
|
48 | - 'data' => self::get_post_personal_data( $gd_post ), |
|
45 | + 'group_id' => 'geodirectory-post-'.$post_type, |
|
46 | + 'group_label' => __($obj_post_type->labels->name, 'geodirectory'), |
|
47 | + 'item_id' => 'post-'.$post_ID, |
|
48 | + 'data' => self::get_post_personal_data($gd_post), |
|
49 | 49 | ); |
50 | 50 | } |
51 | - $done = 10 > count( $posts ); |
|
51 | + $done = 10 > count($posts); |
|
52 | 52 | } else { |
53 | 53 | $done = true; |
54 | 54 | } |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | * @param WP_Post $gd_post The post object. |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - protected static function get_post_personal_data( $gd_post ) { |
|
69 | + protected static function get_post_personal_data($gd_post) { |
|
70 | 70 | $post_categories = array(); |
71 | 71 | $post_tags = array(); |
72 | 72 | $default_category = ''; |
73 | 73 | |
74 | - $cat_taxonomy = $gd_post->post_type . 'category'; |
|
75 | - $tag_taxonomy = $gd_post->post_type . '_tags'; |
|
74 | + $cat_taxonomy = $gd_post->post_type.'category'; |
|
75 | + $tag_taxonomy = $gd_post->post_type.'_tags'; |
|
76 | 76 | |
77 | - $post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) ); |
|
78 | - if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) { |
|
79 | - foreach ( $post_terms as $term ) { |
|
80 | - if ( $term->taxonomy == $cat_taxonomy ) { |
|
77 | + $post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy)); |
|
78 | + if (!empty($post_terms) && !is_wp_error($post_terms)) { |
|
79 | + foreach ($post_terms as $term) { |
|
80 | + if ($term->taxonomy == $cat_taxonomy) { |
|
81 | 81 | $post_categories[] = $term->name; |
82 | 82 | } else { |
83 | 83 | $post_tags[] = $term->name; |
84 | 84 | } |
85 | 85 | |
86 | - if ( $gd_post->default_category == $term->term_id ) { |
|
86 | + if ($gd_post->default_category == $term->term_id) { |
|
87 | 87 | $default_category = $term->name; |
88 | 88 | } |
89 | 89 | } |
@@ -91,167 +91,167 @@ discard block |
||
91 | 91 | |
92 | 92 | $personal_data = array(); |
93 | 93 | $personal_data[] = array( |
94 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
94 | + 'name' => __('Post ID', 'geodirectory'), |
|
95 | 95 | 'value' => $gd_post->ID, |
96 | 96 | ); |
97 | 97 | $personal_data[] = array( |
98 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
98 | + 'name' => __('Post Title', 'geodirectory'), |
|
99 | 99 | 'value' => $gd_post->post_title, |
100 | 100 | ); |
101 | 101 | $personal_data[] = array( |
102 | - 'name' => __( 'Post Date', 'geodirectory' ), |
|
102 | + 'name' => __('Post Date', 'geodirectory'), |
|
103 | 103 | 'value' => $gd_post->post_date, |
104 | 104 | ); |
105 | 105 | $personal_data[] = array( |
106 | - 'name' => __( 'Post Status', 'geodirectory' ), |
|
106 | + 'name' => __('Post Status', 'geodirectory'), |
|
107 | 107 | 'value' => $gd_post->post_status, |
108 | 108 | ); |
109 | 109 | $personal_data[] = array( |
110 | - 'name' => __( 'Post Categories', 'geodirectory' ), |
|
111 | - 'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ), |
|
110 | + 'name' => __('Post Categories', 'geodirectory'), |
|
111 | + 'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''), |
|
112 | 112 | ); |
113 | - if ( $default_category ) { |
|
113 | + if ($default_category) { |
|
114 | 114 | $personal_data[] = array( |
115 | - 'name' => __( 'Default Category', 'geodirectory' ), |
|
115 | + 'name' => __('Default Category', 'geodirectory'), |
|
116 | 116 | 'value' => $default_category, |
117 | 117 | ); |
118 | 118 | } |
119 | - if ( ! empty( $post_tags ) ) { |
|
119 | + if (!empty($post_tags)) { |
|
120 | 120 | $personal_data[] = array( |
121 | - 'name' => __( 'Post Tags', 'geodirectory' ), |
|
122 | - 'value' => implode( ', ', $post_tags ), |
|
121 | + 'name' => __('Post Tags', 'geodirectory'), |
|
122 | + 'value' => implode(', ', $post_tags), |
|
123 | 123 | ); |
124 | 124 | } |
125 | 125 | $personal_data[] = array( |
126 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
127 | - 'value' => get_permalink( $gd_post->ID ), |
|
126 | + 'name' => __('Post URL', 'geodirectory'), |
|
127 | + 'value' => get_permalink($gd_post->ID), |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | // Post Images |
131 | - $post_images = geodir_get_images( $gd_post->ID ); |
|
132 | - if ( ! empty( $post_images ) ) { |
|
131 | + $post_images = geodir_get_images($gd_post->ID); |
|
132 | + if (!empty($post_images)) { |
|
133 | 133 | $images = array(); |
134 | - foreach ( $post_images as $key => $post_image ) { |
|
135 | - if ( ! empty( $post_image->src ) ) { |
|
134 | + foreach ($post_images as $key => $post_image) { |
|
135 | + if (!empty($post_image->src)) { |
|
136 | 136 | $images[] = $post_image->src; |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if ( ! empty( $images ) ) { |
|
140 | + if (!empty($images)) { |
|
141 | 141 | $personal_data[] = array( |
142 | - 'name' => __( 'Post Images', 'geodirectory' ), |
|
143 | - 'value' => self::parse_files_value( $images ), |
|
142 | + 'name' => __('Post Images', 'geodirectory'), |
|
143 | + 'value' => self::parse_files_value($images), |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | 148 | // Post Rating |
149 | - $post_rating = geodir_get_post_rating( $gd_post->ID ); |
|
150 | - if ( $post_rating > 0 ) { |
|
151 | - $post_rating = ( is_float( $post_rating) || ( strpos( $post_rating, ".", 1 ) == 1 && strlen( $post_rating ) > 3 ) ) ? number_format( $post_rating, 1, '.', '' ) : $post_rating; |
|
149 | + $post_rating = geodir_get_post_rating($gd_post->ID); |
|
150 | + if ($post_rating > 0) { |
|
151 | + $post_rating = (is_float($post_rating) || (strpos($post_rating, ".", 1) == 1 && strlen($post_rating) > 3)) ? number_format($post_rating, 1, '.', '') : $post_rating; |
|
152 | 152 | $personal_data[] = array( |
153 | - 'name' => __( 'Post Rating', 'geodirectory' ), |
|
154 | - 'value' => $post_rating . ' / 5', |
|
153 | + 'name' => __('Post Rating', 'geodirectory'), |
|
154 | + 'value' => $post_rating.' / 5', |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Post Reviews |
159 | - $post_reviews = geodir_get_review_count_total( $gd_post->ID ); |
|
160 | - if ( $post_reviews > 0 ) { |
|
159 | + $post_reviews = geodir_get_review_count_total($gd_post->ID); |
|
160 | + if ($post_reviews > 0) { |
|
161 | 161 | $personal_data[] = array( |
162 | - 'name' => __( 'Post Reviews', 'geodirectory' ), |
|
162 | + 'name' => __('Post Reviews', 'geodirectory'), |
|
163 | 163 | 'value' => $post_reviews, |
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
167 | - if ( ! empty( $gd_post->is_featured ) ) { |
|
167 | + if (!empty($gd_post->is_featured)) { |
|
168 | 168 | $personal_data[] = array( |
169 | - 'name' => __( 'Post Featured', 'geodirectory' ), |
|
170 | - 'value' => __( 'Yes', 'geodirectory' ), |
|
169 | + 'name' => __('Post Featured', 'geodirectory'), |
|
170 | + 'value' => __('Yes', 'geodirectory'), |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | - $custom_fields = geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type ); |
|
175 | - $post_fields = array_keys( (array) $gd_post ); |
|
174 | + $custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type); |
|
175 | + $post_fields = array_keys((array) $gd_post); |
|
176 | 176 | |
177 | - foreach ( $custom_fields as $key => $field ) { |
|
178 | - $field_name = ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : ''; |
|
179 | - if ( empty( $field_name ) ) { |
|
177 | + foreach ($custom_fields as $key => $field) { |
|
178 | + $field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : ''; |
|
179 | + if (empty($field_name)) { |
|
180 | 180 | continue; |
181 | 181 | } |
182 | 182 | |
183 | - $field = stripslashes_deep( $field ); |
|
183 | + $field = stripslashes_deep($field); |
|
184 | 184 | |
185 | - $extra_fields = ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array(); |
|
185 | + $extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array(); |
|
186 | 186 | $data_type = $field['data_type']; |
187 | 187 | $field_type = $field['field_type']; |
188 | - $field_title = $field['site_title']; |
|
189 | - if ( $field_name == 'post' ) { |
|
188 | + $field_title = $field['site_title']; |
|
189 | + if ($field_name == 'post') { |
|
190 | 190 | $field_name = 'post_address'; |
191 | 191 | } |
192 | 192 | |
193 | - if ( ! in_array( $field_name, $post_fields ) ) { |
|
193 | + if (!in_array($field_name, $post_fields)) { |
|
194 | 194 | continue; |
195 | 195 | } |
196 | 196 | |
197 | 197 | $name = $field_title; |
198 | 198 | $value = ''; |
199 | - switch ( $field_type ) { |
|
199 | + switch ($field_type) { |
|
200 | 200 | case 'address': |
201 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true; |
|
202 | - if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) { |
|
201 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true; |
|
202 | + if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) { |
|
203 | 203 | $personal_data[] = array( |
204 | - 'name' => __( 'Post Address', 'geodirectory' ), |
|
204 | + 'name' => __('Post Address', 'geodirectory'), |
|
205 | 205 | 'value' => $gd_post->post_address, |
206 | 206 | ); |
207 | 207 | $personal_data[] = array( |
208 | - 'name' => __( 'Post City', 'geodirectory' ), |
|
208 | + 'name' => __('Post City', 'geodirectory'), |
|
209 | 209 | 'value' => $gd_post->post_city, |
210 | 210 | ); |
211 | 211 | $personal_data[] = array( |
212 | - 'name' => __( 'Post Region', 'geodirectory' ), |
|
212 | + 'name' => __('Post Region', 'geodirectory'), |
|
213 | 213 | 'value' => $gd_post->post_region, |
214 | 214 | ); |
215 | 215 | $personal_data[] = array( |
216 | - 'name' => __( 'Post Country', 'geodirectory' ), |
|
216 | + 'name' => __('Post Country', 'geodirectory'), |
|
217 | 217 | 'value' => $gd_post->post_country, |
218 | 218 | ); |
219 | 219 | $personal_data[] = array( |
220 | - 'name' => __( 'Post Zip', 'geodirectory' ), |
|
220 | + 'name' => __('Post Zip', 'geodirectory'), |
|
221 | 221 | 'value' => $gd_post->post_zip, |
222 | 222 | ); |
223 | 223 | $personal_data[] = array( |
224 | - 'name' => __( 'Post Latitude', 'geodirectory' ), |
|
224 | + 'name' => __('Post Latitude', 'geodirectory'), |
|
225 | 225 | 'value' => $gd_post->post_latitude, |
226 | 226 | ); |
227 | 227 | $personal_data[] = array( |
228 | - 'name' => __( 'Post Longitude', 'geodirectory' ), |
|
228 | + 'name' => __('Post Longitude', 'geodirectory'), |
|
229 | 229 | 'value' => $gd_post->post_longitude, |
230 | 230 | ); |
231 | 231 | } |
232 | 232 | break; |
233 | 233 | case 'checkbox': |
234 | - if ( ! empty( $gd_post->{$field_name} ) ) { |
|
235 | - $value = __( 'Yes', 'geodirectory' ); |
|
234 | + if (!empty($gd_post->{$field_name} )) { |
|
235 | + $value = __('Yes', 'geodirectory'); |
|
236 | 236 | } else { |
237 | - $value = __( 'No', 'geodirectory' ); |
|
237 | + $value = __('No', 'geodirectory'); |
|
238 | 238 | } |
239 | 239 | break; |
240 | 240 | case 'datepicker': |
241 | 241 | $value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : ''; |
242 | 242 | break; |
243 | 243 | case 'radio': |
244 | - if ( $gd_post->{$field_name} !== '' ) { |
|
245 | - if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
246 | - $value = __( 'No', 'geodirectory' ); |
|
247 | - } else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
248 | - $value = __( 'Yes', 'geodirectory' ); |
|
244 | + if ($gd_post->{$field_name} !== '') { |
|
245 | + if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
246 | + $value = __('No', 'geodirectory'); |
|
247 | + } else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
248 | + $value = __('Yes', 'geodirectory'); |
|
249 | 249 | } else { |
250 | - if ( !empty( $field['option_values'] ) ) { |
|
251 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
252 | - if ( ! empty( $cf_option_values ) ) { |
|
253 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
254 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
250 | + if (!empty($field['option_values'])) { |
|
251 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
252 | + if (!empty($cf_option_values)) { |
|
253 | + foreach ($cf_option_values as $cf_option_value) { |
|
254 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
255 | 255 | $value = $cf_option_value['label']; |
256 | 256 | } |
257 | 257 | } |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | } |
262 | 262 | break; |
263 | 263 | case 'select': |
264 | - $value = __( $gd_post->{$field_name}, 'geodirectory'); |
|
265 | - if ( !empty( $field['option_values'] ) ) { |
|
266 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
267 | - if ( ! empty( $cf_option_values ) ) { |
|
268 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
269 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
264 | + $value = __($gd_post->{$field_name}, 'geodirectory'); |
|
265 | + if (!empty($field['option_values'])) { |
|
266 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
267 | + if (!empty($cf_option_values)) { |
|
268 | + foreach ($cf_option_values as $cf_option_value) { |
|
269 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
270 | 270 | $value = $cf_option_value['label']; |
271 | 271 | } |
272 | 272 | } |
@@ -274,23 +274,23 @@ discard block |
||
274 | 274 | } |
275 | 275 | break; |
276 | 276 | case 'multiselect': |
277 | - $field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) ); |
|
278 | - if ( is_array( $field_values ) ) { |
|
279 | - $field_values = array_map( 'trim', $field_values ); |
|
277 | + $field_values = explode(',', trim($gd_post->{$field_name}, ",")); |
|
278 | + if (is_array($field_values)) { |
|
279 | + $field_values = array_map('trim', $field_values); |
|
280 | 280 | } |
281 | 281 | $values = array(); |
282 | - if ( ! empty( $field['option_values'] ) ) { |
|
283 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
282 | + if (!empty($field['option_values'])) { |
|
283 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
284 | 284 | |
285 | - if ( ! empty( $cf_option_values ) ) { |
|
286 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
287 | - if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) { |
|
285 | + if (!empty($cf_option_values)) { |
|
286 | + foreach ($cf_option_values as $cf_option_value) { |
|
287 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
288 | 288 | $values[] = $cf_option_value['label']; |
289 | 289 | } |
290 | 290 | } |
291 | 291 | } |
292 | 292 | } |
293 | - $value = ! empty( $values ) ? implode( ', ', $values ) : ''; |
|
293 | + $value = !empty($values) ? implode(', ', $values) : ''; |
|
294 | 294 | break; |
295 | 295 | case 'time': |
296 | 296 | $value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : ''; |
@@ -304,46 +304,46 @@ discard block |
||
304 | 304 | $value = $gd_post->{$field_name} ? $gd_post->{$field_name} : ''; |
305 | 305 | break; |
306 | 306 | case 'file': |
307 | - $files = explode( ",", $gd_post->{$field_name} ); |
|
308 | - if ( ! empty( $files ) ) { |
|
309 | - $allowed_file_types = !empty( $extra_fields['gd_file_types'] ) && is_array( $extra_fields['gd_file_types'] ) && !in_array( "*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
307 | + $files = explode(",", $gd_post->{$field_name} ); |
|
308 | + if (!empty($files)) { |
|
309 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : ''; |
|
310 | 310 | |
311 | 311 | $file_urls = array(); |
312 | - foreach ( $files as $file ) { |
|
313 | - if ( ! empty( $file ) ) { |
|
314 | - $image_name_arr = explode( '/', $file ); |
|
315 | - $curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2]; |
|
312 | + foreach ($files as $file) { |
|
313 | + if (!empty($file)) { |
|
314 | + $image_name_arr = explode('/', $file); |
|
315 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
316 | 316 | $filename = end($image_name_arr); |
317 | 317 | $img_name_arr = explode('.', $filename); |
318 | 318 | |
319 | - $arr_file_type = wp_check_filetype( $filename ); |
|
320 | - if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) { |
|
319 | + $arr_file_type = wp_check_filetype($filename); |
|
320 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
321 | 321 | continue; |
322 | 322 | } |
323 | 323 | |
324 | 324 | $uploaded_file_type = $arr_file_type['type']; |
325 | 325 | $uploaded_file_ext = $arr_file_type['ext']; |
326 | 326 | |
327 | - if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) { |
|
327 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
328 | 328 | continue; // Invalid file type. |
329 | 329 | } |
330 | - $image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' ); |
|
331 | - $audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' ); |
|
330 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
331 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
332 | 332 | |
333 | 333 | // If the uploaded file is image |
334 | - if ( in_array( $uploaded_file_type, $image_file_types ) ) { |
|
334 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
335 | 335 | $file_urls[] = $file; |
336 | 336 | } |
337 | 337 | } |
338 | 338 | } |
339 | - $value = ! empty( $file_urls ) ? self::parse_files_value( $file_urls ) : ''; |
|
339 | + $value = !empty($file_urls) ? self::parse_files_value($file_urls) : ''; |
|
340 | 340 | } |
341 | 341 | break; |
342 | 342 | } |
343 | 343 | |
344 | - if ( ! empty( $name ) && $value !== '' ) { |
|
344 | + if (!empty($name) && $value !== '') { |
|
345 | 345 | $personal_data[] = array( |
346 | - 'name' => __( $name, 'geodirectory' ), |
|
346 | + 'name' => __($name, 'geodirectory'), |
|
347 | 347 | 'value' => $value, |
348 | 348 | ); |
349 | 349 | } |
@@ -356,28 +356,28 @@ discard block |
||
356 | 356 | * @param array $personal_data Array of name value pairs to expose in the export. |
357 | 357 | * @param WP_Post $gd_post The post object. |
358 | 358 | */ |
359 | - $personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post ); |
|
359 | + $personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post); |
|
360 | 360 | |
361 | 361 | return $personal_data; |
362 | 362 | } |
363 | 363 | |
364 | - public static function posts_by_author( $email_address, $post_type, $page ) { |
|
365 | - if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
|
364 | + public static function posts_by_author($email_address, $post_type, $page) { |
|
365 | + if (empty($email_address) || empty($post_type) || empty($page)) { |
|
366 | 366 | return array(); |
367 | 367 | } |
368 | 368 | |
369 | - $user = get_user_by( 'email', $email_address ); |
|
370 | - if ( empty( $user ) ) { |
|
369 | + $user = get_user_by('email', $email_address); |
|
370 | + if (empty($user)) { |
|
371 | 371 | return array(); |
372 | 372 | } |
373 | 373 | |
374 | - $statuses = array_keys( get_post_statuses() ); |
|
374 | + $statuses = array_keys(get_post_statuses()); |
|
375 | 375 | $skip_statuses = geodir_imex_export_skip_statuses(); |
376 | - if ( ! empty( $skip_statuses ) ) { |
|
377 | - $statuses = array_diff( $statuses, $skip_statuses ); |
|
376 | + if (!empty($skip_statuses)) { |
|
377 | + $statuses = array_diff($statuses, $skip_statuses); |
|
378 | 378 | } |
379 | 379 | |
380 | - $query_args = array( |
|
380 | + $query_args = array( |
|
381 | 381 | 'post_type' => $post_type, |
382 | 382 | 'post_status' => $statuses, |
383 | 383 | 'fields' => 'ids', |
@@ -388,85 +388,85 @@ discard block |
||
388 | 388 | 'order' => 'ASC' |
389 | 389 | ); |
390 | 390 | |
391 | - $query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page ); |
|
391 | + $query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page); |
|
392 | 392 | |
393 | - $posts = get_posts( $query_args ); |
|
393 | + $posts = get_posts($query_args); |
|
394 | 394 | |
395 | - return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page ); |
|
395 | + return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page); |
|
396 | 396 | } |
397 | 397 | |
398 | - public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { |
|
398 | + public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) { |
|
399 | 399 | global $wpdb; |
400 | 400 | |
401 | 401 | $exporter_key = GeoDir_Privacy::personal_data_exporter_key(); |
402 | 402 | |
403 | - if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) { |
|
404 | - foreach ( $response['data'] as $key => $data ) { |
|
405 | - $comment_id = str_replace( 'comment-', '', $data['item_id'] ); |
|
403 | + if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) { |
|
404 | + foreach ($response['data'] as $key => $data) { |
|
405 | + $comment_id = str_replace('comment-', '', $data['item_id']); |
|
406 | 406 | |
407 | - $review = geodir_get_review( $comment_id ); |
|
408 | - if ( ! empty( $review ) ) { |
|
409 | - if ( ! empty( $review->overall_rating ) ) { |
|
410 | - $response['data'][ $key ]['data'][] = array( |
|
411 | - 'name' => __( 'Rating (Overall)', 'geodirectory' ), |
|
412 | - 'value' => (float)$review->overall_rating . ' / 5', |
|
407 | + $review = geodir_get_review($comment_id); |
|
408 | + if (!empty($review)) { |
|
409 | + if (!empty($review->overall_rating)) { |
|
410 | + $response['data'][$key]['data'][] = array( |
|
411 | + 'name' => __('Rating (Overall)', 'geodirectory'), |
|
412 | + 'value' => (float) $review->overall_rating.' / 5', |
|
413 | 413 | ); |
414 | 414 | } |
415 | - if ( defined( 'GEODIRREVIEWRATING_VERSION' ) ) { |
|
416 | - if ( get_option( 'geodir_reviewrating_enable_rating' ) ) { |
|
417 | - $ratings = maybe_unserialize( $review->ratings ); |
|
418 | - |
|
419 | - if ( ! empty( $ratings ) && $rating_ids = array_keys( $ratings ) ) { |
|
420 | - $styles = $wpdb->get_results( "SELECT rc.id, rc.title, rs.star_number AS total FROM `" . GEODIR_REVIEWRATING_CATEGORY_TABLE . "` AS rc LEFT JOIN `" . GEODIR_REVIEWRATING_STYLE_TABLE . "` AS rs ON rs.id = rc.category_id WHERE rc.id IN(" . implode( ',', $rating_ids ) . ") AND rs.id IS NOT NULL" ); |
|
421 | - |
|
422 | - foreach ( $styles as $style ) { |
|
423 | - if ( ! empty( $ratings[ $style->id ] ) ) { |
|
424 | - $response['data'][ $key ]['data'][] = array( |
|
425 | - 'name' => wp_sprintf( __( 'Rating (%s)', 'geodirectory' ), __( $style->title, 'geodirectory' ) ), |
|
426 | - 'value' => $ratings[ $style->id ] . ' / ' . $style->total, |
|
415 | + if (defined('GEODIRREVIEWRATING_VERSION')) { |
|
416 | + if (get_option('geodir_reviewrating_enable_rating')) { |
|
417 | + $ratings = maybe_unserialize($review->ratings); |
|
418 | + |
|
419 | + if (!empty($ratings) && $rating_ids = array_keys($ratings)) { |
|
420 | + $styles = $wpdb->get_results("SELECT rc.id, rc.title, rs.star_number AS total FROM `".GEODIR_REVIEWRATING_CATEGORY_TABLE."` AS rc LEFT JOIN `".GEODIR_REVIEWRATING_STYLE_TABLE."` AS rs ON rs.id = rc.category_id WHERE rc.id IN(".implode(',', $rating_ids).") AND rs.id IS NOT NULL"); |
|
421 | + |
|
422 | + foreach ($styles as $style) { |
|
423 | + if (!empty($ratings[$style->id])) { |
|
424 | + $response['data'][$key]['data'][] = array( |
|
425 | + 'name' => wp_sprintf(__('Rating (%s)', 'geodirectory'), __($style->title, 'geodirectory')), |
|
426 | + 'value' => $ratings[$style->id].' / '.$style->total, |
|
427 | 427 | ); |
428 | 428 | } |
429 | 429 | } |
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
433 | - if ( get_option( 'geodir_reviewrating_enable_images' ) ) { |
|
434 | - if ( ! empty( $review->comment_images ) ) { |
|
435 | - $comment_images = explode( ',', $review->comment_images ); |
|
436 | - $response['data'][ $key ]['data'][] = array( |
|
437 | - 'name' => __( 'Review Images', 'geodirectory' ), |
|
438 | - 'value' => self::parse_files_value( $comment_images ), |
|
433 | + if (get_option('geodir_reviewrating_enable_images')) { |
|
434 | + if (!empty($review->comment_images)) { |
|
435 | + $comment_images = explode(',', $review->comment_images); |
|
436 | + $response['data'][$key]['data'][] = array( |
|
437 | + 'name' => __('Review Images', 'geodirectory'), |
|
438 | + 'value' => self::parse_files_value($comment_images), |
|
439 | 439 | ); |
440 | 440 | } |
441 | 441 | } |
442 | 442 | } |
443 | - if ( ! empty( $review->post_city ) ) { |
|
444 | - $response['data'][ $key ]['data'][] = array( |
|
445 | - 'name' => __( 'Review City', 'geodirectory' ), |
|
443 | + if (!empty($review->post_city)) { |
|
444 | + $response['data'][$key]['data'][] = array( |
|
445 | + 'name' => __('Review City', 'geodirectory'), |
|
446 | 446 | 'value' => $review->post_city, |
447 | 447 | ); |
448 | 448 | } |
449 | - if ( ! empty( $review->post_region ) ) { |
|
450 | - $response['data'][ $key ]['data'][] = array( |
|
451 | - 'name' => __( 'Review Region', 'geodirectory' ), |
|
449 | + if (!empty($review->post_region)) { |
|
450 | + $response['data'][$key]['data'][] = array( |
|
451 | + 'name' => __('Review Region', 'geodirectory'), |
|
452 | 452 | 'value' => $review->post_region, |
453 | 453 | ); |
454 | 454 | } |
455 | - if ( ! empty( $review->post_country ) ) { |
|
456 | - $response['data'][ $key ]['data'][] = array( |
|
457 | - 'name' => __( 'Review Country', 'geodirectory' ), |
|
455 | + if (!empty($review->post_country)) { |
|
456 | + $response['data'][$key]['data'][] = array( |
|
457 | + 'name' => __('Review Country', 'geodirectory'), |
|
458 | 458 | 'value' => $review->post_country, |
459 | 459 | ); |
460 | 460 | } |
461 | - if ( ! empty( $review->post_latitude ) ) { |
|
462 | - $response['data'][ $key ]['data'][] = array( |
|
463 | - 'name' => __( 'Review Latitude', 'geodirectory' ), |
|
461 | + if (!empty($review->post_latitude)) { |
|
462 | + $response['data'][$key]['data'][] = array( |
|
463 | + 'name' => __('Review Latitude', 'geodirectory'), |
|
464 | 464 | 'value' => $review->post_latitude, |
465 | 465 | ); |
466 | 466 | } |
467 | - if ( ! empty( $review->post_longitude ) ) { |
|
468 | - $response['data'][ $key ]['data'][] = array( |
|
469 | - 'name' => __( 'Review Longitude', 'geodirectory' ), |
|
467 | + if (!empty($review->post_longitude)) { |
|
468 | + $response['data'][$key]['data'][] = array( |
|
469 | + 'name' => __('Review Longitude', 'geodirectory'), |
|
470 | 470 | 'value' => $review->post_longitude, |
471 | 471 | ); |
472 | 472 | } |
@@ -476,27 +476,27 @@ discard block |
||
476 | 476 | return $response; |
477 | 477 | } |
478 | 478 | |
479 | - public static function parse_files_value( $files ) { |
|
480 | - if ( empty( $files ) ) { |
|
479 | + public static function parse_files_value($files) { |
|
480 | + if (empty($files)) { |
|
481 | 481 | return ''; |
482 | 482 | } |
483 | 483 | |
484 | - if ( ! is_array( $files ) ) { |
|
484 | + if (!is_array($files)) { |
|
485 | 485 | return $files; |
486 | 486 | } |
487 | 487 | |
488 | - if ( count( $files ) == 1 ) { |
|
488 | + if (count($files) == 1) { |
|
489 | 489 | return $files[0]; |
490 | 490 | } |
491 | 491 | |
492 | 492 | $links = array(); |
493 | - foreach ( $files as $file ) { |
|
494 | - if ( false === strpos( $file, ' ' ) && ( 0 === strpos( $file, 'http://' ) || 0 === strpos( $file, 'https://' ) ) ) { |
|
495 | - $file = '<a href="' . esc_url( $file ) . '">' . esc_html( $file ) . '</a>'; |
|
493 | + foreach ($files as $file) { |
|
494 | + if (false === strpos($file, ' ') && (0 === strpos($file, 'http://') || 0 === strpos($file, 'https://'))) { |
|
495 | + $file = '<a href="'.esc_url($file).'">'.esc_html($file).'</a>'; |
|
496 | 496 | } |
497 | 497 | $links[] = $file; |
498 | 498 | } |
499 | - $links = ! empty( $links ) ? implode( ' <br> ', $links ) : ''; |
|
499 | + $links = !empty($links) ? implode(' <br> ', $links) : ''; |
|
500 | 500 | |
501 | 501 | return $links; |
502 | 502 | } |