Version Description
(2021-12-23) = - Updating nonce and capability checks for AJAX calls. - Updating sanitization and escaping.
Download this release
Release Info
Developer | Rustaurius |
Plugin | Ultimate FAQ |
Version | 2.1.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.1 to 2.1.2
- assets/js/dashboard-review-ask.js +62 -17
- assets/js/ewd-ufaq-admin.js +3 -1
- assets/js/ewd-ufaq-wc-admin.js +24 -3
- assets/js/ewd-ufaq-welcome-screen.js +35 -4
- assets/js/ewd-ufaq.js +33 -5
- ewd-ufaq-templates/faq-answer.php +1 -1
- ewd-ufaq-templates/faq-author.php +1 -1
- ewd-ufaq-templates/faq-custom-fields.php +2 -2
- ewd-ufaq-templates/faq-date.php +1 -1
- ewd-ufaq-templates/faq-permalink.php +1 -1
- ewd-ufaq-templates/faq-preview.php +1 -1
- ewd-ufaq-templates/faq-ratings.php +2 -2
- ewd-ufaq-templates/faq-title.php +2 -2
- ewd-ufaq-templates/faq.php +1 -1
- ewd-ufaq-templates/submit-faq-captcha.php +1 -1
- ewd-ufaq-templates/submit-faq-custom-field-checkbox.php +1 -1
- ewd-ufaq-templates/submit-faq-custom-field-radio.php +1 -1
- ewd-ufaq-templates/submit-faq-custom-field-select.php +1 -1
- ewd-ufaq-templates/submit-faq-submitted-faq-message.php +1 -1
- includes/Ajax.class.php +42 -21
- includes/CustomPostTypes.class.php +1 -1
- includes/Dashboard.class.php +3 -13
- includes/FAQ.class.php +1 -1
- includes/Helper.class.php +61 -0
- includes/InstallationWalkthrough.class.php +89 -33
- includes/OrderingTable.class.php +1 -1
- includes/ReviewAsk.class.php +36 -9
- includes/Widgets.class.php +53 -33
- includes/WooCommerce.class.php +44 -9
- includes/template-functions.php +1 -1
- readme.txt +4 -0
- ultimate-faqs.php +9 -11
- views/View.FAQs.class.php +17 -13
assets/js/dashboard-review-ask.js
CHANGED
@@ -2,7 +2,14 @@ jQuery( document ).ready( function( $ ) {
|
|
2 |
jQuery( '.ewd-ufaq-main-dashboard-review-ask' ).css( 'display', 'block' );
|
3 |
|
4 |
jQuery(document).on( 'click', '.ewd-ufaq-main-dashboard-review-ask .notice-dismiss', function( event ) {
|
5 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
jQuery.post( ajaxurl, data, function() {} );
|
7 |
});
|
8 |
|
@@ -16,8 +23,14 @@ jQuery( document ).ready( function( $ ) {
|
|
16 |
jQuery( '.ewd-ufaq-review-ask-not-really' ).addClass( 'ewd-ufaq-hidden' );
|
17 |
jQuery( '.ewd-ufaq-review-ask-yes' ).addClass( 'ewd-ufaq-hidden' );
|
18 |
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
});
|
22 |
|
23 |
jQuery( '.ewd-ufaq-review-ask-not-really' ).on( 'click', function() {
|
@@ -27,36 +40,68 @@ jQuery( document ).ready( function( $ ) {
|
|
27 |
jQuery( '.ewd-ufaq-review-ask-feedback-form' ).removeClass( 'ewd-ufaq-hidden' );
|
28 |
jQuery( '.ewd-ufaq-review-ask-actions' ).addClass( 'ewd-ufaq-hidden' );
|
29 |
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
});
|
33 |
|
34 |
jQuery( '.ewd-ufaq-review-ask-no-thanks' ).on( 'click', function() {
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
});
|
40 |
|
41 |
jQuery( '.ewd-ufaq-review-ask-review' ).on( 'click', function() {
|
42 |
jQuery( '.ewd-ufaq-review-ask-feedback-text' ).addClass( 'ewd-ufaq-hidden' );
|
43 |
jQuery( '.ewd-ufaq-review-ask-thank-you-text' ).removeClass( 'ewd-ufaq-hidden' );
|
44 |
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
});
|
48 |
|
49 |
jQuery( '.ewd-ufaq-review-ask-send-feedback' ).on( 'click', function() {
|
50 |
var feedback = jQuery( '.ewd-ufaq-review-ask-feedback-explanation textarea' ).val();
|
51 |
var email_address = jQuery( '.ewd-ufaq-review-ask-feedback-explanation input[name="feedback_email_address"]' ).val();
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
});
|
62 |
});
|
2 |
jQuery( '.ewd-ufaq-main-dashboard-review-ask' ).css( 'display', 'block' );
|
3 |
|
4 |
jQuery(document).on( 'click', '.ewd-ufaq-main-dashboard-review-ask .notice-dismiss', function( event ) {
|
5 |
+
var params = {};
|
6 |
+
|
7 |
+
params.nonce = ewd_ufaq_review_ask.nonce;
|
8 |
+
params.action = 'ewd_ufaq_hide_review_ask';
|
9 |
+
params.ask_review_time = 7;
|
10 |
+
|
11 |
+
var data = jQuery.param( params );
|
12 |
+
|
13 |
jQuery.post( ajaxurl, data, function() {} );
|
14 |
});
|
15 |
|
23 |
jQuery( '.ewd-ufaq-review-ask-not-really' ).addClass( 'ewd-ufaq-hidden' );
|
24 |
jQuery( '.ewd-ufaq-review-ask-yes' ).addClass( 'ewd-ufaq-hidden' );
|
25 |
|
26 |
+
var params = {};
|
27 |
+
|
28 |
+
params.nonce = ewd_ufaq_review_ask.nonce;
|
29 |
+
params.action = 'ewd_ufaq_hide_review_ask';
|
30 |
+
params.ask_review_time = 7;
|
31 |
+
|
32 |
+
var data = jQuery.param( params );
|
33 |
+
jQuery.post( ajaxurl, data, function() {} );
|
34 |
});
|
35 |
|
36 |
jQuery( '.ewd-ufaq-review-ask-not-really' ).on( 'click', function() {
|
40 |
jQuery( '.ewd-ufaq-review-ask-feedback-form' ).removeClass( 'ewd-ufaq-hidden' );
|
41 |
jQuery( '.ewd-ufaq-review-ask-actions' ).addClass( 'ewd-ufaq-hidden' );
|
42 |
|
43 |
+
var params = {};
|
44 |
+
|
45 |
+
params.nonce = ewd_ufaq_review_ask.nonce;
|
46 |
+
params.action = 'ewd_ufaq_hide_review_ask';
|
47 |
+
params.ask_review_time = 1000;
|
48 |
+
|
49 |
+
var data = jQuery.param( params );
|
50 |
+
jQuery.post( ajaxurl, data, function() {} );
|
51 |
});
|
52 |
|
53 |
jQuery( '.ewd-ufaq-review-ask-no-thanks' ).on( 'click', function() {
|
54 |
+
var params = {};
|
55 |
+
|
56 |
+
params.nonce = ewd_ufaq_review_ask.nonce;
|
57 |
+
params.action = 'ewd_ufaq_hide_review_ask';
|
58 |
+
params.ask_review_time = 1000;
|
59 |
+
|
60 |
+
var data = jQuery.param( params );
|
61 |
+
jQuery.post( ajaxurl, data, function() {} );
|
62 |
|
63 |
+
jQuery( '.ewd-ufaq-main-dashboard-review-ask' ).css( 'display', 'none' );
|
64 |
});
|
65 |
|
66 |
jQuery( '.ewd-ufaq-review-ask-review' ).on( 'click', function() {
|
67 |
jQuery( '.ewd-ufaq-review-ask-feedback-text' ).addClass( 'ewd-ufaq-hidden' );
|
68 |
jQuery( '.ewd-ufaq-review-ask-thank-you-text' ).removeClass( 'ewd-ufaq-hidden' );
|
69 |
|
70 |
+
var params = {};
|
71 |
+
|
72 |
+
params.nonce = ewd_ufaq_review_ask.nonce;
|
73 |
+
params.action = 'ewd_ufaq_hide_review_ask';
|
74 |
+
params.ask_review_time = 1000;
|
75 |
+
|
76 |
+
var data = jQuery.param( params );
|
77 |
+
jQuery.post( ajaxurl, data, function() {} );
|
78 |
});
|
79 |
|
80 |
jQuery( '.ewd-ufaq-review-ask-send-feedback' ).on( 'click', function() {
|
81 |
var feedback = jQuery( '.ewd-ufaq-review-ask-feedback-explanation textarea' ).val();
|
82 |
var email_address = jQuery( '.ewd-ufaq-review-ask-feedback-explanation input[name="feedback_email_address"]' ).val();
|
83 |
+
|
84 |
+
var params = {};
|
85 |
|
86 |
+
params.nonce = ewd_ufaq_review_ask.nonce;
|
87 |
+
params.action = 'ewd_ufaq_send_feedback';
|
88 |
+
params.feedback = feedback;
|
89 |
+
params.email_address = email_address;
|
90 |
+
|
91 |
+
var data = jQuery.param( params );
|
92 |
+
jQuery.post( ajaxurl, data, function() {} );
|
93 |
+
|
94 |
+
var params = {};
|
95 |
+
|
96 |
+
params.nonce = ewd_ufaq_review_ask.nonce;
|
97 |
+
params.action = 'ewd_ufaq_hide_review_ask';
|
98 |
+
params.ask_review_time = 1000;
|
99 |
+
|
100 |
+
var data = jQuery.param( params );
|
101 |
+
jQuery.post( ajaxurl, data, function() {} );
|
102 |
|
103 |
+
jQuery( '.ewd-ufaq-review-ask-feedback-form' ).addClass( 'ewd-ufaq-hidden' );
|
104 |
+
jQuery( '.ewd-ufaq-review-ask-review-text' ).addClass( 'ewd-ufaq-hidden' );
|
105 |
+
jQuery( '.ewd-ufaq-review-ask-thank-you-text' ).removeClass( 'ewd-ufaq-hidden' );
|
106 |
});
|
107 |
});
|
assets/js/ewd-ufaq-admin.js
CHANGED
@@ -38,7 +38,9 @@ jQuery(document).ready(function($) {
|
|
38 |
cursor: 'move',
|
39 |
axis: 'y',
|
40 |
update: function() {
|
41 |
-
var order = jQuery( this ).sortable( 'serialize' )
|
|
|
|
|
42 |
jQuery.post( ajaxurl, order, function( response ) {} );
|
43 |
}
|
44 |
});
|
38 |
cursor: 'move',
|
39 |
axis: 'y',
|
40 |
update: function() {
|
41 |
+
var order = jQuery( this ).sortable( 'serialize' )
|
42 |
+
+ '&action=ewd_ufaq_update_order'
|
43 |
+
+ '&nonce='+ewd_ufaq_php_data.nonce;
|
44 |
jQuery.post( ajaxurl, order, function( response ) {} );
|
45 |
}
|
46 |
});
|
assets/js/ewd-ufaq-wc-admin.js
CHANGED
@@ -8,7 +8,15 @@ jQuery(document).ready(function() {
|
|
8 |
jQuery(this).prop('checked', false);
|
9 |
});
|
10 |
|
11 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
jQuery.post(ajaxurl, data, function(response) {
|
13 |
var Add_FAQs = jQuery.parseJSON(response);
|
14 |
jQuery(Add_FAQs).each(function(index, el) {
|
@@ -34,7 +42,14 @@ jQuery(document).ready(function() {
|
|
34 |
jQuery(this).prop('checked', false);
|
35 |
});
|
36 |
|
37 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
jQuery.post(ajaxurl, data, function(response) {});
|
39 |
|
40 |
jQuery(FAQs).each(function(index, el) {
|
@@ -49,7 +64,13 @@ jQuery(document).ready(function() {
|
|
49 |
jQuery('.ewd-ufaq-category-filter').on('change', function() {
|
50 |
var Cat_ID = jQuery(this).val();
|
51 |
|
52 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
jQuery.post(ajaxurl, data, function(response) {
|
54 |
jQuery('.ewd-ufaq-faq-add-table').remove();
|
55 |
jQuery('.ewd-ufaq-category-filter').after(response);
|
8 |
jQuery(this).prop('checked', false);
|
9 |
});
|
10 |
|
11 |
+
var params = {};
|
12 |
+
|
13 |
+
params.nonce = ewd_ufaq_wc_admin.nonce;
|
14 |
+
params.FAQs = JSON.stringify(FAQs);
|
15 |
+
params.Post_ID = Post_ID;
|
16 |
+
params.action = 'ewd_ufaq_add_wc_faqs';
|
17 |
+
|
18 |
+
var data = jQuery.param( params );
|
19 |
+
|
20 |
jQuery.post(ajaxurl, data, function(response) {
|
21 |
var Add_FAQs = jQuery.parseJSON(response);
|
22 |
jQuery(Add_FAQs).each(function(index, el) {
|
42 |
jQuery(this).prop('checked', false);
|
43 |
});
|
44 |
|
45 |
+
var params = {};
|
46 |
+
|
47 |
+
params.nonce = ewd_ufaq_wc_admin.nonce;
|
48 |
+
params.FAQs = JSON.stringify(FAQs);
|
49 |
+
params.Post_ID = Post_ID;
|
50 |
+
params.action = 'ewd_ufaq_delete_wc_faqs';
|
51 |
+
|
52 |
+
var data = jQuery.param( params );
|
53 |
jQuery.post(ajaxurl, data, function(response) {});
|
54 |
|
55 |
jQuery(FAQs).each(function(index, el) {
|
64 |
jQuery('.ewd-ufaq-category-filter').on('change', function() {
|
65 |
var Cat_ID = jQuery(this).val();
|
66 |
|
67 |
+
var params = {};
|
68 |
+
|
69 |
+
params.nonce = ewd_ufaq_wc_admin.nonce;
|
70 |
+
params.Cat_ID = Cat_ID;
|
71 |
+
params.action = 'ewd_ufaq_wc_faq_category';
|
72 |
+
|
73 |
+
var data = jQuery.param( params );
|
74 |
jQuery.post(ajaxurl, data, function(response) {
|
75 |
jQuery('.ewd-ufaq-faq-add-table').remove();
|
76 |
jQuery('.ewd-ufaq-category-filter').after(response);
|
assets/js/ewd-ufaq-welcome-screen.js
CHANGED
@@ -24,7 +24,14 @@ jQuery(document).ready(function() {
|
|
24 |
jQuery('.ewd-ufaq-welcome-screen-add-category-name input').val('');
|
25 |
jQuery('.ewd-ufaq-welcome-screen-add-category-description textarea').val('');
|
26 |
|
27 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
jQuery.post(ajaxurl, data, function(response) {
|
29 |
var HTML = '<tr class="ewd-ufaq-welcome-screen-category">';
|
30 |
HTML += '<td class="ewd-ufaq-welcome-screen-category-name">' + category_name + '</td>';
|
@@ -43,7 +50,13 @@ jQuery(document).ready(function() {
|
|
43 |
|
44 |
EWD_UFAQ_Toggle_Welcome_Page('options');
|
45 |
|
46 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
jQuery.post(ajaxurl, data, function(response) {});
|
48 |
});
|
49 |
|
@@ -53,7 +66,17 @@ jQuery(document).ready(function() {
|
|
53 |
var group_by_category = jQuery('input[name="group_by_category"]:checked').val();
|
54 |
var order_by_setting = jQuery('select[name="order_by_setting"]').val();
|
55 |
|
56 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
jQuery.post(ajaxurl, data, function(response) {
|
58 |
jQuery('.ewd-ufaq-welcome-screen-save-options-button').after('<div class="ewd-ufaq-save-message"><div class="ewd-ufaq-save-message-inside">Options have been saved.</div></div>');
|
59 |
jQuery('.ewd-ufaq-save-message').delay(2000).fadeOut(400, function() {jQuery('.ewd-ufaq-save-message').remove();});
|
@@ -73,7 +96,15 @@ jQuery(document).ready(function() {
|
|
73 |
jQuery('.ewd-ufaq-welcome-screen-add-faq-answer textarea').val('');
|
74 |
jQuery('.ewd-ufaq-welcome-screen-add-faq-category select').val('');
|
75 |
|
76 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
jQuery.post(ajaxurl, data, function(response) {
|
78 |
var HTML = '<tr class="ewd-ufaq-welcome-screen-faq">';
|
79 |
HTML += '<td class="ewd-ufaq-welcome-screen-faq-question">' + faq_question + '</td>';
|
24 |
jQuery('.ewd-ufaq-welcome-screen-add-category-name input').val('');
|
25 |
jQuery('.ewd-ufaq-welcome-screen-add-category-description textarea').val('');
|
26 |
|
27 |
+
var params = {};
|
28 |
+
|
29 |
+
params.nonce = ewd_ufaq_getting_started.nonce;
|
30 |
+
params.action = 'ewd_ufaq_welcome_add_category';
|
31 |
+
params.category_name = category_name;
|
32 |
+
params.category_description = category_description;
|
33 |
+
|
34 |
+
var data = jQuery.param( params );
|
35 |
jQuery.post(ajaxurl, data, function(response) {
|
36 |
var HTML = '<tr class="ewd-ufaq-welcome-screen-category">';
|
37 |
HTML += '<td class="ewd-ufaq-welcome-screen-category-name">' + category_name + '</td>';
|
50 |
|
51 |
EWD_UFAQ_Toggle_Welcome_Page('options');
|
52 |
|
53 |
+
var params = {};
|
54 |
+
|
55 |
+
params.nonce = ewd_ufaq_getting_started.nonce;
|
56 |
+
params.faq_page_title = faq_page_title;
|
57 |
+
params.action = 'ewd_ufaq_welcome_add_faq_page';
|
58 |
+
|
59 |
+
var data = jQuery.param( params );
|
60 |
jQuery.post(ajaxurl, data, function(response) {});
|
61 |
});
|
62 |
|
66 |
var group_by_category = jQuery('input[name="group_by_category"]:checked').val();
|
67 |
var order_by_setting = jQuery('select[name="order_by_setting"]').val();
|
68 |
|
69 |
+
var params = {};
|
70 |
+
|
71 |
+
params.nonce = ewd_ufaq_getting_started.nonce;
|
72 |
+
params.action = 'ewd_ufaq_welcome_set_options';
|
73 |
+
params.faq_accordion = faq_accordion;
|
74 |
+
params.faq_toggle = faq_toggle;
|
75 |
+
params.group_by_category = group_by_category;
|
76 |
+
params.order_by_setting = order_by_setting;
|
77 |
+
|
78 |
+
var data = jQuery.param( params );
|
79 |
+
|
80 |
jQuery.post(ajaxurl, data, function(response) {
|
81 |
jQuery('.ewd-ufaq-welcome-screen-save-options-button').after('<div class="ewd-ufaq-save-message"><div class="ewd-ufaq-save-message-inside">Options have been saved.</div></div>');
|
82 |
jQuery('.ewd-ufaq-save-message').delay(2000).fadeOut(400, function() {jQuery('.ewd-ufaq-save-message').remove();});
|
96 |
jQuery('.ewd-ufaq-welcome-screen-add-faq-answer textarea').val('');
|
97 |
jQuery('.ewd-ufaq-welcome-screen-add-faq-category select').val('');
|
98 |
|
99 |
+
var params = {};
|
100 |
+
|
101 |
+
params.nonce = ewd_ufaq_getting_started.nonce;
|
102 |
+
params.action = 'ewd_ufaq_welcome_add_faq';
|
103 |
+
params.faq_question = faq_question;
|
104 |
+
params.faq_answer = faq_answer;
|
105 |
+
params.faq_category = faq_category;
|
106 |
+
|
107 |
+
var data = jQuery.param( params );
|
108 |
jQuery.post(ajaxurl, data, function(response) {
|
109 |
var HTML = '<tr class="ewd-ufaq-welcome-screen-faq">';
|
110 |
HTML += '<td class="ewd-ufaq-welcome-screen-faq-question">' + faq_question + '</td>';
|
assets/js/ewd-ufaq.js
CHANGED
@@ -123,7 +123,13 @@ function EWD_UFAQ_Reveal_FAQ( faq_element ) {
|
|
123 |
|
124 |
var post_id = faq_element.data( 'post_id' );
|
125 |
|
126 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
jQuery.post(ajaxurl, data, function(response) {});
|
128 |
|
129 |
faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html( faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html().toUpperCase() );
|
@@ -239,7 +245,23 @@ function ewd_ufaq_ajax_reload( pagination, append_results, search_string ) {
|
|
239 |
|
240 |
if (show_on_load == 'No' && Question.length == 0) {jQuery('#ewd-ufaq-ajax-results').html(''); return;}
|
241 |
|
242 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
jQuery.post( ajaxurl, data, function( response ) {
|
244 |
|
245 |
if ( response.data.request_count == request_count ) {
|
@@ -277,9 +299,15 @@ function UFAQSetRatingHandlers() {
|
|
277 |
if ( jQuery( this ).hasClass( 'ewd-ufaq-up-vote' ) ) { vote_type = 'up'; }
|
278 |
else { vote_type = 'down'; }
|
279 |
|
280 |
-
var
|
281 |
-
|
282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
});
|
284 |
}
|
285 |
|
123 |
|
124 |
var post_id = faq_element.data( 'post_id' );
|
125 |
|
126 |
+
var params = {};
|
127 |
+
|
128 |
+
params.nonce = ewd_ufaq_php_data.nonce;
|
129 |
+
params.post_id = post_id;
|
130 |
+
params.action = 'ewd_ufaq_record_view';
|
131 |
+
|
132 |
+
var data = jQuery.param( params );
|
133 |
jQuery.post(ajaxurl, data, function(response) {});
|
134 |
|
135 |
faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html( faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html().toUpperCase() );
|
245 |
|
246 |
if (show_on_load == 'No' && Question.length == 0) {jQuery('#ewd-ufaq-ajax-results').html(''); return;}
|
247 |
|
248 |
+
var params = {};
|
249 |
+
|
250 |
+
params.search_string = search_string;
|
251 |
+
params.include_category = include_cat;
|
252 |
+
params.exclude_category = exclude_cat;
|
253 |
+
params.orderby = orderby;
|
254 |
+
params.order = order;
|
255 |
+
params.post_count = post_count;
|
256 |
+
params.request_count = request_count;
|
257 |
+
params.current_url = current_url;
|
258 |
+
params.faqs_only = faqs_only;
|
259 |
+
params.faq_page = faq_page;
|
260 |
+
params.action = 'ewd_ufaq_search';
|
261 |
+
params.nonce = ewd_ufaq_php_data.nonce;
|
262 |
+
|
263 |
+
var data = jQuery.param( params );
|
264 |
+
|
265 |
jQuery.post( ajaxurl, data, function( response ) {
|
266 |
|
267 |
if ( response.data.request_count == request_count ) {
|
299 |
if ( jQuery( this ).hasClass( 'ewd-ufaq-up-vote' ) ) { vote_type = 'up'; }
|
300 |
else { vote_type = 'down'; }
|
301 |
|
302 |
+
var params = {};
|
303 |
+
|
304 |
+
params.action = 'ewd_ufaq_update_rating'
|
305 |
+
params.nonce = ewd_ufaq_php_data.nonce;
|
306 |
+
params.faq_id = faq_id;
|
307 |
+
params.vote_type = vote_type;
|
308 |
+
|
309 |
+
var data = jQuery.param( params );
|
310 |
+
jQuery.post( ajaxurl, data );
|
311 |
});
|
312 |
}
|
313 |
|
ewd-ufaq-templates/faq-answer.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<div class='ewd-ufaq-post-margin ewd-ufaq-faq-post'>
|
2 |
-
<?php echo $this->faq_answer; ?>
|
3 |
</div>
|
1 |
<div class='ewd-ufaq-post-margin ewd-ufaq-faq-post'>
|
2 |
+
<?php echo wp_kses_post( $this->faq_answer ); ?>
|
3 |
</div>
|
ewd-ufaq-templates/faq-author.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php echo esc_html( $this->get_label( 'label-by' ) ); ?>
|
2 |
|
3 |
<span class='ewd-ufaq-author'>
|
4 |
-
<?php echo $this->faq_author; ?>
|
5 |
</span>
|
1 |
<?php echo esc_html( $this->get_label( 'label-by' ) ); ?>
|
2 |
|
3 |
<span class='ewd-ufaq-author'>
|
4 |
+
<?php echo esc_html( $this->faq_author ); ?>
|
5 |
</span>
|
ewd-ufaq-templates/faq-custom-fields.php
CHANGED
@@ -7,11 +7,11 @@
|
|
7 |
<?php if ( $this->get_option( 'hide-blank-fields' ) and ! $value ) { continue; } ?>
|
8 |
|
9 |
<div class='ewd-ufaq-custom-field-label'>
|
10 |
-
<?php echo esc_html( $custom_field->name );
|
11 |
</div>
|
12 |
|
13 |
<div class='ewd-ufaq-custom-field-value'>
|
14 |
-
<?php echo ( is_array( $value ) ? implode( ', ', $value ) : $value ); ?>
|
15 |
</div>
|
16 |
|
17 |
<div class='ewd-ufaq-clear'></div>
|
7 |
<?php if ( $this->get_option( 'hide-blank-fields' ) and ! $value ) { continue; } ?>
|
8 |
|
9 |
<div class='ewd-ufaq-custom-field-label'>
|
10 |
+
<?php echo esc_html( $custom_field->name ); ?>:
|
11 |
</div>
|
12 |
|
13 |
<div class='ewd-ufaq-custom-field-value'>
|
14 |
+
<?php echo wp_kses_post( ( is_array( $value ) ? implode( ', ', $value ) : $value ) ); ?>
|
15 |
</div>
|
16 |
|
17 |
<div class='ewd-ufaq-clear'></div>
|
ewd-ufaq-templates/faq-date.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php echo esc_html( $this->get_label( 'label-on' ) ); ?>
|
2 |
|
3 |
<span class='ewd-ufaq-date'>
|
4 |
-
<?php echo $this->date; ?>
|
5 |
</span>
|
1 |
<?php echo esc_html( $this->get_label( 'label-on' ) ); ?>
|
2 |
|
3 |
<span class='ewd-ufaq-date'>
|
4 |
+
<?php echo esc_html( $this->date ); ?>
|
5 |
</span>
|
ewd-ufaq-templates/faq-permalink.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
<a href='<?php echo esc_attr( $this->permalink ); ?>'>
|
4 |
|
5 |
-
<?php if ( $this->get_option( 'include-permalink' ) == 'both' or $this->get_option( 'include-permalink' ) == 'text' ) { echo $this->get_label( 'label-permalink' ); } ?>
|
6 |
<?php if ( $this->get_option( 'include-permalink' ) == 'both' or $this->get_option( 'include-permalink' ) == 'icon' ) { ?> <div class='ewd-ufaq-permalink-image'></div> <?php } ?>
|
7 |
|
8 |
</a>
|
2 |
|
3 |
<a href='<?php echo esc_attr( $this->permalink ); ?>'>
|
4 |
|
5 |
+
<?php if ( $this->get_option( 'include-permalink' ) == 'both' or $this->get_option( 'include-permalink' ) == 'text' ) { echo esc_html( $this->get_label( 'label-permalink' ) ); } ?>
|
6 |
<?php if ( $this->get_option( 'include-permalink' ) == 'both' or $this->get_option( 'include-permalink' ) == 'icon' ) { ?> <div class='ewd-ufaq-permalink-image'></div> <?php } ?>
|
7 |
|
8 |
</a>
|
ewd-ufaq-templates/faq-preview.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<div class='ewd-ufaq-faq-excerpt'>
|
2 |
-
<?php echo $this->faq_preview; ?>
|
3 |
</div>
|
1 |
<div class='ewd-ufaq-faq-excerpt'>
|
2 |
+
<?php echo wp_kses_post( $this->faq_preview ); ?>
|
3 |
</div>
|
ewd-ufaq-templates/faq-ratings.php
CHANGED
@@ -4,9 +4,9 @@
|
|
4 |
<?php echo esc_html( $this->get_label( 'label-find-faq-helpful' ) ); ?>
|
5 |
</div>
|
6 |
|
7 |
-
<div class='ewd-ufaq-rating-button ewd-ufaq-up-vote <?php echo ( ( $ewd_ufaq_controller->settings->get_setting( 'thumbs-up-image' ) and $ewd_ufaq_controller->settings->get_setting( 'thumbs-up-image' ) != 'http://' ) ? 'ewd-ufaq-ratings-custom-image' : 'ewd-ufaq-ratings-default-image' ); ?>' data-faq_id='<?php echo $this->post->ID; ?>'>
|
8 |
<?php echo $this->get_thumbs_up_image(); ?>
|
9 |
-
<span><?php echo $this->get_up_votes(); ?></span>
|
10 |
</div>
|
11 |
|
12 |
<div class='ewd-ufaq-rating-button ewd-ufaq-down-vote <?php echo ( ( $ewd_ufaq_controller->settings->get_setting( 'thumbs-down-image' ) and $ewd_ufaq_controller->settings->get_setting( 'thumbs-down-image' ) != 'http://' ) ? 'ewd-ufaq-ratings-custom-image' : 'ewd-ufaq-ratings-default-image' ); ?>' data-faq_id='<?php echo $this->post->ID; ?>'>
|
4 |
<?php echo esc_html( $this->get_label( 'label-find-faq-helpful' ) ); ?>
|
5 |
</div>
|
6 |
|
7 |
+
<div class='ewd-ufaq-rating-button ewd-ufaq-up-vote <?php echo ( ( $ewd_ufaq_controller->settings->get_setting( 'thumbs-up-image' ) and $ewd_ufaq_controller->settings->get_setting( 'thumbs-up-image' ) != 'http://' ) ? 'ewd-ufaq-ratings-custom-image' : 'ewd-ufaq-ratings-default-image' ); ?>' data-faq_id='<?php echo esc_attr( $this->post->ID ); ?>'>
|
8 |
<?php echo $this->get_thumbs_up_image(); ?>
|
9 |
+
<span><?php echo esc_html( $this->get_up_votes() ); ?></span>
|
10 |
</div>
|
11 |
|
12 |
<div class='ewd-ufaq-rating-button ewd-ufaq-down-vote <?php echo ( ( $ewd_ufaq_controller->settings->get_setting( 'thumbs-down-image' ) and $ewd_ufaq_controller->settings->get_setting( 'thumbs-down-image' ) != 'http://' ) ? 'ewd-ufaq-ratings-custom-image' : 'ewd-ufaq-ratings-default-image' ); ?>' data-faq_id='<?php echo $this->post->ID; ?>'>
|
ewd-ufaq-templates/faq-title.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
|
3 |
<a class='ewd-ufaq-post-margin' href='<?php echo esc_attr( $this->get_anchor_permalink() ); ?>'>
|
4 |
|
5 |
-
<div class='ewd-ufaq-post-margin-symbol <?php echo $this->get_color_block_shape(); ?>'>
|
6 |
<span ><?php echo $this->get_toggle_symbol(); ?></span>
|
7 |
</div>
|
8 |
|
9 |
<div class='ewd-ufaq-faq-title-text'>
|
10 |
|
11 |
<<?php echo $this->get_option( 'styling-faq-heading-type' ); ?>>
|
12 |
-
<?php echo $this->faq_title; ?>
|
13 |
</<?php echo $this->get_option( 'styling-faq-heading-type' ); ?>>
|
14 |
|
15 |
</div>
|
2 |
|
3 |
<a class='ewd-ufaq-post-margin' href='<?php echo esc_attr( $this->get_anchor_permalink() ); ?>'>
|
4 |
|
5 |
+
<div class='ewd-ufaq-post-margin-symbol <?php echo esc_attr( $this->get_color_block_shape() ); ?>'>
|
6 |
<span ><?php echo $this->get_toggle_symbol(); ?></span>
|
7 |
</div>
|
8 |
|
9 |
<div class='ewd-ufaq-faq-title-text'>
|
10 |
|
11 |
<<?php echo $this->get_option( 'styling-faq-heading-type' ); ?>>
|
12 |
+
<?php echo wp_kses_post( $this->faq_title ); ?>
|
13 |
</<?php echo $this->get_option( 'styling-faq-heading-type' ); ?>>
|
14 |
|
15 |
</div>
|
ewd-ufaq-templates/faq.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div <?php echo ewd_format_classes( $this->classes ); ?> id='<?php echo $this->get_id(); ?>' data-post_id='<?php echo $this->post->ID; ?>'>
|
2 |
|
3 |
<?php $this->print_faq_title(); ?>
|
4 |
|
1 |
+
<div <?php echo ewd_format_classes( $this->classes ); ?> id='<?php echo esc_attr( $this->get_id() ); ?>' data-post_id='<?php echo esc_attr( $this->post->ID ); ?>'>
|
2 |
|
3 |
<?php $this->print_faq_title(); ?>
|
4 |
|
ewd-ufaq-templates/submit-faq-captcha.php
CHANGED
@@ -6,6 +6,6 @@
|
|
6 |
|
7 |
</div>
|
8 |
|
9 |
-
<div class='ewd-ufaq-captcha-response'><label for='captcha_text'><?php echo $this->get_label( 'label-captcha-image-number' ); ?>: </label>
|
10 |
<input type='text' name='ewd_ufaq_captcha' value='' />
|
11 |
</div>
|
6 |
|
7 |
</div>
|
8 |
|
9 |
+
<div class='ewd-ufaq-captcha-response'><label for='captcha_text'><?php echo esc_html( $this->get_label( 'label-captcha-image-number' ) ); ?>: </label>
|
10 |
<input type='text' name='ewd_ufaq_captcha' value='' />
|
11 |
</div>
|
ewd-ufaq-templates/submit-faq-custom-field-checkbox.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
<?php foreach ( $this->get_custom_field_options() as $option ) { ?>
|
12 |
|
13 |
<div class='ewd-ufaq-submit-faq-radio-checkbox-each'>
|
14 |
-
<input type='checkbox' name='<?php echo esc_attr( $input_name ); ?>[]' value='<?php echo $option; ?>' <?php echo ( ( ! empty( $_POST[ $input_name ] ) and is_array( $_POST[ $input_name ] ) and in_array( $option, $_POST[ $input_name ] ) ) ? 'checked' : '' ); ?>/><?php echo $option; ?>
|
15 |
</div>
|
16 |
|
17 |
<?php } ?>
|
11 |
<?php foreach ( $this->get_custom_field_options() as $option ) { ?>
|
12 |
|
13 |
<div class='ewd-ufaq-submit-faq-radio-checkbox-each'>
|
14 |
+
<input type='checkbox' name='<?php echo esc_attr( $input_name ); ?>[]' value='<?php echo $option; ?>' <?php echo ( ( ! empty( $_POST[ $input_name ] ) and is_array( $_POST[ $input_name ] ) and in_array( $option, $_POST[ $input_name ] ) ) ? 'checked' : '' ); ?>/><?php echo esc_html( $option ); ?>
|
15 |
</div>
|
16 |
|
17 |
<?php } ?>
|
ewd-ufaq-templates/submit-faq-custom-field-radio.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
<?php foreach ( $this->get_custom_field_options() as $option ) { ?>
|
12 |
|
13 |
<div class='ewd-ufaq-submit-faq-radio-checkbox-each'>
|
14 |
-
<input type='radio' name='<?php echo esc_attr( $input_name ); ?>' value='<?php echo $option; ?>' <?php echo ( ! empty( $_POST[ $input_name ] ) and $option == $_POST[ $input_name ] ? 'checked' : '' ); ?>/><?php echo $option; ?>
|
15 |
</div>
|
16 |
|
17 |
<?php } ?>
|
11 |
<?php foreach ( $this->get_custom_field_options() as $option ) { ?>
|
12 |
|
13 |
<div class='ewd-ufaq-submit-faq-radio-checkbox-each'>
|
14 |
+
<input type='radio' name='<?php echo esc_attr( $input_name ); ?>' value='<?php echo esc_attr( $option ); ?>' <?php echo ( ! empty( $_POST[ $input_name ] ) and $option == $_POST[ $input_name ] ? 'checked' : '' ); ?>/><?php echo esc_html( $option ); ?>
|
15 |
</div>
|
16 |
|
17 |
<?php } ?>
|
ewd-ufaq-templates/submit-faq-custom-field-select.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
<select name='<?php echo esc_attr( $input_name ); ?>' >
|
10 |
|
11 |
<?php foreach ( $this->get_custom_field_options() as $option ) { ?>
|
12 |
-
<option value='<?php echo $option; ?>' <?php echo ( ! empty( $_POST[ $input_name ] ) and $option == $_POST[ $input_name ] ? 'selected' : '' ); ?>><?php echo $option; ?></option>
|
13 |
<?php } ?>
|
14 |
|
15 |
</select>
|
9 |
<select name='<?php echo esc_attr( $input_name ); ?>' >
|
10 |
|
11 |
<?php foreach ( $this->get_custom_field_options() as $option ) { ?>
|
12 |
+
<option value='<?php echo esc_attr( $option ); ?>' <?php echo ( ! empty( $_POST[ $input_name ] ) and $option == $_POST[ $input_name ] ? 'selected' : '' ); ?>><?php echo esc_html( $option ); ?></option>
|
13 |
<?php } ?>
|
14 |
|
15 |
</select>
|
ewd-ufaq-templates/submit-faq-submitted-faq-message.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
<div class='ewd-ufaq-update'>
|
2 |
-
<?php echo $this->update_message; ?>
|
3 |
</div>
|
1 |
<div class='ewd-ufaq-update'>
|
2 |
+
<?php echo wp_kses_post( $this->update_message ); ?>
|
3 |
</div>
|
includes/Ajax.class.php
CHANGED
@@ -29,7 +29,11 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
29 |
*/
|
30 |
public function return_search_results() {
|
31 |
global $ewd_ufaq_controller;
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
$faq_atts = array(
|
34 |
'is_search' => 1,
|
35 |
'search_string' => '',
|
@@ -95,14 +99,18 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
95 |
public function record_view() {
|
96 |
global $wpdb;
|
97 |
|
98 |
-
|
|
|
|
|
|
|
|
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
|
105 |
-
|
106 |
}
|
107 |
|
108 |
/**
|
@@ -111,27 +119,32 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
111 |
*/
|
112 |
public function update_rating() {
|
113 |
|
|
|
|
|
|
|
|
|
114 |
$faq_id = is_numeric( $_POST['faq_id'] ) ? intval( $_POST['faq_id'] ) : 0;
|
115 |
-
|
116 |
|
117 |
-
|
118 |
|
119 |
-
|
120 |
-
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
if ( $vote_type == 'down' ) {
|
126 |
|
127 |
-
|
128 |
-
update_post_meta( $faq_id, 'FAQ_Down_Votes', $down_votes + 1 );
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
}
|
133 |
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
/**
|
@@ -141,6 +154,14 @@ if ( !class_exists( 'ewdufaqAJAX' ) ) {
|
|
141 |
public function update_order() {
|
142 |
global $ewd_ufaq_controller;
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
if ( ! is_array( $_POST['ewd-ufaq-item'] ) or ! $ewd_ufaq_controller->permissions->check_permission( 'ordering' ) ) { return; }
|
145 |
|
146 |
foreach ( $_POST['ewd-ufaq-item'] as $key => $id ) {
|
29 |
*/
|
30 |
public function return_search_results() {
|
31 |
global $ewd_ufaq_controller;
|
32 |
+
|
33 |
+
if ( !check_ajax_referer( 'ewd-ufaq-js', 'nonce' ) ) {
|
34 |
+
ewdUfaqHelper::bad_nonce_ajax();
|
35 |
+
}
|
36 |
+
|
37 |
$faq_atts = array(
|
38 |
'is_search' => 1,
|
39 |
'search_string' => '',
|
99 |
public function record_view() {
|
100 |
global $wpdb;
|
101 |
|
102 |
+
if ( !check_ajax_referer( 'ewd-ufaq-js', 'nonce' ) ) {
|
103 |
+
ewdUfaqHelper::bad_nonce_ajax();
|
104 |
+
}
|
105 |
+
|
106 |
+
$post_id = intval( $_POST['post_id'] );
|
107 |
|
108 |
+
$meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key='ufaq_view_count'", $post_id ) );
|
109 |
+
|
110 |
+
if ( $meta_id != '' and $meta_id != 0 ) { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value=meta_value+1 WHERE post_id=%d AND meta_key='ufaq_view_count'", $post_id ) ); }
|
111 |
+
else { $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES (%d,'ufaq_view_count','1')", $post_id ) ); }
|
112 |
|
113 |
+
die();
|
114 |
}
|
115 |
|
116 |
/**
|
119 |
*/
|
120 |
public function update_rating() {
|
121 |
|
122 |
+
if ( !check_ajax_referer( 'ewd-ufaq-js', 'nonce' ) ) {
|
123 |
+
ewdUfaqHelper::bad_nonce_ajax();
|
124 |
+
}
|
125 |
+
|
126 |
$faq_id = is_numeric( $_POST['faq_id'] ) ? intval( $_POST['faq_id'] ) : 0;
|
127 |
+
$vote_type = sanitize_text_field( $_POST['vote_type'] );
|
128 |
|
129 |
+
if ( $vote_type == 'up' ) {
|
130 |
|
131 |
+
$up_votes = absint( get_post_meta( $faq_id, 'FAQ_Up_Votes', false ) );
|
132 |
+
update_post_meta( $faq_id, 'FAQ_Up_Votes', $up_votes + 1 );
|
133 |
|
134 |
+
$total_score = absint( get_post_meta( $faq_id, 'FAQ_Total_Score', false ) );
|
135 |
+
update_post_meta( $faq_id, 'FAQ_Total_Score', $total_score + 1 );
|
136 |
+
}
|
|
|
137 |
|
138 |
+
if ( $vote_type == 'down' ) {
|
|
|
139 |
|
140 |
+
$down_votes = absint( get_post_meta( $faq_id, 'FAQ_Down_Votes', false ) );
|
141 |
+
update_post_meta( $faq_id, 'FAQ_Down_Votes', $down_votes + 1 );
|
|
|
142 |
|
143 |
+
$total_score = absint( get_post_meta( $faq_id, 'FAQ_Total_Score', false ) );
|
144 |
+
update_post_meta( $faq_id, 'FAQ_Total_Score', $total_score - 1 );
|
145 |
+
}
|
146 |
+
|
147 |
+
die();
|
148 |
}
|
149 |
|
150 |
/**
|
154 |
public function update_order() {
|
155 |
global $ewd_ufaq_controller;
|
156 |
|
157 |
+
if (
|
158 |
+
! check_ajax_referer( 'ewd-ufaq-admin-js', 'nonce' )
|
159 |
+
||
|
160 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
161 |
+
) {
|
162 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
163 |
+
}
|
164 |
+
|
165 |
if ( ! is_array( $_POST['ewd-ufaq-item'] ) or ! $ewd_ufaq_controller->permissions->check_permission( 'ordering' ) ) { return; }
|
166 |
|
167 |
foreach ( $_POST['ewd-ufaq-item'] as $key => $id ) {
|
includes/CustomPostTypes.class.php
CHANGED
@@ -210,7 +210,7 @@ class ewdufaqCustomPostTypes {
|
|
210 |
|
211 |
?>
|
212 |
|
213 |
-
<input type="hidden" name="ewd_ufaq_nonce" value="<?php echo $this->nonce; ?>">
|
214 |
|
215 |
<div class='ewd-ufaq-meta-field'>
|
216 |
<label for='Post_Author'>
|
210 |
|
211 |
?>
|
212 |
|
213 |
+
<input type="hidden" name="ewd_ufaq_nonce" value="<?php echo esc_attr($this->nonce); ?>">
|
214 |
|
215 |
<div class='ewd-ufaq-meta-field'>
|
216 |
<label for='Post_Author'>
|
includes/Dashboard.class.php
CHANGED
@@ -14,9 +14,6 @@ class ewdufaqDashboard {
|
|
14 |
|
15 |
public function __construct() {
|
16 |
add_action( 'admin_menu', array( $this, 'add_dashboard_to_menu' ), 99 );
|
17 |
-
|
18 |
-
add_action( 'wp_ajax_ewd_ufaq_hide_upgrade_box', array($this, 'hide_upgrade_box') );
|
19 |
-
add_action( 'wp_ajax_ewd_ufaq_display_upgrade_box', array($this, 'display_upgrade_box') );
|
20 |
}
|
21 |
|
22 |
public function add_dashboard_to_menu() {
|
@@ -136,8 +133,8 @@ class ewdufaqDashboard {
|
|
136 |
else {
|
137 |
foreach ( $faqs as $faq ) { ?>
|
138 |
<tr>
|
139 |
-
<td><a href='post.php?post=<?php echo $faq->ID;?>&action=edit'><?php echo $faq->post_title; ?></a></td>
|
140 |
-
<td><?php echo get_post_meta( $faq->ID, 'ufaq_view_count', true ); ?></td>
|
141 |
<td><?php echo get_the_term_list( $faq->ID, EWD_UFAQ_FAQ_CATEGORY_TAXONOMY ); ?></td>
|
142 |
</tr>
|
143 |
<?php }
|
@@ -295,13 +292,6 @@ class ewdufaqDashboard {
|
|
295 |
|
296 |
<?php }
|
297 |
|
298 |
-
public function display_notice() {
|
299 |
-
if ( $this->status ) {
|
300 |
-
echo "<div class='updated'><p>" . $this->message . "</p></div>";
|
301 |
-
}
|
302 |
-
else {
|
303 |
-
echo "<div class='error'><p>" . $this->message . "</p></div>";
|
304 |
-
}
|
305 |
-
}
|
306 |
}
|
|
|
307 |
} // endif
|
14 |
|
15 |
public function __construct() {
|
16 |
add_action( 'admin_menu', array( $this, 'add_dashboard_to_menu' ), 99 );
|
|
|
|
|
|
|
17 |
}
|
18 |
|
19 |
public function add_dashboard_to_menu() {
|
133 |
else {
|
134 |
foreach ( $faqs as $faq ) { ?>
|
135 |
<tr>
|
136 |
+
<td><a href='post.php?post=<?php echo esc_attr( $faq->ID );?>&action=edit'><?php echo esc_html( $faq->post_title ); ?></a></td>
|
137 |
+
<td><?php echo esc_html( get_post_meta( $faq->ID, 'ufaq_view_count', true ) ); ?></td>
|
138 |
<td><?php echo get_the_term_list( $faq->ID, EWD_UFAQ_FAQ_CATEGORY_TAXONOMY ); ?></td>
|
139 |
</tr>
|
140 |
<?php }
|
292 |
|
293 |
<?php }
|
294 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
}
|
296 |
+
|
297 |
} // endif
|
includes/FAQ.class.php
CHANGED
@@ -193,7 +193,7 @@ class ewdufaqFAQ {
|
|
193 |
$this->faq_author = empty( $_POST['post_author'] ) ? false : sanitize_text_field( $_POST['post_author'] );
|
194 |
|
195 |
// AUTHOR EMAIL
|
196 |
-
$this->faq_author_email = empty( $_POST['post_author_email'] ) ? false :
|
197 |
|
198 |
// ANSWER
|
199 |
if ( $ewd_ufaq_controller->settings->get_setting( 'allow-proposed-answer' ) ) {
|
193 |
$this->faq_author = empty( $_POST['post_author'] ) ? false : sanitize_text_field( $_POST['post_author'] );
|
194 |
|
195 |
// AUTHOR EMAIL
|
196 |
+
$this->faq_author_email = empty( $_POST['post_author_email'] ) ? false : sanitize_email( $_POST['post_author_email'] );
|
197 |
|
198 |
// ANSWER
|
199 |
if ( $ewd_ufaq_controller->settings->get_setting( 'allow-proposed-answer' ) ) {
|
includes/Helper.class.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
3 |
+
|
4 |
+
if ( !class_exists( 'rtbHelper' ) ) {
|
5 |
+
/**
|
6 |
+
* Class to to provide helpe functions
|
7 |
+
*
|
8 |
+
* @since 2.1.1
|
9 |
+
*/
|
10 |
+
class ewdUfaqHelper {
|
11 |
+
|
12 |
+
// Hold the class instance.
|
13 |
+
private static $instance = null;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* The constructor is private
|
17 |
+
* to prevent initiation with outer code.
|
18 |
+
*
|
19 |
+
**/
|
20 |
+
private function __construct() {}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* The object is created from within the class itself
|
24 |
+
* only if the class has no instance.
|
25 |
+
*/
|
26 |
+
public static function getInstance()
|
27 |
+
{
|
28 |
+
if (self::$instance == null)
|
29 |
+
{
|
30 |
+
self::$instance = new rtbHelper();
|
31 |
+
}
|
32 |
+
|
33 |
+
return self::$instance;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Handle ajax requests in admin area for logged out users
|
38 |
+
* @since 2.1.1
|
39 |
+
*/
|
40 |
+
public static function admin_nopriv_ajax() {
|
41 |
+
|
42 |
+
wp_send_json_error(
|
43 |
+
array(
|
44 |
+
'error' => 'loggedout',
|
45 |
+
'msg' => sprintf( __( 'You have been logged out. Please %slogin again%s.', 'ultimate-faqs' ), '<a href="' . wp_login_url( admin_url( 'admin.php?page=ewd-ufaq-dashboard' ) ) . '">', '</a>' ),
|
46 |
+
)
|
47 |
+
);
|
48 |
+
}
|
49 |
+
|
50 |
+
public static function bad_nonce_ajax()
|
51 |
+
{
|
52 |
+
wp_send_json_error(
|
53 |
+
array(
|
54 |
+
'error' => 'badnonce',
|
55 |
+
'msg' => __( 'The request has been rejected because it does not appear to have come from this site.', 'ultimate-faqs' ),
|
56 |
+
)
|
57 |
+
);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
includes/InstallationWalkthrough.class.php
CHANGED
@@ -72,34 +72,56 @@ class ewdufaqInstallationWalkthrough {
|
|
72 |
* @since 2.0.0
|
73 |
*/
|
74 |
public function create_category() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
$category_name = isset( $_POST['category_name'] ) ? sanitize_text_field( $_POST['category_name'] ) : '';
|
77 |
-
|
78 |
|
79 |
-
|
80 |
|
81 |
-
|
82 |
|
83 |
-
|
84 |
}
|
85 |
|
86 |
public function create_faq() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
$args = array(
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
/**
|
@@ -107,17 +129,26 @@ class ewdufaqInstallationWalkthrough {
|
|
107 |
* @since 2.0.0
|
108 |
*/
|
109 |
public function add_faqs_page() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
$args = array(
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
}
|
122 |
|
123 |
/**
|
@@ -125,17 +156,34 @@ class ewdufaqInstallationWalkthrough {
|
|
125 |
* @since 2.0.0
|
126 |
*/
|
127 |
public function set_options() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
$ewd_ufaq_options = get_option( 'ewd-ufaq-settings' );
|
130 |
|
131 |
-
if ( isset( $_POST['faq_accordion'] ) ) {
|
132 |
-
|
133 |
-
|
134 |
-
if ( isset( $_POST['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
update_option( 'ewd-ufaq-settings', $ewd_ufaq_options );
|
137 |
-
|
138 |
-
|
139 |
}
|
140 |
|
141 |
/**
|
@@ -154,6 +202,14 @@ class ewdufaqInstallationWalkthrough {
|
|
154 |
wp_enqueue_script( 'ewd-ufaq-getting-started', EWD_UFAQ_PLUGIN_URL . '/assets/js/ewd-ufaq-welcome-screen.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
155 |
wp_enqueue_script( 'ewd-ufaq-admin-settings-js', EWD_UFAQ_PLUGIN_URL . '/lib/simple-admin-pages/js/admin-settings.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
156 |
wp_enqueue_script( 'ewd-ufaq-admin-spectrum-js', EWD_UFAQ_PLUGIN_URL . '/lib/simple-admin-pages/js/spectrum.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
|
159 |
/**
|
72 |
* @since 2.0.0
|
73 |
*/
|
74 |
public function create_category() {
|
75 |
+
global $ewd_ufaq_controller;
|
76 |
+
|
77 |
+
if (
|
78 |
+
! check_ajax_referer( 'ewd-ufaq-getting-started', 'nonce' )
|
79 |
+
||
|
80 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
81 |
+
) {
|
82 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
83 |
+
}
|
84 |
|
85 |
$category_name = isset( $_POST['category_name'] ) ? sanitize_text_field( $_POST['category_name'] ) : '';
|
86 |
+
$category_description = isset( $_POST['category_description'] ) ? sanitize_textarea_field( $_POST['category_description'] ) : '';
|
87 |
|
88 |
+
$category_term_id = wp_insert_term( $category_name, EWD_UFAQ_FAQ_CATEGORY_TAXONOMY, array('description' => $category_description) );
|
89 |
|
90 |
+
echo json_encode ( array( 'category_name' => $category_name, 'category_id' => $category_term_id['term_id'] ) );
|
91 |
|
92 |
+
exit();
|
93 |
}
|
94 |
|
95 |
public function create_faq() {
|
96 |
+
global $ewd_ufaq_controller;
|
97 |
+
|
98 |
+
if (
|
99 |
+
! check_ajax_referer( 'ewd-ufaq-getting-started', 'nonce' )
|
100 |
+
||
|
101 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
102 |
+
) {
|
103 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
104 |
+
}
|
105 |
|
106 |
$args = array(
|
107 |
+
'post_title' => isset( $_POST['faq_question'] ) ? sanitize_text_field( $_POST['faq_question'] ) : '',
|
108 |
+
'post_content' => isset( $_POST['faq_answer'] ) ? sanitize_text_field( $_POST['faq_answer'] ) : '',
|
109 |
+
'post_status' => 'publish',
|
110 |
+
'post_type' => EWD_UFAQ_FAQ_POST_TYPE
|
111 |
+
);
|
112 |
+
|
113 |
+
$faq_post_id = wp_insert_post( $args );
|
114 |
+
|
115 |
+
if ( isset( $_POST['faq_category'] ) and $_POST['faq_category'] ) {
|
116 |
+
|
117 |
+
wp_set_post_terms(
|
118 |
+
$faq_post_id,
|
119 |
+
sanitize_text_field( $_POST['faq_category'] ),
|
120 |
+
EWD_UFAQ_FAQ_CATEGORY_TAXONOMY
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
exit();
|
125 |
}
|
126 |
|
127 |
/**
|
129 |
* @since 2.0.0
|
130 |
*/
|
131 |
public function add_faqs_page() {
|
132 |
+
global $ewd_ufaq_controller;
|
133 |
+
|
134 |
+
if (
|
135 |
+
! check_ajax_referer( 'ewd-ufaq-getting-started', 'nonce' )
|
136 |
+
||
|
137 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
138 |
+
) {
|
139 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
140 |
+
}
|
141 |
|
142 |
$args = array(
|
143 |
+
'post_title' => isset($_POST['faq_page_title'] ) ? sanitize_text_field( $_POST['faq_page_title'] ) : '',
|
144 |
+
'post_content' => '<!-- wp:paragraph --><p> [ultimate-faqs] </p><!-- /wp:paragraph -->',
|
145 |
+
'post_status' => 'publish',
|
146 |
+
'post_type' => 'page'
|
147 |
+
);
|
148 |
+
|
149 |
+
wp_insert_post( $args );
|
150 |
+
|
151 |
+
exit();
|
152 |
}
|
153 |
|
154 |
/**
|
156 |
* @since 2.0.0
|
157 |
*/
|
158 |
public function set_options() {
|
159 |
+
global $ewd_ufaq_controller;
|
160 |
+
|
161 |
+
if (
|
162 |
+
! check_ajax_referer( 'ewd-ufaq-getting-started', 'nonce' )
|
163 |
+
||
|
164 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
165 |
+
) {
|
166 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
167 |
+
}
|
168 |
|
169 |
$ewd_ufaq_options = get_option( 'ewd-ufaq-settings' );
|
170 |
|
171 |
+
if ( isset( $_POST['faq_accordion'] ) ) {
|
172 |
+
$ewd_ufaq_options['faq-accordion'] = intval( $_POST['faq_accordion'] );
|
173 |
+
}
|
174 |
+
if ( isset( $_POST['disable_faq_toggle'] ) ) {
|
175 |
+
$ewd_ufaq_options['disable-faq-toggle'] = intval( $_POST['disable_faq_toggle'] );
|
176 |
+
}
|
177 |
+
if ( isset( $_POST['group_by_category'] ) ) {
|
178 |
+
$ewd_ufaq_options['group-by-category'] = intval( $_POST['group_by_category'] );
|
179 |
+
}
|
180 |
+
if ( isset( $_POST['order_by_setting'] ) ) {
|
181 |
+
$ewd_ufaq_options['faq-order-by'] = sanitize_text_field( $_POST['order_by_setting'] );
|
182 |
+
}
|
183 |
|
184 |
update_option( 'ewd-ufaq-settings', $ewd_ufaq_options );
|
185 |
+
|
186 |
+
exit();
|
187 |
}
|
188 |
|
189 |
/**
|
202 |
wp_enqueue_script( 'ewd-ufaq-getting-started', EWD_UFAQ_PLUGIN_URL . '/assets/js/ewd-ufaq-welcome-screen.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
203 |
wp_enqueue_script( 'ewd-ufaq-admin-settings-js', EWD_UFAQ_PLUGIN_URL . '/lib/simple-admin-pages/js/admin-settings.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
204 |
wp_enqueue_script( 'ewd-ufaq-admin-spectrum-js', EWD_UFAQ_PLUGIN_URL . '/lib/simple-admin-pages/js/spectrum.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
205 |
+
|
206 |
+
wp_localize_script(
|
207 |
+
'ewd-ufaq-getting-started',
|
208 |
+
'ewd_ufaq_getting_started',
|
209 |
+
array(
|
210 |
+
'nonce' => wp_create_nonce( 'ewd-ufaq-getting-started' )
|
211 |
+
)
|
212 |
+
);
|
213 |
}
|
214 |
|
215 |
/**
|
includes/OrderingTable.class.php
CHANGED
@@ -85,7 +85,7 @@ class ewdufaqOrderingTable {
|
|
85 |
<?php $faq_categories = get_the_term_list($faq->ID, 'ufaq-category', '', ', ', ''); ?>
|
86 |
<?php $faq_tags = get_the_term_list($faq->ID, 'ufaq-tag', '', ', ', ''); ?>
|
87 |
|
88 |
-
<tr id='ewd-ufaq-item-<?php echo $faq->ID; ?>' class='ewd-ufaq-item'>
|
89 |
<td class='ewd-ufaq-title'><?php echo esc_html( $faq->post_title ); ?></td>
|
90 |
<td class='ewd-ufaq-title'><?php echo esc_html( $faq_views ); ?></td>
|
91 |
<td class='ewd-ufaq-title'><?php echo esc_html( strip_tags( $faq_categories ) ); ?></td>
|
85 |
<?php $faq_categories = get_the_term_list($faq->ID, 'ufaq-category', '', ', ', ''); ?>
|
86 |
<?php $faq_tags = get_the_term_list($faq->ID, 'ufaq-tag', '', ', ', ''); ?>
|
87 |
|
88 |
+
<tr id='ewd-ufaq-item-<?php echo esc_attr( $faq->ID ); ?>' class='ewd-ufaq-item'>
|
89 |
<td class='ewd-ufaq-title'><?php echo esc_html( $faq->post_title ); ?></td>
|
90 |
<td class='ewd-ufaq-title'><?php echo esc_html( $faq_views ); ?></td>
|
91 |
<td class='ewd-ufaq-title'><?php echo esc_html( strip_tags( $faq_categories ) ); ?></td>
|
includes/ReviewAsk.class.php
CHANGED
@@ -73,28 +73,55 @@ class ewdufaqReviewAsk {
|
|
73 |
public function enqueue_review_ask_scripts() {
|
74 |
wp_enqueue_style( 'ewd-ufaq-review-ask-css', EWD_UFAQ_PLUGIN_URL . '/assets/css/dashboard-review-ask.css' );
|
75 |
wp_enqueue_script( 'ewd-ufaq-review-ask-js', EWD_UFAQ_PLUGIN_URL . '/assets/js/dashboard-review-ask.js', array( 'jquery' ), EWD_UFAQ_VERSION, true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
public function hide_review_ask() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
$ask_review_time = sanitize_text_field($_POST['ask_review_time']);
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
|
86 |
-
|
87 |
}
|
88 |
|
89 |
public function send_feedback() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
$headers = 'Content-type: text/html;charset=utf-8' . "\r\n";
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
98 |
}
|
99 |
}
|
100 |
|
73 |
public function enqueue_review_ask_scripts() {
|
74 |
wp_enqueue_style( 'ewd-ufaq-review-ask-css', EWD_UFAQ_PLUGIN_URL . '/assets/css/dashboard-review-ask.css' );
|
75 |
wp_enqueue_script( 'ewd-ufaq-review-ask-js', EWD_UFAQ_PLUGIN_URL . '/assets/js/dashboard-review-ask.js', array( 'jquery' ), EWD_UFAQ_VERSION, true );
|
76 |
+
|
77 |
+
wp_localize_script(
|
78 |
+
'ewd-ufaq-review-ask-js',
|
79 |
+
'ewd_ufaq_review_ask',
|
80 |
+
array(
|
81 |
+
'nonce' => wp_create_nonce( 'ewd-ufaq-review-ask-js' )
|
82 |
+
)
|
83 |
+
);
|
84 |
}
|
85 |
|
86 |
public function hide_review_ask() {
|
87 |
+
global $ewd_ufaq_controller;
|
88 |
+
|
89 |
+
if (
|
90 |
+
! check_ajax_referer( 'ewd-ufaq-review-ask-js', 'nonce' )
|
91 |
+
||
|
92 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
93 |
+
) {
|
94 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
95 |
+
}
|
96 |
|
97 |
$ask_review_time = sanitize_text_field($_POST['ask_review_time']);
|
98 |
|
99 |
+
if ( get_option( 'ewd-ufaq-review-ask-time' ) < time() + 3600*24 * $ask_review_time ) {
|
100 |
+
update_option( 'ewd-ufaq-review-ask-time', time() + 3600*24 * $ask_review_time );
|
101 |
+
}
|
102 |
|
103 |
+
die();
|
104 |
}
|
105 |
|
106 |
public function send_feedback() {
|
107 |
+
global $ewd_ufaq_controller;
|
108 |
+
|
109 |
+
if (
|
110 |
+
! check_ajax_referer( 'ewd-ufaq-review-ask-js', 'nonce' )
|
111 |
+
||
|
112 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
113 |
+
) {
|
114 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
115 |
+
}
|
116 |
+
|
117 |
$headers = 'Content-type: text/html;charset=utf-8' . "\r\n";
|
118 |
+
$feedback = sanitize_text_field( $_POST['feedback'] );
|
119 |
+
$feedback .= '<br /><br />Email Address: ';
|
120 |
+
$feedback .= sanitize_email( $_POST['email_address'] );
|
121 |
|
122 |
+
wp_mail('contact@etoilewebdesign.com', 'UFAQ Feedback - Dashboard Form', $feedback, $headers);
|
123 |
|
124 |
+
die();
|
125 |
}
|
126 |
}
|
127 |
|
includes/Widgets.class.php
CHANGED
@@ -60,10 +60,12 @@ class ewdufaqFAQPostListWidget extends WP_Widget {
|
|
60 |
*/
|
61 |
public function widget( $args, $instance ) {
|
62 |
|
63 |
-
echo $args['before_widget'];
|
64 |
-
if ( $instance['faq_title'] != '' ) {
|
|
|
|
|
65 |
echo do_shortcode( "[select-faq faq_id='". $instance['faq_id'] . "' no_comments='Yes']" );
|
66 |
-
echo $args['after_widget'];
|
67 |
}
|
68 |
|
69 |
/**
|
@@ -79,12 +81,14 @@ class ewdufaqFAQPostListWidget extends WP_Widget {
|
|
79 |
?>
|
80 |
|
81 |
<p>
|
82 |
-
<label for="<?php echo $this->get_field_id( 'faq_id' ); ?>"
|
83 |
-
|
|
|
|
|
84 |
</p>
|
85 |
<p>
|
86 |
-
<label for="<?php echo $this->get_field_id( 'faq_title' ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
87 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'faq_title' ); ?>" name="<?php echo $this->get_field_name( 'faq_title' ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
88 |
</p>
|
89 |
|
90 |
<?php
|
@@ -128,10 +132,14 @@ class ewdufaqRecentFAQsWidget extends WP_Widget {
|
|
128 |
*/
|
129 |
public function widget( $args, $instance ) {
|
130 |
|
131 |
-
echo $args['before_widget'];
|
132 |
-
if ( $instance['faq_title'] != '' ) {
|
|
|
|
|
|
|
|
|
133 |
echo do_shortcode( "[recent-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']" );
|
134 |
-
echo $args['after_widget'];
|
135 |
}
|
136 |
|
137 |
/**
|
@@ -147,12 +155,12 @@ class ewdufaqRecentFAQsWidget extends WP_Widget {
|
|
147 |
?>
|
148 |
|
149 |
<p>
|
150 |
-
<label for="<?php echo $this->get_field_id( 'post_count' ); ?>"><?php _e( 'Number of FAQs:', 'ultimate-faqs' ); ?></label>
|
151 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'post_count' ); ?>" name="<?php echo $this->get_field_name( 'post_count' ); ?>" type="text" value="<?php echo esc_attr( $post_count ); ?>">
|
152 |
</p>
|
153 |
<p>
|
154 |
-
<label for="<?php echo $this->get_field_id( 'faq_title' ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
155 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'faq_title' ); ?>" name="<?php echo $this->get_field_name( 'faq_title' ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
156 |
</p>
|
157 |
|
158 |
<?php
|
@@ -196,10 +204,14 @@ class ewdufaqPopularFAQsWidget extends WP_Widget {
|
|
196 |
*/
|
197 |
public function widget( $args, $instance ) {
|
198 |
|
199 |
-
echo $args['before_widget'];
|
200 |
-
if ( $instance['faq_title'] != '' ) {
|
|
|
|
|
|
|
|
|
201 |
echo do_shortcode( "[popular-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']" );
|
202 |
-
echo $args['after_widget'];
|
203 |
}
|
204 |
|
205 |
/**
|
@@ -215,12 +227,12 @@ class ewdufaqPopularFAQsWidget extends WP_Widget {
|
|
215 |
?>
|
216 |
|
217 |
<p>
|
218 |
-
<label for="<?php echo $this->get_field_id( 'post_count' ); ?>"><?php _e( 'Number of FAQs:', 'ultimate-faqs' ); ?></label>
|
219 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'post_count' ); ?>" name="<?php echo $this->get_field_name( 'post_count' ); ?>" type="text" value="<?php echo esc_attr( $post_count ); ?>">
|
220 |
</p>
|
221 |
<p>
|
222 |
-
<label for="<?php echo $this->get_field_id( 'faq_title' ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
223 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'faq_title' ); ?>" name="<?php echo $this->get_field_name( 'faq_title' ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
224 |
</p>
|
225 |
|
226 |
<?php
|
@@ -273,10 +285,14 @@ class ewdufaqRandomFAQsWidget extends WP_Widget {
|
|
273 |
$faqs = get_posts( $args );
|
274 |
$faq = reset( $faqs );
|
275 |
|
276 |
-
echo $args['before_widget'];
|
277 |
-
if ($instance['faq_title'] != "") {
|
|
|
|
|
|
|
|
|
278 |
echo do_shortcode( "[select-faq faq_id='". $faq->ID . "' no_comments='Yes']" );
|
279 |
-
echo $args['after_widget'];
|
280 |
}
|
281 |
|
282 |
/**
|
@@ -291,8 +307,8 @@ class ewdufaqRandomFAQsWidget extends WP_Widget {
|
|
291 |
?>
|
292 |
|
293 |
<p>
|
294 |
-
<label for="<?php echo $this->get_field_id( 'faq_title' ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
295 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'faq_title' ); ?>" name="<?php echo $this->get_field_name( 'faq_title' ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
296 |
</p>
|
297 |
|
298 |
<?php
|
@@ -335,10 +351,14 @@ class ewdufaqFAQCategoriesWidget extends WP_Widget {
|
|
335 |
*/
|
336 |
public function widget( $args, $instance ) {
|
337 |
|
338 |
-
echo $args['before_widget'];
|
339 |
-
if ($instance['faq_title'] != "") {
|
|
|
|
|
|
|
|
|
340 |
echo do_shortcode( "[ultimate-faqs include_category='". $instance['include_category'] . "' no_comments='Yes']" );
|
341 |
-
echo $args['after_widget'];
|
342 |
}
|
343 |
|
344 |
/**
|
@@ -354,12 +374,12 @@ class ewdufaqFAQCategoriesWidget extends WP_Widget {
|
|
354 |
?>
|
355 |
|
356 |
<p>
|
357 |
-
<label for="<?php echo $this->get_field_id( 'include_category' ); ?>"><?php _e( 'FAQ Category List:', 'ultimate-faqs' ); ?></label>
|
358 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'include_category' ); ?>" name="<?php echo $this->get_field_name( 'include_category' ); ?>" type="text" value="<?php echo esc_attr( $include_category ); ?>">
|
359 |
</p>
|
360 |
<p>
|
361 |
-
<label for="<?php echo $this->get_field_id( 'faq_title' ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
362 |
-
<input class="widefat" id="<?php echo $this->get_field_id( 'faq_title' ); ?>" name="<?php echo $this->get_field_name( 'faq_title' ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
363 |
</p>
|
364 |
|
365 |
<?php
|
60 |
*/
|
61 |
public function widget( $args, $instance ) {
|
62 |
|
63 |
+
echo esc_html( $args['before_widget'] );
|
64 |
+
if ( $instance['faq_title'] != '' ) {
|
65 |
+
echo ( $args['before_title'] != '' ? esc_html( $args['before_title'] ) : '<h3>' ) . esc_html( $instance['faq_title'] ) . ( $args['after_title'] != '' ? esc_html( $args['after_title'] ) : '</h3>' );
|
66 |
+
}
|
67 |
echo do_shortcode( "[select-faq faq_id='". $instance['faq_id'] . "' no_comments='Yes']" );
|
68 |
+
echo esc_html( $args['after_widget'] );
|
69 |
}
|
70 |
|
71 |
/**
|
81 |
?>
|
82 |
|
83 |
<p>
|
84 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'faq_id' ) ); ?>">
|
85 |
+
<?php _e( 'FAQ ID List:', 'ultimate-faqs' ); ?>
|
86 |
+
</label>
|
87 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'faq_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'faq_id' ) ); ?>" type="text" value="<?php echo esc_attr( $faq_id ); ?>">
|
88 |
</p>
|
89 |
<p>
|
90 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
91 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'faq_title' ) ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
92 |
</p>
|
93 |
|
94 |
<?php
|
132 |
*/
|
133 |
public function widget( $args, $instance ) {
|
134 |
|
135 |
+
echo esc_html( $args['before_widget'] );
|
136 |
+
if ( $instance['faq_title'] != '' ) {
|
137 |
+
echo esc_html(
|
138 |
+
( $args['before_title'] != '' ? $args['before_title'] : '<h3>' ) . $instance['faq_title'] . ( $args['after_title'] != '' ? $args['after_title'] : '</h3>' )
|
139 |
+
);
|
140 |
+
}
|
141 |
echo do_shortcode( "[recent-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']" );
|
142 |
+
echo esc_html( $args['after_widget'] );
|
143 |
}
|
144 |
|
145 |
/**
|
155 |
?>
|
156 |
|
157 |
<p>
|
158 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'post_count' ) ); ?>"><?php _e( 'Number of FAQs:', 'ultimate-faqs' ); ?></label>
|
159 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'post_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_count' ) ); ?>" type="text" value="<?php echo esc_attr( $post_count ); ?>">
|
160 |
</p>
|
161 |
<p>
|
162 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
163 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'faq_title' ) ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
164 |
</p>
|
165 |
|
166 |
<?php
|
204 |
*/
|
205 |
public function widget( $args, $instance ) {
|
206 |
|
207 |
+
echo esc_html( $args['before_widget'] );
|
208 |
+
if ( $instance['faq_title'] != '' ) {
|
209 |
+
echo esc_html(
|
210 |
+
( $args['before_title'] != '' ? $args['before_title'] : '<h3>' ) . $instance['faq_title'] . ( $args['after_title'] != '' ? $args['after_title'] : '</h3>' )
|
211 |
+
);
|
212 |
+
}
|
213 |
echo do_shortcode( "[popular-faqs post_count='". $instance['post_count'] . "' no_comments='Yes']" );
|
214 |
+
echo esc_html( $args['after_widget'] );
|
215 |
}
|
216 |
|
217 |
/**
|
227 |
?>
|
228 |
|
229 |
<p>
|
230 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'post_count' ) ); ?>"><?php _e( 'Number of FAQs:', 'ultimate-faqs' ); ?></label>
|
231 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'post_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_count' ) ); ?>" type="text" value="<?php echo esc_attr( $post_count ); ?>">
|
232 |
</p>
|
233 |
<p>
|
234 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
235 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'faq_title' ) ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
236 |
</p>
|
237 |
|
238 |
<?php
|
285 |
$faqs = get_posts( $args );
|
286 |
$faq = reset( $faqs );
|
287 |
|
288 |
+
echo esc_html( $args['before_widget'] );
|
289 |
+
if ($instance['faq_title'] != "") {
|
290 |
+
echo esc_html(
|
291 |
+
($args['before_title'] != '' ? $args['before_title'] : "<h3>") . $instance['faq_title'] . ($args['after_title'] != '' ? $args['after_title'] : "</h3>")
|
292 |
+
);
|
293 |
+
}
|
294 |
echo do_shortcode( "[select-faq faq_id='". $faq->ID . "' no_comments='Yes']" );
|
295 |
+
echo esc_html( $args['after_widget'] );
|
296 |
}
|
297 |
|
298 |
/**
|
307 |
?>
|
308 |
|
309 |
<p>
|
310 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
311 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'faq_title' ) ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
312 |
</p>
|
313 |
|
314 |
<?php
|
351 |
*/
|
352 |
public function widget( $args, $instance ) {
|
353 |
|
354 |
+
echo esc_html( $args['before_widget'] );
|
355 |
+
if ($instance['faq_title'] != "") {
|
356 |
+
echo esc_html(
|
357 |
+
($args['before_title'] != '' ? $args['before_title'] : "<h3>") . $instance['faq_title'] . ($args['after_title'] != '' ? $args['after_title'] : "</h3>")
|
358 |
+
);
|
359 |
+
}
|
360 |
echo do_shortcode( "[ultimate-faqs include_category='". $instance['include_category'] . "' no_comments='Yes']" );
|
361 |
+
echo esc_html( $args['after_widget'] );
|
362 |
}
|
363 |
|
364 |
/**
|
374 |
?>
|
375 |
|
376 |
<p>
|
377 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'include_category' ) ); ?>"><?php _e( 'FAQ Category List:', 'ultimate-faqs' ); ?></label>
|
378 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include_category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include_category' ) ); ?>" type="text" value="<?php echo esc_attr( $include_category ); ?>">
|
379 |
</p>
|
380 |
<p>
|
381 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>"><?php _e( 'Widget Title:', 'ultimate-faqs' ); ?></label>
|
382 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'faq_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'faq_title' ) ); ?>" type="text" value="<?php echo esc_attr( $faq_title ); ?>">
|
383 |
</p>
|
384 |
|
385 |
<?php
|
includes/WooCommerce.class.php
CHANGED
@@ -76,6 +76,14 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
76 |
wp_enqueue_style( 'ewd-ufaq-wc-admin-css', EWD_UFAQ_PLUGIN_URL . '/assets/css/ewd-ufaq-wc-admin.css', array(), EWD_UFAQ_VERSION );
|
77 |
|
78 |
wp_enqueue_script( 'ewd-ufaq-wc-admin-js', EWD_UFAQ_PLUGIN_URL . '/assets/js/ewd-ufaq-wc-admin.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
public function faq_tab_content() {
|
@@ -155,7 +163,7 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
155 |
|
156 |
<select class='ewd-ufaq-category-filter' name='ewd-ufaq-category-filter'>
|
157 |
<option value=''><?php _e('All Categories', 'ultimate-faqs' ); ?></option>
|
158 |
-
<?php foreach ( $categories as $category ) { ?> <option value='<?php echo $category->term_id; ?>'><?php echo esc_html( $category->name ); ?></option><?php } ?>
|
159 |
</select>
|
160 |
|
161 |
<table class='form-table ewd-ufaq-faq-add-table'>
|
@@ -167,8 +175,8 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
167 |
|
168 |
<?php foreach ( $all_faqs as $faq ) { ?>
|
169 |
|
170 |
-
<tr class='ewd-ufaq-faq-row' data-faqid='<?php echo $faq->ID; ?>'>
|
171 |
-
<td><input type='checkbox' class='ewd-ufaq-add-faq' name='Add_FAQs[]' value='<?php echo $faq->ID; ?>'/></td>
|
172 |
<td><?php echo esc_html( $faq->post_title ); ?></td>
|
173 |
</tr>
|
174 |
<?php } ?>
|
@@ -195,8 +203,8 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
195 |
<?php foreach ( $current_faqs as $faq_id ) { ?>
|
196 |
|
197 |
<?php $faq = get_post( $faq_id ); ?>
|
198 |
-
<tr class='ewd-ufaq-faq-row ewd-ufaq-delete-faq-row' data-faqid='<?php echo $faq_id; ?>'>
|
199 |
-
<td><input type='checkbox' class='ewd-ufaq-delete-faq' name='Delete_FAQs[]' value='<?php echo $faq_id; ?>'/></td>
|
200 |
<td><?php echo esc_html( $faq->post_title ); ?></td>
|
201 |
</tr>
|
202 |
<?php } ?>
|
@@ -214,12 +222,21 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
214 |
}
|
215 |
|
216 |
public function add_wc_faqs() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
-
|
219 |
|
220 |
$current_faqs = (array) get_post_meta( $post_id, 'EWD_UFAQ_WC_Selected_FAQs', true );
|
221 |
|
222 |
-
$faqs = json_decode( stripslashes_deep( $_POST['FAQs'] ) );
|
223 |
if ( ! is_array( $faqs ) ) { $faqs = array(); }
|
224 |
|
225 |
$added_faqs = array();
|
@@ -241,6 +258,15 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
241 |
}
|
242 |
|
243 |
public function delete_wc_faqs() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
$post_id = intval( $_POST['Post_ID'] );
|
246 |
|
@@ -257,6 +283,15 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
257 |
}
|
258 |
|
259 |
public function wc_faq_category() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
|
261 |
$cat_id = intval( $_POST['Cat_ID'] );
|
262 |
|
@@ -288,8 +323,8 @@ if ( !class_exists( 'ewdufaqWooCommerce' ) ) {
|
|
288 |
</tr>
|
289 |
<?php foreach ( $all_faqs as $faq ) { ?>
|
290 |
|
291 |
-
<tr class='ewd-ufaq-faq-row' data-faqid='<?php echo $faq->ID; ?>'>
|
292 |
-
<td><input type='checkbox' class='ewd-ufaq-add-faq' name='Add_FAQs[]' value='<?php echo $faq->ID; ?>'/></td>
|
293 |
<td><?php echo esc_html( $faq->post_title ); ?></td>
|
294 |
</tr>
|
295 |
<?php } ?>
|
76 |
wp_enqueue_style( 'ewd-ufaq-wc-admin-css', EWD_UFAQ_PLUGIN_URL . '/assets/css/ewd-ufaq-wc-admin.css', array(), EWD_UFAQ_VERSION );
|
77 |
|
78 |
wp_enqueue_script( 'ewd-ufaq-wc-admin-js', EWD_UFAQ_PLUGIN_URL . '/assets/js/ewd-ufaq-wc-admin.js', array( 'jquery' ), EWD_UFAQ_VERSION );
|
79 |
+
|
80 |
+
wp_localize_script(
|
81 |
+
'ewd-ufaq-wc-admin-js',
|
82 |
+
'ewd_ufaq_wc_admin',
|
83 |
+
array(
|
84 |
+
'nonce' => wp_create_nonce( 'ewd-ufaq-wc-admin-js' )
|
85 |
+
)
|
86 |
+
);
|
87 |
}
|
88 |
|
89 |
public function faq_tab_content() {
|
163 |
|
164 |
<select class='ewd-ufaq-category-filter' name='ewd-ufaq-category-filter'>
|
165 |
<option value=''><?php _e('All Categories', 'ultimate-faqs' ); ?></option>
|
166 |
+
<?php foreach ( $categories as $category ) { ?> <option value='<?php echo esc_attr( $category->term_id ); ?>'><?php echo esc_html( $category->name ); ?></option><?php } ?>
|
167 |
</select>
|
168 |
|
169 |
<table class='form-table ewd-ufaq-faq-add-table'>
|
175 |
|
176 |
<?php foreach ( $all_faqs as $faq ) { ?>
|
177 |
|
178 |
+
<tr class='ewd-ufaq-faq-row' data-faqid='<?php echo esc_attr( $faq->ID ); ?>'>
|
179 |
+
<td><input type='checkbox' class='ewd-ufaq-add-faq' name='Add_FAQs[]' value='<?php echo esc_attr( $faq->ID ); ?>'/></td>
|
180 |
<td><?php echo esc_html( $faq->post_title ); ?></td>
|
181 |
</tr>
|
182 |
<?php } ?>
|
203 |
<?php foreach ( $current_faqs as $faq_id ) { ?>
|
204 |
|
205 |
<?php $faq = get_post( $faq_id ); ?>
|
206 |
+
<tr class='ewd-ufaq-faq-row ewd-ufaq-delete-faq-row' data-faqid='<?php echo esc_attr( $faq_id ); ?>'>
|
207 |
+
<td><input type='checkbox' class='ewd-ufaq-delete-faq' name='Delete_FAQs[]' value='<?php echo esc_attr( $faq_id ); ?>'/></td>
|
208 |
<td><?php echo esc_html( $faq->post_title ); ?></td>
|
209 |
</tr>
|
210 |
<?php } ?>
|
222 |
}
|
223 |
|
224 |
public function add_wc_faqs() {
|
225 |
+
global $ewd_ufaq_controller;
|
226 |
+
|
227 |
+
if (
|
228 |
+
! check_ajax_referer( 'ewd-ufaq-wc-admin-js', 'nonce' )
|
229 |
+
||
|
230 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
231 |
+
) {
|
232 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
233 |
+
}
|
234 |
|
235 |
+
$post_id = intval( $_POST['Post_ID'] );
|
236 |
|
237 |
$current_faqs = (array) get_post_meta( $post_id, 'EWD_UFAQ_WC_Selected_FAQs', true );
|
238 |
|
239 |
+
$faqs = array_map('intval', json_decode( stripslashes_deep( $_POST['FAQs'] ) ) );
|
240 |
if ( ! is_array( $faqs ) ) { $faqs = array(); }
|
241 |
|
242 |
$added_faqs = array();
|
258 |
}
|
259 |
|
260 |
public function delete_wc_faqs() {
|
261 |
+
global $ewd_ufaq_controller;
|
262 |
+
|
263 |
+
if (
|
264 |
+
! check_ajax_referer( 'ewd-ufaq-wc-admin-js', 'nonce' )
|
265 |
+
||
|
266 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
267 |
+
) {
|
268 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
269 |
+
}
|
270 |
|
271 |
$post_id = intval( $_POST['Post_ID'] );
|
272 |
|
283 |
}
|
284 |
|
285 |
public function wc_faq_category() {
|
286 |
+
global $ewd_ufaq_controller;
|
287 |
+
|
288 |
+
if (
|
289 |
+
! check_ajax_referer( 'ewd-ufaq-wc-admin-js', 'nonce' )
|
290 |
+
||
|
291 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
292 |
+
) {
|
293 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
294 |
+
}
|
295 |
|
296 |
$cat_id = intval( $_POST['Cat_ID'] );
|
297 |
|
323 |
</tr>
|
324 |
<?php foreach ( $all_faqs as $faq ) { ?>
|
325 |
|
326 |
+
<tr class='ewd-ufaq-faq-row' data-faqid='<?php echo esc_attr( $faq->ID ); ?>'>
|
327 |
+
<td><input type='checkbox' class='ewd-ufaq-add-faq' name='Add_FAQs[]' value='<?php echo esc_attr( $faq->ID ); ?>'/></td>
|
328 |
<td><?php echo esc_html( $faq->post_title ); ?></td>
|
329 |
</tr>
|
330 |
<?php } ?>
|
includes/template-functions.php
CHANGED
@@ -372,7 +372,7 @@ if ( ! function_exists( 'ewd_format_classes' ) ) {
|
|
372 |
function ewd_format_classes( $classes ) {
|
373 |
|
374 |
if ( count( $classes ) ) {
|
375 |
-
return ' class="' . join( ' ', $classes ) . '"';
|
376 |
}
|
377 |
}
|
378 |
}
|
372 |
function ewd_format_classes( $classes ) {
|
373 |
|
374 |
if ( count( $classes ) ) {
|
375 |
+
return ' class="' . esc_attr( join( ' ', $classes ) ) . '"';
|
376 |
}
|
377 |
}
|
378 |
}
|
readme.txt
CHANGED
@@ -266,6 +266,10 @@ Video 3 - FAQs Ordering
|
|
266 |
|
267 |
== Changelog ==
|
268 |
|
|
|
|
|
|
|
|
|
269 |
= 2.1.1 (2021-12-22) =
|
270 |
- Fixed an issue in which the defaults were not being correctly set for a few options.
|
271 |
|
266 |
|
267 |
== Changelog ==
|
268 |
|
269 |
+
= 2.1.2 (2021-12-23) =
|
270 |
+
- Updating nonce and capability checks for AJAX calls.
|
271 |
+
- Updating sanitization and escaping.
|
272 |
+
|
273 |
= 2.1.1 (2021-12-22) =
|
274 |
- Fixed an issue in which the defaults were not being correctly set for a few options.
|
275 |
|
ultimate-faqs.php
CHANGED
@@ -6,7 +6,7 @@ Description: FAQ and accordion plugin with easy to use Gutenberg blocks, shortco
|
|
6 |
Author URI: https://www.etoilewebdesign.com/
|
7 |
Terms and Conditions: https://www.etoilewebdesign.com/plugin-terms-and-conditions/
|
8 |
Text Domain: ultimate-faqs
|
9 |
-
Version: 2.1.
|
10 |
WC requires at least: 3.0
|
11 |
WC tested up to: 6.0
|
12 |
*/
|
@@ -43,7 +43,7 @@ class ewdufaqInit {
|
|
43 |
define( 'EWD_UFAQ_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
|
44 |
define( 'EWD_UFAQ_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
|
45 |
define( 'EWD_UFAQ_TEMPLATE_DIR', 'ewd-ufaq-templates' );
|
46 |
-
define( 'EWD_UFAQ_VERSION', '2.1.
|
47 |
|
48 |
define( 'EWD_UFAQ_FAQ_POST_TYPE', 'ufaq' );
|
49 |
define( 'EWD_UFAQ_FAQ_CATEGORY_TAXONOMY', 'ufaq-category' );
|
@@ -289,6 +289,7 @@ class ewdufaqInit {
|
|
289 |
);
|
290 |
|
291 |
$screen_ids = array(
|
|
|
292 |
'ufaq_page_ewd-ufaq-dashboard',
|
293 |
'edit-ufaq',
|
294 |
'edit-ufaq-category',
|
@@ -307,6 +308,7 @@ class ewdufaqInit {
|
|
307 |
wp_register_script( 'ewd-ufaq-admin-js', EWD_UFAQ_PLUGIN_URL . '/assets/js/ewd-ufaq-admin.js', array( 'jquery', 'jquery-ui-sortable' ), EWD_UFAQ_VERSION, true );
|
308 |
|
309 |
$args = array(
|
|
|
310 |
'ordering' => $this->permissions->check_permission( 'ordering' )
|
311 |
);
|
312 |
|
@@ -528,19 +530,16 @@ class ewdufaqInit {
|
|
528 |
}
|
529 |
|
530 |
public function hide_helper_notice() {
|
|
|
531 |
|
532 |
// Authenticate request
|
533 |
if (
|
534 |
! check_ajax_referer( 'ewd-ufaq-helper-notice', 'nonce' )
|
535 |
||
|
536 |
-
! current_user_can( '
|
537 |
) {
|
538 |
-
|
539 |
-
|
540 |
-
'error' => 'loggedout',
|
541 |
-
'msg' => sprintf( __( 'You have been logged out. Please %slogin again%s.', 'ultimate-faqs' ), '<a href="' . wp_login_url( admin_url( 'admin.php?page=ewd-ufaq-dashboard' ) ) . '">', '</a>' ),
|
542 |
-
)
|
543 |
-
);
|
544 |
}
|
545 |
|
546 |
set_transient( 'ewd-helper-notice-dismissed', true, 3600*24*7 );
|
@@ -548,8 +547,7 @@ class ewdufaqInit {
|
|
548 |
die();
|
549 |
}
|
550 |
|
551 |
-
public function admin_menu_optional( $menu_list )
|
552 |
-
{
|
553 |
global $ewd_ufaq_controller;
|
554 |
|
555 |
if ( $ewd_ufaq_controller->settings->get_setting( 'faq-order-by' ) == 'set_order' ) {
|
6 |
Author URI: https://www.etoilewebdesign.com/
|
7 |
Terms and Conditions: https://www.etoilewebdesign.com/plugin-terms-and-conditions/
|
8 |
Text Domain: ultimate-faqs
|
9 |
+
Version: 2.1.2
|
10 |
WC requires at least: 3.0
|
11 |
WC tested up to: 6.0
|
12 |
*/
|
43 |
define( 'EWD_UFAQ_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
|
44 |
define( 'EWD_UFAQ_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
|
45 |
define( 'EWD_UFAQ_TEMPLATE_DIR', 'ewd-ufaq-templates' );
|
46 |
+
define( 'EWD_UFAQ_VERSION', '2.1.2' );
|
47 |
|
48 |
define( 'EWD_UFAQ_FAQ_POST_TYPE', 'ufaq' );
|
49 |
define( 'EWD_UFAQ_FAQ_CATEGORY_TAXONOMY', 'ufaq-category' );
|
289 |
);
|
290 |
|
291 |
$screen_ids = array(
|
292 |
+
'ufaq',
|
293 |
'ufaq_page_ewd-ufaq-dashboard',
|
294 |
'edit-ufaq',
|
295 |
'edit-ufaq-category',
|
308 |
wp_register_script( 'ewd-ufaq-admin-js', EWD_UFAQ_PLUGIN_URL . '/assets/js/ewd-ufaq-admin.js', array( 'jquery', 'jquery-ui-sortable' ), EWD_UFAQ_VERSION, true );
|
309 |
|
310 |
$args = array(
|
311 |
+
'nonce' => wp_create_nonce( 'ewd-ufaq-admin-js' ),
|
312 |
'ordering' => $this->permissions->check_permission( 'ordering' )
|
313 |
);
|
314 |
|
530 |
}
|
531 |
|
532 |
public function hide_helper_notice() {
|
533 |
+
global $ewd_ufaq_controller;
|
534 |
|
535 |
// Authenticate request
|
536 |
if (
|
537 |
! check_ajax_referer( 'ewd-ufaq-helper-notice', 'nonce' )
|
538 |
||
|
539 |
+
! current_user_can( $ewd_ufaq_controller->settings->get_setting( 'access-role' ) )
|
540 |
) {
|
541 |
+
ewdUfaqHelper::admin_nopriv_ajax();
|
542 |
+
|
|
|
|
|
|
|
|
|
543 |
}
|
544 |
|
545 |
set_transient( 'ewd-helper-notice-dismissed', true, 3600*24*7 );
|
547 |
die();
|
548 |
}
|
549 |
|
550 |
+
public function admin_menu_optional( $menu_list ) {
|
|
|
551 |
global $ewd_ufaq_controller;
|
552 |
|
553 |
if ( $ewd_ufaq_controller->settings->get_setting( 'faq-order-by' ) == 'set_order' ) {
|
views/View.FAQs.class.php
CHANGED
@@ -523,16 +523,18 @@ class ewdufaqViewFAQs extends ewdufaqView {
|
|
523 |
wp_enqueue_style( 'ewd-ufaq-rrssb' );
|
524 |
wp_enqueue_style( 'ewd-ufaq-jquery-ui' );
|
525 |
|
|
|
526 |
$args = array(
|
527 |
-
'faq_accordion'
|
528 |
-
'category_accordion'
|
529 |
-
'faq_scroll'
|
530 |
-
'reveal_effect'
|
531 |
-
'retrieving_results'
|
532 |
-
'highlight_search_term'
|
533 |
-
'autocomplete_question'
|
534 |
-
'question_titles'
|
535 |
-
'display_faq'
|
|
|
536 |
);
|
537 |
|
538 |
if ( ! empty( get_query_var( 'single_faq' ) ) ) {
|
@@ -541,11 +543,9 @@ class ewdufaqViewFAQs extends ewdufaqView {
|
|
541 |
$args['display_faq'] = $faq->ID;
|
542 |
}
|
543 |
elseif ( isset( $_GET['Display_FAQ'] ) ) {
|
544 |
-
|
545 |
$args['display_faq'] = intval( $_GET['Display_FAQ'] );
|
546 |
}
|
547 |
|
548 |
-
$handle = 'ewd-ufaq-js';
|
549 |
// Fetch any existing script data
|
550 |
$prev_question_titles = $wp_scripts->get_data( $handle, 'question_titles' );
|
551 |
|
@@ -555,9 +555,13 @@ class ewdufaqViewFAQs extends ewdufaqView {
|
|
555 |
}
|
556 |
|
557 |
$wp_scripts->add_data( $handle, 'question_titles', $args['question_titles'] );
|
558 |
-
wp_localize_script(
|
|
|
|
|
|
|
|
|
559 |
|
560 |
-
wp_enqueue_script(
|
561 |
|
562 |
wp_enqueue_script( 'jquery-ui-core' );
|
563 |
|
523 |
wp_enqueue_style( 'ewd-ufaq-rrssb' );
|
524 |
wp_enqueue_style( 'ewd-ufaq-jquery-ui' );
|
525 |
|
526 |
+
$handle = 'ewd-ufaq-js';
|
527 |
$args = array(
|
528 |
+
'faq_accordion' => $ewd_ufaq_controller->settings->get_setting( 'faq-accordion' ),
|
529 |
+
'category_accordion' => $ewd_ufaq_controller->settings->get_setting( 'faq-category-accordion' ),
|
530 |
+
'faq_scroll' => $ewd_ufaq_controller->settings->get_setting( 'scroll-to-top' ),
|
531 |
+
'reveal_effect' => $ewd_ufaq_controller->settings->get_setting( 'reveal-effect' ),
|
532 |
+
'retrieving_results' => $ewd_ufaq_controller->settings->get_setting( 'label-retrieving-results' ),
|
533 |
+
'highlight_search_term' => $ewd_ufaq_controller->settings->get_setting( 'highlight-search-term' ),
|
534 |
+
'autocomplete_question' => $ewd_ufaq_controller->settings->get_setting( 'auto-complete-titles' ),
|
535 |
+
'question_titles' => $this->get_faq_titles(),
|
536 |
+
'display_faq' => 0,
|
537 |
+
'nonce' => wp_create_nonce( $handle ),
|
538 |
);
|
539 |
|
540 |
if ( ! empty( get_query_var( 'single_faq' ) ) ) {
|
543 |
$args['display_faq'] = $faq->ID;
|
544 |
}
|
545 |
elseif ( isset( $_GET['Display_FAQ'] ) ) {
|
|
|
546 |
$args['display_faq'] = intval( $_GET['Display_FAQ'] );
|
547 |
}
|
548 |
|
|
|
549 |
// Fetch any existing script data
|
550 |
$prev_question_titles = $wp_scripts->get_data( $handle, 'question_titles' );
|
551 |
|
555 |
}
|
556 |
|
557 |
$wp_scripts->add_data( $handle, 'question_titles', $args['question_titles'] );
|
558 |
+
wp_localize_script(
|
559 |
+
$handle,
|
560 |
+
'ewd_ufaq_php_data',
|
561 |
+
apply_filters( 'ewd_ufaq_js_localize_data', $args )
|
562 |
+
);
|
563 |
|
564 |
+
wp_enqueue_script( $handle );
|
565 |
|
566 |
wp_enqueue_script( 'jquery-ui-core' );
|
567 |
|