Ultimate FAQ - Version 1.1.14

Version Description

  • Fixed a parent-child issue, where if a parent category was added in the include_category attribute, it was possible to end up with unexpected categories when an FAQ was in multiple categories
Download this release

Release Info

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

Code changes from version 1.1.13 to 1.1.14

Functions/EWD_UFAQ_Version_Update.php CHANGED
@@ -42,7 +42,7 @@ function EWD_UFAQ_Version_Update_Box() {
42
  <h3 class='hndle'><span><?php _e("Thank You!", 'EWD_UFAQ') ?></span></h3>
43
  <div class="inside">
44
  <?php if (get_option("EWD_UFAQ_Install_Flag") == "Yes") { ?><ul><li><?php _e("Thanks for installing the Ultimate Product Catalogue Plugin.", "EWD_UFAQ"); ?><br> <a href='https://www.youtube.com/channel/UCZPuaoetCJB1vZOmpnMxJNw'><?php _e("Subscribe to our YouTube channel ", "EWD_UFAQ"); ?></a> <?php _e("for tutorial videos on this and our other plugins!", "EWD_UFAQ");?> </li></ul>
45
- <?php } else { ?><ul><li><?php _e("Thanks for upgrading to version 1.1.13!", "EWD_UFAQ"); ?><br> <a href='https://wordpress.org/support/view/plugin-reviews/ultimate-faqs?filter=5'><?php _e("Please rate our plugin", "EWD_UFAQ"); ?></a> <?php _e("if you find Ultimate FAQs useful!", "EWD_UFAQ");?> </li></ul><?php } ?>
46
 
47
  <?php /* if (get_option("EWD_UFAQ_Install_Flag") == "Yes") { ?><ul><li><?php _e("Thanks for installing the Ultimate Product Catalogue Plugin.", "EWD_UFAQ"); ?><br> <a href='http://www.facebook.com/EtoileWebDesign'><?php _e("Follow us on Facebook", "EWD_UFAQ"); ?></a> <?php _e("to suggest new features or hear about upcoming ones!", "EWD_UFAQ");?> </li></ul>
48
  <?php } else { ?><ul><li><?php _e("Thanks for upgrading to version 2.2.9!", "EWD_UFAQ"); ?><br> <a href='http://www.facebook.com/EtoileWebDesign'><?php _e("Follow us on Facebook", "EWD_UFAQ"); ?></a> <?php _e("to suggest new features or hear about upcoming ones!", "EWD_UFAQ");?> </li></ul><?php } */ ?>
42
  <h3 class='hndle'><span><?php _e("Thank You!", 'EWD_UFAQ') ?></span></h3>
43
  <div class="inside">
44
  <?php if (get_option("EWD_UFAQ_Install_Flag") == "Yes") { ?><ul><li><?php _e("Thanks for installing the Ultimate Product Catalogue Plugin.", "EWD_UFAQ"); ?><br> <a href='https://www.youtube.com/channel/UCZPuaoetCJB1vZOmpnMxJNw'><?php _e("Subscribe to our YouTube channel ", "EWD_UFAQ"); ?></a> <?php _e("for tutorial videos on this and our other plugins!", "EWD_UFAQ");?> </li></ul>
45
+ <?php } else { ?><ul><li><?php _e("Thanks for upgrading to version 1.1.14!", "EWD_UFAQ"); ?><br> <a href='https://wordpress.org/support/view/plugin-reviews/ultimate-faqs?filter=5'><?php _e("Please rate our plugin", "EWD_UFAQ"); ?></a> <?php _e("if you find Ultimate FAQs useful!", "EWD_UFAQ");?> </li></ul><?php } ?>
46
 
47
  <?php /* if (get_option("EWD_UFAQ_Install_Flag") == "Yes") { ?><ul><li><?php _e("Thanks for installing the Ultimate Product Catalogue Plugin.", "EWD_UFAQ"); ?><br> <a href='http://www.facebook.com/EtoileWebDesign'><?php _e("Follow us on Facebook", "EWD_UFAQ"); ?></a> <?php _e("to suggest new features or hear about upcoming ones!", "EWD_UFAQ");?> </li></ul>
48
  <?php } else { ?><ul><li><?php _e("Thanks for upgrading to version 2.2.9!", "EWD_UFAQ"); ?><br> <a href='http://www.facebook.com/EtoileWebDesign'><?php _e("Follow us on Facebook", "EWD_UFAQ"); ?></a> <?php _e("to suggest new features or hear about upcoming ones!", "EWD_UFAQ");?> </li></ul><?php } */ ?>
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: EWD_UFAQ
10
- Version: 1.1.13
11
  */
12
 
13
  global $ewd_ufaq_message;
7
  Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
8
  Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
9
  Text Domain: EWD_UFAQ
10
+ Version: 1.1.14
11
  */
12
 
13
  global $ewd_ufaq_message;
Shortcodes/DisplayFAQs.php CHANGED
@@ -101,7 +101,7 @@ function Display_FAQs($atts) {
101
  'operator' => 'NOT IN'
102
  );
103
  }
