PluginProbe
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback / 3.4
Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback v3.4
5.1.3 5.1.2 5.1.1 5.1 5.0 trunk 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.2.0 3.2.1 3.22 3.22.1 3.22.2 3.22.3 3.22.4 3.22.5 3.22.6 All 75 releases
atarim-visual-collaboration / wpfeedback.php

wpfeedback.php in Atarim – AI Agency for WordPress: Edit Pages, Fix Code, Update Plugins, SEO & Client Feedback 3.4, at wpfeedback.php

2,764 lines 159.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Atarim - Client Interface
4 * Description: Atarim is a client-focused agency management platform to help simplify collaboration and get things done fast.
5 *
6 * Version: 3.4
7 * Requires at least: 5.0
8 *
9 * Author: Atarim
10 * Author URI: https://atarim.io/
11 *
12 * Text Domain: atarim
13 * Domain Path: /languages/
14 *
15 * License: GPL-3.0-or-later
16 *
17 * @author Atarim <support@atarim.io>
18 * @copyright 2021 Atarim
19 * @license GPL-3.0-or-later
20 * @package Atarim
21 */
22
23 /**
24 * If this file is called directly, abort.
25 */
26 if ( ! defined( 'WPINC' ) ) {
27 die;
28 }
29 if ( ! defined( 'WPF_PLUGIN_NAME' ) ) {
30 define( 'WPF_PLUGIN_NAME', trim( dirname( plugin_basename( __FILE__ ) ), '/' ) );
31 }
32 if ( ! defined( 'WPF_PLUGIN_DIR' ) ) {
33 define( 'WPF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
34 }
35 if ( ! defined( 'WPF_PLUGIN_URL' ) ) {
36 define( 'WPF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
37 }
38 if ( ! defined( 'WPF_VERSION' ) ) {
39 define( 'WPF_VERSION', '3.4' );
40 }
41
42 $site_url = site_url();
43
44 define( 'SCOPER_ALL_UPLOADS_EDITABLE ', true );
45
46
47 if ( ! defined( 'WPF_SITE_URL' ) ) {
48 define( 'WPF_SITE_URL', $site_url );
49 }
50
51 // this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed.
52 define( 'WPF_EDD_SL_STORE_URL', 'https://atarim.io/' ); // IMPORTANT: change the name of this constant to something unique to prevent conflicts with other plugins using this system.
53 // the download ID. This is the ID of your product in EDD and should match the download ID visible in your Downloads list (see example below).
54 define( 'WPF_EDD_SL_ITEM_ID', get_option( 'wpf_prod_id' ) ); // IMPORTANT: change the name of this constant to something unique to prevent conflicts with other plugins using this system.
55 define( 'WPF_EDD_FALLBACK_URL', 'https://verify.wpfeedback.co/' );
56
57 // site urls.
58 define( 'WPF_MAIN_SITE_URL', 'https://atarim.io' );
59 define( 'WPF_APP_SITE_URL', 'https://app.atarim.io' );
60 define( 'WPF_LEARN_SITE_URL', 'https://academy.atarim.io' );
61
62 /*
63 * Register hooks that are fired when the plugin is activated or deactivated.
64 * When the plugin is deleted, the uninstall.php file is loaded.
65 */
66 register_activation_hook( __FILE__, array( 'WP_Feedback', 'activate' ) );
67 register_deactivation_hook( __FILE__, array( 'WP_Feedback', 'deactivate' ) );
68
69 function wpb_admin_notice_warn() {
70 $wpf_user_type = wpf_user_type();
71 $is_notice = get_option('wp_feedback_notice', 'true');
72 if ( current_user_can( 'administrator' ) && $wpf_user_type == 'advisor' && $is_notice == 'true' ) {
73 ?>
74 <div class="notice notice-warning wpf_admin_notice wpf-gftool-notice is-dismissible">
75 <div class="wpf_admin_notice_icon">
76 <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1080">
77 <defs>
78 <style>
79 .cls-1 {
80 fill: #fff;
81 }
82 .cls-2 {
83 fill: #052055;
84 }
85 </style>
86 </defs>
87 <title>Atarim Logo Inverted</title>
88 <g>
89 <g>
90 <polygon class="cls-1" points="937.344 785.955 746.1 856.215 851.972 1060.257 1080 1059.991 937.344 785.955"/>
91 <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"/>
92 </g>
93 <polygon class="cls-2" points="227.659 1060.331 373.967 778.521 1055.074 519.371 227.659 1060.331"/>
94 </g>
95 </svg>
96 </div>
97 <div class="wpf_admin_notice_content">
98 <h4>The Graphic Feedback Tool is moving to the Atarim Dashboard!</h4>
99 <p>Please note that in the next update the ability to add new graphic items and manage your existing items is going to be removed as you will be able to add new graphic items directly inside your Atarim Dashboard - With a few cool new advances. If you already have existing designs, they will still be available through their respective direct URLs.</p>
100 <p class="admin_notice_footer"><i>* This notice is shown to you as the Webmaster.</i></p>
101 </div>
102 </div>
103 <?php
104 }
105 }
106 add_action( 'admin_notices', 'wpb_admin_notice_warn' );
107
108
109 add_action( 'admin_menu', 'wp_feedback_admin_menu' );
110 /**
111 * Create the admin menu.
112 * This function is used to register the admin menu for the Atarim.
113 *
114 * @input NULL
115 * @return NULL
116 */
117 function wp_feedback_admin_menu() {
118 global $current_user;
119 $wpf_powered_by = get_site_data_by_key( 'wpfeedback_powered_by' );
120
121 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
122 $selected_roles = explode( ',', $selected_roles );
123
124 $main_menu_id = 'wpfeedback_page_tasks';
125
126 if ( array_intersect( $current_user->roles, $selected_roles ) || current_user_can( 'administrator' ) ) {
127 $wpf_user_type = wpf_user_type();
128
129 $badge = '';
130 if ( $wpf_powered_by == 'yes' ) {
131 $wpf_main_menu_label = __( 'Collaborate', 'wpfeedback' );
132 $wpf_main_menu_icon = WPF_PLUGIN_URL . 'images/atarim-whitelabel.svg';
133 } else {
134 $wpf_main_menu_label = __( 'Collaborate', 'wpfeedback' );
135 $wpf_main_menu_icon = WPF_PLUGIN_URL . 'images/atarim_favicon_white.svg';
136 }
137 add_menu_page(
138 __( $wpf_main_menu_label, 'wpfeedback' ), __( $wpf_main_menu_label, 'wpfeedback' ) . $badge, 'read', $main_menu_id, $main_menu_id, $wpf_main_menu_icon, 80
139 );
140 add_submenu_page(
141 $main_menu_id, __( 'Tasks Center', 'wpfeedback' ), __( 'Tasks Center', 'wpfeedback' ), 'read', 'wpfeedback_page_tasks', 'wpfeedback_page_tasks'
142 );
143 add_submenu_page(
144 '', __( 'Graphics', 'wpfeedback' ), __( 'Graphics', 'wpfeedback' ), 'read', 'wpfeedback_page_graphics', 'wpfeedback_page_graphics'
145 );
146 if ( $wpf_user_type == 'advisor' || ( $wpf_user_type == '' && current_user_can( 'administrator' ) ) ) {
147 add_submenu_page(
148 $main_menu_id, __( 'Settings', 'wpfeedback' ), __( 'Settings', 'wpfeedback' ), 'read', 'wpfeedback_page_settings', 'wpfeedback_page_settings'
149 );
150 }
151 if ( $wpf_user_type == 'advisor' || ( $wpf_user_type == '' && current_user_can( 'administrator' ) ) ) {
152 add_submenu_page(
153 $main_menu_id, __( 'Permissions', 'wpfeedback' ), __( 'Permissions', 'wpfeedback' ), 'read', 'wpfeedback_page_permissions', 'wpfeedback_page_permissions'
154 );
155 }
156 if ( $wpf_user_type == 'advisor' ) {
157 add_submenu_page(
158 $main_menu_id, __( 'Integrations', 'wpfeedback' ), __( 'Integrations', 'wpfeedback' ), 'read', 'wpfeedback_page_integrate', 'wpfeedback_page_integrate'
159 );
160 }
161
162 if ( $wpf_user_type == 'advisor' || ( $wpf_user_type == '' && current_user_can( 'administrator' ) ) ) {
163 add_submenu_page(
164 $main_menu_id, __( 'Support', 'wpfeedback' ), __( 'Support', 'wpfeedback' ), 'read', 'https://atarim.io/support-reachout'
165 );
166 add_submenu_page(
167 $main_menu_id, __( 'Upgrade', 'wpfeedback' ), __( 'Upgrade', 'wpfeedback' ), 'read', WPF_MAIN_SITE_URL.'/upgrade'
168 );
169 }
170 }
171 }
172
173
174 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'wpf_setting_action_links' );
175 /*
176 * This function is used to set the link for the "Settings" menu item.
177 *
178 * @input Array
179 * @return Array
180 */
181 function wpf_setting_action_links( $links ) {
182 $links[] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=wpfeedback_page_settings&wpf_setting=1' ) ) . '">' . __( 'Settings', 'wpfeedback' ) . '</a>';
183 return $links;
184 }
185
186 /*
187 * This function is used used to include the page-settings template for the settings menu if the initial onboarding is already or include wpf_backend_initial_setup if not.
188 *
189 * @input NULL
190 * @return NULL
191 */
192 function wpfeedback_page_settings() {
193 global $current_user;
194 $initial_setup = get_site_data_by_key( 'wpf_initial_setup_complete' );
195 //update_option("wpf_initial_setup_complete", 'yes');
196 if ( $initial_setup != 'yes' ) {
197 require_once( WPF_PLUGIN_DIR . 'inc/admin/wpf_backend_initial_setup.php' );
198 } else {
199 require_once( WPF_PLUGIN_DIR . 'inc/admin/page-settings.php' );
200 }
201 }
202
203 /*
204 * This function is used used to include the page-settings template for the tasks menu.
205 *
206 * @input NULL
207 * @return NULL
208 */
209 function wpfeedback_page_tasks() {
210 global $current_user;
211 require_once( WPF_PLUGIN_DIR . 'inc/admin/page-settings.php' );
212 }
213
214 /*
215 * This function is used used to include the page-settings template for the integration menu.
216 *
217 * @input NULL
218 * @return NULL
219 */
220 function wpfeedback_page_integrate() {
221 global $current_user;
222 require_once( WPF_PLUGIN_DIR . 'inc/admin/page-settings.php' );
223 }
224
225 /*
226 * This function is used used to include the page-settings template for the support menu.
227 *
228 * @input NULL
229 * @return NULL
230 */
231 function wpfeedback_page_support() {
232 global $current_user;
233 require_once( WPF_PLUGIN_DIR . 'inc/admin/page-settings.php' );
234 }
235
236 /*
237 * This function is used used to include the page-settings-permissions template for the Permissions menu.
238 *
239 * @input NULL
240 * @return NULL
241 */
242 function wpfeedback_page_permissions() {
243 global $current_user;
244 require_once( WPF_PLUGIN_DIR . 'inc/admin/page-settings-permissions.php' );
245 }
246
247 /*
248 * This function is used used to include the page-settings-graphics template for the graphics menu.
249 *
250 * @input NULL
251 * @return NULL
252 */
253 function wpfeedback_page_graphics() {
254 global $current_user;
255 require_once( WPF_PLUGIN_DIR . 'inc/admin/page-settings-graphics.php' );
256 }
257
258 /*
259 * Require admin functionality
260 */
261 require_once( WPF_PLUGIN_DIR . 'inc/wpf_ajax_functions.php' );
262 require_once( WPF_PLUGIN_DIR . 'inc/wpf_function.php' );
263 require_once( WPF_PLUGIN_DIR . 'inc/wpf_email_notifications.php' );
264 require_once( WPF_PLUGIN_DIR . 'inc/wpf_admin_functions.php' );
265 require_once( WPF_PLUGIN_DIR . 'inc/admin/wpf_admin_function.php' );
266 require_once( WPF_PLUGIN_DIR . 'inc/wpf_api.php' );
267
268 if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
269 // load our custom updater if it doesn't already exist
270 include( dirname( __FILE__ ) . '/inc/EDD_SL_Plugin_Updater.php' );
271 }
272
273 $wpf_image_cache = WPF_PLUGIN_DIR . "cache/";
274 if ( ! file_exists( $wpf_image_cache ) ) {
275 mkdir( $wpf_image_cache, 0777, true );
276 }
277
278 // retrieve our license key from the DB.
279 $wpf_license_key = trim( get_option( 'wpf_license_key' ) );
280 $wpf_decry_key = wpf_crypt_key( $wpf_license_key, 'd' );
281 // setup the updater.
282 $edd_updater = new EDD_SL_Plugin_Updater( WPF_EDD_SL_STORE_URL, __FILE__,
283 array(
284 'version' => WPF_VERSION, // current version number.
285 'license' => $wpf_decry_key, // license key (used get_option above to retrieve from DB).
286 'item_id' => WPF_EDD_SL_ITEM_ID, // id of this plugin.
287 'author' => 'Ace Digital London', // author of this plugin.
288 'url' => WPF_SITE_URL,
289 'beta' => false, // set to true if you wish customers to receive update notifications of beta releases.
290 )
291 );
292
293 add_action( 'init','new_license_activation' );
294 function new_license_activation() {
295 if ( get_option( 'wpf_prod_id' ) == '' ) {
296 update_option( 'wpf_license','invalid','no' );
297 }
298
299 /*New license activation*/
300 if ( isset( $_GET['atarim_response'] ) && isset( $_GET['expires'] ) ) {
301 delete_option( 'wpf_decr_checksum' );
302 delete_option( 'wpf_decr_key' );
303 delete_option( 'wpf_license_expires' );
304 delete_option( 'wpf_license' );
305 delete_option( 'wpf_prod_id' );
306 delete_option( 'wpf_license_key' );
307
308 $wpf_license_key = base64_decode( sanitize_text_field( $_GET['license_key'] ) );
309
310 update_option( 'wpf_license', base64_decode( sanitize_text_field( $_GET['atarim_response'] ) ) );
311 update_option( 'wpf_license_expires', base64_decode( sanitize_text_field( $_GET['expires'] ) ), 'no' );
312 update_option( 'wpf_prod_id', base64_decode( sanitize_text_field( $_GET['prod_id'] ) ), 'no' );
313
314 $decr = update_option( 'wpf_decr_key', base64_decode( sanitize_text_field( $_GET['payment_id'] ) ) );
315 $checksu = update_option( 'wpf_decr_checksum', base64_decode( sanitize_text_field( $_GET['checksum'] ) ), 'no' );
316 $wpf_crypt_key = wpf_crypt_key( $wpf_license_key, 'e' );
317 update_option( 'wpf_license_key', $wpf_crypt_key, 'no' );
318 update_option( 'wpf_site_id', base64_decode( sanitize_text_field( $_GET['wpf_site_id'] ) ), 'no' );
319 do_action( 'wpf_initial_sync', $wpf_license_key );
320 syncUsers();
321 get_notif_sitedata_filterdata();
322 syncPages();
323 }
324
325 // When Enable Global Settings is on, the site data will be fetched by the API.
326 $wpf_global_settings = get_option( 'wpf_global_settings' );
327 if ( $wpf_global_settings === "yes" ) {
328 get_site_data();
329 }
330 }
331
332 /*
333 * This function is used for add/update
334 * user default site data
335 */
336 function update_default_site_data() {
337 $options = array();
338 if ( get_site_data_by_key( 'wpf_tab_permission_user_client' ) == '' ) {
339 //global $current_user,$wpdb;
340 array_push( $options, ['name' => 'enabled_wpfeedback', 'value' => 'yes'] );
341 array_push( $options, ['name' => 'wpfeedback_color', 'value' => '002157'] );
342 array_push( $options, ['name' => 'wpf_selcted_role', 'value' => 'administrator'] );
343 array_push( $options, ['name' => 'wpf_website_developer', 'value' => get_current_user_id()] );
344 array_push( $options, ['name' => 'wpf_show_front_stikers', 'value' => 'yes'] );
345 array_push( $options, ['name' => 'wpf_customisations_client', 'value' => 'Client (Website Owner)'] );
346 array_push( $options, ['name' => 'wpf_customisations_webmaster', 'value' => 'Webmaster'] );
347 array_push( $options, ['name' => 'wpf_customisations_others', 'value' => 'Others'] );
348 array_push( $options, ['name' => 'wpf_from_email', 'value' => get_option( 'admin_email' )] );
349 array_push( $options, ['name' => 'wpf_tab_permission_user_client', 'value' => 'yes'] );
350 array_push( $options, ['name' => 'wpf_tab_permission_user_webmaster', 'value' => 'yes'] );
351 array_push( $options, ['name' => 'wpf_tab_permission_user_others', 'value' => 'yes'] );
352 array_push( $options, ['name' => 'wpf_tab_permission_priority_client', 'value' => 'yes'] );
353 array_push( $options, ['name' => 'wpf_tab_permission_priority_webmaster', 'value' => 'yes'] );
354 array_push( $options, ['name' => 'wpf_tab_permission_priority_others', 'value' => 'yes'] );
355 array_push( $options, ['name' => 'wpf_tab_permission_status_client', 'value' => 'yes'] );
356 array_push( $options, ['name' => 'wpf_tab_permission_status_webmaster', 'value' => 'yes'] );
357 array_push( $options, ['name' => 'wpf_tab_permission_status_others', 'value' => 'yes'] );
358 array_push( $options, ['name' => 'wpf_tab_permission_screenshot_client', 'value' => 'yes'] );
359 array_push( $options, ['name' => 'wpf_tab_permission_screenshot_webmaster', 'value' => 'yes'] );
360 array_push( $options, ['name' => 'wpf_tab_permission_screenshot_others', 'value' => 'yes'] );
361 array_push( $options, ['name' => 'wpf_tab_permission_information_client', 'value' => 'yes'] );
362 array_push( $options, ['name' => 'wpf_tab_permission_information_webmaster', 'value' => 'yes'] );
363 array_push( $options, ['name' => 'wpf_tab_permission_information_others', 'value' => 'yes'] );
364 array_push( $options, ['name' => 'wpf_tab_permission_delete_task_client', 'value' => 'no'] );
365 array_push( $options, ['name' => 'wpf_tab_permission_delete_task_webmaster', 'value' => 'yes'] );
366 array_push( $options, ['name' => 'wpf_tab_permission_delete_task_others', 'value' => 'no'] );
367 }
368
369 if ( get_site_data_by_key( 'wpf_tab_permission_user_guest' ) == '' ) {
370 array_push( $options, ['name' => 'wpf_tab_permission_user_guest', 'value' => 'no'] );
371 array_push( $options, ['name' => 'wpf_tab_permission_priority_guest', 'value' => 'no'] );
372 array_push( $options, ['name' => 'wpf_tab_permission_status_guest', 'value' => 'no'] );
373 array_push( $options, ['name' => 'wpf_tab_permission_screenshot_guest', 'value' => 'yes'] );
374 array_push( $options, ['name' => 'wpf_tab_permission_information_guest', 'value' => 'yes'] );
375 array_push( $options, ['name' => 'wpf_tab_permission_delete_task_guest', 'value' => 'no'] );
376 }
377
378 if ( get_site_data_by_key( 'wpf_tab_auto_screenshot_task_client' ) == '' ) {
379 array_push( $options, ['name' => 'wpf_tab_auto_screenshot_task_client', 'value' => 'yes'] );
380 }
381
382 if ( get_site_data_by_key( 'wpf_tab_auto_screenshot_task_webmaster' ) == '' ) {
383 array_push( $options, ['name' => 'wpf_tab_auto_screenshot_task_webmaster', 'value' => 'yes'] );
384 }
385
386 if ( get_site_data_by_key( 'wpf_tab_auto_screenshot_task_others' ) == '' ) {
387 array_push( $options, ['name' => 'wpf_tab_auto_screenshot_task_others', 'value' => 'yes'] );
388 }
389
390 if ( get_site_data_by_key( 'wpf_tab_auto_screenshot_task_guest' ) == '' ) {
391 array_push( $options, ['name' => 'wpf_tab_auto_screenshot_task_guest', 'value' => 'yes'] );
392 }
393
394 if( ! empty( $options ) ) {
395 update_site_data( $options );
396 }
397 }
398
399 /*
400 * This function is used to detect if the page builder is initialized on the current running page and deregister the Atarim of found running.
401 *
402 * @input NULL
403 * @return NULL
404 */
405 function wpfeedback_add_stylesheet_frontend() {
406 $wpf_check_page_builder_active = wpf_check_page_builder_active();
407 /* =====Start Check customize.php==== */
408 if ( $wpf_check_page_builder_active == 0 ) {
409 if ( is_customize_preview() ) {
410 $wpf_check_page_builder_active = 1;
411 } else {
412 $wpf_check_page_builder_active = 0;
413 }
414 }
415 /* =====END check customize.php==== */
416 $enabled_wpfeedback = wpf_check_if_enable();
417 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
418 $is_site_archived = get_site_data_by_key( 'wpf_site_archived' );
419 if ( $wpf_enabled == 'yes' && ( ! $is_site_archived ) ) {
420 if ( ! is_user_logged_in() ) {
421 /* Show the login modal only when 'wpf_login' is present => v2.0.9, v2.1.0 */
422 if ( ( get_query_var( 'is_graphic_page' ) ) || ( ! empty( $_GET['wpf_login'] ) ) ) {
423 wp_register_style( 'wpf_login_style', WPF_PLUGIN_URL . 'css/wpf-login.css', false, strtotime( "now" ) );
424 wp_enqueue_style( 'wpf_login_style' );
425 }
426 }
427
428 if ( get_query_var( 'is_graphic_page' ) ) {
429 wp_register_style( 'wpf-graphics-front-style', WPF_PLUGIN_URL . 'css/graphics-front.css', false, strtotime( "now" ) );
430 wp_enqueue_style( 'wpf-graphics-front-style' );
431 }
432
433 /* Show the login modal only when 'wpf_login' is present => v2.0.9, v2.1.0 */
434 if ( ( get_query_var( 'is_graphic_page' ) ) || ( ! empty( $_GET['wpf_login'] ) ) ) {
435 wp_register_script( 'wpf-ajax-login', WPF_PLUGIN_URL . 'js/wpf-ajax-login.js', array(), strtotime( "now" ), true );
436 wp_enqueue_script( 'wpf-ajax-login' );
437 }
438
439 wp_localize_script( 'wpf-ajax-login', 'wpf_ajax_login_object',
440 array(
441 'ajaxurl' => admin_url( 'admin-ajax.php' ),
442 'wpf_reconnect_icon' => WPF_PLUGIN_URL . 'images/wpf_reconnect.png',
443 'redirecturl' => home_url(),
444 'loadingmessage' => __( 'Sending user info, please wait...' ),
445 )
446 );
447 }
448 if ( ( get_query_var( 'is_graphic_page' ) ) || ( $enabled_wpfeedback == 1 && ! $is_site_archived ) ) {
449 wp_register_style( 'wpf_wpf-icons', WPF_PLUGIN_URL . 'css/wpf-icons.css', false, strtotime( "now" ) );
450 wp_enqueue_style( 'wpf_wpf-icons' );
451
452 wp_register_style( 'wpf_wpf-common', WPF_PLUGIN_URL . 'css/wpf-common.css', false, strtotime( "now" ) );
453 wp_enqueue_style( 'wpf_wpf-common' );
454
455 wp_register_style( 'wpf_rt_style', WPF_PLUGIN_URL . 'css/quill.css', false, strtotime( "now" ) );
456 wp_enqueue_style( 'wpf_rt_style' );
457
458 wp_register_script( 'wpf_rt_script', WPF_PLUGIN_URL . 'js/quill.js', array(), WPF_VERSION, true );
459 wp_enqueue_script( 'wpf_rt_script' );
460
461 wp_register_script( 'wpf_jquery_script', WPF_PLUGIN_URL . 'js/atarimjs.js', array(), WPF_VERSION, true );
462 wp_enqueue_script( 'wpf_jquery_script' );
463
464 //wp_register_script( 'pickr', WPF_PLUGIN_URL . 'js/pickr.min.js', null, null, true );
465 //wp_enqueue_script( 'pickr' );
466
467 //wp_register_style( 'pickr_monolith', WPF_PLUGIN_URL . 'css/monolith.min.css' );
468 //wp_enqueue_style( 'pickr_monolith' );
469 if ( $wpf_check_page_builder_active == 0 ) {
470
471 wp_register_script( 'wpf_jquery_ui_script', WPF_PLUGIN_URL . 'js/atarim-ui.js', array(), WPF_VERSION, true );
472 wp_enqueue_script( 'wpf_jquery_ui_script' );
473
474 wp_register_script( 'wpf_touch_mouse_script', WPF_PLUGIN_URL . 'js/atarim.ui.mouse.min.js', array(), WPF_VERSION, true );
475 wp_enqueue_script( 'wpf_touch_mouse_script' );
476
477 wp_register_script( 'wpf_touch_punch_script', WPF_PLUGIN_URL . 'js/jquery.ui.touch-punch.js', array(), WPF_VERSION, true );
478 wp_enqueue_script( 'wpf_touch_punch_script' );
479
480
481 wp_register_script( 'wpf_browser_info_script', WPF_PLUGIN_URL . 'js/wpf_browser_info.js', array(), WPF_VERSION, true );
482 wp_enqueue_script( 'wpf_browser_info_script' );
483
484 if ( get_query_var( 'is_graphic_page' ) ) {
485 wp_register_script( 'wpf-graphics-front-script', WPF_PLUGIN_URL . 'js/app_graphics.js', array(), strtotime( "now" ), true );
486 wp_enqueue_script( 'wpf-graphics-front-script' );
487
488 $upgrade_url = get_option( 'upgrade_url' );
489 wp_localize_script( 'wpf-graphics-front-script', 'upgrade_url', array( 'url' => $upgrade_url, 'plugin_url' => WPF_PLUGIN_URL ) );
490
491 $feature = array();
492 $edit = is_feature_enabled( 'edit' );
493 if ( ! $edit ) {
494 $feature[] = 'edit';
495 }
496 wp_localize_script( 'wpf-graphics-front-script', 'blocked', $feature );
497
498 wp_enqueue_media();
499 } else {
500 wp_register_script( 'wpf_app_script', WPF_PLUGIN_URL . 'js/app.js', array(), strtotime( "now" ), true );
501 wp_enqueue_script( 'wpf_app_script' );
502 $wpf_user_type = wpf_user_type();
503 $display_name = '';
504 $avatar_url = '';
505 if ( is_user_logged_in() ) {
506 $user = wp_get_current_user();
507 $display_name = $user->display_name;
508 $user_id = get_current_user_id();
509 $avatar_url = get_avatar_url( $user_id, array( 'size' => 42, 'default' => '404' ) );
510 $headers = @get_headers( $avatar_url );
511 if ( $headers[0] == 'HTTP/1.1 404 Not Found' ) {
512 $avatar_url = '';
513 }
514 }
515
516 wp_localize_script( 'wpf_app_script', 'logged_user', array( 'current_user' => $wpf_user_type, 'author_img' => $avatar_url, 'author' => $display_name ) );
517
518 $feature = array();
519 $edit = is_feature_enabled( 'edit' );
520 if ( ! $edit ) {
521 $feature[] = 'edit';
522 }
523 wp_localize_script( 'wpf_app_script', 'blocked', $feature );
524
525 $upgrade_url = get_option( 'upgrade_url' );
526 wp_localize_script( 'wpf_app_script', 'upgrade_url', array( 'url' => $upgrade_url, 'plugin_url' => WPF_PLUGIN_URL ) );
527
528 $wpf_get_user_type = esc_attr( wpf_user_type() );
529 $wpf_new_task = isset($_GET['wpf-task']) ? true : false;
530 if( $wpf_new_task && ! get_option( 'wpf_app_auto_task' ) ) {
531 update_option( 'wpf_app_auto_task', true );
532 $wpf_app_auto_task = true;
533 $wpf_new_task = true;
534 } else {
535 $wpf_app_auto_task = false;
536 $wpf_new_task = false;
537 }
538 $wpf_frontend_user = ( isset( $_GET['wpf-user-flow'] ) || isset( $_GET['wpf-existing-user-flow'] ) ) ? true : false;
539 wp_localize_script( 'wpf_app_script', 'wpf_app_script_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'wpf_app_auto_task' => $wpf_app_auto_task, 'wpf_new_task' => $wpf_new_task, 'wpf_frontend_user' => $wpf_frontend_user ) );
540 }
541 wp_register_script( 'wpf_common_functions', WPF_PLUGIN_URL . 'js/wpf_common_functions.js', array(), strtotime( "now" ), true );
542 wp_enqueue_script( 'wpf_common_functions' );
543
544 wp_register_script( 'wpf_html2canvas_script', WPF_PLUGIN_URL . 'js/html2canvas.js', array(), WPF_VERSION, true );
545 wp_enqueue_script( 'wpf_html2canvas_script' );
546
547 wp_register_script( 'wpf_popper_script', WPF_PLUGIN_URL . 'js/popper.min.js', array(), WPF_VERSION, true );
548 wp_enqueue_script( 'wpf_popper_script' );
549
550 wp_register_script( 'wpf_custompopover_script', WPF_PLUGIN_URL . 'js/custompopover.js', array(), WPF_VERSION, true );
551 wp_enqueue_script( 'wpf_custompopover_script' );
552
553 wp_register_script( 'wpf_selectoroverlay_script', WPF_PLUGIN_URL . 'js/selectoroverlay.js', array(), WPF_VERSION, true );
554 wp_enqueue_script( 'wpf_selectoroverlay_script' );
555
556 wp_register_script( 'wpf_xyposition_script', WPF_PLUGIN_URL . 'js/xyposition.js', array(), WPF_VERSION, true );
557 wp_enqueue_script( 'wpf_xyposition_script' );
558
559 wp_register_script( 'wpf_bootstrap_script', WPF_PLUGIN_URL . 'js/bootstrap.min.js', array(), WPF_VERSION, true );
560 wp_enqueue_script( 'wpf_bootstrap_script' );
561 }
562 }
563 }
564 add_action('wp_enqueue_scripts', 'wpfeedback_add_stylesheet_frontend');
565
566 add_filter( 'script_loader_tag', 'add_attributes_to_script', 10, 3 );
567 /**
568 *
569 * Prevent collision with the WordPress jQuery
570 */
571 function add_attributes_to_script( $tag, $handle, $src ) {
572 if ( 'wpf_jquery_script' === $handle ) {
573 if ( wp_script_is( 'jquery', 'enqueued' ) ) {
574 $tag = '<script>var jQuery_WPF = jQuery;</script>';
575 } else {
576 return;
577 }
578 }
579 return $tag;
580 }
581
582
583
584 /*
585 * This function is used to create the security nonce every time a user requests the Atarim.
586 *
587 * @input NULL
588 * @return String
589 */
590
591 function wpf_wp_create_nonce() {
592 global $post;
593 $wpf_allow_guest = get_site_data_by_key( 'wpf_allow_guest' );
594 if ( is_user_logged_in() || $wpf_allow_guest == 'yes' ) {
595 $wpf_nonce = wp_create_nonce( 'wpfeedback-script-nonce' );
596 return $wpf_nonce;
597 }
598 if ( get_query_var( 'is_graphic_page' ) && ! is_user_logged_in() && $wpf_allow_guest != 'yes' ) {
599 $wpf_nonce = wp_create_nonce( 'wpfeedback-script-nonce' );
600 return $wpf_nonce;
601 }
602 }
603
604 /* ==========All Java script for Admin footer========= */
605 /*
606 * This function is used to initial the Atarim and all related variables on the backend.
607 *
608 * @input NULL
609 * @return NULL
610 */
611 if ( isset( $_GET['page'] ) ) {
612 add_action( 'admin_footer', 'wpf_backed_scripts' );
613 }
614 function wpf_backed_scripts() {
615 global $wpdb, $post, $current_user;
616 $author_id = $current_user->ID;
617 $wpf_user_type = wpf_user_type();
618 $currnet_user_information = wpf_get_current_user_information();
619 $current_role = $currnet_user_information['role'];
620 $current_user_name = $currnet_user_information['display_name'];
621 $current_user_id = $currnet_user_information['user_id'];
622 $wpf_website_builder = get_site_data_by_key( 'wpf_website_developer' );
623 if ( $current_user_name == 'Guest' ) {
624 $wpf_website_client = get_site_data_by_key( 'wpf_website_client' );
625 $wpf_current_role = 'guest';
626 if ( $wpf_website_client ) {
627 $wpf_website_client_info = get_userdata( $wpf_website_client );
628 if ( $wpf_website_client_info ) {
629 if ( $wpf_website_client_info->display_name == '' ) {
630 $current_user_name = $wpf_website_client_info->user_nicename;
631 } else {
632 $current_user_name = $wpf_website_client_info->display_name;
633 }
634 }
635 }
636 }
637 $current_user_name = addslashes( $current_user_name );
638 $wpf_show_front_stikers = get_site_data_by_key( 'wpf_show_front_stikers' );
639 $unix_time_now = time();
640 $wpf_check_atarim_server = get_option( 'atarim_server_down_check' );
641
642 if ( $unix_time_now > $wpf_check_atarim_server ) {
643 update_option( 'atarim_server_down','false','no' );
644 }
645
646 $atarim_server_down = get_option( 'atarim_server_down' );
647 $wpfb_users = do_shortcode( '[wpf_user_list_front]' );
648 $wpf_all_pages = wpf_get_page_list();
649 $ajax_url = admin_url( 'admin-ajax.php' );
650 $plugin_url = WPF_PLUGIN_URL;
651 $wpf_comment_time = date( 'd-m-Y H:i', current_time( 'timestamp', 0 ) );
652 $wpf_nonce = wpf_wp_create_nonce();
653 $sound_file = esc_url( plugins_url( 'images/wpf-screenshot-sound.mp3', __FILE__ ) );
654 $comment_count = get_last_task_id();
655
656 echo "<script>var wpf_nonce = '$wpf_nonce', wpf_comment_time = '$wpf_comment_time', wpf_all_pages = '$wpf_all_pages', current_role = '$current_role', wpf_current_role = '$wpf_user_type', current_user_name = '$current_user_name', current_user_id = '$current_user_id', wpf_website_builder = '$wpf_website_builder', wpfb_users = '$wpfb_users', ajaxurl = '$ajax_url', wpf_screenshot_sound = '$sound_file', plugin_url = '$plugin_url', comment_count = '$comment_count', wpf_show_front_stikers = '$wpf_show_front_stikers', atarim_server_down = '$atarim_server_down';</script>";
657
658 if ( isset( $_REQUEST['page'] ) ) {
659 if ( $_REQUEST['page'] == 'wpfeedback_page_settings' || $_REQUEST['page'] == 'wpfeedback_page_tasks' || $_REQUEST['page'] == 'wpfeedback_page_integrate' || $_REQUEST['page'] == 'wpfeedback_page_upgrade' || $_REQUEST['page'] == 'wpfeedback_page_support' || $_REQUEST['page'] == 'wpfeedback_page_permissions' || $_REQUEST['page'] == 'wpfeedback_page_graphics' ) {
660 ?>
661 <script type='text/javascript'>
662 var plugin_url = '<?php echo $plugin_url ?>';
663 var current_task = 0;
664 var current_user_id = "<?php echo $author_id; ?>";
665 var wpf_user_type = "<?php echo $wpf_user_type; ?>";
666
667 function getParameterByName(name) {
668 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
669 var regexS = "[\\?&]" + name + "=([^&#]*)";
670 var regex = new RegExp( regexS );
671 var results = regex.exec( window.location.href );
672 if ( results == null ) {
673 return "";
674 } else {
675 return decodeURIComponent( results[1].replace(/\+/g, " ") );
676 }
677 }
678
679 /*
680 * wpf task filter code
681 */
682 function wp_feedback_filter() {
683 var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
684 var task_types = [];
685 var task_title = jQuery('#wpf_tasks #wpf_search_title').val();
686 var task_types_meta = [];
687 jQuery.each(
688 jQuery("#wpf_filter_form input[name='task_types']:checked"), function () {
689 task_types.push( jQuery(this).val() );
690 }
691 );
692 var selected_task_types_values = task_types.join(",");
693 var is_internal = 0;
694 jQuery.each(
695 jQuery("#wpf_filter_form input[name='task_types_meta']:checked"), function (index, element) {
696 if ( jQuery(element).attr('id') === 'wpf_task_type_internal' ) {
697 is_internal = 1;
698 } else {
699 task_types_meta.push(jQuery(this).val());
700 }
701 }
702 );
703 var selected_task_types_meta_values = task_types_meta.join(",");
704 var task_status = [];
705 jQuery.each(
706 jQuery("#wpf_filter_form input[name='task_status']:checked"), function () {
707 task_status.push(jQuery(this).val());
708 }
709 );
710 var selected_task_status_values = task_status.join(",");
711 var task_priority = [];
712 jQuery.each(
713 jQuery("#wpf_filter_form input[name='task_priority']:checked"), function () {
714 task_priority.push(jQuery(this).val());
715 }
716 );
717 var selected_task_priority_values = task_priority.join(",");
718 var author_list = [];
719 jQuery.each(
720 jQuery("#wpf_filter_form input[name='author_list']:checked"), function () {
721 author_list.push(jQuery(this).val());
722 }
723 );
724 var selected_author_list_values = author_list.join(",");
725 var wpf_display_all_taskmeta_tasktab = jQuery('#wpf_display_all_taskmeta_tasktab').prop("checked") ? 1 : 0;
726 jQuery.ajax({
727 method: "POST",
728 url: ajaxurl,
729 data: {
730 action: "wpfeedback_get_post_list_ajax",
731 wpf_nonce: wpf_nonce,
732 task_title: task_title,
733 task_types: selected_task_types_values, task_types_meta: selected_task_types_meta_values,
734 task_status: selected_task_status_values,
735 task_priority: selected_task_priority_values,
736 author_list: selected_author_list_values,
737 internal: is_internal
738 },
739 beforeSend: function () {
740 jQuery('.wpf_loader_admin').show();
741 },
742 success: function (data) {
743 //Comment
744 jQuery('#wpf_display_all_taskmeta_tasktab').prop('checked', false);
745 jQuery('.wpf_loader_admin').hide();
746 jQuery('.wpf_tasks_col .wpf_tasks-list').html(data);
747 if ( document.getElementById('wpf_task_bulk_tab').checked ) {
748 jQuery('.wpf_task_num_top').hide();
749 jQuery('#wpf_task_all_tab').removeClass('active');
750 jQuery('ul#all_wpf_list li .wpf_task_id').addClass('wpf_active');
751 jQuery('ul#all_wpf_list #wpf_bulk_select_task_checkbox').addClass('wpf_active');
752 jQuery('#wpf_bulk_select_task_checkbox').show();
753 }
754 if ( wpf_display_all_taskmeta_tasktab == 1 ) {
755 jQuery('ul#all_wpf_list li div.wpf_task_meta').addClass('wpf_active');
756 jQuery('#wpf_display_all_taskmeta_tasktab').prop("checked", true);
757 }
758 }
759 });
760 }
761 var internal_icon_html='<span class="wpf_chevron_wrapper"><img src="' + plugin_url + 'images/eye-off-white.svg" class="wpf-internal-img"></span>';
762 function get_wpf_message_form( comment_post_ID, curren_user_id,is_internal ) {
763 let internal_button = '';
764 if ( wpf_current_role == 'advisor' ) {
765 if ( is_internal == '1' ) {
766 internal_class = "wpf_is_internal";
767 internal_button = '<button class="wpf_mark_internal wpf_mark_internal_task_center '+internal_class+'" data-id="'+comment_post_ID+'"><img src="' + plugin_url + 'images/eye-off-white.svg" class="wpf-internal-img"><span class="wpf_tooltiptext unmark_internal_tooltip_text">Switch to a normal task</span><span class="wpf_tooltiptext new_internal_tooltip_text">Add comment and create Internal task</span><span class="wpf_tooltiptext mark_internal_tooltip_text">Switch to an Internal task</span></button>';
768 } else {
769 internal_class = "";
770 internal_button = '<button class="wpf_mark_internal wpf_mark_internal_task_center '+internal_class+'" data-id="'+comment_post_ID+'"><img src="' + plugin_url + 'images/eye-off.svg" class="wpf-internal-img"><span class="wpf_tooltiptext unmark_internal_tooltip_text">Switch to a normal task</span><span class="wpf_tooltiptext new_internal_tooltip_text">Add comment and create Internal task</span><span class="wpf_tooltiptext mark_internal_tooltip_text">Switch to an Internal task</span></button>';
771 }
772 }
773 let note_button = '';
774 if ( wpf_current_role == 'advisor' || wpf_current_role == 'council' ) {
775 note_button = '<button class="wpf_mark_note wpf_mark_note_task_center" onclick="send_chat_message(true)" data-id="'+comment_post_ID+'"><img src="' + plugin_url + 'images/note.svg"><span class="wpf_tooltiptext note_tooltip_text">Create a private message that only team members can see</span></button>';
776 }
777 var html = '<div id="wpf_chat_box"><form action="" method="post" id="wpf_form" class="comment-form" enctype="multipart/form-data"><p class="comment-form-comment"><div class="wpf-tc-editor"></div><textarea placeholder="' + wpf_comment_box_placeholder + '" id="wpf_comment" name="comment" maxlength="65525" required="required"></textarea><input type="hidden" name="comment_post_ID" value="' + comment_post_ID + '" id="comment_post_ID"> <input type="hidden" name="curren_user_id" value="' + curren_user_id + '" id="curren_user_id"><p class="form-submit chat_button"><input name="submit" type="button" id="send_chat" onclick="send_chat_message()" class="submit wpf_button submit" value="' + wpf_send_message_text + '">' + note_button + internal_button + '<a href="javascript:void(0)" class="wpf_upload_button wpf_button" onchange="wpf_upload_file_admin(' + comment_post_ID + ');"><input type="file" name="wpf_uploadfile" id="wpf_uploadfile" data-elemid="' + comment_post_ID + '" class="wpf_uploadfile"><i class="gg-attachment"></i></a></p><p id="wpf_upload_error" class="wpf_hide">You are trying to upload an invalid filetype <br> Allowd File Types: JPG, PNG, GIF, PDF, DOC, DOCX and XLSX</p></form></div></div>';
778 return html;
779 }
780 function send_chat_message(note=false) {
781 jQuery("#get_masg_loader").show();
782 jQuery(".get_masg_loader").show();
783 var wpf_comment = jQuery('#wpf_comment').val();
784 var post_id = jQuery('#comment_post_ID').val();
785 var author_id = "<?php echo $author_id; ?>";
786 var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
787 var note = note;
788 var task_notify_users = [];
789 jQuery.each(
790 jQuery('#wpf_attributes_content input[name="author_list_task"]:checked'), function () {
791 task_notify_users.push(jQuery(this).val());
792 }
793 );
794 task_notify_users = task_notify_users.join(",");
795
796 if ( jQuery('#wpf_comment').val().trim().length > 0 ) {
797 jQuery.ajax({
798 method: "POST",
799 url: ajaxurl,
800 data: {
801 action: "insert_wpf_comment_func",
802 wpf_nonce: wpf_nonce,
803 post_id: post_id,
804 author_id: author_id,
805 task_notify_users: task_notify_users,
806 wpf_comment: wpf_comment,
807 note: note
808 },
809 beforeSend: function () {
810 jQuery('.wpf_loader_admin').show();
811 },
812 success: function (data) {
813 try {
814 const responseData = JSON.parse(data);
815 if ( responseData['limit'] === true ) {
816 jQuery(".wpf_locked_modal_container").show();
817 return;
818 }
819 } catch(ex){}
820
821 jQuery('.wpf_loader_admin').hide();
822 jQuery("#wpf_not_found").remove();
823 jQuery("#tag_post").html('');
824 if ( jQuery('#wpf_message_list li').length == 0 ) {
825 jQuery('ul#wpf_message_list').html(data);
826 } else {
827 jQuery('ul#wpf_message_list li.chat_author:last').after(data);
828 }
829 jQuery("#wpf_comment").val("");
830 jQuery("#addcart_loader").fadeOut();
831 jQuery("#get_masg_loader").hide();
832 jQuery(".get_masg_loader").hide();
833 // empty Task center rich text editor by Pratap
834 jQuery_WPF('.ql-editor').html('');
835 jQuery('#wpf_message_content').animate({scrollTop: jQuery('#wpf_message_content').prop("scrollHeight")}, 2000);
836 if ( jQuery("#task_task_status_attr").val() == 'complete' ) {
837 jQuery("#task_task_status_attr").val("open");
838 var obj = document.getElementById("task_task_status_attr");
839 task_status_changed(obj);
840 }
841 }
842 });
843 } else {
844 jQuery("#get_masg_loader").hide();
845 jQuery('ul#wpf_message_list').animate({scrollTop: jQuery("ul#wpf_message_list li").last().offset().top}, 1000);
846 jQuery("#wpf_comment").focus();
847 jQuery("#get_masg_loader").hide();
848 }
849 }
850
851 jQuery(document).on('click','.wpf_mark_note_task_center',function(e) {
852 e.preventDefault();
853 });
854
855 jQuery(document).on('click','.wpf_mark_internal_task_center',function(e) {
856 e.preventDefault();
857 let id=jQuery(this).data('id');
858 if( jQuery(this).hasClass('wpf_is_internal') ) {
859 mark_internal_task_center(id,'0');
860 jQuery(this).find('.wpf-internal-img').attr('src', plugin_url + 'images/eye-off.svg');
861 } else {
862 mark_internal_task_center(id,'1');
863 jQuery(this).find('.wpf-internal-img').attr('src', plugin_url + 'images/eye-off-white.svg');
864 }
865 });
866 function mark_internal_task_center( id,internal ) {
867 var task_info = [];
868 var task_notify_users = [];
869 var task_comment = jQuery_WPF('#comment-'+id).val();
870 jQuery_WPF.each(
871 jQuery_WPF('input[name=author_list_'+id+']:checked'), function(){
872 task_notify_users.push(jQuery_WPF(this).val());
873 }
874 );
875 task_info['task_id'] = id;
876 task_info['internal'] = internal;
877 var task_info_obj = jQuery_WPF.extend({}, task_info);
878 var task_info_obj = jQuery_WPF.extend({}, task_info);
879 jQuery_WPF.ajax({
880 method : "POST",
881 url : ajaxurl,
882 data : {
883 action: "wpfb_mark_as_internal",
884 wpf_nonce:wpf_nonce,
885 task_info:task_info_obj
886 },
887 beforeSend: function() {
888 jQuery_WPF('.wpf_loader_admin').show();
889 },
890 success : function(data) {
891 if ( internal == '1' ) {
892 jQuery_WPF('.wpf_mark_internal_task_center').addClass('wpf_is_internal');
893 jQuery_WPF('#wpf-task-'+id).addClass('wpfb-internal');
894 jQuery_WPF('#wpf-task-'+id).find('.wpf_task_num_top').append(internal_icon_html);
895 } else {
896 jQuery_WPF('.wpf_mark_internal_task_center').removeClass('wpf_is_internal');
897 jQuery_WPF('#wpf-task-'+id).removeClass('wpfb-internal');
898 jQuery_WPF('#wpf-task-'+id).find('.wpf_task_num_top').find('.wpf_chevron_wrapper').remove();
899 }
900 jQuery_WPF('.wpf_loader_admin').hide();
901 }
902 });
903 }
904
905 function task_status_changed( sel ) {
906 var task_info = [];
907 var task_notify_users = [];
908 jQuery.each(
909 jQuery('#wpf_attributes_content input[name="author_list_task"]:checked'), function () {
910 task_notify_users.push(jQuery(this).val());
911 }
912 );
913
914 let selected_priority = jQuery('#task_task_priority_attr').val();
915 task_notify_users = task_notify_users.join(",");
916 task_info['task_id'] = current_task;
917 task_info['task_status'] = sel.value;
918 task_info['task_notify_users'] = task_notify_users;
919 var wpf_task_id = jQuery('#wpf_task_details .wpf_task_num_top').text()
920 var task_info_obj = jQuery.extend({}, task_info);
921 let sticker_permission = wpf_tab_permission_display_stickers;
922 let task_id_permission = wpf_tab_permission_display_task_id;
923 jQuery.ajax({
924 url: '<?php echo admin_url('admin-ajax.php'); ?>',
925 type: 'POST',
926 data: {
927 action: "wpfb_set_task_status",
928 wpf_nonce: wpf_nonce,
929 task_info: task_info_obj
930 },
931 beforeSend: function () {
932 jQuery('.wpf_loader_admin').show();
933 },
934 success: function (data) {
935 let display_span = '';
936 let custom_class = '';
937 if ( sticker_permission == 'yes' ) {
938 display_span = '<span class="' + selected_priority + '_custom"></span>';
939 custom_class = task_info['task_status'] + '_custom';
940 }
941 if ( task_info['task_status'] == "open" ) {
942 var news = "Open";
943 }
944 if ( task_info['task_status'] == "in-progress" ) {
945 var news = "In Progress";
946 }
947 if ( task_info['task_status'] == "pending-review" ) {
948 var news = "Pending Review";
949 }
950 if ( task_info['task_status'] == "complete" ) {
951 var news = "Complete";
952 }
953 if ( tss == "open" ) {
954 var olss = "Open";
955 }
956 if ( tss == "in-progress" ) {
957 var olss = "In Progress";
958 }
959 if ( tss == "pending-review" ) {
960 var olss = "Pending Review";
961 }
962 if ( tss == "complete" ) {
963 var olss="Complete";
964 }
965 author_img = plugin_url + 'images/bell.svg';
966 author_html = '<img src="' + author_img + '" ></img>';
967 jQuery("#wpf_message_list").append('<li class=" chat_author is_info " title="1 sec ago"><div class="wpf-comment-container"><div class="wpf-author-img">' + author_html + '</div><div class="wpf-comment-wrapper"><level class="wpf-author"> <span>1 sec</span></level><div class="task_text">'+current_user_name+' marked as <span class="taskStatusMsg">'+news+'</span> from '+olss+'</div></div></div></li>');
968 jQuery("#wpf-task-" + current_task + " .wpf_task_label .task_status").removeClass().addClass("task_status wpf_" + sel.value);
969 tss = task_info['task_status'];
970 jQuery('.wpf_loader_admin').hide();
971 jQuery('#wpf-task-' + current_task).data('task_status', sel.value);
972 var view_id = jQuery(document).find("#wpf_"+current_task).attr("data-disp-id");
973 if ( sel.value == 'complete' ) {
974 jQuery('#all_wpf_list .post_' + current_task).addClass('complete');
975 let display_check_mark = '';
976 if ( task_id_permission == false ) {
977 display_check_mark = '<i class="gg-check"></i>';
978 } else {
979 display_check_mark = view_id
980 }
981
982 jQuery('#all_wpf_list .post_' + current_task + ' .wpf_task_num_top').html(display_check_mark);
983 jQuery('#wpf_task_details .wpf_task_num_top').html(display_span + view_id);
984 jQuery('#wpf_task_details .wpf_task_num_top').removeAttr('class').addClass('wpf_task_num_top ' + custom_class);
985 jQuery('#all_wpf_list .post_' + current_task + ' .wpf_chat_top .wpf_task_num_top').html(display_span + view_id);
986 jQuery('#all_wpf_list .post_' + current_task + ' .wpf_chat_top .wpf_task_num_top').removeAttr('class').addClass('wpf_task_num_top ' + custom_class);
987 jQuery('#all_wpf_list li.post_' + current_task).removeClass('open').removeClass('complete').removeClass('pending-review').removeClass('in-progress').addClass(task_info['task_status']).addClass('active').addClass('wpf_list').addClass(selected_priority);
988 } else {
989 jQuery('#all_wpf_list .post_' + current_task).removeClass('complete');
990 jQuery('#all_wpf_list .post_' + current_task + ' .wpf_task_num_top').html(view_id);
991 jQuery('#wpf_task_details .wpf_task_num_top').html(display_span + view_id);
992 jQuery('#wpf_task_details .wpf_task_num_top').removeAttr('class').addClass('wpf_task_num_top ' + custom_class);
993 jQuery('#all_wpf_list .post_' + current_task + ' .wpf_chat_top .wpf_task_num_top').html(display_span + view_id);
994 jQuery('#all_wpf_list .post_' + current_task + ' .wpf_chat_top .wpf_task_num_top').removeAttr('class').addClass('wpf_task_num_top ' + custom_class);
995 jQuery('#all_wpf_list li.post_' + current_task).removeClass('open').removeClass('complete').removeClass('pending-review').removeClass('in-progress').addClass(task_info['task_status']).addClass('active').addClass('wpf_list').addClass(selected_priority);
996 }
997 }
998 });
999 }
1000
1001 function task_priority_changed( sel ) {
1002 var task_info = [];
1003 var task_priority = sel.value;
1004 task_info['task_id'] = current_task;
1005 task_info['task_priority'] = task_priority;
1006 var task_info_obj = jQuery.extend({}, task_info);
1007 let sticker_permission = wpf_tab_permission_display_stickers;
1008 jQuery.ajax({
1009 method: "POST",
1010 url: "<?php echo admin_url('admin-ajax.php'); ?>",
1011 data: {
1012 action: "wpfb_set_task_priority",
1013 wpf_nonce: wpf_nonce,
1014 task_info: task_info_obj
1015 },
1016 beforeSend: function () {
1017 jQuery('.wpf_loader_admin').show();
1018 },
1019 success: function (data) {
1020 let custom_class = '';
1021 if ( sticker_permission == 'yes' ) {
1022 custom_class = sel.value + '_custom';
1023 }
1024 if ( task_priority == "low" ){
1025 var news = "Low";
1026 }
1027 if ( task_priority == "medium" ) {
1028 var news = "Medium";
1029 }
1030 if ( task_priority == "high" ) {
1031 var news = "High";
1032 }
1033 if ( task_priority == "critical"){
1034 var news = "Critical";
1035 }
1036 if ( prr == "low" ) {
1037 var olss = "Low";
1038 }
1039 if ( prr == "medium" ) {
1040 var olss = "Medium";
1041 }
1042 if ( prr == "high" ) {
1043 var olss = "High";
1044 }
1045 if ( prr == "critical" ) {
1046 var olss = "Critical";
1047 }
1048 author_img = plugin_url + 'images/bell.svg';
1049 author_html = '<img src="' + author_img + '" ></img>';
1050 jQuery("#wpf_message_list").append('<li class=" chat_author is_info " title="1 sec ago"><div class="wpf-comment-container"><div class="wpf-author-img">' + author_html + '</div><div class="wpf-comment-wrapper"><level class="wpf-author"> <span>1 sec</span></level><div class="task_text">'+current_user_name+' marked as <span class="taskStatusMsg">'+news+'</span> from '+olss+'</div></div></div></li>');
1051 prr = task_priority;
1052 jQuery("#wpf-task-" + current_task + " .wpf_task_label .task_priority").removeClass().addClass("task_priority wpf_" + sel.value);
1053 jQuery('.wpf_loader_admin').hide();
1054 jQuery('#wpf-task-' + current_task).data('task_priority', sel.value);
1055 jQuery('#all_wpf_list .post_' + current_task + ' .wpf_chat_top .wpf_task_num_top span').removeAttr('class').addClass(custom_class);
1056 jQuery('#wpf_task_details .wpf_task_num_top span').removeAttr('class').addClass(custom_class);
1057 jQuery('#all_wpf_list li.post_' + current_task).removeClass('low').removeClass('high').removeClass('critical').removeClass('medium').addClass(task_info['task_priority']).addClass('active').addClass('wpf_list');
1058 }
1059 });
1060 }
1061
1062 function update_notify_user(user_id) {
1063 var task_info = [];
1064 var task_notify_users = [];
1065 jQuery.each(
1066 jQuery('#wpf_attributes_content input[name="author_list_task"]:checked'), function () {
1067 task_notify_users.push(jQuery(this).val());
1068 });
1069 task_notify_users = task_notify_users.join(",");
1070 task_info['task_id'] = current_task;
1071 task_info['task_notify_users'] = task_notify_users;
1072 var task_info_obj = jQuery.extend({}, task_info);
1073
1074 jQuery.ajax({
1075 method: "POST",
1076 url: "<?php echo admin_url('admin-ajax.php'); ?>",
1077 data: {
1078 action: "wpfb_set_task_notify_users",
1079 wpf_nonce: wpf_nonce,
1080 task_info: task_info_obj
1081 },
1082 beforeSend: function () {
1083 jQuery('.wpf_loader_admin').show();
1084 },
1085 success: function (data) {
1086 jQuery('.wpf_loader_admin').hide();
1087 jQuery('#wpf-task-' + current_task).data('task_notify_users', task_notify_users);
1088 }
1089 });
1090 }
1091
1092 var tss;
1093 var prr;
1094 //get chat based on WPF post select
1095 function get_wpf_chat(obj, tg, author) {
1096 jQuery("#wpf_edit_title").show();
1097 jQuery("#wpf_task_tabs_container").show();
1098 jQuery("#wpf_edit_title_box").hide();
1099 jQuery("#wpf_title_val").val();
1100 var post_id = jQuery(obj).data("postid");
1101 var view_id = jQuery(obj).data("disp-id");
1102
1103 if ( tg === undefined ) {
1104 tg = false;
1105 }
1106 jQuery("ul#all_wpf_list li.wpf_list").removeClass('active');
1107 jQuery(obj).parent().addClass('active');
1108
1109 var post_author_id = jQuery(obj).data('uid');
1110 var task_is_internal = jQuery('#wpf-task-'+post_id).hasClass('wpfb-internal');
1111 var post_task_type = jQuery(obj).data('task_type');
1112 var post_task_status = jQuery(obj).data('wpf_task_status');
1113 var post_task_no = jQuery(obj).data("task_no");
1114 var task_status = jQuery(obj).data("task_status");
1115 var task_page_url = jQuery(obj).data("task_page_url");
1116 var wpf_task_screenshot = jQuery(obj).data("wpf_task_screenshot");
1117 var task_page_title = jQuery(obj).data("task_page_title");
1118 var task_config_author_name = jQuery(obj).data("task_config_author_name");
1119 var task_author_name = jQuery(obj).data("task_author_name");
1120 let sticker_permission = new_global_sticker_permission;
1121 let title_permission = new_global_task_id_permission;
1122 var task_config_author_res = jQuery(obj).data("task_config_author_res");
1123 var task_config_author_browser = jQuery(obj).data("task_config_author_browser");
1124 var task_config_author_browserversion = jQuery(obj).data("task_config_author_browserversion");
1125 var task_notify_users = jQuery(obj).data("task_notify_users");
1126 var task_priority = jQuery(obj).data("task_priority");
1127 var click = 'yes';
1128 var additional_info_html = '<p><span class="wpf_task_ad_info_title">' + wpf_resolution + '</span> ' +''+ task_config_author_res + '</p><p><span class="wpf_task_ad_info_title">' + wpf_browser + '</span> ' + task_config_author_browser + ' ' + task_config_author_browserversion + '</p><p><span class="wpf_task_ad_info_title">' + wpf_user_name + '</span> ' + task_author_name + '</p><p><span class="wpf_task_ad_info_title">' + wpf_task_id + '</span> ' + post_id + '</p>';
1129 jQuery.ajax({
1130 method: "POST",
1131 url: ajaxurl,
1132 data: {
1133 action: "list_wpf_comment_func",
1134 wpf_nonce: wpf_nonce,
1135 post_id: post_id,
1136 post_author_id: post_author_id,
1137 click: click
1138 },
1139 beforeSend: function () {
1140 jQuery('.wpf_loader_admin').show();
1141 },
1142 success: function (data) {
1143 onload_wpfb_tasks = JSON.parse(data);
1144 if ( onload_wpfb_tasks != null && onload_wpfb_tasks != "null" ) {
1145 current_task = post_id;
1146 wpf_tag_autocomplete(document.getElementById("wpf_tags"), wpf_all_tags);
1147 jQuery('.wpf_loader_admin').hide();
1148 jQuery("#wpf_not_found").remove();
1149 jQuery("#get_masg_loader").hide();
1150 let display_span = '';
1151 let custom_class = '';
1152 if ( sticker_permission == 'yes' ) {
1153 display_span = '<span class="' + task_priority + '_custom"></span> ';
1154 custom_class = task_status + '_custom';
1155 }
1156 let task_count = '';
1157 if ( title_permission == 'yes' ) {
1158 task_count = view_id;
1159 } else {
1160 task_count = '<i class="gg-check"></i>';
1161 }
1162 let task_label = '';
1163 if ( task_status == 'complete' ) {
1164 task_label = task_count;
1165 } else {
1166 task_label = view_id;
1167 }
1168 if ( author ) {
1169 task_config_author_name_parts = task_config_author_name.split(' ');
1170 task_config_author_name_parts[1] = author;
1171 task_config_author_name = task_config_author_name_parts.join(' ');
1172 }
1173
1174 jQuery("div#wpf_task_details .wpf_task_num_top").html(display_span + task_label);
1175 jQuery('#wpf_task_details .wpf_task_num_top').removeClass('complete');
1176 jQuery('#wpf_task_details .wpf_task_num_top').removeAttr('class').addClass('wpf_task_num_top ' + task_status + ' ' + custom_class);
1177 jQuery("div#wpf_task_details .wpf_task_title_top").html(task_page_title);
1178 jQuery("div#wpf_task_details .wpf_task_details_top").html(task_config_author_name);
1179 jQuery("div#wpf_attributes_content #additional_information").html(additional_info_html);
1180 if ( current_user_id == post_author_id || wpf_user_type == 'advisor' ) {
1181 jQuery('#wpf_delete_task_container').html('<a href="javascript:void(0)" class="wpf_task_delete_btn"><i class="gg-trash"></i> ' + wpf_delete_ticket + '</a><p class="wpf_hide" id="wpf_task_delete">' + wpf_delete_conform_text2 + ' <a href="javascript:void(0);" class="wpf_task_delete" data-taskid=' + post_id + ' data-elemid=' + post_task_no + '>' + wpf_yes + '</a></p>');
1182 } else {
1183 jQuery('#wpf_delete_task_container').html('');
1184 }
1185 tss = task_status;
1186 prr = task_priority;
1187 jQuery("#task_task_status_attr").val(task_status);
1188 jQuery("#task_task_priority_attr").val(task_priority);
1189
1190 var wpf_page_url = task_page_url;
1191 if ( wpf_page_url && post_task_status == 'wpf_admin' ) {
1192 var wpf_page_url_with_and = wpf_page_url.split('&')[1];
1193 var wpf_page_url_question = wpf_page_url.split('?')[1];
1194 if ( wpf_page_url_with_and ) {
1195 var saperater = '&';
1196 }
1197 if ( wpf_page_url_question ) {
1198 var saperater = '&';
1199 } else {
1200 var saperater = '?';
1201 }
1202 } else {
1203 var saperater = '?';
1204 }
1205 if ( wpf_task_screenshot == '' ) {
1206 wpf_open_tab('wpf_message_content');
1207 }
1208 if ( post_task_type == 'general' ) {
1209 jQuery("#wpfb_attr_task_page_link").attr("href", task_page_url + saperater + "wpf_general_taskid=" + post_id);
1210 } else if ( post_task_type == 'email' ) {
1211 jQuery("#wpfb_attr_task_page_link").attr("href", task_page_url + saperater + "wpf_general_taskid=" + post_id);
1212 } else if ( post_task_type == 'graphics' ) {
1213 wpf_open_tab('wpf_message_content');
1214 jQuery("#wpfb_attr_task_page_link").attr("href", task_page_url + "&wpf_taskid=" + post_task_no);
1215 } else {
1216 jQuery("#wpfb_attr_task_page_link").attr("href", task_page_url + saperater + "wpf_taskid=" + post_task_no);
1217 }
1218 if ( typeof task_notify_users == 'string' ) {
1219 var task_notify_users_arr = task_notify_users.split(',');
1220 } else {
1221 var task_notify_users_arr = [task_notify_users.toString()];
1222 }
1223 jQuery('#wpf_attributes_content input[name="author_list_task"]').each(function () {
1224 jQuery(this).prop('checked', false);
1225 });
1226 jQuery('#wpf_attributes_content input[name="author_list_task"]').each(function () {
1227 if ( jQuery.inArray(this.value, task_notify_users_arr) != '-1' ) {
1228 jQuery(this).prop('checked', true);
1229 }
1230 });
1231
1232 chat_form = get_wpf_message_form(post_id, post_author_id,task_is_internal);
1233 jQuery('#wpf_message_form').html(chat_form);
1234
1235 if ( onload_wpfb_tasks.data == 0 ) {
1236 chat_form = get_wpf_message_form(post_id, post_author_id,task_is_internal);
1237 jQuery('#wpf_message_form').html(chat_form);
1238 } else {
1239 var chat_form = get_wpf_message_form(post_id, post_author_id,task_is_internal);
1240 jQuery('#wpf_message_form').html(chat_form);
1241 // do not convert link to URl where AWS links are present
1242 if ( onload_wpfb_tasks.data.search(/s3.us-east-2.amazonaws.com/) < 0 ) {
1243 onload_wpfb_tasks.data = onload_wpfb_tasks.data;
1244 }
1245 jQuery('ul#wpf_message_list').html(onload_wpfb_tasks.data);
1246 jQuery('#wpf_task_screenshot').attr('src', wpf_task_screenshot);
1247 jQuery('#wpf_task_screenshot_link').attr('href', wpf_task_screenshot);
1248 jQuery('#all_tag_list').html(onload_wpfb_tasks.wpf_tags);
1249 }
1250 jQuery('#wpf_message_content').animate({scrollTop: jQuery('#wpf_message_content').prop("scrollHeight")}, 2000);
1251
1252 // add rich text editor for Task center by Pratap
1253 jQuery(document).find('.wpf-tc-editor, .wpf-editor').each(function() {
1254 if ( ! jQuery_WPF(this).hasClass('activee') ) {
1255 var $this = jQuery_WPF(this);
1256 jQuery_WPF(this).addClass('activee');
1257 var quill = new Quill(this, {
1258 modules: {
1259 toolbar: [
1260 ['bold', 'italic', 'underline', 'strike'],
1261 [{ list: 'ordered' }, { list: 'bullet' }],
1262 ['link', 'code-block'],
1263 ]
1264 },
1265 placeholder: 'Leave a comment...',
1266 theme: 'bubble' // Specify theme in configuration
1267 });
1268 quill.on('text-change', function(delta, oldDelta, source) {
1269 var isempty = isQuillEmpty( quill );
1270 if ( !isempty ) {
1271 $this.parent().find('textarea').val(quill.root.innerHTML);
1272 } else {
1273 $this.parent().find('textarea').val('');
1274 }
1275 });
1276 }
1277 });
1278 }
1279 }
1280 });
1281 }
1282
1283 jQuery(document).ready(function ($) {
1284 var wpfeedback_page = getParameterByName('page');
1285 if ( wpfeedback_page == "wpfeedback_page_tasks" ) {
1286 jQuery("button.wpf_tab_item.wpf_tasks").trigger('click');
1287 }
1288 if ( wpfeedback_page == "wpfeedback_page_settings" ) {
1289 jQuery("button.wpf_tab_item.wpf_settings").trigger('click');
1290 }
1291 if ( wpfeedback_page == "wpfeedback_page_integrate" ) {
1292 jQuery("button.wpf_tab_item.wpf_addons").trigger('click');
1293 }
1294 if ( wpfeedback_page == "wpfeedback_page_support" ) {
1295 jQuery("button.wpf_tab_item.wpf_support").trigger('click');
1296 }
1297 if ( wpfeedback_page == "wpfeedback_page_permissions" ) {
1298 jQuery("button.wpf_tab_item.wpf_misc").trigger('click');
1299 }
1300 if ( wpfeedback_page == "wpfeedback_page_graphics" ) {
1301 jQuery("button.wpf_tab_item.wpf_graphics").trigger('click');
1302 }
1303 });
1304 </script>
1305 <?php
1306 }
1307 }
1308 }
1309
1310 /*
1311 * This function is used to initial the Atarim and all related variables on the frontend.
1312 *
1313 * @input NULL
1314 * @return NULL
1315 */
1316 function show_wpf_comment_button() {
1317 global $wpdb, $wp_query, $post;
1318 $wpf_current_page_url = "";
1319 $disable_for_admin = 0;
1320 $currnet_user_information = wpf_get_current_user_information();
1321 $current_role = $currnet_user_information['role'];
1322 $current_user_name = $currnet_user_information['display_name'];
1323 $current_user_id = $currnet_user_information['user_id'];
1324 $wpf_website_builder = get_site_data_by_key( 'wpf_website_developer' );
1325 if ( $current_user_name == 'Guest' ) {
1326 $wpf_website_client = get_site_data_by_key( 'wpf_website_client' );
1327 $wpf_current_role = 'guest';
1328 if ( $wpf_website_client ) {
1329 $wpf_website_client_info = get_userdata( $wpf_website_client );
1330 if ( $wpf_website_client_info ) {
1331 if ( $wpf_website_client_info->display_name == '' ) {
1332 $current_user_name = $wpf_website_client_info->user_nicename;
1333 } else {
1334 $current_user_name = $wpf_website_client_info->display_name;
1335 }
1336 }
1337 }
1338 } else {
1339 $wpf_current_role = wpf_user_type();
1340 }
1341
1342 $current_user_name = addslashes( $current_user_name );
1343 $selected_roles = get_site_data_by_key( 'wpf_selcted_role' );
1344 $selected_roles = explode( ',', $selected_roles );
1345 if ( $wpf_current_role == 'advisor' ) {
1346 $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_webmaster' );
1347 $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_webmaster' );
1348 $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_webmaster' );
1349 $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_webmaster' );
1350 $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_webmaster' );
1351 $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_webmaster' );
1352 $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_webmaster' );
1353 $wpf_tab_permission_display_stickers = ( get_site_data_by_key( 'wpf_tab_permission_display_stickers_webmaster' ) != 'no' ) ? 'yes' : 'no';
1354 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no' ) ? 'yes' : 'no';
1355 $wpf_tab_permission_keyboard_shortcut = ( get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_webmaster' ) != 'no' ) ? 'yes' : 'no';
1356 } else if ( $wpf_current_role == 'king' ) {
1357 $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_client' );
1358 $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_client' );
1359 $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_client' );
1360 $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_client' );
1361 $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_client' );
1362 $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_client' );
1363 $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_client' );
1364 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_client' );
1365 $wpf_tab_permission_keyboard_shortcut = get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_client' );
1366 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no' ) ? 'yes' : 'no';
1367 } else if ( $wpf_current_role == 'council' ) {
1368 $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_others' );
1369 $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_others' );
1370 $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_others' );
1371 $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_others' );
1372 $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_others' );
1373 $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_others' );
1374 $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_others' );
1375 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_others' );
1376 $wpf_tab_permission_keyboard_shortcut = get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_others' );
1377 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no' ) ? 'yes' : 'no';
1378 } else {
1379 $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_guest' );
1380 $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_guest' );
1381 $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_guest' );
1382 $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_guest' );
1383 $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_guest' );
1384 $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_guest' );
1385 $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_guest' );
1386 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_guest' );
1387 $wpf_tab_permission_keyboard_shortcut = get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_guest' );
1388 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no' ) ? 'yes' : 'no';
1389 }
1390
1391 $wpf_disable_for_admin = get_site_data_by_key( 'wpf_disable_for_admin' );
1392 if ( $wpf_disable_for_admin == 'yes' && $current_role == 'administrator' ) {
1393 $disable_for_admin = 1;
1394 } else {
1395 $disable_for_admin = 0;
1396 }
1397
1398 $current_page_id = '';
1399 if ( is_admin() ) {
1400 $current_page_id = get_the_ID();
1401 }
1402 if ( $current_page_id == '' ) {
1403 if ( isset( $wp_query->post->ID ) ) {
1404 $current_page_id = $wp_query->post->ID;
1405 }
1406 }
1407
1408 $current_page_title = addslashes( get_the_title( $current_page_id ) );
1409 $page_type = "default";
1410
1411 if ( class_exists( 'WooCommerce' ) ) {
1412 if ( is_category() ) {
1413 $page_type = "archive";
1414 $category = get_queried_object();
1415 $current_page_id = $category->term_id;
1416 $current_page_url = get_category_link( $current_page_id );
1417 $current_page_title = addslashes( get_cat_name( $current_page_id ) );
1418 } else if ( is_archive() && ( ! is_shop() ) && ( ! is_category() ) ) {
1419 if ( ! is_wp_error( get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) ) ) {
1420 $current_page_url = get_term_link( get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1421 } else {
1422 $current_page_url = "";
1423 }
1424 } else if ( is_shop() ) {
1425 $current_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
1426 } else if ( is_home() ) {
1427 $current_page_url = get_permalink( get_option( 'page_for_posts' ) );
1428 } else {
1429 $current_page_url = get_permalink( $current_page_id );
1430 }
1431 } else {
1432 if ( is_category() ) {
1433 $page_type = "archive";
1434 $category = get_queried_object();
1435 $current_page_id = $category->term_id;
1436 $current_page_url = get_category_link( $current_page_id );
1437 $current_page_title = addslashes( get_cat_name( $current_page_id ) );
1438 } else if ( is_tag() ) { // tag archieve page
1439 $category = get_queried_object();
1440 $current_page_id = $category->term_id;
1441 $current_page_url = get_category_link( $current_page_id );
1442 $current_page_title = $category->name;
1443 } else if ( is_tax() ) { // taxonomy archieve page
1444 $category = get_queried_object();
1445 $current_page_id = $category->term_id;
1446 $current_page_url = get_category_link( $current_page_id );
1447 $current_page_title = $category->name;
1448 } else if ( is_home() ) {
1449 if ( get_query_var( 'is_graphic_page' ) ) { // for graphic page
1450 $current_page_id = '';
1451 $current_page_title = '';
1452 $current_page_url = '';
1453 } else {
1454 $current_page_url = get_permalink( get_option( 'page_for_posts' ) );
1455 }
1456 } else if ( is_archive() && ( ! is_category() ) ) {
1457 $current_page_url = "";
1458 } else {
1459 $current_page_url = get_permalink( $current_page_id );
1460 }
1461 }
1462 //fallback if URL is not in the database
1463 $fallback_link = 0;
1464 if ( $current_page_id == '' || $current_page_id == 0 || $current_page_url == "" ) {
1465 $fallback_link = 1;
1466 $current_page_id = 0;
1467 $current_page_url = "";
1468 }
1469 $wpf_show_front_stikers = get_site_data_by_key( 'wpf_show_front_stikers' );
1470 $unix_time_now = time();
1471 $wpf_check_atarim_server = get_option( 'atarim_server_down_check' );
1472 if ( $unix_time_now > $wpf_check_atarim_server ) {
1473 update_option( 'atarim_server_down', 'false', 'no' );
1474 }
1475 $atarim_server_down = get_option( 'atarim_server_down' );
1476 $wpfb_users = do_shortcode( '[wpf_user_list_front]' );
1477 $ajax_url = admin_url( 'admin-ajax.php' );
1478 $plugin_url = WPF_PLUGIN_URL;
1479 $sound_file = esc_url( plugins_url( 'images/wpf-screenshot-sound.mp3', __FILE__ ) );
1480 $wpf_tag_enter_img = esc_url( plugins_url( 'images/enter.png', __FILE__ ) );
1481 $bubble_and_db_id = get_last_task_id( true );
1482 $comment_count = $bubble_and_db_id['Dbid'];
1483 $bubble_comment_count = $bubble_and_db_id['Bubbleid'];
1484 $wpf_check_page_builder_active = wpf_check_page_builder_active();
1485
1486 /* =====Start Check customize.php==== */
1487 if ( $wpf_check_page_builder_active == 0 ) {
1488 if ( is_customize_preview() ) {
1489 $wpf_check_page_builder_active = 1;
1490 } else {
1491 $wpf_check_page_builder_active = 0;
1492 }
1493 }
1494 /* =====END check customize.php==== */
1495
1496 /* =====Start filter sidebar HTML Structure==== */
1497 if ( get_query_var( 'is_graphic_page' ) && $wpf_show_front_stikers == 'yes' ) {
1498 $checkbox_checked = "checked";
1499 } else {
1500 $checkbox_checked = "";
1501 }
1502 $wpf_active = wpf_check_if_enable();
1503 $is_site_archived = get_site_data_by_key( 'wpf_site_archived' );
1504 $backend_btn = '';
1505 $wpf_go_to_cloud_dashboard_btn_tab = '';
1506 if ( $current_user_id > 0 ) {
1507 if ( $wpf_current_role == 'advisor' ) {
1508 $wpf_go_to_cloud_dashboard_btn_tab = '<a href="' . WPF_APP_SITE_URL . '/login" target="_blank" class="wpf_filter_tab_btn cloud_dashboard_btn" title="' . __("Atarim Dashboard", "wpfeedback") . '">'.get_wpf_icon().'</a>';
1509 }
1510 $sidebar_col = "wpf_col3";
1511 $backend_btn = ' <button class="wpf_tab_sidebar wpf_backend" onclick="openWPFTab(\'wpf_backend\')" >' . __('Backend', 'wpfeedback') . '</button>';
1512 if ( get_query_var( 'is_graphic_page' ) ) {
1513 $wpf_current_page_url = site_url() . '/graphic?id=' . sanitize_text_field( $_GET['id'] ) . '?wpf_login=1';
1514 } else {
1515 $wpf_current_page_url = get_permalink() . '?wpf_login=1';
1516 }
1517 } else {
1518 $sidebar_col = "wpf_col2";
1519 }
1520
1521 $wpf_nonce = wpf_wp_create_nonce();
1522 $wpf_admin_bar = 0;
1523 if ( is_admin_bar_showing() ) {
1524 $wpf_admin_bar = 1;
1525 }
1526
1527 $restrict_plugin = get_option( 'restrict_plugin' );
1528 if ( $wpf_active == 1 && $wpf_check_page_builder_active == 0 && ( ! $is_site_archived ) ) {
1529 require_once( WPF_PLUGIN_DIR . 'inc/wpf_popup_string.php' );
1530 echo "<style>li#wp-admin-bar-wpfeedback_admin_bar {display: none !important;}</style>";
1531 if ( $current_page_id == 0 ) {
1532 echo "<script>var fallback_link_check = '$fallback_link', page_type = '$page_type', wpf_tag_enter_img = '$wpf_tag_enter_img', disable_for_admin = '$disable_for_admin', wpf_nonce = '$wpf_nonce', current_role = '$current_role', wpf_current_role = '$wpf_current_role', current_user_name = '$current_user_name', current_user_id = '$current_user_id', wpf_website_builder = '$wpf_website_builder', wpfb_users = '$wpfb_users', ajaxurl = '$ajax_url', current_page_url = window.location.href.split('?')[0], current_page_title = '$current_page_title', current_page_id = '$current_page_id', wpf_screenshot_sound = '$sound_file', plugin_url = '$plugin_url', comment_count = '$comment_count', bubble_comment_count = '$bubble_comment_count', wpf_show_front_stikers = '$wpf_show_front_stikers', wpf_tab_permission_user = '$wpf_tab_permission_user', wpf_tab_permission_priority = '$wpf_tab_permission_priority', wpf_tab_permission_status = '$wpf_tab_permission_status', wpf_tab_permission_screenshot = '$wpf_tab_permission_screenshot', wpf_tab_permission_information = '$wpf_tab_permission_information', wpf_tab_permission_delete_task = '$wpf_tab_permission_delete_task', wpf_tab_permission_auto_screenshot = '$wpf_tab_permission_auto_screenshot', wpf_admin_bar = '$wpf_admin_bar', wpf_tab_permission_display_stickers = '$wpf_tab_permission_display_stickers', wpf_tab_permission_display_task_id = '$wpf_tab_permission_display_task_id', wpf_tab_permission_keyboard_shortcut = '$wpf_tab_permission_keyboard_shortcut', restrict_plugin = '$restrict_plugin', atarim_server_down = '$atarim_server_down';</script>";
1533 } else {
1534 echo "<script>var fallback_link_check = '$fallback_link', page_type = '$page_type', wpf_tag_enter_img = '$wpf_tag_enter_img', disable_for_admin = '$disable_for_admin', wpf_nonce = '$wpf_nonce', current_role = '$current_role', wpf_current_role = '$wpf_current_role', current_user_name = '$current_user_name', current_user_id = '$current_user_id', wpf_website_builder = '$wpf_website_builder', wpfb_users = '$wpfb_users', ajaxurl = '$ajax_url', current_page_url = '$current_page_url', current_page_title = '$current_page_title', current_page_id = '$current_page_id', wpf_screenshot_sound = '$sound_file', plugin_url = '$plugin_url', comment_count = '$comment_count', bubble_comment_count = '$bubble_comment_count', wpf_show_front_stikers = '$wpf_show_front_stikers', wpf_tab_permission_user = '$wpf_tab_permission_user', wpf_tab_permission_priority = '$wpf_tab_permission_priority', wpf_tab_permission_status = '$wpf_tab_permission_status', wpf_tab_permission_screenshot = '$wpf_tab_permission_screenshot', wpf_tab_permission_information = '$wpf_tab_permission_information', wpf_tab_permission_delete_task = '$wpf_tab_permission_delete_task', wpf_tab_permission_auto_screenshot = '$wpf_tab_permission_auto_screenshot', wpf_admin_bar = $wpf_admin_bar, wpf_tab_permission_display_stickers = '$wpf_tab_permission_display_stickers', wpf_tab_permission_display_task_id = '$wpf_tab_permission_display_task_id', wpf_tab_permission_keyboard_shortcut = '$wpf_tab_permission_keyboard_shortcut', restrict_plugin = '$restrict_plugin', atarim_server_down = '$atarim_server_down';</script>";
1535 }
1536 $wpf_sidebar_closeicon = '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 357 357" enable-background="new 0 0 357 357" xml:space="preserve"><g><g id="close"><polygon fill="#F5325C" points="357,35.7 321.3,0 178.5,142.8 35.7,0 0,35.7 142.8,178.5 0,321.3 35.7,357 178.5,214.2 321.3,357 357,321.3 214.2,178.5 "/></g></g></svg>';
1537 if ( $disable_for_admin == 0 ) {
1538 if ( get_query_var( 'is_graphic_page' ) ) {
1539 $wpf_sidebar_style = "";
1540 $wpf_sidebar_active = "wpf_graphics active";
1541 } else {
1542 $wpf_sidebar_active = "";
1543 $wpf_sidebar_style = "opacity: 0; margin-right: -380px";
1544 }
1545
1546 $wpf_site_id = get_option( 'wpf_site_id' );
1547 $bottom_panel_db = get_option( 'bottom_panel' );
1548 $bottom_style = "";
1549 $bottom_button_style = 'bottom: -67px;';
1550 if ( isset( $bottom_panel_db ) && $bottom_panel_db == '0' ) {
1551 $bottom_button_style = 'bottom: 3px;';
1552 }
1553
1554 /* ================filter Tabs Content HTML================ */
1555 $wpf_task_status_filter_btn = '<div id="wpf_filter_taskstatus" class=""><label class="wpf_filter_title">' . get_wpf_status_icon() . ' ' . __('Filter by Status:', 'wpfeedback') . '</label>' . wp_feedback_get_texonomy_filter("task_status") . '</div>';
1556 $wpf_task_priority_filter_btn = '<div id="wpf_filter_taskpriority" class=""><label class="wpf_filter_title">' . get_wpf_priority_icon() . ' ' . __("Filter by Priority:", "wpfeedback") . '</label>' . wp_feedback_get_texonomy_filter("task_priority") . '</div>';
1557
1558 /* If compact mode enabled, load it and don't load the bottom bar => v2.1.0 */
1559 $enable_compact_mode = get_site_data_by_key('wpf_enabled_compact_mode');
1560 if ( is_feature_enabled( 'bottom_bar_enabled' ) && $enable_compact_mode !== 'yes' ) {
1561 $wpf_sidebar_header = '';
1562 if ( get_query_var( 'is_graphic_page' ) ) {
1563 $wpf_sidebar_header = '<div class="wpf_sidebar_header ' . $sidebar_col . '">
1564 <!-- =================Top Tabs================-->
1565 <div class="top_tabs">
1566 <button class="wpf_tab_sidebar wpf_thispage wpf_active" onclick="openWPFTab(\'wpf_thispage\')" >' . __('This Page', 'wpfeedback') . '</button>
1567 </div>
1568 <div id="sidebar_filters">
1569 <ul class="icons-block">
1570 <li class="status">
1571 <a class="wpf_filter_tab_btn_bottom wpf_btm_withside" data-tag="wpf_task_status_filter_btn" href="javascript:void(0);" title="'.__("Filter By Status", "wpfeedback").'" id="wpf_filter_btn_bottom_status">'
1572 . get_wpf_status_icon().'
1573 </a>
1574 </li>
1575 <li class="priority"> <a id="wpf_filter_btn_bottom_priority" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_task_priority_filter_btn" title="'.__("Filter By Priority", "wpfeedback").'">'. get_wpf_priority_icon().'</a></li>
1576 <li class="search">
1577 <a id="wpf_filter_btn_bottom_search" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_search_filter_btn" title="'.__("Search by task title", "wpfeedback").'">
1578
1579 <svg class="svg-icon search-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16pt" height="16pt" viewBox="0 0 16 16" version="1.1">
1580 <g id="surface1">
1581 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(29.019608%,33.333333%,40.784314%);fill-opacity:1;" d="M 15.386719 13.554688 L 12.101562 10.269531 C 12.78125 9.246094 13.175781 8.023438 13.175781 6.707031 C 13.171875 3.132812 10.277344 0.238281 6.707031 0.234375 C 3.132812 0.238281 0.238281 3.132812 0.234375 6.707031 C 0.238281 10.277344 3.132812 13.171875 6.707031 13.175781 C 8.023438 13.175781 9.246094 12.78125 10.269531 12.101562 L 13.554688 15.386719 C 14.0625 15.890625 14.882812 15.890625 15.386719 15.386719 C 15.890625 14.882812 15.890625 14.0625 15.386719 13.558594 Z M 2.175781 6.707031 C 2.175781 4.207031 4.207031 2.175781 6.707031 2.175781 C 9.203125 2.175781 11.234375 4.207031 11.234375 6.707031 C 11.234375 9.203125 9.203125 11.234375 6.707031 11.234375 C 4.207031 11.234375 2.175781 9.203125 2.175781 6.707031 Z M 2.175781 6.707031 "/>
1582 </g>
1583 </svg>
1584 </a>
1585 </li>
1586 </ul>
1587 </div>
1588 </div>';
1589 } else {
1590 $wpf_sidebar_header = '<div class="wpf_sidebar_header ' . $sidebar_col . '">
1591 <!-- =================Top Tabs================-->
1592 <div class="top_tabs">
1593 <button class="wpf_tab_sidebar wpf_thispage wpf_active" onclick="openWPFTab(\'wpf_thispage\')" >' . __('This Page', 'wpfeedback') . '</button>
1594 <button class="wpf_tab_sidebar wpf_allpages" onclick="openWPFTab(\'wpf_allpages\')" >' . __('All Pages', 'wpfeedback') . '</button>' . $backend_btn . '<span id="close_sidebar" class="close_sidebar" onclick="expand_sidebar()">' . $wpf_sidebar_closeicon . '</span>' . '
1595 </div>
1596 <div id="sidebar_filters">
1597 <ul class="icons-block">
1598 <li class="status">
1599 <a class="wpf_filter_tab_btn_bottom wpf_btm_withside" data-tag="wpf_task_status_filter_btn" href="javascript:void(0);" title="'.__("Filter By Status", "wpfeedback").'" id="wpf_filter_btn_bottom_status">'
1600 . get_wpf_status_icon().'
1601 </a>
1602 </li>
1603 <li class="priority"> <a id="wpf_filter_btn_bottom_priority" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_task_priority_filter_btn" title="'.__("Filter By Priority", "wpfeedback").'">'. get_wpf_priority_icon().'</a></li>
1604 <li class="search">
1605 <a id="wpf_filter_btn_bottom_search" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_search_filter_btn" title="'.__("Search by task title", "wpfeedback").'">
1606
1607 <svg class="svg-icon search-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16pt" height="16pt" viewBox="0 0 16 16" version="1.1">
1608 <g id="surface1">
1609 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(29.019608%,33.333333%,40.784314%);fill-opacity:1;" d="M 15.386719 13.554688 L 12.101562 10.269531 C 12.78125 9.246094 13.175781 8.023438 13.175781 6.707031 C 13.171875 3.132812 10.277344 0.238281 6.707031 0.234375 C 3.132812 0.238281 0.238281 3.132812 0.234375 6.707031 C 0.238281 10.277344 3.132812 13.171875 6.707031 13.175781 C 8.023438 13.175781 9.246094 12.78125 10.269531 12.101562 L 13.554688 15.386719 C 14.0625 15.890625 14.882812 15.890625 15.386719 15.386719 C 15.890625 14.882812 15.890625 14.0625 15.386719 13.558594 Z M 2.175781 6.707031 C 2.175781 4.207031 4.207031 2.175781 6.707031 2.175781 C 9.203125 2.175781 11.234375 4.207031 11.234375 6.707031 C 11.234375 9.203125 9.203125 11.234375 6.707031 11.234375 C 4.207031 11.234375 2.175781 9.203125 2.175781 6.707031 Z M 2.175781 6.707031 "/>
1610 </g>
1611 </svg>
1612 </a>
1613 </li>
1614 </ul>
1615 </div>
1616 </div>';
1617 }
1618
1619 $bottom_bar_html = '<div id="wpf_already_comment" class="wpf_hide"><div class="wpf_notice_title">' . __("Task already exist for this element.", "wpfeedback") . '</div><div class="wpf_notice_text">' . __("Write your message in the existing thread. <br>Here, we opened it for you.", "wpfeedback") . '</div></div><div id="pushed_to_media" class="wpf_hide"><div class="wpf_notice_title">' . __("Pushed to Media Folder.", "wpfeedback") . '</div><div class="wpf_notice_text">' . __("The file was added to the website's media folder, you can now use it from the there.", "wpfeedback") . '</div></div><div id="wpf_reconnecting_task" class="wpf_hide" style="display: none;"><div class="wpf_notice_title">' . __("Remapping task....", "wpfeedback") . '</div><div class="wpf_notice_text">' . __("Give it a few seconds. <br>Then, refresh the page to see the task in the new position.", "wpfeedback") . '</div></div><div id="wpf_reconnecting_enabled" class="wpf_hide" style="display: none;"><div class="wpf_notice_title">' . __("Remap task", "wpfeedback") . '</div><div class="wpf_notice_text">' . __("Place the task anywhere on the page to pinpoint the location of the request.", "wpfeedback") . '</div></div><div id="wpf_launcher" data-html2canvas-ignore="true" ><div class="wpf_launch_buttons" style="'.$bottom_button_style.'"><div class="wpf_start_comment"><a href="javascript:enable_comment();" title="' . __('Click to give your feedback!', 'wpfeedback') . '" data-placement="left" class="comment_btn"><i class="gg-math-plus"></i></a></div>
1620 <div class="wpf_expand"><a href="javascript:expand_bottom_bar()" id="wpf_expand_btn" title="' . __("Panel", "wpfeedback") . '"><img title="Panel" src="'. get_wpf_favicon().'" style="width:65px" /></a></div></div>
1621 <div class="wpf_sidebar_container ' . $wpf_sidebar_active . '" style="' . $wpf_sidebar_style . '";>
1622 '. $wpf_sidebar_header .'
1623 <div class="filter_ui_content">
1624 <div id="wpf_side_filter">
1625 <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div>
1626 <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div>
1627 <div class="wpf_list wpf_hide" id="wpf_search_filter_btn"><div id="sidebar_search" class="wpf_search_box"><span class="wpf_search_box">
1628 <svg onclick="hide_search_from_sidebar()" class="svg-icon search-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16pt" height="16pt" viewBox="0 0 16 16" version="1.1">
1629 <g id="surface1">
1630 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(29.019608%,33.333333%,40.784314%);fill-opacity:1;" d="M 15.386719 13.554688 L 12.101562 10.269531 C 12.78125 9.246094 13.175781 8.023438 13.175781 6.707031 C 13.171875 3.132812 10.277344 0.238281 6.707031 0.234375 C 3.132812 0.238281 0.238281 3.132812 0.234375 6.707031 C 0.238281 10.277344 3.132812 13.171875 6.707031 13.175781 C 8.023438 13.175781 9.246094 12.78125 10.269531 12.101562 L 13.554688 15.386719 C 14.0625 15.890625 14.882812 15.890625 15.386719 15.386719 C 15.890625 14.882812 15.890625 14.0625 15.386719 13.558594 Z M 2.175781 6.707031 C 2.175781 4.207031 4.207031 2.175781 6.707031 2.175781 C 9.203125 2.175781 11.234375 4.207031 11.234375 6.707031 C 11.234375 9.203125 9.203125 11.234375 6.707031 11.234375 C 4.207031 11.234375 2.175781 9.203125 2.175781 6.707031 Z M 2.175781 6.707031 "/>
1631 </g>
1632 </svg>
1633 <input onkeyup="wp_feedback_cat_filter(event, this)" type="text" name="wpf_search_title" class="wpf_search_title" value="" id="wpf_search_title" placeholder="'.__("Search by task title", "wpfeedback").'"></span></div></div>
1634 </div>
1635 </div>
1636 <div class="wpf_sidebar_content">
1637 <div class="wpf_sidebar_loader wpf_hide"></div>
1638 <div id="wpf_thispage" class="wpf_thispage_tab wpf_container wpf_active_filter"><!--<div class="custom_today">today</div>--><ul id="wpf_thispage_container_today"></ul><!--<div class="custom_yesterday">yesterday</div> --> <ul id="wpf_thispage_container_yesterday"></ul><!-- <div class="custom_Weekly">Weekly</div> --> <ul id="wpf_thispage_container_this_week"></ul><!-- <div class="custom_this_month">This Month</div> --> <ul id="wpf_thispage_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_thispage_container_year"></ul> <!-- <div class="custom_other">Other</div> --> <ul id="wpf_thispage_container_other"></ul></div>
1639
1640 <div id="wpf_allpages" class="wpf_allpages_tab wpf_container" style="display:none";><!--<div class="custom_today">today</div>--><ul id="wpf_allpages_container_today"></ul><!--<div class="custom_yesterday">yesterday</div> --> <ul id="wpf_allpages_container_yesterday"></ul><!-- <div class="custom_Weekly">Weekly</div> --> <ul id="wpf_allpages_container_this_week"></ul><!-- <div class="custom_this_month">This Month</div> --> <ul id="wpf_allpages_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_allpages_container_year"></ul> <!-- <div class="custom_other">Other</div> --> <ul id="wpf_allpages_container_other"></ul></div>
1641
1642 <div id="wpf_backend" class="wpf_backend_tab wpf_container" style="display:none";><!--<div class="custom_today">today</div>--><ul id="wpf_backend_container_today"></ul><!--<div class="custom_yesterday">yesterday</div> --> <ul id="wpf_backend_container_yesterday"></ul><!-- <div class="custom_Weekly">Weekly</div> --> <ul id="wpf_backend_container_this_week"></ul><!-- <div class="custom_this_month">This Month</div> --> <ul id="wpf_backend_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_backend_container_year"></ul> <!-- <div class="custom_other">Other</div> --> <ul id="wpf_backend_container_other"></ul></div>
1643 </div>
1644 </div>'.generate_bottom_part_html().'
1645 </div>';
1646 } else {
1647 $wpf_graphics_page_class = '';
1648 $wpf_sidebar_header = '';
1649 if ( get_query_var( 'is_graphic_page' ) ) {
1650 $wpf_graphics_page_class = 'graphic_page_compact_buttons';
1651 $wpf_sidebar_header = '<div class="wpf_sidebar_header ' . $sidebar_col . '">
1652 <!-- =================Top Tabs================-->
1653 <div class="top_tabs">
1654 <button class="wpf_tab_sidebar wpf_thispage wpf_active" onclick="openWPFTab(\'wpf_thispage\')" >' . __('This Page', 'wpfeedback') . '</button>
1655 </div>
1656 <div id="sidebar_filters">
1657 <ul class="icons-block">
1658 <li class="status">
1659 <a class="wpf_filter_tab_btn_bottom wpf_btm_withside" data-tag="wpf_task_status_filter_btn" href="javascript:void(0);" title="'.__("Filter By Status", "wpfeedback").'" id="wpf_filter_btn_bottom_status">'
1660 . get_wpf_status_icon().'
1661 </a>
1662 </li>
1663 <li class="priority"> <a id="wpf_filter_btn_bottom_priority" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_task_priority_filter_btn" title="'.__("Filter By Priority", "wpfeedback").'">'. get_wpf_priority_icon().'</a></li>
1664 <li class="search">
1665 <a id="wpf_filter_btn_bottom_search" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_search_filter_btn" title="'.__("Search by task title", "wpfeedback").'">
1666 <svg class="svg-icon search-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16pt" height="16pt" viewBox="0 0 16 16" version="1.1">
1667 <g id="surface1">
1668 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(29.019608%,33.333333%,40.784314%);fill-opacity:1;" d="M 15.386719 13.554688 L 12.101562 10.269531 C 12.78125 9.246094 13.175781 8.023438 13.175781 6.707031 C 13.171875 3.132812 10.277344 0.238281 6.707031 0.234375 C 3.132812 0.238281 0.238281 3.132812 0.234375 6.707031 C 0.238281 10.277344 3.132812 13.171875 6.707031 13.175781 C 8.023438 13.175781 9.246094 12.78125 10.269531 12.101562 L 13.554688 15.386719 C 14.0625 15.890625 14.882812 15.890625 15.386719 15.386719 C 15.890625 14.882812 15.890625 14.0625 15.386719 13.558594 Z M 2.175781 6.707031 C 2.175781 4.207031 4.207031 2.175781 6.707031 2.175781 C 9.203125 2.175781 11.234375 4.207031 11.234375 6.707031 C 11.234375 9.203125 9.203125 11.234375 6.707031 11.234375 C 4.207031 11.234375 2.175781 9.203125 2.175781 6.707031 Z M 2.175781 6.707031 "/>
1669 </g>
1670 </svg>
1671 </a>
1672 </li>
1673 </ul>
1674 </div>
1675 </div>';
1676 } else {
1677 $wpf_sidebar_header = '<div class="wpf_sidebar_header ' . $sidebar_col . '">
1678 <!-- =================Top Tabs================-->
1679 <div class="top_tabs">
1680 <button class="wpf_tab_sidebar wpf_thispage wpf_active" onclick="openWPFTab(\'wpf_thispage\')" >' . __('This Page', 'wpfeedback') . '</button>
1681 <button class="wpf_tab_sidebar wpf_allpages" onclick="openWPFTab(\'wpf_allpages\')" >' . __('All Pages', 'wpfeedback') . '</button>' . $backend_btn . '<span id="close_sidebar" class="close_sidebar" onclick="expand_compact_sidebar()">' . $wpf_sidebar_closeicon . '</span>' . '
1682 </div>
1683 <div id="sidebar_filters">
1684 <ul class="icons-block">
1685 <li class="status">
1686 <a class="wpf_filter_tab_btn_bottom wpf_btm_withside" data-tag="wpf_task_status_filter_btn" href="javascript:void(0);" title="Filter By Status" id="wpf_filter_btn_bottom_status">'
1687 . get_wpf_status_icon().'
1688 </a>
1689 </li>
1690 <li class="priority"> <a id="wpf_filter_btn_bottom_priority" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_task_priority_filter_btn" title="Filter By Priority">'. get_wpf_priority_icon().'</a></li>
1691 <li class="search">
1692 <a id="wpf_filter_btn_bottom_search" class="wpf_filter_tab_btn_bottom wpf_btm_withside" href="javascript:void(0);" data-tag="wpf_search_filter_btn" title="'.__("Search by task title", "wpfeedback").'">
1693 <svg class="svg-icon search-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16pt" height="16pt" viewBox="0 0 16 16" version="1.1">
1694 <g id="surface1">
1695 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(29.019608%,33.333333%,40.784314%);fill-opacity:1;" d="M 15.386719 13.554688 L 12.101562 10.269531 C 12.78125 9.246094 13.175781 8.023438 13.175781 6.707031 C 13.171875 3.132812 10.277344 0.238281 6.707031 0.234375 C 3.132812 0.238281 0.238281 3.132812 0.234375 6.707031 C 0.238281 10.277344 3.132812 13.171875 6.707031 13.175781 C 8.023438 13.175781 9.246094 12.78125 10.269531 12.101562 L 13.554688 15.386719 C 14.0625 15.890625 14.882812 15.890625 15.386719 15.386719 C 15.890625 14.882812 15.890625 14.0625 15.386719 13.558594 Z M 2.175781 6.707031 C 2.175781 4.207031 4.207031 2.175781 6.707031 2.175781 C 9.203125 2.175781 11.234375 4.207031 11.234375 6.707031 C 11.234375 9.203125 9.203125 11.234375 6.707031 11.234375 C 4.207031 11.234375 2.175781 9.203125 2.175781 6.707031 Z M 2.175781 6.707031 "/>
1696 </g>
1697 </svg>
1698 </a>
1699 </li>
1700 </ul>
1701 </div>
1702 </div>';
1703 }
1704 $bottom_bar_html = '<div id="wpf_launcher" class="wpf-compact-launcher" data-html2canvas-ignore="true" style="user-select: auto;">
1705
1706 <div id="wpf_launch_buttons_wrapper">
1707 <div class="wpf_launch_buttons ' . $wpf_graphics_page_class . '" style="user-select: auto; left: -56px;">
1708 <div class="wpf_start_comment" style="user-select: auto;">
1709 <a href="javascript:enable_comment();" title="Click to leave a comment" data-placement="left" class="comment_btn" style="user-select: auto; cursor: pointer;">
1710 <i class="gg-math-plus" style="user-select: auto;"></i>
1711 </a>
1712 </div>
1713
1714 <div class="wpf_expand" style="user-select: auto;">
1715 <a href="javascript:expand_compact_sidebar()" id="wpf_expand_btn" title="Collaboration Sidebar" style="user-select: auto; cursor: pointer;" class="tasks-btn">
1716 <img src="' . get_wpf_favicon() . '" />
1717 </a>
1718 </div>
1719
1720 <div class="wpf_general_comment">
1721 <a class="wpf_green_btn wpf_general_btn wpf_comment_mode_general_task active_comment" id="wpf_comment_mode_general_task" href="javascript:void(0)" onclick="wpf_new_general_task(0)" title="Click to create a generic request" style="user-select: auto; cursor: crosshair;">
1722 '. get_wpf_exclamation_icon() .'
1723 <span style="user-select: auto;">'. __('General', 'wpfeedback') .'</span>
1724 </a>
1725 </div>
1726 </div>
1727 </div>
1728
1729 <div class="wpf_sidebar_container ' . $wpf_sidebar_active . '" style="' . $wpf_sidebar_style . '";>
1730 ' . $wpf_sidebar_header . '
1731 <div class="filter_ui_content">
1732 <div id="wpf_side_filter">
1733 <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div>
1734 <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div>
1735 <div class="wpf_list wpf_hide" id="wpf_search_filter_btn"><div id="sidebar_search" class="wpf_search_box"><span class="wpf_search_box">
1736 <svg onclick="hide_search_from_sidebar()" class="svg-icon search-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16pt" height="16pt" viewBox="0 0 16 16" version="1.1">
1737 <g id="surface1">
1738 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(29.019608%,33.333333%,40.784314%);fill-opacity:1;" d="M 15.386719 13.554688 L 12.101562 10.269531 C 12.78125 9.246094 13.175781 8.023438 13.175781 6.707031 C 13.171875 3.132812 10.277344 0.238281 6.707031 0.234375 C 3.132812 0.238281 0.238281 3.132812 0.234375 6.707031 C 0.238281 10.277344 3.132812 13.171875 6.707031 13.175781 C 8.023438 13.175781 9.246094 12.78125 10.269531 12.101562 L 13.554688 15.386719 C 14.0625 15.890625 14.882812 15.890625 15.386719 15.386719 C 15.890625 14.882812 15.890625 14.0625 15.386719 13.558594 Z M 2.175781 6.707031 C 2.175781 4.207031 4.207031 2.175781 6.707031 2.175781 C 9.203125 2.175781 11.234375 4.207031 11.234375 6.707031 C 11.234375 9.203125 9.203125 11.234375 6.707031 11.234375 C 4.207031 11.234375 2.175781 9.203125 2.175781 6.707031 Z M 2.175781 6.707031 "/>
1739 </g>
1740 </svg>
1741 <input onkeyup="wp_feedback_cat_filter(event, this)" type="text" name="wpf_search_title" class="wpf_search_title" value="" id="wpf_search_title" placeholder="'.__("Search by task title", "wpfeedback").'"></span></div></div>
1742 </div>
1743 </div>
1744 <div class="wpf_sidebar_content">
1745 <div class="wpf_sidebar_loader wpf_hide"></div>
1746 <div id="wpf_thispage" class="wpf_thispage_tab wpf_container wpf_active_filter"><!--<div class="custom_today">today</div>--><ul id="wpf_thispage_container_today"></ul><!--<div class="custom_yesterday">yesterday</div> --> <ul id="wpf_thispage_container_yesterday"></ul><!-- <div class="custom_Weekly">Weekly</div> --> <ul id="wpf_thispage_container_this_week"></ul><!-- <div class="custom_this_month">This Month</div> --> <ul id="wpf_thispage_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_thispage_container_year"></ul> <!-- <div class="custom_other">Other</div> --> <ul id="wpf_thispage_container_other"></ul></div>
1747
1748 <div id="wpf_allpages" class="wpf_allpages_tab wpf_container" style="display:none";><!--<div class="custom_today">today</div>--><ul id="wpf_allpages_container_today"></ul><!--<div class="custom_yesterday">yesterday</div> --> <ul id="wpf_allpages_container_yesterday"></ul><!-- <div class="custom_Weekly">Weekly</div> --> <ul id="wpf_allpages_container_this_week"></ul><!-- <div class="custom_this_month">This Month</div> --> <ul id="wpf_allpages_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_allpages_container_year"></ul> <!-- <div class="custom_other">Other</div> --> <ul id="wpf_allpages_container_other"></ul></div>
1749
1750 <div id="wpf_backend" class="wpf_backend_tab wpf_container" style="display:none";><!--<div class="custom_today">today</div>--><ul id="wpf_backend_container_today"></ul><!--<div class="custom_yesterday">yesterday</div> --> <ul id="wpf_backend_container_yesterday"></ul><!-- <div class="custom_Weekly">Weekly</div> --> <ul id="wpf_backend_container_this_week"></ul><!-- <div class="custom_this_month">This Month</div> --> <ul id="wpf_backend_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_backend_container_year"></ul> <!-- <div class="custom_other">Other</div> --> <ul id="wpf_backend_container_other"></ul></div>
1751 </div>
1752 </div>'.generate_side_part_html().'
1753 </div>';
1754 }
1755
1756 echo $bottom_bar_html;
1757 $wpf_get_user_type = get_user_meta( $current_user_id, 'wpf_user_initial_setup', true );
1758 if ( $wpf_get_user_type == '' && $current_user_id && in_array( $current_role, $selected_roles ) ) {
1759 $wpf_get_user_typpe = get_user_meta( $current_user_id, 'wpf_user_initial_setup', true );
1760 $wpf_get_user_type = esc_attr( wpf_user_type() );
1761 $wpf_user_flow = isset( $_GET['wpf-user-flow'] ) ? true : false;
1762 if ( ! $wpf_get_user_type ) {
1763 delete_option( 'wpf_app_user_flow' );
1764 }
1765 if ( isset( $_GET['wpf-user-flow'] ) && ! get_option( 'wpf_app_user_flow' ) ) {
1766 update_option( 'wpf_app_user_flow', true );
1767 $wpf_app_user_flow = true;
1768 $wpf_user_flow = true;
1769 } else if ( isset( $_GET['wpf-existing-user-flow'] ) ) {
1770 $wpf_app_user_flow = false;
1771 $wpf_user_flow = false;
1772 } else {
1773 $wpf_app_user_flow = true;
1774 $wpf_user_flow = true;
1775 }
1776 if ( $wpf_get_user_typpe == '' && $current_user_id && in_array( $current_role, $selected_roles ) && ( $wpf_app_user_flow && $wpf_user_flow ) ) {
1777 require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_frontend_initial_setup.php' );
1778 }
1779 }
1780 require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_general_task_modal.php' );
1781 require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_approve_page_modal.php' );
1782 require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_responsive_page_modal.php' );
1783 require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_restrictions_modal.php' );
1784 }
1785 }
1786 $wpf_enabled = get_site_data_by_key( 'enabled_wpfeedback' );
1787
1788 if ( ! is_user_logged_in() && ( $wpf_enabled == 'yes' && ( ! $is_site_archived ) ) ) {
1789 require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_login_modal.php' );
1790 }
1791 }
1792
1793 add_action( 'wp_footer', 'show_wpf_comment_button' );
1794 function wpf_check_permission() {
1795 $currnet_user_information = wpf_get_current_user_information();
1796 $current_role = $currnet_user_information['role'];
1797 $current_user_name = $currnet_user_information['display_name'];
1798 $current_user_id = $currnet_user_information['user_id'];
1799 $wpf_website_builder = get_site_data_by_key( 'wpf_website_developer' );
1800 if ( $current_user_name == 'Guest' ) {
1801 $wpf_website_client = get_site_data_by_key( 'wpf_website_client' );
1802 $wpf_current_role = 'guest';
1803 if ( $wpf_website_client ) {
1804 $wpf_website_client_info = get_userdata( $wpf_website_client );
1805 if ( $wpf_website_client_info ) {
1806 if ( $wpf_website_client_info->display_name == '' ) {
1807 $current_user_name = $wpf_website_client_info->user_nicename;
1808 } else {
1809 $current_user_name = $wpf_website_client_info->display_name;
1810 }
1811 }
1812 }
1813 } else {
1814 $wpf_current_role = wpf_user_type();
1815 }
1816
1817 $current_user_name = addslashes($current_user_name);
1818 if ( $wpf_current_role == 'advisor' ) {
1819 $wpf_tab_permission_display_stickers = ( get_site_data_by_key( 'wpf_tab_permission_display_stickers_webmaster' ) != 'no' ) ? 'yes' : 'no';
1820 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no' ) ? 'yes' : 'no';
1821 } else if ( $wpf_current_role == 'king' ) {
1822 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_client' );
1823 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_client' );
1824 } else if ( $wpf_current_role == 'council' ) {
1825 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_others' );
1826 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_others' );
1827 } else {
1828 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_guest' );
1829 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_guest' );
1830 }
1831 }
1832
1833 function add_sticker_permission_to_head() {
1834 $currnet_user_information = wpf_get_current_user_information();
1835 $current_role = $currnet_user_information['role'];
1836 $current_user_name = $currnet_user_information['display_name'];
1837 $current_user_id = $currnet_user_information['user_id'];
1838 $wpf_website_builder = get_site_data_by_key( 'wpf_website_developer' );
1839 if ( $current_user_name == 'Guest' ) {
1840 $wpf_website_client = get_site_data_by_key( 'wpf_website_client' );
1841 $wpf_current_role = 'guest';
1842 if ( $wpf_website_client ) {
1843 $wpf_website_client_info = get_userdata( $wpf_website_client );
1844 if ( $wpf_website_client_info ) {
1845 if ( $wpf_website_client_info->display_name == '' ) {
1846 $current_user_name = $wpf_website_client_info->user_nicename;
1847 } else {
1848 $current_user_name = $wpf_website_client_info->display_name;
1849 }
1850 }
1851 }
1852 } else {
1853 $wpf_current_role = wpf_user_type();
1854 }
1855 $current_user_name = addslashes( $current_user_name );
1856
1857 if ( $wpf_current_role == 'advisor' ) {
1858 $wpf_tab_permission_display_stickers = ( get_site_data_by_key( 'wpf_tab_permission_display_stickers_webmaster' ) != 'no' ) ? 'yes' : 'no';
1859 $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no' ) ? 'yes' : 'no';
1860 } elseif ( $wpf_current_role == 'king' ) {
1861 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_client' );
1862 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_client' );
1863 } elseif ( $wpf_current_role == 'council' ) {
1864 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_others' );
1865 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_others' );
1866 } else {
1867 $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_guest' );
1868 $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_guest' );
1869 }
1870
1871 echo '<script>var new_global_sticker_permission = "' . $wpf_tab_permission_display_stickers . '", new_global_task_id_permission = "' . $wpf_tab_permission_display_task_id . '"</script>';
1872 }
1873 add_filter( 'admin_head', 'add_sticker_permission_to_head' );
1874
1875
1876 /*
1877 * This function is used to remove the backend menu for the wpfeedback post type so they are not accessible by backend users.
1878 *
1879 * @input NULL
1880 * @return NULL
1881 */
1882 function wpf_disable_comments_admin_menu() {
1883 remove_menu_page( 'edit.php?post_type=wpfeedback' );
1884 }
1885 add_action( 'admin_menu', 'wpf_disable_comments_admin_menu' );
1886
1887
1888 /*
1889 * This function is used to disabled the Atarim features on Atarim pages.
1890 *
1891 * @input NULL
1892 * @return NULL
1893 */
1894 function wpf_exclude_comments( $query ) {
1895 if ( $query->query_vars['type'] !== 'wp_feedback' ) {
1896 $query->query_vars['type__not_in'] = array_merge( (array) $query->query_vars['type__not_in'], array('wp_feedback') );
1897 }
1898 }
1899 add_action( 'pre_get_comments', 'wpf_exclude_comments' );
1900
1901
1902 /*
1903 * This function is used to set the redirect of Upgrade menu item.
1904 *
1905 * @input NULL
1906 * @return NULL
1907 */
1908 function wpf_upgrade_menu_page_redirect() {
1909 $wpf_license = get_option( 'wpf_license' );
1910 $wpf_user_type = wpf_user_type();
1911 if ( $wpf_license != 'valid' ) {
1912 ?>
1913 <style type="text/css">
1914 div#wpf_tasks {
1915 position: relative;
1916 }
1917 </style>
1918 <?php
1919 }
1920 if ( $wpf_user_type == 'advisor' ) {
1921 ?>
1922 <script type="text/javascript">
1923 jQuery(document).ready(function ($) {
1924 jQuery('#toplevel_page_wp_feedback ul li').last().find('a').attr('target', '_blank');
1925 });
1926 </script>
1927 <?php
1928 }
1929 }
1930 add_action( 'admin_head', 'wpf_upgrade_menu_page_redirect' );
1931
1932 require_once( WPF_PLUGIN_DIR . 'inc/wpf_class.php' );
1933
1934 /*
1935 * This function is used to redirect the users to the settings page on the activation of the plugin.
1936 *
1937 * @input String
1938 * @return Redirect
1939 */
1940 function wpf_activation_redirect( $plugin ) {
1941 if ( $plugin == plugin_basename( __FILE__ ) ) {
1942 $url = admin_url( 'admin.php?page=wpfeedback_page_settings' );
1943 wp_redirect( $url );
1944 exit;
1945 }
1946 }
1947 add_action( 'activated_plugin', 'wpf_activation_redirect', 10, 1 );
1948
1949 /*
1950 * This function is used to detect if the page builder is active on the current running page.
1951 *
1952 * @input NULL
1953 * @return Boolean
1954 */
1955 function wpf_check_page_builder_active() {
1956 $page_builder = 0;
1957 /* ========Check Divi editor Active======== */
1958 if ( isset( $_GET['et_fb'] ) || ( is_admin() && function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used() ) ) {
1959 $page_builder = 1;
1960 } else if ( isset( $_GET['page'] ) ) {
1961 if ( $_GET['page'] == 'et_theme_builder' ) {
1962 $page_builder = 1;
1963 }
1964 } else if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() ) { /* ------Check wpbeaver editor Active------- */
1965 $page_builder = 1;
1966 } else if ( isset( $_GET['brizy-edit'] ) || isset( $_GET['brizy-edit-iframe'] ) || isset( $_GET['brizy_post'] ) ) { /* ========Check brizy editor Active======== */
1967 $page_builder = 1;
1968 } else if ( isset( $_GET['ct_builder'] ) || isset( $_GET['ct_template'] ) ) { /* =======Check oxygen editor Active======== */
1969 $page_builder = 1;
1970 } else if ( isset( $_POST['cs_preview_state'] ) ) { /* =======Check Cornerstone editor Active======== */
1971 $page_builder = 1;
1972 } else if ( isset( $_GET['vc_editable'] ) ) { /* ------Check Visual Composer Active======== */
1973 $page_builder = 1;
1974 } else if ( defined( 'ELEMENTOR_VERSION' ) ) { /* ------Check elementor editor Active======== */
1975 if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
1976 $page_builder = 1;
1977 } else {
1978 $page_builder = 0;
1979 }
1980 } else if ( is_customize_preview() ) {
1981 $page_builder = 1;
1982 } else {
1983 $page_builder = 0;
1984 }
1985 return $page_builder;
1986 }
1987
1988
1989 /**
1990 * Load the plugin text domain for translation.
1991 *
1992 */
1993 function wpf_load_plugin_textdomain() {
1994 $domain = 'wpfeedback';
1995 if ( is_user_logged_in() ) {
1996 $get_locale = get_user_locale( $user_id = 0 );
1997 } else {
1998 $get_locale = get_locale();
1999 }
2000 $locale = apply_filters( 'plugin_locale', $get_locale, $domain );
2001 load_textdomain( $domain, trailingslashit( WPF_PLUGIN_DIR . '/languages/' ) . $domain . '-' . $locale . '.mo' );
2002 load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
2003 }
2004 add_action( 'init', 'wpf_load_plugin_textdomain', 10 );
2005
2006
2007 /*
2008 * This function is used to identify if certain themes/plugins are so that jquery UI can be de registered.
2009 *
2010 * @input NULL
2011 * @return Boolean
2012 */
2013 function wpf_remove_ui_script() {
2014 $response = 1;
2015 if ( function_exists( 'get_field' ) ) {
2016 $response = 0;
2017 }
2018 if ( class_exists( 'PMXI_Plugin' ) ) {
2019 $response = 0;
2020 }
2021 if ( class_exists( 'Avada' ) ) {
2022 $response = 0;
2023 }
2024 if ( class_exists( 'WooCommerce' ) ) {
2025 $response = 0;
2026 }
2027 if ( class_exists( 'The7_Less_Functions' ) ) {
2028 $response = 0;
2029 }
2030 if ( class_exists( 'iHomefinderAutoloader' ) ) {
2031 $response = 0;
2032 }
2033 return $response;
2034 }
2035
2036
2037 /*
2038 * function is used to get last task no
2039 */
2040 function get_last_task_id( $returnBubbleId = false ) {
2041 $url = WPF_CRM_API . 'wp-api/site/taskCount';
2042 $sendarr = array();
2043 $sendarr["wpf_site_id"] = get_option( 'wpf_site_id' );
2044 $sendtocloud = json_encode( $sendarr );
2045 $response = wpf_send_remote_post( $url, $sendtocloud );
2046 $last_id = 1;
2047 $bubble_id = 1;
2048 if ( isset( $response['data'] ) ) {
2049 $last_id = $response['data'] + 1;
2050 $bubble_id = $response['sitetaskid'] + 1;
2051 }
2052 if ( $returnBubbleId == true ) {
2053 $res = array();
2054 $res['Dbid'] = $last_id;
2055 $res['Bubbleid'] = $bubble_id;
2056 return $res;
2057 }
2058 return $last_id;
2059 }
2060
2061
2062 /*
2063 * function is used to get site settings data
2064 * and stored in session
2065 */
2066 function get_site_data() {
2067 $ret = 0;
2068 if ( ! is_user_logged_in() ) {
2069 if ( ! get_option( 'enabled_wpfeedback' ) == 'yes' ) {
2070 $ret = 1;
2071 } else {
2072 if ( ! get_option( 'wpf_allow_guest' ) == 'yes' ) {
2073 $ret = 1;
2074 } else {
2075 $ret = 0;
2076 }
2077 }
2078 }
2079
2080 if ( $ret == 1 ) {
2081 return;
2082 }
2083
2084 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { /* it's an Ajax call */
2085 } else if( get_option( 'wpf_license' ) != 'valid' ) {
2086 } else {
2087 $wpf_site_id = get_option('wpf_site_id');
2088 $args = array(
2089 'wpf_site_id' => $wpf_site_id
2090 );
2091 $url = WPF_CRM_API . 'get-site-data';
2092 $sendtocloud = json_encode( $args );
2093 $res_data = wpf_send_remote_post( $url, $sendtocloud );
2094 if ( isset( $res_data['status'] ) && $res_data['status'] == '200' && isset( $res_data['data'] ) ) {
2095 $site_data = $res_data['data'];
2096 foreach ( $site_data as $key => $sdata ) {
2097 if ( ( $sdata == 0 || ! empty( $sdata ) ) && ( $key != 'wpf_license' ) ) {
2098 update_option( $key, $sdata, 'no' );
2099 }
2100 }
2101 } else {
2102 }
2103 }
2104 }
2105
2106
2107 /*
2108 * function is used to get site notify user
2109 * and stored in session
2110 */
2111 function get_notify_users() {
2112 $ret = 0;
2113 if ( ! is_user_logged_in() ) {
2114 if ( ! get_option( 'enabled_wpfeedback' ) == 'yes' ) {
2115 $ret = 1;
2116 } else {
2117 if ( ! get_option( 'wpf_allow_guest' ) == 'yes' ) {
2118 $ret = 1;
2119 } else {
2120 $ret = 0;
2121 }
2122 }
2123 }
2124
2125 if ( $ret == 1 ) {
2126 return;
2127 }
2128
2129 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { /* it's an Ajax call */
2130 } else if ( get_option( 'wpf_license' ) != 'valid' ) {
2131 } else {
2132 $wpf_site_id = get_option( 'wpf_site_id' );
2133 $args = array(
2134 'wpf_site_id' => $wpf_site_id
2135 );
2136
2137 $url = WPF_CRM_API . 'wp-api/wpfuser/getNotifiedUsers';
2138 $sendtocloud = json_encode( $args );
2139 $filterData = wpf_send_remote_post( $url, $sendtocloud );
2140
2141 if ( isset( $filterData['status'] ) && $filterData['status'] == '200' ) {
2142 $notify_users = $filterData['data'];
2143 if ( ! empty( $notify_users ) ) {
2144 update_option( 'notify_users', $notify_users, "no" );
2145 } else {
2146 update_option( 'notify_users', '', "no" );
2147 }
2148 }else{
2149 }
2150 }
2151 }
2152
2153 /**
2154 * function is used to get notify user, site data, filter data
2155 * combination of 3 CURL requests into one:-
2156 * get-wp-filter-data
2157 * get-site-data
2158 * wp-api/wpfuser/getNotifiedUsers
2159 */
2160 function get_notif_sitedata_filterdata() {
2161 $ret = 0;
2162 if ( ! is_user_logged_in() ) {
2163 if ( ! get_option( 'enabled_wpfeedback' ) == 'yes' ) {
2164 $ret = 1;
2165 } else {
2166 if ( ! get_option( 'wpf_allow_guest' ) == 'yes' ) {
2167 $ret = 1;
2168 } else {
2169 $ret = 0;
2170 }
2171 }
2172 }
2173
2174 if ( $ret == 1 ) {
2175 return;
2176 }
2177
2178 if ( get_option( 'wpf_license' ) != 'valid' ) {
2179 } else {
2180 $wpf_site_id = get_option( 'wpf_site_id' );
2181 $args = array(
2182 'wpf_site_id' => $wpf_site_id
2183 );
2184
2185 $url = WPF_CRM_API . 'wp-api/site/get-meta-data';
2186 $sendtocloud = json_encode( $args );
2187 $allData = wpf_send_remote_post( $url, $sendtocloud );
2188 if ( isset( $allData['status'] ) && $allData['status'] == '200' ) {
2189 $notify_users = $allData['data']['getNotifiedUsers']['data'];
2190 $res_data = $allData['data']['get-site-data'];
2191 $fil_data = $allData['data']['wp-filter-data'];
2192 $restrict_plugin = $allData['data']['limit'];
2193 $wpf_user_plan = $allData['data']['plan'];
2194
2195 if ( ! empty( $notify_users ) ) {
2196 update_option( 'notify_users', $notify_users, "no" );
2197 }
2198 if ( ! empty( $wpf_user_plan['upgrade_path'] ) ) {
2199 update_option( 'upgrade_url', $wpf_user_plan['upgrade_path'], "no" );
2200 }
2201 if ( !empty($fil_data['data']) ) {
2202 update_option( 'filter_data', $fil_data['data'], 'no' );
2203 }
2204 // update the limit
2205 update_option( 'restrict_plugin', $restrict_plugin, 'no' );
2206
2207 if ( isset( $res_data['status'] ) && $res_data['status'] == '200' && isset( $res_data['data'] ) ) {
2208 $site_data = $res_data['data'];
2209 /* ---- UPDATE BY SHAWN ON VERSION 2.0.9 ---- */
2210 foreach ( $site_data as $key => $sdata ) {
2211 if ( ( $sdata == 0 || ! empty( $sdata ) ) && ( $key != 'wpf_license' ) ) {
2212 update_option( $key, $sdata, 'no' );
2213 }
2214 }
2215
2216 // override old data by checking the old API URL => 2.1.1
2217 if ( ! empty( $site_data ) ) {
2218 $pattern = '/api.wpfeedback.co/';
2219
2220 // check for the logo
2221 if ( preg_match( $pattern, $site_data['wpfeedback_logo'] ) != false ) {
2222 update_option( 'wpfeedback_logo', 'https://api.atarim.io/Atarim.svg', 'no' );
2223 }
2224
2225 // check for the fav icon
2226 if ( preg_match( $pattern, $site_data['wpfeedback_favicon'] ) != false ) {
2227 update_option( 'wpfeedback_favicon', 'https://api.atarim.io/atarim_icon.svg', 'no' );
2228 }
2229 }
2230
2231 // add the site archive settings
2232 if ( ! empty( $allData['site_archived'] ) && $allData['site_archived'] !== 0 ) {
2233 update_option( 'wpf_site_archived', 0, 'no' );
2234 } else if ( ! empty( $allData['site_archived'] ) ) {
2235 update_option( 'wpf_site_archived', 0, 'no' );
2236 }
2237 }
2238 // update the plan data
2239 update_option( 'wpf_user_plan', serialize( $wpf_user_plan ), 'no' );
2240 }
2241 }
2242 }
2243
2244 /*
2245 * function is used to get site settings data
2246 * and stored in session
2247 */
2248 function get_user_data() {
2249 if ( ! session_id() ) {
2250 session_start();
2251 }
2252
2253 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { /* it's an Ajax call */
2254 } else if ( get_option( 'wpf_license' ) != 'valid' ) {
2255 } else {
2256 $wpf_site_id = get_option( 'wpf_site_id' );
2257 if ( is_user_logged_in() ) {
2258 $userid = get_current_user_id();
2259 $args = array(
2260 'wpf_site_id' => $wpf_site_id,
2261 'wpf_user_id' => $userid
2262 );
2263 $url = WPF_CRM_API . 'wp-api/wpfuser/getWpfUser';
2264 $sendtocloud = json_encode( $args );
2265 $res_data = wpf_send_remote_post( $url, $sendtocloud );
2266 if ( isset( $res_data['status'] ) && $res_data['status'] == '200' && isset( $res_data['data'] ) ) {
2267 $user_data = $res_data['data'];
2268 if ( isset( $_SESSION['site_' . $wpf_site_id]["user_data"] ) ) {
2269 unset( $_SESSION['site_'.$wpf_site_id]["user_data"] );
2270 }
2271 $_SESSION['site_'.$wpf_site_id]['user_data'] = $user_data;
2272 } else {
2273 if ( isset( $_SESSION['site_'.$wpf_site_id]["user_data"] ) ) {
2274 unset( $_SESSION['site_'.$wpf_site_id]["user_data"] );
2275 }
2276 }
2277 } else {
2278 if ( isset( $_SESSION['site_' . $wpf_site_id]["user_data"] ) ) {
2279 unset( $_SESSION['site_'.$wpf_site_id]["user_data"] );
2280 }
2281 }
2282 }
2283 }
2284
2285 /*
2286 * function is used to get site filter
2287 * data and store in session
2288 */
2289 function get_site_filter_data() {
2290 $ret = 0;
2291 if ( ! is_user_logged_in() ) {
2292 if( ! get_option( 'enabled_wpfeedback' ) == 'yes' ) {
2293 $ret = 1;
2294 } else {
2295 if ( ! get_option( 'wpf_allow_guest' ) == 'yes' ) {
2296 $ret = 1;
2297 } else {
2298 $ret = 0;
2299 }
2300 }
2301 }
2302
2303 if ( $ret == 1 ) {
2304 return;
2305 }
2306
2307 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { /* it's an Ajax call */
2308 } else if( get_option( 'wpf_license' ) != 'valid' ) {
2309 } else {
2310 $wpf_site_id = get_option( 'wpf_site_id' );
2311 $url = WPF_CRM_API . 'wp-api/site/get-wp-filter-data';
2312 $sendarr = array();
2313 $sendarr["wpf_site_id"] = $wpf_site_id;
2314 $sendtocloud = json_encode( $sendarr );
2315 $response = wpf_send_remote_post( $url, $sendtocloud );
2316 if ( isset( $response['status'] ) && $response['status'] == '1' ) {
2317 update_option( 'filter_data', $response['data'], 'no' );
2318 }
2319 }
2320 }
2321
2322 /*
2323 * function is used to clear the session
2324 */
2325 function clear_session() {
2326 $wpf_site_id = get_option( 'wpf_site_id' );
2327 if ( isset( $_SESSION['site_' . $wpf_site_id]["site_data"] ) ) {
2328 unset( $_SESSION['site_' . $wpf_site_id]["site_data"] );
2329 }
2330
2331 if ( isset( $_SESSION['site_' . $wpf_site_id]["notify_users"] ) ) {
2332 unset( $_SESSION['site_' . $wpf_site_id]["notify_users"] );
2333 }
2334
2335 if ( isset( $_SESSION['site_' . $wpf_site_id]["user_data"] ) ) {
2336 unset( $_SESSION['site_' . $wpf_site_id]["user_data"] );
2337 }
2338 }
2339
2340 /*
2341 * function is used to get site settings data by key
2342 */
2343 function get_site_data_by_key( $key ) {
2344 $str = get_option( $key );
2345 return $str;
2346 }
2347
2348 function get_site_data_by_key_api( $option_name ) {
2349 $args = array(
2350 'wpf_site_id' => get_option( 'wpf_site_id' ),
2351 'option_name' => $option_name
2352 );
2353 $url = WPF_CRM_API . 'get-site-data-by-key';
2354 $sendtocloud = json_encode( $args );
2355 $res_data = wpf_send_remote_post( $url, $sendtocloud );
2356 $str = '';
2357 if ( $res_data['status'] == '200' && isset( $res_data['data'] ) ) {
2358 $str = $res_data['data'];
2359 }
2360 return $str;
2361 }
2362
2363 /*
2364 * function is used to update site settings data
2365 */
2366 function update_site_data( $options ) {
2367 $args = array(
2368 'wpf_site_id' => get_option( 'wpf_site_id' ),
2369 'options' => $options
2370 );
2371 $url = WPF_CRM_API . 'update-site-data';
2372 $sendtocloud = json_encode( $args );
2373 $myposts = wpf_send_remote_post( $url, $sendtocloud );
2374 if ( $myposts['status'] == 200 ) {
2375 get_notif_sitedata_filterdata();
2376 return 1;
2377 } else {
2378 return 0;
2379 }
2380 }
2381
2382 /*
2383 * register new route for graphic page
2384 */
2385 add_action( 'init', 'wpf_graphic_add_rewrite_rule' );
2386 function wpf_graphic_add_rewrite_rule(){
2387 add_rewrite_rule( '^collaborate/graphic?', 'index.php?is_graphic_page=1', 'top' );
2388 flush_rewrite_rules();
2389 }
2390
2391 add_action( 'query_vars', 'wpf_graphic_set_query_var' );
2392 function wpf_graphic_set_query_var( $vars ) {
2393 array_push( $vars, 'is_graphic_page' );
2394 return $vars;
2395 }
2396
2397 add_filter( 'template_include', 'wpf_graphic_include_template', 1000, 1 );
2398 function wpf_graphic_include_template( $template ) {
2399 if ( get_query_var( 'is_graphic_page' ) ) {
2400 $new_template = WPF_PLUGIN_DIR . '/graphics/wpf_graphics.php';
2401 if ( file_exists( $new_template ) ) {
2402 $template = $new_template;
2403 }
2404 }
2405 return $template;
2406 }
2407
2408 function get_task_time_type( $date ) {
2409 $current = strtotime( date( 'Y-m-d' ) );
2410 $datediff = $date - $current;
2411 $difference = floor( $datediff / (60 * 60 * 24) );
2412 if ( $difference == 0 ) {
2413 return 'today';
2414 } else if ( $difference > 1 ) {
2415 return 'Future Date';
2416 } else if ( $difference > 0 ) {
2417 return 'tomorrow';
2418 } else if ( $difference < -1 ) {
2419 return 'Long Back';
2420 } else {
2421 return 'yesterday';
2422 }
2423 }
2424
2425
2426 function formatTimeString( $time ) {
2427 $monday = strtotime( "last monday" );
2428 $monday = date( 'w', $monday ) == date( 'w' ) ? $monday + 7*86400 : $monday;
2429 $sunday = strtotime( date( "Y-m-d 23:59:59", $monday ) . " +6 days" );
2430 $this_week_sd = strtotime( date( "Y-m-d 00:00:01", $monday ) . " -7 days" );
2431 $this_week_ed = strtotime( date( "Y-m-d 23:59:59", $sunday ) . " -7 days" );
2432 $number_of_days_in_this_month = date( 't' );
2433 $first_day_this_month = strtotime( date( 'Y-m-01 00:00:01' ) . " -${number_of_days_in_this_month} days" ); // hard-coded '01' for first day
2434 $last_day_this_month = strtotime( date( 'Y-m-t 23:59:59' ) . " -${number_of_days_in_this_month} days" );
2435 $first_day_of_year = strtotime( 'first day of january this year' );
2436 $last_day_of_year = strtotime('last day of december this year');
2437
2438 if ( $time >= strtotime( date( 'Y-m-d 00:00:01' ) ) && $time <= strtotime( date( 'Y-m-d 23:59:59' ) ) ) {
2439 return "today";
2440 }
2441
2442 if ( $time >= strtotime( date( "Y-m-d 00:00:01" ) . " -1 days" ) && $time <= strtotime( date( 'Y-m-d 23:59:59' ) . " -1 days" ) ) {
2443 return 'yesterday';
2444 }
2445
2446 if ( $time >= $this_week_sd && $time <= $this_week_ed ) {
2447 return "this_week";
2448 }
2449
2450 if ( $time >= $first_day_this_month && $time <= $last_day_this_month ) {
2451 return "this_month";
2452 }
2453
2454 if ( $time >= $first_day_of_year && $time <= $last_day_of_year ) {
2455 return "year";
2456 }
2457 return "other";
2458 }
2459
2460 /*
2461 * Move the site data to wpf when
2462 * plugin 2.0 updated
2463 */
2464 function move_all_old_data_api_call() {
2465 if( isset( $_GET['move_wpf_data'] ) && $_GET['move_wpf_data'] == 1 ) {
2466 echo "Data moved!!";
2467 exit;
2468 }
2469 }
2470
2471
2472 function prefix_plugin_update_message( $data, $response ) {
2473 if( isset( $data['upgrade_notice'] ) ) {
2474 printf(
2475 '<div class="update-message">%s</div>',
2476 wpautop( $data['upgrade_notice'] )
2477 );
2478 }
2479 }
2480 add_action( 'atarim-client-interface-plugin/wpfeedback.php', 'prefix_plugin_update_message', 10, 2 );
2481
2482
2483 function prefix_plugin_update_message_fallback( $data, $response ) {
2484 if ( ! function_exists( 'prefix_plugin_update_message' ) ) {
2485 printf(
2486 '<div class="update-message"><p><strong>%s</strong></p></div>',
2487 __( 'Version 2.0 is a major update. You should take a backup before you upgrade.', 'text-domain' )
2488 );
2489 }
2490 }
2491 add_action( 'atarim-client-interface-plugin/wpfeedback.php', 'prefix_plugin_update_message_fallback', 10, 2 );
2492
2493 /*
2494 * This function is used to register the taxonomy "Task Status" on the website where it is installed.
2495 *
2496 * @input NULL
2497 * @return NULL
2498 */
2499 if ( ! function_exists( 'wp_feedback_task_status_taxonomy' ) ) {
2500 // Register Task status Custom Taxonomy
2501 function wp_feedback_task_status_taxonomy() {
2502 $labels = array(
2503 'name' => _x( 'Task status', 'Taxonomy General Name', 'wp_feedback' ),
2504 'singular_name' => _x( 'Task status', 'Taxonomy Singular Name', 'wp_feedback' ),
2505 'menu_name' => __( 'Task status', 'wp_feedback' ),
2506 'all_items' => __( 'All Task status', 'wp_feedback' ),
2507 'parent_item' => __( 'Parent Item', 'wp_feedback' ),
2508 'parent_item_colon' => __( 'Parent Item:', 'wp_feedback' ),
2509 'new_item_name' => __( 'New Task status', 'wp_feedback' ),
2510 'add_new_item' => __( 'New Task status', 'wp_feedback' ),
2511 'edit_item' => __( 'Edit Task status', 'wp_feedback' ),
2512 'update_item' => __( 'Update Task status', 'wp_feedback' ),
2513 'view_item' => __( 'View Task status', 'wp_feedback' ),
2514 'separate_items_with_commas' => __( 'Separate items with commas', 'wp_feedback' ),
2515 'add_or_remove_items' => __( 'Add or remove Task status', 'wp_feedback' ),
2516 'choose_from_most_used' => __( 'Choose from the most used', 'wp_feedback' ),
2517 'popular_items' => __( 'Popular Task status', 'wp_feedback' ),
2518 'search_items' => __( 'Search Task status', 'wp_feedback' ),
2519 'not_found' => __( 'Not Found Task status', 'wp_feedback' ),
2520 'no_terms' => __( 'No Task status', 'wp_feedback' ),
2521 'items_list' => __( 'Task status list', 'wp_feedback' ),
2522 'items_list_navigation' => __( 'Task status list navigation', 'wp_feedback' ),
2523 );
2524 $args = array(
2525 'labels' => $labels,
2526 'hierarchical' => true,
2527 'public' => false,
2528 'show_ui' => true,
2529 'show_admin_column' => true,
2530 'show_in_nav_menus' => false,
2531 'show_tagcloud' => true,
2532 );
2533 register_taxonomy( 'task_status', array('wpfeedback'), $args );
2534
2535 }
2536 add_action( 'init', 'wp_feedback_task_status_taxonomy', 0 );
2537 }
2538
2539
2540 /**
2541 * This function is used to register the taxonomy "Task Urgency" on the website where it is installed.
2542 *
2543 * @input NULL
2544 * @return NULL
2545 */
2546 if ( ! function_exists( 'wp_feedback_task_priority_taxonomy' ) ) {
2547 // Register Task urgency Custom Taxonomy
2548 function wp_feedback_task_priority_taxonomy() {
2549 $labels = array(
2550 'name' => _x( 'Task urgency', 'Taxonomy General Name', 'wp_feedback' ),
2551 'singular_name' => _x( 'Task urgency', 'Taxonomy Singular Name', 'wp_feedback' ),
2552 'menu_name' => __( 'Task urgency', 'wp_feedback' ),
2553 'all_items' => __( 'All Task urgency', 'wp_feedback' ),
2554 'parent_item' => __( 'Parent Item', 'wp_feedback' ),
2555 'parent_item_colon' => __( 'Parent Item:', 'wp_feedback' ),
2556 'new_item_name' => __( 'New Task urgency', 'wp_feedback' ),
2557 'add_new_item' => __( 'New Task urgency', 'wp_feedback' ),
2558 'edit_item' => __( 'Edit Task urgency', 'wp_feedback' ),
2559 'update_item' => __( 'Update Task urgency', 'wp_feedback' ),
2560 'view_item' => __( 'View Task urgency', 'wp_feedback' ),
2561 'separate_items_with_commas' => __( 'Separate items with commas', 'wp_feedback' ),
2562 'add_or_remove_items' => __( 'Add or remove Task urgency', 'wp_feedback' ),
2563 'choose_from_most_used' => __( 'Choose from the most used', 'wp_feedback' ),
2564 'popular_items' => __( 'Popular Task urgency', 'wp_feedback' ),
2565 'search_items' => __( 'Search Task urgency', 'wp_feedback' ),
2566 'not_found' => __( 'Not Found Task urgency', 'wp_feedback' ),
2567 'no_terms' => __( 'No Task urgency', 'wp_feedback' ),
2568 'items_list' => __( 'Task urgency list', 'wp_feedback' ),
2569 'items_list_navigation' => __( 'Task urgency list navigation', 'wp_feedback' ),
2570 );
2571 $args = array(
2572 'labels' => $labels,
2573 'hierarchical' => true,
2574 'public' => false,
2575 'show_ui' => true,
2576 'show_admin_column' => true,
2577 'show_in_nav_menus' => false,
2578 'show_tagcloud' => true,
2579 );
2580 register_taxonomy( 'task_priority', array('wpfeedback'), $args );
2581 }
2582 add_action( 'init', 'wp_feedback_task_priority_taxonomy', 0 );
2583 }
2584
2585
2586 /**
2587 * This function is used to register the terms for taxonomy "Task Priority" on the website where it is installed.
2588 *
2589 * @input NULL
2590 * @return NULL
2591 */
2592 if ( ! function_exists( 'wp_feedback_register_task_priority_terms' ) ) {
2593 function wp_feedback_register_task_priority_terms() {
2594 $taxonomy = 'task_priority';
2595 $terms = array(
2596 '0' => array(
2597 'name' => 'Low',
2598 'slug' => 'low',
2599 'description' => '',
2600 ),
2601 '1' => array(
2602 'name' => 'Medium',
2603 'slug' => 'medium',
2604 'description' => '',
2605 ),
2606 '2' => array(
2607 'name' => 'High',
2608 'slug' => 'high',
2609 'description' => '',
2610 ),
2611 '3' => array(
2612 'name' => 'Critical',
2613 'slug' => 'critical',
2614 'description' => '',
2615 ),
2616 );
2617
2618 foreach ( $terms as $term_key => $term ) {
2619 if ( ! term_exists( $term['slug'], 'task_priority' ) ) {
2620 wp_insert_term(
2621 $term['name'],
2622 $taxonomy,
2623 array(
2624 'description' => $term['description'],
2625 'slug' => $term['slug'],
2626 )
2627 );
2628 }
2629 }
2630 }
2631 }
2632 add_action( 'wp_loaded', 'wp_feedback_register_task_priority_terms', 0 );
2633
2634 /*
2635 * This function is used to register the terms for taxonomy "Task Status" on the website where it is installed.
2636 *
2637 * @input NULL
2638 * @return NULL
2639 */
2640 if ( ! function_exists( 'wp_feedback_register_task_status_terms' ) ) {
2641 function wp_feedback_register_task_status_terms() {
2642 $taxonomy = 'task_status';
2643 $terms = array(
2644 '0' => array(
2645 'name' => 'Open',
2646 'slug' => 'open',
2647 'description' => '',
2648 ),
2649 '1' => array(
2650 'name' => 'In Progress',
2651 'slug' => 'in-progress',
2652 'description' => '',
2653 ),
2654 '2' => array(
2655 'name' => 'Pending Review',
2656 'slug' => 'pending-review',
2657 'description' => '',
2658 ),
2659 '3' => array(
2660 'name' => 'Complete',
2661 'slug' => 'complete',
2662 'description' => '',
2663 ),
2664 );
2665
2666 foreach ( $terms as $term_key => $term ) {
2667 if ( ! term_exists( $term['slug'], 'task_status' ) ) {
2668 wp_insert_term(
2669 $term['name'],
2670 $taxonomy,
2671 array(
2672 'description' => $term['description'],
2673 'slug' => $term['slug'],
2674 )
2675 );
2676 }
2677 }
2678 }
2679 }
2680 add_action( 'wp_loaded', 'wp_feedback_register_task_status_terms', 0 );
2681
2682 /*
2683 * This function is used to show notice if the license is not active.
2684 *
2685 * @input NULL
2686 * @return NULL
2687 */
2688 function licence_invalid_notice() {
2689 if( get_option( 'wpf_license' ) != 'valid' && ( wpf_user_type() === 'advisor' ) ) {
2690 echo '<div class="notice notice-warning wpf_admin_notice">
2691 <div class="wpf_admin_notice_icon">
2692 <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1080">
2693 <defs>
2694 <style>
2695 .cls-1 {
2696 fill: #fff;
2697 }
2698 .cls-2 {
2699 fill: #052055;
2700 }
2701 </style>
2702 </defs>
2703 <title>Atarim Logo Inverted</title>
2704 <g>
2705 <g>
2706 <polygon class="cls-1" points="937.344 785.955 746.1 856.215 851.972 1060.257 1080 1059.991 937.344 785.955"/>
2707 <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"/>
2708 </g>
2709 <polygon class="cls-2" points="227.659 1060.331 373.967 778.521 1055.074 519.371 227.659 1060.331"/>
2710 </g>
2711 </svg>
2712 </div>
2713 <div class="wpf_admin_notice_content">
2714 <div class="wpf_admin_notice_title">Welcome to Atarim 👋</div>
2715 Please activate your license to continue using the platform.
2716 <p class="admin_notice_footer"><i>* This notice is shown to you as the Webmaster.</i></p>
2717 </div>
2718 <div class="wpf_admin_notice_button_col"><a class="wpf_admin_notice_button" href="'. admin_url() .'admin.php?page=wpfeedback_page_permissions"><span class="dashicons dashicons dashicons-update"></span> Activate & Connect</a></div>
2719 </div>';
2720 }
2721 }
2722 add_action( 'admin_notices', 'licence_invalid_notice' );
2723
2724
2725 /**
2726 * This notice will show on the admin when wpf_site_archived = 1 on the wp_options table
2727 */
2728 function site_archived_notice()
2729 {
2730 if ( get_site_data_by_key( 'wpf_site_archived' ) && ( wpf_user_type() === 'advisor' ) ) { ?>
2731 <div class="notice notice-warning wpf_admin_notice">
2732 <div class="wpf_admin_notice_icon">
2733 <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1080">
2734 <defs>
2735 <style>
2736 .cls-1 {
2737 fill: #fff;
2738 }
2739 .cls-2 {
2740 fill: #052055;
2741 }
2742 </style>
2743 </defs>
2744 <title>Atarim Logo Inverted</title>
2745 <g>
2746 <g>
2747 <polygon class="cls-1" points="937.344 785.955 746.1 856.215 851.972 1060.257 1080 1059.991 937.344 785.955"/>
2748 <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"/>
2749 </g>
2750 <polygon class="cls-2" points="227.659 1060.331 373.967 778.521 1055.074 519.371 227.659 1060.331"/>
2751 </g>
2752 </svg>
2753 </div>
2754 <div class="wpf_admin_notice_content">
2755 Atarim is disabled because this website has been archived on the Agency Dashboard. To re-enable the plugin,
2756 please go to the <a href="https://app.atarim.io/websites" target=_blank >Websites</a> screen in your Agency
2757 Dashboard and <strong>unarchive this website</strong>
2758 <p class="admin_notice_footer"><i>* This notice is shown to you as the Webmaster.</i></p>
2759 </div>
2760 </div>
2761 <?php
2762 }
2763 }
2764 add_action( 'admin_notices', 'site_archived_notice' );