Ultimate FAQ - Version 1.6.6

Version Description

  • Added in a captcha option for the submit question shortcode
  • Fixed an HTML validation error
Download this release

Release Info

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

Code changes from version 1.6.5 to 1.6.6

Functions/EWD_UFAQ_Captcha.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function EWD_UFAQ_Validate_Captcha() {
3
+ $ModifiedCode = $_POST['ewd_ufaq_modified_captcha'];
4
+ $UserCode = $_POST['ewd_ufaq_captcha'];
5
+
6
+ $Code = EWD_UFAQ_Decrypt_Catpcha_Code($ModifiedCode);
7
+
8
+ if ($Code == $UserCode) {$Validate_Captcha = "Yes";}
9
+ else {$Validate_Captcha = "No";}
10
+
11
+ return $Validate_Captcha;
12
+ }
13
+
14
+ function EWD_UFAQ_Encrypt_Captcha_Code($Code) {
15
+ $ModifiedCode = ($Code + 5) * 3;
16
+
17
+ return $ModifiedCode;
18
+ }
19
+
20
+ function EWD_UFAQ_Decrypt_Catpcha_Code($ModifiedCode) {
21
+ $Code = ($ModifiedCode / 3) - 5;
22
+
23
+ return $Code;
24
+ }
25
+ ?>
Functions/EWD_UFAQ_Create_Captcha_Image.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $ModifiedCode = $_GET['Code'];
3
+ $Code = EWD_UFAQ_Decrypt_Catpcha_Code($ModifiedCode);
4
+ $im = imagecreatetruecolor(50, 24);
5
+ $bg = imagecolorallocate($im, 22, 86, 165);
6
+ $fg = imagecolorallocate($im, 255, 255, 255);
7
+ imagefill($im, 0, 0, $bg);
8
+ imagestring($im, 5, 5, 5, $Code, $fg);
9
+ header("Cache-Control: no-cache, must-revalidate");
10
+ header('Content-type: image/png');
11
+ imagepng($im);
12
+ imagedestroy($im);
13
+
14
+
15
+ function EWD_UFAQ_Decrypt_Catpcha_Code($ModifiedCode) {
16
+ $Code = ($ModifiedCode / 3) - 5;
17
+
18
+ return $Code;
19
+ }
20
+ ?>
Functions/EWD_UFAQ_Submit_Question.php CHANGED
@@ -1,11 +1,17 @@
1
  <?php
