PluginProbe
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback / 3.4
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback v3.4
5.1.3 5.1.2 5.1.1 5.1 5.0 trunk 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.2.0 3.2.1 3.22 3.22.1 3.22.2 3.22.3 3.22.4 3.22.5 3.22.6 All 75 releases
atarim-visual-collaboration / inc / wpf_function.php
wpf_function.php
2,415 lines 141.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * wpf_functions.php
4 * This file contains the helper functions called from across the plugin.
5 */
6
7 /*
8 * This function is used to get the checkbox of task status / priority from the terms on website.
9 *
10 * @input String
11 * @return String
12 */
13 if ( ! function_exists( 'wp_feedback_get_texonomy' ) ) {
14 function wp_feedback_get_texonomy( $my_term ) {
15 $filter_data_db = get_option( 'filter_data' )[$my_term];
16 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
17 echo '<ul class="wp_feedback_filter_checkbox">';
18 foreach ( $filter_data_db as $term ) {
19 if ( $term['label'] == 'In Progress' ) {
20 $term['label'] = 'In Prog';
21 } elseif ( $term['label'] == 'Pending Review' ) {
22 $term['label'] = 'Pending';
23 } else {
24 $term['label'] = $term['label'];
25 }
26 echo '<li><input onclick="wp_feedback_filter()" type="checkbox" name="' . $my_term . '" value="' . $term['value'] . '" class="wp_feedback_task wpf_checkbox" id="' . $term['value'] . '"/><label for="' . $term['value'] . '" class="wpf_checkbox_label">' . __( $term['label'], 'wpfeedback' ) . '</label></li>';
27 }
28 echo '</ul>';
29 }
30 }
31 }
32
33 /*
34 * This function is used to get all the roles allowed to use Atarim features.
35 *
36 * @input NULL
37 * @return String
38 */
39 if ( ! function_exists( 'wp_feedback_get_user_role_list' ) ) {
40 function wp_feedback_get_user_role_list() {
41 $editable_roles = get_editable_roles();
42 return $editable_roles;
43 }
44 }
45 add_shortcode( 'wpf_user_role_list', 'wp_feedback_get_user_role_list' );
46
47 /*
48 * This function is used to get all the users (based on role) which are supposed to get notified. This is called in the Tasks Center for "Filters" section.
49 *
50 * @input NULL
51 * @return String
52 */
53 if ( ! function_exists( 'wp_feedback_get_user_list' ) ) {
54 function wp_feedback_get_user_list() {
55 $get_notif_user_db = get_option( 'notify_users' );
56 $notify_users = isset( $get_notif_user_db ) ? $get_notif_user_db : [];
57
58 if ( is_array( $notify_users ) ) {
59 if ( count( $notify_users ) > 0) {
60 echo '<ul class="wp_feedback_filter_checkbox user">';
61 if ( ! empty( $notify_users ) ) {
62 foreach ( $notify_users as $user ) {
63 $wpfusr = get_user_by( 'login', htmlspecialchars( $user['label'], ENT_QUOTES, 'UTF-8' ) );
64 $wpfusrname = $wpfusr->display_name;
65 echo '<li><input onclick="wp_feedback_filter()" type="checkbox" name="author_list" value="' . $user['value'] . '" class="wp_feedback_task wpf_checkbox" data-wp-username="' . $user['label'] . '" id="user_' . $user['value'] . '" /><label for="user_' . $user['value'] . '" class="wpf_checkbox_label">' . $wpfusrname . '</label></li>';
66 }
67 }
68 echo '</ul>';
69 }
70 }
71 }
72 }
73 add_shortcode( 'wpf_user_list', 'wp_feedback_get_user_list' );
74
75 /*
76 * This function is used to get all the users (based on role) which are supposed to get notified. This is called in the Tasks Center for the "Notify Users" section.
77 *
78 * @input NULL
79 * @return String
80 */
81 if ( ! function_exists( 'wp_feedback_get_user_list_task' ) ) {
82 function wp_feedback_get_user_list_task() {
83 $get_notif_user_db = get_option( 'notify_users' );
84 $notify_users = isset( $get_notif_user_db ) ? $get_notif_user_db : [];
85 if ( is_array( $notify_users ) ) {
86 if ( count( $notify_users ) > 0 ) {
87 echo '<ul class="wp_feedback_filter_checkbox user">';
88 if ( ! empty( $notify_users ) ) {
89 foreach ( $notify_users as $user ) {
90 $wpfusr = get_user_by( 'login', htmlspecialchars( $user['label'], ENT_QUOTES, 'UTF-8' ) );
91 $wpfusr_meta = get_user_meta( $wpfusr->ID );
92 $user_name = $wpfusr->display_name;
93 echo '<li><input type="checkbox" name="author_list_task" value="' . $user['value'] . '" class="wp_feedback_task wpf_checkbox" data-wp-username="' . $user['label'] . '" id="' . $user['value'] . '" onclick="update_notify_user(' . $user['value'] . ')" /><label for="' . $user['value'] . '" class="wpf_checkbox_label">' . $user_name . '</label></li>'; //!push
94 }
95 }
96 echo '</ul>';
97 }
98 }
99 }
100 }
101 add_shortcode( 'wpf_user_list_task', 'wp_feedback_get_user_list_task' );
102
103 /*
104 * This function is used to get all the users (based on role) which are supposed to get notified. This is called in the frontend on the Tasks Popup.
105 *
106 * @input NULL
107 * @return String
108 */
109 if ( ! function_exists( 'wp_feedback_get_user_list_front' ) ) {
110 function wp_feedback_get_user_list_front() {
111 $response = [];
112 $get_notif_user_db = get_option( 'notify_users' );
113 $notify_users = isset( $get_notif_user_db ) ? $get_notif_user_db : [];
114
115 if ( is_array( $notify_users ) ) {
116 if ( count( $notify_users ) > 0 ) {
117 if ( ! empty( $notify_users ) ) {
118 foreach ( $notify_users as $user ) {
119 $userdetails = get_user_by( 'login', htmlspecialchars( $user['label'], ENT_QUOTES, 'UTF-8' ) );
120 $response[$user['value']] = array(
121 "id" => htmlspecialchars( $userdetails->ID, ENT_QUOTES, 'UTF-8' ),
122 "username" => htmlspecialchars( $user['label'], ENT_QUOTES, 'UTF-8' ),
123 "displayname" => htmlspecialchars( $userdetails->display_name, ENT_QUOTES, 'UTF-8' ),
124 "first_name" => htmlspecialchars( $userdetails->first_name, ENT_QUOTES, 'UTF-8' ),
125 "last_name" => htmlspecialchars( $userdetails->last_name, ENT_QUOTES, 'UTF-8' )
126 );
127 }
128 }
129 }
130 }
131 return json_encode( $response );
132 }
133 }
134 add_shortcode( 'wpf_user_list_front', 'wp_feedback_get_user_list_front' );
135
136 /*
137 * This function is used to get emails of the users to be notified.
138 *
139 * @input String
140 * @return JSON
141 */
142 if ( ! function_exists( 'get_notify_users_emails' ) ) {
143 function get_notify_users_emails( $id ) {
144 $send_to_arr = explode( ',', $id );
145 $current_user_id = get_current_user_id();
146 if ( ( $key = array_search( $current_user_id, $send_to_arr ) ) !== false ) {
147 unset( $send_to_arr[$key] );
148 }
149 $nofity_users = array();
150 foreach ( $send_to_arr as $k ) {
151 $user = get_user_by( 'id', $k );
152 $nofity_users[] = $user->user_email;
153 }
154 $response = implode( $nofity_users, "," );
155 return $response;
156 }
157 }
158
159 /*
160 * This function is used to verify if the license on the website is valid or not.
161 *
162 * @input String
163 * @return JSON
164 */
165 if ( ! function_exists( 'wpf_license_key_check_item' ) ) {
166 function wpf_license_key_check_item( $wpf_license_key ) {
167 if( ! get_option( 'wpf_decr_key' ) ) {
168 $wpf_license_key = $wpf_license_key;
169 } else {
170 $wpf_license_key = wpf_crypt_key( $wpf_license_key, 'd' );
171 }
172 $site_url = WPF_SITE_URL;
173 $url = WPF_EDD_SL_STORE_URL . "?edd_action=check_license&item_id=" . WPF_EDD_SL_ITEM_ID . "&license=$wpf_license_key&url=$site_url";
174 $args = array(
175 'timeout' => 20,
176 'sslverify' => false
177 );
178 $output = wp_remote_get( $url, $args );
179 if ( ! is_wp_error( $output ) ) {
180 if ( $output['response']['code'] != 200 ) {
181 $url = WPF_EDD_FALLBACK_URL . "license.php?edd_action=check_license&item_id=" . WPF_EDD_SL_ITEM_ID . "&license=$wpf_license_key&url=$site_url";
182 $output = wp_remote_get( $url, $args );
183 }
184 $outputObject = json_decode( $output['body'] );
185 if ( $outputObject->license == 'valid' ) {
186 if ( isset( $outputObject->wpf_site_id ) ) {
187 update_option( 'wpf_site_id', $outputObject->wpf_site_id );
188 }
189 $response = array( 'license' => $outputObject->license, 'expires' => $outputObject->expires, 'payment_id' => $outputObject->payment_id, 'checksum' => $outputObject->checksum, 'executed' => 1 );
190 do_action( 'wpf_initial_sync', $wpf_license_key );
191 } else {
192 $response = array( 'license' => $outputObject->license, 'expires' => '', 'executed' => 1 );
193 }
194 } else {
195 $response = array( 'license' => 'invalid', 'expires' => '', 'executed' => 1 );
196 }
197 return $response;
198 }
199 }
200
201 /*
202 * This function is used to activate the license on the website.
203 *
204 * @input String
205 * @return JSON
206 */
207 if ( ! function_exists( 'wpf_license_key_license_item' ) ) {
208 function wpf_license_key_license_item( $wpf_license_key ) {
209 $wpf_license_key_in = $wpf_license_key;
210 if ( ! get_option( 'wpf_decr_key' ) ) {
211 $wpf_license_key = $wpf_license_key;
212 } else {
213 $wpf_license_key = wpf_crypt_key( $wpf_license_key, 'd' );
214 if ( $wpf_license_key == '' ) {
215 $wpf_license_key = $wpf_license_key_in;
216 }
217 }
218 $site_url = WPF_SITE_URL;
219 $url = WPF_EDD_SL_STORE_URL . "?edd_action=activate_license&item_id=" . WPF_EDD_SL_ITEM_ID . "&license=$wpf_license_key&url=$site_url";
220 $args = array(
221 'timeout' => 20,
222 'sslverify' => false
223 );
224 $output = wp_remote_get( $url, $args );
225 if ( ! is_wp_error( $output ) ) {
226 if ( $output['response']['code'] != 200 ) {
227 $url = WPF_EDD_FALLBACK_URL . "license.php?edd_action=activate_license&item_id=" . WPF_EDD_SL_ITEM_ID . "&license=$wpf_license_key&url=$site_url";
228 $output = wp_remote_get( $url, $args );
229 }
230 $outputObject = json_decode( $output['body'] );
231 if ( $outputObject->license == 'valid' ) {
232 update_option( 'wpf_site_id', $outputObject->wpf_site_id );
233 $response = array( 'license' => $outputObject->license, 'expires' => $outputObject->expires, 'payment_id' => $outputObject->payment_id, 'checksum' => $outputObject->checksum, 'executed' => 1 );
234 } else {
235 $response = array( 'license' => $outputObject->license, 'expires' => '', 'executed' => 1 );
236 }
237 } else {
238 $response = array( 'license' => 'invalid', 'expires' => '', 'executed' => 1 );
239 }
240 return $response;
241 }
242 }
243
244 /*
245 * This function is used to save the Settings of the plugin when saved from the "Settings" tab.
246 *
247 * @input NULL
248 * @return Redirect
249 */
250 if ( ! function_exists( 'process_wpfeedback_options' ) ) {
251 function process_wpfeedback_options() {
252 $options = [];
253 // Check that user has proper security level
254 if ( ! current_user_can( 'manage_options' ) ) {
255 wp_die( 'Not allowed' );
256 }
257
258 if ( ! empty( $_FILES ) ) {
259 foreach ( $_FILES as $key => $file ) {
260 if ( is_array( $file ) ) {
261 $temp_wpf_file_name = $file["name"];
262 $temp_wpf_file_type = $file["type"];
263 $fname = explode( ".", $temp_wpf_file_name );
264 $temp_name = $file['tmp_name'];
265 if ( empty( $temp_name ) ) {
266 continue;
267 }
268 $data = file_get_contents( $temp_name );
269 $invalid = 0;
270 if ( ! in_array( $temp_wpf_file_type, array( 'image/jpeg', 'image/png' ) ) ) {
271 $invalid = 1;
272 }
273
274 if ( $invalid == 0 ) {
275 $base64_image = 'data:' . $temp_wpf_file_type . ';base64,' . base64_encode( $data );
276 if ( $key == 'wpf_logo_file' ) {
277 $options['logo']['image'] = $base64_image;
278 $options['logo']['file_name'] = str_replace( ' ', '_', trim( $fname[0] ) );
279 $options['logo']['type'] = $temp_wpf_file_type;
280 }
281 if ( $key == 'wpf_favicon_file' ) {
282 $options['favicon']['image'] = $base64_image;
283 $options['favicon']['file_name'] = str_replace( ' ', '_', trim( $fname[0] ) );
284 $options['favicon']['type'] = $temp_wpf_file_type;
285 }
286 }
287 }
288 }
289 }
290
291 $options['enabled_wpfeedback'] = isset( $_POST['enabled_wpfeedback'] ) ? 'yes' : 'no';
292 $options['wpf_enabled_compact_mode'] = isset( $_POST['wpf_enabled_compact_mode'] ) ? 'yes' : 'no'; /* => v2.1.0 */
293 $options['wpf_enable_clear_cache'] = isset( $_POST['wpf_enable_clear_cache'] ) ? 'yes' : 'no';
294 $options['delete_data_wpfeedback'] = isset( $_POST['delete_data_wpfeedback'] ) ? 'yes' : 'no';
295 $options['wpf_allow_backend_commenting'] = isset( $_POST['wpf_allow_backend_commenting'] ) ? 'yes' : 'no';
296 $options['wpf_show_front_stikers'] = isset( $_POST['wpf_show_front_stikers'] ) ? 'yes' : 'no';
297 $options['wpf_from_email'] = $_POST['wpf_from_email'];
298 $options['wpfeedback_more_emails'] = $_POST['wpfeedback_more_emails'];
299 $options['wpfeedback_powered_by'] = isset( $_POST['wpfeedback_powered_by'] ) ? 'yes' : 'no';
300 $options['wpfeedback_color'] = $_POST['wpfeedback_color'];
301 $options['wpf_powered_link'] = $_POST['wpf_powered_link'];
302 $options['wpfeedback_powered_by'] = isset( $_POST['wpfeedback_powered_by'] ) ? 'yes' : 'no';
303 $options['wpf_every_new_task'] = isset( $_POST['wpf_every_new_task'] ) ? 'yes' : 'no';
304 $options['wpf_every_new_comment'] = isset( $_POST['wpf_every_new_comment'] ) ? 'yes' : 'no';
305 $options['wpf_every_new_complete'] = isset( $_POST['wpf_every_new_complete'] ) ? 'yes' : 'no';
306 $options['wpf_every_status_change'] = isset( $_POST['wpf_every_status_change'] ) ? 'yes' : 'no';
307 $options['wpf_daily_report'] = isset( $_POST['wpf_daily_report'] ) ? 'yes' : 'no';
308 $options['wpf_weekly_report'] = isset( $_POST['wpf_weekly_report'] ) ? 'yes' : 'no';
309 $options['wpf_auto_daily_report'] = isset( $_POST['wpf_auto_daily_report'] ) ? 'yes' : 'no';
310 $options['wpf_auto_weekly_report'] = isset( $_POST['wpf_auto_weekly_report'] ) ? 'yes' : 'no';
311 $options['wpf_tutorial_video'] = stripcslashes( htmlentities( $_POST['wpf_tutorial_video'] ) );
312 $options['wpf_site_id'] = get_option( 'wpf_site_id' );
313
314 $parms = [];
315 foreach ( $options as $key => $value ) {
316 array_push( $parms, ['name' => $key,'value' => $value] );
317 }
318 update_site_data( $parms );
319
320 $wpf_report_register_types = array();
321 if ( isset( $_POST['wpf_auto_daily_report'] ) ) {
322 $wpf_report_register_types['daily'] = 'yes';
323 } else {
324 $wpf_report_register_types['daily'] = 'no';
325 }
326 if ( isset( $_POST['wpf_auto_weekly_report'] ) ) {
327 $wpf_report_register_types['weekly'] = 'yes';
328 } else {
329 $wpf_report_register_types['weekly'] = 'no';
330 }
331 wpf_register_auto_reports_cron( $wpf_report_register_types );
332 wp_redirect( add_query_arg( 'page', 'wpfeedback_page_settings&wpf_setting=1', admin_url( 'admin.php' ) ) );
333 exit;
334 }
335 }
336 add_action( 'admin_post_save_wpfeedback_options', 'process_wpfeedback_options' );
337
338 /*
339 * This function is used to save the Permissions options of the plugin when saved from the "Permissions" tab.
340 *
341 * @input Array ( $_POST )
342 * @return Redirect
343 */
344 if ( ! function_exists( 'process_wpfeedback_misc_options' ) ) {
345 function process_wpfeedback_misc_options() {
346 $options = [];
347 if ( isset( $_POST['edd_license_deactivate'] ) ) {
348 update_option( 'wpf_license', 'invalid', 'no' );
349 }
350 if ( isset( $_POST ) ) {
351 $options['wpf_allow_guest'] = isset( $_POST['wpfeedback_guest_allowed'] ) ? sanitize_text_field( $_POST['wpfeedback_guest_allowed'] ) : 'no';
352 $options['wpf_disable_for_admin'] = isset( $_POST['wpfeedback_disable_for_admin'] ) ? sanitize_text_field( $_POST['wpfeedback_disable_for_admin'] ) : 'no';
353 $options['wpf_disable_for_app'] = isset( $_POST['wpfeedback_disable_for_app'] ) ? sanitize_text_field( $_POST['wpfeedback_disable_for_app'] ) : 'no';
354 $wpfeedback_selected_roles = '';
355 if ( isset( $_POST['wpfeedback_selcted_role'] ) ) {
356 $wpfeedback_selected_roles = implode( ',', $_POST['wpfeedback_selcted_role'] );
357 } else {
358 $wpfeedback_selected_roles = "administrator";
359 }
360 update_option( 'wpf_selcted_role', $wpfeedback_selected_roles, 'no' );
361 $options['wpf_selcted_role'] = $wpfeedback_selected_roles;
362 $options['wpf_customisations_client'] = sanitize_text_field( $_POST['wpf_customisations_client'] );
363 $options['wpf_customisations_webmaster'] = sanitize_text_field( $_POST['wpf_customisations_webmaster'] );
364 $options['wpf_customisations_others'] = sanitize_text_field( $_POST['wpf_customisations_others'] );
365 $options['wpf_website_client'] = sanitize_text_field( $_POST['wpf_website_client'] );
366 $options['wpf_website_developer'] = sanitize_text_field( $_POST['wpf_website_developer'] );
367 $options['wpf_tab_permission_user_client'] = isset( $_POST['wpf_tab_permission_user_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_client'] ) : 'no';
368 $options['wpf_tab_permission_user_webmaster'] = isset( $_POST['wpf_tab_permission_user_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_webmaster'] ) : 'no';
369 $options['wpf_tab_permission_user_others'] = isset( $_POST['wpf_tab_permission_user_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_others'] ) : 'no';
370 $options['wpf_tab_permission_user_guest'] = isset( $_POST['wpf_tab_permission_user_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_guest'] ) : 'no';
371 $options['wpf_tab_permission_priority_client'] = isset( $_POST['wpf_tab_permission_priority_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_client'] ) : 'no';
372 $options['wpf_tab_permission_priority_webmaster'] = isset( $_POST['wpf_tab_permission_priority_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_webmaster'] ) : 'no';
373 $options['wpf_tab_permission_priority_others'] = isset( $_POST['wpf_tab_permission_priority_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_others'] ) : 'no';
374 $options['wpf_tab_permission_priority_guest'] = isset( $_POST['wpf_tab_permission_priority_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_guest'] ) : 'no';
375 $options['wpf_tab_permission_status_client'] = isset( $_POST['wpf_tab_permission_status_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_client'] ) : 'no';
376 $options['wpf_tab_permission_status_webmaster'] = isset( $_POST['wpf_tab_permission_status_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_webmaster'] ) : 'no';
377 $options['wpf_tab_permission_status_others'] = isset( $_POST['wpf_tab_permission_status_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_others'] ) : 'no';
378 $options['wpf_tab_permission_status_guest'] = isset( $_POST['wpf_tab_permission_status_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_guest'] ) : 'no';
379 $options['wpf_tab_permission_screenshot_client'] = isset( $_POST['wpf_tab_permission_screenshot_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_client'] ) : 'no';
380 $options['wpf_tab_permission_screenshot_webmaster'] = isset( $_POST['wpf_tab_permission_screenshot_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_webmaster'] ) : 'no';
381 $options['wpf_tab_permission_screenshot_others'] = isset( $_POST['wpf_tab_permission_screenshot_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_others'] ) : 'no';
382 $options['wpf_tab_permission_screenshot_guest'] = isset( $_POST['wpf_tab_permission_screenshot_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_guest'] ) : 'no';
383 $options['wpf_tab_permission_information_client'] = isset( $_POST['wpf_tab_permission_information_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_client'] ) : 'no';
384 $options['wpf_tab_permission_information_webmaster'] = isset( $_POST['wpf_tab_permission_information_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_webmaster'] ) : 'no';
385 $options['wpf_tab_permission_information_others'] = isset( $_POST['wpf_tab_permission_information_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_others'] ) : 'no';
386 $options['wpf_tab_permission_information_guest'] = isset( $_POST['wpf_tab_permission_information_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_guest'] ) : 'no';
387 $options['wpf_tab_permission_delete_task_client'] = isset( $_POST['wpf_tab_permission_delete_task_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_delete_task_client'] ) : 'no';
388 $options['wpf_tab_permission_delete_task_webmaster'] = isset( $_POST['wpf_tab_permission_delete_task_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_delete_task_webmaster'] ) : 'no';
389 $options['wpf_tab_permission_delete_task_others'] = isset( $_POST['wpf_tab_permission_delete_task_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_delete_task_others'] ) : 'no';
390 $options['wpf_tab_permission_delete_task_guest'] = isset( $_POST['wpf_tab_permission_delete_task_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_delete_task_guest'] ) : 'no';
391 $options['wpf_tab_auto_screenshot_task_client'] = isset( $_POST['wpf_tab_auto_screenshot_task_client'] ) ? sanitize_text_field( $_POST['wpf_tab_auto_screenshot_task_client'] ) : 'no';
392 $options['wpf_tab_auto_screenshot_task_webmaster'] = isset( $_POST['wpf_tab_auto_screenshot_task_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_auto_screenshot_task_webmaster'] ) : 'no';
393 $options['wpf_tab_auto_screenshot_task_others'] = isset( $_POST['wpf_tab_auto_screenshot_task_others'] ) ? sanitize_text_field( $_POST['wpf_tab_auto_screenshot_task_others'] ) : 'no';
394 $options['wpf_tab_auto_screenshot_task_guest'] = isset( $_POST['wpf_tab_auto_screenshot_task_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_auto_screenshot_task_guest'] ) : 'no';
395
396 /* update settings for display stickers */
397 $webmaster_sticker = 'no';
398 if ( isset( $_POST['wpf_tab_permission_display_stickers_webmaster'] ) && $_POST['wpf_tab_permission_display_stickers_webmaster'] == 'yes' ) {
399 $webmaster_sticker = 'yes';
400 }
401
402 $options['wpf_tab_permission_display_stickers_client'] = isset( $_POST['wpf_tab_permission_display_stickers_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_display_stickers_client'] ) : 'no';
403 $options['wpf_tab_permission_display_stickers_webmaster'] = $webmaster_sticker;
404 $options['wpf_tab_permission_display_stickers_others'] = isset( $_POST['wpf_tab_permission_display_stickers_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_display_stickers_others'] ) : 'no';
405 $options['wpf_tab_permission_display_stickers_guest'] = isset( $_POST['wpf_tab_permission_display_stickers_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_display_stickers_guest'] ) : 'no';
406
407 $webmaster_taskid = 'no';
408 if ( isset( $_POST['wpf_tab_permission_display_task_id_webmaster'] ) && $_POST['wpf_tab_permission_display_task_id_webmaster'] == 'yes' ) {
409 $webmaster_taskid = 'yes';
410 }
411 $options['wpf_tab_permission_display_task_id_client'] = isset( $_POST['wpf_tab_permission_display_task_id_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_display_task_id_client'] ) : 'no';
412 $options['wpf_tab_permission_display_task_id_webmaster'] = $webmaster_taskid;
413 $options['wpf_tab_permission_display_task_id_others'] = isset( $_POST['wpf_tab_permission_display_task_id_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_display_task_id_others'] ) : 'no';
414 $options['wpf_tab_permission_display_task_id_guest'] = isset( $_POST['wpf_tab_permission_display_task_id_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_display_task_id_guest'] ) : 'no';
415
416 // => v2.1.0
417 $keyboard_shortcut = 'no';
418
419 if ( isset( $_POST['wpf_tab_permission_keyboard_shortcut_webmaster'] ) && $_POST['wpf_tab_permission_keyboard_shortcut_webmaster'] == 'yes' ) {
420 $keyboard_shortcut = 'yes';
421 }
422 $options['wpf_tab_permission_keyboard_shortcut_client'] = isset( $_POST['wpf_tab_permission_keyboard_shortcut_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_keyboard_shortcut_client'] ) : 'no';
423 $options['wpf_tab_permission_keyboard_shortcut_webmaster'] = $keyboard_shortcut;
424 $options['wpf_tab_permission_keyboard_shortcut_others'] = isset( $_POST['wpf_tab_permission_keyboard_shortcut_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_keyboard_shortcut_others'] ) : 'no';
425 $options['wpf_tab_permission_keyboard_shortcut_guest'] = isset( $_POST['wpf_tab_permission_keyboard_shortcut_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_keyboard_shortcut_guest'] ) : 'no';
426
427 $parms1 = [];
428 foreach ( $options as $key => $value ) {
429 array_push( $parms1, ['name' => $key, 'value' => $value] );
430 }
431 update_site_data( $parms1 );
432 syncUsers();
433
434 if ( isset( $_POST['wpfeedback_licence_key'] ) && $_POST['wpfeedback_licence_key'] != "" ) {
435 if ( $_POST['wpfeedback_licence_key'] != '00000000000000000000000000000000' ) {
436 $wpf_license_key = sanitize_text_field( $_POST['wpfeedback_licence_key'] );
437 $wpf_result = wpf_license_key_license_item( $wpf_license_key );
438 if ( $wpf_result['license'] == 'valid' ) {
439 $wpf_crypt_key = wpf_crypt_key( $wpf_license_key, 'e' );
440 update_option( 'wpf_license_key', $wpf_crypt_key, 'no' );
441 update_option( 'wpf_license', $wpf_result['license'], 'no' );
442 update_option( 'wpf_license_expires', $wpf_result['expires'], 'no' );
443 if ( ! get_option( 'wpf_decr_key' ) ) {
444 update_option( 'wpf_decr_key', $wpf_result['payment_id'], 'no' );
445 update_option( 'wpf_decr_checksum', $wpf_result['checksum'], 'no' );
446 $wpf_crypt_key = wpf_crypt_key( $wpf_license_key, 'e' );
447 update_option( 'wpf_license_key', $wpf_crypt_key, 'no' );
448 }
449 do_action( 'wpf_initial_sync', $wpf_license_key );
450 } else {
451 update_option( 'wpf_license_key', sanitize_text_field( $_POST['wpfeedback_licence_key'] ), 'no' );
452 update_option( 'wpf_license', $wpf_result['license'], 'no' );
453 }
454 }
455 }
456 }
457 wp_redirect( add_query_arg( 'page', 'wpfeedback_page_permissions', admin_url( 'admin.php' ) ) );
458 exit;
459 }
460 }
461 add_action( 'admin_post_save_wpfeedback_misc_options', 'process_wpfeedback_misc_options' );
462
463 /*
464 * This function is used to create a dropdown of the roles available in website on the "Permissions" tab for the selection.
465 *
466 * @input Boolean
467 * @return String
468 */
469 if ( ! function_exists( 'wpfeedback_dropdown_roles' ) ) {
470 function wpfeedback_dropdown_roles( $selected = false ) {
471 global $wp_roles;
472 $p = '';
473 $r = '';
474 $editable_roles = $wp_roles->get_names();
475 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
476 // For backwards compatibility
477 if ( is_string( $selected_roles ) ) {
478 $selected_roles = explode( ',', $selected_roles );
479 foreach ( $editable_roles as $role => $details ) {
480 if ( is_array( $selected_roles ) AND in_array( $role, $selected_roles ) ) // preselect specified role
481 $p .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$details</option>";
482 else
483 $r .= "\n\t<option value='" . esc_attr( $role ) . "'>$details</option>";
484 }
485 }
486 return $p . $r;
487 }
488 }
489
490 /*
491 * This function is used to get the title of the page based on the page ID. This function is not used currently.
492 *
493 * @input Int
494 * @return String
495 */
496 if ( ! function_exists( 'wpf_get_page_title' ) ) {
497 function wpf_get_page_title( $post_id ) {
498 $get_page_id = get_post_meta( $post_id, '_wpf_page_id', true );
499 $page_title = get_the_title( $get_page_id );
500 return $page_title;
501 }
502 }
503
504 /*
505 * This function is used to get the listing of all the wpfeedback tasks.
506 *
507 * @input NULL
508 * @return String
509 */
510 if ( ! function_exists( 'wpfeedback_get_post_list' ) ) {
511 function wpfeedback_get_post_list() {
512 $output = '';
513 $args = array(
514 'numberposts' => -1,
515 'post_type' => 'wpfeedback',
516 'orderby' => 'title',
517 'orderby' => 'date',
518 'order' => 'DESC',
519 'task_center' => 1,
520 'wpf_site_id' => get_option( 'wpf_site_id' ),
521 );
522
523
524 /* START */
525 $currnet_user_information = wpf_get_current_user_information();
526 $current_role = $currnet_user_information['role'];
527 $current_user_name = $currnet_user_information['display_name'];
528 $current_user_id = $currnet_user_information['user_id'];
529 $wpf_website_builder = get_site_data_by_key( 'wpf_website_developer' ) == 1 ? get_site_data_by_key( 'wpf_website_developer' ) : 0;
530 if ( $current_user_name == 'Guest' ) {
531 $wpf_website_client = get_site_data_by_key( 'wpf_website_client' ) == 1 ? get_site_data_by_key( 'wpf_website_client' ) : 0;
532 $wpf_current_role = 'guest';
533 if ( $wpf_website_client ) {
534 $wpf_website_client_info = get_userdata( $wpf_website_client );
535 if ( $wpf_website_client_info ) {
536 if ( $wpf_website_client_info->display_name == '' ) {
537 $current_user_name = $wpf_website_client_info->user_nicename;
538 } else {
539 $current_user_name = $wpf_website_client_info->display_name;
540 }
541 }
542 }
543 } else {
544 $wpf_current_role = wpf_user_type();
545 }
546 $current_user_name = addslashes( $current_user_name );
547 if ( $wpf_current_role == 'advisor' ) {
548 $wpf_tab_permission_display_stickers = ( get_site_data_by_key( 'wpf_tab_permission_display_stickers_webmaster' ) != 'no') ? 'yes' : 'no';
549 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no') ? 'yes' : 'no';
550 } elseif ( $wpf_current_role == 'king' ) {
551 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_client' ) == 'yes' ? 'yes' : 'no';
552 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_client' ) == 'yes' ? 'yes' : 'no';
553 } elseif ( $wpf_current_role == 'council' ) {
554 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_others' ) == 'yes' ? 'yes' : 'no';
555 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_others' ) == 'yes' ? 'yes' : 'no';
556 } else {
557 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_guest' ) == 'yes' ? 'yes' : 'no';
558 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_guest' ) == 'yes' ? 'yes' : 'no';
559 }
560 /* END */
561
562 $url = WPF_CRM_API . 'wp-api/all/task-center-tasks';
563 $sendtocloud = json_encode( $args );
564 $myposts = wpf_send_remote_post( $url, $sendtocloud );
565 $wpf_orphans = array();
566 if ( $myposts ) {
567 $output .= '<ul id="all_wpf_list" style="list-style-type: none; font-size:12px;">';
568 if ( isset( $myposts['data'] ) && ! empty( $myposts['data'] ) ) {
569 foreach ( $myposts['data'] as $mypost ) {
570 $user_atarim_type = get_user_meta( $current_user_id, 'wpf_user_type', true );
571 if ( $mypost['task']['is_internal'] == '1' ) {
572 if ( $user_atarim_type != 'advisor' ) {
573 continue;
574 }
575 }
576 $post_id = $mypost['task']['id'];
577 $site_task_id = $mypost['task']['site_task_id'];
578 $wpf_task_id = $mypost['task']['wpf_task_id'];
579 $author_id = $mypost['task']['task_config_author_id'];
580 $get_post_date = $mypost['task']['created_at'];
581 $date = date_create( $get_post_date );
582 $post_date = date_format( $date, "d/m/Y H:i" );
583 $post_title = $mypost['task']['task_title'];
584 $task_page_url = $mypost['task']['task_page_url'];
585 $wpf_task_screenshot = $mypost['task']['wpf_task_screenshot'];
586 $task_page_title = ( $mypost['task']['task_page_title'] != null ) ? $mypost['task']['task_page_title'] : "";
587 $task_config_author_name = $mypost['task']['task_config_author_name'];
588 $task_notify_users = $mypost['task']['task_notify_users'];
589 $task_config_author_resX = $mypost['task']['task_config_author_resX'];
590 $task_config_author_resY = $mypost['task']['task_config_author_resY'];
591 $get_task_type = $mypost['task']['task_type'];
592 $is_internal = $mypost['task']['is_internal'];
593
594 if ( $get_task_type == 'general' ) {
595 $task_type = 'general';
596 $general = '<span class="wpf_task_type">' . __( "General", "wpfeedback" ) . '</span>';
597 } elseif ( $get_task_type == 'email' ) { //!email
598 $task_type = 'email';
599 $general = '<span class="wpf_task_type">' . __( "Email", "wpfeedback" ) . '</span>';
600 } elseif ( $get_task_type == 'graphics' ) {
601 $task_type = 'graphics';
602 $general = '<span class="wpf_task_type">' . __( "Graphics", "wpfeedback" ) . '</span>';
603 } else {
604 $task_type = '';
605 $general = '';
606 }
607 if ( $is_internal == '1' ) {
608 $internal = '<span class="wpf_task_type" title="Task type">' . __( "Internal", "wpfeedback" ) . '</span>';
609 $internal_icon = $internal_icon_html = '<span class="wpf_chevron_wrapper"><img src="' . WPF_PLUGIN_URL . 'images/eye-off-white.svg" class="wpf-internal-img"></span>';
610 $internal_class = 'wpfb-internal';
611 } else {
612 $internal = '';
613 $internal_icon = '';
614 $internal_class = '';
615 }
616
617 //create list of orphan tasks
618 if ( $get_task_type == "general" && ( $mypost['task']['wpfb_task_bubble'] != NULL ) ) {
619 $wpf_orphans[] = $post_id;
620 }
621 if ( $mypost['task']['is_admin_task'] == 1 ) {
622 $wpf_task_status = 'wpf_admin';
623 $admin_tag = '<span class="wpf_task_type">' . __( "Admin", "wpfeedback" ) . '</span>';
624 } else {
625 $wpf_task_status = 'public';
626 $admin_tag = '';
627 }
628
629 $task_config_author_browser = $mypost['task']['task_config_author_browser'];
630 $task_config_author_browserVersion = $mypost['task']['task_config_author_browserVersion'];
631 $task_comment_id = $mypost['task']['wpf_task_id'];
632 $task_priority = $mypost['task']['task_priority'];
633 $task_status = $mypost['task']['task_status'];
634 $task_tags = $mypost['task']['tags'];
635 $all_other_tag = '';
636 $wpfb_tags_html = '';
637
638 if ( $task_tags ) {
639 $tag_length = count( $task_tags );
640 $wpfb_tags_html = '<div class="wpf_task_tags">';
641 $i = 1;
642 foreach ( $task_tags as $task_tag => $task_tags_value ) {
643 if ( $i == 1 ) {
644 $wpfb_tags_html .= '<span class="wpf_task_tag">' . $task_tags_value["tag"] . '</span>';
645 } else {
646 if ( $tag_length == $i ) {
647 $all_other_tag .= $task_tags_value['tag'];
648 } else {
649 $all_other_tag .= $task_tags_value["tag"].', ';
650 }
651 }
652 $i++;
653 }
654 if ( $tag_length > 1 ) {
655 $wpfb_tags_html .= '<span class="wpf_task_tag_more" title="' . $all_other_tag . '">...</span>';
656 }
657 $wpfb_tags_html .= '</div>';
658 }
659 $task_date = $mypost['task']['created_at'];
660 $task_date1 = date_create( $task_date );
661
662 //New Logic to get current time.
663 $wpf_wp_current_timestamp = date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) );
664 $task_date2 = date_create( $wpf_wp_current_timestamp );
665 $display_span = '';
666 $custom_class = '';
667 if ( $wpf_tab_permission_display_stickers == 'yes' ) {
668 $display_span = '<span class="' . $task_priority . '_custom wpf_top_badge"></span> ';
669 $custom_class = $task_status . "_custom";
670 }
671 $curr_task_time = wpfb_time_difference( $task_date1, $task_date2 );
672 $display_check_mark = '';
673 if ( $wpf_tab_permission_display_task_id != 'yes' ) {
674 $display_check_mark = '<i class="gg-check"></i>';
675 } else {
676 $display_check_mark = '<span class="wpf_bubble_num_wrapper">' . $mypost['task']['site_task_id'] . '</span>' . $internal_icon;//$task_comment_id;
677 }
678 if ( $task_status == 'complete' ) {
679 $bubble_label = $display_span . $display_check_mark;
680 } else {
681 $bubble_label = $display_span . '<span class="wpf_bubble_num_wrapper">' . $mypost['task']['site_task_id'] . '</span>' . $internal_icon;//$task_comment_id;
682 }
683 $author = get_task_author( $mypost['task'] );
684 $wpf_task_status_label = '<div class="wpf_task_label"><span class="task_status wpf_' . $task_status . '" title="Status: ' . $task_status . '">' . get_wpf_status_icon() . '</span>';
685 $wpf_task_priority_label = '<span class="task_priority wpf_' . $task_priority . '" title="Priority: ' . $task_priority . '">' . get_wpf_priority_icon() . '</span></div>';
686 $author_name = "'" . $author . "'";
687 $output .= '<li class="post_' . $post_id . ' ' . $task_priority . ' ' . $task_status . ' wpf_list"><a href="javascript:void(0)" class="' . $internal_class . ' ' . $task_status . ' ' . $internal_class . '" id="wpf-task-' . $post_id . '" data-wpf_task_status="' . $wpf_task_status . '"" data-task_type="' . $task_type . '" data-task_author_name="' . $task_config_author_name . '" data-task_config_author_browserVersion="' . $task_config_author_browserVersion . '" data-task_config_author_res="' . $task_config_author_resX . ' X ' . $task_config_author_resY . '" data-task_config_author_browser="' . $task_config_author_browser . '" data-task_config_author_name="' . __( 'By ', 'wpfeedback' ) . $task_config_author_name . ' ' . $post_date . '" data-task_notify_users="' . $task_notify_users . '" data-task_page_url="' . $task_page_url . '" data-wpf_task_screenshot="' . $wpf_task_screenshot . '" data-task_page_title="' . $post_title . '"
688 data-task_priority="' . $task_priority . '" data-task_status="' . $task_status . '" data-disp-id="' . $site_task_id . '" data-is-internal="' . $is_internal . '" onclick="get_wpf_chat(this,true,' . $author_name . ')" data-postid="' . $post_id . '" data-uid="' . $author_id . '" data-task_no="' . $task_comment_id . '"><div class="wpf_chat_top"><input type="checkbox" value="' . $post_id . '" name="wpf_task_id" data-disp-id="' . $site_task_id . '" id="wpf_' . $post_id . '" class="wpf_task_id" style="display:none;"><div class="wpf_task_num_top ' . $custom_class . '">' . $bubble_label . '</div><div class="wpf_task_main_top"><div class="wpf_task_details_top">' . $author . ' <span>' . $curr_task_time['comment_time'] . '</span></div><div class="wpf_task_pagename">' . $task_page_title . ' </div><div class="wpf_task_title_top">' . $post_title . '</div></div>' . $internal.$general . '<div class="wpf_task_meta"><div class="wpf_task_meta_icon"><i class="gg-chevron-left"></i></div><div class="wpf_task_meta_details">' . ' ' . $admin_tag . ' ' . $general . $wpf_task_status_label . $wpf_task_priority_label . $wpfb_tags_html . '</div></div></div></a></li>';
689 }
690 }
691 wp_reset_postdata();
692 $output .= '</ul>';
693 } else {
694 $output = '<div class="wpf_no_tasks_found"><i class="gg-info"></i> No tasks found</div>';
695 }
696 $response[0]=$output;
697 $response[1]=$wpf_orphans;
698 return $response;
699 }
700 }
701
702 /*
703 * This function is used to get the logo to be displayed on the backend and sidebar.
704 *
705 * @input NULL
706 * @return String
707 */
708 if ( ! function_exists( 'get_wpf_logo' ) ) {
709 function get_wpf_logo() {
710 $wpf_global_settings = get_site_data_by_key( 'wpf_global_settings' );
711 $get_logoid = get_site_data_by_key( 'wpfeedback_logo' );
712 if ( $wpf_global_settings == 'yes' ) {
713 $get_logo_url = $get_logoid;
714 } else {
715 if ( $get_logoid != '' ) {
716 $get_logo_url = $get_logoid;
717 } else {
718 $get_logo_url = esc_url( WPF_PLUGIN_URL . 'images/Atarim.svg' );
719 }
720 }
721 return $get_logo_url;
722 }
723 }
724
725 if ( ! function_exists( 'get_wpf_favicon' ) ) {
726 function get_wpf_favicon() {
727 $wpf_global_settings = get_site_data_by_key( 'wpf_global_settings' );
728 $get_faviconid = get_site_data_by_key( 'wpfeedback_favicon' );
729 if ( $wpf_global_settings == 'yes' ) {
730 $get_favicon_url = $get_faviconid;
731 } else {
732 if ( $get_faviconid != '' ) {
733 $get_favicon_url = $get_faviconid;
734 } else {
735 $get_favicon_url = esc_url( WPF_PLUGIN_URL . 'images/atarim_icon.svg' );
736 }
737 }
738 if ( $get_faviconid == '' ) {
739 $get_favicon_url = esc_url( WPF_PLUGIN_URL . 'images/atarim_icon.svg' );
740 }
741 return $get_favicon_url;
742 }
743 }
744
745 /*
746 * no image svg
747 */
748 if ( ! function_exists( 'get_wpf_no_image' ) ) {
749 function get_wpf_no_image() {
750 return '<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><g><path d="m466.916 109.19h-42.077v-54.107c0-24.859-20.225-45.083-45.084-45.083h-334.671c-24.859 0-45.084 20.225-45.084 45.083v302.643c0 24.859 20.225 45.083 45.084 45.083h42.077v54.106c0 24.859 20.225 45.084 45.084 45.084h334.671c24.859.001 45.084-20.224 45.084-45.083v-302.642c0-24.859-20.225-45.084-45.084-45.084zm0 20c13.831 0 25.084 11.252 25.084 25.083v267.847l-127.451-144.08c-1.898-2.146-4.625-3.375-7.49-3.375s-5.592 1.229-7.49 3.375l-68.36 77.279-48.574-52.424c-1.893-2.042-4.551-3.204-7.335-3.204s-5.442 1.161-7.335 3.203l-110.804 119.585v-268.205c0-13.831 11.253-25.083 25.084-25.083h334.671zm-199.024 241.183-49.865 56.371h-87.552l94.825-102.338zm-180.731-216.099v228.536h-42.077c-13.831 0-25.084-11.253-25.084-25.084v-302.643c0-13.831 11.253-25.083 25.084-25.083h334.671c13.831 0 25.084 11.252 25.084 25.083v54.107h-272.594c-24.859 0-45.084 20.225-45.084 45.084zm379.755 327.726h-334.671c-13.831 0-25.084-11.252-25.084-25.084v-10.18c.138.006.276.009.415.009h216.454c5.522 0 10-4.477 10-10s-4.478-10-10-10h-79.301l112.33-126.986 112.33 126.986h-54.946c-5.522 0-10 4.477-10 10s4.478 10 10 10h77.557v10.171c0 13.832-11.253 25.084-25.084 25.084z"/><g><path d="m369.42 446.74c-4.174 0-7.985-2.681-9.402-6.604-1.378-3.815-.249-8.236 2.808-10.911 3.277-2.868 8.171-3.259 11.871-.97 3.518 2.176 5.36 6.477 4.51 10.525-.963 4.583-5.096 7.96-9.787 7.96z"/></g><path d="m261.916 269.413c-29.241 0-53.03-23.789-53.03-53.03s23.789-53.03 53.03-53.03 53.03 23.789 53.03 53.03-23.789 53.03-53.03 53.03zm0-86.06c-18.213 0-33.03 14.817-33.03 33.03s14.817 33.03 33.03 33.03 33.03-14.817 33.03-33.03-14.817-33.03-33.03-33.03z"/></g></g></svg>';
751 }
752 }
753
754 /*
755 * get user profile svg icon
756 */
757 if ( ! function_exists( 'get_wpf_user_icon' ) ) {
758 function get_wpf_user_icon() {
759 return '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="166.5px" viewBox="0 0 200 166.5" enable-background="new 0 0 200 166.5" xml:space="preserve"> <path fill="none" stroke="#4B5668" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M141.4,158.021V141.46 c0-18.29-14.83-33.119-33.12-33.119H42.04c-18.292,0-33.121,14.829-33.121,33.119v16.561"/> <circle fill="none" stroke="#4B5668" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" cx="75.16" cy="42.099" r="33.12"/> <path fill="none" stroke="#4B5668" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M191.082,158.021V141.46 c-0.018-15.088-10.221-28.269-24.841-32.044"/> <path fill="none" stroke="#4B5668" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M133.122,10.054 c17.723,4.54,28.413,22.581,23.869,40.301c-2.993,11.725-12.146,20.875-23.869,23.87"/> </svg>';
760 }
761 }
762
763 /*
764 * get user screenshot svg icon
765 */
766 if ( ! function_exists( 'get_wpf_screenshot_icon' ) ) {
767 function get_wpf_screenshot_icon() {
768 return '<svg enable-background="new 0 0 24 24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 23h-18c-1.654 0-3-1.346-3-3v-12c0-1.654 1.346-3 3-3 .853 0 1.619-.474 2-1.236l.211-.422c.722-1.445 2.174-2.342 3.789-2.342h6c1.615 0 3.067.897 3.789 2.342l.211.422c.381.762 1.147 1.236 2 1.236 1.654 0 3 1.346 3 3v12c0 1.654-1.346 3-3 3zm-12-20c-.853 0-1.619.474-2 1.236l-.211.422c-.722 1.445-2.174 2.342-3.789 2.342-.551 0-1 .449-1 1v12c0 .552.449 1 1 1h18c.552 0 1-.448 1-1v-12c0-.551-.448-1-1-1-1.615 0-3.067-.897-3.789-2.342l-.211-.422c-.381-.762-1.147-1.236-2-1.236h-6zm3 16c-3.309 0-6-2.691-6-6s2.691-6 6-6 6 2.691 6 6-2.691 6-6 6zm0-10c-2.206 0-4 1.794-4 4s1.794 4 4 4 4-1.794 4-4-1.794-4-4-4z"/></svg>';
769 }
770 }
771
772 /*
773 * get share svg icon
774 */
775 if ( ! function_exists( 'get_wpf_share_icon' ) ) {
776 function get_wpf_share_icon() {
777 return '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="195px" viewBox="0 0 200 195" enable-background="new 0 0 200 195" xml:space="preserve"> <path fill="#4B5668" d="M128.002,174.893c-25.824,10.856-55.761,5.63-76.456-13.409c17.481-18.517,4.467-49.346-21.274-49.346 C14.131,112.138,1,125.27,1,141.411c0,19.861,19.495,34.034,38.408,27.805c24.83,24.902,62.124,31.979,94.016,18.573 c3.56-1.496,5.234-5.598,3.735-9.16C135.664,175.069,131.564,173.396,128.002,174.893L128.002,174.893z M14.989,141.411 c0-8.427,6.855-15.283,15.283-15.283c8.426,0,15.282,6.856,15.282,15.283s-6.855,15.282-15.282,15.282 C21.845,156.693,14.989,149.838,14.989,141.411z"/> <path fill="#4B5668" d="M23.708,88.273c3.644,1.325,7.648-0.566,8.965-4.181C39.639,64.94,54.739,49.47,73.56,41.929 c4.619,10.106,14.815,17.149,26.632,17.149c16.14,0,29.272-13.131,29.272-29.272c0-16.14-13.132-29.271-29.272-29.271 c-15.512,0-28.238,12.132-29.205,27.404c-23.95,8.684-42.817,27.608-51.461,51.371C18.206,82.939,20.077,86.953,23.708,88.273 L23.708,88.273z M100.193,14.523c8.426,0,15.281,6.855,15.281,15.282s-6.854,15.283-15.281,15.283 c-8.428,0-15.283-6.855-15.283-15.283C84.911,21.378,91.766,14.523,100.193,14.523z"/> <path fill="#4B5668" d="M185.615,116.597c0.248-1.387,0.393-5.853,0.393-7.949c0-24.25-10.332-47.48-28.349-63.734 c-2.868-2.587-7.29-2.36-9.879,0.508c-2.588,2.868-2.361,7.291,0.508,9.879c15.778,14.234,24.703,35.034,23.641,56.899 c-17.003-1.046-31.086,12.519-31.086,29.212c0,16.14,13.13,29.271,29.271,29.271c16.142,0,29.272-13.132,29.272-29.271 C199.386,130.96,193.877,121.776,185.615,116.597L185.615,116.597z M170.112,156.693c-8.425,0-15.281-6.855-15.281-15.282 c0-8.428,6.856-15.284,15.281-15.284c8.429,0,15.282,6.856,15.282,15.284C185.396,149.838,178.541,156.693,170.112,156.693z"/> </svg>';
778 }
779 }
780
781 /*
782 * get status svg icon
783 */
784 if ( ! function_exists( 'get_wpf_status_icon' ) ) {
785 function get_wpf_status_icon() {
786 return '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="110.836px" viewBox="0 0 200 110.836" enable-background="new 0 0 200 110.836" xml:space="preserve"> <g> <path fill="#4B5668" stroke="#FFFFFF" stroke-width="3" stroke-miterlimit="10" d="M96.199,84.264 c3.212-8.122,5.887-14.854,8.54-21.596c6.955-17.673,14.016-35.305,20.766-53.054c1.697-4.463,3.078-8.703,8.865-8.447 c5.82,0.257,7.804,4.332,9.179,9.283c4.447,16.01,9.085,31.967,13.669,47.941c0.518,1.799,1.149,3.571,1.829,5.669 c10.653,0,21.103,0.078,31.551-0.034c5.134-0.054,9.407,1.354,9.421,7.142c0.014,5.783-4.243,7.199-9.379,7.208 c-12.833,0.021-25.67,0.222-38.504,0.363c-5.496,0.062-7.919-3.141-9.272-8.057c-3.298-11.993-6.843-23.916-10.682-37.219 c-1.465,2.919-2.413,4.478-3.063,6.153c-8.467,21.917-16.763,43.902-25.501,65.708c-1.02,2.545-4.559,5.876-6.71,5.726 c-2.753-0.194-6.52-3-7.705-5.638c-7.184-16.025-13.744-32.325-20.544-48.52c-0.972-2.317-2.113-4.565-3.642-7.844 c-4.028,8.057-7.796,15.156-11.148,22.445c-2.247,4.89-5.341,7.185-11.01,6.967c-10.686-0.407-21.399-0.201-32.1-0.085 c-5.209,0.056-10.13-0.729-10.255-7.028c-0.124-6.294,4.633-7.399,9.939-7.321c8.323,0.124,16.667-0.326,24.963,0.168 c4.906,0.292,7.171-1.588,9.085-5.808c4.018-8.863,8.283-17.642,13.061-26.11c1.543-2.737,5.344-6.432,7.502-6.07 c3.262,0.548,7.29,3.667,8.725,6.747c6.71,14.412,12.632,29.188,18.867,43.823C93.527,78.845,94.57,80.845,96.199,84.264z"/> </g> </svg>';
787 }
788 }
789
790 /*
791 * get priority svg icon
792 */
793 if ( ! function_exists( 'get_wpf_priority_icon' ) ) {
794 function get_wpf_priority_icon() {
795 return '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="200px" height="200px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve"> <path fill="#4B5668" d="M197.058,61.695L157.311,5.664c-2.004-2.826-5.271-4.514-8.736-4.515c-0.002,0-0.002,0-0.002,0 c-3.467,0-6.733,1.687-8.738,4.515l-39.747,56.032c-2.328,3.281-2.628,7.542-0.781,11.118c1.847,3.575,5.496,5.796,9.52,5.796 h16.558v108.869c0,6.141,4.994,11.135,11.135,11.135h24.106c6.141,0,11.136-4.995,11.136-11.135V78.609h16.558 c4.024,0,7.671-2.222,9.519-5.796C199.683,69.237,199.385,64.976,197.058,61.695z M164.363,63.817c-4.087,0-7.396,3.311-7.396,7.396 v112.61h-16.794V71.214c0-4.086-3.31-7.396-7.395-7.396h-16.063l31.854-44.907l31.855,44.907L164.363,63.817L164.363,63.817z"/> <path fill="#4B5668" d="M91.176,121.152h-16.56V12.282c0-6.141-4.994-11.136-11.135-11.136H39.375 c-6.141,0-11.135,4.995-11.135,11.136V52.68c0,4.086,3.31,7.396,7.396,7.396c4.085,0,7.396-3.31,7.396-7.396V15.939h16.792v112.61 c0,4.085,3.31,7.396,7.396,7.396h16.062L51.428,180.85l-31.853-44.905h16.062c4.085,0,7.396-3.311,7.396-7.396V87.077 c0-4.085-3.311-7.395-7.396-7.395c-4.086,0-7.396,3.31-7.396,7.395v34.075H11.683c-4.026,0-7.674,2.222-9.521,5.797 c-1.847,3.576-1.546,7.836,0.782,11.115l39.747,56.032c2.006,2.827,5.272,4.517,8.738,4.517h0.002 c3.468-0.001,6.733-1.691,8.737-4.517l39.746-56.03c2.329-3.281,2.63-7.541,0.782-11.117 C98.848,123.374,95.2,121.152,91.176,121.152L91.176,121.152z"/> </svg>';
796 }
797 }
798
799 /*
800 * get info svg icon
801 */
802 if ( ! function_exists( 'get_wpf_info_icon' ) ) {
803 function get_wpf_info_icon() {
804 return '<svg height="100px" version="1.1" viewBox="0 0 100 100" width="100px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="MiMedia---iOS/Android" stroke="none" stroke-width="1"><g fill="#4B5668" id="icon32pt_info"><path d="M50,94 C74.300529,94 94,74.300529 94,50 C94,25.699471 74.300529,6 50,6 C25.699471,6 6,25.699471 6,50 C6,74.300529 25.699471,94 50,94 L50,94 Z M50,86 C69.882251,86 86,69.882251 86,50 C86,30.117749 69.882251,14 50,14 C30.117749,14 14,30.117749 14,50 C14,69.882251 30.117749,86 50,86 L50,86 Z M45,49.0044356 C45,46.2405621 47.2441952,44 50,44 C52.7614237,44 55,46.2303666 55,49.0044356 L55,68.9955644 C55,71.7594379 52.7558048,74 50,74 C47.2385763,74 45,71.7696334 45,68.9955644 L45,49.0044356 L45,49.0044356 Z M44,32 C44,28.6862915 46.6930342,26 50,26 C53.3137085,26 56,28.6930342 56,32 C56,35.3137085 53.3069658,38 50,38 C46.6862915,38 44,35.3069658 44,32 L44,32 Z" id="Oval-58"/></g></g></svg>';
805 }
806 }
807
808 /*
809 * get visibility svg icon
810 */
811 if ( ! function_exists( 'get_wpf_visibility_icon' ) ) {
812 function get_wpf_visibility_icon() {
813 return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"> <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path> <circle cx="12" cy="12" r="3"></circle> </svg>';
814 }
815 }
816
817 /*
818 * get exclamation(?) svg icon
819 */
820 if ( ! function_exists( 'get_wpf_exclamation_icon' ) ) {
821 function get_wpf_exclamation_icon() {
822 return '<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M8.22766 9C8.77678 7.83481 10.2584 7 12.0001 7C14.2092 7 16.0001 8.34315 16.0001 10C16.0001 11.3994 14.7224 12.5751 12.9943 12.9066C12.4519 13.0106 12.0001 13.4477 12.0001 14M12 17H12.01M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" stroke="#363d4d" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/></svg>';
823 }
824 }
825
826 /*
827 * get plus svg icon
828 */
829 if ( ! function_exists( 'get_wpf_plus_icon' ) ) {
830 function get_wpf_plus_icon() {
831 return '<svg viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" class="ph-transition-transform ph-transition-250 ph-mr-2"> <path d="M9 1.5V16.5M1.5 9H16.5" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></path> </svg>';
832 }
833 }
834
835 /*
836 * get close svg icon
837 */
838 if ( ! function_exists( 'get_wpf_close_icon' ) ) {
839 function get_wpf_close_icon() {
840 return '<svg data-v-07452373="" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x feather__content"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
841 }
842 }
843
844 /*
845 * get right svg icon
846 */
847 if ( ! function_exists( 'get_wpf_right_icon' ) ) {
848 function get_wpf_right_icon() {
849 return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"> <polyline points="20 6 9 17 4 12"></polyline> </svg>';
850 }
851 }
852
853 /*
854 * get pro svg icon
855 */
856 if ( ! function_exists( 'get_wpf_pro_icon' ) ) {
857 function get_wpf_pro_icon() {
858 return '<svg viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M19.0044 8.71143L19.0044 1.71143L12.0044 1.71143L12.0044 8.71143L19.0044 8.71143Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M19.0044 19.7114L19.0044 12.7114L12.0044 12.7114L12.0044 19.7114L19.0044 19.7114Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M8.00439 19.7114L8.00439 12.7114L1.00439 12.7114L1.00439 19.7114L8.00439 19.7114Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M8.00439 8.71143L8.00439 1.71143L1.00439 1.71143L1.00439 8.71143L8.00439 8.71143Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </svg>';
859 }
860 }
861
862 /*
863 * get atarim svg icon
864 */
865 if ( ! function_exists( 'get_wpf_icon' ) ) {
866 function get_wpf_icon() {
867 return '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1080"> <defs><style>.cls-1{fill:#052055}.cls-2{fill:#6d5df3}</style></defs><title>#9304 - New logo request</title> <g> <g> <polygon class="cls-1" points="937.344 785.955 746.1 856.215 851.972 1060.257 1080 1059.991 937.344 785.955"/> <polygon class="cls-1" points="539.938 19.669 0 1059.991 228.152 1059.991 539.873 458.766 652.263 675.369 843.507 605.108 539.938 19.669"/> </g> <polygon class="cls-2" points="227.659 1060.331 373.967 778.521 1055.074 519.371 227.659 1060.331"/> </g> </svg>';
868 }
869 }
870
871 /*
872 * get report svg icon
873 */
874 if ( ! function_exists( 'get_wpf_report_icon' ) ) {
875 function get_wpf_report_icon() {
876 return '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mail"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>';
877 }
878 }
879
880 /*
881 * get download icon
882 */
883 if ( ! function_exists( 'get_wpf_image_download_icon' ) ) {
884 function get_wpf_image_download_icon() {
885 return '<svg viewBox="0 0 512 512" id="ion-android-download" width="18" height="18" fill="#fff"><path d="M403.002 217.001C388.998 148.002 328.998 96 256 96c-57.998 0-107.998 32.998-132.998 81.001C63.002 183.002 16 233.998 16 296c0 65.996 53.999 120 120 120h260c55 0 100-45 100-100 0-52.998-40.996-96.001-92.998-98.999zM224 268v-76h64v76h68L256 368 156 268h68z"></path></svg>';
886 }
887 }
888
889 /*
890 * get open icon
891 */
892 if ( ! function_exists( 'get_wpf_image_open_icon' ) ) {
893 function get_wpf_image_open_icon() {
894 return '<svg height="18" version="1.1" viewBox="0 0 100 100" width="18" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="MiMedia---Web" stroke="none" stroke-width="1"><g fill="#fff" id="icon24pt_new_window" transform="translate(2.000000, 2.000000)"><path d="M73.7883228,16 L44.56401,45.2243128 C42.8484762,46.9398466 42.8459918,49.728257 44.5642987,51.4465639 C46.2791092,53.1613744 49.0684023,53.1650001 50.7865498,51.4468526 L80,22.2334024 L80,32.0031611 C80,34.2058797 81.790861,36 84,36 C86.2046438,36 88,34.2105543 88,32.0031611 L88,11.9968389 C88,10.8960049 87.5527117,9.89722307 86.8294627,9.17343595 C86.1051125,8.44841019 85.1063303,8 84.0031611,8 L63.9968389,8 C61.7941203,8 60,9.790861 60,12 C60,14.2046438 61.7894457,16 63.9968389,16 L73.7883228,16 L73.7883228,16 Z M88,56 L88,36.9851507 L88,78.0296986 C88,83.536144 84.0327876,88 79.1329365,88 L16.8670635,88 C11.9699196,88 8,83.5274312 8,78.0296986 L8,17.9703014 C8,12.463856 11.9672124,8 16.8670635,8 L59.5664682,8 L40,8 C42.209139,8 44,9.790861 44,12 C44,14.209139 42.209139,16 40,16 L18.2777939,16 C17.0052872,16 16,17.1947367 16,18.668519 L16,77.331481 C16,78.7786636 17.0198031,80 18.2777939,80 L77.7222061,80 C78.9947128,80 80,78.8052633 80,77.331481 L80,56 C80,53.790861 81.790861,52 84,52 C86.209139,52 88,53.790861 88,56 L88,56 Z" id="Rectangle-2064"/></g></g></svg>';
895 }
896 }
897
898 /*
899 * push to media icon
900 */
901 if ( ! function_exists( 'get_wpf_push_to_media_icon' ) ) {
902 function get_wpf_push_to_media_icon() {
903 return '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32pt" height="31pt" viewBox="0 0 32 31" version="1.1"><g id="surface1"><path style=" stroke:none;fill-rule:nonzero;fill:#ffffff;fill-opacity:1;" d="M 16.234375 16.746094 L 13.558594 24.3125 L 13.550781 24.3125 L 11.476562 30.09375 C 11.621094 30.132812 11.761719 30.164062 11.910156 30.203125 C 11.917969 30.203125 11.925781 30.203125 11.933594 30.203125 C 13.222656 30.535156 14.578125 30.71875 15.972656 30.71875 C 16.667969 30.71875 17.34375 30.679688 18.007812 30.574219 C 18.921875 30.464844 19.800781 30.277344 20.660156 30.015625 C 20.871094 29.953125 21.082031 29.878906 21.296875 29.808594 C 21.066406 29.335938 20.578125 28.28125 20.554688 28.234375 Z M 16.234375 16.746094 "/><path style=" stroke:none;fill-rule:nonzero;fill:#ffffff;fill-opacity:1;" d="M 1.6875 9.5625 C 0.871094 11.351562 0.316406 13.550781 0.316406 15.535156 C 0.316406 16.03125 0.339844 16.53125 0.390625 17.019531 C 0.953125 22.652344 4.707031 27.382812 9.867188 29.507812 C 10.078125 29.59375 10.300781 29.683594 10.519531 29.761719 L 2.929688 9.570312 C 2.277344 9.546875 2.152344 9.585938 1.6875 9.5625 Z M 1.6875 9.5625 "/><path style=" stroke:none;fill-rule:nonzero;fill:#ffffff;fill-opacity:1;" d="M 30.210938 9.160156 C 29.859375 8.425781 29.441406 7.722656 28.976562 7.058594 C 28.847656 6.867188 28.699219 6.675781 28.5625 6.488281 C 26.804688 4.210938 24.414062 2.421875 21.628906 1.378906 C 19.882812 0.714844 17.972656 0.351562 15.980469 0.351562 C 11.058594 0.351562 6.660156 2.566406 3.785156 6.019531 C 3.253906 6.652344 2.78125 7.332031 2.355469 8.046875 C 3.515625 8.054688 4.953125 8.054688 5.117188 8.054688 C 6.59375 8.054688 8.871094 7.878906 8.871094 7.878906 C 9.640625 7.832031 9.71875 8.914062 8.960938 9.003906 C 8.960938 9.003906 8.195312 9.089844 7.34375 9.128906 L 12.480469 23.917969 L 15.566406 14.957031 L 13.378906 9.136719 C 12.609375 9.097656 11.898438 9.011719 11.898438 9.011719 C 11.132812 8.972656 11.230469 7.839844 11.980469 7.886719 C 11.980469 7.886719 14.308594 8.0625 15.695312 8.0625 C 17.171875 8.0625 19.453125 7.886719 19.453125 7.886719 C 20.210938 7.839844 20.308594 8.921875 19.539062 9.011719 C 19.539062 9.011719 18.78125 9.097656 17.933594 9.136719 L 23.019531 23.816406 L 24.429688 19.257812 C 25.140625 17.488281 25.5 16.023438 25.5 14.855469 C 25.5 13.171875 24.871094 12 24.332031 11.089844 C 23.621094 9.960938 22.953125 9.011719 22.953125 7.894531 C 22.953125 6.636719 23.933594 5.46875 25.320312 5.46875 C 25.378906 5.46875 25.441406 5.46875 25.5 5.46875 C 27.640625 5.414062 28.339844 7.46875 28.429688 8.867188 C 28.429688 8.867188 28.429688 8.898438 28.429688 8.914062 C 28.464844 9.484375 28.4375 9.902344 28.4375 10.402344 C 28.4375 11.777344 28.167969 13.335938 27.371094 15.289062 L 24.1875 24.210938 L 22.367188 29.40625 C 22.511719 29.34375 22.652344 29.277344 22.796875 29.207031 C 27.425781 27.042969 30.796875 22.722656 31.507812 17.605469 C 31.613281 16.933594 31.664062 16.246094 31.664062 15.550781 C 31.664062 13.265625 31.140625 11.097656 30.210938 9.160156 Z M 30.210938 9.160156 "/></g></svg>';
904 }
905 }
906
907
908 /*
909 * This function is used to display the success/error notice for settings saving. This function is not used currently.
910 *
911 * @input NULL
912 * @return NULL
913 */
914 if ( ! function_exists( 'wpf_admin_notice_success' ) ) {
915 function wpf_admin_notice_success() {
916 if ( isset( $_GET['wpf_setting'] ) && $_GET['wpf_setting'] == 1 ) {
917 ?>
918 <div class="notice notice-success is-dismissible">
919 <p><?php _e( 'Your settings have been saved!', 'wpfeedback' ); ?></p>
920 </div>
921 <?php }
922
923 if ( isset( $_GET['wpf_setting'] ) && $_GET['wpf_setting'] == 0 ) {
924 ?>
925 <div class="error notice is-dismissible">
926 <p><?php _e( 'Your Settings not saved. ', 'wpfeedback' ); ?></p>
927 </div>
928 <?php }
929 }
930 }
931 //add_action( 'admin_notices', 'wpf_admin_notice_success' );
932
933 /*
934 * This function is used to get the role of current logged in user. This function is not used currently.
935 *
936 * @input NULL
937 * @return String
938 */
939 if ( ! function_exists( 'wpf_get_current_user_roles' ) ) {
940 function wpf_get_current_user_roles() {
941 if ( is_user_logged_in() ) {
942 $user = wp_get_current_user();
943 $roles = ( array )$user->roles;
944 return $roles[0];
945 } else {
946 return 'Guest';
947 }
948 }
949 }
950
951
952 if ( ! function_exists( 'wpf_get_current_user_information' ) ) {
953 function wpf_get_current_user_information( $author_id = '' ) {
954 $response = array();
955 if ( ! is_user_logged_in() ) {
956 $wpfb_users_json = do_shortcode( '[wpf_user_list_front]' );
957 $wpfb_users = json_decode( $wpfb_users_json );
958 $wpf_website_developer = !empty( get_site_data_by_key( 'wpf_website_client' ) ) ? get_site_data_by_key( 'wpf_website_client' ) : 0;
959 }
960
961 if ( $author_id != '' ) {
962 $user = get_userdata( $author_id );
963 $user_details = ( array )$user->data;
964 $roles = ( array )$user->roles;
965 $roles = array_values( $roles );
966 $response['first_name'] = $user_details['first_name'] ?? "";
967 $response['last_name'] = $user_details['last_name'] ?? "";
968 $response['display_name'] = $user_details['display_name'];
969 $response['user_id'] = $user_details['ID'];
970 $response['role'] = $roles[0];
971 return $response;
972 } elseif ( is_user_logged_in() == true ) {
973 $user = wp_get_current_user();
974 $user_details = ( array )$user->data;
975 $roles = ( array )$user->roles;
976 $roles = array_values( $roles );
977 // to ge the first and last name
978 $user_meta = get_user_meta( $user_details['ID'] );
979 $response['first_name'] = ( ! empty( $user_meta['first_name'][0] ) ) ? $user_meta['first_name'][0] : "";
980 $response['last_name'] = ( ! empty( $user_meta['last_name'][0] ) ) ? $user_meta['last_name'][0] : "";
981 $response['display_name'] = $user_details['display_name'];
982 $response['user_id'] = $user_details['ID'];
983 $response['role'] = $roles[0];
984 return $response;
985 } elseif ( $wpf_website_developer != 0 ) {
986 foreach ( $wpfb_users as $key => $val ) {
987 if ( $wpf_website_developer == $key ) {
988 /**
989 * user id was not matching in graphics page when guest mode on and default user selected
990 * => v2.1.0
991 */
992 if ( intval( $wpf_website_developer ) > 0 ) {
993 $user = get_user_by( 'id', $val->username );
994 $response['first_name'] = $val->first_name ?? "";
995 $response['last_name'] = $val->last_name ?? "";
996 $response['display_name'] = $val->displayname;
997 $response['user_id'] = $wpf_website_developer;
998
999 if ( ! empty( $user->roles ) ) {
1000 $roles = array_values( $user->roles );
1001 $response['role'] = $roles[0];
1002 } else {
1003 $response['role'] = 'Guest';
1004 }
1005 } else {
1006 $response['first_name'] = $val->first_name ?? "";
1007 $response['last_name'] = $val->last_name ?? "";
1008 $response['display_name'] = $val->displayname;
1009 $response['user_id'] = 0;
1010 $response['role'] = 'Guest';
1011 }
1012 return $response;
1013 }
1014 }
1015
1016 $response['display_name'] = 'Guest';
1017 $response['user_id'] = 0;
1018 $response['role'] = 'Guest';
1019 return $response;
1020 } else {
1021 $response['display_name'] = 'Guest';
1022 $response['user_id'] = 0;
1023 $response['role'] = 'Guest';
1024 return $response;
1025 }
1026 }
1027 }
1028
1029 /*
1030 * This function is used to get the time difference between two timestamps. It is basically used to get the time difference between current time and the time when comment was posted.
1031 *
1032 * @input Timestamp, Timestamp
1033 * @return Array
1034 */
1035 if ( ! function_exists( 'wpfb_time_difference' ) ) {
1036 function wpfb_time_difference( $datetime1, $datetime2 ) {
1037 $response = array();
1038 $interval = date_diff( $datetime1, $datetime2 );
1039 if ( $interval->y == 0 ) {
1040 if ( $interval->m == 0 ) {
1041 if ( $interval->d == 0 ) {
1042 if ( $interval->h == 0 ) {
1043 if ( $interval->i == 0 ) {
1044 $comment_time = $interval->s . __( 'sec', 'wpfeedback' );
1045 } else {
1046 $comment_time = $interval->i . __( 'min', 'wpfeedback' );
1047 }
1048 } else {
1049 $comment_time = $interval->h . __( 'hr', 'wpfeedback' );
1050 }
1051 } else {
1052 $comment_time = $interval->d . __( 'd', 'wpfeedback' );
1053 }
1054 } else {
1055 $comment_time = $interval->m . __( 'month', 'wpfeedback' );
1056 }
1057 } else {
1058 $comment_time = $interval->y . __( 'year', 'wpfeedback' );
1059 }
1060 $response['interval'] = $interval;
1061 $response['comment_time'] = $comment_time;
1062 return $response;
1063 }
1064 }
1065
1066 /*
1067 * This function is used to get the listing of status and priorities inside the Tasks Center.
1068 *
1069 * @input String
1070 * @return String
1071 */
1072 if ( ! function_exists( 'wp_feedback_get_texonomy_selectbox' ) ) {
1073 function wp_feedback_get_texonomy_selectbox( $my_term ) {
1074 $filter_data_db = get_option( 'filter_data' )[$my_term];
1075
1076 //edited by Pratap
1077 $disable = '';
1078 if ( $my_term == 'task_status' || $my_term == 'task_priority' ) {
1079 if ( !is_feature_enabled( 'task_center' ) ) {
1080 $disable = 'disabled';
1081 }
1082 }
1083
1084 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
1085 echo '<select id="task_' . $my_term . '_attr" onchange="' . $my_term . '_changed(this);" '. $disable .'>';
1086 foreach ( $filter_data_db as $term ) {
1087 if ( $term['label'] == 'In Progress' ) {
1088 $term['label'] = 'In Prog';
1089 } elseif ( $term['label'] == 'Pending Review' ) {
1090 $term['label'] = 'Pending';
1091 } else {
1092 $term['label'] = $term['label'];
1093 }
1094 echo '<option name="' . $my_term . '" value="' . $term['value'] . '" class="wpf_task" id="wpf_' . $term['value'] . '"/>' . __( $term['label'], 'wpfeedback' ) . '</option>';
1095 }
1096 echo '</select>';
1097 }
1098 }
1099 }
1100
1101 /*
1102 * This function is used to check if Atarim is enabled on the website.
1103 *
1104 * @input Int
1105 * @return Boolean
1106 */
1107 if ( ! function_exists( 'wpf_check_if_enable' ) ) {
1108 function wpf_check_if_enable( $author_id = '' ) {
1109 if ( $author_id == '' ) {
1110 $current_user_information = wpf_get_current_user_information();
1111 $user = wp_get_current_user();
1112 } else {
1113 $current_user_information = wpf_get_current_user_information( $author_id );
1114 $user = get_userdata( $author_id );
1115 }
1116
1117 $wpf_license = get_option( 'wpf_license' );
1118 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1119 $wpf_selcted_role = get_site_data_by_key( 'wpf_selcted_role' );
1120 $wpf_allow_guest = get_site_data_by_key( 'wpf_allow_guest' );
1121 $selected_roles = explode( ',', $wpf_selcted_role );
1122 $user_details = ( array )$user->data;
1123 $roles = ( array )$user->roles;
1124 $roles = array_values( $roles );
1125
1126 if ( $wpf_license == 'valid' && $wpf_enabled == 'yes' && ( ! empty( array_intersect( $roles, $selected_roles ) ) || $wpf_allow_guest == 'yes' ) ) {
1127 $wpf_access_output = 1;
1128 } else {
1129 $wpf_access_output = 0;
1130 }
1131 return $wpf_access_output;
1132 }
1133 }
1134
1135 /*
1136 * This function is used to get extra user settings for the Atarim.
1137 *
1138 * @input Object
1139 * @return NULL
1140 */
1141 if ( ! function_exists( 'wpf_show_extra_profile_fields' ) ) {
1142 function wpf_show_extra_profile_fields( $user ) {
1143 $wpf_get_user_type = get_user_meta( $user->ID, 'wpf_user_type', true );
1144 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
1145 $selected_roles = explode( ',', $selected_roles );
1146 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1147 if ( ( array_intersect( $user->roles, $selected_roles ) && $wpf_enabled == 'yes' ) || current_user_can( 'administrator' ) ) {
1148 $notifications_html = wpf_get_allowed_notification_list( $user->ID, 'no' );
1149 ?>
1150 <h3><?php _e( 'Collaborate Information', 'wpfeedback' ); ?></h3>
1151 <table class="form-table wpf_fields">
1152 <tr>
1153 <th><label for="wpf_user_type"><?php _e( "User Type", 'wpfeedback' ); ?></label></th>
1154 <td>
1155 <select id="wpf_user_type" name="wpf_user_type">
1156 <option value="" <?php if ( $wpf_get_user_type == '' ) { echo 'selected'; } ?> ><?php _e( 'Select', 'wpfeedback' ) ?></option>
1157 <option value="king" <?php if ( $wpf_get_user_type == 'king' ) { echo 'selected'; } ?> ><?php echo ! empty( get_site_data_by_key( 'wpf_customisations_client' ) ) ? get_site_data_by_key( 'wpf_customisations_client' ) : 'Client (Website Owner)'; ?></option>
1158 <option value="advisor" <?php if ( $wpf_get_user_type == 'advisor' ) { echo 'selected'; } ?> ><?php echo ! empty( get_site_data_by_key( 'wpf_customisations_webmaster' ) ) ? get_site_data_by_key( 'wpf_customisations_webmaster' ) : 'Webmaster'; ?></option>
1159 <option value="council" <?php if ( $wpf_get_user_type == 'council' ) { echo 'selected'; } ?> ><?php echo ! empty( get_site_data_by_key( 'wpf_customisations_others' ) ) ? get_site_data_by_key( 'wpf_customisations_others' ) : 'Others'; ?></option>
1160 </select>
1161 </td>
1162 </tr>
1163 <tr>
1164 <th><label for="city"><?php _e( "Email notifications", 'wpfeedback' ); ?></label></th>
1165 <td>
1166 <?php echo $notifications_html; ?>
1167 </td>
1168 </tr>
1169 </table>
1170 <?php
1171 }
1172 }
1173 }
1174 add_action( 'show_user_profile', 'wpf_show_extra_profile_fields' );
1175 add_action( 'edit_user_profile', 'wpf_show_extra_profile_fields' );
1176
1177 /*
1178 * This function is used to save the extra user settings for the Atarim.
1179 *
1180 * @input Int
1181 * @return Boolean
1182 */
1183 if ( ! function_exists( 'wpf_save_user_profile_fields' ) ) {
1184 function wpf_save_user_profile_fields( $user_id ) {
1185 syncUsers();
1186 $user = get_userdata( $user_id );
1187 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
1188 $selected_roles = explode( ',', $selected_roles );
1189 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1190 $args = array(
1191 'wpf_site_id' => get_option( 'wpf_site_id' ),
1192 'wpf_id' => sanitize_text_field( $_POST['user_id'] ),
1193 'username' => $user->data->user_login,
1194 'wpf_email' => sanitize_email( $_POST['email'] ),
1195 'first_name' => sanitize_text_field( $_POST['first_name'] ),
1196 'last_name' => sanitize_text_field( $_POST['last_name'] ),
1197 'wpf_user_type' => sanitize_text_field( $_POST['wpf_user_type'] ),
1198 );
1199
1200 update_user_meta( $user->ID, 'wpf_user_type', sanitize_text_field( $_POST['wpf_user_type'] ) );
1201
1202 if ( ( array_intersect( $user->roles, $selected_roles ) && $wpf_enabled == 'yes' && current_user_can( 'edit_user', $user_id ) ) || current_user_can( 'administrator' ) ) {
1203 $options = [];
1204 $options['wpf_site_id'] = get_option( 'wpf_site_id' );
1205 $options['wpf_every_new_task'] = isset( $_POST['wpf_every_new_task'] ) ? 1 : 0;
1206 $options['wpf_every_new_comment'] = isset( $_POST['wpf_every_new_comment'] ) ? 1 : 0;
1207 $options['wpf_every_new_complete'] = isset( $_POST['wpf_every_new_complete'] ) ? 1 : 0;
1208 $options['wpf_every_status_change'] = isset( $_POST['wpf_every_status_change'] ) ? 1 : 0;
1209 $options['wpf_daily_report'] = isset( $_POST['wpf_daily_report'] ) ? 1 : 0;
1210 $options['wpf_weekly_report'] = isset( $_POST['wpf_weekly_report'] ) ? 1 : 0;
1211 $options['wpf_auto_daily_report'] = isset( $_POST['wpf_auto_daily_report'] ) ? 1 : 0;
1212 $options['wpf_auto_weekly_report'] = isset( $_POST['wpf_auto_weekly_report'] ) ? 1 : 0;
1213 $args['notifications'] = $options;
1214 $url = WPF_CRM_API . 'wp-api/wpfuser/update';
1215 $res = wpf_send_remote_post( $url, json_encode( $args ) );
1216 } else {
1217 return false;
1218 }
1219 }
1220 }
1221 add_action( 'personal_options_update', 'wpf_save_user_profile_fields' );
1222 add_action( 'edit_user_profile_update', 'wpf_save_user_profile_fields' );
1223
1224 // sync users
1225 function wpf_sync_users( $user_id ) {
1226 syncUsers();
1227 }
1228 add_action( 'user_register', 'wpf_sync_users' );
1229 add_action( 'deleted_user', 'wpf_sync_users', 10 );
1230 add_action( 'profile_update', 'wpf_sync_users', 10 );
1231
1232 // sync pages
1233 function wpf_sync_posts( $post_id ) {
1234 syncPages();
1235 }
1236 add_action( 'save_post', 'wpf_sync_posts' );
1237 add_action( 'delete_post', 'wpf_sync_posts', 10 );
1238
1239 /* update WP pages into API */
1240 function syncPages() {
1241 $pages = wpf_get_page_list( 'api' );
1242 $args = [];
1243 $args['wpf_site_id'] = get_option( 'wpf_site_id' );
1244 $args['responseBody'] = json_decode( $pages );
1245 $url = WPF_CRM_API . "wp-api/sync/pages";
1246 $sendtocloud = json_encode( $args );
1247 $res = wpf_send_remote_post( $url, $sendtocloud );
1248 }
1249
1250 /* update WP users into API */
1251 function syncUsers() {
1252 $users = wpf_api_func_get_users();
1253 $args = [];
1254 $args['wpf_site_id'] = get_option( 'wpf_site_id' );
1255 $args['responseBody'] = json_decode( $users );
1256 // get all the user ID
1257 $wp_users = get_users( array( 'fields' => array( 'ID' ) ) );
1258 // flaten the data to a single array and added to the request
1259 $args['wpf_wp_user_ids'] = array_map( function( $user ) {
1260 return $user->ID;
1261 }, $wp_users );
1262
1263 $url = WPF_CRM_API . "wp-api/sync/users";
1264 $sendtocloud = json_encode( $args );
1265 $res = wpf_send_remote_post( $url, $sendtocloud );
1266 if ( isset( $res['status'] ) == 200 ) {
1267 get_notif_sitedata_filterdata();
1268 }
1269 }
1270
1271
1272 function syncSite() {
1273 $url = WPF_CRM_API . 'wp-api/wpfsite/update';
1274 $response = array();
1275 $response['wpf_site_id'] = get_option( 'wpf_site_id' );
1276 $response['url'] = get_option( 'siteurl' );
1277 $response['name'] = get_option( 'blogname' );
1278 $body = json_encode( $response );
1279 $res = wpf_send_remote_post( $url, $body );
1280 }
1281
1282 add_action( 'update_option_blogname', function( $old_value, $new_value ) {
1283 syncSite();
1284 }, 10, 2);
1285
1286 add_action( 'update_option_siteurl', function( $old_value, $new_value ) {
1287 syncSite();
1288 }, 10, 2);
1289
1290 /*
1291 * This function is used to get the allowed notification list to be displayed on the users extra settings.
1292 *
1293 * @input Int, String
1294 * @return String
1295 */
1296 if ( ! function_exists( 'wpf_get_allowed_notification_list' ) ) {
1297 function wpf_get_allowed_notification_list( $userid, $default = 'no' ) {
1298 $wpf_site_id = get_option( 'wpf_site_id' );
1299 $args = [];
1300 $args['wpf_site_id'] = $wpf_site_id;
1301 $args['wpf_user_id'] = $userid;
1302 $url = WPF_CRM_API . "wp-api/wpfuser/getWpfUser";
1303 $sendtocloud = json_encode( $args );
1304 $res = wpf_send_remote_post( $url, $sendtocloud );
1305 $response = '';
1306 $wpf_every_new_task = get_site_data_by_key( 'wpf_every_new_task' );
1307 $wpf_every_new_comment = get_site_data_by_key( 'wpf_every_new_comment' );
1308 $wpf_every_new_complete = get_site_data_by_key( 'wpf_every_new_complete' );
1309 $wpf_every_status_change = get_site_data_by_key( 'wpf_every_status_change' );
1310 $wpf_daily_report = get_site_data_by_key( 'wpf_daily_report' );
1311 $wpf_weekly_report = get_site_data_by_key( 'wpf_weekly_report' );
1312 $wpf_auto_daily_report = get_site_data_by_key( 'wpf_auto_daily_report' );
1313 $wpf_auto_weekly_report = get_site_data_by_key( 'wpf_auto_weekly_report' );
1314 if ( $wpf_every_new_task == 'yes' ) {
1315 if ( isset( $res['data']['preference']['every_new_task'] ) && $res['data']['preference']['every_new_task'] == 1 ) {
1316 $checked = 'checked';
1317 } else {
1318 $checked = '';
1319 }
1320 if ( $default == 'yes' ) {
1321 $checked = 'checked';
1322 }
1323 $response .= '<div><input type="checkbox" name="wpf_every_new_task" value="yes" class="wpf_checkbox"
1324 id="wpf_every_new_task" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_every_new_task">' . __( 'Receive email notification for every new task', 'wpfeedback' ) . '</label></div>';
1325 }
1326 if ( $wpf_every_new_comment == 'yes' ) {
1327 if ( isset( $res['data']['preference']['every_new_comment'] ) && $res['data']['preference']['every_new_comment'] == 1 ) {
1328 $checked = 'checked';
1329 } else {
1330 $checked = '';
1331 }
1332 if ( $default == 'yes' ) {
1333 $checked = 'checked';
1334 }
1335 $response .= '<div><input type="checkbox" name="wpf_every_new_comment" value="yes" class="wpf_checkbox"
1336 id="wpf_every_new_comment" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_every_new_comment">' . __( 'Receive email notification for every new comment', 'wpfeedback' ) . '</label></div>';
1337 }
1338 if ( $wpf_every_new_complete == 'yes' ) {
1339 if ( isset( $res['data']['preference']['wpf_every_new_complete'] ) && $res['data']['preference']['wpf_every_new_complete'] == 1 ) {
1340 $checked = 'checked';
1341 } else {
1342 $checked = '';
1343 }
1344 if ( $default == 'yes' ) {
1345 $checked = 'checked';
1346 }
1347 $response .= '<div><input type="checkbox" name="wpf_every_new_complete" value="yes" class="wpf_checkbox"
1348 id="wpf_every_new_complete" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_every_new_complete">' . __( 'Receive email notification when a task is marked as complete', 'wpfeedback' ) . '</label></div>';
1349 }
1350 if ( $wpf_every_status_change == 'yes' ) {
1351 if ( isset( $res['data']['preference']['every_status_change'] ) && $res['data']['preference']['every_status_change'] == 1 ) {
1352 $checked = 'checked';
1353 } else {
1354 $checked = '';
1355 }
1356 if ( $default == 'yes' ) {
1357 $checked = 'checked';
1358 }
1359 $response .= '<div><input type="checkbox" name="wpf_every_status_change" value="yes" class="wpf_checkbox"
1360 id="wpf_every_status_change" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_every_status_change">' . __( 'Receive email notification for every status change', 'wpfeedback' ) . '</label></div>';
1361 }
1362 if ( $wpf_daily_report == 'yes' ) {
1363 if ( isset( $res['data']['preference']['daily_report'] ) && $res['data']['preference']['daily_report'] == 1 ) {
1364 $checked='checked';
1365 } else {
1366 $checked = '';
1367 }
1368 if ( $default == 'yes' ) {
1369 $checked = 'checked';
1370 }
1371 $response .= '<div><input type="checkbox" name="wpf_daily_report" value="yes" class="wpf_checkbox"
1372 id="wpf_daily_report" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_daily_report">' . __( 'Receive email notification for daily report', 'wpfeedback' ) . '</label></div>';
1373 }
1374 if ( $wpf_weekly_report == 'yes' ) {
1375 if ( isset( $res['data']['preference']['weekly_report'] ) && $res['data']['preference']['weekly_report'] == 1 ) {
1376 $checked='checked';
1377 } else {
1378 $checked = '';
1379 }
1380 if ( $default == 'yes' ) {
1381 $checked = 'checked';
1382 }
1383 $response .= '<div><input type="checkbox" name="wpf_weekly_report" value="yes" class="wpf_checkbox"
1384 id="wpf_weekly_report" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_weekly_report">' . __( 'Receive email notification for weekly report', 'wpfeedback' ) . '</label></div>';
1385 }
1386 if ( is_feature_enabled( 'auto_reports' ) ) {
1387 if ( $wpf_auto_daily_report == 'yes' ) {
1388 if ( isset( $res['data']['preference']['wpf_auto_daily_report'] ) && $res['data']['preference']['wpf_auto_daily_report'] == 1 ) {
1389 $checked = 'checked';
1390 } else {
1391 $checked = '';
1392 }
1393 if ( $default == 'yes' ) {
1394 $checked = 'checked';
1395 }
1396 $response .= '<div><input type="checkbox" class="wpf_checkbox" name="wpf_auto_daily_report" value="yes" id="wpf_auto_daily_report" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_auto_daily_report">' . __( 'Auto receive email notification for daily report', 'wpfeedback' ) . '</label></div>';
1397 }
1398 if ( $wpf_auto_weekly_report == 'yes' ) {
1399 if ( isset( $res['data']['preference']['wpf_auto_weekly_report'] ) && $res['data']['preference']['wpf_auto_weekly_report'] == 1 ) {
1400 $checked = 'checked';
1401 } else {
1402 $checked = '';
1403 }
1404 if ( $default == 'yes' ) {
1405 $checked = 'checked';
1406 }
1407 $response .= '<div><input type="checkbox" name="wpf_auto_weekly_report" value="yes" class="wpf_checkbox"
1408 id="wpf_auto_weekly_report" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_auto_weekly_report">' . __( 'Auto receive email notification for weekly report', 'wpfeedback' ) . '</label></div>';
1409 }
1410 }
1411 return $response;
1412 }
1413 }
1414
1415 /*
1416 * This function is used to get the Atarim user type.
1417 *
1418 * @input NULL
1419 * @return String
1420 */
1421 if ( ! function_exists( 'wpf_user_type' ) ) {
1422 function wpf_user_type() {
1423 global $current_user;
1424 return get_user_meta( $current_user->ID, 'wpf_user_type', true );
1425 }
1426 }
1427
1428 /*
1429 * This function is used to verify if the uploaded file is valid or not.
1430 *
1431 * @input File
1432 * @return Boolean
1433 */
1434 if ( ! function_exists( 'wpf_verify_file_upload' ) ) {
1435 function wpf_verify_file_upload( $server, $file_data ) {
1436 $allowed_file_types = array( 'image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'text/plain', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','video/webm','video/mp4','video/mov','video/wmv','video/avi','font/ttf','text/plain' );
1437 if ( function_exists( 'finfo_open' ) ) {
1438 $imgdata = base64_decode( $file_data );
1439 $f = finfo_open();
1440 $mime_type = finfo_buffer( $f, $imgdata, FILEINFO_MIME_TYPE );
1441 if ( in_array( $mime_type, $allowed_file_types ) ) {
1442 $response = 0;
1443 } else {
1444 $response = 1;
1445 }
1446 } else {
1447 $response = 0;
1448 }
1449 return $response;
1450 }
1451 }
1452
1453 /*
1454 * This function is used to verify if the uploaded file extension is proper or not.
1455 *
1456 * @input String
1457 * @return Boolean
1458 */
1459 if ( ! function_exists( 'wpf_verify_file_upload_type' ) ) {
1460 function wpf_verify_file_upload_type( $server, $mime_type ) {
1461 $allowed_file_types = array( 'application/msword','image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'text/plain', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'video/webm', 'video/mp4', 'video/quicktime', 'video/x-ms-wmv', 'video/avi', 'font/ttf', 'text/plain' );
1462 if ( ! empty( $mime_type ) ) {
1463 if ( in_array( $mime_type, $allowed_file_types ) ) {
1464 $response = 0;
1465 } else {
1466 $response = 1;
1467 }
1468 } else {
1469 $response = 0;
1470 }
1471 return $response;
1472 }
1473 }
1474
1475 /*
1476 * This function is used to get the list of the pages on the website. It is called to get the dropdown list when creating a general task from backend.
1477 *
1478 * @input String
1479 * @return JSON
1480 */
1481 if ( ! function_exists( 'wpf_get_page_list' ) ) {
1482 function wpf_get_page_list( $type = 'task_page' ) {
1483 $response = array();
1484 if ( class_exists( 'WooCommerce' ) ) {
1485 $wpf_default_wp_post_types = array( "page" => "page", "post" => "post", "product" => "product" );
1486 } else {
1487 $wpf_default_wp_post_types = array( "page" => "page", "post" => "post" );
1488 }
1489 $wpf_wp_cpts = get_post_types( array( 'public' => true, 'exclude_from_search' => true, '_builtin' => false ) );
1490 $wpf_post_types = array_merge( $wpf_default_wp_post_types, $wpf_wp_cpts );
1491
1492 foreach ( $wpf_post_types as $wpf_post_type ) {
1493 $objType = get_post_type_object( $wpf_post_type );
1494 if ( $wpf_post_type == 'page' ) {
1495 $numberposts = -1;
1496 } else {
1497 $numberposts = 10;
1498 }
1499 $wpf_temp_arg = array(
1500 'post_type' => $wpf_post_type,
1501 'numberposts' => $numberposts,
1502 );
1503 $posts = get_posts( $wpf_temp_arg );
1504 $wpf_count_post = count( $posts );
1505 if ( $wpf_count_post ) {
1506 foreach ( $posts as $post ) {
1507 if ( $type == 'task_page' ) {
1508 $response[$objType->labels->singular_name][$post->ID] = htmlspecialchars( $post->post_title, ENT_QUOTES, 'UTF-8' );
1509 } else {
1510 $temp_res = array(
1511 'id' => $post->ID,
1512 'name' => htmlspecialchars( $post->post_title, ENT_QUOTES, 'UTF-8' ),
1513 'type' => $objType->labels->singular_name,
1514 'url' => get_permalink( $post->ID )
1515 );
1516 $response[] = $temp_res;
1517 }
1518 }
1519 }
1520 }
1521 return json_encode( $response );
1522 }
1523 }
1524
1525 /*
1526 * This function is used to deregister the scripts of the plugins that are conflicting with the Atarim.
1527 *
1528 * @input NULL
1529 * @return NULL
1530 */
1531 if ( ! function_exists( 'wpf_mootools_deregister_javascript' ) ) {
1532 function wpf_mootools_deregister_javascript() {
1533 if ( ! is_admin() ) {
1534 wp_deregister_script( 'mootools-local' );
1535 wp_deregister_script( 'enlighter-local' );
1536 wp_deregister_script( 'dct-carousel-jquery' );
1537 wp_deregister_script( 'onepress-js-plugins' );
1538 }
1539 }
1540 }
1541 add_action( 'wp_print_scripts', 'wpf_mootools_deregister_javascript', 99 );
1542
1543
1544 /*
1545 * This function is used to strip all the code elements from the data.
1546 *
1547 * @input String
1548 * @return String
1549 */
1550 if ( ! function_exists( 'wpf_test_input' ) ) {
1551 function wpf_test_input( $data ) {
1552 $data = trim( $data );
1553 $data = stripslashes( $data );
1554 $data = htmlspecialchars( $data );
1555 return $data;
1556 }
1557 }
1558
1559 /*
1560 * This function is used by all the ajax request to make user that they are coming from authentic source.
1561 *
1562 * @input NULL
1563 * @return String
1564 */
1565 function wpf_security_check() {
1566 $roles = array();
1567 $user = wp_get_current_user();
1568 $user_details = ( array )$user->data;
1569 $roles = ( array )$user->roles;
1570 $roles = array_values( $roles );
1571 if ( ! check_ajax_referer( 'wpfeedback-script-nonce', 'wpf_nonce' ) ) {
1572 echo 'Invalid security token sent.';
1573 wp_die();
1574 } else {
1575 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
1576 $selected_roles = explode( ',', $selected_roles );
1577 if ( ! in_array( "administrator", $selected_roles ) ) {
1578 array_push( $selected_roles, "administrator" );
1579 }
1580 $wpf_allow_guest = get_site_data_by_key( 'wpf_allow_guest' );
1581 if ( $wpf_allow_guest == 'yes' ) {
1582 $selected_roles[] = 'Guest';
1583 $roles[] = 'Guest';
1584 }
1585 if ( empty( array_intersect( $roles, $selected_roles ) ) ) {
1586 echo 'Invalid user.';
1587 wp_die();
1588 }
1589 }
1590 }
1591 add_filter( 'get_comment_text', 'make_clickable', 99 );
1592
1593 /*
1594 * This function is to get the listing of status and priority for the sidebar filters.
1595 *
1596 * @input String
1597 * @return String
1598 */
1599 if ( ! function_exists( 'wp_feedback_get_texonomy_filter' ) ) {
1600 function wp_feedback_get_texonomy_filter( $my_term ) {
1601 $output = '';
1602 $filter_data_db = get_option( 'filter_data' )[$my_term];
1603
1604 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
1605 $output .= '<ul class="wpf_filter_checkbox" id="wpf_sidebar_filter_' . $my_term . '">';
1606 foreach ( $filter_data_db as $term ) {
1607 if ( $term['label'] == 'In Progress' ) {
1608 $term['label'] = 'In Prog';
1609 } elseif ( $term['label'] == 'Pending Review' ) {
1610 $term['label'] = 'Pending';
1611 } else {
1612 $term['label'] = $term['label'];
1613 }
1614 $output .= '<li><input type="checkbox" name="wpf_filter_' . $my_term . '" value="' . $term['value'] . '" class="wp_feedback_task wpf_checkbox" id="wpf_sidebar_filter_' . $term['value'] . '" /><label for="wpf_sidebar_filter_' . $term['value'] . '" class="wpf_checkbox_label">' . __( $term['label'], 'wpfeedback' ) . '</label></li>';
1615 }
1616 $output .= '</ul><a class="wpf_sidebar_filter_reset_' . $my_term . '" href="javascript:void(0)">'. __( 'Reset', 'wpfeedback' ) . '</a>';
1617 return $output;
1618 }
1619 }
1620 }
1621
1622 /*
1623 * This function is used to encrypt and decrypt the license key.
1624 *
1625 * @input String, String
1626 * @return String
1627 */
1628 function wpf_crypt_key( $string, $action = 'e' ) {
1629 if ( strlen( $string ) == 32 ) {
1630 return $string;
1631 }
1632 $wpf_decr_key = get_option( 'wpf_decr_key' );
1633 $wpf_decr_checksum = get_option( 'wpf_decr_checksum' );
1634 $output = false;
1635 $encrypt_method = "AES-256-CBC";
1636 $key = hash( 'sha256', $wpf_decr_key );
1637 $iv = substr( hash( 'sha256', $wpf_decr_checksum ), 0, 16 );
1638
1639 if ( $action == 'e' ) {
1640 $output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) );
1641 } elseif ( $action == 'd' ) {
1642 $output = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv );
1643 update_option( 'wpf_license_key', $output, 'no' );
1644 }
1645 return $output;
1646 }
1647
1648 /*========WPF Login Form========*/
1649 /*
1650 * This function is used to get the login form.
1651 *
1652 * @input NULL
1653 * @return String
1654 */
1655 function wpf_login_form() {
1656 $output = '';
1657 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1658 if ( ! is_user_logged_in() && $wpf_enabled == 'yes' ) {
1659 $output = '<div id="login_form_content"><p><b>Dive straight into the feedback!</b></br>Login below and you can start commenting using your own user instantly</p><form id="wpf_login" method="post"><div class="wpf_user"><label for="username"></label><input id="username" placeholder="Username OR Email Address" type="text" name="username"></div><div class="wpf_password"><label for="password"></label><input id="password" placeholder="Password" type="password" name="password"></div>'. wp_nonce_field( 'wpfeedback-script-nonce', 'wpf_security', true, false ) . '<input class="wpf_submit_button" type="submit" value="Login and start commenting" name="submit"><p class="wpf_status"></p></form></div>';
1660 }
1661 return $output;
1662 }
1663 add_shortcode( 'wpf_login_form', 'wpf_login_form' );
1664
1665
1666 /*
1667 * This function is used to manage the errors generated while logging in from Atarim login modal.
1668 *
1669 * @input NULL
1670 * @return String
1671 */
1672 function wpf_user_errors() {
1673 static $wp_error; // Will hold global variable safely
1674 return isset( $wp_error ) ? $wp_error : ( $wp_error = new WP_Error( null, null, null ) );
1675 }
1676
1677 /*
1678 * This function is used to handle login from the Atarim login modal.
1679 *
1680 * @input NULL
1681 * @return JSON
1682 */
1683 function wpf_ajax_login() {
1684 global $wpdb;
1685 // First check the nonce, if it fails the function will break
1686 check_ajax_referer( 'wpfeedback-script-nonce', 'wpf_security' );
1687
1688 // Nonce is checked, get the POST data and sign user on
1689 $info = array();
1690 $info['user_login'] = sanitize_text_field( $_POST['username'] );
1691 $info['user_password'] = sanitize_text_field( $_POST['password'] );
1692 $info['remember'] = true;
1693 $user_name = sanitize_text_field( $_POST['username'] );
1694 $user_login = '';
1695 $user = '';
1696
1697 $resultsap = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}users WHERE user_login = %s OR user_email = %s limit 1", $user_name, $user_name ) , ARRAY_A );
1698 if ( $resultsap ) {
1699 $user_login = isset( $resultsap[0]['user_login'] ) ? $resultsap[0]['user_login'] : "";
1700 $user = get_user_by( 'login', $user_login );
1701 }
1702 if ( ! $user ) {
1703 // if the user name doesn't exist
1704 wpf_user_errors()->add( 'empty_username', __( 'Invalid username' ) );
1705 }
1706
1707 if ( ! isset( $_POST['password'] ) || $_POST['password'] == '' ) {
1708 // if no password was entered
1709 wpf_user_errors()->add( 'empty_password', __( 'Please enter a password' ) );
1710 }
1711
1712 // check the user's login with their password
1713 if ( ! wp_check_password( $_POST['password'], $user->user_pass, $user->ID ) ) {
1714 // if the password is incorrect for the specified user
1715 wpf_user_errors()->add( 'empty_password', __( 'Incorrect password' ) );
1716 }
1717 // retrieve all error messages
1718 $errors = wpf_user_errors()->get_error_messages();
1719 if ( ! empty( $errors ) ) {
1720 echo json_encode( array( 'loggedin' => false, 'message' => __( 'Wrong username or password.' ) ) );
1721 } else {
1722 wp_set_auth_cookie( $user->ID, true );
1723 wp_set_current_user( $user->ID, $_POST['username'] );
1724 echo json_encode( array( 'loggedin' => true, 'message' => __( 'Login successful, redirecting...' ) ) );
1725 }
1726 die();
1727 }
1728 // Enable the user with no privileges to run ajax_login() in AJAX
1729 add_action( 'wp_ajax_nopriv_wpf_ajaxlogin', 'wpf_ajax_login' );
1730
1731 /*
1732 * This function is used to start the color picker.
1733 *
1734 * @input NULL
1735 * @return NULL
1736 */
1737 if ( ! ( isset( $_GET['ct_builder'] ) ) && ! ( isset( $_GET['ct_inner'] ) ) ) {
1738 function wpf_enqueue_color_picker( $hook_suffix ) {
1739 wp_enqueue_style( 'wp-color-picker' );
1740 if ( ! ( isset( $_GET['et_tb'] ) ) && ! ( isset( $_GET['et_fb'] ) ) ) {
1741 wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
1742 }
1743 }
1744 add_action( 'wp_enqueue_scripts', 'wpf_enqueue_color_picker' );
1745 }
1746
1747 /*=====================Graphics feature Start=====================*/
1748 /*
1749 * This function is used to get the list of the graphics version on the graphics cpt.
1750 *
1751 * @input Int
1752 * @return String
1753 */
1754 function wpf_grapgics_version_list( $dataver, $post_id ) {
1755 $data = $dataver;
1756 $output = '';
1757 $i = '';
1758 $all_graphics_ids_array = array();
1759 $output = '<select id="wpf_graphics_version" onchange="change_graphics_version(this)">';
1760
1761 if ( isset( $data['image'] ) && count( $data['image'] ) > 0 ) {
1762 $i = 0;
1763 foreach ( $data['image'] as $all_graphics_id ) {
1764 $selected = "";
1765 if ( $i == 0 ) {
1766 $selected = "selected";
1767 }
1768 $output .= '<option name="wpf_graphics_id" value="' . $all_graphics_id['version'] . '" class="wpf_graphics_version" data-src="' . $all_graphics_id['image'] . '" ' . $selected . '> ' . __( "Version", "wpfeedback" ) . " " . $all_graphics_id['version'] . ' </option>';
1769 $i++;
1770 }
1771 }
1772 $output .= '</select>';
1773 return $output;
1774 }
1775
1776 /*
1777 * This function is used to define all the tags and theme color for Atarim.
1778 *
1779 * @input NULL
1780 * @return NULL
1781 */
1782 function wpf_all_tags() {
1783 $task_list_tags_array = '';
1784 $url = WPF_CRM_API . 'wp-api/list/tagsBySiteID';
1785 $sendarr = array();
1786 $sendarr["wpf_site_id"] = get_option( 'wpf_site_id' );
1787 $sendtocloud = json_encode( $sendarr );
1788 $res = wpf_send_remote_post( $url, $sendtocloud );
1789 if ( isset( $res['data'] ) && $res['status'] == 200 ) {
1790 $task_list_tags_array .= implode( '","', $res['data'] );
1791 }
1792 ?>
1793 <script type="text/javascript">var wpf_all_tags = ["<?php echo $task_list_tags_array; ?>"]; </script>
1794 <style type="text/css">
1795 :root {
1796 --main-wpf-color: #<?php echo ( get_site_data_by_key( 'wpfeedback_color' ) != "" ) ? str_replace( '#', '', get_site_data_by_key( 'wpfeedback_color' ) ) : "002157"; ?>;
1797 }
1798 </style>
1799 <?php
1800 }
1801 add_action( 'wp_footer', 'wpf_all_tags' );
1802 add_action( 'admin_footer', 'wpf_all_tags' );
1803
1804 /*
1805 * This function is used to get the unique elements from the object.
1806 *
1807 * @input Array, Boolean
1808 * @return Array
1809 */
1810 function wpf_object_array_unique( $array, $keep_key_assoc = false ) {
1811 $duplicate_keys = array();
1812 $tmp = array();
1813 foreach ( $array as $key => $val ) {
1814 if ( is_object( $val ) ) {
1815 $val = (array)$val;
1816 }
1817
1818 if ( ! in_array( $val, $tmp ) ) {
1819 $tmp[] = $val;
1820 } else {
1821 $duplicate_keys[] = $key;
1822 }
1823 }
1824
1825 foreach ( $duplicate_keys as $key ) {
1826 unset( $array[$key] );
1827 }
1828 return $keep_key_assoc ? $array : array_values( $array );
1829 }
1830
1831 /*
1832 * This function is used to check if the caching plugin is active on the website and deregister the Atarim CSS and JS if found.
1833 *
1834 * @input NULL
1835 * @return NULL
1836 */
1837 function wpf_check_for_caching_plugin() {
1838 if ( is_plugin_active( 'wp-rocket/wp-rocket.php' ) ) {
1839 $wp_rocket_settings = get_option( 'wp_rocket_settings' );
1840 $wp_rocket_settings['exclude_css'][] = plugins_url() . '/atarim-client-interface-plugin/css/(.*).css';
1841 $wp_rocket_settings['exclude_js'][] = plugins_url() . '/atarim-client-interface-plugin/js/(.*).js';
1842 if ( get_option( 'wpr_check' ) == "" ) {
1843 update_option( 'wp_rocket_settings', $wp_rocket_settings );
1844 update_option( 'wpr_check', 'true' );
1845 }
1846 }
1847
1848 if ( is_plugin_active( 'fast-velocity-minify/fvm.php' ) ) {
1849 $wpf_fvm_options = get_option( 'fastvelocity_min_ignorelist' );
1850 $wpf_update_fastvelocity_option = get_option( 'wpf_update_fastvelocity_option' );
1851 $wpf_fvm_options = explode( PHP_EOL, $wpf_fvm_options );
1852 array_push( $wpf_fvm_options, '/atarim-client-interface-plugin/' );
1853 if ( $wpf_update_fastvelocity_option != 'yes' ) {
1854 update_option( 'wpf_update_fastvelocity_option', 'yes','no' );
1855 update_option( 'fastvelocity_min_ignorelist', implode( PHP_EOL, $wpf_fvm_options ) );
1856 }
1857 }
1858 if ( is_plugin_active( 'breeze/breeze.php' ) ) {
1859 $get_breeze_advanced_settings = get_option( 'wpf_update_breeze_option' );
1860 $breeze_advanced_settings = get_option( 'breeze_advanced_settings' );
1861 $breeze_advanced_settings['breeze-exclude-css'][] = '/wp-content/plugins/atarim-client-interface-plugin/css/(.*).css';
1862 $breeze_advanced_settings['breeze-exclude-js'][] = '/wp-content/plugins/atarim-client-interface-plugin/js/(.*).js';
1863 if ( $get_breeze_advanced_settings != 'yes' ) {
1864 update_option( 'breeze_advanced_settings', $breeze_advanced_settings );
1865 update_option( 'wpf_update_breeze_option', 'yes','no' );
1866 }
1867 }
1868 if ( defined( 'WPFC_WP_PLUGIN_DIR' ) ) {
1869 $rules_std = array();
1870 $new_rule1 = new stdClass;
1871 $new_rule2 = new stdClass;
1872 $new_rule1->prefix = "contain";
1873 $new_rule1->content = "wp-content/plugins/atarim-client-interface-plugin/css";
1874 $new_rule1->type = "css";
1875 $new_rule2->prefix = "contain";
1876 $new_rule2->content = "wp-content/plugins/atarim-client-interface-plugin/js";
1877 $new_rule2->type = "js";
1878
1879 $wpfeedback_WpFastestCache_save = get_option( "wpf_WpFastestCache_option" );
1880 if ( $wpfeedback_WpFastestCache_save != 'true' ) {
1881 $get_rules_json = get_option( "WpFastestCacheExclude" );
1882 if ( $get_rules_json === false ) {
1883 array_push( $rules_std, $new_rule1 );
1884 array_push( $rules_std, $new_rule2 );
1885 update_option( "WpFastestCacheExclude", json_encode( $rules_std ), "yes" );
1886 update_option( "wpf_WpFastestCache_option", 'true', "no" );
1887 } else {
1888 $rules_std = json_decode( $get_rules_json );
1889 if ( ! is_array( $rules_std ) ) {
1890 $rules_std = array();
1891 }
1892 array_push( $rules_std, $new_rule1 );
1893 array_push( $rules_std, $new_rule2 );
1894 update_option( "WpFastestCacheExclude", json_encode( $rules_std ), "yes" );
1895 update_option( "wpf_WpFastestCache_option", 'true', "no" );
1896 }
1897 }
1898 }
1899 }
1900 add_action( 'admin_init', 'wpf_check_for_caching_plugin' );
1901
1902 /*
1903 * This function is used to get the count of comments for post.
1904 *
1905 * @input Int, Int
1906 * @return Int
1907 */
1908 function wpfeedback_filter_comment_count( $stats, $post_id ) {
1909 global $wpdb;
1910 if ( 0 === $post_id ) {
1911 $stats = wpfeedback_get_comment_count();
1912 }
1913 return $stats;
1914 }
1915 add_action( 'wp_count_comments','wpfeedback_filter_comment_count', 20, 2 );
1916
1917 /*
1918 * This function is used to get the count of the comment.
1919 *
1920 * @input NULL
1921 * @return Int
1922 */
1923 function wpfeedback_get_comment_count() {
1924 global $wpdb;
1925 $stats = get_transient( 'wpfeedback_comment_count' );
1926 if ( ! $stats ) {
1927 $stats = array();
1928 $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN('wp_feedback') GROUP BY comment_approved", ARRAY_A );
1929 $total = 0;
1930 $stats = array();
1931 $approved = array( '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed' );
1932
1933 foreach ( (array) $count as $row ) {
1934 // Don't count post-trashed toward totals
1935 if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1936 $total += $row['num_comments'];
1937 }
1938 if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1939 $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1940 }
1941 }
1942
1943 $stats['total_comments'] = $total;
1944 $stats['all'] = $total;
1945
1946 foreach ( $approved as $key ) {
1947 if ( empty( $stats[ $key ] ) ) {
1948 $stats[ $key ] = 0;
1949 }
1950 }
1951 $stats = (object) $stats;
1952 set_transient( 'wpfeedback_comment_count', $stats );
1953 }
1954 return $stats;
1955 }
1956
1957 /*
1958 * This function is used create the options for the bulk updates of status and priority.
1959 *
1960 * @input String
1961 * @return String
1962 */
1963 if ( ! function_exists( 'wpf_bulk_update_get_texonomy_selectbox' ) ) {
1964 function wpf_bulk_update_get_texonomy_selectbox( $my_term ) {
1965 $filter_data_db = get_option( 'filter_data' )[$my_term];
1966 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
1967 echo '<select id="task_' . $my_term . '_attr" ><option name="' . $my_term . '" value="" class="wpf_task" id="wpf_critical">'. __( "Select Option", "wpfeedback" ) . '</option>';
1968 foreach ( $filter_data_db as $term ) {
1969 if ( $term['label'] == 'In Progress' ) {
1970 $term['label'] = 'In Prog';
1971 } elseif ( $term['label'] == 'Pending Review' ) {
1972 $term['label'] = 'Pending';
1973 } else {
1974 $term['label'] = $term['label'];
1975 }
1976 echo '<option name="' . $my_term . '" value="' . $term['value'] . '" class="wpf_task" id="wpf_' . $term['value'] . '"/>' . __( $term['label'], 'wpfeedback' ) . '</option>';
1977 }
1978 echo '</select>';
1979 }
1980 }
1981 }
1982
1983 /*
1984 * This function is used to remove the CSS of Atarim on Graphics Page if Astra Theme is detected.
1985 *
1986 * @input NULL
1987 * @return String
1988 */
1989 function wpf_remove_astra_css_on_grapgics_page( $href ) {
1990 if ( get_query_var( 'is_graphic_page' ) ) {
1991 if ( strpos( $href, "style.min.css" ) == true ) {
1992 return $href ='';
1993 }
1994 }
1995 return $href;
1996 };
1997 add_filter( 'style_loader_src', 'wpf_remove_astra_css_on_grapgics_page', 10, 1 );
1998
1999 /*
2000 * this function is used to get
2001 * graphic data by id
2002 */
2003 function get_graphic_data( $id ) {
2004 $url = WPF_CRM_API . 'wp-api/graphic/getDetails';
2005 $sendarr = array();
2006 $sendarr["wpf_site_id"] = get_option( 'wpf_site_id' );
2007 $sendarr["graphic_id"] = $id;
2008 $sendtocloud = json_encode( $sendarr );
2009 $response = wpf_send_remote_post( $url, $sendtocloud );
2010 $data = [];
2011 if ( $response['status'] == 200 ) {
2012 $data = $response['data'];
2013 }
2014 return $data;
2015 }
2016
2017 /*
2018 * function is used to generate
2019 * bottom task panel
2020 */
2021 function generate_bottom_part_html() {
2022 global $wpdb, $wp_query, $post;
2023 global $wpf_task_status_filter_btn, $wpf_task_priority_filter_btn;
2024 $current_page_id = '';
2025 if ( is_feature_enabled( 'bottom_bar_enabled' ) ) {
2026 if ( is_admin() ) {
2027 $current_page_id = get_the_ID();
2028 }
2029 if ( $current_page_id == '' ) {
2030 if ( isset( $wp_query->post->ID ) ) {
2031 $current_page_id = $wp_query->post->ID;
2032 }
2033 }
2034
2035 $current_user = wp_get_current_user();
2036 $wpf_user_name = $current_user->display_name; //['display_name']; //->user_nicename;
2037 $wpf_user_email = $current_user->user_email; //['user_email']; //->user_email;
2038 $url = WPF_CRM_API . 'wp-api/page/is-approved';
2039 $sendarr = array();
2040 $sendarr["wpf_site_id"] = get_option( 'wpf_site_id' );
2041 $sendarr["page_id"] = $current_page_id;
2042 $sendtocloud = json_encode( $sendarr );
2043 $response = wpf_send_remote_post( $url, $sendtocloud );
2044 $is_approved = 0;
2045 $data = [];
2046
2047 if ( isset( $response['status'] ) && $response['status'] ) {
2048 $is_approved = 1;
2049 }
2050
2051 $currnet_user_information = wpf_get_current_user_information();
2052 $current_role = $currnet_user_information['role'];
2053 $current_user_name = ( ! empty( $currnet_user_information['first_name'] ) ) ? $currnet_user_information['first_name'] : $currnet_user_information['display_name'];
2054 $current_user_id = $currnet_user_information['user_id'];
2055
2056 if ( $current_user_name == 'Guest' ) {
2057 $wpf_current_role = 'guest';
2058 } else {
2059 $wpf_current_role = wpf_user_type();
2060 }
2061 $current_user_name = addslashes( $current_user_name );
2062 $wpf_powered_class = '_blank';
2063 $wpf_powered_by = get_site_data_by_key( 'wpfeedback_powered_by' );
2064 $wpf_powerbylink = WPF_MAIN_SITE_URL . '/reviews/?website=' . get_bloginfo('name') . '&email=' . $wpf_user_email . '&nameu=' . $wpf_user_name;
2065 $wpf_powerbylogo = get_wpf_logo();
2066 if ( $wpf_powered_by == 'yes' ) {
2067 $wpf_powered_class = '_self';
2068 $wpf_powered_link = get_site_data_by_key( 'wpf_powered_link' );
2069 if ( $wpf_powered_link != '' ) {
2070 $wpf_powerbylink = $wpf_powered_link;
2071 $wpf_powered_class = '_blank';
2072 } else {
2073 $wpf_powerbylink = "javascript:void(0)";
2074 }
2075 }
2076
2077 $wpf_show_front_stikers = get_site_data_by_key( 'wpf_show_front_stikers' );
2078
2079 /* =====Start filter sidebar HTML Structure==== */
2080 if ( $wpf_show_front_stikers == 'yes' ) {
2081 $checkbox_checked = "checked";
2082 } else {
2083 $checkbox_checked = "";
2084 }
2085
2086 $wpf_current_page_url = get_permalink() . '?wpf_login=1';
2087 $backend_btn = '';
2088 $wpf_report_btn = '';
2089 $wpf_report_btn_tab = '';
2090 $wpf_go_to_cloud_dashboard_btn_tab = '';
2091
2092 if ( $current_user_id > 0 ) {
2093 $share_style = '';
2094 if ( $wpf_current_role == 'advisor' ) {
2095 $wpf_go_to_cloud_dashboard_btn_tab = '<a href="' . WPF_APP_SITE_URL . '/login" target="_blank" class="wpf_filter_tab_btn cloud_dashboard_btn" title="' . __( "Atarim Dashboard", "wpfeedback" ) . '">' . get_wpf_icon() . '</a>';
2096 }
2097 $backend_btn = ' <button class="wpf_tab_sidebar wpf_backend" onclick="openWPFTab(\'wpf_backend\')" >' . __('Backend', 'wpfeedback') . '</button>';
2098 $wpf_daily_report = get_site_data_by_key( 'wpf_daily_report' );
2099 $wpf_weekly_report = get_site_data_by_key( 'wpf_weekly_report' );
2100
2101 if ( get_query_var( 'is_graphic_page' ) ) {
2102 $wpf_current_page_url = site_url() . '/collaborate/graphic?id=' . sanitize_text_field( $_GET['id'] ) . '&wpf_login=1';
2103 }
2104 /* ================Go to dashboard Tabs HTML================ */
2105 $wpf_report_btn .= '<div class="wpf_report_trigger"><label class="wpf_reports_title">' . get_wpf_report_icon() . __( "Send Reports:", "wpfeedback" ) . '</label>';
2106 if ( $wpf_daily_report == 'yes' ) {
2107 /* ================Daily report btn HTML================ */
2108 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'daily_report\')">' . __( 'Last 24 Hours', 'wpfeedback' ) . '</a>';
2109 }
2110 if ( $wpf_weekly_report == 'yes' ) {
2111 /* ================Weekly report btn HTML================ */
2112 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'weekly_report\')">' . __( 'Last 7 Days', 'wpfeedback' ) . '</a>';
2113 }
2114 $wpf_report_btn .= '<span id="wpf_front_report_sent_span" class="wpf_hide text-success">' . __( 'Your report was sent', 'wpfeedback' ) . '</span></div>';
2115
2116 /* ================Report Tabs HTML================ */
2117 $wpf_report_btn_tab = '<li class="reports"><a class="wpf_filter_tab_btn_bottom" href="javascript:void(0);" data-tag="wpf_report_btn" title="' . __( "Reports", "wpfeedback" ) . '">' . get_wpf_report_icon() . ' <span>' . __( "Reports", "wpfeedback" ) . '</span></a></li>';
2118 } else {
2119 $share_style = 'style="margin-left: 90px;"';
2120 }
2121
2122 /* ================visibility Tabs Content HTML================ */
2123 $wpf_task_visibility = '<label class="wpf_visibility_title">' . get_wpf_visibility_icon() . __( "Tasks Visibility", "wpfeedback" ) . '</label><div class="wpf_sidebar_checkboxes"><input type="checkbox" name="wpfb_display_tasks" id="wpfb_display_tasks" class="wpf_checkbox" ' . $checkbox_checked . '/> <label for="wpfb_display_tasks" class="wpf_checkbox_label">' . __( 'Show Tasks', 'wpfeedback' ) . '</label></div>
2124 <div class="wpf_sidebar_checkboxes"><input type="checkbox" name="wpfb_display_completed_tasks" class="wpf_checkbox" id="wpfb_display_completed_tasks" /> <label for="wpfb_display_completed_tasks" class="wpf_checkbox_label">' . __( 'Show Completed', 'wpfeedback' ) . '</label></div>
2125 <div class="wpf_sidebar_checkboxes"><input type="checkbox" name="wpfb_display_internal_tasks" class="wpf_checkbox" id="wpfb_display_internal_tasks" checked /> <label for="wpfb_display_internal_tasks" class="wpf_checkbox_label">' . __( 'Show Internal', 'wpfeedback' ) . '</label></div>';
2126 $wpf_page_share = '<div class="wpf_icon_title">'.get_wpf_share_icon(). __("Share Page Link : ", "wpfeedback") . '</div><input type="text" id="wpf_share_page_link" value="' . $wpf_current_page_url . '" style="position: absolute; z-index: -999; opacity: 0;"><span class="wpf_share_task_link"><div class="wpf_task_link">' . $wpf_current_page_url . '</div><a href="javascript:void(0);" onclick="wpf_copy_to_clipboard(\'wpf_share_page_link\')" class="wpf_copy_task_icon" style="display: inline-block; color: var(--main-wpf-color) !important;"><i class="gg-copy"></i></a><span class="wpf_success_wpf_share_link" id="wpf_success_wpf_share_page_link" style="display: none;">The link was copied to your clipboard.</span></span><div class="wpf_remove_login_box"><input type="checkbox" id="wpf_remove_login_task_link" class="wpf_remove_login_task_link wpf_checkbox" onclick=\'wpf_remove_login_to_clipboard_sidebar("wpf_share_page_link","")\'><label class="wpf_remove_login_label wpf_checkbox_label" for="wpf_remove_login_task_link">' . __( "Remove Login Parameter", "wpfeedback" ) . '</label></div>';
2127 /* ================Filter Tabs & Content HTML================ */
2128
2129 $wpf_toggel_filter_tab = '<div id="wpf_bottom_filter">
2130 <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div>
2131 <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div>
2132 <div class="wpf_list wpf_hide" id="wpf_task_visibility">' . $wpf_task_visibility . '</div>
2133 <div class="wpf_list wpf_hide" id="wpf_report_btn">' . $wpf_report_btn . '</div>
2134 <div class="wpf_list wpf_hide" id="wpf_share_page_btn" ' . $share_style . ' >' . $wpf_page_share . '</div>
2135 </div>';
2136 /* =====END filter sidebar HTML Structure==== */
2137 if ( $is_approved == 1 ) {
2138 $btn_title = __( "Approved", "wpfeedback" );
2139 $btn_approve_class = "";
2140 } else {
2141 $btn_title = __( "Approve Page", "wpfeedback" );
2142 $btn_approve_class = "wpf_not_approved";
2143 }
2144
2145 $approve_btn = '<button class="wpf_green_btn approve-page ' . $btn_approve_class . '" id="open_approve_modal" title="' . __( "Approve Page", "wpfeedback" ) . '" data-is-approve="' . $is_approved . '">' . get_wpf_right_icon() . '<span>' . $btn_title . '</span> </button>';
2146 $responsive_btn = '<div class="wpf_responsive_icons_bar">
2147 <a href="javascript:void(0)" class="wpf_responsive_icon wpf_responsive_tablet" title="Tablet View"><span><i class="gg-tablet"></i></span></a>
2148 <a href="javascript:void(0)" class="wpf_responsive_icon wpf_responsive_mobile" title="Mobile View"><span><i class="gg-smartphone"></i></span></a>
2149 </div>';
2150
2151 if ( is_admin() == 1 ) {
2152 $approve_btn = "";
2153 }
2154
2155 $bottom_panel_db = get_option( 'bottom_panel' );
2156 $bottom_style = "";
2157 $bottom_active_class = 'active';
2158 $agency_menu_item = '';
2159 if ( $wpf_current_role == 'advisor' || ( $wpf_current_role == '' && current_user_can( 'administrator' ) ) ) {
2160 $agency_menu_item = '<li class="pro"> <a href="' . WPF_APP_SITE_URL . '/login" target="_blank" title="' . __( "Atarim Dashboard", "wpfeedback" ) . '">' . get_wpf_pro_icon() . '<span>' . __( "Agency", "wpfeedback" ) . '</span> </a></li>';
2161 }
2162 if ( (! get_query_var( 'is_graphic_page' ) ) && ( isset( $bottom_panel_db ) && $bottom_panel_db == '0' ) ) {
2163 $bottom_active_class = '';
2164 $bottom_style = 'bottom: -49px;';
2165 }
2166
2167 if ( get_query_var( 'is_graphic_page' ) ) {
2168 $toggle_button = "";
2169 } else {
2170 $toggle_button = '<a href="javascript:expand_bottom_bar()" class="arrow-down" id="wpf_bottom_arrow" title="Hide Panel"> <img src="' . WPF_PLUGIN_URL . 'images/arrow-down.svg"> </a>';
2171 }
2172
2173 $milestone = '<div id="wpf_site_milestone"></div><div class="wpf_list wpf_hide" id="wpf_site_milestone_wpf_list"><div class="wpf_loader wpf_loader_2 wpf_hide"></div></div>';
2174 return '<section id="wpf_bottom_bar" class="' . $bottom_active_class . '" style="' . $bottom_style . '"><div class="wpf_progress_bar"><div class="red-pb" id="open_progress"></div><div class="orange-pb" id="inprogress_progress"></div><div class="yellow-pb" id="pending_progress"></div><div class="green-pb" id="completed_progress"></div></div><div id="wpf_panel" class="wpf_row"><div class="wpf_bottom_left"><div class="footer-logo" title="Logo"><a href="' . $wpf_powerbylink . '" target="' . $wpf_powered_class . '"><img src="' . $wpf_powerbylogo . '" /></a></div> ' . $toggle_button . $approve_btn . $responsive_btn . $milestone . '</div><div class="wpf_bottom_middle"><ul class="icons-block">' . $agency_menu_item . '<li class="visibility"> <a id="wpf_filter_btn_bottom_visibility" class="wpf_filter_tab_btn_bottom" data-tag="wpf_task_visibility" href="javascript:void(0);" title="' . __( "Task Visibility", "wpfeedback" ) . '">' . get_wpf_visibility_icon() . ' <span>' . __( "Visibility", "wpfeedback" ) . '</span> </a></li>' . $wpf_report_btn_tab . '<li class="share"><a class="wpf_filter_tab_btn_bottom" data-tag="wpf_share_page_btn" href="javascript:void(0);" title="' . __( "Share", "wpfeedback" ) . '">' . get_wpf_share_icon() . '<span>' . __( "Share", "wpfeedback" ) . '</span></a></li></ul>' . $wpf_toggel_filter_tab . '</div><div class="wpf_bottom_right"> <a href="javascript:enable_comment();" class="wpf_green_btn wpf_comment_btn" title="Click to give your feedback!">' . get_wpf_plus_icon() . ' <span>' . __( "Comment", "wpfeedback" ) . '</span></a><a class="wpf_green_btn wpf_general_btn wpf_comment_mode_general_task" id="wpf_comment_mode_general_task" href="javascript:void(0)" onclick="wpf_new_general_task(0)" title="' . __( 'General', 'wpfeedback' ) . '">' . get_wpf_exclamation_icon() . '<span>' . __( 'General', 'wpfeedback' ) . '</span></a><a href="javascript:expand_sidebar()" class="tasks-btn wpf_blue_btn" title="Sidebar"> <svg viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M20.7368 14.3781C20.7368 14.938 20.5144 15.475 20.1185 15.8709C19.7226 16.2668 19.1856 16.4892 18.6257 16.4892L5.95904 16.4892L1.73682 20.7114L1.73682 3.82254C1.73682 3.26264 1.95924 2.72567 2.35515 2.32976C2.75106 1.93385 3.28803 1.71143 3.84793 1.71143L18.6257 1.71143C19.1856 1.71143 19.7226 1.93385 20.1185 2.32976C20.5144 2.72567 20.7368 3.26264 20.7368 3.82254L20.7368 14.3781Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </svg><span class="title">'.__("Tasks", "wpfeedback").'</span> <span class="number wpf_hide" id="wpf_total_task_number"></span> </a></div></div><div id="wpf_enable_comment" class="wpf_row" style="display:none;"><div class="wpf_bottom_left"><div class="footer-logo" title="Logo"> <img src="' . $wpf_powerbylogo . '"></div> <span class="message">Choose a part of the page to add a message or, click the "General" button for a generic request</span></div><div class="wpf_bottom_right"> <a href="javascript:disable_comment();" id="disable_comment_a" class="tasks-btn wpf_red_btn" title="' . __( 'Cancel', 'wpfeedback' ) . '">' . get_wpf_close_icon() . '<span class="title">' . __( 'Cancel', 'wpfeedback' ) . '</span> </a></div></div><div class="wpf_page_loader"></div></section>';
2175 }
2176 }
2177 add_action( 'wpf_generate_bottom_part_html', 'generate_bottom_part_html' );
2178
2179 // Upgrade popup by Pratap
2180 function wpf_upgrade_plan() {
2181 $wpf_user_type = wpf_user_type();
2182 $enabled_wpfeedback = wpf_check_if_enable();
2183 if ( $enabled_wpfeedback ) {
2184 ?>
2185 <div class="wpf-uf-pop-wrapper">
2186 <div class="wpf-uf-pop-container">
2187 <div class="wpf-uf-popup">
2188 <div class="wpf-uf-close-popup"><i class="gg-close"></i></div>
2189 <div class="wpf-uf-popup-title">Let's Unlock This Feature</div>
2190 <p>Unlock this feature and improve your workflow even further by upgrading your plan.</p>
2191 <div class="wpf-uf-popup-plans">
2192 <div class="wpf-uf-popup-image">
2193 <img alt="" src="">
2194 </div>
2195 <div class="wpf-uf-plan">
2196 <div class="wpf-uf-plan-title"></div>
2197 <div class="wpf-uf-plan-detail"></div>
2198 <a class="wpf-uf-plan-link" href="#" target="_blank"><div class="wpf-uf-plan-btn">Upgrade To Unlock</div></a>
2199 </div>
2200 </div>
2201 <?php if ( $wpf_user_type = 'advisor' ) { ?>
2202 <div class="wpf-uf-webmaster-notice">*This is only shown to you as a webmaster, other users will not see this</div>
2203 <?php } else { ?>
2204 <div class="wpf-uf-otheruser-notice">Please contact your webmaster to unlock this feature</div>
2205 <?php } ?>
2206 </div>
2207 </div>
2208 </div>
2209 <?php
2210 }
2211 }
2212 add_action( 'wp_footer', 'wpf_upgrade_plan' );
2213 add_action( 'admin_footer', 'wpf_upgrade_plan' );
2214
2215
2216 /*
2217 * function is used to generate
2218 * side task panel
2219 */
2220 function generate_side_part_html() {
2221 global $wpdb, $wp_query, $post;
2222 $current_page_id = '';
2223 if ( is_admin() ) {
2224 $current_page_id = get_the_ID();
2225 }
2226 if ( $current_page_id == '' ) {
2227 if ( isset( $wp_query->post->ID ) ) {
2228 $current_page_id = $wp_query->post->ID;
2229 }
2230 }
2231
2232 $current_user = wp_get_current_user();
2233 $wpf_user_name = $current_user->display_name; //['display_name']; //->user_nicename;
2234 $wpf_user_email = $current_user->user_email; //['user_email']; //->user_email;
2235 $url = WPF_CRM_API . 'wp-api/page/is-approved';
2236 $sendarr = array();
2237 $sendarr["wpf_site_id"] = get_option('wpf_site_id');
2238 $sendarr["page_id"] = $current_page_id;
2239 $sendtocloud = json_encode( $sendarr );
2240 $response = wpf_send_remote_post( $url, $sendtocloud );
2241 $is_approved = 0;
2242 $data = [];
2243
2244 if ( isset( $response['status'] ) && $response['status'] ) {
2245 $is_approved = 1;
2246 }
2247
2248 $currnet_user_information = wpf_get_current_user_information();
2249 $current_role = $currnet_user_information['role'];
2250 $current_user_name = $currnet_user_information['display_name'];
2251 $current_user_id = $currnet_user_information['user_id'];
2252
2253 if ( $current_user_name == 'Guest' ) {
2254 $wpf_current_role = 'guest';
2255 } else {
2256 $wpf_current_role = wpf_user_type();
2257 }
2258 $current_user_name = addslashes( $current_user_name );
2259 $wpf_powered_class = '_blank';
2260 $wpf_powered_by = get_site_data_by_key( 'wpfeedback_powered_by' );
2261 $wpf_powerbylink = WPF_MAIN_SITE_URL . '/reviews/?website=' . get_bloginfo('name') . '&email=' . $wpf_user_email . '&nameu=' . $wpf_user_name;
2262 $wpf_powerbylogo = get_wpf_logo();
2263 if ( $wpf_powered_by == 'yes' ) {
2264 $wpf_powered_class = '_self';
2265 $wpf_powered_link = get_site_data_by_key( 'wpf_powered_link' );
2266 if ( $wpf_powered_link != '' ) {
2267 $wpf_powerbylink = $wpf_powered_link;
2268 $wpf_powered_class = '_blank';
2269 } else {
2270 $wpf_powerbylink = "javascript:void(0)";
2271 }
2272 }
2273
2274 $wpf_show_front_stikers = get_site_data_by_key( 'wpf_show_front_stikers' );
2275
2276 /* =====Start filter sidebar HTML Structure==== */
2277 if ( $wpf_show_front_stikers == 'yes' ) {
2278 $checkbox_checked = "checked";
2279 } else {
2280 $checkbox_checked = "";
2281 }
2282
2283 $wpf_current_page_url = get_permalink() . '?wpf_login=1';
2284 $backend_btn = '';
2285 $wpf_report_btn = '';
2286 $wpf_report_btn_tab = '';
2287 $wpf_go_to_cloud_dashboard_btn_tab = '';
2288
2289 if ( $current_user_id > 0 ) {
2290 $share_style = '';
2291 if ( $wpf_current_role == 'advisor' ) {
2292 $wpf_go_to_cloud_dashboard_btn_tab = '<a href="' . WPF_APP_SITE_URL . '/login" target="_blank" class="wpf_filter_tab_btn cloud_dashboard_btn" title="' . __( "Atarim Dashboard", "wpfeedback" ) . '">' . get_wpf_icon() . '</a>';
2293 }
2294 $backend_btn = ' <button class="wpf_tab_sidebar wpf_backend" onclick="openWPFTab(\'wpf_backend\')" >' . __('Backend', 'wpfeedback') . '</button>';
2295 $wpf_daily_report = get_site_data_by_key( 'wpf_daily_report' );
2296 $wpf_weekly_report = get_site_data_by_key( 'wpf_weekly_report' );
2297
2298 if ( get_query_var( 'is_graphic_page' ) ) {
2299 $wpf_current_page_url = site_url() . '/collaborate/graphic?id=' . sanitize_text_field( $_GET['id'] ) . '?wpf_login=1';
2300 }
2301 /* ================Go to dashboard Tabs HTML================ */
2302 $wpf_report_btn .= '<div class="wpf_report_trigger"><label class="wpf_reports_title">' . get_wpf_report_icon() . __( "Send Reports:", "wpfeedback" ) . '</label>';
2303 if ( $wpf_daily_report == 'yes' ) {
2304 /* ================Daily report btn HTML================ */
2305 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'daily_report\')">' . __('Last 24 Hours', 'wpfeedback') . '</a>';
2306 }
2307 if ( $wpf_weekly_report == 'yes' ) {
2308 /* ================Weekly report btn HTML================ */
2309 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'weekly_report\')">' . __( 'Last 7 Days', 'wpfeedback' ) . '</a>';
2310 }
2311 $wpf_report_btn .= '<span id="wpf_front_report_sent_span" class="wpf_hide text-success">' . __( 'Your report was sent', 'wpfeedback' ) . '</span></div>';
2312
2313 /* ================Report Tabs HTML================ */
2314 $wpf_report_btn_tab = '<li class="reports"><a class="wpf_filter_tab_btn_bottom" href="javascript:void(0);" data-tag="wpf_report_btn" title="' . __( "Reports", "wpfeedback" ) . '">' . get_wpf_report_icon() . ' <span>' . __( "Reports", "wpfeedback" ) .'</span></a></li>';
2315 } else {
2316 $share_style = 'style="margin-left: 90px;"';
2317 }
2318
2319 /* ================filter Tabs Content HTML================ */
2320 $wpf_task_status_filter_btn = '<div id="wpf_filter_taskstatus" class=""><label class="wpf_filter_title">' . get_wpf_status_icon() . ' ' . __( 'Filter by Status:', 'wpfeedback' ) . '</label>' . wp_feedback_get_texonomy_filter( "task_status" ) . '</div>';
2321 $wpf_task_priority_filter_btn = '<div id="wpf_filter_taskpriority" class=""><label class="wpf_filter_title">' . get_wpf_priority_icon() . ' ' . __( "Filter by Priority:", "wpfeedback" ) . '</label>' . wp_feedback_get_texonomy_filter( "task_priority" ) . '</div>';
2322
2323 /* ================visibility Tabs Content HTML================ */
2324 $wpf_task_visibility = '<label class="wpf_visibility_title">' . get_wpf_visibility_icon() . __( "Tasks Visibility", "wpfeedback" ) . '</label><div class="wpf_sidebar_checkboxes"><input type="checkbox" name="wpfb_display_tasks" id="wpfb_display_tasks" class="wpf_checkbox" ' . $checkbox_checked . '/> <label for="wpfb_display_tasks" class="wpf_checkbox_label">' . __( 'Show Tasks', 'wpfeedback' ) . '</label></div>
2325 <div class="wpf_sidebar_checkboxes"><input type="checkbox" name="wpfb_display_completed_tasks" class="wpf_checkbox" id="wpfb_display_completed_tasks" /> <label for="wpfb_display_completed_tasks" class="wpf_checkbox_label">' . __( 'Show Completed', 'wpfeedback' ) . '</label></div>';
2326
2327 $wpf_page_share = '<div class="wpf_icon_title">' . get_wpf_share_icon() . __( "Share Page Link : ", "wpfeedback" ) . '</div><input type="text" id="wpf_share_page_link" value="' . $wpf_current_page_url . '" style="position: absolute; z-index: -999; opacity: 0;"><span class="wpf_share_task_link"><div class="wpf_task_link">' . $wpf_current_page_url . '</div><a href="javascript:void(0);" onclick="wpf_copy_to_clipboard(\'wpf_share_page_link\')" class="wpf_copy_task_icon" style="display: inline-block; color: var(--main-wpf-color) !important;"><i class="gg-copy"></i></a><span class="wpf_success_wpf_share_link" id="wpf_success_wpf_share_page_link" style="display: none;">The link was copied to your clipboard.</span></span><div class="wpf_remove_login_box"><input type="checkbox" id="wpf_remove_login_task_link" class="wpf_remove_login_task_link wpf_checkbox" onclick=\'wpf_remove_login_to_clipboard_sidebar("wpf_share_page_link","")\'><label class="wpf_remove_login_label wpf_checkbox_label" for="wpf_remove_login_task_link">' . __("Remove Login Parameter", "wpfeedback") . '</label></div>';
2328 /* ================Filter Tabs & Content HTML================ */
2329
2330 $wpf_toggel_filter_tab = '<div id="wpf_bottom_filter">
2331 <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div>
2332 <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div>
2333 <div class="wpf_list wpf_hide" id="wpf_task_visibility">' . $wpf_task_visibility . '</div>
2334 <div class="wpf_list wpf_hide" id="wpf_report_btn">' . $wpf_report_btn . '</div>
2335 <div class="wpf_list wpf_hide" id="wpf_share_page_btn" ' . $share_style .' >' . $wpf_page_share . '</div>
2336 </div>';
2337 /* =====END filter sidebar HTML Structure==== */
2338 if ( $is_approved == 1 ) {
2339 $btn_title = __( "Approved", "wpfeedback" );
2340 } else {
2341 $btn_title = __( "Approve Page", "wpfeedback" );
2342 }
2343
2344 $approve_btn = '<button class="wpf_green_btn approve-page" title="' . __( "Approve Page", "wpfeedback" ) . '" data-is-approve="' . $is_approved . '">' . get_wpf_right_icon() . '<span>' . $btn_title . '</span> </button>';
2345 if ( is_admin() == 1 ) {
2346 $approve_btn = "";
2347 }
2348
2349 $bottom_panel_db = get_option( 'bottom_panel' );
2350 $bottom_style = "";
2351 $bottom_active_class = 'active';
2352 $agency_menu_item = '';
2353 if ( $wpf_current_role == 'advisor' || ( $wpf_current_role == '' && current_user_can( 'administrator' ) ) ) {
2354 $agency_menu_item = '<li class="pro"> <a href="' . WPF_APP_SITE_URL . '/login" target="_blank" title="' . __( "Atarim Dashboard", "wpfeedback" ) . '">' . get_wpf_pro_icon() . '<span>' . __( "Agency", "wpfeedback" ) . '</span> </a></li>';
2355 }
2356 if ( isset( $bottom_panel_db ) && $bottom_panel_db == '0' ) {
2357 $bottom_active_class = '';
2358 $bottom_style = 'bottom: -49px;';
2359 }
2360 return $wpf_toggel_filter_tab;
2361 }
2362
2363
2364 /**
2365 * Get the author name of the tasks
2366 */
2367 function get_task_author( $mypost ) {
2368 /* assign the WP names (first & last name / nickname) if the author is on the site */
2369
2370 // by default, we take name that is coming from the API
2371 $author = $mypost['task_config_author_name'] ?? "Guest";
2372
2373 // list all the usere who's roles are allowed to create tasks
2374 $wpf_front_users = do_shortcode( '[wpf_user_list_front]' );
2375
2376 if ( $wpf_front_users ) {
2377
2378 // convert JSON to array
2379 $wpf_front_users_arr = json_decode( $wpf_front_users, true );
2380
2381 // get the user data by filtering the roles allowed to create tasks
2382 $front_user_meta = array_filter( $wpf_front_users_arr, function( $user ) use( $mypost ) {
2383 return intval( $user['id'] ) === intval( $mypost['task_config_author_id'] );
2384 } );
2385
2386 // if the user dats found, we will assign the appropriate name
2387 if ( is_array( $front_user_meta ) ) { // if ( !empty( $front_user_name ) && is_array( $front_user_meta ) )
2388
2389 // as the filter returns the array with the task's id as key, we only need the data in the array by unpacking
2390 $front_user_metas = array_merge( $front_user_meta );
2391
2392 // assign the first and last name if present, nickname otherwise.
2393 return $front_user_metas[0]['displayname'] ?? $author;
2394 }
2395 }
2396 return $author;
2397 }
2398
2399
2400 /**
2401 * Checks if the feature has enabled by the plan or not
2402 */
2403 function is_feature_enabled( $feature_name ) {
2404 $wpf_user_plan = get_option( 'wpf_user_plan', false );
2405 if ( $wpf_user_plan ) {
2406 $wpf_user_plan = unserialize( $wpf_user_plan );
2407 }
2408
2409 // Enable the feature if the data not in the DB
2410 if ( empty( $wpf_user_plan ) ) {
2411 return true;
2412 }
2413 return ( ! empty( $wpf_user_plan[$feature_name] ) && $wpf_user_plan[$feature_name] === 'yes' );
2414 }
2415