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