-
Notifications
You must be signed in to change notification settings - Fork 0
/
bwl-advanced-faq-manager-lite.php
203 lines (139 loc) · 8.5 KB
/
bwl-advanced-faq-manager-lite.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php
/**
* Plugin Name: BWL Advanced FAQ Manager Lite
* Plugin URI: https://bluewindlab.net
* Description: A WordPress plugin designed for managing frequently asked questions. With this plugin, you can effortlessly create an unlimited number of FAQ items and seamlessly display them on the front end of your website.
* Author: Mahbub Alam Khan
* Version: 1.1.1
* Author URI: https://bluewindlab.net
* WP Requires at least: 6.0
* Text Domain: bwl-adv-faq
*/
if (!class_exists('BWL_Advanced_Faq_Manager')) {
class BWL_Advanced_Faq_Manager
{
function __construct()
{
define("BWL_BAF_PLUGIN_VERSION", '1.1.1');
define("BWL_BAF_PLUGIN_UPDATER_SLUG", plugin_basename(__FILE__));
define("BWL_BAF_PLUGIN_PATH", __DIR__);
define('BWL_BAF_INSTALLATION_TAG', 'baf_installation_' . str_replace('.', '_', BWL_BAF_PLUGIN_VERSION));
require_once(__DIR__ . '/includes/BafConstants.php');
$this->includeFiles();
add_action('wp_enqueue_scripts', [$this, 'bafEnqueueScripts']);
add_action('admin_enqueue_scripts', [$this, 'bafAdminEnqueueScripts']);
add_action('plugins_loaded', [$this, 'bafLoadTranslationFile']);
}
function bafEnqueueScripts()
{
$bwl_advanced_faq_options = get_option('bwl_advanced_faq_options');
// Load front end styles & scripts.
wp_enqueue_style("baf-frontend", plugins_url('assets/styles/frontend.css', __FILE__), [], BWL_BAF_PLUGIN_VERSION);
/*-- RTL MODE --*/
if (is_rtl()) {
wp_enqueue_style('baf-frontend-rtl', plugins_url('assets/styles/frontend_rtl.css', __FILE__), [], BWL_BAF_PLUGIN_VERSION);
}
/*-- Introduce Font-Awesome In Version 1.4.9 --*/
if (isset($bwl_advanced_faq_options['bwl_advanced_fa_status']) && $bwl_advanced_faq_options['bwl_advanced_fa_status'] == "on") {
wp_enqueue_style('font-awesome', plugins_url('libs/font-awesome/font-awesome.min.css', __FILE__), [], BWL_BAF_PLUGIN_VERSION);
wp_enqueue_style('font-awesome-shims', plugins_url('libs/font-awesome/v4-shims.min.css', __FILE__), [], BWL_BAF_PLUGIN_VERSION);
}
// New Scripts.
wp_enqueue_script('baf-frontend', plugins_url('assets/scripts/frontend.js', __FILE__), ['jquery'], BWL_BAF_PLUGIN_VERSION, TRUE);
// Variable access Rules: BafFrontendData.ajaxurl
wp_localize_script(
'baf-frontend',
'BafFrontendData', // javascript end variable.
BafHelpers::localizeData()
);
}
function bafAdminEnqueueScripts()
{
// Load admin styles & scripts.
wp_enqueue_style('baf-admin', plugins_url('assets/styles/admin.css', __FILE__), ['wp-color-picker'], BWL_BAF_PLUGIN_VERSION);
if (is_rtl()) {
wp_enqueue_style('baf-admin-rtl', plugins_url('assets/styles/admin_rtl.css', __FILE__), [], BWL_BAF_PLUGIN_VERSION);
}
// TinyMCE Editor Style.
wp_register_style('bwl-advanced-faq-editor-style', plugins_url('libs/tinymce/styles/bwl-advanced-faq-editor.css', __FILE__), [], BWL_BAF_PLUGIN_VERSION);
wp_register_style('bwl-advanced-faq-multiple-select', plugins_url('libs/multiple-select/styles/multiple-select.css', __FILE__), [], BWL_BAF_PLUGIN_VERSION);
wp_register_script('bwl-advanced-faq-multiple-select', plugins_url('libs/multiple-select/scripts/jquery.multiple.select.js', __FILE__), ['jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable'], BWL_BAF_PLUGIN_VERSION, TRUE);
//Enqueue FAQ Admin Script & Style.
wp_enqueue_style('bwl-advanced-faq-editor-style'); // TinyMCE Editor Overlay.
wp_enqueue_style('bwl-advanced-faq-multiple-select'); // Enqueue Multiselect Style.
wp_enqueue_script('bwl-advanced-faq-multiple-select'); // Enqueue Multiselect Script.
wp_enqueue_script('baf-admin', plugins_url('assets/scripts/admin.js', __FILE__), ['jquery', 'wp-color-picker', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable'], BWL_BAF_PLUGIN_VERSION, TRUE);
// Variable access Rules: BafFrontendData.ajaxurl
wp_localize_script(
'baf-admin',
'BafAdminData',
BafAdminHelpers::localizeData()
);
}
public function includeFiles()
{
// Commen Functions.
require_once(__DIR__ . '/includes/BafHelpers.php');
// Upgrade DataBase.
require_once(__DIR__ . '/includes/db/BafDbSettings.php');
// Custom Post Type.
require_once(__DIR__ . '/includes/cpt/BafCustomPostType.php');
// View Counter
require_once(__DIR__ . '/includes/BafViewsTracker.php');
// Search Keywords Tracker
require_once(__DIR__ . '/includes/BafSearchKeywordsTracker.php');
/*-- Load Required Files --*/
if (is_admin()) {
// Only Load Admin Helpers.
require_once(__DIR__ . '/includes/BafAdminHelpers.php');
// Plugin Metainfo.
require_once(__DIR__ . '/includes/metainfo/BafMetaInfo.php');
// Load Only Admin panel required files.
require_once(__DIR__ . '/includes/version-manager.php'); // Load plugin versioning informations.
// INTEGRATE FAQ SORTING
require_once(__DIR__ . '/includes/settings/sorting-pages/BafTaxonomySort.php');
// Custom Post Types Support.
require_once(__DIR__ . '/includes/cpt/BafCptCustomColumns.php'); // Load plugin custom columns.
require_once(__DIR__ . '/includes/cpt/BafQuickBulkEdit.php'); // Load plugin quick and bulk edit settings.
require_once(__DIR__ . '/includes/cpt/BafCptTaxonomyFilters.php'); // Load plugin custom filter by category and tags
// Load Custom shrotcode editor panel.
require_once(__DIR__ . '/includes/tinymce/baf_tiny_mce_config.php');
// FAQ Analytics Helper.
require_once(__DIR__ . '/includes/settings/analytics/BafAnalyticsHelper.php');
require_once(__DIR__ . '/includes/settings/analytics/BafAnalytics.php');
require_once(__DIR__ . '/includes/settings/analytics/BafAnalyticsSummary.php');
require_once(__DIR__ . '/includes/settings/analytics/BafAnalyticsLikesCount.php');
require_once(__DIR__ . '/includes/settings/analytics/BafAnalyticsViewsCount.php');
require_once(__DIR__ . '/includes/settings/analytics/BafAnalyticsPostsList.php');
require_once(__DIR__ . '/includes/settings/analytics/BafAnalyticsExternalApi.php');
// Options Panel.
require_once(__DIR__ . '/includes/settings/options_panel.php'); // Load plugins options panel.
require_once(__DIR__ . '/includes/settings/options_panel_submenus.php'); // Load Welcome page.
// Admin Notice.
require_once(__DIR__ . '/includes/noticebox/BafAdminNotice.php');
} else {
// Load only Frontend files.
require_once(__DIR__ . '/includes/baf_theme_generator.php'); // Generate and Load plugin custom themes.
/*-- INTEGRATE SHORTCODES --*/
require_once(__DIR__ . '/includes/shortcodes/baf_faq_list.php'); // Load plugin faq shortcodes.
}
require_once(__DIR__ . '/includes/baf_rating.php'); // Count FAQ rating.
}
/*-- TRANSLATION FILE --*/
function bafLoadTranslationFile()
{
load_plugin_textdomain('bwl-adv-faq', FALSE, dirname(plugin_basename(__FILE__)) . '/lang/');
}
}
/*-- INTEGRATE WIDGET --*/
$baf_widgets = ['faqs', 'categories', 'topics'];
foreach ($baf_widgets as $widget_key => $widget_page) :
require_once(__DIR__ . '/includes/widgets/baf_' . $widget_page . '.php');
endforeach;
/*--INITIALIZATION --*/
function initBwlAdvancedFaqManager()
{
new BWL_Advanced_Faq_Manager();
}
add_action('init', 'initBwlAdvancedFaqManager');
}