Version Description
- 2022-01-07 - fix - Background image bug issue fixed.
Download this release
Release Info
Developer | pickplugins |
Plugin | Accordion |
Version | 2.2.36 |
Comparing to | |
See all releases |
Code changes from version 2.2.35 to 2.2.36
- accordions.php +101 -102
- includes/functions.php +202 -190
- readme.txt +5 -1
- templates/accordion/accordion-hook.php +405 -428
accordions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Accordions by PickPlugins
|
4 |
Plugin URI: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
|
5 |
Description: Fully responsive and mobile ready accordion grid for wordpress.
|
6 |
-
Version: 2.2.
|
7 |
Author: PickPlugins
|
8 |
Author URI: http://pickplugins.com
|
9 |
Text Domain: accordions
|
@@ -12,79 +12,83 @@ License: GPLv2 or later
|
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
*/
|
14 |
|
15 |
-
if (
|
16 |
|
17 |
|
18 |
-
class Accordions
|
19 |
-
|
20 |
-
public function __construct(){
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
define('accordions_version', '2.2.35' );
|
25 |
-
define('accordions_plugin_name', 'Accordions' );
|
26 |
-
define('accordions_plugin_basename', plugin_basename( __FILE__ ) );
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
require_once( accordions_plugin_dir . 'includes/class-post-types.php');
|
30 |
|
31 |
-
require_once(
|
32 |
-
require_once( accordions_plugin_dir . 'includes/class-post-meta-accordions-hook.php');
|
33 |
|
34 |
-
require_once(
|
35 |
-
require_once(
|
36 |
|
37 |
-
require_once(
|
38 |
-
require_once(
|
39 |
-
require_once( accordions_plugin_dir . 'includes/functions-data-upgrade.php');
|
40 |
|
|
|
|
|
|
|
41 |
|
42 |
|
43 |
-
require_once( accordions_plugin_dir . 'includes/class-settings-tabs.php');
|
44 |
-
require_once( accordions_plugin_dir . 'includes/functions.php');
|
45 |
-
require_once( accordions_plugin_dir . 'includes/functions-wc.php');
|
46 |
-
require_once( accordions_plugin_dir . 'includes/class-shortcodes.php');
|
47 |
-
require_once( accordions_plugin_dir . 'includes/duplicate-post.php');
|
48 |
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
|
51 |
-
require_once( accordions_plugin_dir . 'templates/accordion/accordion-hook.php');
|
52 |
-
require_once( accordions_plugin_dir . 'templates/tabs/tabs-hook.php');
|
53 |
|
54 |
-
require_once(
|
|
|
55 |
|
|
|
56 |
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
add_filter('cron_schedules', array($this, 'cron_recurrence_interval'));
|
63 |
|
64 |
|
65 |
-
require_once(
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
add_filter(
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
public function _textdomain() {
|
79 |
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
|
|
84 |
|
85 |
-
|
|
|
86 |
|
87 |
-
function cron_recurrence_interval($schedules)
|
|
|
88 |
|
89 |
$schedules['1minute'] = array(
|
90 |
'interval' => 40,
|
@@ -94,82 +98,77 @@ class Accordions{
|
|
94 |
|
95 |
return $schedules;
|
96 |
}
|
97 |
-
|
98 |
-
public function _install(){
|
99 |
-
|
100 |
-
do_action( 'accordions_action_install' );
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
public function _uninstall(){
|
105 |
-
|
106 |
-
do_action( 'accordions_action_uninstall' );
|
107 |
-
}
|
108 |
-
|
109 |
-
public function _deactivation(){
|
110 |
-
|
111 |
-
do_action( 'accordions_action_deactivation' );
|
112 |
-
}
|
113 |
-
|
114 |
-
|
115 |
-
public function _front_scripts(){
|
116 |
-
|
117 |
-
wp_enqueue_script('accordions_js', accordions_plugin_url. 'assets/frontend/js/scripts.js' , array( 'jquery' ));
|
118 |
-
wp_localize_script( 'accordions_js', 'accordions_ajax', array( 'accordions_ajaxurl' => admin_url( 'admin-ajax.php')));
|
119 |
-
|
120 |
-
wp_register_style('accordions-style', accordions_plugin_url. 'assets/frontend/css/style.css');
|
121 |
-
wp_register_style('style-tabs', accordions_plugin_url. 'assets/global/css/style-tabs.css');
|
122 |
-
|
123 |
-
wp_register_style('accordions-tabs', accordions_plugin_url. 'assets/global/css/themesTabs.style.css');
|
124 |
-
wp_register_style('fontawesome-5', accordions_plugin_url.'assets/global/css/font-awesome-5.css');
|
125 |
-
wp_register_style('fontawesome-4', accordions_plugin_url.'assets/global/css/font-awesome-4.css');
|
126 |
-
wp_register_style('jquery-ui', accordions_plugin_url.'assets/frontend/css/jquery-ui.css');
|
127 |
-
wp_register_style('accordions-themes', accordions_plugin_url.'assets/global/css/themes.style.css');
|
128 |
-
|
129 |
-
}
|
130 |
-
|
131 |
-
public function _admin_scripts(){
|
132 |
-
$screen = get_current_screen();
|
133 |
|
134 |
-
|
|
|
135 |
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
142 |
|
143 |
-
|
144 |
-
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
$settings_tabs_field->admin_scripts();
|
149 |
-
}
|
150 |
|
151 |
|
|
|
|
|
152 |
|
|
|
|
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
|
156 |
-
public function
|
|
|
|
|
157 |
|
158 |
-
$
|
159 |
|
160 |
-
if(!in_array( 'accordions-pro/accordions-pro.php', (array) $active_plugins )){
|
161 |
-
$links['get_premium'] = '<a target="_blank" class="" style=" font-weight:bold;" href="https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard">'.__('Buy Premium!', 'accordions').'</a>';
|
162 |
|
|
|
|
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
}
|
|
|
165 |
|
|
|
|
|
166 |
|
|
|
167 |
|
168 |
-
|
|
|
|
|
169 |
|
170 |
-
}
|
171 |
|
172 |
|
|
|
|
|
173 |
}
|
174 |
|
175 |
new Accordions();
|
3 |
Plugin Name: Accordions by PickPlugins
|
4 |
Plugin URI: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
|
5 |
Description: Fully responsive and mobile ready accordion grid for wordpress.
|
6 |
+
Version: 2.2.36
|
7 |
Author: PickPlugins
|
8 |
Author URI: http://pickplugins.com
|
9 |
Text Domain: accordions
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
*/
|
14 |
|
15 |
+
if (!defined('ABSPATH')) exit; // if direct access
|
16 |
|
17 |
|
18 |
+
class Accordions
|
19 |
+
{
|
|
|
20 |
|
21 |
+
public function __construct()
|
22 |
+
{
|
|
|
|
|
|
|
23 |
|
24 |
+
define('accordions_plugin_url', plugins_url('/', __FILE__));
|
25 |
+
define('accordions_plugin_dir', plugin_dir_path(__FILE__));
|
26 |
+
define('accordions_version', '2.2.35');
|
27 |
+
define('accordions_plugin_name', 'Accordions');
|
28 |
+
define('accordions_plugin_basename', plugin_basename(__FILE__));
|
29 |
|
|
|
30 |
|
31 |
+
require_once(accordions_plugin_dir . 'includes/class-post-types.php');
|
|
|
32 |
|
33 |
+
require_once(accordions_plugin_dir . 'includes/class-post-meta-accordions.php');
|
34 |
+
require_once(accordions_plugin_dir . 'includes/class-post-meta-accordions-hook.php');
|
35 |
|
36 |
+
require_once(accordions_plugin_dir . 'includes/class-settings.php');
|
37 |
+
require_once(accordions_plugin_dir . 'includes/class-settings-hook.php');
|
|
|
38 |
|
39 |
+
require_once(accordions_plugin_dir . 'includes/class-post-meta-product.php');
|
40 |
+
require_once(accordions_plugin_dir . 'includes/class-admin-notices.php');
|
41 |
+
require_once(accordions_plugin_dir . 'includes/functions-data-upgrade.php');
|
42 |
|
43 |
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
require_once(accordions_plugin_dir . 'includes/class-settings-tabs.php');
|
46 |
+
require_once(accordions_plugin_dir . 'includes/functions.php');
|
47 |
+
require_once(accordions_plugin_dir . 'includes/functions-wc.php');
|
48 |
+
require_once(accordions_plugin_dir . 'includes/class-shortcodes.php');
|
49 |
+
require_once(accordions_plugin_dir . 'includes/duplicate-post.php');
|
50 |
|
51 |
|
|
|
|
|
52 |
|
53 |
+
require_once(accordions_plugin_dir . 'templates/accordion/accordion-hook.php');
|
54 |
+
require_once(accordions_plugin_dir . 'templates/tabs/tabs-hook.php');
|
55 |
|
56 |
+
require_once(accordions_plugin_dir . 'includes/3rd-party/3rd-party.php');
|
57 |
|
58 |
|
59 |
+
|
60 |
+
add_action('wp_enqueue_scripts', array($this, '_front_scripts'));
|
61 |
+
add_action('admin_enqueue_scripts', array($this, '_admin_scripts'));
|
62 |
+
|
63 |
+
add_action('plugins_loaded', array($this, '_textdomain'));
|
64 |
add_filter('cron_schedules', array($this, 'cron_recurrence_interval'));
|
65 |
|
66 |
|
67 |
+
require_once(accordions_plugin_dir . 'includes/class-widget-accordions.php');
|
68 |
+
|
69 |
+
add_action('widgets_init', array($this, 'widget_register'));
|
70 |
+
|
71 |
+
// Display shortcode in widgets
|
72 |
+
add_filter('widget_text', 'do_shortcode');
|
73 |
+
add_filter('plugin_action_links_' . accordions_plugin_basename, array($this, 'plugin_list_pro_link'));
|
74 |
+
}
|
75 |
+
|
76 |
+
public function widget_register()
|
77 |
+
{
|
78 |
+
register_widget('WidgetAccordions');
|
79 |
+
}
|
|
|
80 |
|
81 |
+
public function _textdomain()
|
82 |
+
{
|
83 |
|
84 |
+
$locale = apply_filters('plugin_locale', get_locale(), 'accordions');
|
85 |
+
load_textdomain('accordions', WP_LANG_DIR . '/accordions/accordions-' . $locale . '.mo');
|
86 |
|
87 |
+
load_plugin_textdomain('accordions', false, plugin_basename(dirname(__FILE__)) . '/languages/');
|
88 |
+
}
|
89 |
|
90 |
+
function cron_recurrence_interval($schedules)
|
91 |
+
{
|
92 |
|
93 |
$schedules['1minute'] = array(
|
94 |
'interval' => 40,
|
98 |
|
99 |
return $schedules;
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
public function _install()
|
103 |
+
{
|
104 |
|
105 |
+
do_action('accordions_action_install');
|
106 |
+
}
|
107 |
|
108 |
+
public function _uninstall()
|
109 |
+
{
|
110 |
|
111 |
+
do_action('accordions_action_uninstall');
|
112 |
+
}
|
113 |
|
114 |
+
public function _deactivation()
|
115 |
+
{
|
116 |
|
117 |
+
do_action('accordions_action_deactivation');
|
118 |
+
}
|
|
|
|
|
119 |
|
120 |
|
121 |
+
public function _front_scripts()
|
122 |
+
{
|
123 |
|
124 |
+
wp_enqueue_script('accordions_js', accordions_plugin_url . 'assets/frontend/js/scripts.js', array('jquery'));
|
125 |
+
wp_localize_script('accordions_js', 'accordions_ajax', array('accordions_ajaxurl' => admin_url('admin-ajax.php')));
|
126 |
|
127 |
+
wp_register_style('accordions-style', accordions_plugin_url . 'assets/frontend/css/style.css');
|
128 |
+
wp_register_style('style-tabs', accordions_plugin_url . 'assets/global/css/style-tabs.css');
|
129 |
+
|
130 |
+
wp_register_style('accordions-tabs', accordions_plugin_url . 'assets/global/css/themesTabs.style.css');
|
131 |
+
wp_register_style('fontawesome-5', accordions_plugin_url . 'assets/global/css/font-awesome-5.css');
|
132 |
+
wp_register_style('fontawesome-4', accordions_plugin_url . 'assets/global/css/font-awesome-4.css');
|
133 |
+
wp_register_style('jquery-ui', accordions_plugin_url . 'assets/frontend/css/jquery-ui.css');
|
134 |
+
wp_register_style('accordions-themes', accordions_plugin_url . 'assets/global/css/themes.style.css');
|
135 |
}
|
136 |
|
137 |
+
public function _admin_scripts()
|
138 |
+
{
|
139 |
+
$screen = get_current_screen();
|
140 |
|
141 |
+
//var_dump($screen);
|
142 |
|
|
|
|
|
143 |
|
144 |
+
wp_enqueue_script('accordions_admin_js', accordions_plugin_url . 'assets/admin/js/scripts.js', array('jquery'), '20181018');
|
145 |
+
wp_localize_script('accordions_admin_js', 'accordions_ajax', array('accordions_ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('accordions_nonce')));
|
146 |
|
147 |
+
wp_register_style('settings-tabs', accordions_plugin_url . 'assets/settings-tabs/settings-tabs.css');
|
148 |
+
wp_register_script('settings-tabs', accordions_plugin_url . 'assets/settings-tabs/settings-tabs.js', array('jquery'));
|
149 |
+
|
150 |
+
wp_register_style('font-awesome-4', accordions_plugin_url . 'assets/global/css/font-awesome-4.css');
|
151 |
+
wp_register_style('font-awesome-5', accordions_plugin_url . 'assets/global/css/font-awesome-5.css');
|
152 |
+
|
153 |
+
if ($screen->id == 'accordions' || $screen->id == 'accordions_page_settings') {
|
154 |
+
$settings_tabs_field = new settings_tabs_field();
|
155 |
+
$settings_tabs_field->admin_scripts();
|
156 |
}
|
157 |
+
}
|
158 |
|
159 |
+
public function plugin_list_pro_link($links)
|
160 |
+
{
|
161 |
|
162 |
+
$active_plugins = get_option('active_plugins');
|
163 |
|
164 |
+
if (!in_array('accordions-pro/accordions-pro.php', (array) $active_plugins)) {
|
165 |
+
$links['get_premium'] = '<a target="_blank" class="" style=" font-weight:bold;" href="https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard">' . __('Buy Premium!', 'accordions') . '</a>';
|
166 |
+
}
|
167 |
|
|
|
168 |
|
169 |
|
170 |
+
return $links;
|
171 |
+
}
|
172 |
}
|
173 |
|
174 |
new Accordions();
|
includes/functions.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
-
if (
|
3 |
|
4 |
-
function accordions_all_user_roles()
|
|
|
5 |
|
6 |
$wp_roles = new WP_Roles();
|
7 |
|
@@ -15,168 +16,169 @@ function accordions_all_user_roles() {
|
|
15 |
}
|
16 |
|
17 |
|
18 |
-
function accordions_old_content($post_id)
|
|
|
19 |
|
20 |
-
$accordions_content_title = get_post_meta(
|
21 |
-
$accordions_content_title_toggled = get_post_meta(
|
22 |
-
$accordions_content_body = get_post_meta(
|
23 |
-
$accordions_hide = get_post_meta(
|
24 |
-
$accordions_section_icon_plus = get_post_meta(
|
25 |
-
$accordions_section_icon_minus = get_post_meta(
|
26 |
-
$accordions_active_accordion = get_post_meta(
|
27 |
|
28 |
$accordions_data = array();
|
29 |
|
30 |
$i = 0;
|
31 |
|
32 |
-
if(!empty($accordions_content_title))
|
33 |
-
|
34 |
|
35 |
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
|
46 |
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
|
53 |
-
|
54 |
-
|
55 |
|
56 |
return $accordions_data;
|
57 |
-
|
58 |
}
|
59 |
|
60 |
|
61 |
|
62 |
-
function accordions_old_options($accordions_id)
|
|
|
63 |
|
64 |
|
65 |
-
$accordions_lazy_load = get_post_meta(
|
66 |
$accordions_options['lazy_load'] = $accordions_lazy_load;
|
67 |
|
68 |
-
$accordions_lazy_load_src = get_post_meta(
|
69 |
$accordions_options['lazy_load_src'] = $accordions_lazy_load_src;
|
70 |
|
71 |
-
$accordions_hide_edit = get_post_meta(
|
72 |
$accordions_options['hide_edit'] = $accordions_hide_edit;
|
73 |
|
74 |
-
$accordions_collapsible = get_post_meta(
|
75 |
$accordions_options['accordion']['collapsible'] = $accordions_collapsible;
|
76 |
|
77 |
-
$accordions_expaned_other = get_post_meta(
|
78 |
$accordions_options['accordion']['expanded_other'] = $accordions_expaned_other;
|
79 |
|
80 |
-
$accordions_heightStyle = get_post_meta(
|
81 |
$accordions_options['accordion']['height_style'] = $accordions_heightStyle;
|
82 |
|
83 |
-
$accordions_active_event = get_post_meta(
|
84 |
$accordions_options['accordion']['active_event'] = $accordions_active_event;
|
85 |
|
86 |
-
$enable_search = get_post_meta(
|
87 |
$accordions_options['accordion']['enable_search'] = $enable_search;
|
88 |
|
89 |
-
$search_placeholder_text = get_post_meta(
|
90 |
$accordions_options['accordion']['search_placeholder_text'] = $search_placeholder_text;
|
91 |
|
92 |
-
$accordions_click_scroll_top = get_post_meta(
|
93 |
$accordions_options['accordion']['click_scroll_top'] = $accordions_click_scroll_top;
|
94 |
|
95 |
-
$accordions_click_scroll_top_offset = get_post_meta(
|
96 |
$accordions_options['accordion']['click_scroll_top_offset'] = $accordions_click_scroll_top_offset;
|
97 |
|
98 |
-
$accordions_header_toggle = get_post_meta(
|
99 |
$accordions_options['accordion']['header_toggle'] = $accordions_header_toggle;
|
100 |
|
101 |
-
$accordions_animate_style = get_post_meta(
|
102 |
$accordions_options['accordion']['animate_style'] = $accordions_animate_style;
|
103 |
|
104 |
-
$accordions_animate_delay = get_post_meta(
|
105 |
$accordions_options['accordion']['animate_delay'] = $accordions_animate_delay;
|
106 |
|
107 |
-
$accordions_expand_collapse_display = get_post_meta(
|
108 |
$accordions_options['accordion']['expand_collapse_display'] = $accordions_expand_collapse_display;
|
109 |
|
110 |
-
$expand_collapse_bg_color = get_post_meta(
|
111 |
$accordions_options['accordion']['expand_collapse_bg_color'] = $expand_collapse_bg_color;
|
112 |
|
113 |
-
$expand_collapse_text = get_post_meta(
|
114 |
$accordions_options['accordion']['expand_collapse_text'] = $expand_collapse_text;
|
115 |
|
116 |
-
$accordions_child = get_post_meta(
|
117 |
$accordions_options['accordion']['is_child'] = $accordions_child;
|
118 |
|
119 |
|
120 |
-
$accordions_click_track = get_post_meta($accordions_id,'accordions_click_track', true);
|
121 |
$accordions_options['enable_stats'] = $accordions_click_track;
|
122 |
|
123 |
|
124 |
-
$accordions_tabs_collapsible = get_post_meta(
|
125 |
$accordions_options['tabs']['collapsible'] = $accordions_tabs_collapsible;
|
126 |
|
127 |
-
$accordions_tabs_active_event = get_post_meta(
|
128 |
$accordions_options['tabs']['active_event'] = $accordions_tabs_active_event;
|
129 |
|
130 |
-
$accordions_tabs_vertical = get_post_meta(
|
131 |
$accordions_options['tabs']['tabs_vertical'] = $accordions_tabs_vertical;
|
132 |
|
133 |
-
$accordions_tabs_vertical_width_ratio = get_post_meta(
|
134 |
$accordions_options['tabs']['navs_width_ratio'] = $accordions_tabs_vertical_width_ratio;
|
135 |
|
136 |
-
$accordions_tabs_icon_toggle = get_post_meta(
|
137 |
$accordions_options['tabs']['tabs_icon_toggle'] = $accordions_tabs_icon_toggle;
|
138 |
|
139 |
-
$accordions_icons_plus = get_post_meta(
|
140 |
-
$accordions_icons_minus = get_post_meta(
|
141 |
|
142 |
-
$accordions_icons_plus = !empty($accordions_icons_plus) ? '<i class="fa '
|
143 |
-
$accordions_icons_minus = !empty($accordions_icons_minus) ? '<i class="fa '
|
144 |
|
145 |
$accordions_options['icon']['active'] = $accordions_icons_plus;
|
146 |
$accordions_options['icon']['inactive'] = $accordions_icons_minus;
|
147 |
|
148 |
-
$accordions_icons_position = get_post_meta(
|
149 |
$accordions_options['icon']['position'] = $accordions_icons_position;
|
150 |
|
151 |
-
$accordions_icons_color = get_post_meta(
|
152 |
$accordions_options['icon']['color'] = $accordions_icons_color;
|
153 |
|
154 |
-
$accordions_icons_color_hover = get_post_meta(
|
155 |
$accordions_options['icon']['color_hover'] = $accordions_icons_color_hover;
|
156 |
|
157 |
-
$accordions_icons_font_size = get_post_meta(
|
158 |
$accordions_options['icon']['font_size'] = $accordions_icons_font_size;
|
159 |
|
160 |
-
$accordions_icons_bg_color = get_post_meta(
|
161 |
$accordions_options['icon']['background_color'] = $accordions_icons_bg_color;
|
162 |
|
163 |
-
$accordions_icons_padding = get_post_meta(
|
164 |
$accordions_options['icon']['padding'] = $accordions_icons_padding;
|
165 |
|
166 |
-
$accordions_themes = get_post_meta(
|
167 |
$accordions_options['accordion']['theme'] = $accordions_themes;
|
168 |
|
169 |
$header_class = 'border-none';
|
170 |
|
171 |
-
if($accordions_themes == 'flat'){
|
172 |
$header_class = 'border-none';
|
173 |
-
}elseif($accordions_themes == 'rounded'){
|
174 |
$header_class = 'border-round';
|
175 |
-
}elseif($accordions_themes == 'semi-rounded'){
|
176 |
$header_class = 'border-semi-round';
|
177 |
-
}elseif($accordions_themes == 'rounded-top'){
|
178 |
$header_class = 'border-top-round';
|
179 |
-
}elseif($accordions_themes == 'shadow'){
|
180 |
$header_class = 'shadow-bottom';
|
181 |
}
|
182 |
|
@@ -184,81 +186,81 @@ function accordions_old_options($accordions_id){
|
|
184 |
|
185 |
$accordions_options['header']['class'] = $header_class;
|
186 |
|
187 |
-
$accordions_active_bg_color = get_post_meta(
|
188 |
$accordions_options['header']['active_background_color'] = $accordions_active_bg_color;
|
189 |
|
190 |
-
$accordions_default_bg_color = get_post_meta(
|
191 |
$accordions_options['header']['background_color'] = $accordions_default_bg_color;
|
192 |
|
193 |
-
$accordions_header_bg_opacity = get_post_meta(
|
194 |
$accordions_options['header']['background_opacity'] = $accordions_header_bg_opacity;
|
195 |
|
196 |
-
$accordions_items_title_color = get_post_meta(
|
197 |
$accordions_options['header']['color'] = $accordions_items_title_color;
|
198 |
|
199 |
-
$accordions_items_title_color_hover = get_post_meta(
|
200 |
$accordions_options['header']['color_hover'] = $accordions_items_title_color_hover;
|
201 |
|
202 |
-
$accordions_items_title_font_size = get_post_meta(
|
203 |
$accordions_options['header']['font_size'] = $accordions_items_title_font_size;
|
204 |
|
205 |
-
$accordions_items_title_font_family = get_post_meta(
|
206 |
$accordions_options['header']['font_family'] = $accordions_items_title_font_family;
|
207 |
|
208 |
-
$accordions_items_title_padding = get_post_meta(
|
209 |
$accordions_options['header']['padding'] = $accordions_items_title_padding;
|
210 |
|
211 |
-
$accordions_items_title_margin = get_post_meta(
|
212 |
$accordions_options['header']['margin'] = $accordions_items_title_margin;
|
213 |
|
214 |
$body_class = '';
|
215 |
$accordions_options['body']['class'] = $body_class;
|
216 |
|
217 |
-
$accordions_active_bg_color = get_post_meta(
|
218 |
$accordions_options['body']['active_background_color'] = $accordions_active_bg_color;
|
219 |
|
220 |
-
$accordions_items_content_bg_color = get_post_meta(
|
221 |
$accordions_options['body']['background_color'] = $accordions_items_content_bg_color;
|
222 |
|
223 |
-
$accordions_items_content_bg_opacity = get_post_meta(
|
224 |
$accordions_options['body']['background_opacity'] = $accordions_items_content_bg_opacity;
|
225 |
|
226 |
-
$accordions_items_content_color = get_post_meta(
|
227 |
$accordions_options['body']['color'] = $accordions_items_content_color;
|
228 |
|
229 |
|
230 |
|
231 |
-
$accordions_items_content_font_size = get_post_meta(
|
232 |
$accordions_options['body']['font_size'] = $accordions_items_content_font_size;
|
233 |
|
234 |
-
$accordions_items_content_font_family = get_post_meta(
|
235 |
$accordions_options['body']['font_family'] = $accordions_items_content_font_family;
|
236 |
|
237 |
|
238 |
-
$accordions_items_content_padding = get_post_meta(
|
239 |
$accordions_options['body']['padding'] = $accordions_items_content_padding;
|
240 |
|
241 |
-
$accordions_items_content_margin = get_post_meta(
|
242 |
$accordions_options['body']['margin'] = $accordions_items_content_margin;
|
243 |
|
244 |
|
245 |
//Container options
|
246 |
-
$accordions_container_padding = get_post_meta(
|
247 |
$accordions_options['container']['padding'] = $accordions_container_padding;
|
248 |
|
249 |
-
$accordions_container_bg_color = get_post_meta(
|
250 |
$accordions_options['container']['background_color'] = $accordions_container_bg_color;
|
251 |
|
252 |
-
$accordions_items_content_bg_opacity = get_post_meta(
|
253 |
$accordions_options['container']['background_opacity'] = $accordions_items_content_bg_opacity;
|
254 |
|
255 |
-
$accordions_bg_img = get_post_meta(
|
256 |
$accordions_options['container']['background_img'] = $accordions_bg_img;
|
257 |
|
258 |
-
$accordions_container_text_align = get_post_meta(
|
259 |
$accordions_options['container']['text_align'] = $accordions_container_text_align;
|
260 |
|
261 |
-
$accordions_width = get_post_meta(
|
262 |
$accordions_width_large = !empty($accordions_width['large']) ? $accordions_width['large'] : '100%';
|
263 |
$accordions_width_medium = !empty($accordions_width['medium']) ? $accordions_width['medium'] : '100%';
|
264 |
$accordions_width_small = !empty($accordions_width['small']) ? $accordions_width['small'] : '100%';
|
@@ -269,31 +271,31 @@ function accordions_old_options($accordions_id){
|
|
269 |
|
270 |
|
271 |
// Custom Scripts
|
272 |
-
$accordions_custom_css = get_post_meta($accordions_id,'accordions_custom_css', true);
|
273 |
$accordions_options['custom_scripts']['custom_css'] = $accordions_custom_css;
|
274 |
|
275 |
-
$accordions_custom_js = get_post_meta($accordions_id,'accordions_custom_js', true);
|
276 |
$accordions_options['custom_scripts']['custom_js'] = $accordions_custom_js;
|
277 |
|
278 |
|
279 |
$track_header = get_post_meta($accordions_id, 'track_header', true);
|
280 |
$accordions_options['track_header'] = $track_header;
|
281 |
|
282 |
-
$accordions_content_title = get_post_meta($accordions_id,'accordions_content_title', true);
|
283 |
-
$accordions_content_body = get_post_meta($accordions_id,'accordions_content_body', true);
|
284 |
-
$accordions_content_title_toggled = get_post_meta($accordions_id,'accordions_content_title_toggled', true);
|
285 |
-
$accordions_section_icon_plus = get_post_meta($accordions_id,'accordions_section_icon_plus', true);
|
286 |
-
$accordions_section_icon_minus = get_post_meta($accordions_id,'accordions_section_icon_minus', true);
|
287 |
-
$accordions_hide = get_post_meta($accordions_id,'accordions_hide', true);
|
288 |
-
$accordions_bg_color = get_post_meta($accordions_id,'accordions_bg_color', true);
|
289 |
-
$accordions_header_bg_img = get_post_meta($accordions_id,'accordions_header_bg_img', true);
|
290 |
|
291 |
-
$accordions_active_accordion = get_post_meta($accordions_id,'accordions_active_accordion', true);
|
292 |
|
293 |
$i = 0;
|
294 |
|
295 |
-
if(!empty($accordions_content_title))
|
296 |
-
foreach ($accordions_content_title as $index => $title){
|
297 |
|
298 |
$accordions_options['content'][$index]['header'] = $title;
|
299 |
$accordions_options['content'][$index]['body'] = isset($accordions_content_body[$index]) ? $accordions_content_body[$index] : '';
|
@@ -303,8 +305,8 @@ function accordions_old_options($accordions_id){
|
|
303 |
$accordions_options['content'][$index]['is_active'] = ($accordions_active_accordion == $i) ? 'yes' : 'no';
|
304 |
|
305 |
|
306 |
-
$active_icon = !empty($accordions_section_icon_plus[$index]) ? '<i class="fa '
|
307 |
-
$inactive_icon = !empty($accordions_section_icon_minus[$index]) ? '<i class="fa '
|
308 |
|
309 |
$accordions_options['content'][$index]['active_icon'] = $active_icon;
|
310 |
$accordions_options['content'][$index]['inactive_icon'] = $inactive_icon;
|
@@ -317,7 +319,6 @@ function accordions_old_options($accordions_id){
|
|
317 |
|
318 |
|
319 |
return $accordions_options;
|
320 |
-
|
321 |
}
|
322 |
|
323 |
|
@@ -326,17 +327,18 @@ function accordions_old_options($accordions_id){
|
|
326 |
|
327 |
|
328 |
//add_filter('the_content','accordions_get_shortcode');
|
329 |
-
function accordions_get_shortcode($content)
|
|
|
330 |
|
331 |
|
332 |
-
if(strpos($content, '[restabs')){
|
333 |
$tabs = accordions_str_between_all($content, "[restabs", "[/restabs]");
|
334 |
|
335 |
-
foreach ($tabs as $tab_content){
|
336 |
|
337 |
-
$shortcode_content = accordions_nested_shortcode_content($tab_content, $child_tag='restab');
|
338 |
-
echo '<pre>'.var_export('#####', true).'</pre>';
|
339 |
-
echo '<pre>'.var_export($shortcode_content, true).'</pre>';
|
340 |
}
|
341 |
}
|
342 |
|
@@ -346,12 +348,12 @@ function accordions_get_shortcode($content){
|
|
346 |
|
347 |
|
348 |
|
349 |
-
function accordions_str_between_all($string, $start, $end, $includeDelimiters = false, &$offset = 0)
|
|
|
350 |
$strings = [];
|
351 |
$length = strlen($string);
|
352 |
|
353 |
-
while ($offset < $length)
|
354 |
-
{
|
355 |
$found = accordions_str_between($string, $start, $end, $includeDelimiters, $offset);
|
356 |
if ($found === null) break;
|
357 |
|
@@ -362,7 +364,8 @@ function accordions_str_between_all($string, $start, $end, $includeDelimiters =
|
|
362 |
return $strings;
|
363 |
}
|
364 |
|
365 |
-
function accordions_str_between($string, $start, $end, $includeDelimiters = false, &$offset = 0)
|
|
|
366 |
if ($string === '' || $start === '' || $end === '') return null;
|
367 |
|
368 |
$startLength = strlen($start);
|
@@ -392,20 +395,21 @@ function accordions_str_between($string, $start, $end, $includeDelimiters = fals
|
|
392 |
|
393 |
|
394 |
|
395 |
-
function accordions_nested_shortcode_content($string, $child_tag='restab')
|
|
|
396 |
|
397 |
$accordion_content = array();
|
398 |
|
399 |
//echo '<pre>'.var_export($tabs, true).'</pre>';
|
400 |
|
401 |
|
402 |
-
$tabs = explode('['
|
403 |
unset($tabs[0]);
|
404 |
|
405 |
$i = 0;
|
406 |
-
foreach ($tabs as $tab){
|
407 |
-
$tab = str_replace('[/'
|
408 |
-
$tab = str_replace(' active="active"','', $tab);
|
409 |
|
410 |
$title_content = explode(']', $tab);
|
411 |
$title = isset($title_content[0]) ? $title_content[0] : '';
|
@@ -435,33 +439,35 @@ function accordions_nested_shortcode_content($string, $child_tag='restab'){
|
|
435 |
}
|
436 |
|
437 |
|
438 |
-
add_filter('the_content','accordions_preview_content');
|
439 |
-
function accordions_preview_content($content)
|
440 |
-
|
|
|
441 |
$post_id = get_the_id();
|
442 |
-
$content .= do_shortcode('[accordions id="'
|
443 |
}
|
444 |
|
445 |
return $content;
|
446 |
}
|
447 |
|
448 |
|
449 |
-
function accordions_ajax_import_json()
|
|
|
450 |
|
451 |
-
|
452 |
|
453 |
|
454 |
$nonce = isset($_POST['nonce']) ? sanitize_text_field($_POST['nonce']) : '';
|
455 |
-
if(wp_verify_nonce(
|
456 |
|
457 |
-
if(current_user_can(
|
458 |
|
459 |
$json_file = isset($_POST['json_file']) ? esc_url_raw($_POST['json_file']) : '';
|
460 |
$string = file_get_contents($json_file);
|
461 |
-
$json_a = json_decode($string,true);
|
462 |
|
463 |
|
464 |
-
foreach ($json_a as $post_id
|
465 |
|
466 |
$meta_fields = accordions_recursive_sanitize_arr($post_data['meta_fields']);
|
467 |
|
@@ -476,30 +482,29 @@ function accordions_ajax_import_json(){
|
|
476 |
|
477 |
);
|
478 |
|
479 |
-
$post_inserted_id = wp_insert_post(
|
480 |
|
481 |
-
foreach ($meta_fields as $meta_key=> $meta_value){
|
482 |
-
update_post_meta(
|
483 |
}
|
484 |
}
|
485 |
|
486 |
|
487 |
//$response['json_a'] = $json_a;
|
488 |
-
$response['message'] = __('Impor done','');
|
489 |
}
|
490 |
-
|
491 |
-
|
492 |
-
$response['message'] = __('You do not have permission','');
|
493 |
}
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
-
|
499 |
|
500 |
|
501 |
|
502 |
-
|
503 |
}
|
504 |
add_action('wp_ajax_accordions_ajax_import_json', 'accordions_ajax_import_json');
|
505 |
//add_action('wp_ajax_nopriv_accordions_ajax_import_json', 'accordions_ajax_import_json');
|
@@ -513,26 +518,28 @@ add_action('wp_ajax_accordions_ajax_import_json', 'accordions_ajax_import_json')
|
|
513 |
add_shortcode('accordions_youtube', 'accordions_youtube');
|
514 |
|
515 |
|
516 |
-
function accordions_youtube($atts, $content = null
|
|
|
517 |
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
$width = $atts['width'];
|
528 |
-
$height = $atts['height'];
|
529 |
-
|
530 |
-
$html = '';
|
531 |
-
$html.= '<iframe width="'.esc_attr($width).'" height="'.esc_attr($height).'" src="https://www.youtube.com/embed/'.esc_attr($video_id).'" frameborder="0" allowfullscreen></iframe>';
|
532 |
|
533 |
-
|
534 |
-
|
|
|
535 |
|
|
|
|
|
|
|
|
|
|
|
536 |
|
537 |
|
538 |
|
@@ -543,64 +550,69 @@ function accordions_youtube($atts, $content = null ){
|
|
543 |
|
544 |
|
545 |
|
546 |
-
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
549 |
}
|
550 |
-
add_filter(
|
|
|
551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
552 |
|
553 |
-
function accordions_posts_shortcode_display( $column, $post_id ) {
|
554 |
-
if ($column == 'shortcode'){
|
555 |
-
?>
|
556 |
-
<input style="background:#bfefff" type="text" onClick="this.select();" value="[accordions <?php echo 'id="'.esc_attr($post_id).'"';?>]" /><br />
|
557 |
-
<textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[accordions id='; echo "'".esc_attr($post_id)."']"; echo '"); ?>'; ?></textarea>
|
558 |
-
<?php
|
559 |
-
|
560 |
}
|
561 |
}
|
562 |
|
563 |
-
add_action(
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
-
function accordions_paratheme_hex2rgb($hex)
|
571 |
-
|
|
|
572 |
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
}
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
-
function accordions_recursive_sanitize_arr($array)
|
|
|
592 |
|
593 |
-
foreach (
|
594 |
-
if (
|
595 |
$value = accordions_recursive_sanitize_arr($value);
|
596 |
-
}
|
597 |
-
|
598 |
-
$value = wp_kses_post( $value );
|
599 |
}
|
600 |
}
|
601 |
|
602 |
return $array;
|
603 |
}
|
604 |
-
|
605 |
-
|
606 |
-
|
1 |
<?php
|
2 |
+
if (!defined('ABSPATH')) exit; // if direct access
|
3 |
|
4 |
+
function accordions_all_user_roles()
|
5 |
+
{
|
6 |
|
7 |
$wp_roles = new WP_Roles();
|
8 |
|
16 |
}
|
17 |
|
18 |
|
19 |
+
function accordions_old_content($post_id)
|
20 |
+
{
|
21 |
|
22 |
+
$accordions_content_title = get_post_meta($post_id, 'accordions_content_title', true);
|
23 |
+
$accordions_content_title_toggled = get_post_meta($post_id, 'accordions_content_title_toggled', true);
|
24 |
+
$accordions_content_body = get_post_meta($post_id, 'accordions_content_body', true);
|
25 |
+
$accordions_hide = get_post_meta($post_id, 'accordions_hide', true);
|
26 |
+
$accordions_section_icon_plus = get_post_meta($post_id, 'accordions_section_icon_plus', true);
|
27 |
+
$accordions_section_icon_minus = get_post_meta($post_id, 'accordions_section_icon_minus', true);
|
28 |
+
$accordions_active_accordion = get_post_meta($post_id, 'accordions_active_accordion', true);
|
29 |
|
30 |
$accordions_data = array();
|
31 |
|
32 |
$i = 0;
|
33 |
|
34 |
+
if (!empty($accordions_content_title))
|
35 |
+
foreach ($accordions_content_title as $index => $item) {
|
36 |
|
37 |
|
38 |
+
$accordions_data[$index]['header'] = $item;
|
39 |
+
$accordions_data[$index]['body'] = isset($accordions_content_body[$index]) ? $accordions_content_body[$index] : '';
|
40 |
|
41 |
+
$is_active = ($accordions_active_accordion == $i) ? array($i) : array();
|
42 |
+
$accordions_data[$index]['is_active'] = $is_active;
|
43 |
+
$accordions_data[$index]['toggled_text'] = isset($accordions_content_title_toggled[$index]) ? $accordions_content_title_toggled[$index] : '';
|
44 |
|
45 |
+
$active_icon = !empty($accordions_section_icon_plus[$index]) ? '<i class="fa ' . $accordions_section_icon_plus[$index] . '"></i>' : '';
|
46 |
+
$inactive_icon = !empty($accordions_section_icon_minus[$index]) ? '<i class="fa ' . $accordions_section_icon_minus[$index] . '"></i>' : '';
|
47 |
|
48 |
|
49 |
|
50 |
+
$accordions_data[$index]['active_icon'] = $active_icon;
|
51 |
+
$accordions_data[$index]['inactive_icon'] = $inactive_icon;
|
52 |
+
$accordions_data[$index]['hide'] = !empty($accordions_hide[$index]) ? 'yes' : 'no';
|
53 |
|
54 |
|
55 |
+
$i++;
|
56 |
+
}
|
57 |
|
58 |
return $accordions_data;
|
|
|
59 |
}
|
60 |
|
61 |
|
62 |
|
63 |
+
function accordions_old_options($accordions_id)
|
64 |
+
{
|
65 |
|
66 |
|
67 |
+
$accordions_lazy_load = get_post_meta($accordions_id, 'accordions_lazy_load', true);
|
68 |
$accordions_options['lazy_load'] = $accordions_lazy_load;
|
69 |
|
70 |
+
$accordions_lazy_load_src = get_post_meta($accordions_id, 'accordions_lazy_load_src', true);
|
71 |
$accordions_options['lazy_load_src'] = $accordions_lazy_load_src;
|
72 |
|
73 |
+
$accordions_hide_edit = get_post_meta($accordions_id, 'accordions_hide_edit', true);
|
74 |
$accordions_options['hide_edit'] = $accordions_hide_edit;
|
75 |
|
76 |
+
$accordions_collapsible = get_post_meta($accordions_id, 'accordions_collapsible', true);
|
77 |
$accordions_options['accordion']['collapsible'] = $accordions_collapsible;
|
78 |
|
79 |
+
$accordions_expaned_other = get_post_meta($accordions_id, 'accordions_expaned_other', true);
|
80 |
$accordions_options['accordion']['expanded_other'] = $accordions_expaned_other;
|
81 |
|
82 |
+
$accordions_heightStyle = get_post_meta($accordions_id, 'accordions_heightStyle', true);
|
83 |
$accordions_options['accordion']['height_style'] = $accordions_heightStyle;
|
84 |
|
85 |
+
$accordions_active_event = get_post_meta($accordions_id, 'accordions_active_event', true);
|
86 |
$accordions_options['accordion']['active_event'] = $accordions_active_event;
|
87 |
|
88 |
+
$enable_search = get_post_meta($accordions_id, 'enable_search', true);
|
89 |
$accordions_options['accordion']['enable_search'] = $enable_search;
|
90 |
|
91 |
+
$search_placeholder_text = get_post_meta($accordions_id, 'search_placeholder_text', true);
|
92 |
$accordions_options['accordion']['search_placeholder_text'] = $search_placeholder_text;
|
93 |
|
94 |
+
$accordions_click_scroll_top = get_post_meta($accordions_id, 'accordions_click_scroll_top', true);
|
95 |
$accordions_options['accordion']['click_scroll_top'] = $accordions_click_scroll_top;
|
96 |
|
97 |
+
$accordions_click_scroll_top_offset = get_post_meta($accordions_id, 'accordions_click_scroll_top_offset', true);
|
98 |
$accordions_options['accordion']['click_scroll_top_offset'] = $accordions_click_scroll_top_offset;
|
99 |
|
100 |
+
$accordions_header_toggle = get_post_meta($accordions_id, 'accordions_header_toggle', true);
|
101 |
$accordions_options['accordion']['header_toggle'] = $accordions_header_toggle;
|
102 |
|
103 |
+
$accordions_animate_style = get_post_meta($accordions_id, 'accordions_animate_style', true);
|
104 |
$accordions_options['accordion']['animate_style'] = $accordions_animate_style;
|
105 |
|
106 |
+
$accordions_animate_delay = get_post_meta($accordions_id, 'accordions_animate_delay', true);
|
107 |
$accordions_options['accordion']['animate_delay'] = $accordions_animate_delay;
|
108 |
|
109 |
+
$accordions_expand_collapse_display = get_post_meta($accordions_id, 'accordions_expand_collapse_display', true);
|
110 |
$accordions_options['accordion']['expand_collapse_display'] = $accordions_expand_collapse_display;
|
111 |
|
112 |
+
$expand_collapse_bg_color = get_post_meta($accordions_id, 'expand_collapse_bg_color', true);
|
113 |
$accordions_options['accordion']['expand_collapse_bg_color'] = $expand_collapse_bg_color;
|
114 |
|
115 |
+
$expand_collapse_text = get_post_meta($accordions_id, 'expand_collapse_text', true);
|
116 |
$accordions_options['accordion']['expand_collapse_text'] = $expand_collapse_text;
|
117 |
|
118 |
+
$accordions_child = get_post_meta($accordions_id, 'accordions_child', true);
|
119 |
$accordions_options['accordion']['is_child'] = $accordions_child;
|
120 |
|
121 |
|
122 |
+
$accordions_click_track = get_post_meta($accordions_id, 'accordions_click_track', true);
|
123 |
$accordions_options['enable_stats'] = $accordions_click_track;
|
124 |
|
125 |
|
126 |
+
$accordions_tabs_collapsible = get_post_meta($accordions_id, 'accordions_tabs_collapsible', true);
|
127 |
$accordions_options['tabs']['collapsible'] = $accordions_tabs_collapsible;
|
128 |
|
129 |
+
$accordions_tabs_active_event = get_post_meta($accordions_id, 'accordions_tabs_active_event', true);
|
130 |
$accordions_options['tabs']['active_event'] = $accordions_tabs_active_event;
|
131 |
|
132 |
+
$accordions_tabs_vertical = get_post_meta($accordions_id, 'accordions_tabs_vertical', true);
|
133 |
$accordions_options['tabs']['tabs_vertical'] = $accordions_tabs_vertical;
|
134 |
|
135 |
+
$accordions_tabs_vertical_width_ratio = get_post_meta($accordions_id, 'accordions_tabs_vertical_width_ratio', true);
|
136 |
$accordions_options['tabs']['navs_width_ratio'] = $accordions_tabs_vertical_width_ratio;
|
137 |
|
138 |
+
$accordions_tabs_icon_toggle = get_post_meta($accordions_id, 'accordions_tabs_icon_toggle', true);
|
139 |
$accordions_options['tabs']['tabs_icon_toggle'] = $accordions_tabs_icon_toggle;
|
140 |
|
141 |
+
$accordions_icons_plus = get_post_meta($accordions_id, 'accordions_icons_plus', true);
|
142 |
+
$accordions_icons_minus = get_post_meta($accordions_id, 'accordions_icons_minus', true);
|
143 |
|
144 |
+
$accordions_icons_plus = !empty($accordions_icons_plus) ? '<i class="fa ' . $accordions_icons_plus . '"></i>' : '';
|
145 |
+
$accordions_icons_minus = !empty($accordions_icons_minus) ? '<i class="fa ' . $accordions_icons_minus . '"></i>' : '';
|
146 |
|
147 |
$accordions_options['icon']['active'] = $accordions_icons_plus;
|
148 |
$accordions_options['icon']['inactive'] = $accordions_icons_minus;
|
149 |
|
150 |
+
$accordions_icons_position = get_post_meta($accordions_id, 'accordions_icons_position', true);
|
151 |
$accordions_options['icon']['position'] = $accordions_icons_position;
|
152 |
|
153 |
+
$accordions_icons_color = get_post_meta($accordions_id, 'accordions_icons_color', true);
|
154 |
$accordions_options['icon']['color'] = $accordions_icons_color;
|
155 |
|
156 |
+
$accordions_icons_color_hover = get_post_meta($accordions_id, 'accordions_icons_color_hover', true);
|
157 |
$accordions_options['icon']['color_hover'] = $accordions_icons_color_hover;
|
158 |
|
159 |
+
$accordions_icons_font_size = get_post_meta($accordions_id, 'accordions_icons_font_size', true);
|
160 |
$accordions_options['icon']['font_size'] = $accordions_icons_font_size;
|
161 |
|
162 |
+
$accordions_icons_bg_color = get_post_meta($accordions_id, 'accordions_icons_bg_color', true);
|
163 |
$accordions_options['icon']['background_color'] = $accordions_icons_bg_color;
|
164 |
|
165 |
+
$accordions_icons_padding = get_post_meta($accordions_id, 'accordions_icons_padding', true);
|
166 |
$accordions_options['icon']['padding'] = $accordions_icons_padding;
|
167 |
|
168 |
+
$accordions_themes = get_post_meta($accordions_id, 'accordions_themes', true);
|
169 |
$accordions_options['accordion']['theme'] = $accordions_themes;
|
170 |
|
171 |
$header_class = 'border-none';
|
172 |
|
173 |
+
if ($accordions_themes == 'flat') {
|
174 |
$header_class = 'border-none';
|
175 |
+
} elseif ($accordions_themes == 'rounded') {
|
176 |
$header_class = 'border-round';
|
177 |
+
} elseif ($accordions_themes == 'semi-rounded') {
|
178 |
$header_class = 'border-semi-round';
|
179 |
+
} elseif ($accordions_themes == 'rounded-top') {
|
180 |
$header_class = 'border-top-round';
|
181 |
+
} elseif ($accordions_themes == 'shadow') {
|
182 |
$header_class = 'shadow-bottom';
|
183 |
}
|
184 |
|
186 |
|
187 |
$accordions_options['header']['class'] = $header_class;
|
188 |
|
189 |
+
$accordions_active_bg_color = get_post_meta($accordions_id, 'accordions_active_bg_color', true);
|
190 |
$accordions_options['header']['active_background_color'] = $accordions_active_bg_color;
|
191 |
|
192 |
+
$accordions_default_bg_color = get_post_meta($accordions_id, 'accordions_default_bg_color', true);
|
193 |
$accordions_options['header']['background_color'] = $accordions_default_bg_color;
|
194 |
|
195 |
+
$accordions_header_bg_opacity = get_post_meta($accordions_id, 'accordions_header_bg_opacity', true);
|
196 |
$accordions_options['header']['background_opacity'] = $accordions_header_bg_opacity;
|
197 |
|
198 |
+
$accordions_items_title_color = get_post_meta($accordions_id, 'accordions_items_title_color', true);
|
199 |
$accordions_options['header']['color'] = $accordions_items_title_color;
|
200 |
|
201 |
+
$accordions_items_title_color_hover = get_post_meta($accordions_id, 'accordions_items_title_color_hover', true);
|
202 |
$accordions_options['header']['color_hover'] = $accordions_items_title_color_hover;
|
203 |
|
204 |
+
$accordions_items_title_font_size = get_post_meta($accordions_id, 'accordions_items_title_font_size', true);
|
205 |
$accordions_options['header']['font_size'] = $accordions_items_title_font_size;
|
206 |
|
207 |
+
$accordions_items_title_font_family = get_post_meta($accordions_id, 'accordions_items_title_font_family', true);
|
208 |
$accordions_options['header']['font_family'] = $accordions_items_title_font_family;
|
209 |
|
210 |
+
$accordions_items_title_padding = get_post_meta($accordions_id, 'accordions_items_title_padding', true);
|
211 |
$accordions_options['header']['padding'] = $accordions_items_title_padding;
|
212 |
|
213 |
+
$accordions_items_title_margin = get_post_meta($accordions_id, 'accordions_items_title_margin', true);
|
214 |
$accordions_options['header']['margin'] = $accordions_items_title_margin;
|
215 |
|
216 |
$body_class = '';
|
217 |
$accordions_options['body']['class'] = $body_class;
|
218 |
|
219 |
+
$accordions_active_bg_color = get_post_meta($accordions_id, 'accordions_active_bg_color', true);
|
220 |
$accordions_options['body']['active_background_color'] = $accordions_active_bg_color;
|
221 |
|
222 |
+
$accordions_items_content_bg_color = get_post_meta($accordions_id, 'accordions_items_content_bg_color', true);
|
223 |
$accordions_options['body']['background_color'] = $accordions_items_content_bg_color;
|
224 |
|
225 |
+
$accordions_items_content_bg_opacity = get_post_meta($accordions_id, 'accordions_items_content_bg_opacity', true);
|
226 |
$accordions_options['body']['background_opacity'] = $accordions_items_content_bg_opacity;
|
227 |
|
228 |
+
$accordions_items_content_color = get_post_meta($accordions_id, 'accordions_items_content_color', true);
|
229 |
$accordions_options['body']['color'] = $accordions_items_content_color;
|
230 |
|
231 |
|
232 |
|
233 |
+
$accordions_items_content_font_size = get_post_meta($accordions_id, 'accordions_items_content_font_size', true);
|
234 |
$accordions_options['body']['font_size'] = $accordions_items_content_font_size;
|
235 |
|
236 |
+
$accordions_items_content_font_family = get_post_meta($accordions_id, 'accordions_items_content_font_family', true);
|
237 |
$accordions_options['body']['font_family'] = $accordions_items_content_font_family;
|
238 |
|
239 |
|
240 |
+
$accordions_items_content_padding = get_post_meta($accordions_id, 'accordions_items_content_padding', true);
|
241 |
$accordions_options['body']['padding'] = $accordions_items_content_padding;
|
242 |
|
243 |
+
$accordions_items_content_margin = get_post_meta($accordions_id, 'accordions_items_content_margin', true);
|
244 |
$accordions_options['body']['margin'] = $accordions_items_content_margin;
|
245 |
|
246 |
|
247 |
//Container options
|
248 |
+
$accordions_container_padding = get_post_meta($accordions_id, 'accordions_container_padding', true);
|
249 |
$accordions_options['container']['padding'] = $accordions_container_padding;
|
250 |
|
251 |
+
$accordions_container_bg_color = get_post_meta($accordions_id, 'accordions_container_bg_color', true);
|
252 |
$accordions_options['container']['background_color'] = $accordions_container_bg_color;
|
253 |
|
254 |
+
$accordions_items_content_bg_opacity = get_post_meta($accordions_id, 'accordions_items_content_bg_opacity', true);
|
255 |
$accordions_options['container']['background_opacity'] = $accordions_items_content_bg_opacity;
|
256 |
|
257 |
+
$accordions_bg_img = get_post_meta($accordions_id, 'accordions_bg_img', true);
|
258 |
$accordions_options['container']['background_img'] = $accordions_bg_img;
|
259 |
|
260 |
+
$accordions_container_text_align = get_post_meta($accordions_id, 'accordions_container_text_align', true);
|
261 |
$accordions_options['container']['text_align'] = $accordions_container_text_align;
|
262 |
|
263 |
+
$accordions_width = get_post_meta($accordions_id, 'accordions_width', true);
|
264 |
$accordions_width_large = !empty($accordions_width['large']) ? $accordions_width['large'] : '100%';
|
265 |
$accordions_width_medium = !empty($accordions_width['medium']) ? $accordions_width['medium'] : '100%';
|
266 |
$accordions_width_small = !empty($accordions_width['small']) ? $accordions_width['small'] : '100%';
|
271 |
|
272 |
|
273 |
// Custom Scripts
|
274 |
+
$accordions_custom_css = get_post_meta($accordions_id, 'accordions_custom_css', true);
|
275 |
$accordions_options['custom_scripts']['custom_css'] = $accordions_custom_css;
|
276 |
|
277 |
+
$accordions_custom_js = get_post_meta($accordions_id, 'accordions_custom_js', true);
|
278 |
$accordions_options['custom_scripts']['custom_js'] = $accordions_custom_js;
|
279 |
|
280 |
|
281 |
$track_header = get_post_meta($accordions_id, 'track_header', true);
|
282 |
$accordions_options['track_header'] = $track_header;
|
283 |
|
284 |
+
$accordions_content_title = get_post_meta($accordions_id, 'accordions_content_title', true);
|
285 |
+
$accordions_content_body = get_post_meta($accordions_id, 'accordions_content_body', true);
|
286 |
+
$accordions_content_title_toggled = get_post_meta($accordions_id, 'accordions_content_title_toggled', true);
|
287 |
+
$accordions_section_icon_plus = get_post_meta($accordions_id, 'accordions_section_icon_plus', true);
|
288 |
+
$accordions_section_icon_minus = get_post_meta($accordions_id, 'accordions_section_icon_minus', true);
|
289 |
+
$accordions_hide = get_post_meta($accordions_id, 'accordions_hide', true);
|
290 |
+
$accordions_bg_color = get_post_meta($accordions_id, 'accordions_bg_color', true);
|
291 |
+
$accordions_header_bg_img = get_post_meta($accordions_id, 'accordions_header_bg_img', true);
|
292 |
|
293 |
+
$accordions_active_accordion = get_post_meta($accordions_id, 'accordions_active_accordion', true);
|
294 |
|
295 |
$i = 0;
|
296 |
|
297 |
+
if (!empty($accordions_content_title))
|
298 |
+
foreach ($accordions_content_title as $index => $title) {
|
299 |
|
300 |
$accordions_options['content'][$index]['header'] = $title;
|
301 |
$accordions_options['content'][$index]['body'] = isset($accordions_content_body[$index]) ? $accordions_content_body[$index] : '';
|
305 |
$accordions_options['content'][$index]['is_active'] = ($accordions_active_accordion == $i) ? 'yes' : 'no';
|
306 |
|
307 |
|
308 |
+
$active_icon = !empty($accordions_section_icon_plus[$index]) ? '<i class="fa ' . $accordions_section_icon_plus[$index] . '"></i>' : '';
|
309 |
+
$inactive_icon = !empty($accordions_section_icon_minus[$index]) ? '<i class="fa ' . $accordions_section_icon_minus[$index] . '"></i>' : '';
|
310 |
|
311 |
$accordions_options['content'][$index]['active_icon'] = $active_icon;
|
312 |
$accordions_options['content'][$index]['inactive_icon'] = $inactive_icon;
|
319 |
|
320 |
|
321 |
return $accordions_options;
|
|
|
322 |
}
|
323 |
|
324 |
|
327 |
|
328 |
|
329 |
//add_filter('the_content','accordions_get_shortcode');
|
330 |
+
function accordions_get_shortcode($content)
|
331 |
+
{
|
332 |
|
333 |
|
334 |
+
if (strpos($content, '[restabs')) {
|
335 |
$tabs = accordions_str_between_all($content, "[restabs", "[/restabs]");
|
336 |
|
337 |
+
foreach ($tabs as $tab_content) {
|
338 |
|
339 |
+
$shortcode_content = accordions_nested_shortcode_content($tab_content, $child_tag = 'restab');
|
340 |
+
echo '<pre>' . var_export('#####', true) . '</pre>';
|
341 |
+
echo '<pre>' . var_export($shortcode_content, true) . '</pre>';
|
342 |
}
|
343 |
}
|
344 |
|
348 |
|
349 |
|
350 |
|
351 |
+
function accordions_str_between_all($string, $start, $end, $includeDelimiters = false, &$offset = 0)
|
352 |
+
{
|
353 |
$strings = [];
|
354 |
$length = strlen($string);
|
355 |
|
356 |
+
while ($offset < $length) {
|
|
|
357 |
$found = accordions_str_between($string, $start, $end, $includeDelimiters, $offset);
|
358 |
if ($found === null) break;
|
359 |
|
364 |
return $strings;
|
365 |
}
|
366 |
|
367 |
+
function accordions_str_between($string, $start, $end, $includeDelimiters = false, &$offset = 0)
|
368 |
+
{
|
369 |
if ($string === '' || $start === '' || $end === '') return null;
|
370 |
|
371 |
$startLength = strlen($start);
|
395 |
|
396 |
|
397 |
|
398 |
+
function accordions_nested_shortcode_content($string, $child_tag = 'restab')
|
399 |
+
{
|
400 |
|
401 |
$accordion_content = array();
|
402 |
|
403 |
//echo '<pre>'.var_export($tabs, true).'</pre>';
|
404 |
|
405 |
|
406 |
+
$tabs = explode('[' . $child_tag, $string);
|
407 |
unset($tabs[0]);
|
408 |
|
409 |
$i = 0;
|
410 |
+
foreach ($tabs as $tab) {
|
411 |
+
$tab = str_replace('[/' . $child_tag . ']', '', $tab);
|
412 |
+
$tab = str_replace(' active="active"', '', $tab);
|
413 |
|
414 |
$title_content = explode(']', $tab);
|
415 |
$title = isset($title_content[0]) ? $title_content[0] : '';
|
439 |
}
|
440 |
|
441 |
|
442 |
+
add_filter('the_content', 'accordions_preview_content');
|
443 |
+
function accordions_preview_content($content)
|
444 |
+
{
|
445 |
+
if (is_singular('accordions')) {
|
446 |
$post_id = get_the_id();
|
447 |
+
$content .= do_shortcode('[accordions id="' . $post_id . '"]');
|
448 |
}
|
449 |
|
450 |
return $content;
|
451 |
}
|
452 |
|
453 |
|
454 |
+
function accordions_ajax_import_json()
|
455 |
+
{
|
456 |
|
457 |
+
$response = array();
|
458 |
|
459 |
|
460 |
$nonce = isset($_POST['nonce']) ? sanitize_text_field($_POST['nonce']) : '';
|
461 |
+
if (wp_verify_nonce($nonce, 'accordions_nonce')) {
|
462 |
|
463 |
+
if (current_user_can('manage_options')) {
|
464 |
|
465 |
$json_file = isset($_POST['json_file']) ? esc_url_raw($_POST['json_file']) : '';
|
466 |
$string = file_get_contents($json_file);
|
467 |
+
$json_a = json_decode($string, true);
|
468 |
|
469 |
|
470 |
+
foreach ($json_a as $post_id => $post_data) {
|
471 |
|
472 |
$meta_fields = accordions_recursive_sanitize_arr($post_data['meta_fields']);
|
473 |
|
482 |
|
483 |
);
|
484 |
|
485 |
+
$post_inserted_id = wp_insert_post($my_post);
|
486 |
|
487 |
+
foreach ($meta_fields as $meta_key => $meta_value) {
|
488 |
+
update_post_meta($post_inserted_id, $meta_key, $meta_value);
|
489 |
}
|
490 |
}
|
491 |
|
492 |
|
493 |
//$response['json_a'] = $json_a;
|
494 |
+
$response['message'] = __('Impor done', '');
|
495 |
}
|
496 |
+
} else {
|
497 |
+
$response['message'] = __('You do not have permission', '');
|
|
|
498 |
}
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
+
echo json_encode($response);
|
504 |
|
505 |
|
506 |
|
507 |
+
die();
|
508 |
}
|
509 |
add_action('wp_ajax_accordions_ajax_import_json', 'accordions_ajax_import_json');
|
510 |
//add_action('wp_ajax_nopriv_accordions_ajax_import_json', 'accordions_ajax_import_json');
|
518 |
add_shortcode('accordions_youtube', 'accordions_youtube');
|
519 |
|
520 |
|
521 |
+
function accordions_youtube($atts, $content = null)
|
522 |
+
{
|
523 |
|
524 |
+
$atts = shortcode_atts(
|
525 |
+
array(
|
526 |
+
'video_id' => "",
|
527 |
+
'width' => "560",
|
528 |
+
'height' => "315",
|
529 |
|
530 |
+
),
|
531 |
+
$atts
|
532 |
+
);
|
|
|
|
|
|
|
|
|
|
|
533 |
|
534 |
+
$video_id = $atts['video_id'];
|
535 |
+
$width = $atts['width'];
|
536 |
+
$height = $atts['height'];
|
537 |
|
538 |
+
$html = '';
|
539 |
+
$html .= '<iframe width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" src="https://www.youtube.com/embed/' . esc_attr($video_id) . '" frameborder="0" allowfullscreen></iframe>';
|
540 |
+
|
541 |
+
return $html;
|
542 |
+
}
|
543 |
|
544 |
|
545 |
|
550 |
|
551 |
|
552 |
|
553 |
+
|
554 |
+
function accordions_add_shortcode_column($columns)
|
555 |
+
{
|
556 |
+
return array_merge(
|
557 |
+
$columns,
|
558 |
+
array('shortcode' => __('Shortcode', 'accordions'))
|
559 |
+
);
|
560 |
}
|
561 |
+
add_filter('manage_accordions_posts_columns', 'accordions_add_shortcode_column');
|
562 |
+
|
563 |
|
564 |
+
function accordions_posts_shortcode_display($column, $post_id)
|
565 |
+
{
|
566 |
+
if ($column == 'shortcode') {
|
567 |
+
?>
|
568 |
+
<input style="background:#bfefff" type="text" onClick="this.select();" value="[accordions <?php echo 'id="' . esc_attr($post_id) . '"'; ?>]" /><br />
|
569 |
+
<textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();"><?php echo '<?php echo do_shortcode("[accordions id=';
|
570 |
+
echo "'" . esc_attr($post_id) . "']";
|
571 |
+
echo '"); ?>'; ?></textarea>
|
572 |
+
<?php
|
573 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
}
|
575 |
}
|
576 |
|
577 |
+
add_action('manage_accordions_posts_custom_column', 'accordions_posts_shortcode_display', 10, 2);
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
+
function accordions_paratheme_hex2rgb($hex)
|
585 |
+
{
|
586 |
+
$hex = str_replace("#", "", $hex);
|
587 |
|
588 |
+
if (strlen($hex) == 3) {
|
589 |
+
$r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1));
|
590 |
+
$g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1));
|
591 |
+
$b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1));
|
592 |
+
} else {
|
593 |
+
$r = hexdec(substr($hex, 0, 2));
|
594 |
+
$g = hexdec(substr($hex, 2, 2));
|
595 |
+
$b = hexdec(substr($hex, 4, 2));
|
596 |
+
}
|
597 |
+
$rgb = $r . ',' . $g . ',' . $b;
|
598 |
+
//return implode(",", $rgb); // returns the rgb values separated by commas
|
599 |
+
return $rgb; // returns an array with the rgb values
|
600 |
}
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
+
function accordions_recursive_sanitize_arr($array)
|
607 |
+
{
|
608 |
|
609 |
+
foreach ($array as $key => &$value) {
|
610 |
+
if (is_array($value)) {
|
611 |
$value = accordions_recursive_sanitize_arr($value);
|
612 |
+
} else {
|
613 |
+
$value = wp_kses_post($value);
|
|
|
614 |
}
|
615 |
}
|
616 |
|
617 |
return $array;
|
618 |
}
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.8
|
7 |
-
Stable tag: 2.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -139,6 +139,10 @@ then paste this shortcode anywhere in your page to display accordions<br />
|
|
139 |
|
140 |
== Changelog ==
|
141 |
|
|
|
|
|
|
|
|
|
142 |
= 2.2.35 =
|
143 |
* 2021-12-15 - fix - SQL security issue fixed.
|
144 |
|
4 |
Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.8
|
7 |
+
Stable tag: 2.2.36
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
139 |
|
140 |
== Changelog ==
|
141 |
|
142 |
+
|
143 |
+
= 2.2.36 =
|
144 |
+
* 2022-01-07 - fix - Background image bug issue fixed.
|
145 |
+
|
146 |
= 2.2.35 =
|
147 |
* 2021-12-15 - fix - SQL security issue fixed.
|
148 |
|
templates/accordion/accordion-hook.php
CHANGED
@@ -1,276 +1,247 @@
|
|
1 |
<?php
|
2 |
-
if (
|
3 |
|
4 |
add_action('accordions_main', 'accordions_main_top', 5);
|
5 |
|
6 |
-
function accordions_main_top($atts)
|
|
|
7 |
|
8 |
$post_id = isset($atts['id']) ? $atts['id'] : '';
|
9 |
-
$accordions_options = get_post_meta($post_id,'accordions_options', true);
|
10 |
$accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
|
11 |
|
12 |
|
13 |
$lazy_load = isset($accordions_options['lazy_load']) ? $accordions_options['lazy_load'] : 'yes';
|
14 |
$lazy_load_src = isset($accordions_options['lazy_load_src']) ? $accordions_options['lazy_load_src'] : '';
|
15 |
|
16 |
-
if($lazy_load=='yes'):
|
17 |
-
|
18 |
-
<?php if(!empty($lazy_load_src))
|
19 |
<img src="<?php echo esc_url_raw($lazy_load_src); ?>" />
|
20 |
<?php endif; ?>
|
21 |
</div>
|
22 |
<script>
|
23 |
-
jQuery(window).load(function(){
|
24 |
jQuery('#accordions-lazy-<?php echo esc_attr($post_id); ?>').fadeOut();
|
25 |
jQuery('#accordions-<?php echo esc_attr($post_id); ?> .items').fadeIn();
|
26 |
});
|
27 |
</script><?php
|
28 |
-
|
29 |
-
}
|
30 |
|
31 |
|
32 |
|
33 |
-
add_action('accordions_main', 'accordions_main_style', 20);
|
34 |
|
35 |
-
function accordions_main_style($atts)
|
|
|
36 |
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
$icon = isset($accordions_options['icon']) ? $accordions_options['icon'] : array();
|
47 |
-
$icon_active = isset($icon['active']) ? $icon['active'] : '';
|
48 |
-
$icon_inactive = isset($icon['inactive']) ? $icon['inactive'] : '';
|
49 |
-
$icon_color = isset($icon['color']) ? $icon['color'] : '';
|
50 |
-
$icon_color_hover = isset($icon['color_hover']) ? $icon['color_hover'] : '';
|
51 |
-
$icon_font_size = isset($icon['font_size']) ? $icon['font_size'] : '';
|
52 |
-
$icon_background_color = isset($icon['background_color']) ? $icon['background_color'] : '';
|
53 |
-
$icon_padding = isset($icon['padding']) ? $icon['padding'] : '0px';
|
54 |
-
$icon_margin = isset($icon['margin']) ? $icon['margin'] : '0px';
|
55 |
-
|
56 |
-
|
57 |
-
$header = isset($accordions_options['header']) ? $accordions_options['header'] : array();
|
58 |
-
$header_style_class = isset($header['style_class']) ? $header['style_class'] : '';
|
59 |
-
|
60 |
-
$header_background_color = !empty($header['background_color']) ? $header['background_color'] : '#1e73be';
|
61 |
-
$header_active_background_color = !empty($header['active_background_color']) ? $header['active_background_color'] : '#174e7f';
|
62 |
-
$header_color = !empty($header['color']) ? $header['color'] : '#ffffff';
|
63 |
-
$header_color_hover = !empty($header['color_hover']) ? $header['color_hover'] : '#ffffff';
|
64 |
-
$header_font_size = !empty($header['font_size']) ? $header['font_size'] : '16px';
|
65 |
-
$header_padding = !empty($header['padding']) ? $header['padding'] : '';
|
66 |
-
$header_margin = !empty($header['margin']) ? $header['margin'] : '';
|
67 |
-
$header_font_family = !empty($header['font_family']) ? $header['font_family'] : '';
|
68 |
-
|
69 |
-
|
70 |
-
$body = isset($accordions_options['body']) ? $accordions_options['body'] : array();
|
71 |
-
$body_background_color = isset($body['background_color']) ? $body['background_color'] : '';
|
72 |
-
$body_active_background_color = isset($body['active_background_color']) ? $body['active_background_color'] : '';
|
73 |
-
$body_color = isset($body['color']) ? $body['color'] : '';
|
74 |
-
$body_color_hover = isset($body['color_hover']) ? $body['color_hover'] : '';
|
75 |
-
$body_font_size = isset($body['font_size']) ? $body['font_size'] : '';
|
76 |
-
$body_padding = isset($body['padding']) ? $body['padding'] : '';
|
77 |
-
$body_margin = isset($body['margin']) ? $body['margin'] : '';
|
78 |
-
$body_font_family = isset($body['font_family']) ? $body['font_family'] : '';
|
79 |
-
|
80 |
-
|
81 |
-
$container = isset($accordions_options['container']) ? $accordions_options['container'] : array();
|
82 |
-
$container_padding = isset($container['padding']) ? $container['padding'] : '';
|
83 |
-
$container_background_color = isset($container['background_color']) ? $container['background_color'] : '';
|
84 |
-
$container_text_align = isset($container['text_align']) ? $container['text_align'] : '';
|
85 |
-
$container_background_img = isset($container['background_img']) ? $container['background_img'] : '';
|
86 |
-
$width_large = isset($container['width_large']) ? $container['width_large'] : '';
|
87 |
-
$width_medium = isset($container['width_medium']) ? $container['width_medium'] : '';
|
88 |
-
$width_small = isset($container['width_small']) ? $container['width_small'] : '';
|
89 |
-
|
90 |
-
$custom_scripts = isset($accordions_options['custom_scripts']) ? $accordions_options['custom_scripts'] : array();
|
91 |
-
$custom_js = isset($custom_scripts['custom_js']) ? $custom_scripts['custom_js'] : '';
|
92 |
-
$custom_css = isset($custom_scripts['custom_css']) ? $custom_scripts['custom_css'] : '';
|
93 |
-
|
94 |
-
$accordions_settings = get_option('accordions_settings');
|
95 |
-
$font_aw_version = isset($accordions_settings['font_aw_version']) ? $accordions_settings['font_aw_version'] : 'v_5';
|
96 |
-
|
97 |
-
//var_dump($custom_css);
|
98 |
-
|
99 |
-
wp_enqueue_style('accordions-style');
|
100 |
-
|
101 |
-
wp_enqueue_style('jquery-ui');
|
102 |
-
wp_enqueue_style('accordions-themes');
|
103 |
-
|
104 |
-
if($font_aw_version =='v_5'){
|
105 |
-
wp_enqueue_style('fontawesome-5');
|
106 |
-
}elseif($font_aw_version =='v_4'){
|
107 |
-
wp_enqueue_style('fontawesome-4');
|
108 |
-
}
|
109 |
|
|
|
|
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
-
wp_enqueue_script( 'jquery' );
|
113 |
-
wp_enqueue_script( 'jquery-ui-core' );
|
114 |
-
wp_enqueue_script('jquery-ui-accordion');
|
115 |
-
wp_enqueue_script('jquery-effects-core');
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
#accordions-<?php echo esc_attr($post_id); ?> {
|
121 |
-
|
122 |
-
|
123 |
-
<?php endif; ?>
|
124 |
}
|
125 |
}
|
126 |
-
|
|
|
127 |
#accordions-<?php echo esc_attr($post_id); ?> {
|
128 |
-
|
129 |
-
|
130 |
-
<?php endif; ?>
|
131 |
}
|
132 |
}
|
133 |
-
|
|
|
134 |
#accordions-<?php echo esc_attr($post_id); ?> {
|
135 |
-
|
136 |
-
|
137 |
-
<?php endif; ?>
|
138 |
}
|
139 |
}
|
|
|
140 |
<?php
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
}
|
|
|
|
|
|
|
153 |
?>#accordions-<?php echo esc_attr($post_id); ?> {
|
154 |
-
<?php if(!empty($container_text_align))
|
155 |
-
|
156 |
-
<?php endif; ?>
|
157 |
-
<?php
|
158 |
-
background:<?php echo esc_attr($container_background_color); ?> url(<?php echo esc_url_raw($container_background_img); ?>) repeat scroll 0 0;
|
159 |
-
<?php endif; ?>
|
160 |
-
<?php if(!empty($container_padding)):?>
|
161 |
-
padding: <?php echo esc_attr($container_padding); ?>;
|
162 |
-
<?php endif; ?>
|
163 |
-
position: relative;
|
164 |
}
|
165 |
-
|
166 |
-
|
167 |
-
background
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
<?php endif; ?>
|
172 |
-
<?php if(!empty($header_padding)):?>
|
173 |
-
padding:<?php echo esc_attr($header_padding); ?>;
|
174 |
-
<?php endif; ?>
|
175 |
-
outline: none;
|
176 |
}
|
177 |
-
|
178 |
-
|
179 |
-
font-family
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
<?php endif; ?>
|
184 |
-
<?php if(!empty($header_font_size)):?>
|
185 |
-
font-size:<?php echo esc_attr($header_font_size); ?>;
|
186 |
-
<?php endif; ?>
|
187 |
}
|
188 |
-
|
189 |
-
|
190 |
-
color
|
191 |
-
|
192 |
-
|
193 |
-
font-size:<?php echo esc_attr($header_font_size); ?>;
|
194 |
-
<?php endif; ?>
|
195 |
}
|
196 |
-
|
197 |
-
|
198 |
-
color
|
199 |
-
|
200 |
}
|
201 |
-
|
202 |
-
|
203 |
-
background: <?php echo esc_attr($header_active_background_color); ?>;
|
204 |
-
|
205 |
-
border: none;
|
206 |
}
|
207 |
-
|
208 |
-
|
209 |
-
font-family
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
<?php endif; ?>
|
217 |
-
<?php if(!empty($body_font_size)):?>
|
218 |
-
font-size:<?php echo esc_attr($body_font_size); ?>;
|
219 |
-
<?php endif; ?>
|
220 |
-
<?php if(!empty($body_margin)):?>
|
221 |
-
margin:<?php echo esc_attr($body_margin); ?>;
|
222 |
-
<?php endif; ?>
|
223 |
-
<?php if(!empty($body_padding)):?>
|
224 |
-
padding:<?php echo esc_attr($body_padding); ?>;
|
225 |
-
<?php endif; ?>
|
226 |
-
border: none;
|
227 |
}
|
228 |
-
|
229 |
-
|
230 |
-
color
|
231 |
-
<?php endif; ?>
|
232 |
-
<?php if(!empty($
|
233 |
-
|
234 |
-
<?php endif; ?>
|
235 |
-
<?php if(!empty($icon_background_color)):?>
|
236 |
-
background:<?php echo esc_attr($icon_background_color); ?> none repeat scroll 0 0;
|
237 |
-
<?php endif; ?>
|
238 |
-
<?php if(!empty($icon_padding)):?>
|
239 |
-
padding:<?php echo esc_attr($icon_padding); ?>;
|
240 |
-
<?php endif; ?>
|
241 |
-
<?php if(!empty($icon_margin)):?>
|
242 |
-
margin:<?php echo esc_attr($icon_margin); ?>;
|
243 |
<?php endif; ?>
|
244 |
}
|
245 |
-
|
246 |
-
|
247 |
-
color
|
248 |
<?php endif; ?>
|
249 |
}
|
|
|
250 |
<?php
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
|
260 |
-
|
261 |
-
|
262 |
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
<?php
|
267 |
-
}
|
268 |
-
}
|
269 |
}
|
|
|
|
|
|
|
|
|
|
|
270 |
?>
|
271 |
</style>
|
272 |
-
|
273 |
-
}
|
274 |
|
275 |
|
276 |
|
@@ -278,349 +249,355 @@ function accordions_main_style($atts){
|
|
278 |
|
279 |
|
280 |
|
281 |
-
add_action('accordions_main', 'accordions_main_items', 30);
|
282 |
|
283 |
-
function accordions_main_items($atts)
|
|
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
|
289 |
|
290 |
-
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
|
297 |
|
298 |
|
299 |
-
|
300 |
-
|
301 |
|
302 |
-
|
303 |
-
|
304 |
|
305 |
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
|
315 |
-
|
316 |
-
|
317 |
<?php
|
318 |
|
319 |
-
|
320 |
|
321 |
-
|
322 |
|
323 |
-
|
324 |
|
325 |
-
|
326 |
|
327 |
-
|
328 |
|
329 |
|
330 |
-
|
331 |
-
|
332 |
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
|
338 |
-
|
339 |
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
|
344 |
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
|
353 |
-
|
354 |
|
355 |
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
|
369 |
-
|
370 |
<div post_id="<?php echo esc_attr($post_id); ?>" itemcount="<?php echo esc_attr($item_count); ?>" header_id="header-<?php echo esc_attr($index); ?>" id="header-<?php echo esc_attr($index); ?>" style="" class="accordions-head head<?php echo esc_attr($index); ?> <?php echo esc_attr($header_class); ?>" toggle-text="<?php echo do_shortcode(esc_attr($toggled_text)); ?>" main-text="<?php echo do_shortcode(esc_attr($accordion_header)); ?>">
|
371 |
<?php
|
372 |
-
|
373 |
-
|
374 |
<span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
|
375 |
<span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
|
376 |
<span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
|
377 |
</span>
|
378 |
<span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
<span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
|
383 |
<span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
|
384 |
<span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
|
385 |
<span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
|
386 |
</span>
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
<span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
|
391 |
<?php
|
392 |
-
|
393 |
?>
|
394 |
</div>
|
395 |
<div class="accordion-content content<?php echo esc_attr($index); ?> <?php echo esc_attr($body_class); ?>">
|
396 |
<?php echo $accordion_body; ?>
|
397 |
</div>
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
|
403 |
-
|
404 |
-
|
405 |
?>
|
406 |
</div>
|
407 |
<script>
|
408 |
-
jQuery(document).ready(function($){
|
409 |
-
|
|
|
410 |
$accordion_index = isset($_GET['active_index']) ? esc_attr($_GET['active_index']) : '';
|
411 |
|
412 |
//var_dump($accordion_index);
|
413 |
|
414 |
$accordion_index = explode('-', $accordion_index);
|
415 |
-
foreach ($accordion_index as $args){
|
416 |
$args_arr = explode('|', $args);
|
417 |
$accordion_id = isset($args_arr[0]) ? $args_arr[0] : '';
|
418 |
$accordion_indexes = isset($args_arr[1]) ? $args_arr[1] : '';
|
419 |
$active_index = !empty($accordion_indexes) ? explode(',', $accordion_indexes) : array();
|
420 |
$active_index_new = array();
|
421 |
-
foreach ($active_index as $ind){
|
422 |
$active_index_new[] = (int)$ind;
|
423 |
}
|
424 |
-
|
|
|
425 |
}
|
426 |
-
else:
|
427 |
-
|
|
|
428 |
endif;
|
429 |
-
|
430 |
})
|
431 |
</script><?php
|
432 |
|
433 |
|
434 |
-
|
435 |
|
436 |
-
|
437 |
-
|
438 |
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
$accordion_header = isset($accordion['header']) ? wp_strip_all_tags(strip_shortcodes($accordion['header'])) : '';
|
451 |
-
$accordion_header = esc_attr($accordion_header);
|
452 |
|
453 |
-
|
|
|
454 |
|
|
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
-
?>{
|
460 |
-
"@type": "Question",
|
461 |
-
"name": "<?php echo esc_html($accordion_header); ?>",
|
462 |
-
"acceptedAnswer":{
|
463 |
-
"@type": "Answer",
|
464 |
-
"text": "<?php echo esc_html($accordion_body); ?>"
|
465 |
-
}
|
466 |
-
}<?php echo ($accordions_count > $i ) ? ',' :'';
|
467 |
|
468 |
-
|
|
|
|
|
|
|
|
|
|
|
469 |
}
|
|
|
470 |
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
|
|
|
|
|
|
479 |
|
480 |
-
}
|
481 |
|
482 |
|
483 |
-
add_action('accordions_main', 'accordions_main_edit_link', 35);
|
484 |
|
485 |
-
function accordions_main_edit_link($atts)
|
|
|
486 |
|
487 |
-
|
488 |
|
489 |
-
|
490 |
-
|
491 |
|
492 |
|
493 |
-
|
494 |
|
495 |
-
|
496 |
|
497 |
-
|
498 |
|
499 |
-
|
500 |
|
501 |
|
502 |
|
503 |
-
|
504 |
-
|
505 |
|
506 |
-
|
507 |
|
508 |
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
|
517 |
?>
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
-
|
522 |
-
}else{
|
523 |
-
continue;
|
524 |
}
|
525 |
|
526 |
-
endforeach;
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
-
}
|
532 |
|
533 |
|
|
|
534 |
|
|
|
|
|
535 |
|
|
|
536 |
|
|
|
|
|
537 |
|
|
|
|
|
|
|
|
|
|
|
538 |
|
539 |
-
|
|
|
540 |
|
541 |
-
|
|
|
|
|
542 |
|
543 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
|
545 |
-
|
546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
|
|
|
|
|
|
553 |
|
554 |
-
|
555 |
-
|
|
|
|
|
|
|
556 |
|
557 |
-
|
558 |
-
|
559 |
-
$hide_edit = isset($accordions_options['hide_edit']) ? $accordions_options['hide_edit'] : '';
|
560 |
-
|
561 |
-
$icon = isset($accordions_options['icon']) ? $accordions_options['icon'] : array();
|
562 |
-
$icon_active = isset($icon['active']) ? $icon['active'] : '';
|
563 |
-
$icon_inactive = isset($icon['inactive']) ? $icon['inactive'] : '';
|
564 |
-
$icon_color = isset($icon['color']) ? $icon['color'] : '';
|
565 |
-
$icon_color_hover = isset($icon['color_hover']) ? $icon['color_hover'] : '';
|
566 |
-
$icon_font_size = isset($icon['font_size']) ? $icon['font_size'] : '';
|
567 |
-
$icon_background_color = isset($icon['background_color']) ? $icon['background_color'] : '';
|
568 |
-
|
569 |
-
$header = isset($accordions_options['header']) ? $accordions_options['header'] : array();
|
570 |
-
$header_background_color = isset($header['background_color']) ? $header['background_color'] : '';
|
571 |
-
$header_active_background_color = isset($header['active_background_color']) ? $header['active_background_color'] : '';
|
572 |
-
$header_color = isset($header['color']) ? $header['color'] : '';
|
573 |
-
$header_color_hover = isset($header['color_hover']) ? $header['color_hover'] : '';
|
574 |
-
$header_font_size = isset($header['font_size']) ? $header['font_size'] : '';
|
575 |
-
$header_padding = isset($header['padding']) ? $header['padding'] : '';
|
576 |
-
$header_margin = isset($header['margin']) ? $header['margin'] : '';
|
577 |
-
|
578 |
-
$body = isset($accordions_options['body']) ? $accordions_options['body'] : array();
|
579 |
-
$body_background_color = isset($body['background_color']) ? $body['background_color'] : '';
|
580 |
-
$body_active_background_color = isset($body['active_background_color']) ? $body['active_background_color'] : '';
|
581 |
-
$body_color = isset($body['color']) ? $body['color'] : '';
|
582 |
-
$body_color_hover = isset($body['color_hover']) ? $body['color_hover'] : '';
|
583 |
-
$body_font_size = isset($body['font_size']) ? $body['font_size'] : '';
|
584 |
-
$body_padding = isset($body['padding']) ? $body['padding'] : '';
|
585 |
-
$body_margin = isset($body['margin']) ? $body['margin'] : '';
|
586 |
-
|
587 |
-
$container = isset($accordions_options['container']) ? $accordions_options['container'] : array();
|
588 |
-
$container_padding = isset($container['padding']) ? $container['padding'] : '';
|
589 |
-
$container_background_color = isset($container['background_color']) ? $container['background_color'] : '';
|
590 |
-
$container_text_align = isset($container['text_align']) ? $container['text_align'] : '';
|
591 |
-
$container_background_img = isset($container['background_img']) ? $container['background_img'] : '';
|
592 |
-
|
593 |
-
$custom_scripts = isset($accordions_options['custom_scripts']) ? $accordions_options['custom_scripts'] : array();
|
594 |
-
$custom_js = isset($custom_scripts['custom_js']) ? $custom_scripts['custom_js'] : '';
|
595 |
|
596 |
?>
|
597 |
<script>
|
598 |
-
jQuery(document).ready(function($){
|
599 |
-
accordion_<?php echo esc_attr($post_id); ?>
|
600 |
event: "<?php echo esc_attr($active_event); ?>",
|
601 |
-
collapsible
|
602 |
heightStyle: "<?php echo esc_attr($height_style); ?>",
|
603 |
animate: ("<?php echo esc_attr($animate_style); ?>", <?php echo esc_attr($animate_delay); ?>),
|
604 |
navigation: true,
|
605 |
active: 999,
|
606 |
<?php
|
607 |
-
if($expanded_other == 'yes'){
|
608 |
?>
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
|
|
|
|
|
|
|
|
624 |
<?php
|
625 |
}
|
626 |
?>
|
@@ -629,26 +606,26 @@ function accordions_main_scripts($atts){
|
|
629 |
</script>
|
630 |
<?php
|
631 |
|
632 |
-
|
633 |
-
|
634 |
<script>
|
635 |
-
jQuery(document).ready(function($){
|
636 |
<?php echo ($custom_js); ?>
|
637 |
})
|
638 |
</script>
|
639 |
<?php
|
640 |
-
|
641 |
-
}
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
-
add_action('accordions_main_no_content', 'accordions_main_no_content', 50);
|
648 |
-
function accordions_main_no_content()
|
|
|
649 |
|
650 |
?>
|
651 |
-
<p><?php echo __('Content missing',''); ?></p>
|
652 |
-
|
653 |
-
}
|
654 |
-
|
1 |
<?php
|
2 |
+
if (!defined('ABSPATH')) exit; // if direct access
|
3 |
|
4 |
add_action('accordions_main', 'accordions_main_top', 5);
|
5 |
|
6 |
+
function accordions_main_top($atts)
|
7 |
+
{
|
8 |
|
9 |
$post_id = isset($atts['id']) ? $atts['id'] : '';
|
10 |
+
$accordions_options = get_post_meta($post_id, 'accordions_options', true);
|
11 |
$accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
|
12 |
|
13 |
|
14 |
$lazy_load = isset($accordions_options['lazy_load']) ? $accordions_options['lazy_load'] : 'yes';
|
15 |
$lazy_load_src = isset($accordions_options['lazy_load_src']) ? $accordions_options['lazy_load_src'] : '';
|
16 |
|
17 |
+
if ($lazy_load == 'yes') :
|
18 |
+
?><div id="accordions-lazy-<?php echo esc_attr($post_id); ?>" class="accordions-lazy">
|
19 |
+
<?php if (!empty($lazy_load_src)) : ?>
|
20 |
<img src="<?php echo esc_url_raw($lazy_load_src); ?>" />
|
21 |
<?php endif; ?>
|
22 |
</div>
|
23 |
<script>
|
24 |
+
jQuery(window).load(function() {
|
25 |
jQuery('#accordions-lazy-<?php echo esc_attr($post_id); ?>').fadeOut();
|
26 |
jQuery('#accordions-<?php echo esc_attr($post_id); ?> .items').fadeIn();
|
27 |
});
|
28 |
</script><?php
|
29 |
+
endif;
|
30 |
+
}
|
31 |
|
32 |
|
33 |
|
34 |
+
add_action('accordions_main', 'accordions_main_style', 20);
|
35 |
|
36 |
+
function accordions_main_style($atts)
|
37 |
+
{
|
38 |
|
39 |
+
$post_id = isset($atts['id']) ? $atts['id'] : '';
|
40 |
|
41 |
+
$accordions_options = get_post_meta($post_id, 'accordions_options', true);
|
42 |
+
$accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
|
43 |
|
44 |
+
$accordions_content = isset($accordions_options['content']) ? $accordions_options['content'] : array();
|
45 |
|
46 |
+
$lazy_load = isset($accordions_options['lazy_load']) ? $accordions_options['lazy_load'] : 'yes';
|
47 |
+
|
48 |
+
$icon = isset($accordions_options['icon']) ? $accordions_options['icon'] : array();
|
49 |
+
$icon_active = isset($icon['active']) ? $icon['active'] : '';
|
50 |
+
$icon_inactive = isset($icon['inactive']) ? $icon['inactive'] : '';
|
51 |
+
$icon_color = isset($icon['color']) ? $icon['color'] : '';
|
52 |
+
$icon_color_hover = isset($icon['color_hover']) ? $icon['color_hover'] : '';
|
53 |
+
$icon_font_size = isset($icon['font_size']) ? $icon['font_size'] : '';
|
54 |
+
$icon_background_color = isset($icon['background_color']) ? $icon['background_color'] : '';
|
55 |
+
$icon_padding = isset($icon['padding']) ? $icon['padding'] : '0px';
|
56 |
+
$icon_margin = isset($icon['margin']) ? $icon['margin'] : '0px';
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
$header = isset($accordions_options['header']) ? $accordions_options['header'] : array();
|
60 |
+
$header_style_class = isset($header['style_class']) ? $header['style_class'] : '';
|
61 |
|
62 |
+
$header_background_color = !empty($header['background_color']) ? $header['background_color'] : '#1e73be';
|
63 |
+
$header_active_background_color = !empty($header['active_background_color']) ? $header['active_background_color'] : '#174e7f';
|
64 |
+
$header_color = !empty($header['color']) ? $header['color'] : '#ffffff';
|
65 |
+
$header_color_hover = !empty($header['color_hover']) ? $header['color_hover'] : '#ffffff';
|
66 |
+
$header_font_size = !empty($header['font_size']) ? $header['font_size'] : '16px';
|
67 |
+
$header_padding = !empty($header['padding']) ? $header['padding'] : '';
|
68 |
+
$header_margin = !empty($header['margin']) ? $header['margin'] : '';
|
69 |
+
$header_font_family = !empty($header['font_family']) ? $header['font_family'] : '';
|
70 |
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
$body = isset($accordions_options['body']) ? $accordions_options['body'] : array();
|
73 |
+
$body_background_color = isset($body['background_color']) ? $body['background_color'] : '';
|
74 |
+
$body_active_background_color = isset($body['active_background_color']) ? $body['active_background_color'] : '';
|
75 |
+
$body_color = isset($body['color']) ? $body['color'] : '';
|
76 |
+
$body_color_hover = isset($body['color_hover']) ? $body['color_hover'] : '';
|
77 |
+
$body_font_size = isset($body['font_size']) ? $body['font_size'] : '';
|
78 |
+
$body_padding = isset($body['padding']) ? $body['padding'] : '';
|
79 |
+
$body_margin = isset($body['margin']) ? $body['margin'] : '';
|
80 |
+
$body_font_family = isset($body['font_family']) ? $body['font_family'] : '';
|
81 |
|
82 |
+
|
83 |
+
$container = isset($accordions_options['container']) ? $accordions_options['container'] : array();
|
84 |
+
$container_padding = isset($container['padding']) ? $container['padding'] : '';
|
85 |
+
$container_background_color = isset($container['background_color']) ? $container['background_color'] : '';
|
86 |
+
$container_text_align = isset($container['text_align']) ? $container['text_align'] : '';
|
87 |
+
$container_background_img = isset($container['background_img']) ? $container['background_img'] : '';
|
88 |
+
$width_large = isset($container['width_large']) ? $container['width_large'] : '';
|
89 |
+
$width_medium = isset($container['width_medium']) ? $container['width_medium'] : '';
|
90 |
+
$width_small = isset($container['width_small']) ? $container['width_small'] : '';
|
91 |
+
|
92 |
+
$custom_scripts = isset($accordions_options['custom_scripts']) ? $accordions_options['custom_scripts'] : array();
|
93 |
+
$custom_js = isset($custom_scripts['custom_js']) ? $custom_scripts['custom_js'] : '';
|
94 |
+
$custom_css = isset($custom_scripts['custom_css']) ? $custom_scripts['custom_css'] : '';
|
95 |
+
|
96 |
+
$accordions_settings = get_option('accordions_settings');
|
97 |
+
$font_aw_version = isset($accordions_settings['font_aw_version']) ? $accordions_settings['font_aw_version'] : 'v_5';
|
98 |
+
|
99 |
+
//var_dump($custom_css);
|
100 |
+
|
101 |
+
wp_enqueue_style('accordions-style');
|
102 |
+
|
103 |
+
wp_enqueue_style('jquery-ui');
|
104 |
+
wp_enqueue_style('accordions-themes');
|
105 |
+
|
106 |
+
if ($font_aw_version == 'v_5') {
|
107 |
+
wp_enqueue_style('fontawesome-5');
|
108 |
+
} elseif ($font_aw_version == 'v_4') {
|
109 |
+
wp_enqueue_style('fontawesome-4');
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
+
|
114 |
+
wp_enqueue_script('jquery');
|
115 |
+
wp_enqueue_script('jquery-ui-core');
|
116 |
+
wp_enqueue_script('jquery-ui-accordion');
|
117 |
+
wp_enqueue_script('jquery-effects-core');
|
118 |
+
|
119 |
+
|
120 |
+
?><style type='text/css'>
|
121 |
+
@media only screen and (min-width: 1024px) {
|
122 |
#accordions-<?php echo esc_attr($post_id); ?> {
|
123 |
+
<?php if (!empty($width_large)) : ?>width: <?php echo esc_attr($width_large); ?>;
|
124 |
+
<?php endif; ?>
|
|
|
125 |
}
|
126 |
}
|
127 |
+
|
128 |
+
@media only screen and (min-width: 768px) and (max-width: 1023px) {
|
129 |
#accordions-<?php echo esc_attr($post_id); ?> {
|
130 |
+
<?php if (!empty($width_medium)) : ?>width: <?php echo esc_attr($width_medium); ?>;
|
131 |
+
<?php endif; ?>
|
|
|
132 |
}
|
133 |
}
|
134 |
+
|
135 |
+
@media only screen and (min-width: 0px) and (max-width: 767px) {
|
136 |
#accordions-<?php echo esc_attr($post_id); ?> {
|
137 |
+
<?php if (!empty($width_small)) : ?>width: <?php echo esc_attr($width_small); ?>;
|
138 |
+
<?php endif; ?>
|
|
|
139 |
}
|
140 |
}
|
141 |
+
|
142 |
<?php
|
143 |
+
if ($lazy_load == 'yes') {
|
144 |
+
?>#accordions-<?php echo esc_attr($post_id); ?>.items {
|
145 |
+
display: none;
|
146 |
+
}
|
147 |
+
|
148 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordions-lazy {
|
149 |
+
text-align: center;
|
150 |
+
position: absolute;
|
151 |
+
top: 50%;
|
152 |
+
left: 50%;
|
153 |
+
transform: translate(-50%, -50%);
|
154 |
}
|
155 |
+
|
156 |
+
<?php
|
157 |
+
}
|
158 |
?>#accordions-<?php echo esc_attr($post_id); ?> {
|
159 |
+
<?php if (!empty($container_text_align)) : ?>text-align: <?php echo esc_attr($container_text_align); ?>;
|
160 |
+
<?php endif; ?><?php if (!empty($container_background_color) || !empty($container_background_img)) : ?>background: <?php echo esc_attr($container_background_color); ?> url(<?php echo esc_url_raw($container_background_img); ?>) repeat scroll 0 0;
|
161 |
+
<?php endif; ?><?php if (!empty($container_padding)) : ?>padding: <?php echo esc_attr($container_padding); ?>;
|
162 |
+
<?php endif; ?>position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
164 |
+
|
165 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordions-head {
|
166 |
+
<?php if (!empty($header_background_color)) : ?>background: <?php echo esc_attr($header_background_color); ?> none repeat scroll 0 0;
|
167 |
+
<?php endif; ?><?php if (!empty($header_margin)) : ?>margin: <?php echo esc_attr($header_margin); ?>;
|
168 |
+
<?php endif; ?><?php if (!empty($header_padding)) : ?>padding: <?php echo esc_attr($header_padding); ?>;
|
169 |
+
<?php endif; ?>outline: none;
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
+
|
172 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordions-head-title {
|
173 |
+
<?php if (!empty($header_font_family)) : ?>font-family: <?php echo esc_attr($header_font_family); ?>;
|
174 |
+
<?php endif; ?><?php if (!empty($header_color)) : ?>color: <?php echo esc_attr($header_color); ?>;
|
175 |
+
<?php endif; ?><?php if (!empty($header_font_size)) : ?>font-size: <?php echo esc_attr($header_font_size); ?>;
|
176 |
+
<?php endif; ?>
|
|
|
|
|
|
|
|
|
177 |
}
|
178 |
+
|
179 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordions-head-title-toggle {
|
180 |
+
<?php if (!empty($header_color)) : ?>color: <?php echo esc_attr($header_color); ?>;
|
181 |
+
<?php endif; ?><?php if (!empty($header_font_size)) : ?>font-size: <?php echo esc_attr($header_font_size); ?>;
|
182 |
+
<?php endif; ?>
|
|
|
|
|
183 |
}
|
184 |
+
|
185 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordions-head:hover .accordions-head-title {
|
186 |
+
<?php if (!empty($header_color_hover)) : ?>color: <?php echo esc_attr($header_color_hover); ?>;
|
187 |
+
<?php endif; ?>
|
188 |
}
|
189 |
+
|
190 |
+
#accordions-<?php echo esc_attr($post_id); ?>.ui-state-active {
|
191 |
+
<?php if (!empty($header_active_background_color)) : ?>background: <?php echo esc_attr($header_active_background_color); ?>;
|
192 |
+
<?php endif; ?>border: none;
|
|
|
193 |
}
|
194 |
+
|
195 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordion-content {
|
196 |
+
<?php if (!empty($body_font_family)) : ?>font-family: <?php echo esc_attr($body_font_family); ?>;
|
197 |
+
<?php endif; ?><?php if (!empty($body_background_color)) : ?>background: <?php echo esc_attr($body_background_color); ?> none repeat scroll 0 0;
|
198 |
+
<?php endif; ?><?php if (!empty($body_color)) : ?>color: <?php echo esc_attr($body_color); ?>;
|
199 |
+
<?php endif; ?><?php if (!empty($body_font_size)) : ?>font-size: <?php echo esc_attr($body_font_size); ?>;
|
200 |
+
<?php endif; ?><?php if (!empty($body_margin)) : ?>margin: <?php echo esc_attr($body_margin); ?>;
|
201 |
+
<?php endif; ?><?php if (!empty($body_padding)) : ?>padding: <?php echo esc_attr($body_padding); ?>;
|
202 |
+
<?php endif; ?>border: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
+
|
205 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordion-icons {
|
206 |
+
<?php if (!empty($icon_color)) : ?>color: <?php echo esc_attr($icon_color); ?>;
|
207 |
+
<?php endif; ?><?php if (!empty($icon_font_size)) : ?>font-size: <?php echo esc_attr($icon_font_size); ?>;
|
208 |
+
<?php endif; ?><?php if (!empty($icon_background_color)) : ?>background: <?php echo esc_attr($icon_background_color); ?> none repeat scroll 0 0;
|
209 |
+
<?php endif; ?><?php if (!empty($icon_padding)) : ?>padding: <?php echo esc_attr($icon_padding); ?>;
|
210 |
+
<?php endif; ?><?php if (!empty($icon_margin)) : ?>margin: <?php echo esc_attr($icon_margin); ?>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
<?php endif; ?>
|
212 |
}
|
213 |
+
|
214 |
+
#accordions-<?php echo esc_attr($post_id); ?>.accordions-head:hover .accordion-icons span {
|
215 |
+
<?php if (!empty($icon_color_hover)) : ?>color: <?php echo esc_attr($icon_color_hover); ?>;
|
216 |
<?php endif; ?>
|
217 |
}
|
218 |
+
|
219 |
<?php
|
220 |
+
if (!empty($custom_css)) {
|
221 |
+
echo esc_attr($custom_css);
|
222 |
+
}
|
223 |
|
224 |
+
if (!empty($accordions_content)) {
|
225 |
+
foreach ($accordions_content as $index => $accordion) {
|
226 |
+
$background_img = isset($accordion['background_img']) ? $accordion['background_img'] : '';
|
227 |
+
$background_color = isset($accordion['background_color']) ? $accordion['background_color'] : '';
|
228 |
|
229 |
+
$header_bg_img = !empty($background_img) ? 'url(' . esc_url_raw($background_img) . ')' : '';
|
230 |
+
$bg_color_css = !empty($background_color) ? $background_color : '';
|
231 |
|
232 |
+
if (!empty($bg_color_css) || !empty($header_bg_img)) {
|
233 |
+
?>#accordions-<?php echo esc_attr($post_id); ?>#header-<?php echo esc_attr($index); ?> {
|
234 |
+
background: <?php echo esc_attr($bg_color_css); ?> <?php echo $header_bg_img; ?>;
|
|
|
|
|
|
|
235 |
}
|
236 |
+
|
237 |
+
<?php
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
?>
|
242 |
</style>
|
243 |
+
<?php
|
244 |
+
}
|
245 |
|
246 |
|
247 |
|
249 |
|
250 |
|
251 |
|
252 |
+
add_action('accordions_main', 'accordions_main_items', 30);
|
253 |
|
254 |
+
function accordions_main_items($atts)
|
255 |
+
{
|
256 |
|
257 |
+
$post_id = isset($atts['id']) ? $atts['id'] : '';
|
258 |
+
$accordions_options = get_post_meta($post_id, 'accordions_options', true);
|
259 |
+
//var_dump($post_id);
|
260 |
|
261 |
|
262 |
+
$accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
|
263 |
|
264 |
+
$accordions_content = isset($accordions_options['content']) ? $accordions_options['content'] : array();
|
265 |
+
$enable_shortcode = isset($accordions_options['enable_shortcode']) ? $accordions_options['enable_shortcode'] : 'yes';
|
266 |
+
$enable_wpautop = isset($accordions_options['enable_wpautop']) ? $accordions_options['enable_wpautop'] : 'yes';
|
267 |
+
$enable_autoembed = isset($accordions_options['enable_autoembed']) ? $accordions_options['enable_autoembed'] : 'yes';
|
268 |
|
269 |
|
270 |
|
271 |
+
$header = isset($accordions_options['header']) ? $accordions_options['header'] : array();
|
272 |
+
$header_class = isset($header['class']) ? $header['class'] : '';
|
273 |
|
274 |
+
$body = isset($accordions_options['body']) ? $accordions_options['body'] : array();
|
275 |
+
$body_class = isset($body['class']) ? $body['class'] : '';
|
276 |
|
277 |
|
278 |
+
$icon = isset($accordions_options['icon']) ? $accordions_options['icon'] : array();
|
279 |
+
$icon_active = !empty($icon['active']) ? $icon['active'] : '<i class="fas fa-chevron-up"></i>';
|
280 |
+
$icon_inactive = !empty($icon['inactive']) ? $icon['inactive'] : '<i class="fas fa-chevron-right"></i>';
|
281 |
+
$icon_position = !empty($icon['position']) ? $icon['position'] : 'left';
|
282 |
|
283 |
+
$active_plugins = get_option('active_plugins');
|
284 |
+
$accordions_plugin_info = get_option('accordions_plugin_info');
|
285 |
+
$accordions_upgrade = isset($accordions_plugin_info['accordions_upgrade']) ? $accordions_plugin_info['accordions_upgrade'] : '';
|
286 |
|
287 |
+
$active_index = array();
|
288 |
+
?><div class="items">
|
289 |
<?php
|
290 |
|
291 |
+
if (!empty($accordions_content)) :
|
292 |
|
293 |
+
$item_count = 0;
|
294 |
|
295 |
+
foreach ($accordions_content as $index => $accordion) {
|
296 |
|
297 |
+
$accordion_hide = isset($accordion['hide']) ? $accordion['hide'] : '';
|
298 |
|
299 |
+
if ($accordion_hide == 'true') continue;
|
300 |
|
301 |
|
302 |
+
$accordion_header = isset($accordion['header']) ? $accordion['header'] : '';
|
303 |
+
$accordion_body = isset($accordion['body']) ? $accordion['body'] : '';
|
304 |
|
305 |
+
$accordion_is_active = isset($accordion['is_active']) ? $accordion['is_active'] : '';
|
306 |
+
$toggled_text = isset($accordion['toggled_text']) ? $accordion['toggled_text'] : '';
|
307 |
+
$active_icon = !empty($accordion['active_icon']) ? $accordion['active_icon'] : $icon_active;
|
308 |
+
$inactive_icon = !empty($accordion['inactive_icon']) ? $accordion['inactive_icon'] : $icon_inactive;
|
309 |
|
310 |
+
$accordion_header = apply_filters('accordions_item_header', $accordion_header, $post_id);
|
311 |
|
312 |
+
if (($accordion_is_active == 'yes')) {
|
313 |
+
$active_index[$index] = $item_count;
|
314 |
+
}
|
315 |
|
316 |
|
317 |
+
if (!in_array('accordions-pro/accordions-pro.php', (array) $active_plugins)) {
|
318 |
+
if (has_shortcode($accordion_body, 'accordions') || has_shortcode($accordion_body, 'accordions_pickplguins') || has_shortcode($accordion_body, 'accordions_pplugins')) {
|
319 |
+
$accordion_body = str_replace('[accordions', '**<a target="_blank" href="https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=wordpress.org"> <strong>Please buy pro to create nested accordion</strong></a>**', $accordion_body);
|
320 |
+
$accordion_body = str_replace('[accordions_pickplguins', '**<a target="_blank" href="https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=wordpress.org"> <strong>Please buy pro to create nested accordion</strong></a>**', $accordion_body);
|
321 |
+
$accordion_body = str_replace('[accordions_pplugins', '**<a target="_blank" href="https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=wordpress.org"> <strong>Please buy pro to create nested accordion</strong></a>**', $accordion_body);
|
322 |
+
}
|
323 |
+
}
|
324 |
|
325 |
+
$accordion_body = apply_filters('accordions_item_body', $accordion_body, $post_id);
|
326 |
|
327 |
|
328 |
+
if ($enable_autoembed == 'yes') {
|
329 |
+
$WP_Embed = new WP_Embed();
|
330 |
+
$accordion_body = $WP_Embed->autoembed($accordion_body);
|
331 |
+
}
|
332 |
|
333 |
+
if ($enable_wpautop == 'yes') {
|
334 |
+
$accordion_body = wpautop($accordion_body);
|
335 |
+
}
|
336 |
|
337 |
+
if ($enable_shortcode == 'yes') {
|
338 |
+
$accordion_body = do_shortcode($accordion_body);
|
339 |
+
}
|
340 |
|
341 |
+
?>
|
342 |
<div post_id="<?php echo esc_attr($post_id); ?>" itemcount="<?php echo esc_attr($item_count); ?>" header_id="header-<?php echo esc_attr($index); ?>" id="header-<?php echo esc_attr($index); ?>" style="" class="accordions-head head<?php echo esc_attr($index); ?> <?php echo esc_attr($header_class); ?>" toggle-text="<?php echo do_shortcode(esc_attr($toggled_text)); ?>" main-text="<?php echo do_shortcode(esc_attr($accordion_header)); ?>">
|
343 |
<?php
|
344 |
+
if ($icon_position == 'left') :
|
345 |
+
?>
|
346 |
<span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
|
347 |
<span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
|
348 |
<span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
|
349 |
</span>
|
350 |
<span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
|
351 |
+
<?php
|
352 |
+
elseif ($icon_position == 'right') :
|
353 |
+
?>
|
354 |
<span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
|
355 |
<span id="accordion-icons-<?php echo esc_attr($index); ?>" class="accordion-icons">
|
356 |
<span class="accordion-icon-active accordion-plus"><?php echo $active_icon; ?></span>
|
357 |
<span class="accordion-icon-inactive accordion-minus"><?php echo $inactive_icon; ?></span>
|
358 |
</span>
|
359 |
+
<?php
|
360 |
+
else :
|
361 |
+
?>
|
362 |
<span id="header-text-<?php echo esc_attr($index); ?>" class="accordions-head-title"><?php echo do_shortcode($accordion_header); ?></span>
|
363 |
<?php
|
364 |
+
endif;
|
365 |
?>
|
366 |
</div>
|
367 |
<div class="accordion-content content<?php echo esc_attr($index); ?> <?php echo esc_attr($body_class); ?>">
|
368 |
<?php echo $accordion_body; ?>
|
369 |
</div>
|
370 |
+
<?php
|
371 |
+
$item_count++;
|
372 |
+
}
|
373 |
+
else :
|
374 |
|
375 |
+
do_action('accordions_main_no_content', $post_id);
|
376 |
+
endif;
|
377 |
?>
|
378 |
</div>
|
379 |
<script>
|
380 |
+
jQuery(document).ready(function($) {
|
381 |
+
<?php
|
382 |
+
if (isset($_GET['active_index'])) :
|
383 |
$accordion_index = isset($_GET['active_index']) ? esc_attr($_GET['active_index']) : '';
|
384 |
|
385 |
//var_dump($accordion_index);
|
386 |
|
387 |
$accordion_index = explode('-', $accordion_index);
|
388 |
+
foreach ($accordion_index as $args) {
|
389 |
$args_arr = explode('|', $args);
|
390 |
$accordion_id = isset($args_arr[0]) ? $args_arr[0] : '';
|
391 |
$accordion_indexes = isset($args_arr[1]) ? $args_arr[1] : '';
|
392 |
$active_index = !empty($accordion_indexes) ? explode(',', $accordion_indexes) : array();
|
393 |
$active_index_new = array();
|
394 |
+
foreach ($active_index as $ind) {
|
395 |
$active_index_new[] = (int)$ind;
|
396 |
}
|
397 |
+
?>accordions_active_index_<?php echo esc_attr($accordion_id); ?> = <?php echo json_encode($active_index_new); ?>;
|
398 |
+
<?php
|
399 |
}
|
400 |
+
else :
|
401 |
+
?>accordions_active_index_<?php echo esc_attr($post_id); ?> = <?php echo json_encode($active_index); ?>;
|
402 |
+
<?php
|
403 |
endif;
|
404 |
+
?>
|
405 |
})
|
406 |
</script><?php
|
407 |
|
408 |
|
409 |
+
$enable_schema = isset($accordions_options['enable_schema']) ? $accordions_options['enable_schema'] : 'yes';
|
410 |
|
411 |
+
if ($enable_schema == 'no') return;
|
412 |
+
$accordions_count = count($accordions_content);
|
413 |
|
414 |
+
ob_start();
|
415 |
+
$i = 1;
|
416 |
+
foreach ($accordions_content as $index => $accordion) {
|
417 |
+
$accordion_hide = isset($accordion['hide']) ? $accordion['hide'] : '';
|
418 |
+
$accordion_hide_schema = isset($accordion['hide_schema']) ? $accordion['hide_schema'] : '';
|
419 |
|
420 |
+
if ($accordion_hide_schema == 'true') {
|
421 |
+
$i++;
|
422 |
+
continue;
|
423 |
+
}
|
|
|
|
|
|
|
424 |
|
425 |
+
$accordion_header = isset($accordion['header']) ? wp_strip_all_tags(strip_shortcodes($accordion['header'])) : '';
|
426 |
+
$accordion_header = esc_attr($accordion_header);
|
427 |
|
428 |
+
$accordion_body = isset($accordion['body']) ? wp_strip_all_tags(strip_shortcodes($accordion['body'])) : '';
|
429 |
|
430 |
|
431 |
|
432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
|
434 |
+
?>{
|
435 |
+
"@type": "Question",
|
436 |
+
"name": "<?php echo esc_html($accordion_header); ?>",
|
437 |
+
"acceptedAnswer":{
|
438 |
+
"@type": "Answer",
|
439 |
+
"text": "<?php echo esc_html($accordion_body); ?>"
|
440 |
}
|
441 |
+
}<?php echo ($accordions_count > $i) ? ',' : '';
|
442 |
|
443 |
+
$i++;
|
444 |
+
}
|
445 |
+
|
446 |
+
$html = ob_get_clean();
|
447 |
+
?><script type="application/ld+json">
|
448 |
+
{
|
449 |
+
"@context": "https://schema.org",
|
450 |
+
"@type": "FAQPage",
|
451 |
+
"mainEntity": [<?php echo $html; ?>]
|
452 |
+
}
|
453 |
+
</script><?php
|
454 |
|
455 |
+
}
|
456 |
|
457 |
|
458 |
+
add_action('accordions_main', 'accordions_main_edit_link', 35);
|
459 |
|
460 |
+
function accordions_main_edit_link($atts)
|
461 |
+
{
|
462 |
|
463 |
+
$post_id = isset($atts['id']) ? $atts['id'] : '';
|
464 |
|
465 |
+
$accordions_options = get_post_meta($post_id, 'accordions_options', true);
|
466 |
+
$accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
|
467 |
|
468 |
|
469 |
+
$hide_edit = isset($accordions_options['hide_edit']) ? $accordions_options['hide_edit'] : 'yes';
|
470 |
|
471 |
+
if ($hide_edit == 'yes') return;
|
472 |
|
473 |
+
//var_dump($hide_edit);
|
474 |
|
475 |
+
$edit_link_access_role = isset($accordions_options['edit_link_access_role']) ? $accordions_options['edit_link_access_role'] : array('administrator');
|
476 |
|
477 |
|
478 |
|
479 |
+
$user = wp_get_current_user();
|
480 |
+
$user_roles = !empty($user->roles) ? $user->roles : array();
|
481 |
|
482 |
+
//echo '<pre>'.var_export($user_roles, true).'</pre>';
|
483 |
|
484 |
|
485 |
+
if (!empty($edit_link_access_role))
|
486 |
+
foreach ($edit_link_access_role as $role) :
|
487 |
+
//echo '<pre>'.var_export($role, true).'</pre>';
|
488 |
|
489 |
+
if (in_array($role, $user_roles)) {
|
490 |
+
$admin_url = admin_url();
|
491 |
+
$accordion_edit_url = apply_filters('accordions_edit_url', '' . $admin_url . 'post.php?post=' . $post_id . '&action=edit', $post_id);
|
492 |
|
493 |
?>
|
494 |
+
<div class="accordion-edit"><a href="<?php echo esc_url_raw($accordion_edit_url); ?>"><?php echo __('Edit this accordion', 'accordions'); ?></a>, <?php echo __("Only admin can see this.", 'accordions') ?></div>
|
495 |
+
<?php
|
496 |
+
|
497 |
+
return;
|
498 |
+
} else {
|
499 |
+
continue;
|
500 |
+
}
|
501 |
|
502 |
+
endforeach;
|
|
|
|
|
503 |
}
|
504 |
|
|
|
505 |
|
506 |
|
507 |
|
508 |
|
|
|
509 |
|
510 |
|
511 |
+
add_action('accordions_main', 'accordions_main_scripts', 40);
|
512 |
|
513 |
+
function accordions_main_scripts($atts)
|
514 |
+
{
|
515 |
|
516 |
+
$post_id = isset($atts['id']) ? $atts['id'] : '';
|
517 |
|
518 |
+
$accordions_options = get_post_meta($post_id, 'accordions_options', true);
|
519 |
+
$accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
|
520 |
|
521 |
+
$accordion = isset($accordions_options['accordion']) ? $accordions_options['accordion'] : array();
|
522 |
+
$collapsible = !empty($accordion['collapsible']) ? $accordion['collapsible'] : 'true';
|
523 |
+
$height_style = isset($accordion['height_style']) ? $accordion['height_style'] : 'content';
|
524 |
+
$active_event = !empty($accordion['active_event']) ? $accordion['active_event'] : 'click';
|
525 |
+
$expanded_other = !empty($accordion['expanded_other']) ? $accordion['expanded_other'] : 'no';
|
526 |
|
527 |
+
$animate_style = !empty($accordion['animate_style']) ? $accordion['animate_style'] : 'swing';
|
528 |
+
$animate_delay = !empty($accordion['animate_delay']) ? $accordion['animate_delay'] : 1000;
|
529 |
|
530 |
+
$lazy_load = isset($accordions_options['lazy_load']) ? $accordions_options['lazy_load'] : 'yes';
|
531 |
+
$lazy_load_src = isset($accordions_options['lazy_load_src']) ? $accordions_options['lazy_load_src'] : '';
|
532 |
+
$hide_edit = isset($accordions_options['hide_edit']) ? $accordions_options['hide_edit'] : '';
|
533 |
|
534 |
+
$icon = isset($accordions_options['icon']) ? $accordions_options['icon'] : array();
|
535 |
+
$icon_active = isset($icon['active']) ? $icon['active'] : '';
|
536 |
+
$icon_inactive = isset($icon['inactive']) ? $icon['inactive'] : '';
|
537 |
+
$icon_color = isset($icon['color']) ? $icon['color'] : '';
|
538 |
+
$icon_color_hover = isset($icon['color_hover']) ? $icon['color_hover'] : '';
|
539 |
+
$icon_font_size = isset($icon['font_size']) ? $icon['font_size'] : '';
|
540 |
+
$icon_background_color = isset($icon['background_color']) ? $icon['background_color'] : '';
|
541 |
|
542 |
+
$header = isset($accordions_options['header']) ? $accordions_options['header'] : array();
|
543 |
+
$header_background_color = isset($header['background_color']) ? $header['background_color'] : '';
|
544 |
+
$header_active_background_color = isset($header['active_background_color']) ? $header['active_background_color'] : '';
|
545 |
+
$header_color = isset($header['color']) ? $header['color'] : '';
|
546 |
+
$header_color_hover = isset($header['color_hover']) ? $header['color_hover'] : '';
|
547 |
+
$header_font_size = isset($header['font_size']) ? $header['font_size'] : '';
|
548 |
+
$header_padding = isset($header['padding']) ? $header['padding'] : '';
|
549 |
+
$header_margin = isset($header['margin']) ? $header['margin'] : '';
|
550 |
|
551 |
+
$body = isset($accordions_options['body']) ? $accordions_options['body'] : array();
|
552 |
+
$body_background_color = isset($body['background_color']) ? $body['background_color'] : '';
|
553 |
+
$body_active_background_color = isset($body['active_background_color']) ? $body['active_background_color'] : '';
|
554 |
+
$body_color = isset($body['color']) ? $body['color'] : '';
|
555 |
+
$body_color_hover = isset($body['color_hover']) ? $body['color_hover'] : '';
|
556 |
+
$body_font_size = isset($body['font_size']) ? $body['font_size'] : '';
|
557 |
+
$body_padding = isset($body['padding']) ? $body['padding'] : '';
|
558 |
+
$body_margin = isset($body['margin']) ? $body['margin'] : '';
|
559 |
|
560 |
+
$container = isset($accordions_options['container']) ? $accordions_options['container'] : array();
|
561 |
+
$container_padding = isset($container['padding']) ? $container['padding'] : '';
|
562 |
+
$container_background_color = isset($container['background_color']) ? $container['background_color'] : '';
|
563 |
+
$container_text_align = isset($container['text_align']) ? $container['text_align'] : '';
|
564 |
+
$container_background_img = isset($container['background_img']) ? $container['background_img'] : '';
|
565 |
|
566 |
+
$custom_scripts = isset($accordions_options['custom_scripts']) ? $accordions_options['custom_scripts'] : array();
|
567 |
+
$custom_js = isset($custom_scripts['custom_js']) ? $custom_scripts['custom_js'] : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
|
569 |
?>
|
570 |
<script>
|
571 |
+
jQuery(document).ready(function($) {
|
572 |
+
accordion_<?php echo esc_attr($post_id); ?> = $("#accordions-<?php echo esc_attr($post_id); ?> .items").accordion({
|
573 |
event: "<?php echo esc_attr($active_event); ?>",
|
574 |
+
collapsible: <?php echo esc_attr($collapsible); ?>,
|
575 |
heightStyle: "<?php echo esc_attr($height_style); ?>",
|
576 |
animate: ("<?php echo esc_attr($animate_style); ?>", <?php echo esc_attr($animate_delay); ?>),
|
577 |
navigation: true,
|
578 |
active: 999,
|
579 |
<?php
|
580 |
+
if ($expanded_other == 'yes') {
|
581 |
?>
|
582 |
+
beforeActivate: function(event, ui) {
|
583 |
+
if (ui.newHeader[0]) {
|
584 |
+
var currHeader = ui.newHeader;
|
585 |
+
var currContent = currHeader.next(".ui-accordion-content");
|
586 |
+
} else {
|
587 |
+
var currHeader = ui.oldHeader;
|
588 |
+
var currContent = currHeader.next(".ui-accordion-content");
|
589 |
+
}
|
590 |
+
var isPanelSelected = currHeader.attr("aria-selected") == "true";
|
591 |
+
currHeader.toggleClass("ui-corner-all", isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top", !isPanelSelected).attr("aria-selected", ((!isPanelSelected).toString()));
|
592 |
+
currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e", isPanelSelected).toggleClass("ui-icon-triangle-1-s", !isPanelSelected);
|
593 |
+
currContent.toggleClass("accordion-content-active", !isPanelSelected)
|
594 |
+
if (isPanelSelected) {
|
595 |
+
currContent.slideUp();
|
596 |
+
} else {
|
597 |
+
currContent.slideDown();
|
598 |
+
}
|
599 |
+
return false;
|
600 |
+
},
|
601 |
<?php
|
602 |
}
|
603 |
?>
|
606 |
</script>
|
607 |
<?php
|
608 |
|
609 |
+
if (!empty($custom_js)) :
|
610 |
+
?>
|
611 |
<script>
|
612 |
+
jQuery(document).ready(function($) {
|
613 |
<?php echo ($custom_js); ?>
|
614 |
})
|
615 |
</script>
|
616 |
<?php
|
617 |
+
endif;
|
618 |
+
}
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
+
add_action('accordions_main_no_content', 'accordions_main_no_content', 50);
|
625 |
+
function accordions_main_no_content()
|
626 |
+
{
|
627 |
|
628 |
?>
|
629 |
+
<p><?php echo __('Content missing', ''); ?></p>
|
630 |
+
<?php
|
631 |
+
}
|
|