Version Description
- Maintenance update (notices removed, pageload speed enhancements, small CSS fixes, etc.)
Download this release
Release Info
Developer | Rustaurius |
Plugin | Ultimate FAQ |
Version | 1.5.39 |
Comparing to | |
See all releases |
Code changes from version 1.5.38 to 1.5.39
- Functions/EWD_UFAQ_Add_Views_Column.php +1 -0
- Functions/EWD_UFAQ_Export.php +45 -44
- Functions/EWD_UFAQ_Export_To_PDF.php +16 -16
- Functions/EWD_UFAQ_Import.php +24 -23
- Functions/EWD_UFAQ_Meta_Boxes.php +12 -10
- Functions/EWD_UFAQ_Submit_Question.php +2 -2
- Functions/Update_Admin_Databases.php +5 -3
- Main.php +4 -24
- Shortcodes/DisplayFAQs.php +49 -24
- css/Admin.css +26 -1
- css/ewd-ufaq-styles.css +45 -4
- html/OptionsPage.php +5 -5
- js/Admin.js +1 -1
- readme.txt +4 -0
Functions/EWD_UFAQ_Add_Views_Column.php
CHANGED
@@ -85,6 +85,7 @@ function EWD_UFAQ_Restrict_By_Category() {
|
|
85 |
if ($typenow=='ufaq') {
|
86 |
$taxonomy = 'ufaq-category';
|
87 |
$faq_taxonomy = get_taxonomy($taxonomy);
|
|
|
88 |
wp_dropdown_categories(array(
|
89 |
'show_option_all' => __("Show All {$faq_taxonomy->label}"),
|
90 |
'taxonomy' => $taxonomy,
|
85 |
if ($typenow=='ufaq') {
|
86 |
$taxonomy = 'ufaq-category';
|
87 |
$faq_taxonomy = get_taxonomy($taxonomy);
|
88 |
+
if (!isset($wp_query->query['term'])) {$wp_query->query['term'] = '';}
|
89 |
wp_dropdown_categories(array(
|
90 |
'show_option_all' => __("Show All {$faq_taxonomy->label}"),
|
91 |
'taxonomy' => $taxonomy,
|
Functions/EWD_UFAQ_Export.php
CHANGED
@@ -1,67 +1,67 @@
|
|
1 |
<?php
|
2 |
function EWD_UFAQ_Export_To_PDF() {
|
3 |
require_once(EWD_UFAQ_CD_PLUGIN_PATH . '/FPDF/fpdf.php');
|
4 |
-
|
5 |
-
if ($Category != "EWD_UFAQ_ALL_CATEGORIES") {$category_array = array( 'taxonomy' => 'ufaq-category',
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
}
|
11 |
-
|
12 |
$params = array(
|
13 |
-
'posts_per_page' => -1,
|
14 |
'post_type' => 'ufaq'
|
15 |
);
|
16 |
$faqs = get_posts($params);
|
17 |
-
|
18 |
$PDFPasses = array("FirstPageRun", "SecondPageRun", "Final");
|
19 |
foreach ($PDFPasses as $PDFRun) {
|
20 |
$pdf = new FPDF();
|
21 |
$pdf->AddPage();
|
22 |
-
|
23 |
if ($PDFRun == "SecondPageRun" or $PDFRun == "Final") {
|
24 |
$pdf->SetFont('Arial','B',14);
|
25 |
$pdf->Cell(20, 10, "Page #");
|
26 |
$pdf->Cell(20, 10, "Article Title");
|
27 |
$pdf->Ln();
|
28 |
$pdf->SetFont('Arial','',12);
|
29 |
-
|
30 |
foreach ($ToC as $entry) {
|
31 |
$pdf->Cell(20, 5, " " . $entry['page']);
|
32 |
$pdf->MultiCell(0, 5, $entry['title']);
|
33 |
$pdf->Ln();
|
34 |
}
|
35 |
-
|
36 |
unset($ToC);
|
37 |
}
|
38 |
-
|
39 |
foreach ($faqs as $faq) {
|
40 |
$PostTitle = strip_tags(html_entity_decode($faq->post_title));
|
41 |
-
|
42 |
$PostText = strip_tags(html_entity_decode($faq->post_content));
|
43 |
$PostText = str_replace("[", "[", $PostText);
|
44 |
$PostText = str_replace("]", "]", $PostText);
|
45 |
-
|
46 |
$pdf->AddPage();
|
47 |
-
|
48 |
$Entry['page'] = $pdf->page;
|
49 |
$Entry['title'] = $PostTitle;
|
50 |
-
|
51 |
$pdf->SetFont('Arial','B',15);
|
52 |
$pdf->MultiCell(0, 10, $PostTitle);
|
53 |
$pdf->Ln();
|
54 |
$pdf->SetFont('Arial','',12);
|
55 |
$pdf->MultiCell(0, 10, $PostText);
|
56 |
-
|
57 |
$ToC[] = $Entry;
|
58 |
unset($Entry);
|
59 |
}
|
60 |
-
|
61 |
if ($PDFRun == "FirstPageRun" or $PDFRun == "SecondPageRun") {
|
62 |
$pdf->Close();
|
63 |
}
|
64 |
-
|
65 |
if ($PDFRun == "Final") {
|
66 |
$pdf->Output('Ultimate-FAQ-Manual.pdf', 'D');
|
67 |
}
|
@@ -70,36 +70,37 @@ function EWD_UFAQ_Export_To_PDF() {
|
|
70 |
|
71 |
function EWD_UFAQ_Export_To_Excel() {
|
72 |
include_once('../wp-content/plugins/ultimate-faqs/PHPExcel/Classes/PHPExcel.php');
|
73 |
-
|
74 |
-
// Instantiate a new PHPExcel object
|
75 |
-
$objPHPExcel = new PHPExcel();
|
76 |
-
// Set the active Excel worksheet to sheet 0
|
77 |
-
$objPHPExcel->setActiveSheetIndex(0);
|
78 |
|
79 |
// Print out the regular order field labels
|
80 |
$objPHPExcel->getActiveSheet()->setCellValue("A1", "Question");
|
81 |
$objPHPExcel->getActiveSheet()->setCellValue("B1", "Answer");
|
82 |
$objPHPExcel->getActiveSheet()->setCellValue("C1", "Categories");
|
83 |
-
$objPHPExcel->getActiveSheet()->setCellValue("D1", "Tags");
|
84 |
|
85 |
-
//start while loop to get data
|
86 |
$rowCount = 2;
|
87 |
$params = array(
|
88 |
'posts_per_page' => -1,
|
89 |
'post_type' => 'ufaq'
|
90 |
);
|
91 |
$Posts = get_posts($params);
|
92 |
-
foreach ($Posts as $Post)
|
93 |
-
{
|
94 |
$Categories = get_the_terms($Post->ID, "ufaq-category");
|
95 |
-
|
|
|
96 |
foreach ($Categories as $Category) {
|
97 |
$Category_String .= $Category->name . ",";
|
98 |
}
|
99 |
$Category_String = substr($Category_String, 0, -1);
|
100 |
}
|
101 |
else {$Category_String = "";}
|
102 |
-
|
103 |
$Tags = get_the_terms($Post->ID, "ufaq-tag");
|
104 |
if (is_array($Tags)) {
|
105 |
foreach ($Tags as $Tag) {
|
@@ -113,29 +114,29 @@ function EWD_UFAQ_Export_To_Excel() {
|
|
113 |
$objPHPExcel->getActiveSheet()->setCellValue("B" . $rowCount, $Post->post_content);
|
114 |
$objPHPExcel->getActiveSheet()->setCellValue("C" . $rowCount, $Category_String);
|
115 |
$objPHPExcel->getActiveSheet()->setCellValue("D" . $rowCount, $Tag_String);
|
116 |
-
|
117 |
$rowCount++;
|
118 |
|
119 |
unset($Category_String);
|
120 |
unset($Tag_String);
|
121 |
-
}
|
122 |
|
123 |
|
124 |
-
// Redirect output to a client’s web browser (Excel5)
|
125 |
-
if ($Format_Type == "CSV") {
|
126 |
-
header('Content-Type: application/vnd.ms-excel');
|
127 |
-
header('Content-Disposition: attachment;filename="FAQ_Export.csv"');
|
128 |
-
header('Cache-Control: max-age=0');
|
129 |
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
|
130 |
$objWriter->save('php://output');
|
131 |
}
|
132 |
else {
|
133 |
-
header('Content-Type: application/vnd.ms-excel');
|
134 |
-
header('Content-Disposition: attachment;filename="FAQ_Export.xls"');
|
135 |
-
header('Cache-Control: max-age=0');
|
136 |
-
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
137 |
$objWriter->save('php://output');
|
138 |
}
|
139 |
|
140 |
}
|
141 |
-
?>
|
1 |
<?php
|
2 |
function EWD_UFAQ_Export_To_PDF() {
|
3 |
require_once(EWD_UFAQ_CD_PLUGIN_PATH . '/FPDF/fpdf.php');
|
4 |
+
global $Category; /*Undefined Category variable at line 5 and 7*/
|
5 |
+
// if ($Category != "EWD_UFAQ_ALL_CATEGORIES") {$category_array = array( 'taxonomy' => 'ufaq-category',
|
6 |
+
// 'field' => 'slug',
|
7 |
+
// 'terms' => $Category->slug
|
8 |
+
// );
|
9 |
+
//
|
10 |
+
// }
|
11 |
+
|
12 |
$params = array(
|
13 |
+
'posts_per_page' => -1,
|
14 |
'post_type' => 'ufaq'
|
15 |
);
|
16 |
$faqs = get_posts($params);
|
17 |
+
|
18 |
$PDFPasses = array("FirstPageRun", "SecondPageRun", "Final");
|
19 |
foreach ($PDFPasses as $PDFRun) {
|
20 |
$pdf = new FPDF();
|
21 |
$pdf->AddPage();
|
22 |
+
|
23 |
if ($PDFRun == "SecondPageRun" or $PDFRun == "Final") {
|
24 |
$pdf->SetFont('Arial','B',14);
|
25 |
$pdf->Cell(20, 10, "Page #");
|
26 |
$pdf->Cell(20, 10, "Article Title");
|
27 |
$pdf->Ln();
|
28 |
$pdf->SetFont('Arial','',12);
|
29 |
+
|
30 |
foreach ($ToC as $entry) {
|
31 |
$pdf->Cell(20, 5, " " . $entry['page']);
|
32 |
$pdf->MultiCell(0, 5, $entry['title']);
|
33 |
$pdf->Ln();
|
34 |
}
|
35 |
+
|
36 |
unset($ToC);
|
37 |
}
|
38 |
+
|
39 |
foreach ($faqs as $faq) {
|
40 |
$PostTitle = strip_tags(html_entity_decode($faq->post_title));
|
41 |
+
|
42 |
$PostText = strip_tags(html_entity_decode($faq->post_content));
|
43 |
$PostText = str_replace("[", "[", $PostText);
|
44 |
$PostText = str_replace("]", "]", $PostText);
|
45 |
+
|
46 |
$pdf->AddPage();
|
47 |
+
|
48 |
$Entry['page'] = $pdf->page;
|
49 |
$Entry['title'] = $PostTitle;
|
50 |
+
|
51 |
$pdf->SetFont('Arial','B',15);
|
52 |
$pdf->MultiCell(0, 10, $PostTitle);
|
53 |
$pdf->Ln();
|
54 |
$pdf->SetFont('Arial','',12);
|
55 |
$pdf->MultiCell(0, 10, $PostText);
|
56 |
+
|
57 |
$ToC[] = $Entry;
|
58 |
unset($Entry);
|
59 |
}
|
60 |
+
|
61 |
if ($PDFRun == "FirstPageRun" or $PDFRun == "SecondPageRun") {
|
62 |
$pdf->Close();
|
63 |
}
|
64 |
+
|
65 |
if ($PDFRun == "Final") {
|
66 |
$pdf->Output('Ultimate-FAQ-Manual.pdf', 'D');
|
67 |
}
|
70 |
|
71 |
function EWD_UFAQ_Export_To_Excel() {
|
72 |
include_once('../wp-content/plugins/ultimate-faqs/PHPExcel/Classes/PHPExcel.php');
|
73 |
+
|
74 |
+
// Instantiate a new PHPExcel object
|
75 |
+
$objPHPExcel = new PHPExcel();
|
76 |
+
// Set the active Excel worksheet to sheet 0
|
77 |
+
$objPHPExcel->setActiveSheetIndex(0);
|
78 |
|
79 |
// Print out the regular order field labels
|
80 |
$objPHPExcel->getActiveSheet()->setCellValue("A1", "Question");
|
81 |
$objPHPExcel->getActiveSheet()->setCellValue("B1", "Answer");
|
82 |
$objPHPExcel->getActiveSheet()->setCellValue("C1", "Categories");
|
83 |
+
$objPHPExcel->getActiveSheet()->setCellValue("D1", "Tags");
|
84 |
|
85 |
+
//start while loop to get data
|
86 |
$rowCount = 2;
|
87 |
$params = array(
|
88 |
'posts_per_page' => -1,
|
89 |
'post_type' => 'ufaq'
|
90 |
);
|
91 |
$Posts = get_posts($params);
|
92 |
+
foreach ($Posts as $Post)
|
93 |
+
{
|
94 |
$Categories = get_the_terms($Post->ID, "ufaq-category");
|
95 |
+
$Category_String = '';
|
96 |
+
if (is_array($Categories)) {
|
97 |
foreach ($Categories as $Category) {
|
98 |
$Category_String .= $Category->name . ",";
|
99 |
}
|
100 |
$Category_String = substr($Category_String, 0, -1);
|
101 |
}
|
102 |
else {$Category_String = "";}
|
103 |
+
|
104 |
$Tags = get_the_terms($Post->ID, "ufaq-tag");
|
105 |
if (is_array($Tags)) {
|
106 |
foreach ($Tags as $Tag) {
|
114 |
$objPHPExcel->getActiveSheet()->setCellValue("B" . $rowCount, $Post->post_content);
|
115 |
$objPHPExcel->getActiveSheet()->setCellValue("C" . $rowCount, $Category_String);
|
116 |
$objPHPExcel->getActiveSheet()->setCellValue("D" . $rowCount, $Tag_String);
|
117 |
+
|
118 |
$rowCount++;
|
119 |
|
120 |
unset($Category_String);
|
121 |
unset($Tag_String);
|
122 |
+
}
|
123 |
|
124 |
|
125 |
+
// Redirect output to a client’s web browser (Excel5)
|
126 |
+
if (!isset($Format_Type) == "CSV") {
|
127 |
+
header('Content-Type: application/vnd.ms-excel');
|
128 |
+
header('Content-Disposition: attachment;filename="FAQ_Export.csv"');
|
129 |
+
header('Cache-Control: max-age=0');
|
130 |
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
|
131 |
$objWriter->save('php://output');
|
132 |
}
|
133 |
else {
|
134 |
+
header('Content-Type: application/vnd.ms-excel');
|
135 |
+
header('Content-Disposition: attachment;filename="FAQ_Export.xls"');
|
136 |
+
header('Cache-Control: max-age=0');
|
137 |
+
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
138 |
$objWriter->save('php://output');
|
139 |
}
|
140 |
|
141 |
}
|
142 |
+
?>
|
Functions/EWD_UFAQ_Export_To_PDF.php
CHANGED
@@ -6,65 +6,65 @@ function EWD_UFAQ_Export_To_PDF() {
|
|
6 |
'field' => 'slug',
|
7 |
'terms' => $Category->slug
|
8 |
);
|
9 |
-
|
10 |
}
|
11 |
-
|
12 |
$params = array(
|
13 |
-
'posts_per_page' => -1,
|
14 |
'post_type' => 'ufaq'
|
15 |
);
|
16 |
$faqs = get_posts($params);
|
17 |
-
|
18 |
$PDFPasses = array("FirstPageRun", "SecondPageRun", "Final");
|
19 |
foreach ($PDFPasses as $PDFRun) {
|
20 |
$pdf = new FPDF();
|
21 |
$pdf->AddPage();
|
22 |
-
|
23 |
if ($PDFRun == "SecondPageRun" or $PDFRun == "Final") {
|
24 |
$pdf->SetFont('Arial','B',14);
|
25 |
$pdf->Cell(20, 10, "Page #");
|
26 |
$pdf->Cell(20, 10, "Article Title");
|
27 |
$pdf->Ln();
|
28 |
$pdf->SetFont('Arial','',12);
|
29 |
-
|
30 |
foreach ($ToC as $entry) {
|
31 |
$pdf->Cell(20, 5, " " . $entry['page']);
|
32 |
$pdf->MultiCell(0, 5, $entry['title']);
|
33 |
$pdf->Ln();
|
34 |
}
|
35 |
-
|
36 |
unset($ToC);
|
37 |
}
|
38 |
-
|
39 |
foreach ($faqs as $faq) {
|
40 |
$PostTitle = strip_tags(html_entity_decode($faq->post_title));
|
41 |
-
|
42 |
$PostText = strip_tags(html_entity_decode($faq->post_content));
|
43 |
$PostText = str_replace("[", "[", $PostText);
|
44 |
$PostText = str_replace("]", "]", $PostText);
|
45 |
-
|
46 |
$pdf->AddPage();
|
47 |
-
|
48 |
$Entry['page'] = $pdf->page;
|
49 |
$Entry['title'] = $PostTitle;
|
50 |
-
|
51 |
$pdf->SetFont('Arial','B',15);
|
52 |
$pdf->MultiCell(0, 10, $PostTitle);
|
53 |
$pdf->Ln();
|
54 |
$pdf->SetFont('Arial','',12);
|
55 |
$pdf->MultiCell(0, 10, $PostText);
|
56 |
-
|
57 |
$ToC[] = $Entry;
|
58 |
unset($Entry);
|
59 |
}
|
60 |
-
|
61 |
if ($PDFRun == "FirstPageRun" or $PDFRun == "SecondPageRun") {
|
62 |
$pdf->Close();
|
63 |
}
|
64 |
-
|
65 |
if ($PDFRun == "Final") {
|
66 |
$pdf->Output('Ultimate-FAQ-Manual.pdf', 'D');
|
67 |
}
|
68 |
}
|
69 |
}
|
70 |
-
?>
|
6 |
'field' => 'slug',
|
7 |
'terms' => $Category->slug
|
8 |
);
|
9 |
+
|
10 |
}
|
11 |
+
|
12 |
$params = array(
|
13 |
+
'posts_per_page' => -1,
|
14 |
'post_type' => 'ufaq'
|
15 |
);
|
16 |
$faqs = get_posts($params);
|
17 |
+
|
18 |
$PDFPasses = array("FirstPageRun", "SecondPageRun", "Final");
|
19 |
foreach ($PDFPasses as $PDFRun) {
|
20 |
$pdf = new FPDF();
|
21 |
$pdf->AddPage();
|
22 |
+
|
23 |
if ($PDFRun == "SecondPageRun" or $PDFRun == "Final") {
|
24 |
$pdf->SetFont('Arial','B',14);
|
25 |
$pdf->Cell(20, 10, "Page #");
|
26 |
$pdf->Cell(20, 10, "Article Title");
|
27 |
$pdf->Ln();
|
28 |
$pdf->SetFont('Arial','',12);
|
29 |
+
|
30 |
foreach ($ToC as $entry) {
|
31 |
$pdf->Cell(20, 5, " " . $entry['page']);
|
32 |
$pdf->MultiCell(0, 5, $entry['title']);
|
33 |
$pdf->Ln();
|
34 |
}
|
35 |
+
|
36 |
unset($ToC);
|
37 |
}
|
38 |
+
|
39 |
foreach ($faqs as $faq) {
|
40 |
$PostTitle = strip_tags(html_entity_decode($faq->post_title));
|
41 |
+
|
42 |
$PostText = strip_tags(html_entity_decode($faq->post_content));
|
43 |
$PostText = str_replace("[", "[", $PostText);
|
44 |
$PostText = str_replace("]", "]", $PostText);
|
45 |
+
|
46 |
$pdf->AddPage();
|
47 |
+
|
48 |
$Entry['page'] = $pdf->page;
|
49 |
$Entry['title'] = $PostTitle;
|
50 |
+
|
51 |
$pdf->SetFont('Arial','B',15);
|
52 |
$pdf->MultiCell(0, 10, $PostTitle);
|
53 |
$pdf->Ln();
|
54 |
$pdf->SetFont('Arial','',12);
|
55 |
$pdf->MultiCell(0, 10, $PostText);
|
56 |
+
|
57 |
$ToC[] = $Entry;
|
58 |
unset($Entry);
|
59 |
}
|
60 |
+
|
61 |
if ($PDFRun == "FirstPageRun" or $PDFRun == "SecondPageRun") {
|
62 |
$pdf->Close();
|
63 |
}
|
64 |
+
|
65 |
if ($PDFRun == "Final") {
|
66 |
$pdf->Output('Ultimate-FAQ-Manual.pdf', 'D');
|
67 |
}
|
68 |
}
|
69 |
}
|
70 |
+
?>
|
Functions/EWD_UFAQ_Import.php
CHANGED
@@ -11,7 +11,7 @@ function EWD_UFAQ_Import(){
|
|
11 |
if (is_array($Results)){
|
12 |
|
13 |
foreach($Results as $Result){
|
14 |
-
|
15 |
$data_array = array('post_type' => 'ufaq');
|
16 |
//$data_array = array('post_type' => 'qa_faqs');
|
17 |
$where = array('ID' => $Result->ID);
|
@@ -26,13 +26,13 @@ function EWD_UFAQ_Import(){
|
|
26 |
//$where = array('taxonomy' => 'ufaq-category');
|
27 |
$wpdb->update($Terms_Table_Name, $data_array, $where);
|
28 |
|
29 |
-
$args = array('post_type' => 'ufaq');
|
30 |
$FAQs_Query = new WP_Query($args);
|
31 |
$FAQs = $FAQs_Query->get_posts();
|
32 |
-
|
33 |
foreach ($FAQs as $FAQ) {
|
34 |
if (get_post_meta($FAQ->ID, 'ufaq_view_count', true) == "") {update_post_meta($FAQ->ID, 'ufaq_view_count', 0);}
|
35 |
-
}
|
36 |
|
37 |
echo $wpdb->last_query;
|
38 |
}
|
@@ -41,32 +41,32 @@ function Add_EWD_UFAQs_From_Spreadsheet($Excel_File_Name){
|
|
41 |
global $wpdb;
|
42 |
|
43 |
$Excel_URL = '../wp-content/plugins/ultimate-faqs/faq-sheets/' . $Excel_File_Name;
|
44 |
-
|
45 |
// Uses the PHPExcel class to simplify the file parsing process
|
46 |
include_once('../wp-content/plugins/ultimate-faqs/PHPExcel/Classes/PHPExcel.php');
|
47 |
-
|
48 |
// Build the workbook object out of the uploaded spredsheet
|
49 |
$inputFileType = PHPExcel_IOFactory::identify($Excel_URL);
|
50 |
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
51 |
$objWorkBook = $objReader->load($Excel_URL);
|
52 |
-
|
53 |
// Create a worksheet object out of the product sheet in the workbook
|
54 |
$sheet = $objWorkBook->getActiveSheet();
|
55 |
-
|
56 |
$Allowable_Custom_Fields = array();
|
57 |
//List of fields that can be accepted via upload
|
58 |
$Allowed_Fields = array("Question", "Answer", "Categories", "Tags");
|
59 |
-
|
60 |
// Get column names
|
61 |
$highestColumn = $sheet->getHighestColumn();
|
62 |
-
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
|
63 |
for ($column = 0; $column < $highestColumnIndex; $column++) {
|
64 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Question") {$Question_Column = $column;}
|
65 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Answer") {$Answer_Column = $column;}
|
66 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Categories") {$Categories_Column = $column;}
|
67 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Tags") {$Tags_Column = $column;}
|
68 |
}
|
69 |
-
|
70 |
// Put the spreadsheet data into a multi-dimensional array to facilitate processing
|
71 |
$highestRow = $sheet->getHighestRow();
|
72 |
for ($row = 2; $row <= $highestRow; $row++) {
|
@@ -77,7 +77,7 @@ function Add_EWD_UFAQs_From_Spreadsheet($Excel_File_Name){
|
|
77 |
|
78 |
// Create the query to insert the products one at a time into the database and then run it
|
79 |
foreach ($Data as $FAQ) {
|
80 |
-
|
81 |
// Create an array of the values that are being inserted for each order,
|
82 |
// edit if it's a current order, otherwise add it
|
83 |
foreach ($FAQ as $Col_Index => $Value) {
|
@@ -102,7 +102,7 @@ function Add_EWD_UFAQs_From_Spreadsheet($Excel_File_Name){
|
|
102 |
}
|
103 |
if (is_array($Category_IDs)) {wp_set_object_terms($Post_ID, $Tag_IDs, 'ufaq-tag');}
|
104 |
}
|
105 |
-
|
106 |
unset($Post);
|
107 |
unset($Post_Categories);
|
108 |
unset($Post_Tags);
|
@@ -114,7 +114,7 @@ function Add_EWD_UFAQs_From_Spreadsheet($Excel_File_Name){
|
|
114 |
}
|
115 |
|
116 |
function EWD_UFAQ_Import_From_Spreadsheet() {
|
117 |
-
|
118 |
/* Test if there is an error with the uploaded spreadsheet and return that error if there is */
|
119 |
if (!empty($_FILES['FAQs_Spreadsheet']['error']))
|
120 |
{
|
@@ -148,22 +148,23 @@ function EWD_UFAQ_Import_From_Spreadsheet() {
|
|
148 |
$error = __('No error code avaiable', 'ultimate-faqs');
|
149 |
}
|
150 |
}
|
151 |
-
/* Make sure that the file exists */
|
152 |
elseif (empty($_FILES['FAQs_Spreadsheet']['tmp_name']) || $_FILES['FAQs_Spreadsheet']['tmp_name'] == 'none') {
|
153 |
$error = __('No file was uploaded here..', 'ultimate-faqs');
|
154 |
}
|
155 |
-
/* Move the file and store the URL to pass it onwards*/
|
156 |
/* Check that it is a .xls or .xlsx file */
|
157 |
-
if(!preg_match("/\.(xls.?)$/", $_FILES['FAQs_Spreadsheet']['name']) and !preg_match("/\.(csv.?)$/", $_FILES['FAQs_Spreadsheet']['name'])) {
|
158 |
$error = __('File must be .csv, .xls or .xlsx', 'ultimate-faqs');
|
159 |
-
}
|
160 |
-
else {
|
161 |
-
|
|
|
162 |
//for security reason, we force to remove all uploaded file
|
163 |
$target_path = ABSPATH . "wp-content/plugins/ultimate-faqs/faq-sheets/";
|
164 |
//plugins_url("order-tracking/product-sheets/");
|
165 |
|
166 |
-
$target_path = $target_path . basename( $_FILES['FAQs_Spreadsheet']['name']);
|
167 |
|
168 |
if (!move_uploaded_file($_FILES['FAQs_Spreadsheet']['tmp_name'], $target_path)) {
|
169 |
//if (!$upload = wp_upload_bits($_FILES["Item_Image"]["name"], null, file_get_contents($_FILES["Item_Image"]["tmp_name"]))) {
|
@@ -171,7 +172,7 @@ function EWD_UFAQ_Import_From_Spreadsheet() {
|
|
171 |
}
|
172 |
else {
|
173 |
$Excel_File_Name = basename( $_FILES['FAQs_Spreadsheet']['name']);
|
174 |
-
}
|
175 |
}
|
176 |
|
177 |
/* Pass the data to the appropriate function in Update_Admin_Databases.php to create the products */
|
@@ -184,4 +185,4 @@ function EWD_UFAQ_Import_From_Spreadsheet() {
|
|
184 |
return $output_error;
|
185 |
}
|
186 |
}
|
187 |
-
?>
|
11 |
if (is_array($Results)){
|
12 |
|
13 |
foreach($Results as $Result){
|
14 |
+
|
15 |
$data_array = array('post_type' => 'ufaq');
|
16 |
//$data_array = array('post_type' => 'qa_faqs');
|
17 |
$where = array('ID' => $Result->ID);
|
26 |
//$where = array('taxonomy' => 'ufaq-category');
|
27 |
$wpdb->update($Terms_Table_Name, $data_array, $where);
|
28 |
|
29 |
+
$args = array('post_type' => 'ufaq');
|
30 |
$FAQs_Query = new WP_Query($args);
|
31 |
$FAQs = $FAQs_Query->get_posts();
|
32 |
+
|
33 |
foreach ($FAQs as $FAQ) {
|
34 |
if (get_post_meta($FAQ->ID, 'ufaq_view_count', true) == "") {update_post_meta($FAQ->ID, 'ufaq_view_count', 0);}
|
35 |
+
}
|
36 |
|
37 |
echo $wpdb->last_query;
|
38 |
}
|
41 |
global $wpdb;
|
42 |
|
43 |
$Excel_URL = '../wp-content/plugins/ultimate-faqs/faq-sheets/' . $Excel_File_Name;
|
44 |
+
|
45 |
// Uses the PHPExcel class to simplify the file parsing process
|
46 |
include_once('../wp-content/plugins/ultimate-faqs/PHPExcel/Classes/PHPExcel.php');
|
47 |
+
|
48 |
// Build the workbook object out of the uploaded spredsheet
|
49 |
$inputFileType = PHPExcel_IOFactory::identify($Excel_URL);
|
50 |
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
51 |
$objWorkBook = $objReader->load($Excel_URL);
|
52 |
+
|
53 |
// Create a worksheet object out of the product sheet in the workbook
|
54 |
$sheet = $objWorkBook->getActiveSheet();
|
55 |
+
|
56 |
$Allowable_Custom_Fields = array();
|
57 |
//List of fields that can be accepted via upload
|
58 |
$Allowed_Fields = array("Question", "Answer", "Categories", "Tags");
|
59 |
+
|
60 |
// Get column names
|
61 |
$highestColumn = $sheet->getHighestColumn();
|
62 |
+
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
|
63 |
for ($column = 0; $column < $highestColumnIndex; $column++) {
|
64 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Question") {$Question_Column = $column;}
|
65 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Answer") {$Answer_Column = $column;}
|
66 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Categories") {$Categories_Column = $column;}
|
67 |
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Tags") {$Tags_Column = $column;}
|
68 |
}
|
69 |
+
|
70 |
// Put the spreadsheet data into a multi-dimensional array to facilitate processing
|
71 |
$highestRow = $sheet->getHighestRow();
|
72 |
for ($row = 2; $row <= $highestRow; $row++) {
|
77 |
|
78 |
// Create the query to insert the products one at a time into the database and then run it
|
79 |
foreach ($Data as $FAQ) {
|
80 |
+
|
81 |
// Create an array of the values that are being inserted for each order,
|
82 |
// edit if it's a current order, otherwise add it
|
83 |
foreach ($FAQ as $Col_Index => $Value) {
|
102 |
}
|
103 |
if (is_array($Category_IDs)) {wp_set_object_terms($Post_ID, $Tag_IDs, 'ufaq-tag');}
|
104 |
}
|
105 |
+
|
106 |
unset($Post);
|
107 |
unset($Post_Categories);
|
108 |
unset($Post_Tags);
|
114 |
}
|
115 |
|
116 |
function EWD_UFAQ_Import_From_Spreadsheet() {
|
117 |
+
|
118 |
/* Test if there is an error with the uploaded spreadsheet and return that error if there is */
|
119 |
if (!empty($_FILES['FAQs_Spreadsheet']['error']))
|
120 |
{
|
148 |
$error = __('No error code avaiable', 'ultimate-faqs');
|
149 |
}
|
150 |
}
|
151 |
+
/* Make sure that the file exists */
|
152 |
elseif (empty($_FILES['FAQs_Spreadsheet']['tmp_name']) || $_FILES['FAQs_Spreadsheet']['tmp_name'] == 'none') {
|
153 |
$error = __('No file was uploaded here..', 'ultimate-faqs');
|
154 |
}
|
155 |
+
/* Move the file and store the URL to pass it onwards*/
|
156 |
/* Check that it is a .xls or .xlsx file */
|
157 |
+
if(!isset($_FILES['FAQs_Spreadsheet']['name']) or (!preg_match("/\.(xls.?)$/", $_FILES['FAQs_Spreadsheet']['name']) and !preg_match("/\.(csv.?)$/", $_FILES['FAQs_Spreadsheet']['name']))) {
|
158 |
$error = __('File must be .csv, .xls or .xlsx', 'ultimate-faqs');
|
159 |
+
}
|
160 |
+
else {
|
161 |
+
$msg = " ";
|
162 |
+
$msg .= $_FILES['FAQs_Spreadsheet']['name'];
|
163 |
//for security reason, we force to remove all uploaded file
|
164 |
$target_path = ABSPATH . "wp-content/plugins/ultimate-faqs/faq-sheets/";
|
165 |
//plugins_url("order-tracking/product-sheets/");
|
166 |
|
167 |
+
$target_path = $target_path . basename( $_FILES['FAQs_Spreadsheet']['name']);
|
168 |
|
169 |
if (!move_uploaded_file($_FILES['FAQs_Spreadsheet']['tmp_name'], $target_path)) {
|
170 |
//if (!$upload = wp_upload_bits($_FILES["Item_Image"]["name"], null, file_get_contents($_FILES["Item_Image"]["tmp_name"]))) {
|
172 |
}
|
173 |
else {
|
174 |
$Excel_File_Name = basename( $_FILES['FAQs_Spreadsheet']['name']);
|
175 |
+
}
|
176 |
}
|
177 |
|
178 |
/* Pass the data to the appropriate function in Update_Admin_Databases.php to create the products */
|
185 |
return $output_error;
|
186 |
}
|
187 |
}
|
188 |
+
?>
|
Functions/EWD_UFAQ_Meta_Boxes.php
CHANGED
@@ -24,7 +24,7 @@ function EWD_UFAQ_Add_Meta_Boxes () {
|
|
24 |
|
25 |
/**
|
26 |
* Prints the box content.
|
27 |
-
*
|
28 |
* @param WP_Post $post The object for the current post/page.
|
29 |
*/
|
30 |
function EWD_UFAQ_Meta_Box( $post ) {
|
@@ -45,7 +45,7 @@ function EWD_UFAQ_Meta_Box( $post ) {
|
|
45 |
$User = wp_get_current_user();
|
46 |
$Author = $User->display_name;
|
47 |
}
|
48 |
-
|
49 |
echo "<div class='ewd-ufaq-meta-field'>";
|
50 |
echo "<label for='Post_Author'>";
|
51 |
echo __( "Author Display Name:", 'EWD_UFAQ' );
|
@@ -82,8 +82,8 @@ function EWD_UFAQ_Meta_Box( $post ) {
|
|
82 |
}
|
83 |
elseif ($FAQ_Field_Item['FieldType'] == "textarea") {
|
84 |
echo "<textarea name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' id='ewd-ufaq-input-" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-textarea' cols='60' rows='6'>" . $Value . "</textarea>";
|
85 |
-
}
|
86 |
-
elseif ($FAQ_Field_Item['FieldType'] == "select") {
|
87 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
88 |
echo "<select name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' id='ewd-ufaq-input-" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-select'>";
|
89 |
foreach ($Options as $Option) {
|
@@ -92,7 +92,7 @@ function EWD_UFAQ_Meta_Box( $post ) {
|
|
92 |
echo ">" . $Option . "</option>";
|
93 |
}
|
94 |
echo "</select>";
|
95 |
-
}
|
96 |
elseif ($FAQ_Field_Item['FieldType'] == "radio") {
|
97 |
$Counter = 0;
|
98 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
@@ -103,9 +103,9 @@ function EWD_UFAQ_Meta_Box( $post ) {
|
|
103 |
if (trim($Option) == trim($Value)) {echo "checked";}
|
104 |
echo ">" . $Option;
|
105 |
$Counter++;
|
106 |
-
}
|
107 |
echo "";
|
108 |
-
}
|
109 |
elseif ($FAQ_Field_Item['FieldType'] == "checkbox") {
|
110 |
$Counter = 0;
|
111 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
@@ -128,7 +128,7 @@ function EWD_UFAQ_Meta_Box( $post ) {
|
|
128 |
}
|
129 |
elseif ($FAQ_Field_Item['FieldType'] == "date") {
|
130 |
echo "<input name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-date-input' type='date' value='" . $Value . "' />";
|
131 |
-
}
|
132 |
elseif ($FAQ_Field_Item['FieldType'] == "datetime") {
|
133 |
echo "<input name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-datetime-input' type='datetime-local' value='" . $Value . "' />";
|
134 |
}
|
@@ -181,6 +181,8 @@ function EWD_UFAQ_Save_Meta_Box_Data($post_id) {
|
|
181 |
$FieldName = "Custom_Field_" . $FAQ_Field_Item['FieldID'];
|
182 |
if (isset($_POST[$FieldName]) or isset($_FILES[$FieldName])) {
|
183 |
// If it's a file, pass back to Prepare_Data_For_Insertion.php to upload the file and get the name
|
|
|
|
|
184 |
if ($FAQ_Field_Item['FieldType'] == "file") {
|
185 |
$File_Upload_Return = EWD_UFAQ_Handle_File_Upload($FieldName);
|
186 |
if ($File_Upload_Return['Success'] == "No") {return $File_Upload_Return['Data'];}
|
@@ -238,7 +240,7 @@ function EWD_UFAQ_Add_Edit_Form_Multipart_Encoding() {
|
|
238 |
add_action('post_edit_form_tag', 'EWD_UFAQ_Add_Edit_Form_Multipart_Encoding');
|
239 |
|
240 |
function EWD_UFAQ_Handle_File_Upload($Field_Name) {
|
241 |
-
|
242 |
if (!is_user_logged_in()) {exit();}
|
243 |
|
244 |
if (isset($_FILES[$Field_Name]) && ($_FILES[$Field_Name]['size'] > 0)) {
|
@@ -260,4 +262,4 @@ function EWD_UFAQ_Handle_File_Upload($Field_Name) {
|
|
260 |
return $Return;
|
261 |
}
|
262 |
|
263 |
-
?>
|
24 |
|
25 |
/**
|
26 |
* Prints the box content.
|
27 |
+
*
|
28 |
* @param WP_Post $post The object for the current post/page.
|
29 |
*/
|
30 |
function EWD_UFAQ_Meta_Box( $post ) {
|
45 |
$User = wp_get_current_user();
|
46 |
$Author = $User->display_name;
|
47 |
}
|
48 |
+
|
49 |
echo "<div class='ewd-ufaq-meta-field'>";
|
50 |
echo "<label for='Post_Author'>";
|
51 |
echo __( "Author Display Name:", 'EWD_UFAQ' );
|
82 |
}
|
83 |
elseif ($FAQ_Field_Item['FieldType'] == "textarea") {
|
84 |
echo "<textarea name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' id='ewd-ufaq-input-" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-textarea' cols='60' rows='6'>" . $Value . "</textarea>";
|
85 |
+
}
|
86 |
+
elseif ($FAQ_Field_Item['FieldType'] == "select") {
|
87 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
88 |
echo "<select name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' id='ewd-ufaq-input-" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-select'>";
|
89 |
foreach ($Options as $Option) {
|
92 |
echo ">" . $Option . "</option>";
|
93 |
}
|
94 |
echo "</select>";
|
95 |
+
}
|
96 |
elseif ($FAQ_Field_Item['FieldType'] == "radio") {
|
97 |
$Counter = 0;
|
98 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
103 |
if (trim($Option) == trim($Value)) {echo "checked";}
|
104 |
echo ">" . $Option;
|
105 |
$Counter++;
|
106 |
+
}
|
107 |
echo "";
|
108 |
+
}
|
109 |
elseif ($FAQ_Field_Item['FieldType'] == "checkbox") {
|
110 |
$Counter = 0;
|
111 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
128 |
}
|
129 |
elseif ($FAQ_Field_Item['FieldType'] == "date") {
|
130 |
echo "<input name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-date-input' type='date' value='" . $Value . "' />";
|
131 |
+
}
|
132 |
elseif ($FAQ_Field_Item['FieldType'] == "datetime") {
|
133 |
echo "<input name='Custom_Field_" . $FAQ_Field_Item['FieldID'] . "' class='ewd-ufaq-datetime-input' type='datetime-local' value='" . $Value . "' />";
|
134 |
}
|
181 |
$FieldName = "Custom_Field_" . $FAQ_Field_Item['FieldID'];
|
182 |
if (isset($_POST[$FieldName]) or isset($_FILES[$FieldName])) {
|
183 |
// If it's a file, pass back to Prepare_Data_For_Insertion.php to upload the file and get the name
|
184 |
+
$Value = '';
|
185 |
+
$NoFile = '';
|
186 |
if ($FAQ_Field_Item['FieldType'] == "file") {
|
187 |
$File_Upload_Return = EWD_UFAQ_Handle_File_Upload($FieldName);
|
188 |
if ($File_Upload_Return['Success'] == "No") {return $File_Upload_Return['Data'];}
|
240 |
add_action('post_edit_form_tag', 'EWD_UFAQ_Add_Edit_Form_Multipart_Encoding');
|
241 |
|
242 |
function EWD_UFAQ_Handle_File_Upload($Field_Name) {
|
243 |
+
|
244 |
if (!is_user_logged_in()) {exit();}
|
245 |
|
246 |
if (isset($_FILES[$Field_Name]) && ($_FILES[$Field_Name]['size'] > 0)) {
|
262 |
return $Return;
|
263 |
}
|
264 |
|
265 |
+
?>
|
Functions/EWD_UFAQ_Submit_Question.php
CHANGED
@@ -3,7 +3,7 @@ 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 = sanitize_text_field($_POST['Post_Body']);
|
7 |
$Post_Author = sanitize_text_field($_POST['Post_Author']);
|
8 |
|
9 |
$post = array(
|
@@ -47,4 +47,4 @@ function EWD_UFAQ_Send_Admin_Notification_Email($post_id, $Post_Title, $Post_Bod
|
|
47 |
$Mail_Success = wp_mail($Admin_Email, $Subject_Line, $Message_Body, $headers);
|
48 |
}
|
49 |
|
50 |
-
?>
|
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(
|
47 |
$Mail_Success = wp_mail($Admin_Email, $Subject_Line, $Message_Body, $headers);
|
48 |
}
|
49 |
|
50 |
+
?>
|
Functions/Update_Admin_Databases.php
CHANGED
@@ -13,8 +13,8 @@ add_action('save_post_ufaq', 'EWD_UFAQ_Add_Post_Order_Meta');
|
|
13 |
function EWD_UFAQ_UpdateOptions() {
|
14 |
global $UFAQ_Full_Version;
|
15 |
|
16 |
-
$Custom_CSS = $_POST['custom_css'];
|
17 |
-
$Social_Media_Array = $_POST['Socialmedia'];
|
18 |
if (is_array($Social_Media_Array)) {$Social_Media = implode(",", $Social_Media_Array);}
|
19 |
|
20 |
$Custom_CSS = stripslashes_deep($Custom_CSS);
|
@@ -59,6 +59,7 @@ function EWD_UFAQ_UpdateOptions() {
|
|
59 |
if (isset($_POST['order_setting'])) {update_option('EWD_UFAQ_Order', $_POST['order_setting']);}
|
60 |
|
61 |
$Counter = 0;
|
|
|
62 |
while ($Counter < 30) {
|
63 |
if (isset($_POST['Custom_Field_' . $Counter . '_Name'])) {
|
64 |
$Prefix = 'Custom_Field_' . $Counter;
|
@@ -73,6 +74,7 @@ function EWD_UFAQ_UpdateOptions() {
|
|
73 |
}
|
74 |
$Counter++;
|
75 |
}
|
|
|
76 |
if (isset($_POST['Options_Submit'])) {update_option('EWD_UFAQ_FAQ_Fields', $Custom_Fields);}
|
77 |
if (isset($_POST['hide_blank_fields'])) {update_option('EWD_UFAQ_Hide_Blank_Fields', $_POST['hide_blank_fields']);}
|
78 |
|
@@ -142,7 +144,7 @@ function EWD_UFAQ_UpdateOptions() {
|
|
142 |
|
143 |
if (isset($_POST['custom_css'])) {update_option('EWD_UFAQ_Custom_CSS', $Custom_CSS);}
|
144 |
|
145 |
-
if ($_POST['Pretty_Permalinks'] == "Yes") {
|
146 |
update_option("EWD_UFAQ_Rewrite_Rules", "Yes");
|
147 |
}
|
148 |
}
|
13 |
function EWD_UFAQ_UpdateOptions() {
|
14 |
global $UFAQ_Full_Version;
|
15 |
|
16 |
+
$Custom_CSS = (isset($_POST['custom_css']) ? $_POST['custom_css'] : null);
|
17 |
+
$Social_Media_Array = (isset($_POST['Socialmedia']) ? $_POST['Socialmedia'] : null);
|
18 |
if (is_array($Social_Media_Array)) {$Social_Media = implode(",", $Social_Media_Array);}
|
19 |
|
20 |
$Custom_CSS = stripslashes_deep($Custom_CSS);
|
59 |
if (isset($_POST['order_setting'])) {update_option('EWD_UFAQ_Order', $_POST['order_setting']);}
|
60 |
|
61 |
$Counter = 0;
|
62 |
+
$Custom_Fields = array();
|
63 |
while ($Counter < 30) {
|
64 |
if (isset($_POST['Custom_Field_' . $Counter . '_Name'])) {
|
65 |
$Prefix = 'Custom_Field_' . $Counter;
|
74 |
}
|
75 |
$Counter++;
|
76 |
}
|
77 |
+
|
78 |
if (isset($_POST['Options_Submit'])) {update_option('EWD_UFAQ_FAQ_Fields', $Custom_Fields);}
|
79 |
if (isset($_POST['hide_blank_fields'])) {update_option('EWD_UFAQ_Hide_Blank_Fields', $_POST['hide_blank_fields']);}
|
80 |
|
144 |
|
145 |
if (isset($_POST['custom_css'])) {update_option('EWD_UFAQ_Custom_CSS', $Custom_CSS);}
|
146 |
|
147 |
+
if (isset($_POST['Pretty_Permalinks']) and $_POST['Pretty_Permalinks'] == "Yes") {
|
148 |
update_option("EWD_UFAQ_Rewrite_Rules", "Yes");
|
149 |
}
|
150 |
}
|
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.5.
|
11 |
*/
|
12 |
|
13 |
global $ewd_ufaq_message;
|
@@ -124,7 +124,7 @@ function Add_EWD_UFAQ_Scripts($hook) {
|
|
124 |
}
|
125 |
|
126 |
if ($hook == 'edit.php' or $hook == 'post-new.php' or $hook == 'post.php') {
|
127 |
-
if ($post->post_type == 'product') {
|
128 |
wp_enqueue_script('ewd-ufaq-wc-admin', plugins_url("js/ewd-ufaq-wc-admin.js", __FILE__, array('jquery')));
|
129 |
}
|
130 |
}
|
@@ -132,14 +132,14 @@ function Add_EWD_UFAQ_Scripts($hook) {
|
|
132 |
|
133 |
function EWD_UFAQ_Admin_Options() {
|
134 |
global $EWD_UFAQ_Version;
|
135 |
-
|
136 |
wp_enqueue_style( 'ewd-ufaq-admin', plugins_url("ultimate-faqs/css/Admin.css"), array(), $EWD_UFAQ_Version);
|
137 |
wp_enqueue_style( 'ewd-ufaq-spectrum', plugins_url("ultimate-faqs/css/spectrum.css"));
|
138 |
}
|
139 |
|
140 |
add_action( 'wp_enqueue_scripts', 'Add_EWD_UFAQ_FrontEnd_Scripts' );
|
141 |
function Add_EWD_UFAQ_FrontEnd_Scripts() {
|
142 |
-
|
143 |
|
144 |
$Retrieving_Results = get_option("EWD_UFAQ_Retrieving_Results");
|
145 |
if ($Retrieving_Results == "") {$Retrieving_Results = __("Retrieving Results", 'ultimate-faqs') . "...";}
|
@@ -149,26 +149,6 @@ function Add_EWD_UFAQ_FrontEnd_Scripts() {
|
|
149 |
);
|
150 |
|
151 |
wp_localize_script('ewd-ufaq-js', 'ewd_ufaq_php_data', $ewd_ufaq_php_data );
|
152 |
-
|
153 |
-
wp_enqueue_script("jquery-ui-core");
|
154 |
-
wp_enqueue_script("jquery-effects-core");
|
155 |
-
wp_enqueue_script('jquery-ui-autocomplete');
|
156 |
-
|
157 |
-
$Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
|
158 |
-
|
159 |
-
if ($Reveal_Effect == "blind") {wp_enqueue_script("jquery-effects-blind");}
|
160 |
-
if ($Reveal_Effect == "bounce") {wp_enqueue_script("jquery-effects-bounce");}
|
161 |
-
if ($Reveal_Effect == "clip") {wp_enqueue_script("jquery-effects-clip");}
|
162 |
-
if ($Reveal_Effect == "drop") {wp_enqueue_script("jquery-effects-drop");}
|
163 |
-
if ($Reveal_Effect == "explode") {wp_enqueue_script("jquery-effects-explode");}
|
164 |
-
if ($Reveal_Effect == "fade") {wp_enqueue_script("jquery-effects-fade");}
|
165 |
-
if ($Reveal_Effect == "fold") {wp_enqueue_script("jquery-effects-fold");}
|
166 |
-
if ($Reveal_Effect == "highlight") {wp_enqueue_script("jquery-effects-highlight");}
|
167 |
-
if ($Reveal_Effect == "pulsate") {wp_enqueue_script("jquery-effects-pulsate");}
|
168 |
-
wp_enqueue_script("jquery-effects-scale");
|
169 |
-
if ($Reveal_Effect == "shake") {wp_enqueue_script("jquery-effects-shake");}
|
170 |
-
if ($Reveal_Effect == "slide") {wp_enqueue_script("jquery-effects-slide");}
|
171 |
-
wp_enqueue_script("jquery-effects-transfer");
|
172 |
}
|
173 |
|
174 |
|
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.5.39
|
11 |
*/
|
12 |
|
13 |
global $ewd_ufaq_message;
|
124 |
}
|
125 |
|
126 |
if ($hook == 'edit.php' or $hook == 'post-new.php' or $hook == 'post.php') {
|
127 |
+
if (isset($post->post_type) and $post->post_type == 'product') {
|
128 |
wp_enqueue_script('ewd-ufaq-wc-admin', plugins_url("js/ewd-ufaq-wc-admin.js", __FILE__, array('jquery')));
|
129 |
}
|
130 |
}
|
132 |
|
133 |
function EWD_UFAQ_Admin_Options() {
|
134 |
global $EWD_UFAQ_Version;
|
135 |
+
|
136 |
wp_enqueue_style( 'ewd-ufaq-admin', plugins_url("ultimate-faqs/css/Admin.css"), array(), $EWD_UFAQ_Version);
|
137 |
wp_enqueue_style( 'ewd-ufaq-spectrum', plugins_url("ultimate-faqs/css/spectrum.css"));
|
138 |
}
|
139 |
|
140 |
add_action( 'wp_enqueue_scripts', 'Add_EWD_UFAQ_FrontEnd_Scripts' );
|
141 |
function Add_EWD_UFAQ_FrontEnd_Scripts() {
|
142 |
+
wp_register_script('ewd-ufaq-js', plugins_url( '/js/ewd-ufaq-js.js' , __FILE__ ), array( 'jquery' ));
|
143 |
|
144 |
$Retrieving_Results = get_option("EWD_UFAQ_Retrieving_Results");
|
145 |
if ($Retrieving_Results == "") {$Retrieving_Results = __("Retrieving Results", 'ultimate-faqs') . "...";}
|
149 |
);
|
150 |
|
151 |
wp_localize_script('ewd-ufaq-js', 'ewd_ufaq_php_data', $ewd_ufaq_php_data );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
|
154 |
|
Shortcodes/DisplayFAQs.php
CHANGED
@@ -36,7 +36,7 @@ function Display_FAQs($atts) {
|
|
36 |
$FAQ_Fields_Array = get_option("EWD_UFAQ_FAQ_Fields");
|
37 |
if (!is_array($FAQ_Fields_Array)) {$FAQ_Fields_Array = array();}
|
38 |
$Hide_Blank_Fields = get_option("EWD_UFAQ_Hide_Blank_Fields");
|
39 |
-
|
40 |
$Posted_Label = get_option("EWD_UFAQ_Posted_Label");
|
41 |
if ($Posted_Label == "") {$Posted_Label = __("Posted ", 'ultimate-faqs');}
|
42 |
$By_Label = get_option("EWD_UFAQ_By_Label");
|
@@ -60,13 +60,14 @@ function Display_FAQs($atts) {
|
|
60 |
|
61 |
if ($Display_Style != "Color_Block") {$Color_Block_Shape = "";}
|
62 |
else {$Color_Block_Shape = "ewd-ufaq-" . $Color_Block_Shape;}
|
63 |
-
|
64 |
$Unique_ID = EWD_UFAQ_Rand_Chars(3);
|
|
|
65 |
|
66 |
$ReturnString = "";
|
67 |
$HeaderString = "";
|
68 |
$TitlesArray = array();
|
69 |
-
|
70 |
// Get the attributes passed by the shortcode, and store them in new variables for processing
|
71 |
extract( shortcode_atts( array(
|
72 |
'search_string' => "",
|
@@ -95,7 +96,7 @@ function Display_FAQs($atts) {
|
|
95 |
if (strpos($current_url,'?include_category') !== false) {$current_url = substr($current_url,0,strpos($current_url,'?include_category'));}
|
96 |
|
97 |
if (strpos($No_Results_Found_Text, "%s")) {$No_Results_Found_Text = str_replace("%s", $search_string, $No_Results_Found_Text);}
|
98 |
-
|
99 |
$search_string = strtolower($search_string);
|
100 |
|
101 |
if ($display_all_answers != "") {$Display_All_Answers = $display_all_answers;}
|
@@ -106,7 +107,7 @@ function Display_FAQs($atts) {
|
|
106 |
}
|
107 |
elseif ($post__in_string != "") {$post_id_array = explode(",", $post__in_string);}
|
108 |
else {$post_id_array = "";}
|
109 |
-
|
110 |
if ($orderby == "") {$orderby = $Order_By_Setting;}
|
111 |
if ($orderby == "popular" or $orderby == "set_order" or $orderby == "top_rated") {
|
112 |
$orig_order_setting = $orderby;
|
@@ -125,7 +126,7 @@ function Display_FAQs($atts) {
|
|
125 |
else {
|
126 |
$Category_Array = array("EWD_UFAQ_ALL_CATEGORIES");
|
127 |
}
|
128 |
-
|
129 |
if (isset($_GET['include_category'])) {$include_category = $_GET['include_category'];}
|
130 |
if (get_query_var('ufaq_category_slug') != "") {$include_category = get_query_var('ufaq_category_slug');}
|
131 |
if ($include_category_ids != "" ) {$include_category_ids_array = explode(",", $include_category_ids);}
|
@@ -161,7 +162,7 @@ function Display_FAQs($atts) {
|
|
161 |
'operator' => 'NOT IN'
|
162 |
);
|
163 |
}
|
164 |
-
|
165 |
if (isset($_GET['include_tag'])) {$include_tag = $_GET['include_tag'];}
|
166 |
if (get_query_var('ufaq_tag_slug') != "") {$include_tag = get_query_var('ufaq_tag_slug');}
|
167 |
if (isset($include_tag) and $include_tag != "" ) {$include_tag_array = explode(",", $include_tag);}
|
@@ -191,7 +192,7 @@ function Display_FAQs($atts) {
|
|
191 |
|
192 |
if ($Custom_CSS != "") {$ReturnString .= "<style>" . $Custom_CSS . "</style>";}
|
193 |
$ReturnString .= EWD_UFAQ_Add_Modified_Styles();
|
194 |
-
|
195 |
$ReturnString .= "<script language='JavaScript' type='text/javascript'>";
|
196 |
if ($FAQ_Accordion == "Yes") {$ReturnString .= "var faq_accordion = true;";}
|
197 |
else {$ReturnString .= "var faq_accordion = false;";}
|
@@ -216,7 +217,7 @@ function Display_FAQs($atts) {
|
|
216 |
|
217 |
if ($Category != "EWD_UFAQ_ALL_CATEGORIES") {
|
218 |
if (!EWD_UFAQ_Category_Matches($Category, $include_category_array, $exclude_category_array)) {continue;}
|
219 |
-
|
220 |
$category_array = array( 'taxonomy' => 'ufaq-category',
|
221 |
'field' => 'slug',
|
222 |
'terms' => $Category->slug
|
@@ -228,7 +229,7 @@ function Display_FAQs($atts) {
|
|
228 |
if (isset($exclude_category_filter_array)) {$tax_query_array[] = $exclude_category_filter_array;}
|
229 |
if (isset($include_tag_filter_array)) {$tax_query_array[] = $include_tag_filter_array;}
|
230 |
if (isset($category_array)) {$tax_query_array[] = $category_array;}
|
231 |
-
|
232 |
$params = array('posts_per_page' => $post_count,
|
233 |
'post_status' => 'publish',
|
234 |
'post_type' => 'ufaq',
|
@@ -244,7 +245,7 @@ function Display_FAQs($atts) {
|
|
244 |
if ($orig_order_setting == "top_rated") {$params['meta_key'] = 'FAQ_Total_Score';}
|
245 |
if ($orig_order_setting == "set_order") {$params['meta_key'] = 'ufaq_order';}
|
246 |
$FAQ_Query = new WP_Query($params);
|
247 |
-
|
248 |
if ($Category != "EWD_UFAQ_ALL_CATEGORIES" and $FAQ_Query->post_count > 0) {
|
249 |
$ReturnString .= "<div class='ufaq-faq-category'>";
|
250 |
$ReturnString .= "<div class='ufaq-faq-category-title";
|
@@ -286,9 +287,9 @@ function Display_FAQs($atts) {
|
|
286 |
|
287 |
$TitlesArray[] = json_encode($faq->post_title);
|
288 |
$HeaderString .= "<div class='ufaq-faq-header-title'><a href='' class='ufaq-faq-header-link' data-postid='" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "'>" . apply_filters('the_title', $faq->post_title) . "</a></div>";
|
289 |
-
|
290 |
-
$ReturnString .= "<div class='ufaq-faq-div ufaq-faq-display-style-" . $Display_Style . "' id='ufaq-post-" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "' data-postid='" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "' itemscope itemtype='http://schema.org/Question'>";
|
291 |
-
|
292 |
$ReturnString .= "<div class='ufaq-faq-title";
|
293 |
if ($FAQ_Toggle != "No") {$ReturnString .= " ufaq-faq-toggle";}
|
294 |
$ReturnString .= "' id='ufaq-title-" . $faq->ID . "' data-postid='" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "'>";
|
@@ -314,7 +315,7 @@ function Display_FAQs($atts) {
|
|
314 |
}
|
315 |
|
316 |
$ReturnString .= "<div class='ewd-ufaq-post-margin ufaq-faq-post' id='ufaq-post-" . $faq->ID . "' itemprop='text'>" . apply_filters('the_content', html_entity_decode($faq->post_content)) . "</div>";
|
317 |
-
|
318 |
if (sizeOf($FAQ_Fields_Array) > 0) {
|
319 |
$ReturnString .= "<div class='ufaq-faq-custom-fields' id='ufaq-custom-fields-" . $faq->ID . "'>";
|
320 |
foreach ($FAQ_Fields_Array as $FAQ_Field_Item) {
|
@@ -355,7 +356,7 @@ function Display_FAQs($atts) {
|
|
355 |
else {$ReturnString .= "Tag: ";}}
|
356 |
else {$ReturnString .= $Tag_Label . ": ";}
|
357 |
foreach ($Tag_Terms as $Tag_Term) {
|
358 |
-
if ($Pretty_Permalinks == "Yes") {$Tag_URL = $current_url . "faq-tag/" . $Tag_Term->slug . "/";}
|
359 |
else {$Tag_URL = $current_url . "?include_tag=" . $Tag_Term->slug;}
|
360 |
$ReturnString .= "<a href='" . $Tag_URL . "'>" .$Tag_Term->name . "</a>, ";
|
361 |
}
|
@@ -378,7 +379,7 @@ function Display_FAQs($atts) {
|
|
378 |
$ReturnString .= "</div>";
|
379 |
$ReturnString .= "<div class='ewd-ufaq-clear'></div>";
|
380 |
}
|
381 |
-
|
382 |
if ($Socialmedia[0] != "Blank" and $Socialmedia[0] != "") {
|
383 |
$ReturnString .= "<div class='ufaq-social-links'>Share: ";
|
384 |
$ReturnString .= "<ul class='rrssb-buttons'>";
|
@@ -392,7 +393,7 @@ function Display_FAQs($atts) {
|
|
392 |
if ($Socialmedia[0] != "Blank" and $Socialmedia[0] != "") {
|
393 |
$ReturnString .= "</ul>";
|
394 |
$ReturnString .= "</div>";
|
395 |
-
}
|
396 |
|
397 |
if ($Include_Permalink == "Yes" and $ajax == "No") {
|
398 |
$ReturnString .= "<div class='ufaq-permalink'>" . $Permalink_Label;
|
@@ -408,7 +409,7 @@ function Display_FAQs($atts) {
|
|
408 |
wp_list_comments(array(), $Comments);
|
409 |
comment_form(array(), $faq->ID);
|
410 |
$ReturnString .= ob_get_contents();
|
411 |
-
ob_end_clean();
|
412 |
}
|
413 |
|
414 |
if ($Display_Back_To_Top == "Yes") {
|
@@ -418,13 +419,13 @@ function Display_FAQs($atts) {
|
|
418 |
$ReturnString .= "</a>";
|
419 |
$ReturnString .= "</div>";
|
420 |
}
|
421 |
-
|
422 |
$ReturnString .= "</div>";
|
423 |
$ReturnString .= "</div>";
|
424 |
|
425 |
$Counter++;
|
426 |
endwhile;
|
427 |
-
|
428 |
if ($Category != "EWD_UFAQ_ALL_CATEGORIES" and $FAQ_Query->post_count > 0) {
|
429 |
$ReturnString .= "</div>";
|
430 |
$ReturnString .= "</div>";
|
@@ -460,7 +461,7 @@ add_shortcode("ultimate-faqs", "Display_FAQs");
|
|
460 |
function EWD_UFAQ_Category_Matches($Category, $include_category_array, $exclude_category_array) {
|
461 |
$Excluded = EWD_UFAQ_Excluded_Category_Check($Category, $exclude_category_array);
|
462 |
$Included = EWD_UFAQ_Included_Category_Check($Category, $include_category_array);
|
463 |
-
|
464 |
if ($Included and !$Excluded) {
|
465 |
return true;
|
466 |
}
|
@@ -491,11 +492,35 @@ function EWD_UFAQ_Included_Category_Check($Category, $include_category_array) {
|
|
491 |
}
|
492 |
}
|
493 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
function EWD_UFAQ_Rand_Chars($CharLength = 10) {
|
495 |
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
496 |
$randstring = '';
|
497 |
for ($i = 0; $i < $CharLength; $i++) {
|
498 |
-
$randstring .= $characters[rand(0, strlen($characters))];
|
499 |
}
|
500 |
return $randstring;
|
501 |
-
}
|
36 |
$FAQ_Fields_Array = get_option("EWD_UFAQ_FAQ_Fields");
|
37 |
if (!is_array($FAQ_Fields_Array)) {$FAQ_Fields_Array = array();}
|
38 |
$Hide_Blank_Fields = get_option("EWD_UFAQ_Hide_Blank_Fields");
|
39 |
+
|
40 |
$Posted_Label = get_option("EWD_UFAQ_Posted_Label");
|
41 |
if ($Posted_Label == "") {$Posted_Label = __("Posted ", 'ultimate-faqs');}
|
42 |
$By_Label = get_option("EWD_UFAQ_By_Label");
|
60 |
|
61 |
if ($Display_Style != "Color_Block") {$Color_Block_Shape = "";}
|
62 |
else {$Color_Block_Shape = "ewd-ufaq-" . $Color_Block_Shape;}
|
63 |
+
|
64 |
$Unique_ID = EWD_UFAQ_Rand_Chars(3);
|
65 |
+
EWD_UFAQ_Enqueue_Scripts_In_Shortcode();
|
66 |
|
67 |
$ReturnString = "";
|
68 |
$HeaderString = "";
|
69 |
$TitlesArray = array();
|
70 |
+
|
71 |
// Get the attributes passed by the shortcode, and store them in new variables for processing
|
72 |
extract( shortcode_atts( array(
|
73 |
'search_string' => "",
|
96 |
if (strpos($current_url,'?include_category') !== false) {$current_url = substr($current_url,0,strpos($current_url,'?include_category'));}
|
97 |
|
98 |
if (strpos($No_Results_Found_Text, "%s")) {$No_Results_Found_Text = str_replace("%s", $search_string, $No_Results_Found_Text);}
|
99 |
+
|
100 |
$search_string = strtolower($search_string);
|
101 |
|
102 |
if ($display_all_answers != "") {$Display_All_Answers = $display_all_answers;}
|
107 |
}
|
108 |
elseif ($post__in_string != "") {$post_id_array = explode(",", $post__in_string);}
|
109 |
else {$post_id_array = "";}
|
110 |
+
|
111 |
if ($orderby == "") {$orderby = $Order_By_Setting;}
|
112 |
if ($orderby == "popular" or $orderby == "set_order" or $orderby == "top_rated") {
|
113 |
$orig_order_setting = $orderby;
|
126 |
else {
|
127 |
$Category_Array = array("EWD_UFAQ_ALL_CATEGORIES");
|
128 |
}
|
129 |
+
|
130 |
if (isset($_GET['include_category'])) {$include_category = $_GET['include_category'];}
|
131 |
if (get_query_var('ufaq_category_slug') != "") {$include_category = get_query_var('ufaq_category_slug');}
|
132 |
if ($include_category_ids != "" ) {$include_category_ids_array = explode(",", $include_category_ids);}
|
162 |
'operator' => 'NOT IN'
|
163 |
);
|
164 |
}
|
165 |
+
|
166 |
if (isset($_GET['include_tag'])) {$include_tag = $_GET['include_tag'];}
|
167 |
if (get_query_var('ufaq_tag_slug') != "") {$include_tag = get_query_var('ufaq_tag_slug');}
|
168 |
if (isset($include_tag) and $include_tag != "" ) {$include_tag_array = explode(",", $include_tag);}
|
192 |
|
193 |
if ($Custom_CSS != "") {$ReturnString .= "<style>" . $Custom_CSS . "</style>";}
|
194 |
$ReturnString .= EWD_UFAQ_Add_Modified_Styles();
|
195 |
+
|
196 |
$ReturnString .= "<script language='JavaScript' type='text/javascript'>";
|
197 |
if ($FAQ_Accordion == "Yes") {$ReturnString .= "var faq_accordion = true;";}
|
198 |
else {$ReturnString .= "var faq_accordion = false;";}
|
217 |
|
218 |
if ($Category != "EWD_UFAQ_ALL_CATEGORIES") {
|
219 |
if (!EWD_UFAQ_Category_Matches($Category, $include_category_array, $exclude_category_array)) {continue;}
|
220 |
+
|
221 |
$category_array = array( 'taxonomy' => 'ufaq-category',
|
222 |
'field' => 'slug',
|
223 |
'terms' => $Category->slug
|
229 |
if (isset($exclude_category_filter_array)) {$tax_query_array[] = $exclude_category_filter_array;}
|
230 |
if (isset($include_tag_filter_array)) {$tax_query_array[] = $include_tag_filter_array;}
|
231 |
if (isset($category_array)) {$tax_query_array[] = $category_array;}
|
232 |
+
|
233 |
$params = array('posts_per_page' => $post_count,
|
234 |
'post_status' => 'publish',
|
235 |
'post_type' => 'ufaq',
|
245 |
if ($orig_order_setting == "top_rated") {$params['meta_key'] = 'FAQ_Total_Score';}
|
246 |
if ($orig_order_setting == "set_order") {$params['meta_key'] = 'ufaq_order';}
|
247 |
$FAQ_Query = new WP_Query($params);
|
248 |
+
|
249 |
if ($Category != "EWD_UFAQ_ALL_CATEGORIES" and $FAQ_Query->post_count > 0) {
|
250 |
$ReturnString .= "<div class='ufaq-faq-category'>";
|
251 |
$ReturnString .= "<div class='ufaq-faq-category-title";
|
287 |
|
288 |
$TitlesArray[] = json_encode($faq->post_title);
|
289 |
$HeaderString .= "<div class='ufaq-faq-header-title'><a href='' class='ufaq-faq-header-link' data-postid='" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "'>" . apply_filters('the_title', $faq->post_title) . "</a></div>";
|
290 |
+
|
291 |
+
$ReturnString .= "<div class='ufaq-faq-div ufaq-faq-display-style-" . $Display_Style . "' id='ufaq-post-" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "' data-postid='" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "' itemscope itemtype='http://schema.org/Question'>";
|
292 |
+
|
293 |
$ReturnString .= "<div class='ufaq-faq-title";
|
294 |
if ($FAQ_Toggle != "No") {$ReturnString .= " ufaq-faq-toggle";}
|
295 |
$ReturnString .= "' id='ufaq-title-" . $faq->ID . "' data-postid='" . $Unique_ID . "-" . $faq->ID . "-" . $Counter . "'>";
|
315 |
}
|
316 |
|
317 |
$ReturnString .= "<div class='ewd-ufaq-post-margin ufaq-faq-post' id='ufaq-post-" . $faq->ID . "' itemprop='text'>" . apply_filters('the_content', html_entity_decode($faq->post_content)) . "</div>";
|
318 |
+
|
319 |
if (sizeOf($FAQ_Fields_Array) > 0) {
|
320 |
$ReturnString .= "<div class='ufaq-faq-custom-fields' id='ufaq-custom-fields-" . $faq->ID . "'>";
|
321 |
foreach ($FAQ_Fields_Array as $FAQ_Field_Item) {
|
356 |
else {$ReturnString .= "Tag: ";}}
|
357 |
else {$ReturnString .= $Tag_Label . ": ";}
|
358 |
foreach ($Tag_Terms as $Tag_Term) {
|
359 |
+
if ($Pretty_Permalinks == "Yes") {$Tag_URL = $current_url . "faq-tag/" . $Tag_Term->slug . "/";}
|
360 |
else {$Tag_URL = $current_url . "?include_tag=" . $Tag_Term->slug;}
|
361 |
$ReturnString .= "<a href='" . $Tag_URL . "'>" .$Tag_Term->name . "</a>, ";
|
362 |
}
|
379 |
$ReturnString .= "</div>";
|
380 |
$ReturnString .= "<div class='ewd-ufaq-clear'></div>";
|
381 |
}
|
382 |
+
|
383 |
if ($Socialmedia[0] != "Blank" and $Socialmedia[0] != "") {
|
384 |
$ReturnString .= "<div class='ufaq-social-links'>Share: ";
|
385 |
$ReturnString .= "<ul class='rrssb-buttons'>";
|
393 |
if ($Socialmedia[0] != "Blank" and $Socialmedia[0] != "") {
|
394 |
$ReturnString .= "</ul>";
|
395 |
$ReturnString .= "</div>";
|
396 |
+
}
|
397 |
|
398 |
if ($Include_Permalink == "Yes" and $ajax == "No") {
|
399 |
$ReturnString .= "<div class='ufaq-permalink'>" . $Permalink_Label;
|
409 |
wp_list_comments(array(), $Comments);
|
410 |
comment_form(array(), $faq->ID);
|
411 |
$ReturnString .= ob_get_contents();
|
412 |
+
ob_end_clean();
|
413 |
}
|
414 |
|
415 |
if ($Display_Back_To_Top == "Yes") {
|
419 |
$ReturnString .= "</a>";
|
420 |
$ReturnString .= "</div>";
|
421 |
}
|
422 |
+
|
423 |
$ReturnString .= "</div>";
|
424 |
$ReturnString .= "</div>";
|
425 |
|
426 |
$Counter++;
|
427 |
endwhile;
|
428 |
+
|
429 |
if ($Category != "EWD_UFAQ_ALL_CATEGORIES" and $FAQ_Query->post_count > 0) {
|
430 |
$ReturnString .= "</div>";
|
431 |
$ReturnString .= "</div>";
|
461 |
function EWD_UFAQ_Category_Matches($Category, $include_category_array, $exclude_category_array) {
|
462 |
$Excluded = EWD_UFAQ_Excluded_Category_Check($Category, $exclude_category_array);
|
463 |
$Included = EWD_UFAQ_Included_Category_Check($Category, $include_category_array);
|
464 |
+
|
465 |
if ($Included and !$Excluded) {
|
466 |
return true;
|
467 |
}
|
492 |
}
|
493 |
}
|
494 |
|
495 |
+
function EWD_UFAQ_Enqueue_Scripts_In_Shortcode() {
|
496 |
+
wp_enqueue_script('ewd-ufaq-js');
|
497 |
+
|
498 |
+
wp_enqueue_script("jquery-ui-core");
|
499 |
+
wp_enqueue_script("jquery-effects-core");
|
500 |
+
wp_enqueue_script('jquery-ui-autocomplete');
|
501 |
+
|
502 |
+
$Reveal_Effect = get_option("EWD_UFAQ_Reveal_Effect");
|
503 |
+
|
504 |
+
if ($Reveal_Effect == "blind") {wp_enqueue_script("jquery-effects-blind");}
|
505 |
+
if ($Reveal_Effect == "bounce") {wp_enqueue_script("jquery-effects-bounce");}
|
506 |
+
if ($Reveal_Effect == "clip") {wp_enqueue_script("jquery-effects-clip");}
|
507 |
+
if ($Reveal_Effect == "drop") {wp_enqueue_script("jquery-effects-drop");}
|
508 |
+
if ($Reveal_Effect == "explode") {wp_enqueue_script("jquery-effects-explode");}
|
509 |
+
if ($Reveal_Effect == "fade") {wp_enqueue_script("jquery-effects-fade");}
|
510 |
+
if ($Reveal_Effect == "fold") {wp_enqueue_script("jquery-effects-fold");}
|
511 |
+
if ($Reveal_Effect == "highlight") {wp_enqueue_script("jquery-effects-highlight");}
|
512 |
+
if ($Reveal_Effect == "pulsate") {wp_enqueue_script("jquery-effects-pulsate");}
|
513 |
+
wp_enqueue_script("jquery-effects-scale");
|
514 |
+
if ($Reveal_Effect == "shake") {wp_enqueue_script("jquery-effects-shake");}
|
515 |
+
if ($Reveal_Effect == "slide") {wp_enqueue_script("jquery-effects-slide");}
|
516 |
+
wp_enqueue_script("jquery-effects-transfer");
|
517 |
+
}
|
518 |
+
|
519 |
function EWD_UFAQ_Rand_Chars($CharLength = 10) {
|
520 |
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
521 |
$randstring = '';
|
522 |
for ($i = 0; $i < $CharLength; $i++) {
|
523 |
+
$randstring .= $characters[rand(0, strlen($characters)-1)];
|
524 |
}
|
525 |
return $randstring;
|
526 |
+
}
|
css/Admin.css
CHANGED
@@ -393,6 +393,8 @@ EXTRA
|
|
393 |
margin-right: 25px;
|
394 |
padding: 5px 5px 5px 5px;
|
395 |
box-shadow: 2px 2px 5px #666666;
|
|
|
|
|
396 |
}
|
397 |
.ewd-ufaq-dashboard-box a {
|
398 |
text-decoration: none;
|
@@ -930,4 +932,27 @@ NEW ASK FOR REVIEW POPUP
|
|
930 |
#ewd-ufaq-hide-review-ask-never:hover {
|
931 |
background: #c6ab55;
|
932 |
color: #fff;
|
933 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
margin-right: 25px;
|
394 |
padding: 5px 5px 5px 5px;
|
395 |
box-shadow: 2px 2px 5px #666666;
|
396 |
+
min-width: 160px;/* pchanges */
|
397 |
+
margin-top: 10px;/* pchanges */
|
398 |
}
|
399 |
.ewd-ufaq-dashboard-box a {
|
400 |
text-decoration: none;
|
932 |
#ewd-ufaq-hide-review-ask-never:hover {
|
933 |
background: #c6ab55;
|
934 |
color: #fff;
|
935 |
+
}
|
936 |
+
|
937 |
+
|
938 |
+
|
939 |
+
/*
|
940 |
+
==============================================
|
941 |
+
PChanges
|
942 |
+
==============================================
|
943 |
+
*/
|
944 |
+
@media screen and (max-width: 782px) {
|
945 |
+
.ewd-ufaq-overview-table td {
|
946 |
+
display: table-cell !important;
|
947 |
+
}
|
948 |
+
}
|
949 |
+
|
950 |
+
.ewd-ufaq-meta-field label{
|
951 |
+
display: inline-block;
|
952 |
+
width: 200px;
|
953 |
+
float: left;
|
954 |
+
}
|
955 |
+
|
956 |
+
|
957 |
+
|
958 |
+
|
css/ewd-ufaq-styles.css
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
height: 21px;
|
31 |
width: 30px;
|
32 |
margin-top: -25px;
|
33 |
-
margin-left:
|
34 |
}
|
35 |
|
36 |
.ewd-ufaq-author-date {
|
@@ -53,6 +53,11 @@
|
|
53 |
width: 100%;
|
54 |
clear: both;
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
56 |
.ufaq-faq-body {
|
57 |
padding:10px 25px;
|
58 |
padding-left: 55px;
|
@@ -80,8 +85,10 @@ border-radius: 0 !important;
|
|
80 |
display: inline-block;
|
81 |
float: left;
|
82 |
text-align: center;
|
83 |
-
|
84 |
-
height: 35px
|
|
|
|
|
85 |
margin-right: 15px;
|
86 |
padding: 2px 0px 0px 2px;
|
87 |
line-height: 1;
|
@@ -415,4 +422,38 @@ Toggle Font
|
|
415 |
.ewd-ufaq-post-margin-symbol,
|
416 |
.ewd-ufaq-toggle-all-symbol {
|
417 |
font-family: 'ewd-toggle-icon';
|
418 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
height: 21px;
|
31 |
width: 30px;
|
32 |
margin-top: -25px;
|
33 |
+
margin-left: 90px;
|
34 |
}
|
35 |
|
36 |
.ewd-ufaq-author-date {
|
53 |
width: 100%;
|
54 |
clear: both;
|
55 |
}
|
56 |
+
|
57 |
+
.ufaq-faq-category{
|
58 |
+
margin-bottom: 20px;
|
59 |
+
}
|
60 |
+
|
61 |
.ufaq-faq-body {
|
62 |
padding:10px 25px;
|
63 |
padding-left: 55px;
|
85 |
display: inline-block;
|
86 |
float: left;
|
87 |
text-align: center;
|
88 |
+
/* width:35px;
|
89 |
+
height: 35px;*/
|
90 |
+
width: auto;
|
91 |
+
height: auto;
|
92 |
margin-right: 15px;
|
93 |
padding: 2px 0px 0px 2px;
|
94 |
line-height: 1;
|
422 |
.ewd-ufaq-post-margin-symbol,
|
423 |
.ewd-ufaq-toggle-all-symbol {
|
424 |
font-family: 'ewd-toggle-icon';
|
425 |
+
}
|
426 |
+
|
427 |
+
|
428 |
+
/*
|
429 |
+
==============================================
|
430 |
+
PChanges
|
431 |
+
==============================================
|
432 |
+
*/
|
433 |
+
|
434 |
+
.ewd-ufaq-question-update{
|
435 |
+
font-size: 1.2em;
|
436 |
+
margin-bottom: 20px;
|
437 |
+
}
|
438 |
+
|
439 |
+
.rrssb-buttons li a .rrssb-text {
|
440 |
+
color: #fff;
|
441 |
+
margin-left: 5px;
|
442 |
+
}
|
443 |
+
|
444 |
+
.ufaq-social-links .rrssb-buttons li {
|
445 |
+
margin-bottom: 5px;
|
446 |
+
}
|
447 |
+
|
448 |
+
.ufaq-permalink{
|
449 |
+
clear: both;
|
450 |
+
}
|
451 |
+
@media only screen and (max-width: 810px) {
|
452 |
+
|
453 |
+
.ufaq-faq-title-text {
|
454 |
+
width: 80%;
|
455 |
+
}
|
456 |
+
|
457 |
+
}
|
458 |
+
|
459 |
+
|
html/OptionsPage.php
CHANGED
@@ -272,7 +272,7 @@
|
|
272 |
<fieldset><legend class="screen-reader-text"><span>Display All Answers</span></legend>
|
273 |
<label title='Yes'><input type='radio' name='display_all_answers' value='Yes' <?php if($Display_All_Answers == "Yes") {echo "checked='checked'";} ?> /> <span>Yes</span></label><br />
|
274 |
<label title='No'><input type='radio' name='display_all_answers' value='No' <?php if($Display_All_Answers == "No") {echo "checked='checked'";} ?> /> <span>No</span></label><br />
|
275 |
-
<p>Should all answers be displayed when the page loads? (Careful if FAQ
|
276 |
</fieldset>
|
277 |
</td>
|
278 |
</tr>
|
@@ -387,7 +387,7 @@
|
|
387 |
<fieldset><legend class="screen-reader-text"><span>Pretty Permalinks</span></legend>
|
388 |
<label title='Yes'><input type='radio' name='pretty_permalinks' value='Yes' <?php if($Pretty_Permalinks == "Yes") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>Yes</span></label><br />
|
389 |
<label title='No'><input type='radio' name='pretty_permalinks' value='No' <?php if($Pretty_Permalinks == "No") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>No</span></label><br />
|
390 |
-
<p>Should an SEO friendly permalink structure be used for the link to
|
391 |
</fieldset>
|
392 |
</td>
|
393 |
</tr>
|
@@ -481,7 +481,7 @@
|
|
481 |
<td>
|
482 |
<fieldset><legend class="screen-reader-text"><span>Admin Notification Email</span></legend>
|
483 |
<input type='text' name='admin_notification_email' value='<?php echo $Admin_Notification_Email; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> size='60'/>
|
484 |
-
<p>What email address should
|
485 |
</fieldset>
|
486 |
</td>
|
487 |
</tr>
|
@@ -665,7 +665,7 @@
|
|
665 |
echo "<td><input type='text' name='Custom_Field_" . $Counter . "_Values' value='" . $FAQ_Field_Item['FieldValues'] . "'/></td>";
|
666 |
echo "</tr>";
|
667 |
$Counter++;
|
668 |
-
$Max_ID = max($Max_ID, $
|
669 |
}
|
670 |
$Max_ID++;
|
671 |
echo "<tr><td colspan='4'><a class='ewd-ufaq-add-custom-field' data-nextid='" . $Counter . "' data-maxid='" . $Max_ID . "'>Add</a></td></tr>";
|
@@ -682,7 +682,7 @@
|
|
682 |
<fieldset><legend class="screen-reader-text"><span>Hide Blank Fields</span></legend>
|
683 |
<label title='Yes'><input type='radio' name='hide_blank_fields' value='Yes' <?php if($Hide_Blank_Fields == "Yes") {echo "checked='checked'";} ?> /> <span>Yes</span></label><br />
|
684 |
<label title='No'><input type='radio' name='hide_blank_fields' value='No' <?php if($Hide_Blank_Fields == "No") {echo "checked='checked'";} ?> /> <span>No</span></label><br />
|
685 |
-
<p>Should field labels
|
686 |
</fieldset>
|
687 |
</td>
|
688 |
</tr>
|
272 |
<fieldset><legend class="screen-reader-text"><span>Display All Answers</span></legend>
|
273 |
<label title='Yes'><input type='radio' name='display_all_answers' value='Yes' <?php if($Display_All_Answers == "Yes") {echo "checked='checked'";} ?> /> <span>Yes</span></label><br />
|
274 |
<label title='No'><input type='radio' name='display_all_answers' value='No' <?php if($Display_All_Answers == "No") {echo "checked='checked'";} ?> /> <span>No</span></label><br />
|
275 |
+
<p>Should all answers be displayed when the page loads? (Careful if FAQ Accordion is on)</p>
|
276 |
</fieldset>
|
277 |
</td>
|
278 |
</tr>
|
387 |
<fieldset><legend class="screen-reader-text"><span>Pretty Permalinks</span></legend>
|
388 |
<label title='Yes'><input type='radio' name='pretty_permalinks' value='Yes' <?php if($Pretty_Permalinks == "Yes") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>Yes</span></label><br />
|
389 |
<label title='No'><input type='radio' name='pretty_permalinks' value='No' <?php if($Pretty_Permalinks == "No") {echo "checked='checked'";} ?> <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> /> <span>No</span></label><br />
|
390 |
+
<p>Should an SEO friendly permalink structure be used for the link to the FAQ?</p>
|
391 |
</fieldset>
|
392 |
</td>
|
393 |
</tr>
|
481 |
<td>
|
482 |
<fieldset><legend class="screen-reader-text"><span>Admin Notification Email</span></legend>
|
483 |
<input type='text' name='admin_notification_email' value='<?php echo $Admin_Notification_Email; ?>' <?php if ($UFAQ_Full_Version != "Yes") {echo "disabled";} ?> size='60'/>
|
484 |
+
<p>What email address should the notifications be sent to if "Admin Question Notifications" are set to "Yes" above? If blank, the default WordPress admin email will be used.</p>
|
485 |
</fieldset>
|
486 |
</td>
|
487 |
</tr>
|
665 |
echo "<td><input type='text' name='Custom_Field_" . $Counter . "_Values' value='" . $FAQ_Field_Item['FieldValues'] . "'/></td>";
|
666 |
echo "</tr>";
|
667 |
$Counter++;
|
668 |
+
$Max_ID = max($Max_ID, $FAQ_Field_Item['FieldID']);
|
669 |
}
|
670 |
$Max_ID++;
|
671 |
echo "<tr><td colspan='4'><a class='ewd-ufaq-add-custom-field' data-nextid='" . $Counter . "' data-maxid='" . $Max_ID . "'>Add</a></td></tr>";
|
682 |
<fieldset><legend class="screen-reader-text"><span>Hide Blank Fields</span></legend>
|
683 |
<label title='Yes'><input type='radio' name='hide_blank_fields' value='Yes' <?php if($Hide_Blank_Fields == "Yes") {echo "checked='checked'";} ?> /> <span>Yes</span></label><br />
|
684 |
<label title='No'><input type='radio' name='hide_blank_fields' value='No' <?php if($Hide_Blank_Fields == "No") {echo "checked='checked'";} ?> /> <span>No</span></label><br />
|
685 |
+
<p>Should field labels be hidden if a field hasn't been filled out for a particular FAQ?</p>
|
686 |
</fieldset>
|
687 |
</td>
|
688 |
</tr>
|
js/Admin.js
CHANGED
@@ -77,7 +77,7 @@ jQuery(document).ready(function() {
|
|
77 |
jQuery(this).data('nextid', Counter); //updates but doesn't show in DOM
|
78 |
jQuery(this).data('maxid', Max_ID);
|
79 |
|
80 |
-
|
81 |
|
82 |
event.preventDefault();
|
83 |
});
|
77 |
jQuery(this).data('nextid', Counter); //updates but doesn't show in DOM
|
78 |
jQuery(this).data('maxid', Max_ID);
|
79 |
|
80 |
+
SetCustomFieldDeleteHandlers();
|
81 |
|
82 |
event.preventDefault();
|
83 |
});
|
readme.txt
CHANGED
@@ -10,6 +10,7 @@ FAQ plugin that lets you easily create, order and publicize FAQs, insert 3 style
|
|
10 |
|
11 |
== Description ==
|
12 |
|
|
|
13 |
<a href='http://www.etoilewebdesign.com/ultimate-faq-demo/'>FAQ Demo</a>
|
14 |
|
15 |
FAQ plugin that lets you create FAQ (frequently asked questions), organize FAQs and publicize your FAQ in no time through your Wordpress admin panel. Select from multiple FAQ styles and FAQ layouts.
|
@@ -267,6 +268,9 @@ Video 3 - FAQs Ordering
|
|
267 |
|
268 |
|
269 |
== Changelog ==
|
|
|
|
|
|
|
270 |
= 1.5.38 =
|
271 |
- Added spacing and a span for category post counts
|
272 |
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
|
14 |
<a href='http://www.etoilewebdesign.com/ultimate-faq-demo/'>FAQ Demo</a>
|
15 |
|
16 |
FAQ plugin that lets you create FAQ (frequently asked questions), organize FAQs and publicize your FAQ in no time through your Wordpress admin panel. Select from multiple FAQ styles and FAQ layouts.
|
268 |
|
269 |
|
270 |
== Changelog ==
|
271 |
+
= 1.5.39 =
|
272 |
+
- Maintenance update (notices removed, pageload speed enhancements, small CSS fixes, etc.)
|
273 |
+
|
274 |
= 1.5.38 =
|
275 |
- Added spacing and a span for category post counts
|
276 |
|