PluginProbe
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback / 3.18
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback v3.18
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 in Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback 3.18, at inc/wpf_function.php

2,672 lines 159.1 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 = get_option( 'filter_data' );
16 $filter_data_db = $filter_data[$my_term];
17 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
18 echo '<ul class="wp_feedback_filter_checkbox">';
19 foreach ( $filter_data_db as $term ) {
20 if ( $term['label'] == 'In Progress' ) {
21 $term['label'] = 'In Prog';
22 } elseif ( $term['label'] == 'Pending Review' ) {
23 $term['label'] = 'Pending';
24 } else {
25 $term['label'] = $term['label'];
26 }
27 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'] . '">' . __( $term['label'], 'atarim-visual-collaboration' ) . '</label></li>';
28 }
29 echo '</ul>';
30 }
31 }
32 }
33
34 /*
35 * This function is used to get all the roles allowed to use Atarim features.
36 *
37 * @input NULL
38 * @return String
39 */
40 if ( ! function_exists( 'wp_feedback_get_user_role_list' ) ) {
41 function wp_feedback_get_user_role_list() {
42 $editable_roles = get_editable_roles();
43 return $editable_roles;
44 }
45 }
46 add_shortcode( 'wpf_user_role_list', 'wp_feedback_get_user_role_list' );
47
48 /*
49 * 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.
50 *
51 * @input NULL
52 * @return String
53 */
54 if ( ! function_exists( 'wp_feedback_get_user_list' ) ) {
55 function wp_feedback_get_user_list() {
56 $get_notif_user_db = get_option( 'notify_users' );
57 $notify_users = isset( $get_notif_user_db ) ? $get_notif_user_db : [];
58
59 if ( is_array( $notify_users ) ) {
60 if ( count( $notify_users ) > 0) {
61 echo '<ul class="wp_feedback_filter_checkbox user">';
62 if ( ! empty( $notify_users ) ) {
63 foreach ( $notify_users as $user ) {
64 $wpfusr = get_user_by( 'id', htmlspecialchars( $user['wpf_id'], ENT_QUOTES, 'UTF-8' ) );
65 $wpfusrname = $wpfusr->display_name;
66 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>';
67 }
68 }
69 echo '</ul>';
70 }
71 }
72 }
73 }
74 add_shortcode( 'wpf_user_list', 'wp_feedback_get_user_list' );
75
76 /*
77 * 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.
78 *
79 * @input NULL
80 * @return String
81 */
82 if ( ! function_exists( 'wp_feedback_get_user_list_task' ) ) {
83 function wp_feedback_get_user_list_task() {
84 $get_notif_user_db = get_option( 'notify_users' );
85 $notify_users = isset( $get_notif_user_db ) ? $get_notif_user_db : [];
86 if ( is_array( $notify_users ) ) {
87 if ( count( $notify_users ) > 0 ) {
88 echo '<ul class="wp_feedback_filter_checkbox user">';
89 if ( ! empty( $notify_users ) ) {
90 foreach ( $notify_users as $user ) {
91 $wpfusr = get_user_by( 'id', htmlspecialchars( $user['wpf_id'], ENT_QUOTES, 'UTF-8' ) );
92 $wpfusr_meta = get_user_meta( $wpfusr->ID );
93 $user_name = $wpfusr->display_name;
94 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
95 }
96 }
97 echo '</ul>';
98 }
99 }
100 }
101 }
102 add_shortcode( 'wpf_user_list_task', 'wp_feedback_get_user_list_task' );
103
104 /*
105 * 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.
106 *
107 * @input NULL
108 * @return String
109 */
110 if ( ! function_exists( 'wp_feedback_get_user_list_front' ) ) {
111 function wp_feedback_get_user_list_front() {
112 $response = [];
113 $get_notif_user_db = get_option( 'notify_users' );
114 $notify_users = isset( $get_notif_user_db ) ? $get_notif_user_db : [];
115
116 if ( is_array( $notify_users ) ) {
117 if ( count( $notify_users ) > 0 ) {
118 if ( ! empty( $notify_users ) ) {
119 foreach ( $notify_users as $user ) {
120 $userdetails = get_user_by( 'id', htmlspecialchars( $user['wpf_id'], ENT_QUOTES, 'UTF-8' ) );
121 $response[$user['value']] = array(
122 "id" => htmlspecialchars( $userdetails->ID, ENT_QUOTES, 'UTF-8' ),
123 "username" => htmlspecialchars( $user['label'], ENT_QUOTES, 'UTF-8' ),
124 "displayname" => htmlspecialchars( $userdetails->display_name, ENT_QUOTES, 'UTF-8' ),
125 "first_name" => htmlspecialchars( $userdetails->first_name, ENT_QUOTES, 'UTF-8' ),
126 "last_name" => htmlspecialchars( $userdetails->last_name, ENT_QUOTES, 'UTF-8' )
127 );
128 }
129 }
130 }
131 }
132 return json_encode( $response );
133 }
134 }
135 add_shortcode( 'wpf_user_list_front', 'wp_feedback_get_user_list_front' );
136
137 /*
138 * This function is used to get emails of the users to be notified.
139 *
140 * @input String
141 * @return JSON
142 */
143 if ( ! function_exists( 'get_notify_users_emails' ) ) {
144 function get_notify_users_emails( $id ) {
145 $send_to_arr = explode( ',', $id );
146 $current_user_id = get_current_user_id();
147 if ( ( $key = array_search( $current_user_id, $send_to_arr ) ) !== false ) {
148 unset( $send_to_arr[$key] );
149 }
150 $nofity_users = array();
151 foreach ( $send_to_arr as $k ) {
152 $user = get_user_by( 'id', $k );
153 $nofity_users[] = $user->user_email;
154 }
155 $response = implode( $nofity_users, "," );
156 return $response;
157 }
158 }
159
160 /*
161 * This function is used to verify if the license on the website is valid or not.
162 *
163 * @input String
164 * @return JSON
165 */
166 if ( ! function_exists( 'wpf_license_key_check_item' ) ) {
167 function wpf_license_key_check_item( $wpf_license_key ) {
168 if( ! get_option( 'wpf_decr_key' ) ) {
169 $wpf_license_key = $wpf_license_key;
170 } else {
171 $wpf_license_key = wpf_crypt_key( $wpf_license_key, 'd' );
172 }
173 $site_url = WPF_SITE_URL;
174 $url = WPF_EDD_SL_STORE_URL . "?edd_action=check_license&item_id=" . WPF_EDD_SL_ITEM_ID . "&license=$wpf_license_key&url=$site_url";
175 $args = array(
176 'timeout' => 20,
177 'sslverify' => false
178 );
179 $output = wp_remote_get( $url, $args );
180 if ( ! is_wp_error( $output ) ) {
181 if ( $output['response']['code'] != 200 ) {
182 $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";
183 $output = wp_remote_get( $url, $args );
184 }
185 $outputObject = json_decode( $output['body'] );
186 if ( $outputObject->license == 'valid' ) {
187 if ( isset( $outputObject->wpf_site_id ) ) {
188 update_option( 'wpf_site_id', $outputObject->wpf_site_id );
189 }
190 $response = array( 'license' => $outputObject->license, 'expires' => $outputObject->expires, 'payment_id' => $outputObject->payment_id, 'checksum' => $outputObject->checksum, 'executed' => 1 );
191 do_action( 'wpf_initial_sync', $wpf_license_key );
192 } else {
193 $response = array( 'license' => $outputObject->license, 'expires' => '', 'executed' => 1 );
194 }
195 } else {
196 $response = array( 'license' => 'invalid', 'expires' => '', 'executed' => 1 );
197 }
198 return $response;
199 }
200 }
201
202 /*
203 * This function is used to activate the license on the website.
204 *
205 * @input String
206 * @return JSON
207 */
208 if ( ! function_exists( 'wpf_license_key_license_item' ) ) {
209 function wpf_license_key_license_item( $wpf_license_key ) {
210 $wpf_license_key_in = $wpf_license_key;
211 if ( ! get_option( 'wpf_decr_key' ) ) {
212 $wpf_license_key = $wpf_license_key;
213 } else {
214 $wpf_license_key = wpf_crypt_key( $wpf_license_key, 'd' );
215 if ( $wpf_license_key == '' ) {
216 $wpf_license_key = $wpf_license_key_in;
217 }
218 }
219 $site_url = WPF_SITE_URL;
220 $url = WPF_EDD_SL_STORE_URL . "?edd_action=activate_license&item_id=" . WPF_EDD_SL_ITEM_ID . "&license=$wpf_license_key&url=$site_url";
221 $args = array(
222 'timeout' => 20,
223 'sslverify' => false
224 );
225 $output = wp_remote_get( $url, $args );
226 if ( ! is_wp_error( $output ) ) {
227 if ( $output['response']['code'] != 200 ) {
228 $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";
229 $output = wp_remote_get( $url, $args );
230 }
231 $outputObject = json_decode( $output['body'] );
232 if ( $outputObject->license == 'valid' ) {
233 update_option( 'wpf_site_id', $outputObject->wpf_site_id );
234 $response = array( 'license' => $outputObject->license, 'expires' => $outputObject->expires, 'payment_id' => $outputObject->payment_id, 'checksum' => $outputObject->checksum, 'executed' => 1 );
235 } else {
236 $response = array( 'license' => $outputObject->license, 'expires' => '', 'executed' => 1 );
237 }
238 } else {
239 $response = array( 'license' => 'invalid', 'expires' => '', 'executed' => 1 );
240 }
241 return $response;
242 }
243 }
244
245 /*
246 * This function is used to save the Settings of the plugin when saved from the "Settings" tab.
247 *
248 * @input NULL
249 * @return Redirect
250 */
251 if ( ! function_exists( 'process_wpfeedback_options' ) ) {
252 function process_wpfeedback_options() {
253 $options = [];
254 // Check that user has proper security level
255 if ( ! current_user_can( 'manage_options' ) ) {
256 wp_die( 'Not allowed' );
257 }
258
259 if ( ! empty( $_FILES ) ) {
260 foreach ( $_FILES as $key => $file ) {
261 if ( is_array( $file ) ) {
262 $temp_wpf_file_name = $file["name"];
263 $temp_wpf_file_type = $file["type"];
264 $fname = explode( ".", $temp_wpf_file_name );
265 $temp_name = $file['tmp_name'];
266 if ( empty( $temp_name ) ) {
267 continue;
268 }
269 $data = file_get_contents( $temp_name );
270 $invalid = 0;
271 if ( ! in_array( $temp_wpf_file_type, array( 'image/jpeg', 'image/png' ) ) ) {
272 $invalid = 1;
273 }
274
275 if ( $invalid == 0 ) {
276 $base64_image = 'data:' . $temp_wpf_file_type . ';base64,' . base64_encode( $data );
277 if ( $key == 'wpf_logo_file' ) {
278 $options['logo']['image'] = $base64_image;
279 $options['logo']['file_name'] = str_replace( ' ', '_', trim( $fname[0] ) );
280 $options['logo']['type'] = $temp_wpf_file_type;
281 }
282 if ( $key == 'wpf_favicon_file' ) {
283 $options['favicon']['image'] = $base64_image;
284 $options['favicon']['file_name'] = str_replace( ' ', '_', trim( $fname[0] ) );
285 $options['favicon']['type'] = $temp_wpf_file_type;
286 }
287 }
288 }
289 }
290 }
291
292 $options['enabled_wpfeedback'] = isset( $_POST['enabled_wpfeedback'] ) ? 'yes' : 'no';
293 $options['wpf_enabled_compact_mode'] = isset( $_POST['wpf_enabled_compact_mode'] ) ? 'yes' : 'no'; /* => v2.1.0 */
294 $options['wpf_enable_clear_cache'] = isset( $_POST['wpf_enable_clear_cache'] ) ? 'yes' : 'no';
295 $options['delete_data_wpfeedback'] = isset( $_POST['delete_data_wpfeedback'] ) ? 'yes' : 'no';
296 $options['wpf_allow_backend_commenting'] = isset( $_POST['wpf_allow_backend_commenting'] ) ? 'yes' : 'no';
297 $options['wpf_show_front_stikers'] = isset( $_POST['wpf_show_front_stikers'] ) ? 'yes' : 'no';
298 $options['wpf_from_email'] = $_POST['wpf_from_email'];
299 $options['wpfeedback_more_emails'] = $_POST['wpfeedback_more_emails'];
300 $options['wpfeedback_powered_by'] = isset( $_POST['wpfeedback_powered_by'] ) ? 'yes' : 'no';
301 $options['wpfeedback_color'] = $_POST['wpfeedback_color'];
302 $options['wpf_powered_link'] = $_POST['wpf_powered_link'];
303 $options['wpfeedback_powered_by'] = isset( $_POST['wpfeedback_powered_by'] ) ? 'yes' : 'no';
304 $options['wpf_every_new_task'] = isset( $_POST['wpf_every_new_task'] ) ? 'yes' : 'no';
305 $options['wpf_every_new_comment'] = isset( $_POST['wpf_every_new_comment'] ) ? 'yes' : 'no';
306 $options['wpf_every_new_complete'] = isset( $_POST['wpf_every_new_complete'] ) ? 'yes' : 'no';
307 $options['wpf_every_status_change'] = isset( $_POST['wpf_every_status_change'] ) ? 'yes' : 'no';
308 $options['wpf_daily_report'] = isset( $_POST['wpf_daily_report'] ) ? 'yes' : 'no';
309 $options['wpf_weekly_report'] = isset( $_POST['wpf_weekly_report'] ) ? 'yes' : 'no';
310 $options['wpf_auto_daily_report'] = isset( $_POST['wpf_auto_daily_report'] ) ? 'yes' : 'no';
311 $options['wpf_auto_weekly_report'] = isset( $_POST['wpf_auto_weekly_report'] ) ? 'yes' : 'no';
312 $options['wpf_tutorial_video'] = stripcslashes( htmlentities( $_POST['wpf_tutorial_video'] ) );
313 $options['wpf_site_id'] = get_option( 'wpf_site_id' );
314
315 $parms = [];
316 foreach ( $options as $key => $value ) {
317 array_push( $parms, ['name' => $key,'value' => $value] );
318 }
319 update_site_data( $parms );
320
321 $wpf_report_register_types = array();
322 if ( isset( $_POST['wpf_auto_daily_report'] ) ) {
323 $wpf_report_register_types['daily'] = 'yes';
324 } else {
325 $wpf_report_register_types['daily'] = 'no';
326 }
327 if ( isset( $_POST['wpf_auto_weekly_report'] ) ) {
328 $wpf_report_register_types['weekly'] = 'yes';
329 } else {
330 $wpf_report_register_types['weekly'] = 'no';
331 }
332 wpf_register_auto_reports_cron( $wpf_report_register_types );
333 wp_redirect( add_query_arg( 'page', 'wpfeedback_page_settings&wpf_setting=1', admin_url( 'admin.php' ) ) );
334 exit;
335 }
336 }
337 add_action( 'admin_post_save_wpfeedback_options', 'process_wpfeedback_options' );
338
339 /*
340 * This function is used to save the Permissions options of the plugin when saved from the "Permissions" tab.
341 *
342 * @input Array ( $_POST )
343 * @return Redirect
344 */
345 if ( ! function_exists( 'process_wpfeedback_misc_options' ) ) {
346 function process_wpfeedback_misc_options() {
347 $options = [];
348 if ( isset( $_POST['edd_license_deactivate'] ) ) {
349 update_option( 'wpf_license', 'invalid', 'no' );
350 }
351 if ( isset( $_POST ) ) {
352 $options['wpf_allow_guest'] = isset( $_POST['wpfeedback_guest_allowed'] ) ? sanitize_text_field( $_POST['wpfeedback_guest_allowed'] ) : 'no';
353 $options['wpf_disable_for_admin'] = isset( $_POST['wpfeedback_disable_for_admin'] ) ? sanitize_text_field( $_POST['wpfeedback_disable_for_admin'] ) : 'no';
354 $options['wpf_disable_autologin'] = isset( $_POST['wpfeedback_disable_autologin'] ) ? sanitize_text_field( $_POST['wpfeedback_disable_autologin'] ) : 'no';
355 $options['wpf_disable_for_app'] = isset( $_POST['wpfeedback_disable_for_app'] ) ? sanitize_text_field( $_POST['wpfeedback_disable_for_app'] ) : 'no';
356 $wpfeedback_selected_roles = '';
357 if ( isset( $_POST['wpfeedback_selcted_role'] ) ) {
358 $wpfeedback_selected_roles = implode( ',', $_POST['wpfeedback_selcted_role'] );
359 } else {
360 $wpfeedback_selected_roles = "administrator";
361 }
362 update_option( 'wpf_selcted_role', $wpfeedback_selected_roles, 'no' );
363 $options['wpf_selcted_role'] = $wpfeedback_selected_roles;
364 $options['wpf_customisations_client'] = sanitize_text_field( $_POST['wpf_customisations_client'] );
365 $options['wpf_customisations_webmaster'] = sanitize_text_field( $_POST['wpf_customisations_webmaster'] );
366 $options['wpf_customisations_others'] = sanitize_text_field( $_POST['wpf_customisations_others'] );
367 $options['wpf_website_client'] = sanitize_text_field( $_POST['wpf_website_client'] );
368 $options['wpf_website_developer'] = sanitize_text_field( $_POST['wpf_website_developer'] );
369 $options['wpf_tab_permission_user_client'] = isset( $_POST['wpf_tab_permission_user_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_client'] ) : 'no';
370 $options['wpf_tab_permission_user_webmaster'] = isset( $_POST['wpf_tab_permission_user_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_webmaster'] ) : 'no';
371 $options['wpf_tab_permission_user_others'] = isset( $_POST['wpf_tab_permission_user_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_others'] ) : 'no';
372 $options['wpf_tab_permission_user_guest'] = isset( $_POST['wpf_tab_permission_user_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_user_guest'] ) : 'no';
373 $options['wpf_tab_permission_priority_client'] = isset( $_POST['wpf_tab_permission_priority_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_client'] ) : 'no';
374 $options['wpf_tab_permission_priority_webmaster'] = isset( $_POST['wpf_tab_permission_priority_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_webmaster'] ) : 'no';
375 $options['wpf_tab_permission_priority_others'] = isset( $_POST['wpf_tab_permission_priority_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_others'] ) : 'no';
376 $options['wpf_tab_permission_priority_guest'] = isset( $_POST['wpf_tab_permission_priority_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_priority_guest'] ) : 'no';
377 $options['wpf_tab_permission_status_client'] = isset( $_POST['wpf_tab_permission_status_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_client'] ) : 'no';
378 $options['wpf_tab_permission_status_webmaster'] = isset( $_POST['wpf_tab_permission_status_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_webmaster'] ) : 'no';
379 $options['wpf_tab_permission_status_others'] = isset( $_POST['wpf_tab_permission_status_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_others'] ) : 'no';
380 $options['wpf_tab_permission_status_guest'] = isset( $_POST['wpf_tab_permission_status_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_status_guest'] ) : 'no';
381 $options['wpf_tab_permission_screenshot_client'] = isset( $_POST['wpf_tab_permission_screenshot_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_client'] ) : 'no';
382 $options['wpf_tab_permission_screenshot_webmaster'] = isset( $_POST['wpf_tab_permission_screenshot_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_webmaster'] ) : 'no';
383 $options['wpf_tab_permission_screenshot_others'] = isset( $_POST['wpf_tab_permission_screenshot_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_others'] ) : 'no';
384 $options['wpf_tab_permission_screenshot_guest'] = isset( $_POST['wpf_tab_permission_screenshot_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_screenshot_guest'] ) : 'no';
385 $options['wpf_tab_permission_information_client'] = isset( $_POST['wpf_tab_permission_information_client'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_client'] ) : 'no';
386 $options['wpf_tab_permission_information_webmaster'] = isset( $_POST['wpf_tab_permission_information_webmaster'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_webmaster'] ) : 'no';
387 $options['wpf_tab_permission_information_others'] = isset( $_POST['wpf_tab_permission_information_others'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_others'] ) : 'no';
388 $options['wpf_tab_permission_information_guest'] = isset( $_POST['wpf_tab_permission_information_guest'] ) ? sanitize_text_field( $_POST['wpf_tab_permission_information_guest'] ) : 'no';
389 $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';
390 $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';
391 $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';
392 $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';
393 $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';
394 $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';
395 $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';
396 $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';
397
398 /* update settings for display stickers */
399 $webmaster_sticker = 'no';
400 if ( isset( $_POST['wpf_tab_permission_display_stickers_webmaster'] ) && $_POST['wpf_tab_permission_display_stickers_webmaster'] == 'yes' ) {
401 $webmaster_sticker = 'yes';
402 }
403
404 $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';
405 $options['wpf_tab_permission_display_stickers_webmaster'] = $webmaster_sticker;
406 $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';
407 $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';
408
409 $webmaster_taskid = 'no';
410 if ( isset( $_POST['wpf_tab_permission_display_task_id_webmaster'] ) && $_POST['wpf_tab_permission_display_task_id_webmaster'] == 'yes' ) {
411 $webmaster_taskid = 'yes';
412 }
413 $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';
414 $options['wpf_tab_permission_display_task_id_webmaster'] = $webmaster_taskid;
415 $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';
416 $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';
417
418 // => v2.1.0
419 $keyboard_shortcut = 'no';
420
421 if ( isset( $_POST['wpf_tab_permission_keyboard_shortcut_webmaster'] ) && $_POST['wpf_tab_permission_keyboard_shortcut_webmaster'] == 'yes' ) {
422 $keyboard_shortcut = 'yes';
423 }
424 $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';
425 $options['wpf_tab_permission_keyboard_shortcut_webmaster'] = $keyboard_shortcut;
426 $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';
427 $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';
428
429 $parms1 = [];
430 foreach ( $options as $key => $value ) {
431 array_push( $parms1, ['name' => $key, 'value' => $value] );
432 }
433 syncUsers();
434 update_site_data( $parms1 );
435
436 if ( isset( $_POST['wpfeedback_licence_key'] ) && $_POST['wpfeedback_licence_key'] != "" ) {
437 if ( $_POST['wpfeedback_licence_key'] != '00000000000000000000000000000000' ) {
438 $wpf_license_key = sanitize_text_field( $_POST['wpfeedback_licence_key'] );
439 $wpf_result = wpf_license_key_license_item( $wpf_license_key );
440 if ( $wpf_result['license'] == 'valid' ) {
441 $wpf_crypt_key = wpf_crypt_key( $wpf_license_key, 'e' );
442 update_option( 'wpf_license_key', $wpf_crypt_key, 'no' );
443 update_option( 'wpf_license', $wpf_result['license'], 'no' );
444 update_option( 'wpf_license_expires', $wpf_result['expires'], 'no' );
445 if ( ! get_option( 'wpf_decr_key' ) ) {
446 update_option( 'wpf_decr_key', $wpf_result['payment_id'], 'no' );
447 update_option( 'wpf_decr_checksum', $wpf_result['checksum'], 'no' );
448 $wpf_crypt_key = wpf_crypt_key( $wpf_license_key, 'e' );
449 update_option( 'wpf_license_key', $wpf_crypt_key, 'no' );
450 }
451 do_action( 'wpf_initial_sync', $wpf_license_key );
452 } else {
453 update_option( 'wpf_license_key', sanitize_text_field( $_POST['wpfeedback_licence_key'] ), 'no' );
454 update_option( 'wpf_license', $wpf_result['license'], 'no' );
455 }
456 }
457 }
458 }
459 wp_redirect( add_query_arg( 'page', 'wpfeedback_page_permissions', admin_url( 'admin.php' ) ) );
460 exit;
461 }
462 }
463 add_action( 'admin_post_save_wpfeedback_misc_options', 'process_wpfeedback_misc_options' );
464
465 /*
466 * This function is used to create a dropdown of the roles available in website on the "Permissions" tab for the selection.
467 *
468 * @input Boolean
469 * @return String
470 */
471 if ( ! function_exists( 'wpfeedback_dropdown_roles' ) ) {
472 function wpfeedback_dropdown_roles( $selected = false ) {
473 global $wp_roles;
474 $p = '';
475 $r = '';
476 $editable_roles = $wp_roles->get_names();
477 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
478 // For backwards compatibility
479 if ( is_string( $selected_roles ) ) {
480 $selected_roles = explode( ',', $selected_roles );
481 foreach ( $editable_roles as $role => $details ) {
482 if ( is_array( $selected_roles ) AND in_array( $role, $selected_roles ) ) // preselect specified role
483 $p .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$details</option>";
484 else
485 $r .= "\n\t<option value='" . esc_attr( $role ) . "'>$details</option>";
486 }
487 }
488 return $p . $r;
489 }
490 }
491
492 /*
493 * This function is used to get the title of the page based on the page ID. This function is not used currently.
494 *
495 * @input Int
496 * @return String
497 */
498 if ( ! function_exists( 'wpf_get_page_title' ) ) {
499 function wpf_get_page_title( $post_id ) {
500 $get_page_id = get_post_meta( $post_id, '_wpf_page_id', true );
501 $page_title = get_the_title( $get_page_id );
502 return $page_title;
503 }
504 }
505
506 /*
507 * This function is used to get the listing of all the wpfeedback tasks.
508 *
509 * @input NULL
510 * @return String
511 */
512 if ( ! function_exists( 'wpfeedback_get_post_list' ) ) {
513 function wpfeedback_get_post_list() {
514 $output = '';
515 $args = array(
516 'numberposts' => -1,
517 'limit' => 20,
518 'page_no' => 1,
519 'post_type' => 'wpfeedback',
520 'orderby' => 'title',
521 'orderby' => 'date',
522 'order' => 'DESC',
523 'task_center' => 1,
524 'wpf_site_id' => get_option( 'wpf_site_id' ),
525 );
526
527
528 /* START */
529 $currnet_user_information = wpf_get_current_user_information();
530 $current_role = $currnet_user_information['role'];
531 $current_user_name = $currnet_user_information['display_name'];
532 $current_user_id = $currnet_user_information['user_id'];
533 $wpf_website_builder = get_site_data_by_key( 'wpf_website_developer' ) == 1 ? get_site_data_by_key( 'wpf_website_developer' ) : 0;
534 if ( $current_user_name == 'Guest' ) {
535 $wpf_website_client = get_site_data_by_key( 'wpf_website_client' ) == 1 ? get_site_data_by_key( 'wpf_website_client' ) : 0;
536 $wpf_current_role = 'guest';
537 if ( $wpf_website_client ) {
538 $wpf_website_client_info = get_userdata( $wpf_website_client );
539 if ( $wpf_website_client_info ) {
540 if ( $wpf_website_client_info->display_name == '' ) {
541 $current_user_name = $wpf_website_client_info->user_nicename;
542 } else {
543 $current_user_name = $wpf_website_client_info->display_name;
544 }
545 }
546 }
547 } else {
548 $wpf_current_role = wpf_user_type();
549 }
550 $current_user_name = addslashes( $current_user_name );
551 if ( $wpf_current_role == 'advisor' ) {
552 $wpf_tab_permission_display_stickers = ( get_site_data_by_key( 'wpf_tab_permission_display_stickers_webmaster' ) != 'no') ? 'yes' : 'no';
553 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no') ? 'yes' : 'no';
554 } elseif ( $wpf_current_role == 'king' ) {
555 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_client' ) == 'yes' ? 'yes' : 'no';
556 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_client' ) == 'yes' ? 'yes' : 'no';
557 } elseif ( $wpf_current_role == 'council' ) {
558 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_others' ) == 'yes' ? 'yes' : 'no';
559 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_others' ) == 'yes' ? 'yes' : 'no';
560 } else {
561 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_guest' ) == 'yes' ? 'yes' : 'no';
562 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_guest' ) == 'yes' ? 'yes' : 'no';
563 }
564 /* END */
565
566 $url = WPF_CRM_API . 'wp-api/all/task-center-tasks';
567 $sendtocloud = json_encode( $args );
568 $myposts = wpf_send_remote_post( $url, $sendtocloud );
569 $data = isset( $myposts['data'] ) ? $myposts['data'] : '' ;
570 $wpf_orphans = array();
571 if ( $myposts ) {
572 $output .= '<ul id="all_wpf_list" style="list-style-type: none; font-size:12px;">';
573 if ( ! empty( $data ) ) {
574 foreach ( $data as $mypost ) {
575 $user_atarim_type = get_user_meta( $current_user_id, 'wpf_user_type', true );
576 if ( $mypost['task']['is_internal'] == '1' ) {
577 if ( $user_atarim_type != 'advisor' ) {
578 continue;
579 }
580 }
581 $post_id = $mypost['task']['id'];
582 $site_task_id = $mypost['task']['site_task_id'];
583 $wpf_task_id = $mypost['task']['wpf_task_id'];
584 $author_id = $mypost['task']['task_config_author_id'];
585 $get_post_date = $mypost['task']['created_at'];
586 $date = strtotime( $get_post_date );
587 $post_date = get_date_from_gmt( date( 'Y-m-d H:i:s', $date ), 'd/m/Y H:i' );
588 $post_title = $mypost['task']['task_title'];
589 $task_page_url = $mypost['task']['task_page_url'];
590 $wpf_task_screenshot = $mypost['task']['wpf_task_screenshot'];
591 $task_page_title = ( $mypost['task']['task_page_title'] != null ) ? $mypost['task']['task_page_title'] : "";
592 $task_config_author_name = $mypost['task']['task_config_author_name'];
593 $task_notify_users = $mypost['task']['task_notify_users'];
594 $task_config_author_resX = $mypost['task']['task_config_author_resX'];
595 $task_config_author_resY = $mypost['task']['task_config_author_resY'];
596 $get_task_type = $mypost['task']['task_type'];
597 $is_internal = $mypost['task']['is_internal'];
598
599 if ( $get_task_type == 'general' ) {
600 $task_type = 'general';
601 $general = '<span class="wpf_task_type">' . __( "General", 'atarim-visual-collaboration' ) . '</span>';
602 } elseif ( $get_task_type == 'email' ) { //!email
603 $task_type = 'email';
604 $general = '<span class="wpf_task_type">' . __( "Email", 'atarim-visual-collaboration' ) . '</span>';
605 } else {
606 $task_type = '';
607 $general = '';
608 }
609 if ( $is_internal == '1' ) {
610 $internal = '<span class="wpf_task_type" title="Task type">' . __( "Internal", 'atarim-visual-collaboration' ) . '</span>';
611 $internal_icon = $internal_icon_html = '<span class="wpf_chevron_wrapper"><img src="' . WPF_PLUGIN_URL . 'images/eye-off-white.svg" alt="eye off white" class="wpf-internal-img"></span>';
612 $internal_class = 'wpfb-internal';
613 } else {
614 $internal = '';
615 $internal_icon = '';
616 $internal_class = '';
617 }
618
619 //create list of orphan tasks
620 if ( $get_task_type == "general" && ( $mypost['task']['wpfb_task_bubble'] != NULL ) ) {
621 $wpf_orphans[] = $post_id;
622 }
623 if ( $mypost['task']['is_admin_task'] == 1 ) {
624 $wpf_task_status = 'wpf_admin';
625 $admin_tag = '<span class="wpf_task_type">' . __( "Admin", 'atarim-visual-collaboration' ) . '</span>';
626 } else {
627 $wpf_task_status = 'public';
628 $admin_tag = '';
629 }
630
631 $task_config_author_browser = $mypost['task']['task_config_author_browser'];
632 $task_config_author_browserVersion = $mypost['task']['task_config_author_browserVersion'];
633 $task_comment_id = $mypost['task']['wpf_task_id'];
634 $task_priority = $mypost['task']['task_priority'];
635 $task_status = $mypost['task']['task_status'];
636 $task_tags = $mypost['task']['tags'];
637 $all_other_tag = '';
638 $wpfb_tags_html = '';
639
640 if ( $task_tags ) {
641 $tag_length = count( $task_tags );
642 $wpfb_tags_html = '<div class="wpf_task_tags">';
643 $i = 1;
644 foreach ( $task_tags as $task_tag => $task_tags_value ) {
645 if ( $i == 1 ) {
646 $wpfb_tags_html .= '<span class="wpf_task_tag">' . $task_tags_value["tag"] . '</span>';
647 } else {
648 if ( $tag_length == $i ) {
649 $all_other_tag .= $task_tags_value['tag'];
650 } else {
651 $all_other_tag .= $task_tags_value["tag"].', ';
652 }
653 }
654 $i++;
655 }
656 if ( $tag_length > 1 ) {
657 $wpfb_tags_html .= '<span class="wpf_task_tag_more" title="' . $all_other_tag . '">...</span>';
658 }
659 $wpfb_tags_html .= '</div>';
660 }
661 $task_date = $mypost['task']['created_at'];
662 $task_date = strtotime( $task_date );
663 $task_date = get_date_from_gmt( date( 'Y-m-d H:i:s', $task_date ), 'Y-m-d H:i:s' );
664 $task_date1 = date_create($task_date);
665 $wpf_wp_current_timestamp = date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) );
666 $task_date2 = date_create( $wpf_wp_current_timestamp );
667 $curr_task_time = wpfb_time_difference( $task_date1, $task_date2 );
668 $display_span = '';
669 $custom_class = '';
670 if ( $wpf_tab_permission_display_stickers == 'yes' ) {
671 $display_span = '<span class="' . $task_priority . '_custom wpf_top_badge"></span> ';
672 $custom_class = $task_status . "_custom";
673 }
674 $display_check_mark = '';
675 if ( $wpf_tab_permission_display_task_id != 'yes' ) {
676 $display_check_mark = '<i class="gg-check"></i>';
677 } else {
678 $display_check_mark = '<span class="wpf_bubble_num_wrapper">' . $mypost['task']['site_task_id'] . '</span>' . $internal_icon;//$task_comment_id;
679 }
680 if ( $task_status == 'complete' ) {
681 $bubble_label = $display_span . $display_check_mark;
682 } else {
683 $bubble_label = $display_span . '<span class="wpf_bubble_num_wrapper">' . $mypost['task']['site_task_id'] . '</span>' . $internal_icon;//$task_comment_id;
684 }
685 $author = get_task_author( $mypost['task'] );
686 $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>';
687 $wpf_task_priority_label = '<span class="task_priority wpf_' . $task_priority . '" title="Priority: ' . $task_priority . '">' . get_wpf_priority_icon() . '</span></div>';
688 $author_name = "'" . $author . "'";
689 $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 ', 'atarim-visual-collaboration' ) . $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 . '"
690 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>';
691 }
692 }
693 wp_reset_postdata();
694 $output .= '</ul>';
695 } else {
696 $output = '<div class="wpf_no_tasks_found"><i class="gg-info"></i> No tasks found</div>';
697 }
698 $response[0] = $output;
699 $response[1] = $wpf_orphans;
700 return $response;
701 }
702 }
703
704 /*
705 * This function is used to get the logo to be displayed on the backend and sidebar.
706 *
707 * @input NULL
708 * @return String
709 */
710 if ( ! function_exists( 'get_wpf_logo' ) ) {
711 function get_wpf_logo() {
712 $wpf_global_settings = get_site_data_by_key( 'wpf_global_settings' );
713 $get_logoid = get_site_data_by_key( 'wpfeedback_logo' );
714 if ( $wpf_global_settings == 'yes' ) {
715 $get_logo_url = $get_logoid;
716 } else {
717 if ( $get_logoid != '' ) {
718 $get_logo_url = $get_logoid;
719 } else {
720 $get_logo_url = esc_url( WPF_PLUGIN_URL . 'images/Atarim.svg' );
721 }
722 }
723 return $get_logo_url;
724 }
725 }
726
727 if ( ! function_exists( 'get_wpf_favicon' ) ) {
728 function get_wpf_favicon() {
729 $wpf_global_settings = get_site_data_by_key( 'wpf_global_settings' );
730 $get_faviconid = get_site_data_by_key( 'wpfeedback_favicon' );
731 if ( $wpf_global_settings == 'yes' ) {
732 $get_favicon_url = $get_faviconid;
733 } else {
734 if ( $get_faviconid != '' ) {
735 $get_favicon_url = $get_faviconid;
736 } else {
737 $get_favicon_url = esc_url( WPF_PLUGIN_URL . 'images/atarim_icon.svg' );
738 }
739 }
740 if ( $get_faviconid == '' ) {
741 $get_favicon_url = esc_url( WPF_PLUGIN_URL . 'images/atarim_icon.svg' );
742 }
743 return $get_favicon_url;
744 }
745 }
746
747 /*
748 * no image svg
749 */
750 if ( ! function_exists( 'get_wpf_no_image' ) ) {
751 function get_wpf_no_image() {
752 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>';
753 }
754 }
755
756 /*
757 * get user profile svg icon
758 */
759 if ( ! function_exists( 'get_wpf_user_icon' ) ) {
760 function get_wpf_user_icon() {
761 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>';
762 }
763 }
764
765 /*
766 * get user screenshot svg icon
767 */
768 if ( ! function_exists( 'get_wpf_screenshot_icon' ) ) {
769 function get_wpf_screenshot_icon() {
770 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>';
771 }
772 }
773
774 /*
775 * get share svg icon
776 */
777 if ( ! function_exists( 'get_wpf_share_icon' ) ) {
778 function get_wpf_share_icon() {
779 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>';
780 }
781 }
782
783 /*
784 * get status svg icon
785 */
786 if ( ! function_exists( 'get_wpf_status_icon' ) ) {
787 function get_wpf_status_icon() {
788 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>';
789 }
790 }
791
792 /*
793 * get priority svg icon
794 */
795 if ( ! function_exists( 'get_wpf_priority_icon' ) ) {
796 function get_wpf_priority_icon() {
797 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>';
798 }
799 }
800
801 /*
802 * get info svg icon
803 */
804 if ( ! function_exists( 'get_wpf_info_icon' ) ) {
805 function get_wpf_info_icon() {
806 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>';
807 }
808 }
809
810 /*
811 * get visibility svg icon
812 */
813 if ( ! function_exists( 'get_wpf_visibility_icon' ) ) {
814 function get_wpf_visibility_icon() {
815 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>';
816 }
817 }
818
819 /*
820 * get exclamation(?) svg icon
821 */
822 if ( ! function_exists( 'get_wpf_exclamation_icon' ) ) {
823 function get_wpf_exclamation_icon() {
824 return '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" color="#272d3c" height="55" xmlns="http://www.w3.org/2000/svg" style="color: #272d3c;"><path fill="none" d="M0 0h24v24H0z"></path><path d="M22 5.18L10.59 16.6l-4.24-4.24 1.41-1.41 2.83 2.83 10-10L22 5.18zM12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8c1.57 0 3.04.46 4.28 1.25l1.45-1.45A10.02 10.02 0 0012 2C6.48 2 2 6.48 2 12s4.48 10 10 10c1.73 0 3.36-.44 4.78-1.22l-1.5-1.5c-1 .46-2.11.72-3.28.72zm7-5h-3v2h3v3h2v-3h3v-2h-3v-3h-2v3z"></path></svg>';
825 }
826 }
827
828 /*
829 * get plus svg icon
830 */
831 if ( ! function_exists( 'get_wpf_plus_icon' ) ) {
832 function get_wpf_plus_icon() {
833 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>';
834 }
835 }
836
837 /*
838 * get close svg icon
839 */
840 if ( ! function_exists( 'get_wpf_close_icon' ) ) {
841 function get_wpf_close_icon() {
842 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>';
843 }
844 }
845
846 /*
847 * get right svg icon
848 */
849 if ( ! function_exists( 'get_wpf_right_icon' ) ) {
850 function get_wpf_right_icon() {
851 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>';
852 }
853 }
854
855 /*
856 * get pro svg icon
857 */
858 if ( ! function_exists( 'get_wpf_pro_icon' ) ) {
859 function get_wpf_pro_icon() {
860 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>';
861 }
862 }
863
864 /*
865 * get atarim svg icon
866 */
867 if ( ! function_exists( 'get_wpf_icon' ) ) {
868 function get_wpf_icon() {
869 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>';
870 }
871 }
872
873 /*
874 * get report svg icon
875 */
876 if ( ! function_exists( 'get_wpf_report_icon' ) ) {
877 function get_wpf_report_icon() {
878 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>';
879 }
880 }
881
882 /*
883 * get download icon
884 */
885 if ( ! function_exists( 'get_wpf_image_download_icon' ) ) {
886 function get_wpf_image_download_icon() {
887 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>';
888 }
889 }
890
891 /*
892 * get open icon
893 */
894 if ( ! function_exists( 'get_wpf_image_open_icon' ) ) {
895 function get_wpf_image_open_icon() {
896 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>';
897 }
898 }
899
900 /*
901 * push to media icon
902 */
903 if ( ! function_exists( 'get_wpf_push_to_media_icon' ) ) {
904 function get_wpf_push_to_media_icon() {
905 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>';
906 }
907 }
908
909
910 /*
911 * This function is used to display the success/error notice for settings saving. This function is not used currently.
912 *
913 * @input NULL
914 * @return NULL
915 */
916 if ( ! function_exists( 'wpf_admin_notice_success' ) ) {
917 function wpf_admin_notice_success() {
918 if ( isset( $_GET['wpf_setting'] ) && $_GET['wpf_setting'] == 1 ) {
919 ?>
920 <div class="notice notice-success is-dismissible">
921 <p><?php _e( 'Your settings have been saved!', 'atarim-visual-collaboration' ); ?></p>
922 </div>
923 <?php }
924
925 if ( isset( $_GET['wpf_setting'] ) && $_GET['wpf_setting'] == 0 ) {
926 ?>
927 <div class="error notice is-dismissible">
928 <p><?php _e( 'Your Settings not saved. ', 'atarim-visual-collaboration' ); ?></p>
929 </div>
930 <?php }
931 }
932 }
933 //add_action( 'admin_notices', 'wpf_admin_notice_success' );
934
935 /*
936 * This function is used to get the role of current logged in user. This function is not used currently.
937 *
938 * @input NULL
939 * @return String
940 */
941 if ( ! function_exists( 'wpf_get_current_user_roles' ) ) {
942 function wpf_get_current_user_roles() {
943 if ( is_user_logged_in() ) {
944 $user = wp_get_current_user();
945 $roles = ( array )$user->roles;
946 return $roles[0];
947 } else {
948 return 'Guest';
949 }
950 }
951 }
952
953
954 if ( ! function_exists( 'wpf_get_current_user_information' ) ) {
955 function wpf_get_current_user_information( $author_id = '' ) {
956 $response = array();
957 if ( ! is_user_logged_in() ) {
958 $wpfb_users_json = do_shortcode( '[wpf_user_list_front]' );
959 $wpfb_users = json_decode( $wpfb_users_json );
960 $wpf_website_developer = !empty( get_site_data_by_key( 'wpf_website_client' ) ) ? get_site_data_by_key( 'wpf_website_client' ) : 0;
961 // Allow user if used Share version 2 by Pratap
962 if ( isset( $_COOKIE['wordpress_avc_allow_guest'] ) && $_COOKIE['wordpress_avc_allow_guest'] != '' ) {
963 $user = json_decode( stripslashes( $_COOKIE['wordpress_avc_allow_guest'] ), true );
964 $response['first_name'] = $user['fname'];
965 $response['display_name'] = $user['dname'];
966 $response['role'] = $user['role'];
967 $response['user_id'] = $user['id'];
968 return $response;
969 }
970 }
971
972 if ( $author_id != '' ) {
973 $user = get_userdata( $author_id );
974 $user_details = ( array )$user->data;
975 $roles = ( array )$user->roles;
976 $roles = array_values( $roles );
977 $response['first_name'] = $user_details['first_name'] ?? "";
978 $response['last_name'] = $user_details['last_name'] ?? "";
979 $response['display_name'] = $user_details['display_name'];
980 $response['user_id'] = $user_details['ID'];
981 $response['role'] = $roles[0];
982 return $response;
983 } elseif ( is_user_logged_in() == true ) {
984 $user = wp_get_current_user();
985 $user_details = ( array )$user->data;
986 $roles = ( array )$user->roles;
987 $roles = array_values( $roles );
988 // to ge the first and last name
989 $user_meta = get_user_meta( $user_details['ID'] );
990 $response['first_name'] = ( ! empty( $user_meta['first_name'][0] ) ) ? $user_meta['first_name'][0] : "";
991 $response['last_name'] = ( ! empty( $user_meta['last_name'][0] ) ) ? $user_meta['last_name'][0] : "";
992 $response['display_name'] = $user_details['display_name'];
993 $response['user_id'] = $user_details['ID'];
994 $response['role'] = $roles[0];
995 return $response;
996 } elseif ( $wpf_website_developer != 0 ) {
997 foreach ( $wpfb_users as $key => $val ) {
998 if ( $wpf_website_developer == $key ) {
999 /**
1000 * user id was not matching in graphics page when guest mode on and default user selected
1001 * => v2.1.0
1002 */
1003 if ( intval( $wpf_website_developer ) > 0 ) {
1004 $user = get_user_by( 'id', $val->username );
1005 $response['first_name'] = $val->first_name ?? "";
1006 $response['last_name'] = $val->last_name ?? "";
1007 $response['display_name'] = $val->displayname;
1008 $response['user_id'] = $wpf_website_developer;
1009
1010 if ( ! empty( $user->roles ) ) {
1011 $roles = array_values( $user->roles );
1012 $response['role'] = $roles[0];
1013 } else {
1014 $response['role'] = 'Guest';
1015 }
1016 } else {
1017 $response['first_name'] = $val->first_name ?? "";
1018 $response['last_name'] = $val->last_name ?? "";
1019 $response['display_name'] = $val->displayname;
1020 $response['user_id'] = 0;
1021 $response['role'] = 'Guest';
1022 }
1023 return $response;
1024 }
1025 }
1026
1027 $response['display_name'] = 'Guest';
1028 $response['user_id'] = 0;
1029 $response['role'] = 'Guest';
1030 return $response;
1031 } else {
1032 $response['display_name'] = 'Guest';
1033 $response['user_id'] = 0;
1034 $response['role'] = 'Guest';
1035 return $response;
1036 }
1037 }
1038 }
1039
1040 /*
1041 * 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.
1042 *
1043 * @input Timestamp, Timestamp
1044 * @return Array
1045 */
1046 if ( ! function_exists( 'wpfb_time_difference' ) ) {
1047 function wpfb_time_difference( $datetime1, $datetime2 ) {
1048 $response = array();
1049 $interval = date_diff( $datetime1, $datetime2 );
1050 if ( $interval->y == 0 ) {
1051 if ( $interval->m == 0 ) {
1052 if ( $interval->d == 0 ) {
1053 if ( $interval->h == 0 ) {
1054 if ( $interval->i == 0 ) {
1055 $comment_time = $interval->s . __( 'sec', 'atarim-visual-collaboration' );
1056 } else {
1057 $comment_time = $interval->i . __( 'min', 'atarim-visual-collaboration' );
1058 }
1059 } else {
1060 $comment_time = $interval->h . __( 'hr', 'atarim-visual-collaboration' );
1061 }
1062 } else {
1063 $comment_time = $interval->d . __( 'd', 'atarim-visual-collaboration' );
1064 }
1065 } else {
1066 $comment_time = $interval->m . __( 'month', 'atarim-visual-collaboration' );
1067 }
1068 } else {
1069 $comment_time = $interval->y . __( 'year', 'atarim-visual-collaboration' );
1070 }
1071 $response['interval'] = $interval;
1072 $response['comment_time'] = $comment_time;
1073 return $response;
1074 }
1075 }
1076
1077 /*
1078 * This function is used to get the listing of status and priorities inside the Tasks Center.
1079 *
1080 * @input String
1081 * @return String
1082 */
1083 if ( ! function_exists( 'wp_feedback_get_texonomy_selectbox' ) ) {
1084 function wp_feedback_get_texonomy_selectbox( $my_term ) {
1085 $filter_data = get_option( 'filter_data' );
1086 $filter_data_db = $filter_data[$my_term];
1087
1088 //edited by Pratap
1089 $disable = '';
1090 if ( $my_term == 'task_status' || $my_term == 'task_priority' ) {
1091 if ( !is_feature_enabled( 'task_center' ) ) {
1092 $disable = 'disabled';
1093 }
1094 }
1095
1096 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
1097 echo '<select id="task_' . $my_term . '_attr" onchange="' . $my_term . '_changed(this);" '. $disable .'>';
1098 foreach ( $filter_data_db as $term ) {
1099 if ( $term['label'] == 'In Progress' ) {
1100 $term['label'] = 'In Prog';
1101 } elseif ( $term['label'] == 'Pending Review' ) {
1102 $term['label'] = 'Pending';
1103 } else {
1104 $term['label'] = $term['label'];
1105 }
1106 echo '<option name="' . $my_term . '" value="' . $term['value'] . '" class="wpf_task" id="wpf_' . $term['value'] . '"/>' . __( $term['label'], 'atarim-visual-collaboration' ) . '</option>';
1107 }
1108 echo '</select>';
1109 }
1110 }
1111 }
1112
1113 /*
1114 * This function is used to check if Atarim is enabled on the website.
1115 *
1116 * @input Int
1117 * @return Boolean
1118 */
1119 if ( ! function_exists( 'wpf_check_if_enable' ) ) {
1120 function wpf_check_if_enable( $author_id = '' ) {
1121 if ( $author_id == '' ) {
1122 $current_user_information = wpf_get_current_user_information();
1123 $user = wp_get_current_user();
1124 } else {
1125 $current_user_information = wpf_get_current_user_information( $author_id );
1126 $user = get_userdata( $author_id );
1127 }
1128
1129 $wpf_license = get_option( 'wpf_license' );
1130 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1131 $wpf_selcted_role = get_site_data_by_key( 'wpf_selcted_role' );
1132 $wpf_allow_guest = get_site_data_by_key( 'wpf_allow_guest' );
1133 $selected_roles = explode( ',', $wpf_selcted_role );
1134 $user_details = ( array )$user->data;
1135 $roles = ( array )$user->roles;
1136 $roles = array_values( $roles );
1137 // Allow user if used Share version 2 by Pratap
1138 if ( isset( $_COOKIE['wordpress_avc_allow_guest'] ) ) {
1139 $wpf_allow_guest = 'yes';
1140 }
1141
1142 if ( isset( $_COOKIE['wordpress_avc_guest'] ) ) {
1143 $wpf_allow_guest = 'yes';
1144 }
1145
1146 if ( $wpf_license == 'valid' && $wpf_enabled == 'yes' && ( ! empty( array_intersect( $roles, $selected_roles ) ) || $wpf_allow_guest == 'yes' ) ) {
1147 $wpf_access_output = 1;
1148 } else {
1149 $wpf_access_output = 0;
1150 }
1151 return $wpf_access_output;
1152 }
1153 }
1154
1155 /*
1156 * This function is used to get extra user settings for the Atarim.
1157 *
1158 * @input Object
1159 * @return NULL
1160 */
1161 if ( ! function_exists( 'wpf_show_extra_profile_fields' ) ) {
1162 function wpf_show_extra_profile_fields( $user ) {
1163 $wpf_get_user_type = get_user_meta( $user->ID, 'wpf_user_type', true );
1164 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
1165 $selected_roles = explode( ',', $selected_roles );
1166 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1167 if ( ( array_intersect( $user->roles, $selected_roles ) && $wpf_enabled == 'yes' ) || current_user_can( 'administrator' ) ) {
1168 $notifications_html = wpf_get_allowed_notification_list( $user->ID, 'no' );
1169 ?>
1170 <h3><?php _e( 'Collaborate Information', 'atarim-visual-collaboration' ); ?></h3>
1171 <table class="form-table wpf_fields">
1172 <tr>
1173 <th><label for="wpf_user_type"><?php _e( "User Type", 'atarim-visual-collaboration' ); ?></label></th>
1174 <td>
1175 <select id="wpf_user_type" name="wpf_user_type">
1176 <option value="" <?php if ( $wpf_get_user_type == '' ) { echo 'selected'; } ?> ><?php _e( 'Select', 'atarim-visual-collaboration' ) ?></option>
1177 <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>
1178 <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>
1179 <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>
1180 </select>
1181 </td>
1182 </tr>
1183 <tr>
1184 <th><label for="city"><?php _e( "Email notifications", 'atarim-visual-collaboration' ); ?></label></th>
1185 <td>
1186 <?php echo $notifications_html; ?>
1187 </td>
1188 </tr>
1189 </table>
1190 <?php
1191 }
1192 }
1193 }
1194 add_action( 'show_user_profile', 'wpf_show_extra_profile_fields' );
1195 add_action( 'edit_user_profile', 'wpf_show_extra_profile_fields' );
1196
1197 /*
1198 * This function is used to save the extra user settings for the Atarim.
1199 *
1200 * @input Int
1201 * @return Boolean
1202 */
1203 if ( ! function_exists( 'wpf_save_user_profile_fields' ) ) {
1204 function wpf_save_user_profile_fields( $user_id ) {
1205 syncUsers();
1206 $user = get_userdata( $user_id );
1207 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
1208 $selected_roles = explode( ',', $selected_roles );
1209 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1210 $args = array(
1211 'wpf_site_id' => get_option( 'wpf_site_id' ),
1212 'wpf_id' => sanitize_text_field( $_POST['user_id'] ),
1213 'username' => $user->data->user_login,
1214 'wpf_email' => sanitize_email( $_POST['email'] ),
1215 'first_name' => sanitize_text_field( $_POST['first_name'] ),
1216 'last_name' => sanitize_text_field( $_POST['last_name'] ),
1217 'wpf_user_type' => sanitize_text_field( $_POST['wpf_user_type'] ),
1218 );
1219
1220 update_user_meta( $user->ID, 'wpf_user_type', sanitize_text_field( $_POST['wpf_user_type'] ) );
1221
1222 if ( ( array_intersect( $user->roles, $selected_roles ) && $wpf_enabled == 'yes' && current_user_can( 'edit_user', $user_id ) ) || current_user_can( 'administrator' ) ) {
1223 $options = [];
1224 $options['wpf_site_id'] = get_option( 'wpf_site_id' );
1225 $options['wpf_every_new_task'] = isset( $_POST['wpf_every_new_task'] ) ? 1 : 0;
1226 $options['wpf_every_new_comment'] = isset( $_POST['wpf_every_new_comment'] ) ? 1 : 0;
1227 $options['wpf_every_new_complete'] = isset( $_POST['wpf_every_new_complete'] ) ? 1 : 0;
1228 $options['wpf_every_status_change'] = isset( $_POST['wpf_every_status_change'] ) ? 1 : 0;
1229 $options['wpf_daily_report'] = isset( $_POST['wpf_daily_report'] ) ? 1 : 0;
1230 $options['wpf_weekly_report'] = isset( $_POST['wpf_weekly_report'] ) ? 1 : 0;
1231 $options['wpf_auto_daily_report'] = isset( $_POST['wpf_auto_daily_report'] ) ? 1 : 0;
1232 $options['wpf_auto_weekly_report'] = isset( $_POST['wpf_auto_weekly_report'] ) ? 1 : 0;
1233 $args['notifications'] = $options;
1234 $url = WPF_CRM_API . 'wp-api/wpfuser/update';
1235 $res = wpf_send_remote_post( $url, json_encode( $args ) );
1236 } else {
1237 return false;
1238 }
1239 }
1240 }
1241 add_action( 'personal_options_update', 'wpf_save_user_profile_fields' );
1242 add_action( 'edit_user_profile_update', 'wpf_save_user_profile_fields' );
1243
1244 // sync users
1245 function wpf_sync_users( $user_id ) {
1246 syncUsers();
1247 }
1248 add_action( 'user_register', 'wpf_sync_users' );
1249 add_action( 'deleted_user', 'wpf_sync_users', 10 );
1250 add_action( 'profile_update', 'wpf_sync_users', 10 );
1251
1252 // sync pages
1253 function wpf_sync_posts( $post_id ) {
1254 syncPages();
1255 }
1256 add_action( 'save_post', 'wpf_sync_posts' );
1257 add_action( 'delete_post', 'wpf_sync_posts', 10 );
1258
1259 /* update WP pages into API */
1260 function syncPages() {
1261 $pages = wpf_get_page_list( 'api' );
1262 $args = [];
1263 $args['wpf_site_id'] = get_option( 'wpf_site_id' );
1264 $args['responseBody'] = json_decode( $pages );
1265 $url = WPF_CRM_API . "wp-api/sync/pages";
1266 $sendtocloud = json_encode( $args );
1267 $res = wpf_send_remote_post( $url, $sendtocloud );
1268 }
1269
1270 /* update WP users into API */
1271 function syncUsers() {
1272 $users = wpf_api_func_get_users();
1273 $args = [];
1274 $args['wpf_site_id'] = get_option( 'wpf_site_id' );
1275 $args['responseBody'] = json_decode( $users );
1276 // get all the user ID
1277 $wp_users = get_users( array( 'fields' => array( 'ID' ) ) );
1278 // flaten the data to a single array and added to the request
1279 $args['wpf_wp_user_ids'] = array_map( function( $user ) {
1280 return $user->ID;
1281 }, $wp_users );
1282
1283 $url = WPF_CRM_API . "wp-api/sync/users";
1284 $sendtocloud = json_encode( $args );
1285 $res = wpf_send_remote_post( $url, $sendtocloud );
1286 }
1287
1288
1289 function syncSite() {
1290 $url = WPF_CRM_API . 'wp-api/wpfsite/update';
1291 $response = array();
1292 $response['wpf_site_id'] = get_option( 'wpf_site_id' );
1293 $response['url'] = get_option( 'siteurl' );
1294 $response['name'] = get_option( 'blogname' );
1295 $body = json_encode( $response );
1296 $res = wpf_send_remote_post( $url, $body );
1297 }
1298
1299 add_action( 'update_option_blogname', function( $old_value, $new_value ) {
1300 syncSite();
1301 }, 10, 2);
1302
1303 add_action( 'update_option_siteurl', function( $old_value, $new_value ) {
1304 syncSite();
1305 }, 10, 2);
1306
1307 /*
1308 * This function is used to get the allowed notification list to be displayed on the users extra settings.
1309 *
1310 * @input Int, String
1311 * @return String
1312 */
1313 if ( ! function_exists( 'wpf_get_allowed_notification_list' ) ) {
1314 function wpf_get_allowed_notification_list( $userid, $default = 'no' ) {
1315 $wpf_site_id = get_option( 'wpf_site_id' );
1316 $args = [];
1317 $args['wpf_site_id'] = $wpf_site_id;
1318 $args['wpf_user_id'] = $userid;
1319 $url = WPF_CRM_API . "wp-api/wpfuser/getWpfUser";
1320 $sendtocloud = json_encode( $args );
1321 $res = wpf_send_remote_post( $url, $sendtocloud );
1322 $response = '';
1323 $wpf_every_new_task = get_site_data_by_key( 'wpf_every_new_task' );
1324 $wpf_every_new_comment = get_site_data_by_key( 'wpf_every_new_comment' );
1325 $wpf_every_new_complete = get_site_data_by_key( 'wpf_every_new_complete' );
1326 $wpf_every_status_change = get_site_data_by_key( 'wpf_every_status_change' );
1327 $wpf_daily_report = get_site_data_by_key( 'wpf_daily_report' );
1328 $wpf_weekly_report = get_site_data_by_key( 'wpf_weekly_report' );
1329 $wpf_auto_daily_report = get_site_data_by_key( 'wpf_auto_daily_report' );
1330 $wpf_auto_weekly_report = get_site_data_by_key( 'wpf_auto_weekly_report' );
1331 if ( $wpf_every_new_task == 'yes' ) {
1332 if ( isset( $res['data']['preference']['every_new_task'] ) && $res['data']['preference']['every_new_task'] == 1 ) {
1333 $checked = 'checked';
1334 } else {
1335 $checked = '';
1336 }
1337 if ( $default == 'yes' ) {
1338 $checked = 'checked';
1339 }
1340 $response .= '<div><input type="checkbox" name="wpf_every_new_task" value="yes" class="wpf_checkbox"
1341 id="wpf_every_new_task" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_every_new_task">' . __( 'Receive email notification for every new task', 'atarim-visual-collaboration' ) . '</label></div>';
1342 }
1343 if ( $wpf_every_new_comment == 'yes' ) {
1344 if ( isset( $res['data']['preference']['every_new_comment'] ) && $res['data']['preference']['every_new_comment'] == 1 ) {
1345 $checked = 'checked';
1346 } else {
1347 $checked = '';
1348 }
1349 if ( $default == 'yes' ) {
1350 $checked = 'checked';
1351 }
1352 $response .= '<div><input type="checkbox" name="wpf_every_new_comment" value="yes" class="wpf_checkbox"
1353 id="wpf_every_new_comment" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_every_new_comment">' . __( 'Receive email notification for every new comment', 'atarim-visual-collaboration' ) . '</label></div>';
1354 }
1355 if ( $wpf_every_new_complete == 'yes' ) {
1356 if ( isset( $res['data']['preference']['wpf_every_new_complete'] ) && $res['data']['preference']['wpf_every_new_complete'] == 1 ) {
1357 $checked = 'checked';
1358 } else {
1359 $checked = '';
1360 }
1361 if ( $default == 'yes' ) {
1362 $checked = 'checked';
1363 }
1364 $response .= '<div><input type="checkbox" name="wpf_every_new_complete" value="yes" class="wpf_checkbox"
1365 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', 'atarim-visual-collaboration' ) . '</label></div>';
1366 }
1367 if ( $wpf_every_status_change == 'yes' ) {
1368 if ( isset( $res['data']['preference']['every_status_change'] ) && $res['data']['preference']['every_status_change'] == 1 ) {
1369 $checked = 'checked';
1370 } else {
1371 $checked = '';
1372 }
1373 if ( $default == 'yes' ) {
1374 $checked = 'checked';
1375 }
1376 $response .= '<div><input type="checkbox" name="wpf_every_status_change" value="yes" class="wpf_checkbox"
1377 id="wpf_every_status_change" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_every_status_change">' . __( 'Receive email notification for every status change', 'atarim-visual-collaboration' ) . '</label></div>';
1378 }
1379 if ( $wpf_daily_report == 'yes' ) {
1380 if ( isset( $res['data']['preference']['daily_report'] ) && $res['data']['preference']['daily_report'] == 1 ) {
1381 $checked='checked';
1382 } else {
1383 $checked = '';
1384 }
1385 if ( $default == 'yes' ) {
1386 $checked = 'checked';
1387 }
1388 $response .= '<div><input type="checkbox" name="wpf_daily_report" value="yes" class="wpf_checkbox"
1389 id="wpf_daily_report" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_daily_report">' . __( 'Receive email notification for daily report', 'atarim-visual-collaboration' ) . '</label></div>';
1390 }
1391 if ( $wpf_weekly_report == 'yes' ) {
1392 if ( isset( $res['data']['preference']['weekly_report'] ) && $res['data']['preference']['weekly_report'] == 1 ) {
1393 $checked='checked';
1394 } else {
1395 $checked = '';
1396 }
1397 if ( $default == 'yes' ) {
1398 $checked = 'checked';
1399 }
1400 $response .= '<div><input type="checkbox" name="wpf_weekly_report" value="yes" class="wpf_checkbox"
1401 id="wpf_weekly_report" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_weekly_report">' . __( 'Receive email notification for weekly report', 'atarim-visual-collaboration' ) . '</label></div>';
1402 }
1403 if ( is_feature_enabled( 'auto_reports' ) ) {
1404 if ( $wpf_auto_daily_report == 'yes' ) {
1405 if ( isset( $res['data']['preference']['wpf_auto_daily_report'] ) && $res['data']['preference']['wpf_auto_daily_report'] == 1 ) {
1406 $checked = 'checked';
1407 } else {
1408 $checked = '';
1409 }
1410 if ( $default == 'yes' ) {
1411 $checked = 'checked';
1412 }
1413 $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', 'atarim-visual-collaboration' ) . '</label></div>';
1414 }
1415 if ( $wpf_auto_weekly_report == 'yes' ) {
1416 if ( isset( $res['data']['preference']['wpf_auto_weekly_report'] ) && $res['data']['preference']['wpf_auto_weekly_report'] == 1 ) {
1417 $checked = 'checked';
1418 } else {
1419 $checked = '';
1420 }
1421 if ( $default == 'yes' ) {
1422 $checked = 'checked';
1423 }
1424 $response .= '<div><input type="checkbox" name="wpf_auto_weekly_report" value="yes" class="wpf_checkbox"
1425 id="wpf_auto_weekly_report" ' . $checked . ' /><label class="wpf_checkbox_label" for="wpf_auto_weekly_report">' . __( 'Auto receive email notification for weekly report', 'atarim-visual-collaboration' ) . '</label></div>';
1426 }
1427 }
1428 return $response;
1429 }
1430 }
1431
1432 /*
1433 * This function is used to get the Atarim user type.
1434 *
1435 * @input NULL
1436 * @return String
1437 */
1438 if ( ! function_exists( 'wpf_user_type' ) ) {
1439 function wpf_user_type() {
1440 global $current_user;
1441 return get_user_meta( $current_user->ID, 'wpf_user_type', true );
1442 }
1443 }
1444
1445 /*
1446 * This function is used to verify if the uploaded file is valid or not.
1447 *
1448 * @input File
1449 * @return Boolean
1450 */
1451 if ( ! function_exists( 'wpf_verify_file_upload' ) ) {
1452 function wpf_verify_file_upload( $server, $file_data ) {
1453 $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' );
1454 if ( function_exists( 'finfo_open' ) ) {
1455 $imgdata = base64_decode( $file_data );
1456 $f = finfo_open();
1457 $mime_type = finfo_buffer( $f, $imgdata, FILEINFO_MIME_TYPE );
1458 if ( in_array( $mime_type, $allowed_file_types ) ) {
1459 $response = 0;
1460 } else {
1461 $response = 1;
1462 }
1463 } else {
1464 $response = 0;
1465 }
1466 return $response;
1467 }
1468 }
1469
1470 /*
1471 * This function is used to verify if the uploaded file extension is proper or not.
1472 *
1473 * @input String
1474 * @return Boolean
1475 */
1476 if ( ! function_exists( 'wpf_verify_file_upload_type' ) ) {
1477 function wpf_verify_file_upload_type( $server, $mime_type ) {
1478 $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' );
1479 if ( ! empty( $mime_type ) ) {
1480 if ( in_array( $mime_type, $allowed_file_types ) ) {
1481 $response = 0;
1482 } else {
1483 $response = 1;
1484 }
1485 } else {
1486 $response = 0;
1487 }
1488 return $response;
1489 }
1490 }
1491
1492 /*
1493 * 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.
1494 *
1495 * @input String
1496 * @return JSON
1497 */
1498 if ( ! function_exists( 'wpf_get_page_list' ) ) {
1499 function wpf_get_page_list( $type = 'task_page' ) {
1500 $response = array();
1501 if ( class_exists( 'WooCommerce' ) ) {
1502 $wpf_default_wp_post_types = array( "page" => "page", "post" => "post", "product" => "product" );
1503 } else {
1504 $wpf_default_wp_post_types = array( "page" => "page", "post" => "post" );
1505 }
1506 $wpf_wp_cpts = get_post_types( array( 'public' => true, 'exclude_from_search' => true, '_builtin' => false ) );
1507 $wpf_post_types = array_merge( $wpf_default_wp_post_types, $wpf_wp_cpts );
1508
1509 foreach ( $wpf_post_types as $wpf_post_type ) {
1510 $objType = get_post_type_object( $wpf_post_type );
1511 if ( $wpf_post_type == 'page' ) {
1512 $numberposts = -1;
1513 } else {
1514 $numberposts = 10;
1515 }
1516 $wpf_temp_arg = array(
1517 'post_type' => $wpf_post_type,
1518 'numberposts' => $numberposts,
1519 );
1520 $posts = get_posts( $wpf_temp_arg );
1521 $wpf_count_post = count( $posts );
1522 if ( $wpf_count_post ) {
1523 foreach ( $posts as $post ) {
1524 if ( $type == 'task_page' ) {
1525 $response[$objType->labels->singular_name][$post->ID] = htmlspecialchars( $post->post_title, ENT_QUOTES, 'UTF-8' );
1526 } else {
1527 $temp_res = array(
1528 'id' => $post->ID,
1529 'name' => htmlspecialchars( $post->post_title, ENT_QUOTES, 'UTF-8' ),
1530 'type' => $objType->labels->singular_name,
1531 'url' => get_permalink( $post->ID )
1532 );
1533 $response[] = $temp_res;
1534 }
1535 }
1536 }
1537 }
1538 return json_encode( $response );
1539 }
1540 }
1541
1542 /*
1543 * This function is used to deregister the scripts of the plugins that are conflicting with the Atarim.
1544 *
1545 * @input NULL
1546 * @return NULL
1547 */
1548 if ( ! function_exists( 'wpf_mootools_deregister_javascript' ) ) {
1549 function wpf_mootools_deregister_javascript() {
1550 if ( ! is_admin() ) {
1551 wp_deregister_script( 'mootools-local' );
1552 wp_deregister_script( 'enlighter-local' );
1553 wp_deregister_script( 'dct-carousel-jquery' );
1554 wp_deregister_script( 'onepress-js-plugins' );
1555 }
1556 }
1557 }
1558 add_action( 'wp_print_scripts', 'wpf_mootools_deregister_javascript', 99 );
1559
1560 /*
1561 * This function is to remove script/tags that could be used for XSS attack by Pratap.
1562 *
1563 * @input NULL
1564 * @return NULL
1565 */
1566 function wpf_wp_kses_check( $content ) {
1567 $allowed_html = array(
1568 'a' => array(
1569 'href' => array(),
1570 'target' => array(),
1571 ),
1572 'img' => array(
1573 'title' => array(),
1574 'src' => array(),
1575 'alt' => array(),
1576 ),
1577 'p' => array(),
1578 'br' => array(),
1579 'em' => array(),
1580 'strong' => array(),
1581 's' => array(),
1582 'u' => array(),
1583 'ul' => array(),
1584 'ol' => array(),
1585 'li' => array(),
1586 'pre' => array(
1587 'class' => array(),
1588 'spellcheck' => array(),
1589 ),
1590 );
1591 return wp_kses( $content, $allowed_html );
1592 }
1593
1594
1595 /*
1596 * This function is used to strip all the code elements from the data.
1597 *
1598 * @input String
1599 * @return String
1600 */
1601 if ( ! function_exists( 'wpf_test_input' ) ) {
1602 function wpf_test_input( $data ) {
1603 $data = trim( $data );
1604 $data = stripslashes( $data );
1605 $data = htmlspecialchars( $data );
1606 return $data;
1607 }
1608 }
1609
1610 /*
1611 * This function is used by all the ajax request to make user that they are coming from authentic source.
1612 *
1613 * @input NULL
1614 * @return String
1615 */
1616 function wpf_security_check() {
1617 $roles = array();
1618 $user = wp_get_current_user();
1619 $user_details = ( array )$user->data;
1620 $roles = ( array )$user->roles;
1621 $roles = array_values( $roles );
1622 if ( ! check_ajax_referer( 'wpfeedback-script-nonce', 'wpf_nonce' ) ) {
1623 echo 'Invalid security token sent.';
1624 wp_die();
1625 } else {
1626 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
1627 $selected_roles = explode( ',', $selected_roles );
1628 if ( ! in_array( "administrator", $selected_roles ) ) {
1629 array_push( $selected_roles, "administrator" );
1630 }
1631 $wpf_allow_guest = get_site_data_by_key( 'wpf_allow_guest' );
1632 // Allow user if used Share version 2 by Pratap
1633 if ( isset( $_COOKIE['wordpress_avc_allow_guest'] ) ) {
1634 $wpf_allow_guest = 'yes';
1635 }
1636 if ( isset( $_COOKIE['wordpress_avc_guest'] ) ) {
1637 $wpf_allow_guest = 'yes';
1638 }
1639 if ( $wpf_allow_guest == 'yes' ) {
1640 $selected_roles[] = 'Guest';
1641 $roles[] = 'Guest';
1642 }
1643 if ( empty( array_intersect( $roles, $selected_roles ) ) ) {
1644 echo 'Invalid user.';
1645 wp_die();
1646 }
1647 }
1648 }
1649 add_filter( 'get_comment_text', 'make_clickable', 99 );
1650
1651 /*
1652 * This function is to get the listing of status and priority for the sidebar filters.
1653 *
1654 * @input String
1655 * @return String
1656 */
1657 if ( ! function_exists( 'wp_feedback_get_texonomy_filter' ) ) {
1658 function wp_feedback_get_texonomy_filter( $my_term ) {
1659 $output = '';
1660 $filter_data = get_option( 'filter_data' );
1661 $filter_data_db = $filter_data[$my_term];
1662
1663 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
1664 $output .= '<ul class="wpf_filter_checkbox" id="wpf_sidebar_filter_' . $my_term . '">';
1665 foreach ( $filter_data_db as $term ) {
1666 if ( $term['label'] == 'In Progress' ) {
1667 $term['label'] = 'In Prog';
1668 } elseif ( $term['label'] == 'Pending Review' ) {
1669 $term['label'] = 'Pending';
1670 } else {
1671 $term['label'] = $term['label'];
1672 }
1673 $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'], 'atarim-visual-collaboration' ) . '</label></li>';
1674 }
1675 $output .= '</ul><a class="wpf_sidebar_filter_reset_' . $my_term . '" href="javascript:void(0)">'. __( 'Reset', 'atarim-visual-collaboration' ) . '</a>';
1676 return $output;
1677 }
1678 }
1679 }
1680
1681 /*
1682 * This function is used to encrypt and decrypt the license key.
1683 *
1684 * @input String, String
1685 * @return String
1686 */
1687 function wpf_crypt_key( $string, $action = 'e' ) {
1688 if ( strlen( $string ) == 32 ) {
1689 return $string;
1690 }
1691 $wpf_decr_key = get_option( 'wpf_decr_key' );
1692 $wpf_decr_checksum = get_option( 'wpf_decr_checksum' );
1693 $output = false;
1694 $encrypt_method = "AES-256-CBC";
1695 $key = hash( 'sha256', $wpf_decr_key );
1696 $iv = substr( hash( 'sha256', $wpf_decr_checksum ), 0, 16 );
1697
1698 if ( $action == 'e' ) {
1699 $output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) );
1700 } elseif ( $action == 'd' ) {
1701 $output = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv );
1702 update_option( 'wpf_license_key', $output, 'no' );
1703 }
1704 return $output;
1705 }
1706
1707 /*========WPF Login Form========*/
1708 /*
1709 * This function is used to get the login form.
1710 *
1711 * @input NULL
1712 * @return String
1713 */
1714 function wpf_login_form() {
1715 $output = '';
1716 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1717 if ( ! is_user_logged_in() && $wpf_enabled == 'yes' ) {
1718 $output = '<div id="login_form_content">
1719 <p>
1720 <b>Dive straight into the feedback!</b></br>
1721 Login below and you can start commenting using your own user instantly
1722 </p>
1723 <form id="wpf_login" method="post">
1724 <div class="wpf_user">
1725 <label for="username"></label>
1726 <input id="username" placeholder="Username OR Email Address" type="text" name="username">
1727 </div>
1728 <div class="wpf_password">
1729 <label for="password"></label>
1730 <input id="password" placeholder="Password" type="password" name="password">
1731 </div>'
1732 . wp_nonce_field( 'wpfeedback-script-nonce', 'wpf_security', true, false ) .
1733 '<input class="wpf_submit_button" type="submit" value="Login and start commenting" name="submit">
1734 <p class="wpf_status"></p>
1735 </form>
1736 </div>';
1737 $checkinguser = __( 'Sending user info, please wait...', 'atarim-visual-collaboration' );
1738 $wrongcredential = __( 'Wrong username or password.', 'atarim-visual-collaboration' );
1739 $loginsuccessful = __( 'Login successful, redirecting...', 'atarim-visual-collaboration' );
1740 $localize = '<script>var checkinguser= "' . addslashes( $checkinguser ) . '", wrongcredential= "' . addslashes( $wrongcredential ) . '", loginsuccessful= "' . addslashes( $loginsuccessful ) . '"</script>';
1741 $output .= $localize;
1742 }
1743 return $output;
1744 }
1745 add_shortcode( 'wpf_login_form', 'wpf_login_form' );
1746
1747
1748 /*
1749 * This function is used to manage the errors generated while logging in from Atarim login modal.
1750 *
1751 * @input NULL
1752 * @return String
1753 */
1754 function wpf_user_errors() {
1755 static $wp_error; // Will hold global variable safely
1756 return isset( $wp_error ) ? $wp_error : ( $wp_error = new WP_Error( null, null, null ) );
1757 }
1758
1759 /*
1760 * This function is used to handle login from the Atarim login modal.
1761 *
1762 * @input NULL
1763 * @return JSON
1764 */
1765 function wpf_ajax_login() {
1766 global $wpdb;
1767 // First check the nonce, if it fails the function will break
1768 check_ajax_referer( 'wpfeedback-script-nonce', 'wpf_security' );
1769
1770 // Nonce is checked, get the POST data and sign user on
1771 $info = array();
1772 $info['user_login'] = sanitize_text_field( $_POST['username'] );
1773 $info['user_password'] = sanitize_text_field( $_POST['password'] );
1774 $info['remember'] = true;
1775 $user_name = sanitize_text_field( $_POST['username'] );
1776 $user_login = '';
1777 $user = '';
1778
1779 $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 );
1780 if ( $resultsap ) {
1781 $user_login = isset( $resultsap[0]['user_login'] ) ? $resultsap[0]['user_login'] : "";
1782 $user = get_user_by( 'login', $user_login );
1783 }
1784 if ( ! $user ) {
1785 // if the user name doesn't exist
1786 wpf_user_errors()->add( 'empty_username', __( 'Invalid username' ) );
1787 }
1788
1789 if ( ! isset( $_POST['password'] ) || $_POST['password'] == '' ) {
1790 // if no password was entered
1791 wpf_user_errors()->add( 'empty_password', __( 'Please enter a password' ) );
1792 }
1793
1794 // check the user's login with their password
1795
1796 if ( ! empty( $user ) && ! wp_check_password( $_POST['password'], $user->user_pass, $user->ID ) ) {
1797 // if the password is incorrect for the specified user
1798 wpf_user_errors()->add( 'empty_password', __( 'Incorrect password' ) );
1799 }
1800
1801 // retrieve all error messages
1802 $errors = wpf_user_errors()->get_error_messages();
1803 if ( ! empty( $errors ) ) {
1804 echo json_encode( array( 'loggedin' => false ) );
1805 } else {
1806 wp_set_auth_cookie( $user->ID, true );
1807 wp_set_current_user( $user->ID, $_POST['username'] );
1808 echo json_encode( array( 'loggedin' => true ) );
1809 }
1810 die();
1811 }
1812 // Enable the user with no privileges to run ajax_login() in AJAX
1813 add_action( 'wp_ajax_nopriv_wpf_ajaxlogin', 'wpf_ajax_login' );
1814
1815 /*
1816 * This function is used to start the color picker.
1817 *
1818 * @input NULL
1819 * @return NULL
1820 */
1821 if ( ! ( isset( $_GET['ct_builder'] ) ) && ! ( isset( $_GET['ct_inner'] ) ) ) {
1822 function wpf_enqueue_color_picker( $hook_suffix ) {
1823 wp_enqueue_style( 'wp-color-picker' );
1824 if ( ! ( isset( $_GET['et_tb'] ) ) && ! ( isset( $_GET['et_fb'] ) ) ) {
1825 wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 );
1826 }
1827 }
1828 add_action( 'wp_enqueue_scripts', 'wpf_enqueue_color_picker' );
1829 }
1830
1831 /*
1832 * This function is used to get the unique elements from the object.
1833 *
1834 * @input Array, Boolean
1835 * @return Array
1836 */
1837 function wpf_object_array_unique( $array, $keep_key_assoc = false ) {
1838 $duplicate_keys = array();
1839 $tmp = array();
1840 foreach ( $array as $key => $val ) {
1841 if ( is_object( $val ) ) {
1842 $val = (array)$val;
1843 }
1844
1845 if ( ! in_array( $val, $tmp ) ) {
1846 $tmp[] = $val;
1847 } else {
1848 $duplicate_keys[] = $key;
1849 }
1850 }
1851
1852 foreach ( $duplicate_keys as $key ) {
1853 unset( $array[$key] );
1854 }
1855 return $keep_key_assoc ? $array : array_values( $array );
1856 }
1857
1858 /*
1859 * This function is used to check if the caching plugin is active on the website and deregister the Atarim CSS and JS if found.
1860 *
1861 * @input NULL
1862 * @return NULL
1863 */
1864 function wpf_check_for_caching_plugin() {
1865 if ( is_plugin_active( 'wp-rocket/wp-rocket.php' ) ) {
1866 $wp_rocket_settings = get_option( 'wp_rocket_settings' );
1867 $wp_rocket_settings['exclude_css'][] = plugins_url() . '/atarim-client-interface-plugin/css/(.*).css';
1868 $wp_rocket_settings['exclude_js'][] = plugins_url() . '/atarim-client-interface-plugin/js/(.*).js';
1869 if ( get_option( 'wpr_check' ) == "" ) {
1870 update_option( 'wp_rocket_settings', $wp_rocket_settings );
1871 update_option( 'wpr_check', 'true' );
1872 }
1873 }
1874
1875 if ( is_plugin_active( 'fast-velocity-minify/fvm.php' ) ) {
1876 $wpf_fvm_options = get_option( 'fastvelocity_min_ignorelist' );
1877 $wpf_update_fastvelocity_option = get_option( 'wpf_update_fastvelocity_option' );
1878 $wpf_fvm_options = explode( PHP_EOL, $wpf_fvm_options );
1879 array_push( $wpf_fvm_options, '/atarim-client-interface-plugin/' );
1880 if ( $wpf_update_fastvelocity_option != 'yes' ) {
1881 update_option( 'wpf_update_fastvelocity_option', 'yes','no' );
1882 update_option( 'fastvelocity_min_ignorelist', implode( PHP_EOL, $wpf_fvm_options ) );
1883 }
1884 }
1885 if ( is_plugin_active( 'breeze/breeze.php' ) ) {
1886 $get_breeze_advanced_settings = get_option( 'wpf_update_breeze_option' );
1887 $breeze_advanced_settings = get_option( 'breeze_advanced_settings' );
1888 $breeze_advanced_settings['breeze-exclude-css'][] = '/wp-content/plugins/atarim-client-interface-plugin/css/(.*).css';
1889 $breeze_advanced_settings['breeze-exclude-js'][] = '/wp-content/plugins/atarim-client-interface-plugin/js/(.*).js';
1890 if ( $get_breeze_advanced_settings != 'yes' ) {
1891 update_option( 'breeze_advanced_settings', $breeze_advanced_settings );
1892 update_option( 'wpf_update_breeze_option', 'yes','no' );
1893 }
1894 }
1895 if ( defined( 'WPFC_WP_PLUGIN_DIR' ) ) {
1896 $rules_std = array();
1897 $new_rule1 = new stdClass;
1898 $new_rule2 = new stdClass;
1899 $new_rule1->prefix = "contain";
1900 $new_rule1->content = "wp-content/plugins/atarim-client-interface-plugin/css";
1901 $new_rule1->type = "css";
1902 $new_rule2->prefix = "contain";
1903 $new_rule2->content = "wp-content/plugins/atarim-client-interface-plugin/js";
1904 $new_rule2->type = "js";
1905
1906 $wpfeedback_WpFastestCache_save = get_option( "wpf_WpFastestCache_option" );
1907 if ( $wpfeedback_WpFastestCache_save != 'true' ) {
1908 $get_rules_json = get_option( "WpFastestCacheExclude" );
1909 if ( $get_rules_json === false ) {
1910 array_push( $rules_std, $new_rule1 );
1911 array_push( $rules_std, $new_rule2 );
1912 update_option( "WpFastestCacheExclude", json_encode( $rules_std ), "yes" );
1913 update_option( "wpf_WpFastestCache_option", 'true', "no" );
1914 } else {
1915 $rules_std = json_decode( $get_rules_json );
1916 if ( ! is_array( $rules_std ) ) {
1917 $rules_std = array();
1918 }
1919 array_push( $rules_std, $new_rule1 );
1920 array_push( $rules_std, $new_rule2 );
1921 update_option( "WpFastestCacheExclude", json_encode( $rules_std ), "yes" );
1922 update_option( "wpf_WpFastestCache_option", 'true', "no" );
1923 }
1924 }
1925 }
1926 }
1927 add_action( 'admin_init', 'wpf_check_for_caching_plugin' );
1928
1929 /*
1930 * This function is used to get the count of comments for post.
1931 *
1932 * @input Int, Int
1933 * @return Int
1934 */
1935 function wpfeedback_filter_comment_count( $stats, $post_id ) {
1936 global $wpdb;
1937 if ( 0 === $post_id ) {
1938 $stats = wpfeedback_get_comment_count();
1939 }
1940 return $stats;
1941 }
1942 //add_action( 'wp_count_comments','wpfeedback_filter_comment_count', 20, 2 );
1943
1944 /*
1945 * This function is used to get the count of the comment.
1946 *
1947 * @input NULL
1948 * @return Int
1949 */
1950 function wpfeedback_get_comment_count() {
1951 global $wpdb;
1952 $stats = get_transient( 'wpfeedback_comment_count' );
1953 if ( ! $stats ) {
1954 $stats = array();
1955 $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 );
1956 $total = 0;
1957 $stats = array();
1958 $approved = array( '0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed' );
1959
1960 foreach ( (array) $count as $row ) {
1961 // Don't count post-trashed toward totals
1962 if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1963 $total += $row['num_comments'];
1964 }
1965 if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1966 $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1967 }
1968 }
1969
1970 $stats['total_comments'] = $total;
1971 $stats['all'] = $total;
1972
1973 foreach ( $approved as $key ) {
1974 if ( empty( $stats[ $key ] ) ) {
1975 $stats[ $key ] = 0;
1976 }
1977 }
1978 $stats = (object) $stats;
1979 set_transient( 'wpfeedback_comment_count', $stats );
1980 }
1981 return $stats;
1982 }
1983
1984 /*
1985 * This function is used create the options for the bulk updates of status and priority.
1986 *
1987 * @input String
1988 * @return String
1989 */
1990 if ( ! function_exists( 'wpf_bulk_update_get_texonomy_selectbox' ) ) {
1991 function wpf_bulk_update_get_texonomy_selectbox( $my_term ) {
1992 $filter_data = get_option( 'filter_data' );
1993 $filter_data_db = $filter_data[$my_term];
1994 if ( isset( $filter_data_db ) && ! empty( $filter_data_db ) ) {
1995 echo '<select id="task_' . $my_term . '_attr" ><option name="' . $my_term . '" value="" class="wpf_task" id="wpf_critical">'. __( "Select Option", 'atarim-visual-collaboration' ) . '</option>';
1996 foreach ( $filter_data_db as $term ) {
1997 if ( $term['label'] == 'In Progress' ) {
1998 $term['label'] = 'In Prog';
1999 } elseif ( $term['label'] == 'Pending Review' ) {
2000 $term['label'] = 'Pending';
2001 } else {
2002 $term['label'] = $term['label'];
2003 }
2004 echo '<option name="' . $my_term . '" value="' . $term['value'] . '" class="wpf_task" id="wpf_' . $term['value'] . '"/>' . __( $term['label'], 'atarim-visual-collaboration' ) . '</option>';
2005 }
2006 echo '</select>';
2007 }
2008 }
2009 }
2010
2011 function avc_menubar() {
2012 $wpf_user_type = wpf_user_type();
2013 if ( $wpf_user_type != 'advisor' ) {
2014 return;
2015 }
2016
2017 $menubar = '<div class="avc_menu_wrapper">
2018 <div class="avc_menu_container">
2019 <div class="avc_each_menu">
2020 <a href="'. WPF_APP_SITE_URL .'/dashboard" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-dash.svg" alt="" /></a>
2021 </div>
2022 <div class="avc_each_menu">
2023 <a href="'. WPF_APP_SITE_URL .'/projects" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-project.svg" alt="" /></a>
2024 </div>
2025 <div class="avc_each_menu">
2026 <a href="'. WPF_APP_SITE_URL .'/tasks" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-inbox.svg" alt="" /></a>
2027 </div>
2028 <div class="avc_each_menu">
2029 <a href="'. WPF_APP_SITE_URL .'/board" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-board.svg" alt="" /></a>
2030 </div>
2031 <div class="avc_each_menu">
2032 <a href="'. WPF_APP_SITE_URL .'/forms" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-form.svg" alt="" /></a>
2033 <span class="avc-menu-beta-tag">BETA</span>
2034 </div>
2035 <div class="avc_each_menu">
2036 <a href="'. WPF_APP_SITE_URL .'/time-entries" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-timer.svg" alt="" /></a>
2037 </div>
2038 <div class="avc_each_menu">
2039 <a href="'. WPF_APP_SITE_URL .'/settings" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-setting.svg" alt="" /></a>
2040 </div>
2041 <div class="avc_each_menu">
2042 <a href="'. WPF_APP_SITE_URL .'/user" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-user.svg" alt="" /></a>
2043 </div>
2044 <div class="avc_each_menu">
2045 <a href="https://support.atarim.io/" target="_blank"><img src="' . WPF_PLUGIN_URL . 'images/app-help.svg" alt="" /></a>
2046 </div>
2047 </div>
2048 </div>';
2049 return $menubar;
2050 }
2051
2052 /*
2053 * function is used to generate
2054 * bottom task panel
2055 */
2056 function generate_bottom_part_html() {
2057 global $wpdb, $wp_query, $post;
2058 global $wpf_task_status_filter_btn, $wpf_task_priority_filter_btn;
2059 $current_page_id = '';
2060 if ( is_feature_enabled( 'bottom_bar_enabled' ) ) {
2061 if ( is_admin() ) {
2062 $current_page_id = get_the_ID();
2063 }
2064 if ( $current_page_id == '' ) {
2065 if ( isset( $wp_query->post->ID ) ) {
2066 $current_page_id = $wp_query->post->ID;
2067 }
2068 }
2069
2070 $current_user = wp_get_current_user();
2071 $wpf_user_name = $current_user->display_name; //['display_name']; //->user_nicename;
2072 $wpf_user_email = $current_user->user_email; //['user_email']; //->user_email;
2073 $url = WPF_CRM_API . 'wp-api/page/is-approved';
2074 $sendarr = array();
2075 $sendarr["wpf_site_id"] = get_option( 'wpf_site_id' );
2076 $sendarr["page_id"] = $current_page_id;
2077 $sendtocloud = json_encode( $sendarr );
2078 $response = wpf_send_remote_post( $url, $sendtocloud );
2079 $is_approved = 0;
2080 $data = [];
2081
2082 if ( isset( $response['status'] ) && $response['status'] ) {
2083 $is_approved = 1;
2084 }
2085
2086 $currnet_user_information = wpf_get_current_user_information();
2087 $current_role = $currnet_user_information['role'];
2088 $current_user_name = ( ! empty( $currnet_user_information['first_name'] ) ) ? $currnet_user_information['first_name'] : $currnet_user_information['display_name'];
2089 $current_user_id = $currnet_user_information['user_id'];
2090
2091 if ( $current_user_name == 'Guest' ) {
2092 $wpf_current_role = 'guest';
2093 } else {
2094 $wpf_current_role = wpf_user_type();
2095 }
2096 $current_user_name = addslashes( $current_user_name );
2097 $wpf_powered_class = '_blank';
2098 $wpf_powered_by = get_site_data_by_key( 'wpfeedback_powered_by' );
2099 $wpf_powerbylink = WPF_MAIN_SITE_URL . '/reviews/?website=' . get_bloginfo('name') . '&email=' . $wpf_user_email . '&nameu=' . $wpf_user_name;
2100 $wpf_powerbylogo = get_wpf_logo();
2101 if ( $wpf_powered_by == 'yes' ) {
2102 $wpf_powered_class = '_self';
2103 $wpf_powered_link = get_site_data_by_key( 'wpf_powered_link' );
2104 if ( $wpf_powered_link != '' ) {
2105 $wpf_powerbylink = $wpf_powered_link;
2106 $wpf_powered_class = '_blank';
2107 } else {
2108 $wpf_powerbylink = "javascript:void(0)";
2109 }
2110 }
2111
2112 $wpf_show_front_stikers = get_site_data_by_key( 'wpf_show_front_stikers' );
2113
2114 /* =====Start filter sidebar HTML Structure==== */
2115 if ( $wpf_show_front_stikers == 'yes' ) {
2116 $checkbox_checked = "checked";
2117 } else {
2118 $checkbox_checked = "";
2119 }
2120
2121 $wpf_current_page_url = get_permalink() . '?wpf_login=1';
2122 $backend_btn = '';
2123 $wpf_report_btn = '';
2124 $wpf_report_btn_tab = '';
2125 $wpf_go_to_cloud_dashboard_btn_tab = '';
2126
2127 if ( $current_user_id > 0 ) {
2128 $share_style = '';
2129 if ( $wpf_current_role == 'advisor' ) {
2130 $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", 'atarim-visual-collaboration' ) . '">' . get_wpf_icon() . '</a>';
2131 }
2132 $backend_btn = ' <button class="wpf_tab_sidebar wpf_backend" onclick="openWPFTab(\'wpf_backend\')" >' . __('Backend', 'atarim-visual-collaboration') . '</button>';
2133 $wpf_daily_report = get_site_data_by_key( 'wpf_daily_report' );
2134 $wpf_weekly_report = get_site_data_by_key( 'wpf_weekly_report' );
2135
2136 /* ================Go to dashboard Tabs HTML================ */
2137 $wpf_report_btn .= '<div class="wpf_report_trigger"><label class="wpf_reports_title">' . get_wpf_report_icon() . __( "Send Reports:", 'atarim-visual-collaboration' ) . '</label>';
2138 if ( $wpf_daily_report == 'yes' ) {
2139 /* ================Daily report btn HTML================ */
2140 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'daily_report\')">' . __( 'Last 24 Hours', 'atarim-visual-collaboration' ) . '</a>';
2141 }
2142 if ( $wpf_weekly_report == 'yes' ) {
2143 /* ================Weekly report btn HTML================ */
2144 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'weekly_report\')">' . __( 'Last 7 Days', 'atarim-visual-collaboration' ) . '</a>';
2145 }
2146 $wpf_report_btn .= '<span id="wpf_front_report_sent_span" class="wpf_hide text-success">' . __( 'Your report was sent', 'atarim-visual-collaboration' ) . '</span></div>';
2147
2148 /* ================Report Tabs HTML================ */
2149 $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", 'atarim-visual-collaboration' ) . '">' . get_wpf_report_icon() . ' <span>' . __( "Reports", 'atarim-visual-collaboration' ) . '</span></a></li>';
2150 } else {
2151 $share_style = 'style="margin-left: 90px;"';
2152 }
2153
2154 /* ================share Tabs Content HTML================ */
2155 $wpf_page_share = '<div class="wpf_icon_title">'.get_wpf_share_icon(). __("Share Page Link : ", 'atarim-visual-collaboration') . '</div>
2156 <input type="text" id="wpf_share_page_link" value="' . $wpf_current_page_url . '" style="position: absolute; z-index: -999; opacity: 0;">
2157 <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>
2158 <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", 'atarim-visual-collaboration' ) . '</label></div>';
2159
2160 /* ================Filter Tabs & Content HTML================ */
2161 $wpf_toggel_filter_tab = '<div id="wpf_bottom_filter">
2162 <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div>
2163 <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div>
2164 <div class="wpf_list wpf_hide" id="wpf_report_btn">' . $wpf_report_btn . '</div>
2165 <div class="wpf_list wpf_hide" id="wpf_share_page_btn" ' . $share_style . ' >' . $wpf_page_share . '</div>
2166 </div>';
2167 /* =====END filter sidebar HTML Structure==== */
2168 if ( $is_approved == 1 ) {
2169 $btn_title = __( "Approved", 'atarim-visual-collaboration' );
2170 $btn_approve_class = "";
2171 } else {
2172 $btn_title = __( "Approve Page", 'atarim-visual-collaboration' );
2173 $btn_approve_class = "wpf_not_approved";
2174 }
2175
2176 $approve_btn = '<button class="wpf_green_btn wpf_btn_hover approve-page ' . $btn_approve_class . '" id="open_approve_modal" title="' . __( "Approve Page", 'atarim-visual-collaboration' ) . '" data-is-approve="' . $is_approved . '">' . get_wpf_right_icon() . '<span>' . $btn_title . '</span> </button>';
2177 $responsive_btn = '';
2178 if ( !is_admin() ) {
2179 $responsive_btn = '<div class="wpf_responsive_icons_bar wpf_btn_hover">
2180 <img src="' . WPF_PLUGIN_URL . 'images/responsive.svg" alt="responsive box">
2181 <div class="wpf_responsove_options">
2182 <div class="wpf_desktop_view"><img src="' . WPF_PLUGIN_URL . 'images/desktop.svg" alt="desktop icon"><span>Desktop</span></div>
2183 <div class="wpf_tab_view wpf_responsive_tablet"><img src="' . WPF_PLUGIN_URL . 'images/tablet.svg" alt="tablate icon"><span>Tablet</span></div>
2184 <div class="wpf_mobile_view wpf_responsive_mobile"><img src="' . WPF_PLUGIN_URL . 'images/mobile.svg" alt="mobile icon"><span>Mobile</span></div>
2185 </div>
2186 </div>';
2187 }
2188
2189 if ( is_admin() == 1 ) {
2190 $approve_btn = "";
2191 }
2192
2193 $bottom_panel_db = get_option( 'bottom_panel', 1 );
2194 $bottom_style = "";
2195 $bottom_active_class = 'active';
2196 $agency_menu_item = '';
2197 if ( $wpf_current_role == 'advisor' || ( $wpf_current_role == '' && current_user_can( 'administrator' ) ) ) {
2198 $agency_menu_item = '<li class="pro"> <a href="' . WPF_APP_SITE_URL . '/login" target="_blank" title="' . __( "Atarim Dashboard", 'atarim-visual-collaboration' ) . '">' . get_wpf_pro_icon() . '<span>' . __( "Agency", 'atarim-visual-collaboration' ) . '</span> </a></li>';
2199 }
2200 if ( ( isset( $bottom_panel_db ) && $bottom_panel_db == '0' ) ) {
2201 $bottom_active_class = '';
2202 $bottom_style = 'bottom: -60px;';
2203 }
2204
2205 $toggle_button = '<a href="javascript:expand_bottom_bar()" class="arrow-down wpf_btn_hover" id="wpf_bottom_arrow" title="Hide Panel"><img src="' . WPF_PLUGIN_URL . 'images/arrow-down.svg" alt="arrow down image"></a>';
2206
2207 $app_button = '';
2208 if ( $wpf_current_role == 'advisor' || ( $wpf_current_role == '' && current_user_can( 'administrator' ) ) ) {
2209 $app_button = '<a href="javascript:expand_menubar()" id="wpf_app_dashboard" class="wpf_btn_hover" title="' . __( "Atarim Dashboard", 'atarim-visual-collaboration' ) . '"><img src="' . WPF_PLUGIN_URL . 'images/menu.svg" alt="atarim dashbord"></a>';
2210 }
2211
2212 $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>';
2213
2214 // Share version 2 popup structure by Pratap.
2215 $share_popup = '';
2216 if( current_user_can( 'administrator' ) ) {
2217 $current_page = '';
2218 $page_token_url = '';
2219 $current_login_url = '';
2220 if ( is_admin() ) {
2221 $screen = get_current_screen();
2222 if ( $screen -> id == 'dashboard' ) {
2223 $current_page = admin_url();
2224 } else {
2225 $current_page = admin_url( basename( $_SERVER['REQUEST_URI'] ) );
2226 }
2227 /*
2228 * Wordpress cannot allow accessing admin panel without login due to which guest access is not possible on admin side
2229 * Hence we set the frontend url in the invitation link
2230 */
2231 $current_page = get_site_url();
2232 } else {
2233 global $wp;
2234 $current_page = add_query_arg( $wp->query_vars, home_url( $wp->request ) );
2235 }
2236
2237 $current_page = rtrim( $current_page, '/' );
2238 $guest_token = 'guest_token=' . get_option( 'wpf_guest_token' );
2239
2240 if ( strpos( $current_page, '?' ) !== false) {
2241 $page_token_url = $current_page . '&collab_token=';
2242 $current_login_url = $current_page . '&' . $guest_token;
2243 } else {
2244 $page_token_url = $current_page . '/?collab_token=';
2245 $current_login_url = $current_page . '/?' . $guest_token;
2246 }
2247
2248 $site_title = get_bloginfo( 'name' );
2249
2250 $args = array(
2251 'meta_key' => 'avc_user_token',
2252 'meta_value' => '',
2253 'meta_compare' => '!='
2254 );
2255 $user_query = new WP_User_Query( $args );
2256 $user_list = $user_query->get_results();
2257 $user_data = array();
2258 if ( ! empty( $user_list ) ) {
2259 foreach ( $user_list as $user ) {
2260 $user_info = $user->data;
2261 $user_data[$user_info->ID]['id'] = $user_info->ID;
2262 $user_data[$user_info->ID]['email'] = $user_info->user_email;
2263 $user_data[$user_info->ID]['name'] = $user_info->display_name;
2264 $token = get_user_meta( $user_info->ID, 'avc_user_token', true );
2265 $link = $page_token_url . $token;
2266 $user_data[$user_info->ID]['link'] = $link . '&action=atarim';
2267 $user_initial = substr( $user_info->user_email, 0, 2 );
2268 $user_data[$user_info->ID]['initial'] = strtoupper( $user_initial );
2269 }
2270 }
2271
2272 $share_popup = '<div class="avc_invite_share_wrapper">
2273 <div class="avc_invite_share_container">
2274 <div class="avc_close_share_container"><span>+</span></div>
2275 <div class="avc_invite_share_icon"><img src="'.WPF_PLUGIN_URL.'/images/share_icon.svg" ></div>
2276 <div class="avc_invite_title">Invite Collaborators</div>
2277 <div class="avc_invite_subtitle">Invite clients and stakeholders to collaborate on this project.</div>
2278 <div class="avc_invite_container">
2279 <div class="avc_invite_wrapper">
2280 <div class="avc_each_invite">
2281 <div class="avc_invite_fields">
2282 <input tpye="text" name="invite_name" class="avc_invite_name" placeholder="Full name" >
2283 <input type="email" name="invite_email" class="avc_invite_email" placeholder="Email address" >
2284 </div>
2285 <div class="avc_add_remove_invite">
2286 <button class="avc_add_invite" tabindex="0" type="button">
2287 <svg class="avc_add_inivite_svg" focusable="false" viewBox="0 0 24 24" aria-hidden="true">
2288 <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path>
2289 </svg>
2290 </button>
2291 <button class="avc_remove_invite" tabindex="0" type="button">
2292 <svg class="avc_remove_inivite_svg" focusable="false" viewBox="0 0 24 24" aria-hidden="true">
2293 <path d="M19 13H5v-2h14v2z"></path>
2294 </svg>
2295 </button>
2296 </div>
2297 </div>
2298 </div>
2299 <div id="send_invite">Invite Users</div>
2300 </div>
2301 <input type="hidden" name="avc_current_page" id="avc_current_page" value="'. $page_token_url .'" >
2302 <input type="hidden" name="avc_site_title" id="avc_site_title" value="'. $site_title .'" >
2303 <div class="avc_shared_container">
2304 <div class="avc_invited_user_title">People With Access</div>
2305 <div class="avc_shared_user_list">';
2306 if ( ! empty( $user_data ) ) {
2307 $i = 1;
2308 foreach( $user_data as $data ) {
2309 $share_popup .= '<div class="avc_invited_user">
2310 <div class="avc_ivi_user_info">
2311 <div class="avc_ivi_user_img">' . $data["initial"] . '</div>
2312 <div class="avc_ivi_user_name"><span>' . $data["name"] . '</span><br>' . $data["email"] . '</div>
2313 <div class="avc_user_share_action">
2314 <div class="avc_delete_ivi_user" data-id="' . $data["id"] . '">Remove</div>
2315 <div class="avc_share_button">
2316 <input type="text" class="avc_share_page_link_input" id="share_link_input'. $i .'" value="' . $data["link"] . '">
2317 <a href="javascript:void(0);" onclick="avc_copy_to_clipboard(\'share_link_input'. $i .'\')" class="avc_copy_link_icon">
2318 <img src="'.WPF_PLUGIN_URL.'/images/link.svg" > <span>Reshare Link</span>
2319 </a>
2320 </div>
2321 </div>
2322 </div>
2323 </div>';
2324 $i++;
2325 }
2326 } else {
2327 echo '<style>
2328 .avc_shared_container {
2329 display: none;
2330 }
2331 </style>';
2332 }
2333 $share_popup .= '</div>
2334 </div>
2335 <div class="avc_share_page_link">
2336 <div class="avc_share_or">Or Share This Link</div>
2337 <div class="avc_share_page_container">
2338 <div class="avc_share_page_icon"><img src="'.WPF_PLUGIN_URL.'/images/link.svg" ></div>
2339 <div class="avc_share_link_container">
2340 <div class="avc_share_link">' . $current_login_url . '</div>
2341 <input type="text" class="avc_share_page_link_input" id="share_link_input" value="' . $current_login_url . '">
2342 <a href="javascript:void(0);" onclick="avc_copypagelink_to_clipboard(\'share_link_input\')" class="avc_copy_pagelink">Copy</a>
2343 </div>
2344 </div>
2345 </div>
2346 </div>
2347 <div class="avc_invite_error_container">
2348 <div class="avc_invite_error_msg1"><div class="avc_err_icon"></div>Please add the Full name.</div>
2349 <div class="avc_invite_error_msg2"><div class="avc_err_icon"></div>Please add an Email address.</div>
2350 <div class="avc_invite_error_msg3"><div class="avc_err_icon"></div>Name must be minimum 3 character long.</div>
2351 <div class="avc_invite_error_msg4"><div class="avc_err_icon"></div>Must be a valid Email address.</div>
2352 </div>
2353 <div class="wpf_loader wpf_hide"></div>
2354 <div class="avc_suc_err_container">
2355 <div class="avc_invite_success"><div class="avc_succ_icon"></div>Invitation has been sent</div>
2356 <div class="avc_delete_success"><div class="avc_succ_icon"></div>Invitation has been deleted</div>
2357 <div class="avc_invite_fail"><div class="avc_err_icon"></div>Invitation failed</div>
2358 </div>
2359 <div class="avc_hidden_user_structure">
2360 <div class="avc_invited_user">
2361 <div class="avc_ivi_user_info">
2362 <div class="avc_ivi_user_img"></div>
2363 <div class="avc_ivi_user_name"><span></div>
2364 <div class="avc_user_share_action">
2365 <div class="avc_delete_ivi_user" data-id="">Remove</div>
2366 <div class="avc_share_button">
2367 <input type="text" class="avc_share_page_link_input" id="" value="">
2368 <a href="javascript:void(0);" onclick="" class="avc_copy_link_icon">
2369 <img src="'.WPF_PLUGIN_URL.'/images/link.svg" > <span>Reshare Link</span>
2370 </a>
2371 </div>
2372 </div>
2373 </div>
2374 </div>
2375 </div>
2376 </div>';
2377 }
2378 // share popup structure ends.
2379
2380 $sidebar = '<a href="javascript:expand_sidebar()" class="tasks-btn wpf_btn_hover" title="Sidebar"> </span><img src="' . WPF_PLUGIN_URL . 'images/sidebar.svg" alt="sidebar icon"><span class="number wpf_hide" id="wpf_total_task_number"></span> </a>';
2381 /* ================visibility Tabs Content HTML================ */
2382 $visibility_conatiner = '<div class="wpf_visibility_container wpf_btn_hover">
2383 <img src="' . WPF_PLUGIN_URL . 'images/visible.svg" alt="visibility icon">
2384 <div id="wpf_task_visibility">
2385 <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', 'atarim-visual-collaboration' ) . '</label></div>
2386 <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', 'atarim-visual-collaboration' ) . '</label></div>
2387 <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', 'atarim-visual-collaboration' ) . '</label></div>
2388 </div>
2389 </div>';
2390 $general_button = '<a class="wpf_general_btn wpf_comment_mode_general_task wpf_btn_hover" id="wpf_comment_mode_general_task" href="javascript:void(0)" onclick="wpf_new_general_task(0)" title="' . __( 'General', 'atarim-visual-collaboration' ) . '"><img src="' . WPF_PLUGIN_URL . 'images/general.svg" alt="general button icon"><span>' . __( 'General', 'atarim-visual-collaboration' ) . '</span></a>';
2391 $share_btn = '';
2392 if ( is_user_logged_in() ) {
2393 $share_btn = '<div class="wpf_share_btn wpf_btn_hover" href="javascript:void(0);" title="' . __( "Share", 'atarim-visual-collaboration' ) . '"><img src="' . WPF_PLUGIN_URL . 'images/share.svg" alt="share icon"><span>' . __( "Share", 'atarim-visual-collaboration' ) . '</span></div>';
2394 }
2395
2396 $wpf_comment = '<a href="javascript:enable_comment();" class="wpf_green_btn wpf_comment_btn" title="Click to give your feedback!"><img src="' . WPF_PLUGIN_URL . 'images/comment.svg" alt="comment icon"><span>' . __( "Add Comment", 'atarim-visual-collaboration' ) . '</span></a>';
2397
2398 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 . '" alt="poweredby" /></a></div> ' . $toggle_button . $app_button . $approve_btn . $responsive_btn . $milestone . '</div><div class="wpf_bottom_middle">'. $wpf_comment .'</div><div class="wpf_bottom_right">' . $share_btn . $general_button . $visibility_conatiner . $sidebar . '</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 . '" alt="poweredby"></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', 'atarim-visual-collaboration' ) . '">' . get_wpf_close_icon() . '<span class="title">' . __( 'Cancel', 'atarim-visual-collaboration' ) . '</span> </a></div></div>'. $share_popup .'<div class="wpf_page_loader"></div></section>';
2399 }
2400 }
2401 add_action( 'wpf_generate_bottom_part_html', 'generate_bottom_part_html' );
2402
2403 // Upgrade popup by Pratap
2404 function wpf_upgrade_plan() {
2405 $wpf_user_type = wpf_user_type();
2406 $enabled_wpfeedback = wpf_check_if_enable();
2407 if ( $enabled_wpfeedback ) {
2408 ?>
2409 <div class="wpf-uf-pop-wrapper" style="display:none">
2410 <div class="wpf-uf-pop-container">
2411 <div class="wpf-uf-popup">
2412 <div class="wpf-uf-close-popup"><i class="gg-close"></i></div>
2413 <div class="wpf-uf-popup-title">Let's Unlock This Feature</div>
2414 <p>Unlock this feature and improve your workflow even further by upgrading your plan.</p>
2415 <div class="wpf-uf-popup-plans">
2416 <div class="wpf-uf-popup-image">
2417 <img alt="" src="">
2418 </div>
2419 <div class="wpf-uf-plan">
2420 <div class="wpf-uf-plan-title"></div>
2421 <div class="wpf-uf-plan-detail"></div>
2422 <a class="wpf-uf-plan-link" href="#" target="_blank"><div class="wpf-uf-plan-btn">Upgrade To Unlock</div></a>
2423 </div>
2424 </div>
2425 <?php if ( $wpf_user_type = 'advisor' ) { ?>
2426 <div class="wpf-uf-webmaster-notice">*This is only shown to you as a webmaster, other users will not see this</div>
2427 <?php } else { ?>
2428 <div class="wpf-uf-otheruser-notice">Please contact your webmaster to unlock this feature</div>
2429 <?php } ?>
2430 </div>
2431 </div>
2432 </div>
2433 <?php
2434 }
2435 }
2436 add_action( 'wp_footer', 'wpf_upgrade_plan' );
2437 add_action( 'admin_footer', 'wpf_upgrade_plan' );
2438
2439 // Upgrade popup on license expires by Pratap
2440 function wpf_subscribe_plan() {
2441 $wpf_user_type = wpf_user_type();
2442 $enabled_wpfeedback = wpf_check_if_enable();
2443 if ( $enabled_wpfeedback ) {
2444 ?>
2445 <div class="wpf-le-pop-wrapper" style="display:none">
2446 <div class="wpf-le-pop-container">
2447 <div class="wpf-le-popup">
2448 <div class="wpf-le-close-popup"><i class="gg-close"></i></div>
2449 <div class="wpf-le-popup-plans">
2450 <div class="wpf-le-plan">
2451 <div class="wpf-le-icon"><img src= "<?php echo WPF_PLUGIN_URL; ?>/images/lock.svg" alt="lock image"></div>
2452 <div class="wpf-le-title">Renew or upgrade your subscription</div>
2453 <div class="wpf-le-detail">It looks like your subscription has expired or doesn’t exist, please upgrade your account to unlock this feature.</div>
2454 <a class="wpf-le-plan-link" href="https://atarim.io/pricing" target="_blank"><div class="wpf-le-plan-btn">Upgrade Now</div></a>
2455 </div>
2456 </div>
2457 </div>
2458 </div>
2459 </div>
2460 <?php
2461 }
2462 }
2463 add_action( 'wp_footer', 'wpf_subscribe_plan' );
2464 add_action( 'admin_footer', 'wpf_subscribe_plan' );
2465
2466
2467 /*
2468 * function is used to generate
2469 * side task panel
2470 */
2471 function generate_side_part_html() {
2472 global $wpdb, $wp_query, $post;
2473 $current_page_id = '';
2474 if ( is_admin() ) {
2475 $current_page_id = get_the_ID();
2476 }
2477 if ( $current_page_id == '' ) {
2478 if ( isset( $wp_query->post->ID ) ) {
2479 $current_page_id = $wp_query->post->ID;
2480 }
2481 }
2482
2483 $current_user = wp_get_current_user();
2484 $wpf_user_name = $current_user->display_name; //['display_name']; //->user_nicename;
2485 $wpf_user_email = $current_user->user_email; //['user_email']; //->user_email;
2486 $url = WPF_CRM_API . 'wp-api/page/is-approved';
2487 $sendarr = array();
2488 $sendarr["wpf_site_id"] = get_option('wpf_site_id');
2489 $sendarr["page_id"] = $current_page_id;
2490 $sendtocloud = json_encode( $sendarr );
2491 $response = wpf_send_remote_post( $url, $sendtocloud );
2492 $is_approved = 0;
2493 $data = [];
2494
2495 if ( isset( $response['status'] ) && $response['status'] ) {
2496 $is_approved = 1;
2497 }
2498
2499 $currnet_user_information = wpf_get_current_user_information();
2500 $current_role = $currnet_user_information['role'];
2501 $current_user_name = $currnet_user_information['display_name'];
2502 $current_user_id = $currnet_user_information['user_id'];
2503
2504 if ( $current_user_name == 'Guest' ) {
2505 $wpf_current_role = 'guest';
2506 } else {
2507 $wpf_current_role = wpf_user_type();
2508 }
2509 $current_user_name = addslashes( $current_user_name );
2510 $wpf_powered_class = '_blank';
2511 $wpf_powered_by = get_site_data_by_key( 'wpfeedback_powered_by' );
2512 $wpf_powerbylink = WPF_MAIN_SITE_URL . '/reviews/?website=' . get_bloginfo('name') . '&email=' . $wpf_user_email . '&nameu=' . $wpf_user_name;
2513 $wpf_powerbylogo = get_wpf_logo();
2514 if ( $wpf_powered_by == 'yes' ) {
2515 $wpf_powered_class = '_self';
2516 $wpf_powered_link = get_site_data_by_key( 'wpf_powered_link' );
2517 if ( $wpf_powered_link != '' ) {
2518 $wpf_powerbylink = $wpf_powered_link;
2519 $wpf_powered_class = '_blank';
2520 } else {
2521 $wpf_powerbylink = "javascript:void(0)";
2522 }
2523 }
2524
2525 $wpf_show_front_stikers = get_site_data_by_key( 'wpf_show_front_stikers' );
2526
2527 /* =====Start filter sidebar HTML Structure==== */
2528 if ( $wpf_show_front_stikers == 'yes' ) {
2529 $checkbox_checked = "checked";
2530 } else {
2531 $checkbox_checked = "";
2532 }
2533
2534 $wpf_current_page_url = get_permalink() . '?wpf_login=1';
2535 $backend_btn = '';
2536 $wpf_report_btn = '';
2537 $wpf_report_btn_tab = '';
2538 $wpf_go_to_cloud_dashboard_btn_tab = '';
2539
2540 if ( $current_user_id > 0 ) {
2541 $share_style = '';
2542 if ( $wpf_current_role == 'advisor' ) {
2543 $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", 'atarim-visual-collaboration' ) . '">' . get_wpf_icon() . '</a>';
2544 }
2545 $backend_btn = ' <button class="wpf_tab_sidebar wpf_backend" onclick="openWPFTab(\'wpf_backend\')" >' . __('Backend', 'atarim-visual-collaboration') . '</button>';
2546 $wpf_daily_report = get_site_data_by_key( 'wpf_daily_report' );
2547 $wpf_weekly_report = get_site_data_by_key( 'wpf_weekly_report' );
2548
2549 /* ================Go to dashboard Tabs HTML================ */
2550 $wpf_report_btn .= '<div class="wpf_report_trigger"><label class="wpf_reports_title">' . get_wpf_report_icon() . __( "Send Reports:", 'atarim-visual-collaboration' ) . '</label>';
2551 if ( $wpf_daily_report == 'yes' ) {
2552 /* ================Daily report btn HTML================ */
2553 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'daily_report\')">' . __('Last 24 Hours', 'atarim-visual-collaboration') . '</a>';
2554 }
2555 if ( $wpf_weekly_report == 'yes' ) {
2556 /* ================Weekly report btn HTML================ */
2557 $wpf_report_btn .= '<a href="javascript:wpf_send_report(\'weekly_report\')">' . __( 'Last 7 Days', 'atarim-visual-collaboration' ) . '</a>';
2558 }
2559 $wpf_report_btn .= '<span id="wpf_front_report_sent_span" class="wpf_hide text-success">' . __( 'Your report was sent', 'atarim-visual-collaboration' ) . '</span></div>';
2560
2561 /* ================Report Tabs HTML================ */
2562 $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", 'atarim-visual-collaboration' ) . '">' . get_wpf_report_icon() . ' <span>' . __( "Reports", 'atarim-visual-collaboration' ) .'</span></a></li>';
2563 } else {
2564 $share_style = 'style="margin-left: 90px;"';
2565 }
2566
2567 /* ================filter Tabs Content HTML================ */
2568 $wpf_task_status_filter_btn = '<div id="wpf_filter_taskstatus" class=""><label class="wpf_filter_title">' . get_wpf_status_icon() . ' ' . __( 'Filter by Status:', 'atarim-visual-collaboration' ) . '</label>' . wp_feedback_get_texonomy_filter( "task_status" ) . '</div>';
2569 $wpf_task_priority_filter_btn = '<div id="wpf_filter_taskpriority" class=""><label class="wpf_filter_title">' . get_wpf_priority_icon() . ' ' . __( "Filter by Priority:", 'atarim-visual-collaboration' ) . '</label>' . wp_feedback_get_texonomy_filter( "task_priority" ) . '</div>';
2570
2571 /* ================visibility Tabs Content HTML================ */
2572 $wpf_task_visibility = '<label class="wpf_visibility_title">' . get_wpf_visibility_icon() . __( "Tasks Visibility", 'atarim-visual-collaboration' ) . '</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', 'atarim-visual-collaboration' ) . '</label></div>
2573 <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', 'atarim-visual-collaboration' ) . '</label></div>';
2574
2575 $wpf_page_share = '<div class="wpf_icon_title">' . get_wpf_share_icon() . __( "Share Page Link : ", 'atarim-visual-collaboration' ) . '</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", 'atarim-visual-collaboration') . '</label></div>';
2576 /* ================Filter Tabs & Content HTML================ */
2577
2578 $wpf_toggel_filter_tab = '<div id="wpf_bottom_filter">
2579 <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div>
2580 <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div>
2581 <div class="wpf_list wpf_hide" id="wpf_task_visibility">' . $wpf_task_visibility . '</div>
2582 <div class="wpf_list wpf_hide" id="wpf_report_btn">' . $wpf_report_btn . '</div>
2583 <div class="wpf_list wpf_hide" id="wpf_share_page_btn" ' . $share_style .' >' . $wpf_page_share . '</div>
2584 </div>';
2585 /* =====END filter sidebar HTML Structure==== */
2586 if ( $is_approved == 1 ) {
2587 $btn_title = __( "Approved", 'atarim-visual-collaboration' );
2588 } else {
2589 $btn_title = __( "Approve Page", 'atarim-visual-collaboration' );
2590 }
2591
2592 $approve_btn = '<button class="wpf_green_btn approve-page" title="' . __( "Approve Page", 'atarim-visual-collaboration' ) . '" data-is-approve="' . $is_approved . '">' . get_wpf_right_icon() . '<span>' . $btn_title . '</span> </button>';
2593 if ( is_admin() == 1 ) {
2594 $approve_btn = "";
2595 }
2596
2597 $bottom_panel_db = get_option( 'bottom_panel', 1 );
2598 $bottom_style = "";
2599 $bottom_active_class = 'active';
2600 $agency_menu_item = '';
2601 if ( $wpf_current_role == 'advisor' || ( $wpf_current_role == '' && current_user_can( 'administrator' ) ) ) {
2602 $agency_menu_item = '<li class="pro"> <a href="' . WPF_APP_SITE_URL . '/login" target="_blank" title="' . __( "Atarim Dashboard", 'atarim-visual-collaboration' ) . '">' . get_wpf_pro_icon() . '<span>' . __( "Agency", 'atarim-visual-collaboration' ) . '</span> </a></li>';
2603 }
2604 if ( isset( $bottom_panel_db ) && $bottom_panel_db == '0' ) {
2605 $bottom_active_class = '';
2606 $bottom_style = 'bottom: -60px;';
2607 }
2608 return $wpf_toggel_filter_tab;
2609 }
2610
2611
2612 /**
2613 * Get the author name of the tasks
2614 */
2615 function get_task_author( $mypost ) {
2616 /* assign the WP names (first & last name / nickname) if the author is on the site */
2617
2618 // by default, we take name that is coming from the API
2619 $author = $mypost['task_config_author_name'] ?? "Guest";
2620
2621 // Task author name for Share version 2 by Pratap.
2622 if ( $mypost['task_config_author_id'] > 0 ) {
2623 $userInfo = get_userdata( $mypost['task_config_author_id'] );
2624 if ( ! empty( $userInfo ) ) {
2625 $userr = $userInfo->data;
2626 return $userr->display_name;
2627 }
2628 }
2629
2630 // list all the usere who's roles are allowed to create tasks
2631 $wpf_front_users = do_shortcode( '[wpf_user_list_front]' );
2632
2633 if ( $wpf_front_users ) {
2634
2635 // convert JSON to array
2636 $wpf_front_users_arr = json_decode( $wpf_front_users, true );
2637
2638 // get the user data by filtering the roles allowed to create tasks
2639 $front_user_meta = array_filter( $wpf_front_users_arr, function( $user ) use( $mypost ) {
2640 return intval( $user['id'] ) === intval( $mypost['task_config_author_id'] );
2641 } );
2642
2643 // if the user dats found, we will assign the appropriate name
2644 if ( is_array( $front_user_meta ) ) { // if ( !empty( $front_user_name ) && is_array( $front_user_meta ) )
2645
2646 // as the filter returns the array with the task's id as key, we only need the data in the array by unpacking
2647 $front_user_metas = array_merge( $front_user_meta );
2648
2649 // assign the first and last name if present, nickname otherwise.
2650 return $front_user_metas[0]['displayname'] ?? $author;
2651 }
2652 }
2653 return $author;
2654 }
2655
2656
2657 /**
2658 * Checks if the feature has enabled by the plan or not
2659 */
2660 function is_feature_enabled( $feature_name ) {
2661 $wpf_user_plan = get_option( 'wpf_user_plan', false );
2662 if ( $wpf_user_plan ) {
2663 $wpf_user_plan = unserialize( $wpf_user_plan );
2664 }
2665
2666 // Enable the feature if the data not in the DB
2667 if ( empty( $wpf_user_plan ) ) {
2668 return true;
2669 }
2670 return ( ! empty( $wpf_user_plan[$feature_name] ) && $wpf_user_plan[$feature_name] === 'yes' );
2671 }
2672