2
  function EWD_UFAQ_Submit_Question($success_message) {
 
3
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
4
 
5
  $Post_Title = sanitize_text_field($_POST['Post_Title']);
6
  $Post_Body = (isset($_POST['Post_Body']) ? sanitize_text_field($_POST['Post_Body']) : '');
7
  $Post_Author = sanitize_text_field($_POST['Post_Author']);
8
 
 
 
 
 
 
9
  $post = array(
10
  'post_content' => $Post_Body,
11
  'post_title' => $Post_Title,
1
  <?php
2
  function EWD_UFAQ_Submit_Question($success_message) {
3
+ $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
4
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
5
 
6
  $Post_Title = sanitize_text_field($_POST['Post_Title']);
7
  $Post_Body = (isset($_POST['Post_Body']) ? sanitize_text_field($_POST['Post_Body']) : '');
8
  $Post_Author = sanitize_text_field($_POST['Post_Author']);
9
 
10
+ if ($Submit_Question_Captcha == "Yes" and EWD_UFAQ_Validate_Captcha() != "Yes") {
11
+ $user_message = __("Captcha number didn't match image.", 'ultimate-faqs');
12
+ return $user_message;
13
+ }
14
+
15
  $post = array(
16
  'post_content' => $Post_Body,
17
  'post_title' => $Post_Title,
Functions/Update_Admin_Databases.php CHANGED
@@ -50,6 +50,7 @@ function EWD_UFAQ_UpdateOptions() {
50
  if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', sanitize_text_field($_POST['reveal_effect']));}
51
  if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', sanitize_text_field($_POST['pretty_permalinks']));}
52
  if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', sanitize_text_field($_POST['allow_proposed_answer']));}
 
53
  if (isset($_POST['admin_question_notification']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Question_Notification', sanitize_text_field($_POST['admin_question_notification']));}
54
  if (isset($_POST['Options_Submit']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Notification_Email', sanitize_text_field($_POST['admin_notification_email']));}
55
  if (isset($_POST['faq_auto_complete_titles']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Auto_Complete_Titles', sanitize_text_field($_POST['faq_auto_complete_titles']));}
50
  if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', sanitize_text_field($_POST['reveal_effect']));}
51
  if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', sanitize_text_field($_POST['pretty_permalinks']));}
52
  if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', sanitize_text_field($_POST['allow_proposed_answer']));}
53
+ if (isset($_POST['submit_question_captcha']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Submit_Question_Captcha', sanitize_text_field($_POST['submit_question_captcha']));}
54
  if (isset($_POST['admin_question_notification']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Question_Notification', sanitize_text_field($_POST['admin_question_notification']));}
55
  if (isset($_POST['Options_Submit']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Notification_Email', sanitize_text_field($_POST['admin_notification_email']));}
56
  if (isset($_POST['faq_auto_complete_titles']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Auto_Complete_Titles', sanitize_text_field($_POST['faq_auto_complete_titles']));}
Main.php CHANGED
@@ -7,7 +7,7 @@ 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.6.5
11
  */
12
 
13
  global $ewd_ufaq_message;
@@ -194,6 +194,7 @@ function Set_EWD_UFAQ_Options() {
194
  if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
195
  if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
196
  if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
 
197
  if (get_option("EWD_UFAQ_Admin_Question_Notification") == "") {update_option("EWD_UFAQ_Admin_Question_Notification", "No");}
198
  if (get_option("EWD_UFAQ_Auto_Complete_Titles") == "") {update_option("EWD_UFAQ_Auto_Complete_Titles", "Yes");}
199
  if (get_option("EWD_UFAQ_Slug_Base") == "") {update_option("EWD_UFAQ_Slug_Base", "ufaqs");}
@@ -296,6 +297,7 @@ function UFAQ_Set_Pointers($page) {
296
  include "Functions/Error_Notices.php";
297
  include "Functions/EWD_UFAQ_Add_Social_Media_Buttons.php";
298
  include "Functions/EWD_UFAQ_Add_Views_Column.php";
 
299
  include "Functions/EWD_UFAQ_Export.php";
300
  include "Functions/EWD_UFAQ_Help_Pointers.php";
301
  include "Functions/EWD_UFAQ_Import.php";
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.6.6
11
  */
12
 
13
  global $ewd_ufaq_message;
194
  if (get_option("EWD_UFAQ_Reveal_Effect") == "") {update_option("EWD_UFAQ_Reveal_Effect", "none");}
195
  if (get_option("EWD_UFAQ_Pretty_Permalinks") == "") {update_option("EWD_UFAQ_Pretty_Permalinks", "No");}
196
  if (get_option("EWD_UFAQ_Allow_Proposed_Answer") == "") {update_option("EWD_UFAQ_Allow_Proposed_Answer", "No");}
197
+ if (get_option("EWD_UFAQ_Submit_Question_Captcha") == "") {update_option("EWD_UFAQ_Submit_Question_Captcha", "No");}
198
  if (get_option("EWD_UFAQ_Admin_Question_Notification") == "") {update_option("EWD_UFAQ_Admin_Question_Notification", "No");}
199
  if (get_option("EWD_UFAQ_Auto_Complete_Titles") == "") {update_option("EWD_UFAQ_Auto_Complete_Titles", "Yes");}
200
  if (get_option("EWD_UFAQ_Slug_Base") == "") {update_option("EWD_UFAQ_Slug_Base", "ufaqs");}
297
  include "Functions/Error_Notices.php";
298
  include "Functions/EWD_UFAQ_Add_Social_Media_Buttons.php";
299
  include "Functions/EWD_UFAQ_Add_Views_Column.php";
300
+ include "Functions/EWD_UFAQ_Captcha.php";
301
  include "Functions/EWD_UFAQ_Export.php";
302
  include "Functions/EWD_UFAQ_Help_Pointers.php";
303
  include "Functions/EWD_UFAQ_Import.php";
Shortcodes/Display_FAQ_Search.php CHANGED
@@ -46,12 +46,12 @@ function UFAQ_AJAX_Search($atts) {
46
  $ReturnString .= "<input type='hidden' name='ufaq-input' value='Search'>";
47
  $ReturnString .= "<div id='ewd-ufaq-jquery-ajax-search' class='pure-control-group ui-front' style='position:relative;'>";
48
  $ReturnString .= "<label id='ufaq-ajax-search-lbl' class='ewd-otp-field-label ewd-otp-bold'>" . $Enter_Question_Label . ":</label>";
49
- $ReturnString .= "<input type='hidden' name'include_category' value='" . $include_category . "' id='ufaq-include-category' />";
50
- $ReturnString .= "<input type='hidden' name'exclude_category' value='" . $exclude_category . "' id='ufaq-exclude-category' />";
51
- $ReturnString .= "<input type='hidden' name'orderby' value='" . $orderby . "' id='ufaq-orderby' />";
52
- $ReturnString .= "<input type='hidden' name'order' value='" . $order . "' id='ufaq-order' />";
53
- $ReturnString .= "<input type='hidden' name'post_count' value='" . $post_count . "' id='ufaq-post-count' />";
54
- $ReturnString .= "<input type='hidden' name'current_url' value='" . $_SERVER['REQUEST_URI'] . "' id='ufaq-current-url' />";
55
  $ReturnString .= "<input type='text' id='ufaq-ajax-text-input' class='ufaq-text-input' name='Question ' placeholder='" . $Enter_Question_Label . "...'>";
56
  $ReturnString .= "</div>";
57
  if ($Auto_Complete_Titles != "Yes" and $show_on_load == "No") {$ReturnString .= "<label for='Submit'></label><input type='button' id='ufaq-ajax-search-btn' class='ewd-otp-submit pure-button pure-button-primary' name='Search' value='" . $Search_Label . "'>";}
46
  $ReturnString .= "<input type='hidden' name='ufaq-input' value='Search'>";
47
  $ReturnString .= "<div id='ewd-ufaq-jquery-ajax-search' class='pure-control-group ui-front' style='position:relative;'>";
48
  $ReturnString .= "<label id='ufaq-ajax-search-lbl' class='ewd-otp-field-label ewd-otp-bold'>" . $Enter_Question_Label . ":</label>";
49
+ $ReturnString .= "<input type='hidden' name='include_category' value='" . $include_category . "' id='ufaq-include-category' />";
50
+ $ReturnString .= "<input type='hidden' name='exclude_category' value='" . $exclude_category . "' id='ufaq-exclude-category' />";
51
+ $ReturnString .= "<input type='hidden' name='orderby' value='" . $orderby . "' id='ufaq-orderby' />";
52
+ $ReturnString .= "<input type='hidden' name='order' value='" . $order . "' id='ufaq-order' />";
53
+ $ReturnString .= "<input type='hidden' name='post_count' value='" . $post_count . "' id='ufaq-post-count' />";
54
+ $ReturnString .= "<input type='hidden' name='current_url' value='" . $_SERVER['REQUEST_URI'] . "' id='ufaq-current-url' />";
55
  $ReturnString .= "<input type='text' id='ufaq-ajax-text-input' class='ufaq-text-input' name='Question ' placeholder='" . $Enter_Question_Label . "...'>";
56
  $ReturnString .= "</div>";
57
  if ($Auto_Complete_Titles != "Yes" and $show_on_load == "No") {$ReturnString .= "<label for='Submit'></label><input type='button' id='ufaq-ajax-search-btn' class='ewd-otp-submit pure-button pure-button-primary' name='Search' value='" . $Search_Label . "'>";}
Shortcodes/SubmitFAQ.php CHANGED
@@ -7,6 +7,7 @@ function Insert_Question_Form($atts) {
7
 
8
  $Custom_CSS = get_option('EWD_UFAQ_Custom_CSS');
9
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
 
10
 
11
  $ReturnString = "";
12
 
@@ -86,6 +87,18 @@ function Insert_Question_Form($atts) {
86
  $ReturnString .= "</div>";
87
  $ReturnString .= "</div>";
88
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  $ReturnString .= "<p class='submit'><input type='submit' name='Submit_Question' id='submit' class='button-primary' value='" . $submit_text . "' /></p></form>";
91
  $ReturnString .= "</div>";
7
 
8
  $Custom_CSS = get_option('EWD_UFAQ_Custom_CSS');
9
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
10
+ $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
11
 
12
  $ReturnString = "";
13
 
87
  $ReturnString .= "</div>";
88
  $ReturnString .= "</div>";
89
 
90
+ if ($Submit_Question_Captcha == "Yes") {
91
+ $Code = rand(1000,9999);
92
+ $ModifiedCode = EWD_UFAQ_Encrypt_Captcha_Code($Code);
93
+
94
+ $ReturnString .= "<div class='ewd-faq-review-input'><label for='captcha_image'></label>";
95
+ $ReturnString .= "<img src=" . EWD_UFAQ_CD_PLUGIN_URL . "Functions/EWD_UFAQ_Create_Captcha_Image.php?Code=" . $ModifiedCode . " />";
96
+ $ReturnString .= "<input type='hidden' name='ewd_ufaq_modified_captcha' value='" . $ModifiedCode . "' />";
97
+ $ReturnString .= "</div>";
98
+ $ReturnString .= "<div class='ewd-faq-review-input'><label for='captcha_text'>" . __("Image Number: ", 'ultimate-faqs') . "</label>";
99
+ $ReturnString .= "<input type='text' name='ewd_ufaq_captcha' value='' />";
100
+ $ReturnString .= "</div>";
101
+ }
102
 
103
  $ReturnString .= "<p class='submit'><input type='submit' name='Submit_Question' id='submit' class='button-primary' value='" . $submit_text . "' /></p></form>";
104
  $ReturnString .= "</div>";
html/OptionsPage.php CHANGED
@@ -24,6 +24,7 @@
24
  $Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
25
  $Pretty_Permalinks = get_option("EWD_UFAQ_Pretty_Permalinks");
26
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
 
27
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
28
  $Admin_Notification_Email = get_option("EWD_UFAQ_Admin_Notification_Email");
29
  $FAQ_Auto_Complete_Titles = get_option("EWD_UFAQ_Auto_Complete_Titles");
@@ -469,6 +470,16 @@
469
  </td>
470
  </tr>
471
  <tr>
 
 
 
 
 
 
 
 
 
 
472
  <th scope="row">Admin Question Notification</th>
473
  <td>
474
  <fieldset><legend class="screen-reader-text"><span>Admin Question Notification</span></legend>
24
  $Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
25
  $Pretty_Permalinks = get_option("EWD_UFAQ_Pretty_Permalinks");
26
  $Allow_Proposed_Answer = get_option("EWD_UFAQ_Allow_Proposed_Answer");
27
+ $Submit_Question_Captcha = get_option("EWD_UFAQ_Submit_Question_Captcha");
28
  $Admin_Question_Notification = get_option("EWD_UFAQ_Admin_Question_Notification");
29
  $Admin_Notification_Email = get_option("EWD_UFAQ_Admin_Notification_Email");
30
  $FAQ_Auto_Complete_Titles = get_option("EWD_UFAQ_Auto_Complete_Titles");
470
  </td>
471
  </tr>
472
  <tr>
473
+ <th scope="row">Submit Question Captcha</th>
474
+ <td>
475
+ <fieldset><legend class="screen-reader-text"><span>Submit Question Captcha</span></legend>
476
+ <label title='Yes'><input type='radio' name='submit_question_captcha' value='Yes' <?php if($Submit_Question_Captcha == "Yes") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>Yes</span></label><br />
477
+ <label title='No'><input type='radio' name='submit_question_captcha' value='No' <?php if($Submit_Question_Captcha == "No") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>No</span></label><br />
478
+ <p>When using the user-submitted question shortcode, should a captcha field be added to the form to reduce the volume of spam FAQs?</p>
479
+ </fieldset>
480
+ </td>
481
+ </tr>
482
+ <tr>
483
  <th scope="row">Admin Question Notification</th>
484
  <td>
485
  <fieldset><legend class="screen-reader-text"><span>Admin Question Notification</span></legend>
readme.txt CHANGED
@@ -266,8 +266,11 @@ Video 3 - FAQs Ordering
266
  26. FAQ widgets
267
 
268
 
269
-
270
  == Changelog ==
 
 
 
 
271
  = 1.6.5 =
272
  - Updated color select sanitizing function
273
 
266
  26. FAQ widgets
267
 
268
 
 
269
  == Changelog ==
270
+ = 1.6.6 =
271
+ - Added in a captcha option for the submit question shortcode
272
+ - Fixed an HTML validation error
273
+
274
  = 1.6.5 =
275
  - Updated color select sanitizing function
276