104
-
105
  if (isset($_GET['include_tag'])) {$include_tag = $_GET['include_tag'];}
106
  if (get_query_var('ufaq_tag_slug') != "") {$include_tag = get_query_var('ufaq_tag_slug');}
107
  if (isset($include_tag) and $include_tag != "" ) {$include_tag_array = explode(",", $include_tag);}
@@ -145,10 +145,13 @@ function Display_FAQs($atts) {
145
  $Counter = 0;
146
  foreach ($Category_Array as $Category) {
147
 
148
- if ($Category != "EWD_UFAQ_ALL_CATEGORIES") {$category_array = array( 'taxonomy' => 'ufaq-category',
149
- 'field' => 'slug',
150
- 'terms' => $Category->slug
151
- );
 
 
 
152
  }
153
 
154
  $tax_query_array = array('relation' => 'AND');
@@ -325,3 +328,38 @@ function Display_FAQs($atts) {
325
  return $ReturnString;
326
  }
327
  add_shortcode("ultimate-faqs", "Display_FAQs");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  'operator' => 'NOT IN'
102
  );
103
  }
104
+
105
  if (isset($_GET['include_tag'])) {$include_tag = $_GET['include_tag'];}
106
  if (get_query_var('ufaq_tag_slug') != "") {$include_tag = get_query_var('ufaq_tag_slug');}
107
  if (isset($include_tag) and $include_tag != "" ) {$include_tag_array = explode(",", $include_tag);}
145
  $Counter = 0;
146
  foreach ($Category_Array as $Category) {
147
 
148
+ if ($Category != "EWD_UFAQ_ALL_CATEGORIES") {
149
+ if (!EWD_UFAQ_Category_Matches($Category, $include_category_array, $exclude_category_array)) {continue;}
150
+
151
+ $category_array = array( 'taxonomy' => 'ufaq-category',
152
+ 'field' => 'slug',
153
+ 'terms' => $Category->slug
154
+ );
155
  }
156
 
157
  $tax_query_array = array('relation' => 'AND');
328
  return $ReturnString;
329
  }
330
  add_shortcode("ultimate-faqs", "Display_FAQs");
331
+
332
+
333
+ function EWD_UFAQ_Category_Matches($Category, $include_category_array, $exclude_category_array) {
334
+ $Excluded = EWD_UFAQ_Excluded_Category_Check($Category, $exclude_category_array);
335
+ $Included = EWD_UFAQ_Included_Category_Check($Category, $include_category_array);
336
+
337
+ if ($Included and !$Excluded) {
338
+ return true;
339
+ }
340
+ else {
341
+ return false;
342
+ }
343
+ }
344
+
345
+ function EWD_UFAQ_Excluded_Category_Check($Category, $exclude_category_array) {
346
+ if (sizeof($exclude_category_array) == 0) {return false;}
347
+
348
+ if (in_array($Category->slug, $exclude_category_array)) {return true;}
349
+ elseif ($Category->parent == 0) {return false;}
350
+ else {
351
+ $Parent_Category = get_term($Category->parent, 'ufaq-category');
352
+ return EWD_UFAQ_Excluded_Category_Check($Parent_Category, $exclude_category_array);
353
+ }
354
+ }
355
+
356
+ function EWD_UFAQ_Included_Category_Check($Category, $include_category_array) {
357
+ if (sizeof($include_category_array) == 0) {return true;}
358
+
359
+ if (in_array($Category->slug, $include_category_array)) {return true;}
360
+ elseif ($Category->parent == 0) {return false;}
361
+ else {
362
+ $Parent_Category = get_term($Category->parent, 'ufaq-category');
363
+ return EWD_UFAQ_Included_Category_Check($Parent_Category, $include_category_array);
364
+ }
365
+ }
readme.txt CHANGED
@@ -126,6 +126,9 @@ For more questions and support you can post in the support forum:
126
  9. All answers displayed in the 'list' FAQ mode
127
 
128
  == Changelog ==
 
 
 
129
  = 1.1.13 =
130
  - Fixed a number of PHP notices
131
 
126
  9. All answers displayed in the 'list' FAQ mode
127
 
128
  == Changelog ==
129
+ = 1.1.14 =
130
+ - Fixed a parent-child issue, where if a parent category was added in the include_category attribute, it was possible to end up with unexpected categories when an FAQ was in multiple categories
131
+
132
  = 1.1.13 =
133
  - Fixed a number of PHP notices
134