Ultimate FAQ - Version 1.8.20

Version Description

  • Added in before_title and after_title for the widget titles
Download this release

Release Info

Developer Rustaurius
Plugin Icon 128x128 Ultimate FAQ
Version 1.8.20
Comparing to
See all releases

Code changes from version 1.8.19 to 1.8.20

Files changed (3) hide show
  1. Functions/EWD_UFAQ_Widgets.php +5 -5
  2. Main.php +405 -405
  3. readme.txt +5 -1
Functions/EWD_UFAQ_Widgets.php CHANGED
@@ -20,7 +20,7 @@ class EWD_UFAQ_Display_FAQ_Post_List extends WP_Widget {
20
  */
21
  public function widget( $args, $instance ) {
22
  echo $args['before_widget'];
23
- if ($instance['faq_title'] != "") {echo "<h3>" . $instance['faq_title'] . "</h3>";}
24
  echo do_shortcode("[select-faq faq_id='". $instance['faq_id'] . "' no_comments='Yes']");
25
  echo $args['after_widget'];
26
  }
@@ -85,7 +85,7 @@ class EWD_UFAQ_Display_Recent_FAQS extends WP_Widget {
85
  */
86
  public function widget( $args, $instance ) {
87
  echo $args['before_widget'];
88
- if ($instance['faq_title'] != "") {echo "<h3>" . $instance['faq_title'] . "</h3>";}
89
  echo do_shortcode("[recent-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']");
90
  echo $args['after_widget'];
91
  }
@@ -150,7 +150,7 @@ class EWD_UFAQ_Display_Popular_FAQS extends WP_Widget {
150
  */
151
  public function widget( $args, $instance ) {
152
  echo $args['before_widget'];
153
- if ($instance['faq_title'] != "") {echo "<h3>" . $instance['faq_title'] . "</h3>";}
154
  echo do_shortcode("[popular-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']");
155
  echo $args['after_widget'];
156
  }
@@ -217,7 +217,7 @@ class EWD_UFAQ_Display_Random_FAQ extends WP_Widget {
217
  $FAQs = get_posts(array('orderby' => 'rand', 'posts_per_page' => '1', 'post_type' => 'ufaq'));
218
 
219
  echo $args['before_widget'];
220
- if ($instance['faq_title'] != "") {echo "<h3>" . $instance['faq_title'] . "</h3>";}
221
  foreach ($FAQs as $FAQ) {echo do_shortcode("[select-faq faq_id='". $FAQ->ID . "' no_comments='Yes']");}
222
  echo $args['after_widget'];
223
  }
@@ -276,7 +276,7 @@ class EWD_UFAQ_Display_FAQ_Categories extends WP_Widget {
276
  */
277
  public function widget( $args, $instance ) {
278
  echo $args['before_widget'];
279
- if ($instance['faq_title'] != "") {echo "<h3>" . $instance['faq_title'] . "</h3>";}
280
  echo do_shortcode("[ultimate-faqs include_category='". $instance['include_category'] . "' no_comments='Yes']");
281
  echo $args['after_widget'];
282
  }
20
  */
21
  public function widget( $args, $instance ) {
22
  echo $args['before_widget'];
23
+ if ($instance['faq_title'] != "") {echo ($args['before_title'] != '' ? $args['before_title'] : "<h3>") . $instance['faq_title'] . ($args['after_title'] != '' ? $args['after_title'] : "</h3>");}
24
  echo do_shortcode("[select-faq faq_id='". $instance['faq_id'] . "' no_comments='Yes']");
25
  echo $args['after_widget'];
26
  }
85
  */
86
  public function widget( $args, $instance ) {
87
  echo $args['before_widget'];
88
+ if ($instance['faq_title'] != "") {echo ($args['before_title'] != '' ? $args['before_title'] : "<h3>") . $instance['faq_title'] . ($args['after_title'] != '' ? $args['after_title'] : "</h3>");}
89
  echo do_shortcode("[recent-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']");
90
  echo $args['after_widget'];
91
  }
150
  */
151
  public function widget( $args, $instance ) {
152
  echo $args['before_widget'];
153
+ if ($instance['faq_title'] != "") {echo ($args['before_title'] != '' ? $args['before_title'] : "<h3>") . $instance['faq_title'] . ($args['after_title'] != '' ? $args['after_title'] : "</h3>");}
154
  echo do_shortcode("[popular-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']");
155
  echo $args['after_widget'];
156
  }
217
  $FAQs = get_posts(array('orderby' => 'rand', 'posts_per_page' => '1', 'post_type' => 'ufaq'));
218
 
219
  echo $args['before_widget'];
220
+ if ($instance['faq_title'] != "") {echo ($args['before_title'] != '' ? $args['before_title'] : "<h3>") . $instance['faq_title'] . ($args['after_title'] != '' ? $args['after_title'] : "</h3>");}
221
  foreach ($FAQs as $FAQ) {echo do_shortcode("[select-faq faq_id='". $FAQ->ID . "' no_comments='Yes']");}
222
  echo $args['after_widget'];
223
  }
276
  */
277
  public function widget( $args, $instance ) {
278
  echo $args['before_widget'];
279
+ if ($instance['faq_title'] != "") {echo ($args['before_title'] != '' ? $args['before_title'] : "<h3>") . $instance['faq_title'] . ($args['after_title'] != '' ? $args['after_title'] : "</h3>");}
280
  echo do_shortcode("[ultimate-faqs include_category='". $instance['include_category'] . "' no_comments='Yes']");
281
  echo $args['after_widget'];
282
  }
Main.php CHANGED
@@ -1,405 +1,405 @@
1
- <?php
2
- /*
3
- Plugin Name: Ultimate FAQ
4
- Plugin URI: http://www.EtoileWebDesign.com/wordpress-plugins/
5
- Description: FAQ plugin that lets you easily create, order and publicize FAQs using shortcodes, with many unique styles, WooCommerce FAQs and AJAX FAQ search
6
- Author: Etoile Web Design
7
- Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
8
- Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
- Text Domain: ultimate-faqs
10
- Version: 1.8.19
11
- */
12
-
13
- global $ewd_ufaq_message;
14
- global $UFAQ_Full_Version;
15
- global $EWD_UFAQ_Version;
16
-
17
- $EWD_UFAQ_Version = '1.8.0d';
18
-
19
- define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
20
- define( 'EWD_UFAQ_CD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
21
-
22
- //define('WP_DEBUG', true);
23
-
24
- register_activation_hook(__FILE__,'Set_EWD_UFAQ_Options');
25
- register_activation_hook(__FILE__,'Run_UFAQ_Tutorial');
26
- register_activation_hook(__FILE__,'EWD_UFAQ_Show_Dashboard_Link');
27
- add_filter('upgrader_post_install', 'Set_EWD_UFAQ_Options');
28
-
29
- /* Hooks neccessary admin tasks */
30
- if ( is_admin() ){
31
- add_action('widgets_init', 'Update_EWD_UFAQ_Content');
32
- add_action('admin_notices', 'EWD_UFAQ_Error_Notices');
33
- add_action('admin_enqueue_scripts', 'Add_EWD_UFAQ_Scripts', 10, 1);
34
- add_action('admin_head', 'EWD_UFAQ_Admin_Options');
35
- }
36
-
37
- function EWD_UFAQ_Enable_Sub_Menu() {
38
- global $submenu;
39
-
40
- $Admin_Approval = get_option("EWD_UFAQ_Admin_Approval");
41
- $Access_Role = get_option("UPCP_Access_Role");
42
-
43
- if ($Access_Role == "") {$Access_Role = "edit_posts";}
44
-
45
- remove_menu_page('edit.php?post_type=ufaq');
46
-
47
- add_menu_page( 'Ultimate FAQs', 'FAQs', $Access_Role, 'EWD-UFAQ-Options', 'EWD_UFAQ_Output_Pages', 'dashicons-format-chat', '49.1' );
48
- add_submenu_page('EWD-UFAQ-Options', 'FAQ Options', 'FAQ Options', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=Options', 'EWD_UFAQ_Output_Pages');
49
- if ($Admin_Approval == "Yes") {
50
- $submenu['EWD-UFAQ-Options'][6] = $submenu['EWD-UFAQ-Options'][1];
51
- $submenu['EWD-UFAQ-Options'][1] = array( 'Approved FAQs', $Access_Role, "edit.php?post_type=ufaq&post_status=publish", "Approved FAQs" );
52
- $submenu['EWD-UFAQ-Options'][2] = array( 'Awaiting Approval', $Access_Role, "edit.php?post_type=ufaq&post_status=draft", "Awaiting Approval" );
53
- $submenu['EWD-UFAQ-Options'][3] = array( 'Add New', $Access_Role, "post-new.php?post_type=ufaq", "Add New" );
54
- $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Categories', $Access_Role, "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
55
- $submenu['EWD-UFAQ-Options'][5] = array( 'FAQ Tags', $Access_Role, "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
56
- }
57
- else {
58
- $submenu['EWD-UFAQ-Options'][5] = $submenu['EWD-UFAQ-Options'][1];
59
- $submenu['EWD-UFAQ-Options'][1] = array( 'FAQs', $Access_Role, "edit.php?post_type=ufaq", "FAQs" );
60
- $submenu['EWD-UFAQ-Options'][2] = array( 'Add New', $Access_Role, "post-new.php?post_type=ufaq", "Add New" );
61
- $submenu['EWD-UFAQ-Options'][3] = array( 'FAQ Categories', $Access_Role, "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
62
- $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Tags', $Access_Role, "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
63
- }
64
- add_submenu_page('EWD-UFAQ-Options', 'FAQ Export', 'FAQ Export', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=Export', 'EWD_UFAQ_Output_Pages');
65
- add_submenu_page('EWD-UFAQ-Options', 'FAQ Import', 'FAQ Import', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=ImportPosts', 'EWD_UFAQ_Output_Pages');
66
-
67
- $submenu['EWD-UFAQ-Options'][0][0] = "Dashboard";
68
- ksort($submenu['EWD-UFAQ-Options']);
69
- }
70
- add_action('admin_menu' , 'EWD_UFAQ_Enable_Sub_Menu', 1);
71
-
72
- function EWD_UFAQ_Add_Header_Bar($Called = "No") {
73
- global $pagenow, $post;
74
-
75
- if ($Called != "Yes" and (!isset($_GET['post_type']) or $_GET['post_type'] != "ufaq") and (!is_object($post) or $post->post_type != 'ufaq')) {return;}
76
-
77
- $Admin_Approval = get_option("EWD_UFAQ_Admin_Approval"); ?>
78
-
79
- <div class="EWD_UFAQ_Menu">
80
- <h2 class="nav-tab-wrapper">
81
- <a id="ewd-ufaq-dash-mobile-menu-open" href="#" class="MenuTab nav-tab"><?php _e("MENU", 'ultimate-faqs'); ?><span id="ewd-ufaq-dash-mobile-menu-down-caret">&nbsp;&nbsp;&#9660;</span><span id="ewd-ufaq-dash-mobile-menu-up-caret">&nbsp;&nbsp;&#9650;</span></a>
82
- <a id="Dashboard_Menu" href='admin.php?page=EWD-UFAQ-Options' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and (isset($_GET['DisplayPage']) and ($_GET['DisplayPage'] == '' or $_GET['DisplayPage'] == 'Dashboard'))) {echo 'nav-tab-active';}?>"><?php _e("Dashboard", 'ultimate-faqs'); ?></a>
83
- <?php if ($Admin_Approval == "Yes") { ?>
84
- <a id="Approved_FAQs_Menu" href='edit.php?post_type=ufaq&post_status=publish' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit.php' and (!isset($_GET['post_status']) or $_GET['post_status'] == 'publish')) {echo 'nav-tab-active';}?>"><?php _e("Approved FAQs", 'ultimate-faqs'); ?></a>
85
- <a id="FAQs_Awaiting_Approval_Menu" href='edit.php?post_type=ufaq&post_status=draft' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit.php' and $_GET['post_status'] == 'draft') {echo 'nav-tab-active';}?>"><?php _e("Awaiting Approval", 'ultimate-faqs'); ?></a>
86
- <?php } else { ?>
87
- <a id="FAQs_Menu" href='edit.php?post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit.php') {echo 'nav-tab-active';}?>"><?php _e("FAQs", 'ultimate-faqs'); ?></a>
88
- <?php } ?>
89
- <a id="Add_New_Menu" href='post-new.php?post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'post-new.php') {echo 'nav-tab-active';}?>"><?php _e("Add New", 'ultimate-faqs'); ?></a>
90
- <a id="FAQ_Categories_Menu" href='edit-tags.php?taxonomy=ufaq-category&post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit-tags.php' and $_GET['taxonomy'] == "ufaq-category") {echo 'nav-tab-active';}?>"><?php _e("Categories", 'ultimate-faqs'); ?></a>
91
- <a id="FAQ_Categories_Menu" href='edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit-tags.php' and $_GET['taxonomy'] == "ufaq-tag") {echo 'nav-tab-active';}?>"><?php _e("Tags", 'ultimate-faqs'); ?></a>
92
- <a id="Options_Menu" href='admin.php?page=EWD-UFAQ-Options&DisplayPage=Options' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and isset($_GET['DisplayPage']) and $_GET['DisplayPage'] == 'Options') {echo 'nav-tab-active';}?>"><?php _e("Options", 'ultimate-faqs'); ?></a>
93
- <a id="WooCommerce_Import_Menu" href='admin.php?page=EWD-UFAQ-Options&DisplayPage=Export' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and isset($_GET['DisplayPage']) and $_GET['DisplayPage'] == 'Export') {echo 'nav-tab-active';}?>"><?php _e("Export", 'ultimate-faqs'); ?></a>
94
- <a id="WooCommerce_Import_Menu" href='admin.php?page=EWD-UFAQ-Options&DisplayPage=ImportPosts' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and isset($_GET['DisplayPage']) and $_GET['DisplayPage'] == 'ImportPosts') {echo 'nav-tab-active';}?>"><?php _e("Import", 'ultimate-faqs'); ?></a>
95
- </h2>
96
- </div>
97
- <?php }
98
- add_action('admin_notices', 'EWD_UFAQ_Add_Header_Bar');
99
-
100
- /* Add localization support */
101
- function EWD_UFAQ_localization_setup() {
102
- load_plugin_textdomain('ultimate-faqs', false, dirname(plugin_basename(__FILE__)) . '/lang/');
103
- }
104
- add_action('after_setup_theme', 'EWD_UFAQ_localization_setup');
105
-
106
- // Add settings link on plugin page
107
- function EWD_UFAQ_plugin_settings_link($links) {
108
- $settings_link = '<a href="admin.php?page=EWD-UFAQ-Options">Settings</a>';
109
- array_unshift($links, $settings_link);
110
- return $links;
111
- }
112
- $plugin = plugin_basename(__FILE__);
113
- add_filter("plugin_action_links_$plugin", 'EWD_UFAQ_plugin_settings_link' );
114
-
115
- function Add_EWD_UFAQ_Scripts($hook) {
116
- global $post, $EWD_UFAQ_Version;
117
-
118
- wp_enqueue_script('ewd-ufaq-review-ask', plugins_url("js/ewd-ufaq-dashboard-review-ask.js", __FILE__), array('jquery'), $EWD_UFAQ_Version);
119
-
120
- if ((isset($_GET['post_type']) && $_GET['post_type'] == 'ufaq') or
121
- (isset($_GET['page']) && $_GET['page'] == 'EWD-UFAQ-Options')) {
122
- $url_one = plugins_url("ultimate-faqs/js/sorttable.js");
123
- $url_two = plugins_url("ultimate-faqs/js/Admin.js");
124
- $url_three = plugins_url("ultimate-faqs/js/spectrum.js");
125
-
126
- wp_enqueue_script('jquery-ui-sortable');
127
- wp_enqueue_script('sortable', $url_one, array('jquery'));
128
- wp_enqueue_script('UFAQ Admin', $url_two, array('jquery'), $EWD_UFAQ_Version);
129
- wp_enqueue_script('spectrum', $url_three, array('jquery'));
130
- }
131
-
132
- if ($hook == 'edit.php' or $hook == 'post-new.php' or $hook == 'post.php') {
133
- if (isset($post->post_type) and $post->post_type == 'product') {
134
- wp_enqueue_script('ewd-ufaq-wc-admin', plugins_url("js/ewd-ufaq-wc-admin.js", __FILE__), array('jquery'), $EWD_UFAQ_Version);
135
- }
136
- }
137
-
138
- if (isset($_GET['page']) && $_GET['page'] == 'ewd-ufaq-getting-started') {
139
- wp_enqueue_script('ewd-ufaq-getting-started', EWD_UFAQ_CD_PLUGIN_URL . 'js/ewd-ufaq-getting-started.js', array('jquery'), $EWD_UFAQ_Version);
140
- wp_enqueue_script('spectrum', EWD_UFAQ_CD_PLUGIN_URL . 'js/spectrum.js', array('jquery'), $EWD_UFAQ_Version);
141
- wp_enqueue_script('UFAQ Admin', EWD_UFAQ_CD_PLUGIN_URL . 'js/Admin.js', array('jquery', 'jquery-ui-sortable', 'spectrum'), $EWD_UFAQ_Version);
142
- }
143
- }
144
-
145
- function EWD_UFAQ_Admin_Options() {
146
- global $EWD_UFAQ_Version;
147
-
148
- wp_enqueue_style( 'ewd-ufaq-admin', plugins_url("ultimate-faqs/css/Admin.css"), array(), $EWD_UFAQ_Version);
149
- wp_enqueue_style( 'ewd-ufaq-spectrum', plugins_url("ultimate-faqs/css/spectrum.css"));
150
- wp_enqueue_style( 'ewd-ufaq-welcome-screen', EWD_UFAQ_CD_PLUGIN_URL . 'css/ewd-ufaq-welcome-screen.css', array(), $EWD_UFAQ_Version);
151
- }
152
-
153
- add_action( 'wp_enqueue_scripts', 'Add_EWD_UFAQ_FrontEnd_Scripts' );
154
- function Add_EWD_UFAQ_FrontEnd_Scripts() {
155
- global $EWD_UFAQ_Version;
156
-
157
- wp_register_script('ewd-ufaq-js', plugins_url( '/js/ewd-ufaq-js.js' , __FILE__ ), array( 'jquery' ), $EWD_UFAQ_Version);
158
-
159
- $Highlight_Search_Term = get_option("EWD_UFAQ_Highlight_Search_Term");
160
-
161
- $Retrieving_Results = get_option("EWD_UFAQ_Retrieving_Results");
162
- if ($Retrieving_Results == "") {$Retrieving_Results = __("Retrieving Results", 'ultimate-faqs') . "...";}
163
-
164
- $ewd_ufaq_php_data = array(
165
- 'retrieving_results' => $Retrieving_Results,
166
- 'highlight_search_term' => $Highlight_Search_Term
167
- );
168
-
169
- wp_localize_script('ewd-ufaq-js', 'ewd_ufaq_php_data', $ewd_ufaq_php_data );
170
- }
171
-
172
-
173
- add_action( 'wp_enqueue_scripts', 'EWD_UFAQ_Add_Stylesheet' );
174
- function EWD_UFAQ_Add_Stylesheet() {
175
- global $EWD_UFAQ_Version;
176
-
177
- wp_register_style( 'ewd-ufaq-style', plugins_url('css/ewd-ufaq-styles.css', __FILE__) );
178
- wp_enqueue_style( 'ewd-ufaq-style', $EWD_UFAQ_Version );
179
-
180
- wp_register_style( 'ewd-ufaq-rrssb', plugins_url('css/rrssb-min.css', __FILE__) );
181
- wp_enqueue_style( 'ewd-ufaq-rrssb' );
182
- }
183
-
184
- //add_action('activated_plugin','save_ufaq_error');
185
- function save_ufaq_error(){
186
- update_option('plugin_error', ob_get_contents());
187
- file_put_contents("Error.txt", ob_get_contents());
188
- }
189
-
190
- function Set_EWD_UFAQ_Options() {
191
- if (get_option("EWD_UFAQ_Toggle") == "") {update_option("EWD_UFAQ_Toggle", "Yes");}
192
- if (get_option("EWD_UFAQ_Category_Toggle") == "") {update_option("EWD_UFAQ_Category_Toggle", "No");}
193
- if (get_option("EWD_UFAQ_Category_Accordion") == "") {update_option("EWD_UFAQ_Category_Accordion", "No");}
194
- if (get_option("EWD_UFAQ_Expand_Collapse_All") == "") {update_option("EWD_UFAQ_Expand_Collapse_All", "No");}
195
- if (get_option("EWD_UFAQ_FAQ_Accordion") == "") {update_option("EWD_UFAQ_FAQ_Accordion", "No");}
196
- if (get_option("EWD_UFAQ_Hide_Categories") == "") {update_option("EWD_UFAQ_Hide_Categories", "No");}
197
- if (get_option("EWD_UFAQ_Hide_Tags") == "") {update_option("EWD_UFAQ_Hide_Tags", "No");}
198
- if (get_option("EWD_UFAQ_Scroll_To_Top") == "") {update_option("EWD_UFAQ_Scroll_To_Top", "Yes");}
199
- if (get_option("EWD_UFAQ_Display_All_Answers") == "") {update_option("EWD_UFAQ_Display_All_Answers", "No");}
200
- if (get_option("EWD_UFAQ_Display_Author") == "") {update_option("EWD_UFAQ_Display_Author", "Yes");}
201
- if (get_option("EWD_UFAQ_Display_Date") == "") {update_option("EWD_UFAQ_Display_Date", "Yes");}
202
- if (get_option("EWD_UFAQ_Display_Back_To_Top") == "") {update_option("EWD_UFAQ_Display_Back_To_Top", "No");}
203
- if (get_option("EWD_UFAQ_Include_Permalink") == "") {update_option("EWD_UFAQ_Include_Permalink", "Yes");}
204
- if (get_option("EWD_UFAQ_Permalink_Type") == "") {update_option("EWD_UFAQ_Permalink_Type", "SamePage");}
205
- if (get_option("EWD_UFAQ_Show_TinyMCE") == "") {update_option("EWD_UFAQ_Show_TinyMCE", "Yes");}
206
- if (get_option("EWD_UFAQ_Comments_On") == "") {update_option("EWD_UFAQ_Comments_On", "Yes");}
207
- if (get_option("EWD_UFAQ_Access_Role") == "") {update_option("EWD_UFAQ_Access_Role", "edit_posts");}
208
-
209
- if (get_option("EWD_UFAQ_Display_Style") == "") {update_option("EWD_UFAQ_Display_Style", "Default");}
210
- if (get_option("EWD_UFAQ_FAQ_Number_Of_Columns") == "") {update_option("EWD_UFAQ_FAQ_Number_Of_Columns", "One");}
211
- if (get_option("EWD_UFAQ_Color_Block_Shape") == "") {update_option("EWD_UFAQ_Color_Block_Shape", "Square");}
212
- if (get_option("EWD_UFAQ_Page_Type") == "") {update_option("EWD_UFAQ_Page_Type", "Load_More");}
213
- if (get_option("EWD_UFAQ_FAQ_Ratings") == "") {update_option("EWD_UFAQ_FAQ_Ratings", "No");}
214
- if (get_option("EWD_UFAQ_WooCommerce_FAQs") == "") {update_option("EWD_UFAQ_WooCommerce_FAQs", "No");}
215
- if (get_option("EWD_UFAQ_Use_Product") == "") {update_option("EWD_UFAQ_Use_Product", "Yes");}
216
- if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
217
- if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
218
- if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
219
- if (get_option("EWD_UFAQ_Submit_Custom_Fields") == "") {update_option("EWD_UFAQ_Submit_Custom_Fields", "No");}
220
- if (get_option("EWD_UFAQ_Submit_Question_Captcha") == "") {update_option("EWD_UFAQ_Submit_Question_Captcha", "No");}
221
- if (get_option("EWD_UFAQ_Admin_Question_Notification") == "") {update_option("EWD_UFAQ_Admin_Question_Notification", "No");}
222
- if (get_option("EWD_UFAQ_Submit_FAQ_Email") == "") {update_option("EWD_UFAQ_Submit_FAQ_Email", 0);}
223
- if (get_option("EWD_UFAQ_Auto_Complete_Titles") == "") {update_option("EWD_UFAQ_Auto_Complete_Titles", "Yes");}
224
- if (get_option("EWD_UFAQ_Highlight_Search_Term") == "") {update_option("EWD_UFAQ_Highlight_Search_Term", "No");}
225
- if (get_option("EWD_UFAQ_Slug_Base") == "") {update_option("EWD_UFAQ_Slug_Base", "ufaqs");}
226
-
227
- if (get_option("EWD_UFAQ_FAQ_Elements") == "") {
228
- $FAQ_Elements = array();
229
- $FAQ_Elements[0] = "Author_Date";
230
- $FAQ_Elements[1] = "Body";
231
- $FAQ_Elements[2] = "Custom_Fields";
232
- $FAQ_Elements[3] = "Categories";
233
- $FAQ_Elements[4] = "Tags";
234
- $FAQ_Elements[5] = "Ratings";
235
- $FAQ_Elements[6] = "Social_Media";
236
- $FAQ_Elements[7] = "Permalink";
237
- $FAQ_Elements[8] = "Comments";
238
- $FAQ_Elements[9] = "Back_To_Top";
239
-
240
- update_option("EWD_UFAQ_FAQ_Elements", $FAQ_Elements);
241
- }
242
-
243
- if (get_option("EWD_UFAQ_Group_By_Category") == "") {update_option("EWD_UFAQ_Group_By_Category", "No");}
244
- if (get_option("EWD_UFAQ_Group_By_Category_Count") == "") {update_option("EWD_UFAQ_Group_By_Category_Count", "No");}
245
- if (get_option("EWD_UFAQ_Group_By_Order_By") == "") {update_option("EWD_UFAQ_Group_By_Order_By", "name");}
246
- if (get_option("EWD_UFAQ_Group_By_Order") == "") {update_option("EWD_UFAQ_Group_By_Order", "ASC");}
247
- if (get_option("EWD_UFAQ_Order_By") == "") {update_option("EWD_UFAQ_Order_By", "date");}
248
- if (get_option("EWD_UFAQ_Order") == "") {update_option("EWD_UFAQ_Order", "DESC");}
249
-
250
- if (get_option("EWD_UFAQ_Hide_Blank_Fields") == "") {update_option("EWD_UFAQ_Hide_Blank_Fields", "Yes");}
251
-
252
- if (get_option("EWD_UFAQ_Styling_Category_Heading_Type") == "") {update_option("EWD_UFAQ_Styling_Category_Heading_Type", "h4");}
253
- if (get_option("EWD_UFAQ_Styling_FAQ_Heading_Type") == "") {update_option("EWD_UFAQ_Styling_FAQ_Heading_Type", "h4");}
254
- if (get_option("EWD_UFAQ_Toggle_Symbol") == "") {update_option("EWD_UFAQ_Toggle_Symbol", "A");}
255
-
256
- if (get_option("EWD_UFAQ_Full_Version") == "") {update_option("EWD_UFAQ_Full_Version", "No");}
257
- if (get_option("EWD_UFAQ_Install_Flag") == "") {update_option("EWD_UFAQ_Update_Flag", "Yes");}
258
- if (get_option("EWD_UFAQ_Install_Flag") == "") {update_option("EWD_UFAQ_Install_Flag", "Yes");}
259
-
260
- if (get_option("EWD_UFAQ_Install_Version") == "") {update_option("EWD_UFAQ_Install_Version", 1.6);}
261
- if (get_option("EWD_UFAQ_Install_Time") == "") {update_option("EWD_UFAQ_Install_Time", time());}
262
- }
263
-
264
- $UFAQ_Full_Version = get_option("EWD_UFAQ_Full_Version");
265
- if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and isset($_POST['EWD_UFAQ_Upgrade_To_Full']) and $UFAQ_Full_Version == "Yes") {add_action("admin_notices", "EWD_UFAQ_Upgrade_Notice");}
266
-
267
- $PrettyLinks = get_option("EWD_UFAQ_Pretty_Permalinks");
268
- if ($PrettyLinks == "Yes") {
269
- add_filter( 'query_vars', 'EWD_UFAQ_add_query_vars_filter' );
270
- add_filter('init', 'EWD_UFAQ_Rewrite_Rules');
271
- update_option("EWD_UFAQ_Update_RR_Rules", "No");
272
- }
273
-
274
- if (isset($_POST['EWD_UFAQ_Upgrade_To_Full'])) {
275
- add_action('admin_init', 'EWD_UFAQ_Upgrade_To_Full');
276
- }
277
-
278
- $Show_TinyMCE = get_option("EWD_UFAQ_Show_TinyMCE");
279
- if ($Show_TinyMCE == "Yes") {
280
- add_filter( 'mce_buttons', 'EWD_UFAQ_Register_TinyMCE_Buttons' );
281
- add_filter( 'mce_external_plugins', 'EWD_UFAQ_Register_TinyMCE_Javascript' );
282
- add_action('admin_head', 'EWD_UFAQ_Output_TinyMCE_Vars');
283
- }
284
-
285
- function EWD_UFAQ_Register_TinyMCE_Buttons( $buttons ) {
286
- array_push( $buttons, 'separator', 'UFAQ_Shortcodes' );
287
- return $buttons;
288
- }
289
-
290
- function EWD_UFAQ_Register_TinyMCE_Javascript( $plugin_array ) {
291
- $plugin_array['UFAQ_Shortcodes'] = plugins_url( '/js/tinymce-plugin.js',__FILE__ );
292
-
293
- return $plugin_array;
294
- }
295
-
296
- function EWD_UFAQ_Output_TinyMCE_Vars() {
297
- global $UFAQ_Full_Version;
298
- $UFAQ_Categories = get_terms('ufaq-category');
299
-
300
- echo "<script type='text/javascript'>";
301
- echo "var ufaq_premium = '" . $UFAQ_Full_Version . "';\n";
302
- echo "var ufaq_categories = " . json_encode($UFAQ_Categories) . ";\n";
303
- echo "</script>";
304
- }
305
-
306
- function Run_UFAQ_Tutorial() {
307
- update_option("UFAQ_Run_Tutorial", "Yes");
308
- }
309
-
310
- if (get_option("UFAQ_Run_Tutorial") == "Yes" and isset($_GET['page']) and $_GET['page'] == 'EWD-UFAQ-Options') {
311
- add_action( 'admin_enqueue_scripts', 'UFAQ_Set_Pointers', 10, 1);
312
- }
313
-
314
- function UFAQ_Set_Pointers($page) {
315
- $Pointers = UFAQ_Return_Pointers();
316
-
317
- //Arguments: pointers php file, version (dots will be replaced), prefix
318
- $manager = new UFAQPointersManager( $Pointers, '1.0', 'ufaq_admin_pointers' );
319
- $manager->parse();
320
- $pointers = $manager->filter( $page );
321
- if ( empty( $pointers ) ) { // nothing to do if no pointers pass the filter
322
- return;
323
- }
324
- wp_enqueue_style( 'wp-pointer' );
325
- $js_url = plugins_url( 'js/ewd-ufaq-pointers.js', __FILE__ );
326
- wp_enqueue_script( 'ufaq_admin_pointers', $js_url, array('wp-pointer'), NULL, TRUE );
327
- //data to pass to javascript
328
- $data = array(
329
- 'next_label' => __( 'Next' ),
330
- 'close_label' => __('Close'),
331
- 'pointers' => $pointers
332
- );
333
- wp_localize_script( 'ufaq_admin_pointers', 'MyAdminPointers', $data );
334
- //update_option("UFAQ_Run_Tutorial", "No");
335
- }
336
-
337
- function EWD_UFAQ_Show_Dashboard_Link() {
338
- set_transient('ewd-ufaq-getting-started', true, 30);
339
- }
340
-
341
- function UFAQ_Leave_Reply_Text($translation, $text, $domain) {
342
- global $post;
343
- if ($text == 'Leave a Reply' and (is_object($post) and $post->post_type == 'ufaq')) {
344
- $translations = &get_translations_for_domain( $domain);
345
- return $translations->translate( 'Comment on this FAQ' );
346
- }
347
- return $translation;
348
- }
349
- add_filter('gettext', 'UFAQ_Leave_Reply_Text', 10, 4);
350
-
351
-
352
- function UFAQ_Post_Edit_Styles( $hook_suffix ){
353
- $cpt = 'ufaq';
354
- if( in_array( $hook_suffix, array('post.php', 'post-new.php') ) ){
355
- $screen = get_current_screen();
356
- if( is_object( $screen ) && $cpt == $screen->post_type ){
357
- wp_enqueue_style( 'ewd-ufaq-post-edit-styles', plugins_url("ultimate-faqs/css/ewd-ufaq-post-edit-styles.css"), $EWD_UFAQ_Version );
358
- }
359
- }
360
- }
361
- add_action('admin_enqueue_scripts', 'UFAQ_Post_Edit_Styles');
362
-
363
- include "blocks/ewd-ufaq-blocks.php";
364
- include "Functions/Error_Notices.php";
365
- include "Functions/EWD_UFAQ_Add_Social_Media_Buttons.php";
366
- include "Functions/EWD_UFAQ_Add_Views_Column.php";
367
- include "Functions/EWD_UFAQ_Captcha.php";
368
- include "Functions/EWD_UFAQ_Deactivation_Survey.php";
369
- include "Functions/EWD_UFAQ_Export.php";
370
- include "Functions/EWD_UFAQ_Help_Pointers.php";
371
- include "Functions/EWD_UFAQ_Import.php";
372
- include "Functions/EWD_UFAQ_Initial_Data.php";
373
- include "Functions/EWD_UFAQ_Meta_Boxes.php";
374
- include "Functions/EWD_UFAQ_Styling.php";
375
- include "Functions/EWD_UFAQ_Output_Pages.php";
376
- include "Functions/EWD_UFAQ_Pointers_Manager_Interface.php";
377
- include "Functions/EWD_UFAQ_Pointers_Manager_Class.php";
378
- include "Functions/EWD_UFAQ_Rewrite_Rules.php";
379
- include "Functions/EWD_UFAQ_Submit_Question.php";
380
- include "Functions/EWD_UFAQ_Upgrade_Box.php";
381
- include "Functions/EWD_UFAQ_Version_Reversion.php";
382
- include "Functions/EWD_UFAQ_Version_Update.php";
383
- include "Functions/EWD_UFAQ_Widgets.php";
384
- include "Functions/EWD_UFAQ_WooCommerce_Tab.php";
385
- include "Functions/FrontEndAjaxUrl.php";
386
- include "Functions/Full_Upgrade.php";
387
- include "Functions/Process_Ajax.php";
388
- include "Functions/Register_EWD_UFAQ_Posts_Taxonomies.php";
389
- include "Functions/Update_Admin_Databases.php";
390
- include "Functions/Update_EWD_UFAQ_Content.php";
391
-
392
- include "Shortcodes/DisplayFAQs.php";
393
- include "Shortcodes/Display_FAQ_Search.php";
394
- include "Shortcodes/Display_Popular_FAQs.php";
395
- include "Shortcodes/Display_Recent_FAQs.php";
396
- include "Shortcodes/Display_Top_Rated_FAQs.php";
397
- include "Shortcodes/SelectFAQ.php";
398
- include "Shortcodes/SubmitFAQ.php";
399
-
400
- if ($EWD_UFAQ_Version != get_option('EWD_UFAQ_Version')) {
401
- Set_EWD_UFAQ_Options();
402
- EWD_UFAQ_Version_Update();
403
- }
404
-
405
- ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: Ultimate FAQ
4
+ Plugin URI: http://www.EtoileWebDesign.com/wordpress-plugins/
5
+ Description: FAQ plugin that lets you easily create, order and publicize FAQs using shortcodes, with many unique styles, WooCommerce FAQs and AJAX FAQ search
6
+ Author: Etoile Web Design
7
+ Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
8
+ Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
+ Text Domain: ultimate-faqs
10
+ Version: 1.8.20
11
+ */
12
+
13
+ global $ewd_ufaq_message;
14
+ global $UFAQ_Full_Version;
15
+ global $EWD_UFAQ_Version;
16
+
17
+ $EWD_UFAQ_Version = '1.8.0d';
18
+
19
+ define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
20
+ define( 'EWD_UFAQ_CD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
21
+
22
+ //define('WP_DEBUG', true);
23
+
24
+ register_activation_hook(__FILE__,'Set_EWD_UFAQ_Options');
25
+ register_activation_hook(__FILE__,'Run_UFAQ_Tutorial');
26
+ register_activation_hook(__FILE__,'EWD_UFAQ_Show_Dashboard_Link');
27
+ add_filter('upgrader_post_install', 'Set_EWD_UFAQ_Options');
28
+
29
+ /* Hooks neccessary admin tasks */
30
+ if ( is_admin() ){
31
+ add_action('widgets_init', 'Update_EWD_UFAQ_Content');
32
+ add_action('admin_notices', 'EWD_UFAQ_Error_Notices');
33
+ add_action('admin_enqueue_scripts', 'Add_EWD_UFAQ_Scripts', 10, 1);
34
+ add_action('admin_head', 'EWD_UFAQ_Admin_Options');
35
+ }
36
+
37
+ function EWD_UFAQ_Enable_Sub_Menu() {
38
+ global $submenu;
39
+
40
+ $Admin_Approval = get_option("EWD_UFAQ_Admin_Approval");
41
+ $Access_Role = get_option("UPCP_Access_Role");
42
+
43
+ if ($Access_Role == "") {$Access_Role = "edit_posts";}
44
+
45
+ remove_menu_page('edit.php?post_type=ufaq');
46
+
47
+ add_menu_page( 'Ultimate FAQs', 'FAQs', $Access_Role, 'EWD-UFAQ-Options', 'EWD_UFAQ_Output_Pages', 'dashicons-format-chat', '49.1' );
48
+ add_submenu_page('EWD-UFAQ-Options', 'FAQ Options', 'FAQ Options', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=Options', 'EWD_UFAQ_Output_Pages');
49
+ if ($Admin_Approval == "Yes") {
50
+ $submenu['EWD-UFAQ-Options'][6] = $submenu['EWD-UFAQ-Options'][1];
51
+ $submenu['EWD-UFAQ-Options'][1] = array( 'Approved FAQs', $Access_Role, "edit.php?post_type=ufaq&post_status=publish", "Approved FAQs" );
52
+ $submenu['EWD-UFAQ-Options'][2] = array( 'Awaiting Approval', $Access_Role, "edit.php?post_type=ufaq&post_status=draft", "Awaiting Approval" );
53
+ $submenu['EWD-UFAQ-Options'][3] = array( 'Add New', $Access_Role, "post-new.php?post_type=ufaq", "Add New" );
54
+ $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Categories', $Access_Role, "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
55
+ $submenu['EWD-UFAQ-Options'][5] = array( 'FAQ Tags', $Access_Role, "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
56
+ }
57
+ else {
58
+ $submenu['EWD-UFAQ-Options'][5] = $submenu['EWD-UFAQ-Options'][1];
59
+ $submenu['EWD-UFAQ-Options'][1] = array( 'FAQs', $Access_Role, "edit.php?post_type=ufaq", "FAQs" );
60
+ $submenu['EWD-UFAQ-Options'][2] = array( 'Add New', $Access_Role, "post-new.php?post_type=ufaq", "Add New" );
61
+ $submenu['EWD-UFAQ-Options'][3] = array( 'FAQ Categories', $Access_Role, "edit-tags.php?taxonomy=ufaq-category&post_type=ufaq", "FAQ Categories" );
62
+ $submenu['EWD-UFAQ-Options'][4] = array( 'FAQ Tags', $Access_Role, "edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq", "FAQ Tags" );
63
+ }
64
+ add_submenu_page('EWD-UFAQ-Options', 'FAQ Export', 'FAQ Export', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=Export', 'EWD_UFAQ_Output_Pages');
65
+ add_submenu_page('EWD-UFAQ-Options', 'FAQ Import', 'FAQ Import', $Access_Role, 'EWD-UFAQ-Options&DisplayPage=ImportPosts', 'EWD_UFAQ_Output_Pages');
66
+
67
+ $submenu['EWD-UFAQ-Options'][0][0] = "Dashboard";
68
+ ksort($submenu['EWD-UFAQ-Options']);
69
+ }
70
+ add_action('admin_menu' , 'EWD_UFAQ_Enable_Sub_Menu', 1);
71
+
72
+ function EWD_UFAQ_Add_Header_Bar($Called = "No") {
73
+ global $pagenow, $post;
74
+
75
+ if ($Called != "Yes" and (!isset($_GET['post_type']) or $_GET['post_type'] != "ufaq") and (!is_object($post) or $post->post_type != 'ufaq')) {return;}
76
+
77
+ $Admin_Approval = get_option("EWD_UFAQ_Admin_Approval"); ?>
78
+
79
+ <div class="EWD_UFAQ_Menu">
80
+ <h2 class="nav-tab-wrapper">
81
+ <a id="ewd-ufaq-dash-mobile-menu-open" href="#" class="MenuTab nav-tab"><?php _e("MENU", 'ultimate-faqs'); ?><span id="ewd-ufaq-dash-mobile-menu-down-caret">&nbsp;&nbsp;&#9660;</span><span id="ewd-ufaq-dash-mobile-menu-up-caret">&nbsp;&nbsp;&#9650;</span></a>
82
+ <a id="Dashboard_Menu" href='admin.php?page=EWD-UFAQ-Options' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and (isset($_GET['DisplayPage']) and ($_GET['DisplayPage'] == '' or $_GET['DisplayPage'] == 'Dashboard'))) {echo 'nav-tab-active';}?>"><?php _e("Dashboard", 'ultimate-faqs'); ?></a>
83
+ <?php if ($Admin_Approval == "Yes") { ?>
84
+ <a id="Approved_FAQs_Menu" href='edit.php?post_type=ufaq&post_status=publish' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit.php' and (!isset($_GET['post_status']) or $_GET['post_status'] == 'publish')) {echo 'nav-tab-active';}?>"><?php _e("Approved FAQs", 'ultimate-faqs'); ?></a>
85
+ <a id="FAQs_Awaiting_Approval_Menu" href='edit.php?post_type=ufaq&post_status=draft' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit.php' and $_GET['post_status'] == 'draft') {echo 'nav-tab-active';}?>"><?php _e("Awaiting Approval", 'ultimate-faqs'); ?></a>
86
+ <?php } else { ?>
87
+ <a id="FAQs_Menu" href='edit.php?post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit.php') {echo 'nav-tab-active';}?>"><?php _e("FAQs", 'ultimate-faqs'); ?></a>
88
+ <?php } ?>
89
+ <a id="Add_New_Menu" href='post-new.php?post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'post-new.php') {echo 'nav-tab-active';}?>"><?php _e("Add New", 'ultimate-faqs'); ?></a>
90
+ <a id="FAQ_Categories_Menu" href='edit-tags.php?taxonomy=ufaq-category&post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit-tags.php' and $_GET['taxonomy'] == "ufaq-category") {echo 'nav-tab-active';}?>"><?php _e("Categories", 'ultimate-faqs'); ?></a>
91
+ <a id="FAQ_Categories_Menu" href='edit-tags.php?taxonomy=ufaq-tag&post_type=ufaq' class="MenuTab nav-tab <?php if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and $pagenow == 'edit-tags.php' and $_GET['taxonomy'] == "ufaq-tag") {echo 'nav-tab-active';}?>"><?php _e("Tags", 'ultimate-faqs'); ?></a>
92
+ <a id="Options_Menu" href='admin.php?page=EWD-UFAQ-Options&DisplayPage=Options' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and isset($_GET['DisplayPage']) and $_GET['DisplayPage'] == 'Options') {echo 'nav-tab-active';}?>"><?php _e("Options", 'ultimate-faqs'); ?></a>
93
+ <a id="WooCommerce_Import_Menu" href='admin.php?page=EWD-UFAQ-Options&DisplayPage=Export' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and isset($_GET['DisplayPage']) and $_GET['DisplayPage'] == 'Export') {echo 'nav-tab-active';}?>"><?php _e("Export", 'ultimate-faqs'); ?></a>
94
+ <a id="WooCommerce_Import_Menu" href='admin.php?page=EWD-UFAQ-Options&DisplayPage=ImportPosts' class="MenuTab nav-tab <?php if (!isset($_GET['post_type']) and isset($_GET['DisplayPage']) and $_GET['DisplayPage'] == 'ImportPosts') {echo 'nav-tab-active';}?>"><?php _e("Import", 'ultimate-faqs'); ?></a>
95
+ </h2>
96
+ </div>
97
+ <?php }
98
+ add_action('admin_notices', 'EWD_UFAQ_Add_Header_Bar');
99
+
100
+ /* Add localization support */
101
+ function EWD_UFAQ_localization_setup() {
102
+ load_plugin_textdomain('ultimate-faqs', false, dirname(plugin_basename(__FILE__)) . '/lang/');
103
+ }
104
+ add_action('after_setup_theme', 'EWD_UFAQ_localization_setup');
105
+
106
+ // Add settings link on plugin page
107
+ function EWD_UFAQ_plugin_settings_link($links) {
108
+ $settings_link = '<a href="admin.php?page=EWD-UFAQ-Options">Settings</a>';
109
+ array_unshift($links, $settings_link);
110
+ return $links;
111
+ }
112
+ $plugin = plugin_basename(__FILE__);
113
+ add_filter("plugin_action_links_$plugin", 'EWD_UFAQ_plugin_settings_link' );
114
+
115
+ function Add_EWD_UFAQ_Scripts($hook) {
116
+ global $post, $EWD_UFAQ_Version;
117
+
118
+ wp_enqueue_script('ewd-ufaq-review-ask', plugins_url("js/ewd-ufaq-dashboard-review-ask.js", __FILE__), array('jquery'), $EWD_UFAQ_Version);
119
+
120
+ if ((isset($_GET['post_type']) && $_GET['post_type'] == 'ufaq') or
121
+ (isset($_GET['page']) && $_GET['page'] == 'EWD-UFAQ-Options')) {
122
+ $url_one = plugins_url("ultimate-faqs/js/sorttable.js");
123
+ $url_two = plugins_url("ultimate-faqs/js/Admin.js");
124
+ $url_three = plugins_url("ultimate-faqs/js/spectrum.js");
125
+
126
+ wp_enqueue_script('jquery-ui-sortable');
127
+ wp_enqueue_script('sortable', $url_one, array('jquery'));
128
+ wp_enqueue_script('UFAQ Admin', $url_two, array('jquery'), $EWD_UFAQ_Version);
129
+ wp_enqueue_script('spectrum', $url_three, array('jquery'));
130
+ }
131
+
132
+ if ($hook == 'edit.php' or $hook == 'post-new.php' or $hook == 'post.php') {
133
+ if (isset($post->post_type) and $post->post_type == 'product') {
134
+ wp_enqueue_script('ewd-ufaq-wc-admin', plugins_url("js/ewd-ufaq-wc-admin.js", __FILE__), array('jquery'), $EWD_UFAQ_Version);
135
+ }
136
+ }
137
+
138
+ if (isset($_GET['page']) && $_GET['page'] == 'ewd-ufaq-getting-started') {
139
+ wp_enqueue_script('ewd-ufaq-getting-started', EWD_UFAQ_CD_PLUGIN_URL . 'js/ewd-ufaq-getting-started.js', array('jquery'), $EWD_UFAQ_Version);
140
+ wp_enqueue_script('spectrum', EWD_UFAQ_CD_PLUGIN_URL . 'js/spectrum.js', array('jquery'), $EWD_UFAQ_Version);
141
+ wp_enqueue_script('UFAQ Admin', EWD_UFAQ_CD_PLUGIN_URL . 'js/Admin.js', array('jquery', 'jquery-ui-sortable', 'spectrum'), $EWD_UFAQ_Version);
142
+ }
143
+ }
144
+
145
+ function EWD_UFAQ_Admin_Options() {
146
+ global $EWD_UFAQ_Version;
147
+
148
+ wp_enqueue_style( 'ewd-ufaq-admin', plugins_url("ultimate-faqs/css/Admin.css"), array(), $EWD_UFAQ_Version);
149
+ wp_enqueue_style( 'ewd-ufaq-spectrum', plugins_url("ultimate-faqs/css/spectrum.css"));
150
+ wp_enqueue_style( 'ewd-ufaq-welcome-screen', EWD_UFAQ_CD_PLUGIN_URL . 'css/ewd-ufaq-welcome-screen.css', array(), $EWD_UFAQ_Version);
151
+ }
152
+
153
+ add_action( 'wp_enqueue_scripts', 'Add_EWD_UFAQ_FrontEnd_Scripts' );
154
+ function Add_EWD_UFAQ_FrontEnd_Scripts() {
155
+ global $EWD_UFAQ_Version;
156
+
157
+ wp_register_script('ewd-ufaq-js', plugins_url( '/js/ewd-ufaq-js.js' , __FILE__ ), array( 'jquery' ), $EWD_UFAQ_Version);
158
+
159
+ $Highlight_Search_Term = get_option("EWD_UFAQ_Highlight_Search_Term");
160
+
161
+ $Retrieving_Results = get_option("EWD_UFAQ_Retrieving_Results");
162
+ if ($Retrieving_Results == "") {$Retrieving_Results = __("Retrieving Results", 'ultimate-faqs') . "...";}
163
+
164
+ $ewd_ufaq_php_data = array(
165
+ 'retrieving_results' => $Retrieving_Results,
166
+ 'highlight_search_term' => $Highlight_Search_Term
167
+ );
168
+
169
+ wp_localize_script('ewd-ufaq-js', 'ewd_ufaq_php_data', $ewd_ufaq_php_data );
170
+ }
171
+
172
+
173
+ add_action( 'wp_enqueue_scripts', 'EWD_UFAQ_Add_Stylesheet' );
174
+ function EWD_UFAQ_Add_Stylesheet() {
175
+ global $EWD_UFAQ_Version;
176
+
177
+ wp_register_style( 'ewd-ufaq-style', plugins_url('css/ewd-ufaq-styles.css', __FILE__) );
178
+ wp_enqueue_style( 'ewd-ufaq-style', $EWD_UFAQ_Version );
179
+
180
+ wp_register_style( 'ewd-ufaq-rrssb', plugins_url('css/rrssb-min.css', __FILE__) );
181
+ wp_enqueue_style( 'ewd-ufaq-rrssb' );
182
+ }
183
+
184
+ //add_action('activated_plugin','save_ufaq_error');
185
+ function save_ufaq_error(){
186
+ update_option('plugin_error', ob_get_contents());
187
+ file_put_contents("Error.txt", ob_get_contents());
188
+ }
189
+
190
+ function Set_EWD_UFAQ_Options() {
191
+ if (get_option("EWD_UFAQ_Toggle") == "") {update_option("EWD_UFAQ_Toggle", "Yes");}
192
+ if (get_option("EWD_UFAQ_Category_Toggle") == "") {update_option("EWD_UFAQ_Category_Toggle", "No");}
193
+ if (get_option("EWD_UFAQ_Category_Accordion") == "") {update_option("EWD_UFAQ_Category_Accordion", "No");}
194
+ if (get_option("EWD_UFAQ_Expand_Collapse_All") == "") {update_option("EWD_UFAQ_Expand_Collapse_All", "No");}
195
+ if (get_option("EWD_UFAQ_FAQ_Accordion") == "") {update_option("EWD_UFAQ_FAQ_Accordion", "No");}
196
+ if (get_option("EWD_UFAQ_Hide_Categories") == "") {update_option("EWD_UFAQ_Hide_Categories", "No");}
197
+ if (get_option("EWD_UFAQ_Hide_Tags") == "") {update_option("EWD_UFAQ_Hide_Tags", "No");}
198
+ if (get_option("EWD_UFAQ_Scroll_To_Top") == "") {update_option("EWD_UFAQ_Scroll_To_Top", "Yes");}
199
+ if (get_option("EWD_UFAQ_Display_All_Answers") == "") {update_option("EWD_UFAQ_Display_All_Answers", "No");}
200
+ if (get_option("EWD_UFAQ_Display_Author") == "") {update_option("EWD_UFAQ_Display_Author", "Yes");}
201
+ if (get_option("EWD_UFAQ_Display_Date") == "") {update_option("EWD_UFAQ_Display_Date", "Yes");}
202
+ if (get_option("EWD_UFAQ_Display_Back_To_Top") == "") {update_option("EWD_UFAQ_Display_Back_To_Top", "No");}
203
+ if (get_option("EWD_UFAQ_Include_Permalink") == "") {update_option("EWD_UFAQ_Include_Permalink", "Yes");}
204
+ if (get_option("EWD_UFAQ_Permalink_Type") == "") {update_option("EWD_UFAQ_Permalink_Type", "SamePage");}
205
+ if (get_option("EWD_UFAQ_Show_TinyMCE") == "") {update_option("EWD_UFAQ_Show_TinyMCE", "Yes");}
206
+ if (get_option("EWD_UFAQ_Comments_On") == "") {update_option("EWD_UFAQ_Comments_On", "Yes");}
207
+ if (get_option("EWD_UFAQ_Access_Role") == "") {update_option("EWD_UFAQ_Access_Role", "edit_posts");}
208
+
209
+ if (get_option("EWD_UFAQ_Display_Style") == "") {update_option("EWD_UFAQ_Display_Style", "Default");}
210
+ if (get_option("EWD_UFAQ_FAQ_Number_Of_Columns") == "") {update_option("EWD_UFAQ_FAQ_Number_Of_Columns", "One");}
211
+ if (get_option("EWD_UFAQ_Color_Block_Shape") == "") {update_option("EWD_UFAQ_Color_Block_Shape", "Square");}
212
+ if (get_option("EWD_UFAQ_Page_Type") == "") {update_option("EWD_UFAQ_Page_Type", "Load_More");}
213
+ if (get_option("EWD_UFAQ_FAQ_Ratings") == "") {update_option("EWD_UFAQ_FAQ_Ratings", "No");}
214
+ if (get_option("EWD_UFAQ_WooCommerce_FAQs") == "") {update_option("EWD_UFAQ_WooCommerce_FAQs", "No");}
215
+ if (get_option("EWD_UFAQ_Use_Product") == "") {update_option("EWD_UFAQ_Use_Product", "Yes");}
216
+ if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
217
+ if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
218
+ if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
219
+ if (get_option("EWD_UFAQ_Submit_Custom_Fields") == "") {update_option("EWD_UFAQ_Submit_Custom_Fields", "No");}
220
+ if (get_option("EWD_UFAQ_Submit_Question_Captcha") == "") {update_option("EWD_UFAQ_Submit_Question_Captcha", "No");}
221
+ if (get_option("EWD_UFAQ_Admin_Question_Notification") == "") {update_option("EWD_UFAQ_Admin_Question_Notification", "No");}
222
+ if (get_option("EWD_UFAQ_Submit_FAQ_Email") == "") {update_option("EWD_UFAQ_Submit_FAQ_Email", 0);}
223
+ if (get_option("EWD_UFAQ_Auto_Complete_Titles") == "") {update_option("EWD_UFAQ_Auto_Complete_Titles", "Yes");}
224
+ if (get_option("EWD_UFAQ_Highlight_Search_Term") == "") {update_option("EWD_UFAQ_Highlight_Search_Term", "No");}
225
+ if (get_option("EWD_UFAQ_Slug_Base") == "") {update_option("EWD_UFAQ_Slug_Base", "ufaqs");}
226
+
227
+ if (get_option("EWD_UFAQ_FAQ_Elements") == "") {
228
+ $FAQ_Elements = array();
229
+ $FAQ_Elements[0] = "Author_Date";
230
+ $FAQ_Elements[1] = "Body";
231
+ $FAQ_Elements[2] = "Custom_Fields";
232
+ $FAQ_Elements[3] = "Categories";
233
+ $FAQ_Elements[4] = "Tags";
234
+ $FAQ_Elements[5] = "Ratings";
235
+ $FAQ_Elements[6] = "Social_Media";
236
+ $FAQ_Elements[7] = "Permalink";
237
+ $FAQ_Elements[8] = "Comments";
238
+ $FAQ_Elements[9] = "Back_To_Top";
239
+
240
+ update_option("EWD_UFAQ_FAQ_Elements", $FAQ_Elements);
241
+ }
242
+
243
+ if (get_option("EWD_UFAQ_Group_By_Category") == "") {update_option("EWD_UFAQ_Group_By_Category", "No");}
244
+ if (get_option("EWD_UFAQ_Group_By_Category_Count") == "") {update_option("EWD_UFAQ_Group_By_Category_Count", "No");}
245
+ if (get_option("EWD_UFAQ_Group_By_Order_By") == "") {update_option("EWD_UFAQ_Group_By_Order_By", "name");}
246
+ if (get_option("EWD_UFAQ_Group_By_Order") == "") {update_option("EWD_UFAQ_Group_By_Order", "ASC");}
247
+ if (get_option("EWD_UFAQ_Order_By") == "") {update_option("EWD_UFAQ_Order_By", "date");}
248
+ if (get_option("EWD_UFAQ_Order") == "") {update_option("EWD_UFAQ_Order", "DESC");}
249
+
250
+ if (get_option("EWD_UFAQ_Hide_Blank_Fields") == "") {update_option("EWD_UFAQ_Hide_Blank_Fields", "Yes");}
251
+
252
+ if (get_option("EWD_UFAQ_Styling_Category_Heading_Type") == "") {update_option("EWD_UFAQ_Styling_Category_Heading_Type", "h4");}
253
+ if (get_option("EWD_UFAQ_Styling_FAQ_Heading_Type") == "") {update_option("EWD_UFAQ_Styling_FAQ_Heading_Type", "h4");}
254
+ if (get_option("EWD_UFAQ_Toggle_Symbol") == "") {update_option("EWD_UFAQ_Toggle_Symbol", "A");}
255
+
256
+ if (get_option("EWD_UFAQ_Full_Version") == "") {update_option("EWD_UFAQ_Full_Version", "No");}
257
+ if (get_option("EWD_UFAQ_Install_Flag") == "") {update_option("EWD_UFAQ_Update_Flag", "Yes");}
258
+ if (get_option("EWD_UFAQ_Install_Flag") == "") {update_option("EWD_UFAQ_Install_Flag", "Yes");}
259
+
260
+ if (get_option("EWD_UFAQ_Install_Version") == "") {update_option("EWD_UFAQ_Install_Version", 1.6);}
261
+ if (get_option("EWD_UFAQ_Install_Time") == "") {update_option("EWD_UFAQ_Install_Time", time());}
262
+ }
263
+
264
+ $UFAQ_Full_Version = get_option("EWD_UFAQ_Full_Version");
265
+ if (isset($_GET['post_type']) and $_GET['post_type'] == 'ufaq' and isset($_POST['EWD_UFAQ_Upgrade_To_Full']) and $UFAQ_Full_Version == "Yes") {add_action("admin_notices", "EWD_UFAQ_Upgrade_Notice");}
266
+
267
+ $PrettyLinks = get_option("EWD_UFAQ_Pretty_Permalinks");
268
+ if ($PrettyLinks == "Yes") {
269
+ add_filter( 'query_vars', 'EWD_UFAQ_add_query_vars_filter' );
270
+ add_filter('init', 'EWD_UFAQ_Rewrite_Rules');
271
+ update_option("EWD_UFAQ_Update_RR_Rules", "No");
272
+ }
273
+
274
+ if (isset($_POST['EWD_UFAQ_Upgrade_To_Full'])) {
275
+ add_action('admin_init', 'EWD_UFAQ_Upgrade_To_Full');
276
+ }
277
+
278
+ $Show_TinyMCE = get_option("EWD_UFAQ_Show_TinyMCE");
279
+ if ($Show_TinyMCE == "Yes") {
280
+ add_filter( 'mce_buttons', 'EWD_UFAQ_Register_TinyMCE_Buttons' );
281
+ add_filter( 'mce_external_plugins', 'EWD_UFAQ_Register_TinyMCE_Javascript' );
282
+ add_action('admin_head', 'EWD_UFAQ_Output_TinyMCE_Vars');
283
+ }
284
+
285
+ function EWD_UFAQ_Register_TinyMCE_Buttons( $buttons ) {
286
+ array_push( $buttons, 'separator', 'UFAQ_Shortcodes' );
287
+ return $buttons;
288
+ }
289
+
290
+ function EWD_UFAQ_Register_TinyMCE_Javascript( $plugin_array ) {
291
+ $plugin_array['UFAQ_Shortcodes'] = plugins_url( '/js/tinymce-plugin.js',__FILE__ );
292
+
293
+ return $plugin_array;
294
+ }
295
+
296
+ function EWD_UFAQ_Output_TinyMCE_Vars() {
297
+ global $UFAQ_Full_Version;
298
+ $UFAQ_Categories = get_terms('ufaq-category');
299
+
300
+ echo "<script type='text/javascript'>";
301
+ echo "var ufaq_premium = '" . $UFAQ_Full_Version . "';\n";
302
+ echo "var ufaq_categories = " . json_encode($UFAQ_Categories) . ";\n";
303
+ echo "</script>";
304
+ }
305
+
306
+ function Run_UFAQ_Tutorial() {
307
+ update_option("UFAQ_Run_Tutorial", "Yes");
308
+ }
309
+
310
+ if (get_option("UFAQ_Run_Tutorial") == "Yes" and isset($_GET['page']) and $_GET['page'] == 'EWD-UFAQ-Options') {
311
+ add_action( 'admin_enqueue_scripts', 'UFAQ_Set_Pointers', 10, 1);
312
+ }
313
+
314
+ function UFAQ_Set_Pointers($page) {
315
+ $Pointers = UFAQ_Return_Pointers();
316
+
317
+ //Arguments: pointers php file, version (dots will be replaced), prefix
318
+ $manager = new UFAQPointersManager( $Pointers, '1.0', 'ufaq_admin_pointers' );
319
+ $manager->parse();
320
+ $pointers = $manager->filter( $page );
321
+ if ( empty( $pointers ) ) { // nothing to do if no pointers pass the filter
322
+ return;
323
+ }
324
+ wp_enqueue_style( 'wp-pointer' );
325
+ $js_url = plugins_url( 'js/ewd-ufaq-pointers.js', __FILE__ );
326
+ wp_enqueue_script( 'ufaq_admin_pointers', $js_url, array('wp-pointer'), NULL, TRUE );
327
+ //data to pass to javascript
328
+ $data = array(
329
+ 'next_label' => __( 'Next' ),
330
+ 'close_label' => __('Close'),
331
+ 'pointers' => $pointers
332
+ );
333
+ wp_localize_script( 'ufaq_admin_pointers', 'MyAdminPointers', $data );
334
+ //update_option("UFAQ_Run_Tutorial", "No");
335
+ }
336
+
337
+ function EWD_UFAQ_Show_Dashboard_Link() {
338
+ set_transient('ewd-ufaq-getting-started', true, 30);
339
+ }
340
+
341
+ function UFAQ_Leave_Reply_Text($translation, $text, $domain) {
342
+ global $post;
343
+ if ($text == 'Leave a Reply' and (is_object($post) and $post->post_type == 'ufaq')) {
344
+ $translations = &get_translations_for_domain( $domain);
345
+ return $translations->translate( 'Comment on this FAQ' );
346
+ }
347
+ return $translation;
348
+ }
349
+ add_filter('gettext', 'UFAQ_Leave_Reply_Text', 10, 4);
350
+
351
+
352
+ function UFAQ_Post_Edit_Styles( $hook_suffix ){
353
+ $cpt = 'ufaq';
354
+ if( in_array( $hook_suffix, array('post.php', 'post-new.php') ) ){
355
+ $screen = get_current_screen();
356
+ if( is_object( $screen ) && $cpt == $screen->post_type ){
357
+ wp_enqueue_style( 'ewd-ufaq-post-edit-styles', plugins_url("ultimate-faqs/css/ewd-ufaq-post-edit-styles.css"), $EWD_UFAQ_Version );
358
+ }
359
+ }
360
+ }
361
+ add_action('admin_enqueue_scripts', 'UFAQ_Post_Edit_Styles');
362
+
363
+ include "blocks/ewd-ufaq-blocks.php";
364
+ include "Functions/Error_Notices.php";
365
+ include "Functions/EWD_UFAQ_Add_Social_Media_Buttons.php";
366
+ include "Functions/EWD_UFAQ_Add_Views_Column.php";
367
+ include "Functions/EWD_UFAQ_Captcha.php";
368
+ include "Functions/EWD_UFAQ_Deactivation_Survey.php";
369
+ include "Functions/EWD_UFAQ_Export.php";
370
+ include "Functions/EWD_UFAQ_Help_Pointers.php";
371
+ include "Functions/EWD_UFAQ_Import.php";
372
+ include "Functions/EWD_UFAQ_Initial_Data.php";
373
+ include "Functions/EWD_UFAQ_Meta_Boxes.php";
374
+ include "Functions/EWD_UFAQ_Styling.php";
375
+ include "Functions/EWD_UFAQ_Output_Pages.php";
376
+ include "Functions/EWD_UFAQ_Pointers_Manager_Interface.php";
377
+ include "Functions/EWD_UFAQ_Pointers_Manager_Class.php";
378
+ include "Functions/EWD_UFAQ_Rewrite_Rules.php";
379
+ include "Functions/EWD_UFAQ_Submit_Question.php";
380
+ include "Functions/EWD_UFAQ_Upgrade_Box.php";
381
+ include "Functions/EWD_UFAQ_Version_Reversion.php";
382
+ include "Functions/EWD_UFAQ_Version_Update.php";
383
+ include "Functions/EWD_UFAQ_Widgets.php";
384
+ include "Functions/EWD_UFAQ_WooCommerce_Tab.php";
385
+ include "Functions/FrontEndAjaxUrl.php";
386
+ include "Functions/Full_Upgrade.php";
387
+ include "Functions/Process_Ajax.php";
388
+ include "Functions/Register_EWD_UFAQ_Posts_Taxonomies.php";
389
+ include "Functions/Update_Admin_Databases.php";
390
+ include "Functions/Update_EWD_UFAQ_Content.php";
391
+
392
+ include "Shortcodes/DisplayFAQs.php";
393
+ include "Shortcodes/Display_FAQ_Search.php";
394
+ include "Shortcodes/Display_Popular_FAQs.php";
395
+ include "Shortcodes/Display_Recent_FAQs.php";
396
+ include "Shortcodes/Display_Top_Rated_FAQs.php";
397
+ include "Shortcodes/SelectFAQ.php";
398
+ include "Shortcodes/SubmitFAQ.php";
399
+
400
+ if ($EWD_UFAQ_Version != get_option('EWD_UFAQ_Version')) {
401
+ Set_EWD_UFAQ_Options();
402
+ EWD_UFAQ_Version_Update();
403
+ }
404
+
405
+ ?>
readme.txt CHANGED
@@ -275,7 +275,11 @@ Video 3 - FAQs Ordering
275
  26. FAQ widgets
276
 
277
 
278
- == Changelog ==
 
 
 
 
279
  = 1.8.19 =
280
  - Corrected an issue that was causing the "Skip All" button to not work in the tutorial that displays on plugin activation.
281
 
275
  26. FAQ widgets
276
 
277
 
278
+ == Changelog ==
279
+
280
+ = 1.8.20 =
281
+ - Added in before_title and after_title for the widget titles
282
+
283
  = 1.8.19 =
284
  - Corrected an issue that was causing the "Skip All" button to not work in the tutorial that displays on plugin activation.
285