wpf_admin_function.php
| 1 | <?php |
| 2 | /* |
| 3 | * wpf_admin_function.pgp |
| 4 | * This file contains the code to initialize the commenting on the backend. |
| 5 | * Below are the mentioned functions present in the file. |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * This function contains the code to initialize the sidebar and commenting feature on the backend. |
| 10 | * |
| 11 | * @input NULL |
| 12 | * @return NULL |
| 13 | */ |
| 14 | if ( ! function_exists( 'wpf_comment_button_admin' ) ) { |
| 15 | function wpf_comment_button_admin() { |
| 16 | global $wpdb; |
| 17 | $disable_for_admin = 0; |
| 18 | $wpf_current_screen = ''; |
| 19 | if ( is_admin() ) { |
| 20 | $wpf_current_screen = get_current_screen(); |
| 21 | $wpf_current_screen = $wpf_current_screen->id; |
| 22 | } |
| 23 | // STEP 1: Fetching current user information |
| 24 | $currnet_user_information = wpf_get_current_user_information(); |
| 25 | $current_role = $currnet_user_information['role']; |
| 26 | $current_user_name = $currnet_user_information['display_name']; |
| 27 | $current_user_id = $currnet_user_information['user_id']; |
| 28 | $wpf_website_builder = get_site_data_by_key( 'wpf_website_developer' ); |
| 29 | |
| 30 | if ( $current_user_name == 'Guest' ) { |
| 31 | $wpf_website_client = get_site_data_by_key( 'wpf_website_client' ); |
| 32 | $wpf_current_role = 'guest'; |
| 33 | if ( $wpf_website_client ) { |
| 34 | $wpf_website_client_info = get_userdata( $wpf_website_client ); |
| 35 | if ( $wpf_website_client_info ) { |
| 36 | if ( $wpf_website_client_info->display_name == '' ) { |
| 37 | $current_user_name = $wpf_website_client_info->user_nicename; |
| 38 | } else { |
| 39 | $current_user_name = $wpf_website_client_info->display_name; |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | } else { |
| 44 | $wpf_current_role = wpf_user_type(); |
| 45 | } |
| 46 | $current_user_name = addslashes( $current_user_name ); |
| 47 | |
| 48 | if ( $wpf_current_role == 'advisor' ) { |
| 49 | $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_user_webmaster' ) : 'no'; |
| 50 | $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_user_webmaster' ) : 'no'; |
| 51 | $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_status_webmaster' ) : 'no'; |
| 52 | $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_screenshot_webmaster' ) : 'no'; |
| 53 | $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_information_webmaster' ) : 'no'; |
| 54 | $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_delete_task_webmaster' ) : 'no'; |
| 55 | $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_auto_screenshot_task_webmaster' ) : 'no'; |
| 56 | $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_display_stickers_webmaster' ) : 'no'; |
| 57 | $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) : 'no'; |
| 58 | $wpf_tab_permission_keyboard_shortcut = get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_webmaster' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_webmaster' ) : 'no'; |
| 59 | } else if ( $wpf_current_role == 'king' ) { |
| 60 | $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_user_client' ) : 'no'; |
| 61 | $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_priority_client' ) : 'no'; |
| 62 | $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_status_client' ) : 'no'; |
| 63 | $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_screenshot_client' ) : 'no'; |
| 64 | $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_information_client' ) : 'no'; |
| 65 | $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_delete_task_client' ) : 'no'; |
| 66 | $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_client' ) != '' ? get_site_data_by_key( 'wpf_tab_auto_screenshot_task_client' ) : 'no'; |
| 67 | $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_display_stickers_client' ) : 'no'; |
| 68 | $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_display_task_id_client' ) : 'no'; |
| 69 | $wpf_tab_permission_keyboard_shortcut = get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_client' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_client' ) : 'no'; |
| 70 | } else if ( $wpf_current_role == 'council' ) { |
| 71 | $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_user_others' ) : 'no'; |
| 72 | $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_priority_others' ) : 'no'; |
| 73 | $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_status_others' ) : 'no'; |
| 74 | $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_screenshot_others' ) : 'no'; |
| 75 | $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_information_others' ) : 'no'; |
| 76 | $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_delete_task_others' ) : 'no'; |
| 77 | $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_others' ) != '' ? get_site_data_by_key( 'wpf_tab_auto_screenshot_task_others' ) : 'no'; |
| 78 | $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_display_stickers_others' ) : 'no'; |
| 79 | $wpf_tab_permission_display_task_id = get_site_data_by_key( 'wpf_tab_permission_display_task_id_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_display_task_id_others' ) : 'no'; |
| 80 | $wpf_tab_permission_keyboard_shortcut = get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_others' ) != '' ? get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_others' ) : 'no'; |
| 81 | } else { |
| 82 | $wpf_tab_permission_user = get_site_data_by_key( 'wpf_tab_permission_user_guest' ); |
| 83 | $wpf_tab_permission_priority = get_site_data_by_key( 'wpf_tab_permission_priority_guest' ); |
| 84 | $wpf_tab_permission_status = get_site_data_by_key( 'wpf_tab_permission_status_guest' ); |
| 85 | $wpf_tab_permission_screenshot = get_site_data_by_key( 'wpf_tab_permission_screenshot_guest' ); |
| 86 | $wpf_tab_permission_information = get_site_data_by_key( 'wpf_tab_permission_information_guest' ); |
| 87 | $wpf_tab_permission_delete_task = get_site_data_by_key( 'wpf_tab_permission_delete_task_guest' ); |
| 88 | $wpf_tab_permission_auto_screenshot = get_site_data_by_key( 'wpf_tab_auto_screenshot_task_guest' ); |
| 89 | $wpf_tab_permission_display_stickers = get_site_data_by_key( 'wpf_tab_permission_display_stickers_guest' ); |
| 90 | $wpf_tab_permission_keyboard_shortcut = get_site_data_by_key( 'wpf_tab_permission_keyboard_shortcut_guest' ); |
| 91 | $wpf_tab_permission_display_task_id = ( get_site_data_by_key( 'wpf_tab_permission_display_task_id_webmaster' ) != 'no' ) ? 'yes' : 'no'; |
| 92 | } |
| 93 | |
| 94 | // STEP 3: Fetching current page url for task meta information |
| 95 | $protocol = ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] != 'off' ) || $_SERVER['SERVER_PORT'] == 443 ) ? "https://" : "http://"; |
| 96 | |
| 97 | $current_page_id = ''; |
| 98 | if ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' && isset( $_GET['vcv-action'] ) && $_GET['vcv-action'] == 'frontend' && isset( $_GET['vcv-source-id'] ) ) { |
| 99 | $current_page_id = $_GET['vcv-source-id']; |
| 100 | } |
| 101 | $current_page_url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
| 102 | $current_page_title = ''; |
| 103 | $current_option = get_current_screen(); |
| 104 | if ( ! empty( $current_option ) ) { |
| 105 | $current_page_title = $current_option->id; |
| 106 | } |
| 107 | |
| 108 | // STEP 4: Fetching plugin options |
| 109 | $wpf_disable_for_admin = get_site_data_by_key( 'wpf_disable_for_admin' ); |
| 110 | if ( $wpf_disable_for_admin == 'yes' && $current_role == 'administrator' ) { |
| 111 | $disable_for_admin = 1; |
| 112 | } else { |
| 113 | $disable_for_admin = 0; |
| 114 | } |
| 115 | |
| 116 | $wpf_show_front_stikers = get_site_data_by_key( 'wpf_show_front_stikers' ); |
| 117 | $wpfb_users = do_shortcode( '[wpf_user_list_front]' ); |
| 118 | $ajax_url = admin_url( 'admin-ajax.php' ); |
| 119 | $plugin_url = WPF_PLUGIN_URL; |
| 120 | $sound_file = WPF_PLUGIN_URL . 'images/wpf-screenshot-sound.mp3'; |
| 121 | $wpf_tag_enter_img = WPF_PLUGIN_URL . 'images/enter.png'; |
| 122 | $wpf_reconnect_icon = WPF_PLUGIN_URL . 'images/wpf_reconnect.png'; |
| 123 | $bubble_and_db_id = get_last_task_id(true); |
| 124 | $comment_count = $bubble_and_db_id['Dbid']; |
| 125 | $bubble_comment_count = $bubble_and_db_id['Bubbleid']; |
| 126 | |
| 127 | // STEP 5: Fetching options for task meta information |
| 128 | $wpf_powered_class = '_blank'; |
| 129 | $wpf_powered_by = get_site_data_by_key( 'wpfeedback_powered_by' ); |
| 130 | $selected_roles = get_site_data_by_key( 'wpf_selcted_role' ); |
| 131 | $current_user = wp_get_current_user(); |
| 132 | $wpf_user_name = $current_user->display_name; |
| 133 | $wpf_user_email = $current_user->user_email; |
| 134 | $wpf_allow_backend_commenting = get_site_data_by_key( 'wpf_allow_backend_commenting' ); |
| 135 | $selected_roles = explode( ',', $selected_roles ); |
| 136 | $wpf_powerbylink = WPF_MAIN_SITE_URL . '/reviews/?website=' . get_bloginfo( 'name' ) . '&email=' . $wpf_user_email . '&nameu=' . $wpf_user_name; |
| 137 | $wpf_powerbylogo = get_wpf_logo(); |
| 138 | if ( $wpf_powered_by == 'yes' ) { |
| 139 | $wpf_powered_class = '_self'; |
| 140 | $wpf_powered_link = get_site_data_by_key( 'wpf_powered_link' ); |
| 141 | if ( $wpf_powered_link != '' ) { |
| 142 | $wpf_powerbylink = $wpf_powered_link; |
| 143 | $wpf_powered_class = '_blank'; |
| 144 | } else { |
| 145 | $wpf_powerbylink = "javascript:void(0)"; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // STEP 6: Checking if page builder is active on current page (if so then remove the feature of adding new task) |
| 150 | $wpf_check_page_builder_active = wpf_check_page_builder_active(); |
| 151 | /*if ( $wpf_check_page_builder_active == 0 ) { |
| 152 | if ( is_customize_preview() ) { |
| 153 | $wpf_check_page_builder_active = 1; |
| 154 | } else { |
| 155 | $wpf_check_page_builder_active = 0; |
| 156 | } |
| 157 | }*/ |
| 158 | if ( class_exists( 'GeoDirectory' ) ) { |
| 159 | if ( $wpf_current_screen == 'gd_place_page_gd_place-settings' ) { |
| 160 | $wpf_check_page_builder_active = 1; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // STEP 7: Initialize the structure of sidebar HTML+PHP |
| 165 | $wpf_active = wpf_check_if_enable(); |
| 166 | $is_site_archived = get_site_data_by_key( 'wpf_site_archived' ); |
| 167 | if ( $current_user_id > 0 ) { |
| 168 | $sidebar_col = "wpf_col3"; |
| 169 | } else { |
| 170 | $sidebar_col = "wpf_col2"; |
| 171 | } |
| 172 | |
| 173 | $wpf_check_atarim_server = get_option( 'atarim_server_down_check' ); |
| 174 | $unix_time_now = time(); |
| 175 | if ( $unix_time_now > $wpf_check_atarim_server ) { |
| 176 | update_option( 'atarim_server_down', 'false', 'no' ); |
| 177 | } |
| 178 | |
| 179 | $atarim_server_down = get_option( 'atarim_server_down' ); |
| 180 | $restrict_plugin = get_option( 'restrict_plugin' ); |
| 181 | $wpf_nonce = wpf_wp_create_nonce(); |
| 182 | echo "<script>var wpf_tab_permission_display_stickers = '$wpf_tab_permission_display_stickers', wpf_tab_permission_display_task_id = '$wpf_tab_permission_display_task_id';</script>"; |
| 183 | require_once( WPF_PLUGIN_DIR . 'inc/wpf_popup_string.php' ); |
| 184 | if ( $wpf_active == 1 && $wpf_check_page_builder_active == 0 && $wpf_allow_backend_commenting != 'yes' && $wpf_current_screen != 'settings_page_menu_editor' && $wpf_current_screen != 'collaborate_page_wpfeedback_page_settings' && ( ! $is_site_archived ) ) { |
| 185 | echo "<script>var wpf_reconnect_icon = '$wpf_reconnect_icon', wpf_tag_enter_img = '$wpf_tag_enter_img', disable_for_admin = '$disable_for_admin', wpf_nonce = '$wpf_nonce', wpf_current_screen = '$wpf_current_screen', 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_tab_permission_keyboard_shortcut = '$wpf_tab_permission_keyboard_shortcut', wpf_admin_bar = 1, restrict_plugin = '$restrict_plugin', atarim_server_down = '$atarim_server_down';</script>"; |
| 186 | if ( $disable_for_admin == 0 ) { |
| 187 | $wpf_site_id = get_option( 'wpf_site_id' ); |
| 188 | $bottom_panel_db = get_option( 'bottom_panel', 1 ); |
| 189 | $bottom_button_style = 'bottom: -67px;'; |
| 190 | if ( isset( $bottom_panel_db ) && $bottom_panel_db == '0' ) { |
| 191 | $bottom_button_style = 'bottom: 3px;'; |
| 192 | } |
| 193 | |
| 194 | /* ================filter Tabs Content HTML================ */ |
| 195 | $wpf_task_status_filter_btn = '<div id="wpf_filter_taskstatus" class=""><label class="wpf_filter_title">' . get_wpf_status_icon() . ' ' . __( 'Filter by Status:', 'atarim-visual-collaboration' ) . '</label>' . wp_feedback_get_texonomy_filter( "task_status" ) . '</div>'; |
| 196 | $wpf_task_priority_filter_btn = '<div id="wpf_filter_taskpriority" class=""><label class="wpf_filter_title">' . get_wpf_priority_icon() . ' ' . __( "Filter by Priority:", 'atarim-visual-collaboration' ) . '</label>' . wp_feedback_get_texonomy_filter( "task_priority" ) . '</div>'; |
| 197 | |
| 198 | /* If compact mode enabled, load it and don't load the bottom bar => v2.1.0 */ |
| 199 | $enable_compact_mode = get_site_data_by_key( 'wpf_enabled_compact_mode' ); |
| 200 | if ( $enable_compact_mode !== 'yes' && is_feature_enabled( 'bottom_bar_enabled' ) ) { |
| 201 | $bottom_bar_html = '<div id="pushed_to_media" class="wpf_hide"><div class="wpf_notice_title">' . __( "Pushed to Media Folder.", 'atarim-visual-collaboration' ) . '</div><div class="wpf_notice_text">' . __( "The file was added to the website's media folder, you can now use it from the there.", 'atarim-visual-collaboration' ) . '</div></div>'; |
| 202 | $bottom_bar_html .= '<div id="wpf_already_comment" class="wpf_hide"><div class="wpf_notice_title">' . __( "Task already exist for this element.", 'atarim-visual-collaboration' ) . '</div><div class="wpf_notice_text">' . __( "Write your message in the existing thread. <br>Here, we opened it for you.", 'atarim-visual-collaboration' ) . '</div></div>'; |
| 203 | $bottom_bar_html .= '<div id="wpf_reconnecting_task" class="wpf_hide" style="display: none;"><div class="wpf_notice_title">' . __( "Remapping task....", 'atarim-visual-collaboration' ) . '</div><div class="wpf_notice_text">' . __( "Give it a few seconds. <br>Then, refresh the page to see the task in the new position.", 'atarim-visual-collaboration' ) . '</div></div>'; |
| 204 | $bottom_bar_html .= '<div id="wpf_reconnecting_enabled" class="wpf_hide" style="display: none;"><div class="wpf_notice_title">' . __( "Remap task", 'atarim-visual-collaboration' ) . '</div><div class="wpf_notice_text">' . __( "Place the task anywhere on the page to pinpoint the location of the request.", 'atarim-visual-collaboration' ) . '</div></div>'; |
| 205 | $bottom_bar_html .= '<div id="wpf_launcher" data-html2canvas-ignore="true"> |
| 206 | <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!', 'atarim-visual-collaboration' ) . '" data-placement="left" class="comment_btn" id="wpf_enable_comment_btn"><i class="gg-math-plus"></i></a></div><div class="wpf_expand"><a href="javascript:expand_bottom_bar()" id="wpf_expand_btn" title="Panel"><img title="Panel" src="' . get_wpf_favicon() . '" alt="icon" style="width:65px" /></a></div></div> |
| 207 | <div class="wpf_sidebar_container" style="opacity: 0; margin-right: -380px";> |
| 208 | <div class="wpf_sidebar_header"> |
| 209 | <!-- =================Top Tabs================--> |
| 210 | <div class="top_tabs"> |
| 211 | <button class="wpf_tab_sidebar wpf_thispage wpf_active" onclick="openWPFTab_admin(\'wpf_thispage\')" >' . __( 'This Page', 'atarim-visual-collaboration' ) . '</button> |
| 212 | <button class="wpf_tab_sidebar wpf_allpages" onclick="openWPFTab_admin(\'wpf_allpages\')" >' . __( 'All Pages', 'atarim-visual-collaboration' ) . '</button> |
| 213 | <button class="wpf_tab_sidebar wpf_frontend" onclick="openWPFTab_admin(\'wpf_frontend\')" >' . __( 'Frontend', 'atarim-visual-collaboration' ) . '</button> |
| 214 | <span id="close_sidebar" class="close_sidebar" onclick="expand_sidebar()"><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></span> |
| 215 | </div> |
| 216 | <div id="sidebar_filters"> |
| 217 | <ul class="icons-block"> |
| 218 | <li class="status"> |
| 219 | <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", 'atarim-visual-collaboration' ) . '" id="wpf_filter_btn_bottom_status">' . get_wpf_status_icon() . ' |
| 220 | </a> |
| 221 | </li> |
| 222 | <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> |
| 223 | <li class="search"> |
| 224 | <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", 'atarim-visual-collaboration' ) . '"> |
| 225 | <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"> |
| 226 | <g id="surface1"> |
| 227 | <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 "/> |
| 228 | </g> |
| 229 | </svg> |
| 230 | </a> |
| 231 | </li> |
| 232 | </ul> |
| 233 | </div> |
| 234 | </div> |
| 235 | <div class="filter_ui_content"> |
| 236 | <div id="wpf_side_filter"> |
| 237 | <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div> |
| 238 | <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div> |
| 239 | <div class="wpf_list wpf_hide" id="wpf_search_filter_btn"><div id="sidebar_search" class="wpf_search_box"><span class="wpf_search_box"> |
| 240 | <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"> |
| 241 | <g id="surface1"> |
| 242 | <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 "/> |
| 243 | </g> |
| 244 | </svg> |
| 245 | <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", 'atarim-visual-collaboration' ) . '"></span></div> |
| 246 | </div> |
| 247 | </div> |
| 248 | </div> |
| 249 | <div class="wpf_sidebar_content"> |
| 250 | <div class="wpf_sidebar_loader wpf_hide"></div> |
| 251 | <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> |
| 252 | <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> |
| 253 | <div class="wpf_loading" style="margin-bottom: 30px">Loading...</div> |
| 254 | <div id="wpf_frontend" class="wpf_frontend_container wpf_container" style="display:none";><!--<div class="custom_today">today</div>--><ul id="wpf_frontend_container_today"></ul><!--<div class="custom_yesterday">yesterday</div>--><ul id="wpf_frontend_container_yesterday"></ul><!--<div class="custom_Weekly">Weekly</div>--><ul id="wpf_frontend_container_this_week"></ul><!--<div class="custom_this_month">This Month</div>--><ul id="wpf_frontend_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_frontend_container_year"></ul><!-- <div class="custom_year">Other</div> --> <ul id="wpf_frontend_container_other"></ul></div> |
| 255 | </div> |
| 256 | </div>' . generate_bottom_part_html() . avc_menubar() .' |
| 257 | </div>'; |
| 258 | } else { |
| 259 | $bottom_bar_html = '<div id="wpf_launcher" class="wpf-compact-launcher" data-html2canvas-ignore="true" style="user-select: auto;"> |
| 260 | <div id="wpf_launch_buttons_wrapper"> |
| 261 | <div class="wpf_launch_buttons" style="user-select: auto; left: -56px;"> |
| 262 | <div class="wpf_start_comment" style="user-select: auto;"> |
| 263 | <a href="javascript:enable_comment();" title="Click to leave a comment" data-placement="left" class="comment_btn" style="user-select: auto; cursor: pointer;"> |
| 264 | <i class="gg-math-plus" style="user-select: auto;"></i> |
| 265 | </a> |
| 266 | </div> |
| 267 | <div class="wpf_expand" style="user-select: auto;"> |
| 268 | <a href="javascript:expand_compact_sidebar()" id="wpf_expand_btn" title="Collaboration Sidebar" style="user-select: auto; cursor: pointer;" class="tasks-btn"> |
| 269 | <img src="' . get_wpf_favicon() . '" alt="icon" /> |
| 270 | </a> |
| 271 | </div> |
| 272 | <div class="wpf_general_comment"> |
| 273 | <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;"> |
| 274 | ' . get_wpf_exclamation_icon() . ' |
| 275 | <span style="user-select: auto;">' . __( 'General', 'atarim-visual-collaboration' ) . '</span> |
| 276 | </a> |
| 277 | </div> |
| 278 | </div> |
| 279 | </div> |
| 280 | <div class="wpf_sidebar_container" style="opacity: 0; margin-right: -380px";> |
| 281 | <div class="wpf_sidebar_header"> |
| 282 | <!-- =================Top Tabs================--> |
| 283 | <div class="top_tabs"> |
| 284 | <button class="wpf_tab_sidebar wpf_thispage wpf_active" onclick="openWPFTab_admin(\'wpf_thispage\')" >' . __( 'This Page', 'atarim-visual-collaboration' ) . '</button> |
| 285 | <button class="wpf_tab_sidebar wpf_allpages" onclick="openWPFTab_admin(\'wpf_allpages\')" >' . __( 'All Pages', 'atarim-visual-collaboration' ) . '</button> |
| 286 | <button class="wpf_tab_sidebar wpf_frontend" onclick="openWPFTab_admin(\'wpf_frontend\')" >' . __( 'Frontend', 'atarim-visual-collaboration' ) . '</button> |
| 287 | <span id="close_sidebar" class="close_sidebar" onclick="expand_compact_sidebar()"><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></span> |
| 288 | </div> |
| 289 | <div id="sidebar_filters"> |
| 290 | <ul class="icons-block"> |
| 291 | <li class="status"> |
| 292 | <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">' . get_wpf_status_icon() . ' |
| 293 | </a> |
| 294 | </li> |
| 295 | <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", 'atarim-visual-collaboration' ) . '">' . get_wpf_priority_icon() . '</a></li> |
| 296 | <li class="search"> |
| 297 | <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", 'atarim-visual-collaboration' ) . '"> |
| 298 | <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"> |
| 299 | <g id="surface1"> |
| 300 | <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 "/> |
| 301 | </g> |
| 302 | </svg> |
| 303 | </a> |
| 304 | </li> |
| 305 | </ul> |
| 306 | </div> |
| 307 | </div> |
| 308 | <div class="filter_ui_content"> |
| 309 | <div id="wpf_side_filter"> |
| 310 | <div class="wpf_list wpf_hide" id="wpf_task_status_filter_btn">' . $wpf_task_status_filter_btn . '</div> |
| 311 | <div class="wpf_list wpf_hide" id="wpf_task_priority_filter_btn">' . $wpf_task_priority_filter_btn . '</div> |
| 312 | <div class="wpf_list wpf_hide" id="wpf_search_filter_btn"><div id="sidebar_search" class="wpf_search_box"><span class="wpf_search_box"> |
| 313 | <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"> |
| 314 | <g id="surface1"> |
| 315 | <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 "/> |
| 316 | </g> |
| 317 | </svg> |
| 318 | <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", 'atarim-visual-collaboration' ) . '"></span></div></div> |
| 319 | </div> |
| 320 | </div> |
| 321 | <div class="wpf_sidebar_content"> |
| 322 | <div class="wpf_sidebar_loader wpf_hide"></div> |
| 323 | <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> |
| 324 | <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> |
| 325 | <div class="wpf_loading" style="margin-bottom: 30px">Loading...</div> |
| 326 | <div id="wpf_frontend" class="wpf_frontend_container wpf_container" style="display:none";><!--<div class="custom_today">today</div>--><ul id="wpf_frontend_container_today"></ul><!--<div class="custom_yesterday">yesterday</div>--><ul id="wpf_frontend_container_yesterday"></ul><!--<div class="custom_Weekly">Weekly</div>--><ul id="wpf_frontend_container_this_week"></ul><!--<div class="custom_this_month">This Month</div>--><ul id="wpf_frontend_container_this_month"></ul><!-- <div class="custom_year">This Year</div> --> <ul id="wpf_frontend_container_year"></ul><!-- <div class="custom_year">Other</div> --> <ul id="wpf_frontend_container_other"></ul></div> |
| 327 | </div> |
| 328 | </div>' . generate_side_part_html() . ' |
| 329 | </div>'; |
| 330 | } |
| 331 | echo $bottom_bar_html; |
| 332 | echo ''; |
| 333 | require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_general_task_modal.php' ); |
| 334 | require_once( WPF_PLUGIN_DIR . 'inc/frontend/wpf_restrictions_modal.php' ); |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | add_action( 'admin_footer', 'wpf_comment_button_admin' ); |
| 340 | |
| 341 | /* |
| 342 | * This function contains the code to remove the plugin initialization if Oxygen builder is detected. |
| 343 | * |
| 344 | * @input NULL |
| 345 | * @return NULL |
| 346 | */ |
| 347 | if ( class_exists( 'Oxygen_Gutenberg' ) || isset( $_GET['ct_builder'] ) || isset( $_GET['ct_template'] ) || isset( $_GET['ct_inner'] ) ) { |
| 348 | function remove_wp_foorer_action() { |
| 349 | remove_action( 'wp_footer', 'show_wpf_comment_button' ); |
| 350 | } |
| 351 | add_action( 'admin_init', 'remove_wp_foorer_action', 99 ); |
| 352 | } |
| 353 | |
| 354 | /* |
| 355 | * This function contains the code to register the JS and CSS files to the page if plugin is active |
| 356 | * |
| 357 | * @input NULL |
| 358 | * @return NULL |
| 359 | */ |
| 360 | if ( ! function_exists( 'wpfeedback_add_stylesheet_to_admin' ) ) { |
| 361 | function wpfeedback_add_stylesheet_to_admin() { |
| 362 | // only enque CSS and JS if tool is allowed. |
| 363 | $wpf_check_page_builder_active = wpf_check_page_builder_active(); |
| 364 | if ( $wpf_check_page_builder_active == 0 ) { |
| 365 | $is_site_archived = get_site_data_by_key( 'wpf_site_archived' ); |
| 366 | $wpf_current_screen_id = ''; |
| 367 | if ( is_admin() ) { |
| 368 | $wpf_current_screen = get_current_screen(); |
| 369 | $wpf_current_screen_id = $wpf_current_screen->id; |
| 370 | } |
| 371 | |
| 372 | /*===========Removed WPF on mailpoet plugin related in all pages ==========*/ |
| 373 | $mailpoet_page = array( 'mailpoet_page_mailpoet-segments', 'admin_page_mailpoet-newsletter-editor', 'toplevel_page_mailpoet-newsletters', 'mailpoet_page_mailpoet-forms', 'mailpoet_page_mailpoet-subscribers', 'mailpoet_pa', 'ge_mailpoet-segments', 'mailpoet_page_mailpoet-dynamic-segments', 'mailpoet_page_mailpoet-settings', 'mailpoet_page_mailpoet-help', 'mailpoet_page_mailpoet-premium' ); |
| 374 | if ( in_array( $wpf_current_screen_id, $mailpoet_page ) ) { |
| 375 | if ( is_plugin_active( 'mailpoet/mailpoet.php' ) ) { |
| 376 | remove_action( 'admin_footer', 'wpf_comment_button_admin' ); |
| 377 | } |
| 378 | } |
| 379 | /*===========End mailpoet plugin==========*/ |
| 380 | |
| 381 | /*===========Removed WPF on gravity forms plugin related in all pages ==========*/ |
| 382 | $gravityf_page = array( 'forms_page_gf_new_form', 'toplevel_page_gf_edit_forms', 'forms_page_gf_entries', 'forms_page_gf_settings', 'forms_page_gf_export', 'forms_page_gf_addons', 'forms_page_gf_system_status', 'forms_page_gf_help' ); |
| 383 | if ( in_array( $wpf_current_screen_id, $gravityf_page ) ) { |
| 384 | remove_action( 'admin_footer', 'wpf_comment_button_admin' ); |
| 385 | } |
| 386 | /*===========End gravity forms plugin==========*/ |
| 387 | |
| 388 | $wpf_license = get_option( 'wpf_license' ); |
| 389 | |
| 390 | wp_register_style( 'wpf_wpf-icons', WPF_PLUGIN_URL . 'css/wpf-icons.css', false, WPF_VERSION ); |
| 391 | wp_enqueue_style( 'wpf_wpf-icons' ); |
| 392 | |
| 393 | wp_register_style( 'wpf-admin-setting-style', WPF_PLUGIN_URL . 'css/admin-settings.css', false, strtotime( "now" ) ); |
| 394 | wp_enqueue_style( 'wpf-admin-setting-style' ); |
| 395 | |
| 396 | if ( $wpf_current_screen_id != 'settings_page_menu_editor' ) { |
| 397 | wp_register_style( 'wpf_admin_style', WPF_PLUGIN_URL . 'css/admin.css', false, strtotime( "now" ) ); |
| 398 | wp_enqueue_style( 'wpf_admin_style' ); |
| 399 | } |
| 400 | |
| 401 | wp_register_style( 'wpf_wpf-common', WPF_PLUGIN_URL . 'css/wpf-common.css', false, strtotime( "now" ) ); |
| 402 | wp_enqueue_style( 'wpf_wpf-common' ); |
| 403 | |
| 404 | wp_register_style( 'wpf_rt_style', WPF_PLUGIN_URL . 'css/quill.css', false, strtotime( "now" ) ); |
| 405 | wp_enqueue_style( 'wpf_rt_style' ); |
| 406 | |
| 407 | wp_register_script( 'wpf_rt_script', WPF_PLUGIN_URL . 'js/quill.js', array(), WPF_VERSION, true ); |
| 408 | wp_enqueue_script( 'wpf_rt_script' ); |
| 409 | |
| 410 | wp_register_script( 'wpf_jquery_script', WPF_PLUGIN_URL . 'js/atarimjs.js', array(), WPF_VERSION, true ); |
| 411 | wp_enqueue_script( 'wpf_jquery_script' ); |
| 412 | |
| 413 | if ( isset( $_GET['page'] ) && $_GET['page'] == "wpfeedback_page_settings" ) { |
| 414 | wp_register_script( 'pickr', WPF_PLUGIN_URL . 'js/pickr.min.js', null, null, true ); |
| 415 | wp_enqueue_script( 'pickr' ); |
| 416 | wp_register_script( 'cpickr', WPF_PLUGIN_URL . 'js/cpickr.js', null, null, true ); |
| 417 | wp_enqueue_script( 'cpickr' ); |
| 418 | } |
| 419 | wp_register_style( 'pickr_monolith', WPF_PLUGIN_URL . 'css/monolith.min.css' ); |
| 420 | wp_enqueue_style( 'pickr_monolith' ); |
| 421 | |
| 422 | wp_register_script( 'wpf_admin_script', WPF_PLUGIN_URL . 'js/admin.js', array(), strtotime( "now" ), true ); |
| 423 | wp_enqueue_script( 'wpf_admin_script' ); |
| 424 | |
| 425 | $wpf_user_type = wpf_user_type(); |
| 426 | $user = wp_get_current_user(); |
| 427 | $display_name = $user->display_name; |
| 428 | $user_id = get_current_user_id(); |
| 429 | $avatar_url = get_avatar_url( $user_id, array( 'size' => 42, 'default' => '404' ) ); |
| 430 | $headers = @get_headers( $avatar_url ); |
| 431 | if ( ! empty( $headers ) ) { |
| 432 | if ( in_array( 'HTTP/1.1 404 Not Found', $headers ) ) { |
| 433 | $avatar_url = ''; |
| 434 | } |
| 435 | } |
| 436 | wp_localize_script( 'wpf_admin_script', 'logged_user', array( 'current_user' => $wpf_user_type, 'author_img' => $avatar_url, 'author' => $display_name, 'site_url' => WPF_SITE_URL ) ); |
| 437 | |
| 438 | $feature = array(); |
| 439 | $edit = is_feature_enabled( 'edit' ); |
| 440 | if ( ! $edit ) { |
| 441 | $feature[] = 'edit'; |
| 442 | } |
| 443 | wp_localize_script( 'wpf_admin_script', 'blocked', $feature ); |
| 444 | |
| 445 | $upgrade_url = get_option( 'upgrade_url' ); |
| 446 | wp_localize_script( 'wpf_admin_script', 'upgrade_url', array( 'url' => $upgrade_url, 'plugin_url' => WPF_PLUGIN_URL ) ); |
| 447 | |
| 448 | wp_register_script( 'wpf_jscolor_script', WPF_PLUGIN_URL . 'js/jscolor.js', array(), WPF_VERSION, true ); |
| 449 | wp_enqueue_script( 'wpf_jscolor_script' ); |
| 450 | |
| 451 | wp_register_script( 'wpf_browser_info_script', WPF_PLUGIN_URL . 'js/wpf_browser_info.js', array(), WPF_VERSION, true ); |
| 452 | wp_enqueue_script( 'wpf_browser_info_script' ); |
| 453 | |
| 454 | wp_register_script( 'wpf_popper_script', WPF_PLUGIN_URL . 'js/popper.min.js', array(), WPF_VERSION, true ); |
| 455 | wp_enqueue_script( 'wpf_popper_script' ); |
| 456 | |
| 457 | wp_register_script( 'wpf_common_functions', WPF_PLUGIN_URL . 'js/wpf_common_functions.js', array(), strtotime( "now" ), true ); |
| 458 | wp_enqueue_script( 'wpf_common_functions' ); |
| 459 | |
| 460 | wp_enqueue_media(); |
| 461 | |
| 462 | /* ===========Admin Side================ */ |
| 463 | /*=====Start Check customize.php====*/ |
| 464 | /*if ( $wpf_check_page_builder_active == 0 ) { |
| 465 | if ( is_customize_preview() ) { |
| 466 | $wpf_check_page_builder_active = 1; |
| 467 | } else { |
| 468 | $wpf_check_page_builder_active = 0; |
| 469 | } |
| 470 | }*/ |
| 471 | if ( class_exists( 'GeoDirectory' ) ) { |
| 472 | if ( $wpf_current_screen_id == 'gd_place_page_gd_place-settings' ) { |
| 473 | $wpf_check_page_builder_active = 1; |
| 474 | } |
| 475 | } |
| 476 | /*=====END check customize.php====*/ |
| 477 | $enabled_wpfeedback = wpf_check_if_enable(); |
| 478 | $wpf_allow_backend_commenting = get_site_data_by_key( 'wpf_allow_backend_commenting' ); |
| 479 | |
| 480 | if ( $wpf_allow_backend_commenting != 'yes' ) { |
| 481 | if ( $wpf_current_screen_id != 'event' && ( ( isset( $_GET['page'] ) && $_GET['page'] != "updraftplus" ) || ( defined( 'BSF_AIOSRS_PRO_VER' ) == false && class_exists( 'BSF_AIOSRS_Pro_Markup' ) == false ) ) ) { |
| 482 | wp_register_script( 'wpf_jquery_ui_script', WPF_PLUGIN_URL . 'js/atarim-ui.js', array(), WPF_VERSION, true ); |
| 483 | wp_enqueue_script( 'wpf_jquery_ui_script' ); |
| 484 | } |
| 485 | |
| 486 | wp_register_script( 'wpf_popper_script', WPF_PLUGIN_URL . 'js/popper.min.js', array(), WPF_VERSION, true ); |
| 487 | wp_enqueue_script( 'wpf_popper_script' ); |
| 488 | |
| 489 | if ( $wpf_current_screen_id != 'settings_page_menu_editor' && ( isset( $_GET['page'] ) && $_GET['page'] != "formidable" ) ) { |
| 490 | wp_register_script( 'wpf_bootstrap_script', WPF_PLUGIN_URL . 'js/bootstrap.min.js', array(), WPF_VERSION, true ); |
| 491 | wp_enqueue_script( 'wpf_bootstrap_script' ); |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | $wpf_exclude_page = array( "wp-feedback_page_wpfeedback_page_tasks", "wp-feedback_page_wpfeedback_page_settings", "wp-feedback_page_wpfeedback_page_permissions", "wp-feedback_page_wpfeedback_page_support" ); |
| 496 | if ( $enabled_wpfeedback == 1 && $wpf_allow_backend_commenting != 'yes' && ( ! $is_site_archived ) ) { |
| 497 | if ( ! in_array( $wpf_current_screen_id, $wpf_exclude_page ) ) { |
| 498 | |
| 499 | } |
| 500 | if ( ! in_array( $wpf_current_screen_id, $gravityf_page ) ) { |
| 501 | |
| 502 | } |
| 503 | if ( $wpf_check_page_builder_active == 0 && $wpf_current_screen_id != 'settings_page_menu_editor' ) { |
| 504 | //wp_register_script( 'wpf_jquery_ui_script', WPF_PLUGIN_URL . 'js/atarim-ui.js', array(), WPF_VERSION, true ); |
| 505 | //wp_enqueue_script( 'wpf_jquery_ui_script' ); |
| 506 | |
| 507 | wp_register_script( 'wpf_app_script', WPF_PLUGIN_URL . 'js/admin/admin_app.js', array(), strtotime( "now" ), true ); |
| 508 | wp_enqueue_script( 'wpf_app_script' ); |
| 509 | |
| 510 | wp_register_script( 'wpf_html2canvas_script', WPF_PLUGIN_URL . 'js/html2canvas.js', array(), WPF_VERSION, true ); |
| 511 | wp_enqueue_script( 'wpf_html2canvas_script' ); |
| 512 | |
| 513 | //wp_register_script( 'wpf_popper_script', WPF_PLUGIN_URL . 'js/popper.min.js', array(), WPF_VERSION, true ); |
| 514 | //wp_enqueue_script( 'wpf_popper_script' ); |
| 515 | |
| 516 | wp_register_script( 'wpf_custompopover_script', WPF_PLUGIN_URL . 'js/custompopover.js', array(), WPF_VERSION, true ); |
| 517 | wp_enqueue_script( 'wpf_custompopover_script' ); |
| 518 | |
| 519 | wp_register_script( 'wpf_selectoroverlay_script', WPF_PLUGIN_URL . 'js/selectoroverlay.js', array(), WPF_VERSION, true ); |
| 520 | wp_enqueue_script( 'wpf_selectoroverlay_script' ); |
| 521 | |
| 522 | wp_register_script( 'wpf_xyposition_script', WPF_PLUGIN_URL . 'js/xyposition.js', array(), WPF_VERSION, true ); |
| 523 | wp_enqueue_script( 'wpf_xyposition_script' ); |
| 524 | |
| 525 | if ( ! defined( 'WDT_BASENAME' ) || ! defined( 'WDT_ROOT_PATH' ) ) { |
| 526 | wp_register_script( 'wpf_bootstrap_script', WPF_PLUGIN_URL . 'js/bootstrap.min.js', array(), WPF_VERSION, true ); |
| 527 | wp_enqueue_script( 'wpf_bootstrap_script' ); |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | add_action( 'admin_enqueue_scripts', 'wpfeedback_add_stylesheet_to_admin' ); |
| 535 | |
| 536 | /* |
| 537 | * This function contains the code to load all the tasks on the admin side as well as the comments inside the tasks. |
| 538 | * |
| 539 | * @input NULL |
| 540 | * @return JSON |
| 541 | */ |
| 542 | if ( ! function_exists( 'load_wpfb_tasks_admin' ) ) { |
| 543 | function load_wpfb_tasks_admin() { |
| 544 | ob_clean(); |
| 545 | global $wpdb, $current_user; |
| 546 | wpf_security_check(); |
| 547 | $response = array(); |
| 548 | |
| 549 | if ( isset( $_POST['current_page_id'] ) && $_POST['current_page_id'] != '' && $_POST['all_page'] != 1 ) { |
| 550 | $post_data = array( |
| 551 | 'wpf_site_id' => get_option( 'wpf_site_id' ), |
| 552 | 'url' => home_url(), |
| 553 | 'task_types' => ['general','email','page'], |
| 554 | "sort" => ["task_title", "created_at"], |
| 555 | "sort_by" => "asc", |
| 556 | "current_page_id" => sanitize_text_field( $_POST['current_page_id'] ), |
| 557 | "url" => home_url() |
| 558 | ); |
| 559 | $url = WPF_CRM_API . 'wp-api/all/task'; |
| 560 | $sendtocloud = json_encode( $post_data ); |
| 561 | $wpfb_tasks = wpf_send_remote_post( $url, $sendtocloud ); |
| 562 | } else if ( isset( $_POST['wpf_current_screen'] ) && $_POST['wpf_current_screen'] != '' && $_POST['all_page'] != 1 ) { |
| 563 | global $wp; |
| 564 | $post_data = array( |
| 565 | 'wpf_site_id' => get_option( 'wpf_site_id' ), |
| 566 | 'wpf_current_screen' => sanitize_text_field( $_POST['wpf_current_screen'] ), |
| 567 | 'task_types' => ['general','page'], |
| 568 | "sort" => ["task_title", "created_at"], |
| 569 | "sort_by" => "asc", |
| 570 | 'url' => home_url(), |
| 571 | "is_admin_task" => 1 |
| 572 | ); |
| 573 | |
| 574 | $url = WPF_CRM_API . 'wp-api/all/task'; |
| 575 | $sendtocloud = json_encode( $post_data ); |
| 576 | $wpfb_tasks = wpf_send_remote_post( $url, $sendtocloud ); |
| 577 | } else if ( isset( $_POST['task_id'] ) && $_POST['task_id'] != "") { |
| 578 | $post_data = array( |
| 579 | 'task_id' => sanitize_text_field( $_POST['task_id'] ), |
| 580 | 'post_type' => 'wpfeedback', |
| 581 | 'wpf_site_id' => get_option( 'wpf_site_id' ), |
| 582 | 'url' => home_url(), |
| 583 | 'is_admin_task' => 1 |
| 584 | ); |
| 585 | |
| 586 | $url = WPF_CRM_API . 'wp-api/all/task'; |
| 587 | $sendtocloud = json_encode( $post_data ); |
| 588 | $wpfb_tasks = wpf_send_remote_post( $url, $sendtocloud ); |
| 589 | } else { |
| 590 | $page_no = $_POST['page_no']; |
| 591 | $post_data = array( |
| 592 | 'wpf_site_id' => get_option( 'wpf_site_id' ), |
| 593 | 'task_types' => [], |
| 594 | "current_page_id" => '', |
| 595 | 'post_type' => 'wpfeedback', |
| 596 | 'numberposts' => -1, |
| 597 | 'limit' => 20, |
| 598 | 'page_no' => $page_no, |
| 599 | 'post_status' => 'any', |
| 600 | 'orderby' => 'date', |
| 601 | 'order' => 'DESC', |
| 602 | 'url' => home_url(), |
| 603 | 'is_admin_task' => 1, |
| 604 | 'from_frontend' => isset( $_POST['from_frontend'] ) ? sanitize_text_field( $_POST['from_frontend'] ) : 0 |
| 605 | ); |
| 606 | |
| 607 | $url = WPF_CRM_API . 'wp-api/all/task'; |
| 608 | $sendtocloud = json_encode( $post_data ); |
| 609 | $wpfb_tasks = wpf_send_remote_post( $url, $sendtocloud ); |
| 610 | } |
| 611 | |
| 612 | if ( ! empty( $wpfb_tasks ) ) { |
| 613 | $response = process_task_response( $wpfb_tasks ); |
| 614 | } |
| 615 | |
| 616 | // Tags. |
| 617 | if ( ! empty( $wpfb_tasks ) && isset( $wpfb_tasks['wpf_all_tags'] ) && ! is_null( $wpfb_tasks['wpf_all_tags'] ) ) { |
| 618 | $response['wpf_all_tags'] = $wpfb_tasks['wpf_all_tags']; |
| 619 | } |
| 620 | |
| 621 | //update_option( 'restrict_plugin', $wpfb_tasks['limit'], 'no' ); |
| 622 | ob_end_clean(); |
| 623 | echo json_encode( $response ); |
| 624 | exit; |
| 625 | } |
| 626 | } |
| 627 | add_action( 'wp_ajax_load_wpfb_tasks_admin', 'load_wpfb_tasks_admin' ); |
| 628 | add_action( 'wp_ajax_nopriv_load_wpfb_tasks_admin', 'load_wpfb_tasks_admin' ); |
| 629 | |
| 630 | /* |
| 631 | * This function contains the code to disable the commenting on the admin side (If option is selected from the admin) |
| 632 | * |
| 633 | * @input NULL |
| 634 | * @output NULL |
| 635 | */ |
| 636 | if ( ! function_exists( 'wpf_disable_comment_for_admin_page' ) ) { |
| 637 | function wpf_disable_comment_for_admin_page() { |
| 638 | $response = 0; |
| 639 | if ( is_admin() ) { |
| 640 | $wpf_current_screen = get_current_screen(); |
| 641 | if ( $wpf_current_screen ) { |
| 642 | $wpf_current_screen_id = $wpf_current_screen->id; |
| 643 | if ( $wpf_current_screen_id == 'toplevel_page_tvr-microthemer' ) { |
| 644 | remove_action( 'admin_footer', 'wpf_comment_button_admin' ); |
| 645 | wp_dequeue_script( 'wpf_app_script' ); |
| 646 | ?> |
| 647 | <script> |
| 648 | jQuery(window).load(function() { |
| 649 | jQuery("#viframe").contents().find("body").find("#wpf_launcher").css("display","none"); |
| 650 | jQuery("#viframe").contents().find("body").find(".wpfb-point").css("display","none"); |
| 651 | }); |
| 652 | </script> |
| 653 | <?php } |
| 654 | if ( $wpf_current_screen_id == 'nav-menus' ) { |
| 655 | if ( function_exists( '_QuadMenu' ) ) { |
| 656 | remove_action( 'admin_footer', 'wpf_comment_button_admin' ); |
| 657 | remove_action( 'admin_enqueue_scripts', 'wpfeedback_add_stylesheet_to_admin' ); |
| 658 | wp_dequeue_script( 'wpf_app_script' ); |
| 659 | wp_dequeue_script( 'wpf_bootstrap_script' ); |
| 660 | } |
| 661 | } |
| 662 | } |
| 663 | } |
| 664 | } |
| 665 | } |
| 666 | add_action( 'admin_head', 'wpf_disable_comment_for_admin_page', 10 ); |
| 667 | |
| 668 | |
| 669 | if ( ! function_exists( 'bottom_panel_session' ) ) { |
| 670 | function bottom_panel_session() { |
| 671 | ob_clean(); |
| 672 | update_option( 'bottom_panel', sanitize_text_field( $_POST['is_expand'] ), 'no' ); |
| 673 | echo json_encode( ['status' => 1] ); |
| 674 | exit; |
| 675 | } |
| 676 | } |
| 677 | add_action( 'wp_ajax_bottom_panel_session', 'bottom_panel_session' ); |
| 678 | add_action( 'wp_ajax_nopriv_bottom_panel_session', 'bottom_panel_session' ); |
| 679 | |
| 680 | // Remove admin notice of Feedback tool. |
| 681 | function remove_feedbacktool_notice() { |
| 682 | $notice = $_POST['notice']; |
| 683 | update_option('wp_feedback_notice', $notice, 'no'); |
| 684 | } |
| 685 | add_action( 'wp_ajax_remove_feedbacktool_notice', 'remove_feedbacktool_notice' ); |
| 686 | add_action( 'wp_ajax_nopriv_remove_feedbacktool_notice', 'remove_feedbacktool_notice' ); |