@@ -1,159 +1,159 @@ |
||
1 | 1 | <div class="uix-field-wrapper"> |
2 | 2 | <ul class="ui-tab-nav"> |
3 | - <?php if ( class_exists('LSX_Banners') ) { ?> |
|
4 | - <li><a href="#ui-placeholders" class="active"><?php esc_html_e('Placeholders', 'lsx-sharing'); ?></a></li> |
|
3 | + <?php if(class_exists('LSX_Banners')){ ?> |
|
4 | + <li><a href="#ui-placeholders" class="active"><?php esc_html_e('Placeholders','lsx-sharing');?></a></li> |
|
5 | 5 | <?php } ?> |
6 | 6 | |
7 | - <?php if ( class_exists('LSX_Currencies') ) { ?> |
|
8 | - <?php $class_active = class_exists('LSX_Banners') ? '' : 'active'; ?> |
|
9 | - <li><a href="#ui-currencies" class="<?php echo esc_attr($class_active); ?>"> |
|
10 | - <?php esc_html_e('Currencies', 'lsx-sharing'); ?></a></li> |
|
7 | + <?php if(class_exists('LSX_Currencies')){ ?> |
|
8 | + <?php $class_active=class_exists('LSX_Banners')?'':'active';?> |
|
9 | + <li><a href="#ui-currencies" class="<?php echo esc_attr($class_active);?>"> |
|
10 | + <?php esc_html_e('Currencies','lsx-sharing');?></a></li> |
|
11 | 11 | <?php } ?> |
12 | 12 | |
13 | - <?php if ( class_exists('LSX_Team') ) { ?> |
|
14 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') ) ? '' : 'active'; ?> |
|
15 | - <li><a href="#ui-team" class="<?php echo esc_attr($class_active); ?>"> |
|
16 | - <?php esc_html_e('Team', 'lsx-sharing'); ?></a></li> |
|
13 | + <?php if(class_exists('LSX_Team')){ ?> |
|
14 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies'))?'':'active';?> |
|
15 | + <li><a href="#ui-team" class="<?php echo esc_attr($class_active);?>"> |
|
16 | + <?php esc_html_e('Team','lsx-sharing');?></a></li> |
|
17 | 17 | <?php } ?> |
18 | 18 | |
19 | - <?php if ( class_exists('LSX_Testimonials') ) { ?> |
|
20 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') ) ? '' : 'active'; ?> |
|
21 | - <li><a href="#ui-testimonials" class="<?php echo esc_attr($class_active); ?>"> |
|
22 | - <?php esc_html_e('Testimonials', 'lsx-sharing'); ?></a></li> |
|
19 | + <?php if(class_exists('LSX_Testimonials')){ ?> |
|
20 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team'))?'':'active';?> |
|
21 | + <li><a href="#ui-testimonials" class="<?php echo esc_attr($class_active);?>"> |
|
22 | + <?php esc_html_e('Testimonials','lsx-sharing');?></a></li> |
|
23 | 23 | <?php } ?> |
24 | 24 | |
25 | - <?php if ( class_exists('LSX_Projects') ) { ?> |
|
26 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') ) ? '' : 'active'; ?> |
|
27 | - <li><a href="#ui-projects" class="<?php echo esc_attr($class_active); ?>"> |
|
28 | - <?php esc_html_e('Projects', 'lsx-sharing'); ?> |
|
25 | + <?php if(class_exists('LSX_Projects')){ ?> |
|
26 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials'))?'':'active';?> |
|
27 | + <li><a href="#ui-projects" class="<?php echo esc_attr($class_active);?>"> |
|
28 | + <?php esc_html_e('Projects','lsx-sharing');?> |
|
29 | 29 | </a></li> |
30 | 30 | <?php } ?> |
31 | 31 | |
32 | - <?php if ( class_exists('LSX_Services') ) { ?> |
|
33 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') ) ? '' : 'active'; ?> |
|
34 | - <li><a href="#ui-services" class="<?php echo esc_attr($class); ?>"> |
|
35 | - <?php esc_html_e('Services', 'lsx-sharing'); ?></a></li> |
|
32 | + <?php if(class_exists('LSX_Services')){ ?> |
|
33 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects'))?'':'active';?> |
|
34 | + <li><a href="#ui-services" class="<?php echo esc_attr($class);?>"> |
|
35 | + <?php esc_html_e('Services','lsx-sharing');?></a></li> |
|
36 | 36 | <?php |
37 | - $class = ''; |
|
37 | + $class=''; |
|
38 | 38 | } |
39 | 39 | ?> |
40 | 40 | |
41 | - <?php if ( class_exists('LSX_Blog_Customizer') ) { ?> |
|
42 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') ) ? '' : 'active'; ?> |
|
43 | - <li><a href="#ui-blog-customizer" class="<?php echo esc_attr($class_active); ?>"> |
|
44 | - <?php esc_html_e('Blog Customizer (posts widget)', 'lsx-sharing'); ?></a></li> |
|
41 | + <?php if(class_exists('LSX_Blog_Customizer')){ ?> |
|
42 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects')||class_exists('LSX_Services'))?'':'active';?> |
|
43 | + <li><a href="#ui-blog-customizer" class="<?php echo esc_attr($class_active);?>"> |
|
44 | + <?php esc_html_e('Blog Customizer (posts widget)','lsx-sharing');?></a></li> |
|
45 | 45 | <?php } ?> |
46 | 46 | |
47 | - <?php if ( class_exists('LSX_Sharing') ) { ?> |
|
48 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') ) ? '' : 'active'; ?> |
|
49 | - <li><a href="#ui-sharing" class="<?php echo esc_attr($class_active); ?>"> |
|
50 | - <?php esc_html_e('Sharing', 'lsx-sharing'); ?></a></li> |
|
47 | + <?php if(class_exists('LSX_Sharing')){ ?> |
|
48 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects')||class_exists('LSX_Services')||class_exists('LSX_Blog_Customizer'))?'':'active';?> |
|
49 | + <li><a href="#ui-sharing" class="<?php echo esc_attr($class_active);?>"> |
|
50 | + <?php esc_html_e('Sharing','lsx-sharing');?></a></li> |
|
51 | 51 | <?php } ?> |
52 | 52 | |
53 | - <?php if ( class_exists('LSX_Videos') ) { ?> |
|
54 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing') ) ? '' : 'active'; ?> |
|
55 | - <li><a href="#ui-videos" class="<?php echo esc_attr($class_active); ?>"> |
|
56 | - <?php esc_html_e('Videos', 'lsx-sharing'); ?></a></li> |
|
53 | + <?php if(class_exists('LSX_Videos')){ ?> |
|
54 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects')||class_exists('LSX_Services')||class_exists('LSX_Blog_Customizer')||class_exists('LSX_Sharing'))?'':'active';?> |
|
55 | + <li><a href="#ui-videos" class="<?php echo esc_attr($class_active);?>"> |
|
56 | + <?php esc_html_e('Videos','lsx-sharing');?></a></li> |
|
57 | 57 | <?php } ?> |
58 | 58 | </ul> |
59 | 59 | |
60 | - <?php if ( class_exists('LSX_Banners') ) { ?> |
|
60 | + <?php if(class_exists('LSX_Banners')){ ?> |
|
61 | 61 | <div id="ui-placeholders" class="ui-tab active"> |
62 | 62 | <table class="form-table"> |
63 | 63 | <tbody> |
64 | - <?php do_action('lsx_framework_display_tab_content', 'placeholders'); ?> |
|
64 | + <?php do_action('lsx_framework_display_tab_content','placeholders');?> |
|
65 | 65 | </tbody> |
66 | 66 | </table> |
67 | 67 | </div> |
68 | 68 | <?php } ?> |
69 | 69 | |
70 | - <?php if ( class_exists('LSX_Currencies') ) { ?> |
|
71 | - <?php $class_active = class_exists('LSX_Banners') ? '' : 'active'; ?> |
|
72 | - <div id="ui-currencies" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
70 | + <?php if(class_exists('LSX_Currencies')){ ?> |
|
71 | + <?php $class_active=class_exists('LSX_Banners')?'':'active';?> |
|
72 | + <div id="ui-currencies" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
73 | 73 | <table class="form-table"> |
74 | 74 | <tbody> |
75 | - <?php do_action('lsx_framework_display_tab_content', 'currency_switcher'); ?> |
|
75 | + <?php do_action('lsx_framework_display_tab_content','currency_switcher');?> |
|
76 | 76 | </tbody> |
77 | 77 | </table> |
78 | 78 | </div> |
79 | 79 | <?php } ?> |
80 | 80 | |
81 | - <?php if ( class_exists('LSX_Team') ) { ?> |
|
82 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') ) ? '' : 'active'; ?> |
|
83 | - <div id="ui-team" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
81 | + <?php if(class_exists('LSX_Team')){ ?> |
|
82 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies'))?'':'active';?> |
|
83 | + <div id="ui-team" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
84 | 84 | <table class="form-table"> |
85 | 85 | <tbody> |
86 | - <?php do_action('lsx_framework_display_tab_content', 'team'); ?> |
|
86 | + <?php do_action('lsx_framework_display_tab_content','team');?> |
|
87 | 87 | </tbody> |
88 | 88 | </table> |
89 | 89 | </div> |
90 | 90 | <?php } ?> |
91 | 91 | |
92 | - <?php if ( class_exists('LSX_Testimonials') ) { ?> |
|
93 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') ) ? '' : 'active'; ?> |
|
94 | - <div id="ui-testimonials" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
92 | + <?php if(class_exists('LSX_Testimonials')){ ?> |
|
93 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team'))?'':'active';?> |
|
94 | + <div id="ui-testimonials" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
95 | 95 | <table class="form-table"> |
96 | 96 | <tbody> |
97 | - <?php do_action('lsx_framework_display_tab_content', 'testimonials'); ?> |
|
97 | + <?php do_action('lsx_framework_display_tab_content','testimonials');?> |
|
98 | 98 | </tbody> |
99 | 99 | </table> |
100 | 100 | </div> |
101 | 101 | <?php } ?> |
102 | 102 | |
103 | - <?php if ( class_exists('LSX_Projects') ) { ?> |
|
104 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') ) ? '' : 'active'; ?> |
|
105 | - <div id="ui-projects" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
103 | + <?php if(class_exists('LSX_Projects')){ ?> |
|
104 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials'))?'':'active';?> |
|
105 | + <div id="ui-projects" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
106 | 106 | <table class="form-table"> |
107 | 107 | <tbody> |
108 | - <?php do_action('lsx_framework_display_tab_content', 'projects'); ?> |
|
108 | + <?php do_action('lsx_framework_display_tab_content','projects');?> |
|
109 | 109 | </tbody> |
110 | 110 | </table> |
111 | 111 | </div> |
112 | 112 | <?php } ?> |
113 | 113 | |
114 | - <?php if ( class_exists('LSX_Services') ) { ?> |
|
115 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') ) ? '' : 'active'; ?> |
|
116 | - <div id="ui-services" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
114 | + <?php if(class_exists('LSX_Services')){ ?> |
|
115 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects'))?'':'active';?> |
|
116 | + <div id="ui-services" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
117 | 117 | <table class="form-table"> |
118 | 118 | <tbody> |
119 | - <?php do_action('lsx_framework_display_tab_content', 'services'); ?> |
|
119 | + <?php do_action('lsx_framework_display_tab_content','services');?> |
|
120 | 120 | </tbody> |
121 | 121 | </table> |
122 | 122 | </div> |
123 | 123 | <?php } ?> |
124 | 124 | |
125 | - <?php if ( class_exists('LSX_Blog_Customizer') ) { ?> |
|
126 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') ) ? '' : 'active'; ?> |
|
127 | - <div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
125 | + <?php if(class_exists('LSX_Blog_Customizer')){ ?> |
|
126 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects')||class_exists('LSX_Services'))?'':'active';?> |
|
127 | + <div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
128 | 128 | <table class="form-table"> |
129 | 129 | <tbody> |
130 | - <?php do_action('lsx_framework_display_tab_content', 'blog-customizer'); ?> |
|
130 | + <?php do_action('lsx_framework_display_tab_content','blog-customizer');?> |
|
131 | 131 | </tbody> |
132 | 132 | </table> |
133 | 133 | </div> |
134 | 134 | <?php } ?> |
135 | 135 | |
136 | - <?php if ( class_exists('LSX_Sharing') ) { ?> |
|
137 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') ) ? '' : 'active'; ?> |
|
138 | - <div id="ui-sharing" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
136 | + <?php if(class_exists('LSX_Sharing')){ ?> |
|
137 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects')||class_exists('LSX_Services')||class_exists('LSX_Blog_Customizer'))?'':'active';?> |
|
138 | + <div id="ui-sharing" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
139 | 139 | <table class="form-table"> |
140 | 140 | <tbody> |
141 | - <?php do_action('lsx_framework_display_tab_content', 'sharing'); ?> |
|
141 | + <?php do_action('lsx_framework_display_tab_content','sharing');?> |
|
142 | 142 | </tbody> |
143 | 143 | </table> |
144 | 144 | </div> |
145 | 145 | <?php } ?> |
146 | 146 | |
147 | - <?php if ( class_exists('LSX_Videos') ) { ?> |
|
148 | - <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing') ) ? '' : 'active'; ?> |
|
149 | - <div id="ui-videos" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
147 | + <?php if(class_exists('LSX_Videos')){ ?> |
|
148 | + <?php $class_active=(class_exists('LSX_Banners')||class_exists('LSX_Currencies')||class_exists('LSX_Team')||class_exists('LSX_Testimonials')||class_exists('LSX_Projects')||class_exists('LSX_Services')||class_exists('LSX_Blog_Customizer')||class_exists('LSX_Sharing'))?'':'active';?> |
|
149 | + <div id="ui-videos" class="ui-tab <?php echo esc_attr($class_active);?>"> |
|
150 | 150 | <table class="form-table"> |
151 | 151 | <tbody> |
152 | - <?php do_action('lsx_framework_display_tab_content', 'videos'); ?> |
|
152 | + <?php do_action('lsx_framework_display_tab_content','videos');?> |
|
153 | 153 | </tbody> |
154 | 154 | </table> |
155 | 155 | </div> |
156 | 156 | <?php } ?> |
157 | 157 | |
158 | - <?php do_action('lsx_framework_display_tab_bottom', 'display'); ?> |
|
158 | + <?php do_action('lsx_framework_display_tab_bottom','display');?> |
|
159 | 159 | </div> |
@@ -34,9 +34,9 @@ |
||
34 | 34 | <li><a href="#ui-services" class="<?php echo esc_attr($class); ?>"> |
35 | 35 | <?php esc_html_e('Services', 'lsx-sharing'); ?></a></li> |
36 | 36 | <?php |
37 | - $class = ''; |
|
38 | - } |
|
39 | - ?> |
|
37 | + $class = ''; |
|
38 | + } |
|
39 | + ?> |
|
40 | 40 | |
41 | 41 | <?php if ( class_exists('LSX_Blog_Customizer') ) { ?> |
42 | 42 | <?php $class_active = ( class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') ) ? '' : 'active'; ?> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * |
9 | 9 | * @package lsx-sharing |
10 | 10 | */ |
11 | -class Settings_Theme { |
|
11 | +class Settings_Theme{ |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Holds class instance |
@@ -17,34 +17,34 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @var object \lsx\sharing\classes\admin\Settings_Theme() |
19 | 19 | */ |
20 | - protected static $instance = null; |
|
20 | + protected static $instance=null; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Will return true if this is the LSX Sharing settings page. |
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - public $is_options_page = false; |
|
27 | + public $is_options_page=false; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Holds the id and labels for the navigation. |
31 | 31 | * |
32 | 32 | * @var array |
33 | 33 | */ |
34 | - public $navigation = array(); |
|
34 | + public $navigation=array(); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Contructor |
38 | 38 | */ |
39 | - public function __construct() { |
|
40 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
41 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
42 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
43 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
44 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
45 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
46 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
47 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
39 | + public function __construct(){ |
|
40 | + add_filter('cmb2_enqueue_css',array($this,'disable_cmb2_styles'),1,1); |
|
41 | + add_action('cmb2_before_form',array($this,'generate_navigation'),10,4); |
|
42 | + add_action('cmb2_before_title_field_row',array($this,'output_tab_open_div'),10,1); |
|
43 | + add_action('cmb2_after_tab_closing_field_row',array($this,'output_tab_closing_div'),10,1); |
|
44 | + add_action('cmb2_render_tab_closing',array($this,'cmb2_render_callback_for_tab_closing'),10,5); |
|
45 | + add_filter('cmb2_sanitize_tab_closing',array($this,'cmb2_sanitize_tab_closing_callback'),10,2); |
|
46 | + add_action('cmb2_after_form',array($this,'navigation_js'),10,4); |
|
47 | + add_filter('cmb2_options_page_redirect_url',array($this,'add_tab_argument'),10,1); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return object \lsx\sharing\classes\admin\Settings_Theme() A single instance of this class. |
56 | 56 | */ |
57 | - public static function get_instance() { |
|
57 | + public static function get_instance(){ |
|
58 | 58 | // If the single instance hasn't been set, set it now. |
59 | - if ( null == self::$instance ) { |
|
60 | - self::$instance = new self(); |
|
59 | + if(null==self::$instance){ |
|
60 | + self::$instance=new self(); |
|
61 | 61 | } |
62 | 62 | return self::$instance; |
63 | 63 | } |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return bool $enabled Whether to enable (enqueue) styles. |
69 | 69 | */ |
70 | - public function disable_cmb2_styles( $enabled ) { |
|
71 | - if ( is_admin() ) { |
|
72 | - $current_screen = get_current_screen(); |
|
73 | - if ( is_object( $current_screen ) && 'settings_page_lsx-sharing-settings' === $current_screen->id ) { |
|
74 | - $enabled = false; |
|
70 | + public function disable_cmb2_styles($enabled){ |
|
71 | + if(is_admin()){ |
|
72 | + $current_screen=get_current_screen(); |
|
73 | + if(is_object($current_screen)&&'settings_page_lsx-sharing-settings'===$current_screen->id){ |
|
74 | + $enabled=false; |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | return $enabled; |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * @param object $cmb2_obj |
87 | 87 | * @return void |
88 | 88 | */ |
89 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
90 | - if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
91 | - $this->navigation = array(); |
|
92 | - $this->is_options_page = true; |
|
93 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
94 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
95 | - if ( 'title' === $field['type'] ) { |
|
96 | - $this->navigation[ $field_index ] = $field['name']; |
|
89 | + public function generate_navigation($cmb_id,$object_id,$object_type,$cmb2_obj){ |
|
90 | + if('lsx_sharing_settings'===$cmb_id&&'lsx-sharing-settings'===$object_id&&'options-page'===$object_type){ |
|
91 | + $this->navigation=array(); |
|
92 | + $this->is_options_page=true; |
|
93 | + if(isset($cmb2_obj->meta_box['fields'])&&!empty($cmb2_obj->meta_box['fields'])){ |
|
94 | + foreach($cmb2_obj->meta_box['fields'] as $field_index => $field){ |
|
95 | + if('title'===$field['type']){ |
|
96 | + $this->navigation[$field_index]=$field['name']; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -106,33 +106,33 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return void |
108 | 108 | */ |
109 | - public function output_navigation() { |
|
110 | - if ( ! empty( $this->navigation ) ) { |
|
109 | + public function output_navigation(){ |
|
110 | + if(!empty($this->navigation)){ |
|
111 | 111 | ?> |
112 | 112 | <div class="wp-filter hide-if-no-js"> |
113 | 113 | <ul class="filter-links"> |
114 | 114 | <?php |
115 | - $first_tab = true; |
|
116 | - $total = count( $this->navigation ); |
|
117 | - $count = 0; |
|
118 | - $separator = ' |'; |
|
119 | - $selected_tab = ''; |
|
120 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
121 | - $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
122 | - $selected_tab = 'settings_' . $selected_tab; |
|
115 | + $first_tab=true; |
|
116 | + $total=count($this->navigation); |
|
117 | + $count=0; |
|
118 | + $separator=' |'; |
|
119 | + $selected_tab=''; |
|
120 | + if(isset($_GET['cmb_tab'])&&''!==$_GET['cmb_tab']){ |
|
121 | + $selected_tab=sanitize_text_field($_GET['cmb_tab']); |
|
122 | + $selected_tab='settings_'.$selected_tab; |
|
123 | 123 | } |
124 | - foreach ( $this->navigation as $key => $label ) { |
|
124 | + foreach($this->navigation as $key => $label){ |
|
125 | 125 | $count++; |
126 | - $current_css = ''; |
|
127 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
128 | - $first_tab = false; |
|
129 | - $current_css = 'current'; |
|
126 | + $current_css=''; |
|
127 | + if((true===$first_tab&&''===$selected_tab)||$key===$selected_tab){ |
|
128 | + $first_tab=false; |
|
129 | + $current_css='current'; |
|
130 | 130 | } |
131 | - if ( $count === $total ) { |
|
132 | - $separator = ''; |
|
131 | + if($count===$total){ |
|
132 | + $separator=''; |
|
133 | 133 | } |
134 | 134 | ?> |
135 | - <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
|
135 | + <li><a href="#" class="<?php echo esc_attr($current_css);?>" data-sort="<?php echo esc_attr($key);?>_tab"><?php echo esc_attr($label);?></a><?php echo esc_attr($separator);?></li> |
|
136 | 136 | <?php |
137 | 137 | } |
138 | 138 | ?> |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | * @param object $field CMB2_Field(); |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public function output_tab_open_div( $field ) { |
|
152 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
151 | + public function output_tab_open_div($field){ |
|
152 | + if(true===$this->is_options_page&&isset($field->args['type'])&&'title'===$field->args['type']){ |
|
153 | 153 | ?> |
154 | - <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
|
154 | + <div id="<?php echo esc_attr($field->args['id']);?>_tab" class="tab tab-nav hidden"> |
|
155 | 155 | <?php |
156 | 156 | } |
157 | 157 | } |
@@ -162,19 +162,19 @@ discard block |
||
162 | 162 | * @param object $field CMB2_Field(); |
163 | 163 | * @return void |
164 | 164 | */ |
165 | - public function output_tab_closing_div( $field ) { |
|
166 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
165 | + public function output_tab_closing_div($field){ |
|
166 | + if(true===$this->is_options_page&&isset($field->args['type'])&&'tab_closing'===$field->args['type']){ |
|
167 | 167 | ?> |
168 | 168 | </div> |
169 | 169 | <?php |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
173 | + public function cmb2_render_callback_for_tab_closing($field,$escaped_value,$object_id,$object_type,$field_type_object){ |
|
174 | 174 | return; |
175 | 175 | } |
176 | 176 | |
177 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
177 | + public function cmb2_sanitize_tab_closing_callback($override_value,$value){ |
|
178 | 178 | return ''; |
179 | 179 | } |
180 | 180 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param string $object_type |
187 | 187 | * @return void |
188 | 188 | */ |
189 | - public function navigation_js( $cmb_id, $object_id, $object_type ) { |
|
190 | - if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
189 | + public function navigation_js($cmb_id,$object_id,$object_type){ |
|
190 | + if('lsx_sharing_settings'===$cmb_id&&'lsx-sharing-settings'===$object_id&&'options-page'===$object_type){ |
|
191 | 191 | ?> |
192 | 192 | <script> |
193 | 193 | var LSX_SHARING_CMB2 = Object.create( null ); |
@@ -198,15 +198,15 @@ discard block |
||
198 | 198 | |
199 | 199 | LSX_SHARING_CMB2.document = $(document); |
200 | 200 | |
201 | - <?php $this->navigation_js_init(); ?> |
|
201 | + <?php $this->navigation_js_init();?> |
|
202 | 202 | |
203 | - <?php $this->navigation_js_add_tab_input(); ?> |
|
203 | + <?php $this->navigation_js_add_tab_input();?> |
|
204 | 204 | |
205 | - <?php $this->navigation_js_prep_navigation(); ?> |
|
205 | + <?php $this->navigation_js_prep_navigation();?> |
|
206 | 206 | |
207 | - <?php $this->navigation_js_watch_navigation(); ?> |
|
207 | + <?php $this->navigation_js_watch_navigation();?> |
|
208 | 208 | |
209 | - <?php $this->navigation_js_url_param(); ?> |
|
209 | + <?php $this->navigation_js_url_param();?> |
|
210 | 210 | |
211 | 211 | LSX_SHARING_CMB2.document.ready( function() { |
212 | 212 | LSX_SHARING_CMB2.init(); |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | * @param string $url |
225 | 225 | * @return void |
226 | 226 | */ |
227 | - public function add_tab_argument( $url ) { |
|
228 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
229 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
230 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
231 | - if ( 'single' !== $tab_selection ) { |
|
232 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
233 | - } else { |
|
234 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
227 | + public function add_tab_argument($url){ |
|
228 | + if(isset($_POST['cmb_tab'])&&''!==$_POST['cmb_tab']){ // @codingStandardsIgnoreLine |
|
229 | + $tab_selection=sanitize_text_field($_POST['cmb_tab']);// @codingStandardsIgnoreLine |
|
230 | + $tab_selection=str_replace(array('settings_','_tab'),'',$tab_selection);// @codingStandardsIgnoreLine |
|
231 | + if('single'!==$tab_selection){ |
|
232 | + $url=add_query_arg('cmb_tab',$tab_selection,$url); |
|
233 | + }else{ |
|
234 | + $url=remove_query_arg('cmb_tab',$url); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | return $url; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return void |
244 | 244 | */ |
245 | - public function navigation_js_init() { |
|
245 | + public function navigation_js_init(){ |
|
246 | 246 | ?> |
247 | 247 | /** |
248 | 248 | * Start the JS Class |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | }; |
259 | 259 | <?php |
260 | 260 | } |
261 | - public function navigation_js_add_tab_input() { |
|
261 | + public function navigation_js_add_tab_input(){ |
|
262 | 262 | ?> |
263 | 263 | LSX_SHARING_CMB2.addTabInput = function( tab = '' ) { |
264 | 264 | var counter = 1; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | <?php |
268 | 268 | } |
269 | 269 | |
270 | - public function navigation_js_url_param() { |
|
270 | + public function navigation_js_url_param(){ |
|
271 | 271 | ?> |
272 | 272 | LSX_SHARING_CMB2.urlParam = function(name){ |
273 | 273 | var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return void |
286 | 286 | */ |
287 | - public function navigation_js_watch_navigation() { |
|
287 | + public function navigation_js_watch_navigation(){ |
|
288 | 288 | ?> |
289 | 289 | LSX_SHARING_CMB2.watchNavigation = function() { |
290 | 290 | $( ".wp-filter li a" ).on( 'click', function(event){ |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * |
309 | 309 | * @return void |
310 | 310 | */ |
311 | - public function navigation_js_prep_navigation() { |
|
311 | + public function navigation_js_prep_navigation(){ |
|
312 | 312 | ?> |
313 | 313 | LSX_SHARING_CMB2.prepNavigation = function( tab = '' ) { |
314 | 314 | var counter = 1; |
@@ -10,185 +10,185 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class Settings_Theme { |
12 | 12 | |
13 | - /** |
|
14 | - * Holds class instance |
|
15 | - * |
|
16 | - * @since 1.0.0 |
|
17 | - * |
|
18 | - * @var object \lsx\sharing\classes\admin\Settings_Theme() |
|
19 | - */ |
|
20 | - protected static $instance = null; |
|
13 | + /** |
|
14 | + * Holds class instance |
|
15 | + * |
|
16 | + * @since 1.0.0 |
|
17 | + * |
|
18 | + * @var object \lsx\sharing\classes\admin\Settings_Theme() |
|
19 | + */ |
|
20 | + protected static $instance = null; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Will return true if this is the LSX Sharing settings page. |
|
24 | - * |
|
25 | - * @var array |
|
26 | - */ |
|
27 | - public $is_options_page = false; |
|
22 | + /** |
|
23 | + * Will return true if this is the LSX Sharing settings page. |
|
24 | + * |
|
25 | + * @var array |
|
26 | + */ |
|
27 | + public $is_options_page = false; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Holds the id and labels for the navigation. |
|
31 | - * |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - public $navigation = array(); |
|
29 | + /** |
|
30 | + * Holds the id and labels for the navigation. |
|
31 | + * |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + public $navigation = array(); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Contructor |
|
38 | - */ |
|
39 | - public function __construct() { |
|
40 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
41 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
42 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
43 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
44 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
45 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
46 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
47 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
48 | - } |
|
36 | + /** |
|
37 | + * Contructor |
|
38 | + */ |
|
39 | + public function __construct() { |
|
40 | + add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
41 | + add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
42 | + add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
43 | + add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
44 | + add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
45 | + add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
46 | + add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
47 | + add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Return an instance of this class. |
|
52 | - * |
|
53 | - * @since 1.0.0 |
|
54 | - * |
|
55 | - * @return object \lsx\sharing\classes\admin\Settings_Theme() A single instance of this class. |
|
56 | - */ |
|
57 | - public static function get_instance() { |
|
58 | - // If the single instance hasn't been set, set it now. |
|
59 | - if ( null == self::$instance ) { |
|
60 | - self::$instance = new self(); |
|
61 | - } |
|
62 | - return self::$instance; |
|
63 | - } |
|
50 | + /** |
|
51 | + * Return an instance of this class. |
|
52 | + * |
|
53 | + * @since 1.0.0 |
|
54 | + * |
|
55 | + * @return object \lsx\sharing\classes\admin\Settings_Theme() A single instance of this class. |
|
56 | + */ |
|
57 | + public static function get_instance() { |
|
58 | + // If the single instance hasn't been set, set it now. |
|
59 | + if ( null == self::$instance ) { |
|
60 | + self::$instance = new self(); |
|
61 | + } |
|
62 | + return self::$instance; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Disable CMB2 styles on front end forms. |
|
67 | - * |
|
68 | - * @return bool $enabled Whether to enable (enqueue) styles. |
|
69 | - */ |
|
70 | - public function disable_cmb2_styles( $enabled ) { |
|
71 | - if ( is_admin() ) { |
|
72 | - $current_screen = get_current_screen(); |
|
73 | - if ( is_object( $current_screen ) && 'settings_page_lsx-sharing-settings' === $current_screen->id ) { |
|
74 | - $enabled = false; |
|
75 | - } |
|
76 | - } |
|
77 | - return $enabled; |
|
78 | - } |
|
65 | + /** |
|
66 | + * Disable CMB2 styles on front end forms. |
|
67 | + * |
|
68 | + * @return bool $enabled Whether to enable (enqueue) styles. |
|
69 | + */ |
|
70 | + public function disable_cmb2_styles( $enabled ) { |
|
71 | + if ( is_admin() ) { |
|
72 | + $current_screen = get_current_screen(); |
|
73 | + if ( is_object( $current_screen ) && 'settings_page_lsx-sharing-settings' === $current_screen->id ) { |
|
74 | + $enabled = false; |
|
75 | + } |
|
76 | + } |
|
77 | + return $enabled; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Generates the tabbed navigation for the settings page. |
|
82 | - * |
|
83 | - * @param string $cmb_id |
|
84 | - * @param string $object_id |
|
85 | - * @param string $object_type |
|
86 | - * @param object $cmb2_obj |
|
87 | - * @return void |
|
88 | - */ |
|
89 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
90 | - if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
91 | - $this->navigation = array(); |
|
92 | - $this->is_options_page = true; |
|
93 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
94 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
95 | - if ( 'title' === $field['type'] ) { |
|
96 | - $this->navigation[ $field_index ] = $field['name']; |
|
97 | - } |
|
98 | - } |
|
99 | - } |
|
100 | - $this->output_navigation(); |
|
101 | - } |
|
102 | - } |
|
80 | + /** |
|
81 | + * Generates the tabbed navigation for the settings page. |
|
82 | + * |
|
83 | + * @param string $cmb_id |
|
84 | + * @param string $object_id |
|
85 | + * @param string $object_type |
|
86 | + * @param object $cmb2_obj |
|
87 | + * @return void |
|
88 | + */ |
|
89 | + public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
90 | + if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
91 | + $this->navigation = array(); |
|
92 | + $this->is_options_page = true; |
|
93 | + if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
94 | + foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
95 | + if ( 'title' === $field['type'] ) { |
|
96 | + $this->navigation[ $field_index ] = $field['name']; |
|
97 | + } |
|
98 | + } |
|
99 | + } |
|
100 | + $this->output_navigation(); |
|
101 | + } |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * Outputs the WP style navigation for the Settings page. |
|
106 | - * |
|
107 | - * @return void |
|
108 | - */ |
|
109 | - public function output_navigation() { |
|
110 | - if ( ! empty( $this->navigation ) ) { |
|
111 | - ?> |
|
104 | + /** |
|
105 | + * Outputs the WP style navigation for the Settings page. |
|
106 | + * |
|
107 | + * @return void |
|
108 | + */ |
|
109 | + public function output_navigation() { |
|
110 | + if ( ! empty( $this->navigation ) ) { |
|
111 | + ?> |
|
112 | 112 | <div class="wp-filter hide-if-no-js"> |
113 | 113 | <ul class="filter-links"> |
114 | 114 | <?php |
115 | - $first_tab = true; |
|
116 | - $total = count( $this->navigation ); |
|
117 | - $count = 0; |
|
118 | - $separator = ' |'; |
|
119 | - $selected_tab = ''; |
|
120 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
121 | - $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
122 | - $selected_tab = 'settings_' . $selected_tab; |
|
123 | - } |
|
124 | - foreach ( $this->navigation as $key => $label ) { |
|
125 | - $count++; |
|
126 | - $current_css = ''; |
|
127 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
128 | - $first_tab = false; |
|
129 | - $current_css = 'current'; |
|
130 | - } |
|
131 | - if ( $count === $total ) { |
|
132 | - $separator = ''; |
|
133 | - } |
|
134 | - ?> |
|
115 | + $first_tab = true; |
|
116 | + $total = count( $this->navigation ); |
|
117 | + $count = 0; |
|
118 | + $separator = ' |'; |
|
119 | + $selected_tab = ''; |
|
120 | + if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
121 | + $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
122 | + $selected_tab = 'settings_' . $selected_tab; |
|
123 | + } |
|
124 | + foreach ( $this->navigation as $key => $label ) { |
|
125 | + $count++; |
|
126 | + $current_css = ''; |
|
127 | + if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
128 | + $first_tab = false; |
|
129 | + $current_css = 'current'; |
|
130 | + } |
|
131 | + if ( $count === $total ) { |
|
132 | + $separator = ''; |
|
133 | + } |
|
134 | + ?> |
|
135 | 135 | <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
136 | 136 | <?php |
137 | - } |
|
138 | - ?> |
|
137 | + } |
|
138 | + ?> |
|
139 | 139 | </ul> |
140 | 140 | </div> |
141 | 141 | <?php |
142 | - } |
|
143 | - } |
|
142 | + } |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * Outputs the opening tab div. |
|
147 | - * |
|
148 | - * @param object $field CMB2_Field(); |
|
149 | - * @return void |
|
150 | - */ |
|
151 | - public function output_tab_open_div( $field ) { |
|
152 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
153 | - ?> |
|
145 | + /** |
|
146 | + * Outputs the opening tab div. |
|
147 | + * |
|
148 | + * @param object $field CMB2_Field(); |
|
149 | + * @return void |
|
150 | + */ |
|
151 | + public function output_tab_open_div( $field ) { |
|
152 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
153 | + ?> |
|
154 | 154 | <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
155 | 155 | <?php |
156 | - } |
|
157 | - } |
|
156 | + } |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
160 | - * Outputs the opening closing div. |
|
161 | - * |
|
162 | - * @param object $field CMB2_Field(); |
|
163 | - * @return void |
|
164 | - */ |
|
165 | - public function output_tab_closing_div( $field ) { |
|
166 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
167 | - ?> |
|
159 | + /** |
|
160 | + * Outputs the opening closing div. |
|
161 | + * |
|
162 | + * @param object $field CMB2_Field(); |
|
163 | + * @return void |
|
164 | + */ |
|
165 | + public function output_tab_closing_div( $field ) { |
|
166 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
167 | + ?> |
|
168 | 168 | </div> |
169 | 169 | <?php |
170 | - } |
|
171 | - } |
|
170 | + } |
|
171 | + } |
|
172 | 172 | |
173 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
174 | - return; |
|
175 | - } |
|
173 | + public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
174 | + return; |
|
175 | + } |
|
176 | 176 | |
177 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
178 | - return ''; |
|
179 | - } |
|
177 | + public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
178 | + return ''; |
|
179 | + } |
|
180 | 180 | |
181 | - /** |
|
182 | - * Outputs the Script for the tabbed navigation. |
|
183 | - * |
|
184 | - * @param string $cmb_id |
|
185 | - * @param string $object_id |
|
186 | - * @param string $object_type |
|
187 | - * @return void |
|
188 | - */ |
|
189 | - public function navigation_js( $cmb_id, $object_id, $object_type ) { |
|
190 | - if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
191 | - ?> |
|
181 | + /** |
|
182 | + * Outputs the Script for the tabbed navigation. |
|
183 | + * |
|
184 | + * @param string $cmb_id |
|
185 | + * @param string $object_id |
|
186 | + * @param string $object_type |
|
187 | + * @return void |
|
188 | + */ |
|
189 | + public function navigation_js( $cmb_id, $object_id, $object_type ) { |
|
190 | + if ( 'lsx_sharing_settings' === $cmb_id && 'lsx-sharing-settings' === $object_id && 'options-page' === $object_type ) { |
|
191 | + ?> |
|
192 | 192 | <script> |
193 | 193 | var LSX_SHARING_CMB2 = Object.create( null ); |
194 | 194 | |
@@ -215,35 +215,35 @@ discard block |
||
215 | 215 | } )( jQuery, window, document ); |
216 | 216 | </script> |
217 | 217 | <?php |
218 | - } |
|
219 | - } |
|
218 | + } |
|
219 | + } |
|
220 | 220 | |
221 | - /** |
|
222 | - * This will add the tab selection to the url. |
|
223 | - * |
|
224 | - * @param string $url |
|
225 | - * @return void |
|
226 | - */ |
|
227 | - public function add_tab_argument( $url ) { |
|
228 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
229 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
230 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
231 | - if ( 'single' !== $tab_selection ) { |
|
232 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
233 | - } else { |
|
234 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
235 | - } |
|
236 | - } |
|
237 | - return $url; |
|
238 | - } |
|
221 | + /** |
|
222 | + * This will add the tab selection to the url. |
|
223 | + * |
|
224 | + * @param string $url |
|
225 | + * @return void |
|
226 | + */ |
|
227 | + public function add_tab_argument( $url ) { |
|
228 | + if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
229 | + $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
230 | + $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
231 | + if ( 'single' !== $tab_selection ) { |
|
232 | + $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
233 | + } else { |
|
234 | + $url = remove_query_arg( 'cmb_tab', $url ); |
|
235 | + } |
|
236 | + } |
|
237 | + return $url; |
|
238 | + } |
|
239 | 239 | |
240 | - /** |
|
241 | - * The JS function to init the navigation JS. |
|
242 | - * |
|
243 | - * @return void |
|
244 | - */ |
|
245 | - public function navigation_js_init() { |
|
246 | - ?> |
|
240 | + /** |
|
241 | + * The JS function to init the navigation JS. |
|
242 | + * |
|
243 | + * @return void |
|
244 | + */ |
|
245 | + public function navigation_js_init() { |
|
246 | + ?> |
|
247 | 247 | /** |
248 | 248 | * Start the JS Class |
249 | 249 | */ |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | LSX_SHARING_CMB2.watchNavigation(); |
258 | 258 | }; |
259 | 259 | <?php |
260 | - } |
|
261 | - public function navigation_js_add_tab_input() { |
|
262 | - ?> |
|
260 | + } |
|
261 | + public function navigation_js_add_tab_input() { |
|
262 | + ?> |
|
263 | 263 | LSX_SHARING_CMB2.addTabInput = function( tab = '' ) { |
264 | 264 | var counter = 1; |
265 | 265 | $( "form.cmb-form" ).append('<input type="hidden" name="cmb_tab" value="' + tab + '" />'); |
266 | 266 | } |
267 | 267 | <?php |
268 | - } |
|
268 | + } |
|
269 | 269 | |
270 | - public function navigation_js_url_param() { |
|
271 | - ?> |
|
270 | + public function navigation_js_url_param() { |
|
271 | + ?> |
|
272 | 272 | LSX_SHARING_CMB2.urlParam = function(name){ |
273 | 273 | var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); |
274 | 274 | if ( results == null ){ |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | } |
279 | 279 | } |
280 | 280 | <?php |
281 | - } |
|
282 | - /** |
|
283 | - * The JS function to init the watch navigation JS. |
|
284 | - * |
|
285 | - * @return void |
|
286 | - */ |
|
287 | - public function navigation_js_watch_navigation() { |
|
288 | - ?> |
|
281 | + } |
|
282 | + /** |
|
283 | + * The JS function to init the watch navigation JS. |
|
284 | + * |
|
285 | + * @return void |
|
286 | + */ |
|
287 | + public function navigation_js_watch_navigation() { |
|
288 | + ?> |
|
289 | 289 | LSX_SHARING_CMB2.watchNavigation = function() { |
290 | 290 | $( ".wp-filter li a" ).on( 'click', function(event){ |
291 | 291 | event.preventDefault(); |
@@ -301,15 +301,15 @@ discard block |
||
301 | 301 | }); |
302 | 302 | }; |
303 | 303 | <?php |
304 | - } |
|
304 | + } |
|
305 | 305 | |
306 | - /** |
|
307 | - * Preps the navigation for the js functions. |
|
308 | - * |
|
309 | - * @return void |
|
310 | - */ |
|
311 | - public function navigation_js_prep_navigation() { |
|
312 | - ?> |
|
306 | + /** |
|
307 | + * Preps the navigation for the js functions. |
|
308 | + * |
|
309 | + * @return void |
|
310 | + */ |
|
311 | + public function navigation_js_prep_navigation() { |
|
312 | + ?> |
|
313 | 313 | LSX_SHARING_CMB2.prepNavigation = function( tab = '' ) { |
314 | 314 | var counter = 1; |
315 | 315 | $( ".tab.tab-nav" ).each(function(){ |
@@ -323,5 +323,5 @@ discard block |
||
323 | 323 | }); |
324 | 324 | } |
325 | 325 | <?php |
326 | - } |
|
326 | + } |
|
327 | 327 | } |
@@ -8,12 +8,12 @@ |
||
8 | 8 | /** |
9 | 9 | * Deprecated class. |
10 | 10 | */ |
11 | -class LSX_Sharing { |
|
11 | +class LSX_Sharing{ |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Constructor. |
15 | 15 | */ |
16 | - public function __construct() { |
|
16 | + public function __construct(){ |
|
17 | 17 | return lsx_sharing(); |
18 | 18 | } |
19 | 19 | } |
@@ -10,10 +10,10 @@ |
||
10 | 10 | */ |
11 | 11 | class LSX_Sharing { |
12 | 12 | |
13 | - /** |
|
14 | - * Constructor. |
|
15 | - */ |
|
16 | - public function __construct() { |
|
17 | - return lsx_sharing(); |
|
18 | - } |
|
13 | + /** |
|
14 | + * Constructor. |
|
15 | + */ |
|
16 | + public function __construct() { |
|
17 | + return lsx_sharing(); |
|
18 | + } |
|
19 | 19 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @package lsx-sharing |
13 | 13 | */ |
14 | -class Sharing { |
|
14 | +class Sharing{ |
|
15 | 15 | |
16 | 16 | |
17 | 17 | /** |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @var object \lsx\search\Sharing() |
23 | 23 | */ |
24 | - protected static $instance = null; |
|
24 | + protected static $instance=null; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Holds class instance |
@@ -30,27 +30,27 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @var object \lsx\search\classes\Admin() |
32 | 32 | */ |
33 | - public $admin = false; |
|
33 | + public $admin=false; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * If we are using the new options or not. |
37 | 37 | * |
38 | 38 | * @var boolean |
39 | 39 | */ |
40 | - public $is_new_options = false; |
|
40 | + public $is_new_options=false; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * The options for the plugin. |
44 | 44 | * |
45 | 45 | * @var array |
46 | 46 | */ |
47 | - public $options = array(); |
|
47 | + public $options=array(); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Constructor. |
51 | 51 | */ |
52 | - public function __construct() { |
|
53 | - add_action('init', array( $this, 'set_options' ), 50); |
|
52 | + public function __construct(){ |
|
53 | + add_action('init',array($this,'set_options'),50); |
|
54 | 54 | $this->load_vendors(); |
55 | 55 | $this->load_includes(); |
56 | 56 | $this->load_classes(); |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return object \lsx\member_directory\search\Admin() A single instance of this class. |
65 | 65 | */ |
66 | - public static function get_instance() { |
|
66 | + public static function get_instance(){ |
|
67 | 67 | // If the single instance hasn't been set, set it now. |
68 | - if ( null === self::$instance ) { |
|
69 | - self::$instance = new self(); |
|
68 | + if(null===self::$instance){ |
|
69 | + self::$instance=new self(); |
|
70 | 70 | } |
71 | 71 | return self::$instance; |
72 | 72 | } |
@@ -74,53 +74,53 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * Loads the plugin functions. |
76 | 76 | */ |
77 | - private function load_vendors() { |
|
77 | + private function load_vendors(){ |
|
78 | 78 | // Configure custom fields. |
79 | - if ( ! class_exists('CMB2') ) { |
|
80 | - include_once LSX_SHARING_PATH . 'vendor/CMB2/init.php'; |
|
79 | + if(!class_exists('CMB2')){ |
|
80 | + include_once LSX_SHARING_PATH.'vendor/CMB2/init.php'; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | /** |
84 | 84 | * Loads the plugin functions. |
85 | 85 | */ |
86 | - private function load_includes() { |
|
87 | - include_once LSX_SHARING_PATH . '/includes/functions.php'; |
|
86 | + private function load_includes(){ |
|
87 | + include_once LSX_SHARING_PATH.'/includes/functions.php'; |
|
88 | 88 | } |
89 | 89 | /** |
90 | 90 | * Loads the plugin functions. |
91 | 91 | */ |
92 | - private function load_classes() { |
|
93 | - include_once LSX_SHARING_PATH . '/classes/class-admin.php'; |
|
92 | + private function load_classes(){ |
|
93 | + include_once LSX_SHARING_PATH.'/classes/class-admin.php'; |
|
94 | 94 | global $lsx_sharing_admin; |
95 | - $this->admin = \lsx\sharing\classes\Admin::get_instance(); |
|
95 | + $this->admin=\lsx\sharing\classes\Admin::get_instance(); |
|
96 | 96 | $lsx_sharing_admin; |
97 | 97 | |
98 | - include_once LSX_SHARING_PATH . '/classes/class-frontend.php'; |
|
99 | - $this->frontend = \lsx\sharing\classes\Frontend::get_instance(); |
|
98 | + include_once LSX_SHARING_PATH.'/classes/class-frontend.php'; |
|
99 | + $this->frontend=\lsx\sharing\classes\Frontend::get_instance(); |
|
100 | 100 | global $lsx_sharing; |
101 | - $lsx_sharing = $this->frontend->output; |
|
101 | + $lsx_sharing=$this->frontend->output; |
|
102 | 102 | |
103 | - include_once LSX_SHARING_PATH . '/classes/deprecated/class-lsx-sharing.php'; |
|
103 | + include_once LSX_SHARING_PATH.'/classes/deprecated/class-lsx-sharing.php'; |
|
104 | 104 | } |
105 | 105 | /** |
106 | 106 | * Set options. |
107 | 107 | */ |
108 | - public function set_options() { |
|
109 | - if ( function_exists('tour_operator') ) { |
|
110 | - $this->options = get_option('_lsx-to_settings', false); |
|
111 | - } else { |
|
112 | - $this->options = get_option('_lsx_settings', false); |
|
108 | + public function set_options(){ |
|
109 | + if(function_exists('tour_operator')){ |
|
110 | + $this->options=get_option('_lsx-to_settings',false); |
|
111 | + }else{ |
|
112 | + $this->options=get_option('_lsx_settings',false); |
|
113 | 113 | |
114 | - if ( false === $this->options ) { |
|
115 | - $this->options = get_option('_lsx_lsx-settings', false); |
|
114 | + if(false===$this->options){ |
|
115 | + $this->options=get_option('_lsx_lsx-settings',false); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - $new_options = get_option('lsx-sharing-settings'); |
|
120 | - if ( ! empty($new_options) ) { |
|
121 | - if ( '' !== $new_options && false !== $new_options ) { |
|
122 | - $this->is_new_options = true; |
|
123 | - $this->options = $new_options; |
|
119 | + $new_options=get_option('lsx-sharing-settings'); |
|
120 | + if(!empty($new_options)){ |
|
121 | + if(''!==$new_options&&false!==$new_options){ |
|
122 | + $this->is_new_options=true; |
|
123 | + $this->options=$new_options; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
@@ -14,114 +14,114 @@ |
||
14 | 14 | class Sharing { |
15 | 15 | |
16 | 16 | |
17 | - /** |
|
18 | - * Holds class instance |
|
19 | - * |
|
20 | - * @since 1.0.0 |
|
21 | - * |
|
22 | - * @var object \lsx\search\Sharing() |
|
23 | - */ |
|
24 | - protected static $instance = null; |
|
17 | + /** |
|
18 | + * Holds class instance |
|
19 | + * |
|
20 | + * @since 1.0.0 |
|
21 | + * |
|
22 | + * @var object \lsx\search\Sharing() |
|
23 | + */ |
|
24 | + protected static $instance = null; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Holds class instance |
|
28 | - * |
|
29 | - * @since 1.0.0 |
|
30 | - * |
|
31 | - * @var object \lsx\search\classes\Admin() |
|
32 | - */ |
|
33 | - public $admin = false; |
|
26 | + /** |
|
27 | + * Holds class instance |
|
28 | + * |
|
29 | + * @since 1.0.0 |
|
30 | + * |
|
31 | + * @var object \lsx\search\classes\Admin() |
|
32 | + */ |
|
33 | + public $admin = false; |
|
34 | 34 | |
35 | - /** |
|
36 | - * If we are using the new options or not. |
|
37 | - * |
|
38 | - * @var boolean |
|
39 | - */ |
|
40 | - public $is_new_options = false; |
|
35 | + /** |
|
36 | + * If we are using the new options or not. |
|
37 | + * |
|
38 | + * @var boolean |
|
39 | + */ |
|
40 | + public $is_new_options = false; |
|
41 | 41 | |
42 | - /** |
|
43 | - * The options for the plugin. |
|
44 | - * |
|
45 | - * @var array |
|
46 | - */ |
|
47 | - public $options = array(); |
|
42 | + /** |
|
43 | + * The options for the plugin. |
|
44 | + * |
|
45 | + * @var array |
|
46 | + */ |
|
47 | + public $options = array(); |
|
48 | 48 | |
49 | - /** |
|
50 | - * Constructor. |
|
51 | - */ |
|
52 | - public function __construct() { |
|
53 | - add_action('init', array( $this, 'set_options' ), 50); |
|
54 | - $this->load_vendors(); |
|
55 | - $this->load_includes(); |
|
56 | - $this->load_classes(); |
|
57 | - } |
|
49 | + /** |
|
50 | + * Constructor. |
|
51 | + */ |
|
52 | + public function __construct() { |
|
53 | + add_action('init', array( $this, 'set_options' ), 50); |
|
54 | + $this->load_vendors(); |
|
55 | + $this->load_includes(); |
|
56 | + $this->load_classes(); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Return an instance of this class. |
|
61 | - * |
|
62 | - * @since 1.0.0 |
|
63 | - * |
|
64 | - * @return object \lsx\member_directory\search\Admin() A single instance of this class. |
|
65 | - */ |
|
66 | - public static function get_instance() { |
|
67 | - // If the single instance hasn't been set, set it now. |
|
68 | - if ( null === self::$instance ) { |
|
69 | - self::$instance = new self(); |
|
70 | - } |
|
71 | - return self::$instance; |
|
72 | - } |
|
59 | + /** |
|
60 | + * Return an instance of this class. |
|
61 | + * |
|
62 | + * @since 1.0.0 |
|
63 | + * |
|
64 | + * @return object \lsx\member_directory\search\Admin() A single instance of this class. |
|
65 | + */ |
|
66 | + public static function get_instance() { |
|
67 | + // If the single instance hasn't been set, set it now. |
|
68 | + if ( null === self::$instance ) { |
|
69 | + self::$instance = new self(); |
|
70 | + } |
|
71 | + return self::$instance; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * Loads the plugin functions. |
|
76 | - */ |
|
77 | - private function load_vendors() { |
|
78 | - // Configure custom fields. |
|
79 | - if ( ! class_exists('CMB2') ) { |
|
80 | - include_once LSX_SHARING_PATH . 'vendor/CMB2/init.php'; |
|
81 | - } |
|
82 | - } |
|
83 | - /** |
|
84 | - * Loads the plugin functions. |
|
85 | - */ |
|
86 | - private function load_includes() { |
|
87 | - include_once LSX_SHARING_PATH . '/includes/functions.php'; |
|
88 | - } |
|
89 | - /** |
|
90 | - * Loads the plugin functions. |
|
91 | - */ |
|
92 | - private function load_classes() { |
|
93 | - include_once LSX_SHARING_PATH . '/classes/class-admin.php'; |
|
94 | - global $lsx_sharing_admin; |
|
95 | - $this->admin = \lsx\sharing\classes\Admin::get_instance(); |
|
96 | - $lsx_sharing_admin; |
|
74 | + /** |
|
75 | + * Loads the plugin functions. |
|
76 | + */ |
|
77 | + private function load_vendors() { |
|
78 | + // Configure custom fields. |
|
79 | + if ( ! class_exists('CMB2') ) { |
|
80 | + include_once LSX_SHARING_PATH . 'vendor/CMB2/init.php'; |
|
81 | + } |
|
82 | + } |
|
83 | + /** |
|
84 | + * Loads the plugin functions. |
|
85 | + */ |
|
86 | + private function load_includes() { |
|
87 | + include_once LSX_SHARING_PATH . '/includes/functions.php'; |
|
88 | + } |
|
89 | + /** |
|
90 | + * Loads the plugin functions. |
|
91 | + */ |
|
92 | + private function load_classes() { |
|
93 | + include_once LSX_SHARING_PATH . '/classes/class-admin.php'; |
|
94 | + global $lsx_sharing_admin; |
|
95 | + $this->admin = \lsx\sharing\classes\Admin::get_instance(); |
|
96 | + $lsx_sharing_admin; |
|
97 | 97 | |
98 | - include_once LSX_SHARING_PATH . '/classes/class-frontend.php'; |
|
99 | - $this->frontend = \lsx\sharing\classes\Frontend::get_instance(); |
|
100 | - global $lsx_sharing; |
|
101 | - $lsx_sharing = $this->frontend->output; |
|
98 | + include_once LSX_SHARING_PATH . '/classes/class-frontend.php'; |
|
99 | + $this->frontend = \lsx\sharing\classes\Frontend::get_instance(); |
|
100 | + global $lsx_sharing; |
|
101 | + $lsx_sharing = $this->frontend->output; |
|
102 | 102 | |
103 | - include_once LSX_SHARING_PATH . '/classes/deprecated/class-lsx-sharing.php'; |
|
104 | - } |
|
105 | - /** |
|
106 | - * Set options. |
|
107 | - */ |
|
108 | - public function set_options() { |
|
109 | - if ( function_exists('tour_operator') ) { |
|
110 | - $this->options = get_option('_lsx-to_settings', false); |
|
111 | - } else { |
|
112 | - $this->options = get_option('_lsx_settings', false); |
|
103 | + include_once LSX_SHARING_PATH . '/classes/deprecated/class-lsx-sharing.php'; |
|
104 | + } |
|
105 | + /** |
|
106 | + * Set options. |
|
107 | + */ |
|
108 | + public function set_options() { |
|
109 | + if ( function_exists('tour_operator') ) { |
|
110 | + $this->options = get_option('_lsx-to_settings', false); |
|
111 | + } else { |
|
112 | + $this->options = get_option('_lsx_settings', false); |
|
113 | 113 | |
114 | - if ( false === $this->options ) { |
|
115 | - $this->options = get_option('_lsx_lsx-settings', false); |
|
116 | - } |
|
117 | - } |
|
114 | + if ( false === $this->options ) { |
|
115 | + $this->options = get_option('_lsx_lsx-settings', false); |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | - $new_options = get_option('lsx-sharing-settings'); |
|
120 | - if ( ! empty($new_options) ) { |
|
121 | - if ( '' !== $new_options && false !== $new_options ) { |
|
122 | - $this->is_new_options = true; |
|
123 | - $this->options = $new_options; |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
119 | + $new_options = get_option('lsx-sharing-settings'); |
|
120 | + if ( ! empty($new_options) ) { |
|
121 | + if ( '' !== $new_options && false !== $new_options ) { |
|
122 | + $this->is_new_options = true; |
|
123 | + $this->options = $new_options; |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | 127 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @package lsx-sharing |
8 | 8 | */ |
9 | -class Output { |
|
9 | +class Output{ |
|
10 | 10 | |
11 | 11 | |
12 | 12 | /** |
@@ -16,28 +16,28 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @var object \lsx\sharing\classes\frontend\Output() |
18 | 18 | */ |
19 | - protected static $instance = null; |
|
19 | + protected static $instance=null; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Contructor |
23 | 23 | */ |
24 | - public function __construct() { |
|
25 | - add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5); |
|
26 | - add_filter('wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2); |
|
27 | - add_shortcode('lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' )); |
|
24 | + public function __construct(){ |
|
25 | + add_action('wp_enqueue_scripts',array($this,'assets'),5); |
|
26 | + add_filter('wp_kses_allowed_html',array($this,'wp_kses_allowed_html'),10,2); |
|
27 | + add_shortcode('lsx_sharing_buttons',array($this,'sharing_buttons_shortcode')); |
|
28 | 28 | // Storefront (storefront_loop_post, storefront_single_post). |
29 | - add_action('storefront_post_content_before', array( $this, 'sharing_buttons_template' ), 20); |
|
29 | + add_action('storefront_post_content_before',array($this,'sharing_buttons_template'),20); |
|
30 | 30 | // WooCommerce. |
31 | - add_action('woocommerce_share', array( $this, 'sharing_buttons_template' )); |
|
31 | + add_action('woocommerce_share',array($this,'sharing_buttons_template')); |
|
32 | 32 | |
33 | 33 | // General Post Types. |
34 | - add_action('lsx_entry_after', array( $this, 'output_sharing' )); |
|
34 | + add_action('lsx_entry_after',array($this,'output_sharing')); |
|
35 | 35 | |
36 | 36 | // Tribe Events. |
37 | - add_filter('tribe_events_ical_single_event_links', array( $this, 'output_event_sharing' ), 10, 1); |
|
37 | + add_filter('tribe_events_ical_single_event_links',array($this,'output_event_sharing'),10,1); |
|
38 | 38 | |
39 | 39 | // Sensei Integration. |
40 | - add_action('sensei_pagination', array( $this, 'output_sharing' ), 20); |
|
40 | + add_action('sensei_pagination',array($this,'output_sharing'),20); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @return object \lsx\sharing\classes\frontend\Output() A single instance of this class. |
49 | 49 | */ |
50 | - public static function get_instance() { |
|
50 | + public static function get_instance(){ |
|
51 | 51 | // If the single instance hasn't been set, set it now. |
52 | - if ( null == self::$instance ) { |
|
53 | - self::$instance = new self(); |
|
52 | + if(null==self::$instance){ |
|
53 | + self::$instance=new self(); |
|
54 | 54 | } |
55 | 55 | return self::$instance; |
56 | 56 | } |
@@ -58,99 +58,99 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * Enques the assets. |
60 | 60 | */ |
61 | - public function assets() { |
|
62 | - if ( defined('WP_DEBUG') && true === WP_DEBUG ) { |
|
63 | - $min = ''; |
|
64 | - } else { |
|
65 | - $min = '.min'; |
|
61 | + public function assets(){ |
|
62 | + if(defined('WP_DEBUG')&&true===WP_DEBUG){ |
|
63 | + $min=''; |
|
64 | + }else{ |
|
65 | + $min='.min'; |
|
66 | 66 | } |
67 | 67 | /* Remove assets completely if all sharing options are off */ |
68 | 68 | |
69 | - if ( \lsx\sharing\includes\functions\is_disabled() ) { |
|
69 | + if(\lsx\sharing\includes\functions\is_disabled()){ |
|
70 | 70 | return ''; |
71 | 71 | } |
72 | 72 | |
73 | 73 | // Set our variables. |
74 | - $post_type = get_post_type(); |
|
74 | + $post_type=get_post_type(); |
|
75 | 75 | |
76 | 76 | /* Only show the assets if the post type sharing option is on */ |
77 | - if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) { |
|
77 | + if(!\lsx\sharing\includes\functions\is_pt_disabled($post_type)){ |
|
78 | 78 | |
79 | - wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true); |
|
79 | + wp_enqueue_script('lsx-sharing',LSX_SHARING_URL.'assets/js/lsx-sharing'.$min.'.js',array('jquery'),LSX_SHARING_VER,true); |
|
80 | 80 | |
81 | - $params = apply_filters( |
|
82 | - 'lsx_sharing_js_params', array( |
|
81 | + $params=apply_filters( |
|
82 | + 'lsx_sharing_js_params',array( |
|
83 | 83 | 'ajax_url' => admin_url('admin-ajax.php'), |
84 | 84 | ) |
85 | 85 | ); |
86 | 86 | |
87 | - wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params); |
|
87 | + wp_localize_script('lsx-sharing','lsx_sharing_params',$params); |
|
88 | 88 | |
89 | - wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER); |
|
90 | - wp_style_add_data('lsx-sharing', 'rtl', 'replace'); |
|
89 | + wp_enqueue_style('lsx-sharing',LSX_SHARING_URL.'assets/css/lsx-sharing.css',array(),LSX_SHARING_VER); |
|
90 | + wp_style_add_data('lsx-sharing','rtl','replace'); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Display/return sharing buttons. |
96 | 96 | */ |
97 | - public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
|
98 | - $sharing_content = ''; |
|
97 | + public function sharing_buttons($buttons=array('facebook','twitter','pinterest'),$echo=false,$post_id=false){ |
|
98 | + $sharing_content=''; |
|
99 | 99 | |
100 | - if ( ( is_preview() || is_admin() ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) { |
|
100 | + if((is_preview()||is_admin())&&!(defined('DOING_AJAX')&&DOING_AJAX)){ |
|
101 | 101 | return ''; |
102 | 102 | } |
103 | 103 | |
104 | - if ( empty($this->options) ) { |
|
105 | - $this->options = array(); |
|
104 | + if(empty($this->options)){ |
|
105 | + $this->options=array(); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | //Set our variables |
109 | 109 | global $post; |
110 | - $share_post = $post; |
|
111 | - if ( false !== $post_id ) { |
|
112 | - $share_post = get_post($post_id); |
|
113 | - $post_type = get_post_type($post_id); |
|
114 | - } else { |
|
115 | - $post_type = get_post_type(); |
|
110 | + $share_post=$post; |
|
111 | + if(false!==$post_id){ |
|
112 | + $share_post=get_post($post_id); |
|
113 | + $post_type=get_post_type($post_id); |
|
114 | + }else{ |
|
115 | + $post_type=get_post_type(); |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) { |
|
118 | + if(\lsx\sharing\includes\functions\is_disabled()||\lsx\sharing\includes\functions\is_pt_disabled($post_type)){ |
|
119 | 119 | return ''; |
120 | 120 | } |
121 | 121 | |
122 | - if ( ( is_array($buttons) && count($buttons) > 0 ) ) { |
|
123 | - $sharing_content .= '<div class="lsx-sharing-content"><p>'; |
|
122 | + if((is_array($buttons)&&count($buttons)>0)){ |
|
123 | + $sharing_content.='<div class="lsx-sharing-content"><p>'; |
|
124 | 124 | |
125 | - $sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type); |
|
126 | - if ( '' !== $sharing_text ) { |
|
127 | - $sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>'; |
|
125 | + $sharing_text=\lsx\sharing\includes\functions\get_sharing_text($post_type); |
|
126 | + if(''!==$sharing_text){ |
|
127 | + $sharing_content.='<span class="lsx-sharing-label">'.$sharing_text.'</span>'; |
|
128 | 128 | } |
129 | 129 | |
130 | - foreach ( $buttons as $id => $button ) { |
|
131 | - $button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type); |
|
130 | + foreach($buttons as $id => $button){ |
|
131 | + $button_obj=new \lsx\sharing\classes\frontend\Button($button,$this->options,$post_type); |
|
132 | 132 | |
133 | - if ( ! empty($button_obj) ) { |
|
134 | - $url = $button_obj->get_link($share_post); |
|
133 | + if(!empty($button_obj)){ |
|
134 | + $url=$button_obj->get_link($share_post); |
|
135 | 135 | |
136 | - if ( ! empty($url) ) { |
|
137 | - if ( 'email' === $button ) { |
|
138 | - if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id']) ) { |
|
136 | + if(!empty($url)){ |
|
137 | + if('email'===$button){ |
|
138 | + if(!isset($this->options['display'])||empty($this->options['display']['sharing_email_form_id'])){ |
|
139 | 139 | continue; |
140 | 140 | } |
141 | - $sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="#lsx-sharing-email" data-toggle="modal" data-link="' . esc_url($url) . '"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
142 | - } else { |
|
143 | - $sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="' . esc_url($url) . '" target="_blank" rel="noopener noreferrer"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
141 | + $sharing_content.='<span class="lsx-sharing-button lsx-sharing-button-'.esc_attr($button).'"><a href="#lsx-sharing-email" data-toggle="modal" data-link="'.esc_url($url).'"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
142 | + }else{ |
|
143 | + $sharing_content.='<span class="lsx-sharing-button lsx-sharing-button-'.esc_attr($button).'"><a href="'.esc_url($url).'" target="_blank" rel="noopener noreferrer"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
148 | - $sharing_content .= '</p></div>'; |
|
148 | + $sharing_content.='</p></div>'; |
|
149 | 149 | } |
150 | 150 | |
151 | - if ( $echo ) { |
|
151 | + if($echo){ |
|
152 | 152 | echo wp_kses_post($sharing_content); |
153 | - } else { |
|
153 | + }else{ |
|
154 | 154 | return $sharing_content; |
155 | 155 | } |
156 | 156 | } |
@@ -158,21 +158,21 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * Sharing buttons shortcode. |
160 | 160 | */ |
161 | - public function sharing_buttons_shortcode( $atts ) { |
|
162 | - $atts = shortcode_atts( |
|
161 | + public function sharing_buttons_shortcode($atts){ |
|
162 | + $atts=shortcode_atts( |
|
163 | 163 | array( |
164 | 164 | 'buttons' => '', |
165 | - ), $atts, 'lsx_sharing_buttons' |
|
165 | + ),$atts,'lsx_sharing_buttons' |
|
166 | 166 | ); |
167 | 167 | |
168 | - if ( empty($atts['buttons']) ) { |
|
168 | + if(empty($atts['buttons'])){ |
|
169 | 169 | return ''; |
170 | 170 | } |
171 | 171 | |
172 | - $no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING)); |
|
173 | - $buttons = explode(',', $no_whitespaces); |
|
172 | + $no_whitespaces=preg_replace('/\s*,\s*/',',',filter_var($atts['buttons'],FILTER_SANITIZE_STRING)); |
|
173 | + $buttons=explode(',',$no_whitespaces); |
|
174 | 174 | |
175 | - if ( is_array($buttons) && count($buttons) > 0 ) { |
|
175 | + if(is_array($buttons)&&count($buttons)>0){ |
|
176 | 176 | return $this->sharing_buttons($buttons); |
177 | 177 | } |
178 | 178 | } |
@@ -180,16 +180,16 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * Display buttons (template hook). |
182 | 182 | */ |
183 | - public function sharing_buttons_template() { |
|
183 | + public function sharing_buttons_template(){ |
|
184 | 184 | echo wp_kses_post($this->sharing_buttons()); |
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Allow data params for Bootstrap modal. |
189 | 189 | */ |
190 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
191 | - $allowedtags['a']['data-toggle'] = true; |
|
192 | - $allowedtags['a']['data-link'] = true; |
|
190 | + public function wp_kses_allowed_html($allowedtags,$context){ |
|
191 | + $allowedtags['a']['data-toggle']=true; |
|
192 | + $allowedtags['a']['data-link']=true; |
|
193 | 193 | return $allowedtags; |
194 | 194 | } |
195 | 195 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return void |
200 | 200 | */ |
201 | - public function output_sharing() { |
|
202 | - if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) { |
|
201 | + public function output_sharing(){ |
|
202 | + if(is_main_query()&&is_single()&&!is_singular(array('post','page','product'))){ |
|
203 | 203 | |
204 | - if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_restricted_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_to_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_hp_post_types()) ) { |
|
204 | + if(\lsx\sharing\includes\functions\is_disabled()||\lsx\sharing\includes\functions\is_pt_disabled(get_post_type())||in_array(get_post_type(),\lsx\sharing\includes\functions\get_restricted_post_types())||in_array(get_post_type(),\lsx\sharing\includes\functions\get_to_post_types())||in_array(get_post_type(),\lsx\sharing\includes\functions\get_hp_post_types())){ |
|
205 | 205 | return ''; |
206 | 206 | } |
207 | 207 | ?> |
208 | 208 | <footer class="lsx-sharing-wrapper footer-meta clearfix"> |
209 | 209 | <div class="post-tags-wrapper"> |
210 | - <?php $this->sharing_buttons_template(); ?> |
|
210 | + <?php $this->sharing_buttons_template();?> |
|
211 | 211 | </div> |
212 | 212 | </footer><!-- .footer-meta --> |
213 | 213 | <?php |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * @param string $ical_links |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function output_event_sharing( $ical_links = '' ) { |
|
224 | - if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) { |
|
223 | + public function output_event_sharing($ical_links=''){ |
|
224 | + if(\lsx\sharing\includes\functions\is_disabled()||\lsx\sharing\includes\functions\is_pt_disabled(get_post_type())){ |
|
225 | 225 | return ''; |
226 | - } else { |
|
227 | - $ical_links .= $this->sharing_buttons(); |
|
226 | + }else{ |
|
227 | + $ical_links.=$this->sharing_buttons(); |
|
228 | 228 | } |
229 | 229 | return $ical_links; |
230 | 230 | } |
@@ -9,223 +9,223 @@ |
||
9 | 9 | class Output { |
10 | 10 | |
11 | 11 | |
12 | - /** |
|
13 | - * Holds class instance |
|
14 | - * |
|
15 | - * @since 1.0.0 |
|
16 | - * |
|
17 | - * @var object \lsx\sharing\classes\frontend\Output() |
|
18 | - */ |
|
19 | - protected static $instance = null; |
|
20 | - |
|
21 | - /** |
|
22 | - * Contructor |
|
23 | - */ |
|
24 | - public function __construct() { |
|
25 | - add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5); |
|
26 | - add_filter('wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2); |
|
27 | - add_shortcode('lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' )); |
|
28 | - // Storefront (storefront_loop_post, storefront_single_post). |
|
29 | - add_action('storefront_post_content_before', array( $this, 'sharing_buttons_template' ), 20); |
|
30 | - // WooCommerce. |
|
31 | - add_action('woocommerce_share', array( $this, 'sharing_buttons_template' )); |
|
32 | - |
|
33 | - // General Post Types. |
|
34 | - add_action('lsx_entry_after', array( $this, 'output_sharing' )); |
|
35 | - |
|
36 | - // Tribe Events. |
|
37 | - add_filter('tribe_events_ical_single_event_links', array( $this, 'output_event_sharing' ), 10, 1); |
|
38 | - |
|
39 | - // Sensei Integration. |
|
40 | - add_action('sensei_pagination', array( $this, 'output_sharing' ), 20); |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Return an instance of this class. |
|
45 | - * |
|
46 | - * @since 1.0.0 |
|
47 | - * |
|
48 | - * @return object \lsx\sharing\classes\frontend\Output() A single instance of this class. |
|
49 | - */ |
|
50 | - public static function get_instance() { |
|
51 | - // If the single instance hasn't been set, set it now. |
|
52 | - if ( null == self::$instance ) { |
|
53 | - self::$instance = new self(); |
|
54 | - } |
|
55 | - return self::$instance; |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * Enques the assets. |
|
60 | - */ |
|
61 | - public function assets() { |
|
62 | - if ( defined('WP_DEBUG') && true === WP_DEBUG ) { |
|
63 | - $min = ''; |
|
64 | - } else { |
|
65 | - $min = '.min'; |
|
66 | - } |
|
67 | - /* Remove assets completely if all sharing options are off */ |
|
68 | - |
|
69 | - if ( \lsx\sharing\includes\functions\is_disabled() ) { |
|
70 | - return ''; |
|
71 | - } |
|
72 | - |
|
73 | - // Set our variables. |
|
74 | - $post_type = get_post_type(); |
|
75 | - |
|
76 | - /* Only show the assets if the post type sharing option is on */ |
|
77 | - if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) { |
|
78 | - |
|
79 | - wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true); |
|
80 | - |
|
81 | - $params = apply_filters( |
|
82 | - 'lsx_sharing_js_params', array( |
|
83 | - 'ajax_url' => admin_url('admin-ajax.php'), |
|
84 | - ) |
|
85 | - ); |
|
86 | - |
|
87 | - wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params); |
|
88 | - |
|
89 | - wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER); |
|
90 | - wp_style_add_data('lsx-sharing', 'rtl', 'replace'); |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Display/return sharing buttons. |
|
96 | - */ |
|
97 | - public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
|
98 | - $sharing_content = ''; |
|
99 | - |
|
100 | - if ( ( is_preview() || is_admin() ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) { |
|
101 | - return ''; |
|
102 | - } |
|
103 | - |
|
104 | - if ( empty($this->options) ) { |
|
105 | - $this->options = array(); |
|
106 | - } |
|
107 | - |
|
108 | - //Set our variables |
|
109 | - global $post; |
|
110 | - $share_post = $post; |
|
111 | - if ( false !== $post_id ) { |
|
112 | - $share_post = get_post($post_id); |
|
113 | - $post_type = get_post_type($post_id); |
|
114 | - } else { |
|
115 | - $post_type = get_post_type(); |
|
116 | - } |
|
117 | - |
|
118 | - if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) { |
|
119 | - return ''; |
|
120 | - } |
|
121 | - |
|
122 | - if ( ( is_array($buttons) && count($buttons) > 0 ) ) { |
|
123 | - $sharing_content .= '<div class="lsx-sharing-content"><p>'; |
|
124 | - |
|
125 | - $sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type); |
|
126 | - if ( '' !== $sharing_text ) { |
|
127 | - $sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>'; |
|
128 | - } |
|
129 | - |
|
130 | - foreach ( $buttons as $id => $button ) { |
|
131 | - $button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type); |
|
132 | - |
|
133 | - if ( ! empty($button_obj) ) { |
|
12 | + /** |
|
13 | + * Holds class instance |
|
14 | + * |
|
15 | + * @since 1.0.0 |
|
16 | + * |
|
17 | + * @var object \lsx\sharing\classes\frontend\Output() |
|
18 | + */ |
|
19 | + protected static $instance = null; |
|
20 | + |
|
21 | + /** |
|
22 | + * Contructor |
|
23 | + */ |
|
24 | + public function __construct() { |
|
25 | + add_action('wp_enqueue_scripts', array( $this, 'assets' ), 5); |
|
26 | + add_filter('wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2); |
|
27 | + add_shortcode('lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' )); |
|
28 | + // Storefront (storefront_loop_post, storefront_single_post). |
|
29 | + add_action('storefront_post_content_before', array( $this, 'sharing_buttons_template' ), 20); |
|
30 | + // WooCommerce. |
|
31 | + add_action('woocommerce_share', array( $this, 'sharing_buttons_template' )); |
|
32 | + |
|
33 | + // General Post Types. |
|
34 | + add_action('lsx_entry_after', array( $this, 'output_sharing' )); |
|
35 | + |
|
36 | + // Tribe Events. |
|
37 | + add_filter('tribe_events_ical_single_event_links', array( $this, 'output_event_sharing' ), 10, 1); |
|
38 | + |
|
39 | + // Sensei Integration. |
|
40 | + add_action('sensei_pagination', array( $this, 'output_sharing' ), 20); |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Return an instance of this class. |
|
45 | + * |
|
46 | + * @since 1.0.0 |
|
47 | + * |
|
48 | + * @return object \lsx\sharing\classes\frontend\Output() A single instance of this class. |
|
49 | + */ |
|
50 | + public static function get_instance() { |
|
51 | + // If the single instance hasn't been set, set it now. |
|
52 | + if ( null == self::$instance ) { |
|
53 | + self::$instance = new self(); |
|
54 | + } |
|
55 | + return self::$instance; |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * Enques the assets. |
|
60 | + */ |
|
61 | + public function assets() { |
|
62 | + if ( defined('WP_DEBUG') && true === WP_DEBUG ) { |
|
63 | + $min = ''; |
|
64 | + } else { |
|
65 | + $min = '.min'; |
|
66 | + } |
|
67 | + /* Remove assets completely if all sharing options are off */ |
|
68 | + |
|
69 | + if ( \lsx\sharing\includes\functions\is_disabled() ) { |
|
70 | + return ''; |
|
71 | + } |
|
72 | + |
|
73 | + // Set our variables. |
|
74 | + $post_type = get_post_type(); |
|
75 | + |
|
76 | + /* Only show the assets if the post type sharing option is on */ |
|
77 | + if ( ! \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) { |
|
78 | + |
|
79 | + wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true); |
|
80 | + |
|
81 | + $params = apply_filters( |
|
82 | + 'lsx_sharing_js_params', array( |
|
83 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
84 | + ) |
|
85 | + ); |
|
86 | + |
|
87 | + wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params); |
|
88 | + |
|
89 | + wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER); |
|
90 | + wp_style_add_data('lsx-sharing', 'rtl', 'replace'); |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Display/return sharing buttons. |
|
96 | + */ |
|
97 | + public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
|
98 | + $sharing_content = ''; |
|
99 | + |
|
100 | + if ( ( is_preview() || is_admin() ) && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) { |
|
101 | + return ''; |
|
102 | + } |
|
103 | + |
|
104 | + if ( empty($this->options) ) { |
|
105 | + $this->options = array(); |
|
106 | + } |
|
107 | + |
|
108 | + //Set our variables |
|
109 | + global $post; |
|
110 | + $share_post = $post; |
|
111 | + if ( false !== $post_id ) { |
|
112 | + $share_post = get_post($post_id); |
|
113 | + $post_type = get_post_type($post_id); |
|
114 | + } else { |
|
115 | + $post_type = get_post_type(); |
|
116 | + } |
|
117 | + |
|
118 | + if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled($post_type) ) { |
|
119 | + return ''; |
|
120 | + } |
|
121 | + |
|
122 | + if ( ( is_array($buttons) && count($buttons) > 0 ) ) { |
|
123 | + $sharing_content .= '<div class="lsx-sharing-content"><p>'; |
|
124 | + |
|
125 | + $sharing_text = \lsx\sharing\includes\functions\get_sharing_text($post_type); |
|
126 | + if ( '' !== $sharing_text ) { |
|
127 | + $sharing_content .= '<span class="lsx-sharing-label">' . $sharing_text . '</span>'; |
|
128 | + } |
|
129 | + |
|
130 | + foreach ( $buttons as $id => $button ) { |
|
131 | + $button_obj = new \lsx\sharing\classes\frontend\Button($button, $this->options, $post_type); |
|
132 | + |
|
133 | + if ( ! empty($button_obj) ) { |
|
134 | 134 | $url = $button_obj->get_link($share_post); |
135 | 135 | |
136 | 136 | if ( ! empty($url) ) { |
137 | - if ( 'email' === $button ) { |
|
138 | - if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id']) ) { |
|
139 | - continue; |
|
140 | - } |
|
141 | - $sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="#lsx-sharing-email" data-toggle="modal" data-link="' . esc_url($url) . '"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
142 | - } else { |
|
143 | - $sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="' . esc_url($url) . '" target="_blank" rel="noopener noreferrer"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
144 | - } |
|
137 | + if ( 'email' === $button ) { |
|
138 | + if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id']) ) { |
|
139 | + continue; |
|
140 | + } |
|
141 | + $sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="#lsx-sharing-email" data-toggle="modal" data-link="' . esc_url($url) . '"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
142 | + } else { |
|
143 | + $sharing_content .= '<span class="lsx-sharing-button lsx-sharing-button-' . esc_attr($button) . '"><a href="' . esc_url($url) . '" target="_blank" rel="noopener noreferrer"><span class="fa" aria-hidden="true"></span></a></span>'; |
|
144 | + } |
|
145 | 145 | } |
146 | - } |
|
147 | - } |
|
148 | - $sharing_content .= '</p></div>'; |
|
149 | - } |
|
150 | - |
|
151 | - if ( $echo ) { |
|
152 | - echo wp_kses_post($sharing_content); |
|
153 | - } else { |
|
154 | - return $sharing_content; |
|
155 | - } |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * Sharing buttons shortcode. |
|
160 | - */ |
|
161 | - public function sharing_buttons_shortcode( $atts ) { |
|
162 | - $atts = shortcode_atts( |
|
163 | - array( |
|
164 | - 'buttons' => '', |
|
165 | - ), $atts, 'lsx_sharing_buttons' |
|
166 | - ); |
|
167 | - |
|
168 | - if ( empty($atts['buttons']) ) { |
|
169 | - return ''; |
|
170 | - } |
|
171 | - |
|
172 | - $no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING)); |
|
173 | - $buttons = explode(',', $no_whitespaces); |
|
174 | - |
|
175 | - if ( is_array($buttons) && count($buttons) > 0 ) { |
|
176 | - return $this->sharing_buttons($buttons); |
|
177 | - } |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * Display buttons (template hook). |
|
182 | - */ |
|
183 | - public function sharing_buttons_template() { |
|
184 | - echo wp_kses_post($this->sharing_buttons()); |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * Allow data params for Bootstrap modal. |
|
189 | - */ |
|
190 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
191 | - $allowedtags['a']['data-toggle'] = true; |
|
192 | - $allowedtags['a']['data-link'] = true; |
|
193 | - return $allowedtags; |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * Outputs the sharing to the templates. |
|
198 | - * |
|
199 | - * @return void |
|
200 | - */ |
|
201 | - public function output_sharing() { |
|
202 | - if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) { |
|
203 | - |
|
204 | - if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_restricted_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_to_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_hp_post_types()) ) { |
|
205 | - return ''; |
|
206 | - } |
|
207 | - ?> |
|
146 | + } |
|
147 | + } |
|
148 | + $sharing_content .= '</p></div>'; |
|
149 | + } |
|
150 | + |
|
151 | + if ( $echo ) { |
|
152 | + echo wp_kses_post($sharing_content); |
|
153 | + } else { |
|
154 | + return $sharing_content; |
|
155 | + } |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * Sharing buttons shortcode. |
|
160 | + */ |
|
161 | + public function sharing_buttons_shortcode( $atts ) { |
|
162 | + $atts = shortcode_atts( |
|
163 | + array( |
|
164 | + 'buttons' => '', |
|
165 | + ), $atts, 'lsx_sharing_buttons' |
|
166 | + ); |
|
167 | + |
|
168 | + if ( empty($atts['buttons']) ) { |
|
169 | + return ''; |
|
170 | + } |
|
171 | + |
|
172 | + $no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING)); |
|
173 | + $buttons = explode(',', $no_whitespaces); |
|
174 | + |
|
175 | + if ( is_array($buttons) && count($buttons) > 0 ) { |
|
176 | + return $this->sharing_buttons($buttons); |
|
177 | + } |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * Display buttons (template hook). |
|
182 | + */ |
|
183 | + public function sharing_buttons_template() { |
|
184 | + echo wp_kses_post($this->sharing_buttons()); |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * Allow data params for Bootstrap modal. |
|
189 | + */ |
|
190 | + public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
191 | + $allowedtags['a']['data-toggle'] = true; |
|
192 | + $allowedtags['a']['data-link'] = true; |
|
193 | + return $allowedtags; |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * Outputs the sharing to the templates. |
|
198 | + * |
|
199 | + * @return void |
|
200 | + */ |
|
201 | + public function output_sharing() { |
|
202 | + if ( is_main_query() && is_single() && ! is_singular(array( 'post', 'page', 'product' )) ) { |
|
203 | + |
|
204 | + if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_restricted_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_to_post_types()) || in_array(get_post_type(), \lsx\sharing\includes\functions\get_hp_post_types()) ) { |
|
205 | + return ''; |
|
206 | + } |
|
207 | + ?> |
|
208 | 208 | <footer class="lsx-sharing-wrapper footer-meta clearfix"> |
209 | 209 | <div class="post-tags-wrapper"> |
210 | 210 | <?php $this->sharing_buttons_template(); ?> |
211 | 211 | </div> |
212 | 212 | </footer><!-- .footer-meta --> |
213 | 213 | <?php |
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * Outputs the sharing below the events. |
|
219 | - * |
|
220 | - * @param string $ical_links |
|
221 | - * @return string |
|
222 | - */ |
|
223 | - public function output_event_sharing( $ical_links = '' ) { |
|
224 | - if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) { |
|
225 | - return ''; |
|
226 | - } else { |
|
227 | - $ical_links .= $this->sharing_buttons(); |
|
228 | - } |
|
229 | - return $ical_links; |
|
230 | - } |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * Outputs the sharing below the events. |
|
219 | + * |
|
220 | + * @param string $ical_links |
|
221 | + * @return string |
|
222 | + */ |
|
223 | + public function output_event_sharing( $ical_links = '' ) { |
|
224 | + if ( \lsx\sharing\includes\functions\is_disabled() || \lsx\sharing\includes\functions\is_pt_disabled(get_post_type()) ) { |
|
225 | + return ''; |
|
226 | + } else { |
|
227 | + $ical_links .= $this->sharing_buttons(); |
|
228 | + } |
|
229 | + return $ical_links; |
|
230 | + } |
|
231 | 231 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @package lsx-sharing |
14 | 14 | */ |
15 | -class Admin { |
|
15 | +class Admin{ |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -20,26 +20,26 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @var object \lsx\sharing\classes\Admin() |
22 | 22 | */ |
23 | - protected static $instance = null; |
|
23 | + protected static $instance=null; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Holds Settings Theme Instance |
27 | 27 | * |
28 | 28 | * @var object \lsx\sharing\classes\admin\Settings_Theme() |
29 | 29 | */ |
30 | - public $settings_theme = false; |
|
30 | + public $settings_theme=false; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Holds Settings Instance |
34 | 34 | * |
35 | 35 | * @var object \lsx\sharing\classes\admin\Settings() |
36 | 36 | */ |
37 | - public $settings = false; |
|
37 | + public $settings=false; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Constructor. |
41 | 41 | */ |
42 | - public function __construct() { |
|
42 | + public function __construct(){ |
|
43 | 43 | $this->load_classes(); |
44 | 44 | } |
45 | 45 | |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return object \lsx\sharing\Admin() A single instance of this class. |
52 | 52 | */ |
53 | - public static function get_instance() { |
|
53 | + public static function get_instance(){ |
|
54 | 54 | // If the single instance hasn't been set, set it now. |
55 | - if ( null === self::$instance ) { |
|
56 | - self::$instance = new self(); |
|
55 | + if(null===self::$instance){ |
|
56 | + self::$instance=new self(); |
|
57 | 57 | } |
58 | 58 | return self::$instance; |
59 | 59 | } |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * Loads the plugin functions. |
63 | 63 | */ |
64 | - private function load_classes() { |
|
65 | - include_once LSX_SHARING_PATH . '/classes/admin/class-settings-theme.php'; |
|
66 | - $this->settings_theme = \lsx\sharing\classes\admin\Settings_Theme::get_instance(); |
|
67 | - include_once LSX_SHARING_PATH . '/classes/admin/class-settings.php'; |
|
68 | - $this->settings = \lsx\sharing\classes\admin\Settings::get_instance(); |
|
64 | + private function load_classes(){ |
|
65 | + include_once LSX_SHARING_PATH.'/classes/admin/class-settings-theme.php'; |
|
66 | + $this->settings_theme=\lsx\sharing\classes\admin\Settings_Theme::get_instance(); |
|
67 | + include_once LSX_SHARING_PATH.'/classes/admin/class-settings.php'; |
|
68 | + $this->settings=\lsx\sharing\classes\admin\Settings::get_instance(); |
|
69 | 69 | } |
70 | 70 | } |
@@ -15,56 +15,56 @@ |
||
15 | 15 | class Admin { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Holds class instance. |
|
20 | - * |
|
21 | - * @var object \lsx\sharing\classes\Admin() |
|
22 | - */ |
|
23 | - protected static $instance = null; |
|
18 | + /** |
|
19 | + * Holds class instance. |
|
20 | + * |
|
21 | + * @var object \lsx\sharing\classes\Admin() |
|
22 | + */ |
|
23 | + protected static $instance = null; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Holds Settings Theme Instance |
|
27 | - * |
|
28 | - * @var object \lsx\sharing\classes\admin\Settings_Theme() |
|
29 | - */ |
|
30 | - public $settings_theme = false; |
|
25 | + /** |
|
26 | + * Holds Settings Theme Instance |
|
27 | + * |
|
28 | + * @var object \lsx\sharing\classes\admin\Settings_Theme() |
|
29 | + */ |
|
30 | + public $settings_theme = false; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Holds Settings Instance |
|
34 | - * |
|
35 | - * @var object \lsx\sharing\classes\admin\Settings() |
|
36 | - */ |
|
37 | - public $settings = false; |
|
32 | + /** |
|
33 | + * Holds Settings Instance |
|
34 | + * |
|
35 | + * @var object \lsx\sharing\classes\admin\Settings() |
|
36 | + */ |
|
37 | + public $settings = false; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Constructor. |
|
41 | - */ |
|
42 | - public function __construct() { |
|
43 | - $this->load_classes(); |
|
44 | - } |
|
39 | + /** |
|
40 | + * Constructor. |
|
41 | + */ |
|
42 | + public function __construct() { |
|
43 | + $this->load_classes(); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Return an instance of this class. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * |
|
51 | - * @return object \lsx\sharing\Admin() A single instance of this class. |
|
52 | - */ |
|
53 | - public static function get_instance() { |
|
54 | - // If the single instance hasn't been set, set it now. |
|
55 | - if ( null === self::$instance ) { |
|
56 | - self::$instance = new self(); |
|
57 | - } |
|
58 | - return self::$instance; |
|
59 | - } |
|
46 | + /** |
|
47 | + * Return an instance of this class. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * |
|
51 | + * @return object \lsx\sharing\Admin() A single instance of this class. |
|
52 | + */ |
|
53 | + public static function get_instance() { |
|
54 | + // If the single instance hasn't been set, set it now. |
|
55 | + if ( null === self::$instance ) { |
|
56 | + self::$instance = new self(); |
|
57 | + } |
|
58 | + return self::$instance; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Loads the plugin functions. |
|
63 | - */ |
|
64 | - private function load_classes() { |
|
65 | - include_once LSX_SHARING_PATH . '/classes/admin/class-settings-theme.php'; |
|
66 | - $this->settings_theme = \lsx\sharing\classes\admin\Settings_Theme::get_instance(); |
|
67 | - include_once LSX_SHARING_PATH . '/classes/admin/class-settings.php'; |
|
68 | - $this->settings = \lsx\sharing\classes\admin\Settings::get_instance(); |
|
69 | - } |
|
61 | + /** |
|
62 | + * Loads the plugin functions. |
|
63 | + */ |
|
64 | + private function load_classes() { |
|
65 | + include_once LSX_SHARING_PATH . '/classes/admin/class-settings-theme.php'; |
|
66 | + $this->settings_theme = \lsx\sharing\classes\admin\Settings_Theme::get_instance(); |
|
67 | + include_once LSX_SHARING_PATH . '/classes/admin/class-settings.php'; |
|
68 | + $this->settings = \lsx\sharing\classes\admin\Settings::get_instance(); |
|
69 | + } |
|
70 | 70 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @package lsx-sharing |
14 | 14 | */ |
15 | -class Frontend { |
|
15 | +class Frontend{ |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @var object \lsx\sharing\classes\Frontend() |
24 | 24 | */ |
25 | - protected static $instance = null; |
|
25 | + protected static $instance=null; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Holds the output class. |
29 | 29 | * |
30 | 30 | * @var object \lsx\sharing\classes\frontend\Output() |
31 | 31 | */ |
32 | - public $output = null; |
|
32 | + public $output=null; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Constructor. |
36 | 36 | */ |
37 | - public function __construct() { |
|
37 | + public function __construct(){ |
|
38 | 38 | $this->load_classes(); |
39 | 39 | |
40 | 40 | } |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return object \lsx\sharing\classes\Frontend() A single instance of this class. |
48 | 48 | */ |
49 | - public static function get_instance() { |
|
49 | + public static function get_instance(){ |
|
50 | 50 | // If the single instance hasn't been set, set it now. |
51 | - if ( null == self::$instance ) { |
|
52 | - self::$instance = new self(); |
|
51 | + if(null==self::$instance){ |
|
52 | + self::$instance=new self(); |
|
53 | 53 | } |
54 | 54 | return self::$instance; |
55 | 55 | } |
@@ -57,17 +57,17 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * Loads the plugin functions. |
59 | 59 | */ |
60 | - private function load_classes() { |
|
61 | - include_once LSX_SHARING_PATH . '/classes/frontend/class-button.php'; |
|
62 | - include_once LSX_SHARING_PATH . '/classes/frontend/class-output.php'; |
|
63 | - $this->output = \lsx\sharing\classes\frontend\Output::get_instance(); |
|
60 | + private function load_classes(){ |
|
61 | + include_once LSX_SHARING_PATH.'/classes/frontend/class-button.php'; |
|
62 | + include_once LSX_SHARING_PATH.'/classes/frontend/class-output.php'; |
|
63 | + $this->output=\lsx\sharing\classes\frontend\Output::get_instance(); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Backwards compatabile function for the sharing buttons. |
68 | 68 | */ |
69 | - public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
|
70 | - wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()'); |
|
71 | - $this->output->sharing_buttons($buttons, $echo, $post_id); |
|
69 | + public function sharing_buttons($buttons=array('facebook','twitter','pinterest'),$echo=false,$post_id=false){ |
|
70 | + wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()','1.2.0','lsx_sharing()->frontend->output->sharing_buttons()'); |
|
71 | + $this->output->sharing_buttons($buttons,$echo,$post_id); |
|
72 | 72 | } |
73 | 73 | } |
@@ -15,59 +15,59 @@ |
||
15 | 15 | class Frontend { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Holds class instance |
|
20 | - * |
|
21 | - * @since 1.0.0 |
|
22 | - * |
|
23 | - * @var object \lsx\sharing\classes\Frontend() |
|
24 | - */ |
|
25 | - protected static $instance = null; |
|
18 | + /** |
|
19 | + * Holds class instance |
|
20 | + * |
|
21 | + * @since 1.0.0 |
|
22 | + * |
|
23 | + * @var object \lsx\sharing\classes\Frontend() |
|
24 | + */ |
|
25 | + protected static $instance = null; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Holds the output class. |
|
29 | - * |
|
30 | - * @var object \lsx\sharing\classes\frontend\Output() |
|
31 | - */ |
|
32 | - public $output = null; |
|
27 | + /** |
|
28 | + * Holds the output class. |
|
29 | + * |
|
30 | + * @var object \lsx\sharing\classes\frontend\Output() |
|
31 | + */ |
|
32 | + public $output = null; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Constructor. |
|
36 | - */ |
|
37 | - public function __construct() { |
|
38 | - $this->load_classes(); |
|
34 | + /** |
|
35 | + * Constructor. |
|
36 | + */ |
|
37 | + public function __construct() { |
|
38 | + $this->load_classes(); |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Return an instance of this class. |
|
44 | - * |
|
45 | - * @since 1.0.0 |
|
46 | - * |
|
47 | - * @return object \lsx\sharing\classes\Frontend() A single instance of this class. |
|
48 | - */ |
|
49 | - public static function get_instance() { |
|
50 | - // If the single instance hasn't been set, set it now. |
|
51 | - if ( null == self::$instance ) { |
|
52 | - self::$instance = new self(); |
|
53 | - } |
|
54 | - return self::$instance; |
|
55 | - } |
|
42 | + /** |
|
43 | + * Return an instance of this class. |
|
44 | + * |
|
45 | + * @since 1.0.0 |
|
46 | + * |
|
47 | + * @return object \lsx\sharing\classes\Frontend() A single instance of this class. |
|
48 | + */ |
|
49 | + public static function get_instance() { |
|
50 | + // If the single instance hasn't been set, set it now. |
|
51 | + if ( null == self::$instance ) { |
|
52 | + self::$instance = new self(); |
|
53 | + } |
|
54 | + return self::$instance; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Loads the plugin functions. |
|
59 | - */ |
|
60 | - private function load_classes() { |
|
61 | - include_once LSX_SHARING_PATH . '/classes/frontend/class-button.php'; |
|
62 | - include_once LSX_SHARING_PATH . '/classes/frontend/class-output.php'; |
|
63 | - $this->output = \lsx\sharing\classes\frontend\Output::get_instance(); |
|
64 | - } |
|
57 | + /** |
|
58 | + * Loads the plugin functions. |
|
59 | + */ |
|
60 | + private function load_classes() { |
|
61 | + include_once LSX_SHARING_PATH . '/classes/frontend/class-button.php'; |
|
62 | + include_once LSX_SHARING_PATH . '/classes/frontend/class-output.php'; |
|
63 | + $this->output = \lsx\sharing\classes\frontend\Output::get_instance(); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Backwards compatabile function for the sharing buttons. |
|
68 | - */ |
|
69 | - public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
|
70 | - wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()'); |
|
71 | - $this->output->sharing_buttons($buttons, $echo, $post_id); |
|
72 | - } |
|
66 | + /** |
|
67 | + * Backwards compatabile function for the sharing buttons. |
|
68 | + */ |
|
69 | + public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
|
70 | + wc_deprecated_function('LSX_Sharing_Frontend::sharing_buttons()', '1.2.0', 'lsx_sharing()->frontend->output->sharing_buttons()'); |
|
71 | + $this->output->sharing_buttons($buttons, $echo, $post_id); |
|
72 | + } |
|
73 | 73 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | 16 | if ( ! defined('WPINC') ) { |
17 | - die; |
|
17 | + die; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | define('LSX_SHARING_PATH', plugin_dir_path(__FILE__)); |
@@ -31,6 +31,6 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function lsx_sharing() { |
33 | 33 | $lsx_sharing = \lsx\sharing\Sharing::get_instance(); |
34 | - return $lsx_sharing; |
|
34 | + return $lsx_sharing; |
|
35 | 35 | } |
36 | 36 | lsx_sharing(); |
@@ -13,24 +13,24 @@ |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | -if ( ! defined('WPINC') ) { |
|
16 | +if(!defined('WPINC')){ |
|
17 | 17 | die; |
18 | 18 | } |
19 | 19 | |
20 | -define('LSX_SHARING_PATH', plugin_dir_path(__FILE__)); |
|
21 | -define('LSX_SHARING_CORE', __FILE__); |
|
22 | -define('LSX_SHARING_URL', plugin_dir_url(__FILE__)); |
|
23 | -define('LSX_SHARING_VER', '1.2.1'); |
|
20 | +define('LSX_SHARING_PATH',plugin_dir_path(__FILE__)); |
|
21 | +define('LSX_SHARING_CORE',__FILE__); |
|
22 | +define('LSX_SHARING_URL',plugin_dir_url(__FILE__)); |
|
23 | +define('LSX_SHARING_VER','1.2.1'); |
|
24 | 24 | |
25 | 25 | /* ======================= Below is the Plugin Class init ========================= */ |
26 | -require_once LSX_SHARING_PATH . '/classes/class-sharing.php'; |
|
26 | +require_once LSX_SHARING_PATH.'/classes/class-sharing.php'; |
|
27 | 27 | /** |
28 | 28 | * Returns and instance of the LSX Sharing plugin. |
29 | 29 | * |
30 | 30 | * @return object \lsx\sharing\Sharing(); |
31 | 31 | */ |
32 | -function lsx_sharing() { |
|
33 | - $lsx_sharing = \lsx\sharing\Sharing::get_instance(); |
|
32 | +function lsx_sharing(){ |
|
33 | + $lsx_sharing=\lsx\sharing\Sharing::get_instance(); |
|
34 | 34 | return $lsx_sharing; |
35 | 35 | } |
36 | 36 | lsx_sharing(); |
@@ -13,24 +13,24 @@ discard block |
||
13 | 13 | * @return array |
14 | 14 | */ |
15 | 15 | function get_restricted_post_types() { |
16 | - $post_types = array( |
|
17 | - 'page', |
|
18 | - 'attachment', |
|
19 | - 'forum', |
|
20 | - 'topic', |
|
21 | - 'lesson', |
|
22 | - 'quiz', |
|
23 | - 'question', |
|
24 | - 'reply', |
|
25 | - 'popup', |
|
26 | - 'sensei_message', |
|
27 | - 'envira', |
|
28 | - 'soliloquy', |
|
29 | - 'certificate_template', |
|
30 | - 'certificate', |
|
31 | - 'project', |
|
32 | - ); |
|
33 | - return apply_filters( 'lsx_sharing_get_restricted_post_types', $post_types ); |
|
16 | + $post_types = array( |
|
17 | + 'page', |
|
18 | + 'attachment', |
|
19 | + 'forum', |
|
20 | + 'topic', |
|
21 | + 'lesson', |
|
22 | + 'quiz', |
|
23 | + 'question', |
|
24 | + 'reply', |
|
25 | + 'popup', |
|
26 | + 'sensei_message', |
|
27 | + 'envira', |
|
28 | + 'soliloquy', |
|
29 | + 'certificate_template', |
|
30 | + 'certificate', |
|
31 | + 'project', |
|
32 | + ); |
|
33 | + return apply_filters( 'lsx_sharing_get_restricted_post_types', $post_types ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | * @return array |
40 | 40 | */ |
41 | 41 | function get_to_post_types() { |
42 | - $post_types = array( |
|
43 | - 'accommodation', |
|
44 | - 'tour', |
|
45 | - 'destination', |
|
46 | - 'review', |
|
47 | - 'special', |
|
48 | - 'vehicle', |
|
49 | - 'activity', |
|
50 | - ); |
|
51 | - return apply_filters( 'lsx_sharing_get_to_post_types', $post_types ); |
|
42 | + $post_types = array( |
|
43 | + 'accommodation', |
|
44 | + 'tour', |
|
45 | + 'destination', |
|
46 | + 'review', |
|
47 | + 'special', |
|
48 | + 'vehicle', |
|
49 | + 'activity', |
|
50 | + ); |
|
51 | + return apply_filters( 'lsx_sharing_get_to_post_types', $post_types ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | * @return array |
58 | 58 | */ |
59 | 59 | function get_hp_post_types() { |
60 | - $post_types = array( |
|
61 | - 'workout', |
|
62 | - 'exercise', |
|
63 | - 'recipe', |
|
64 | - 'meal', |
|
65 | - 'tip', |
|
66 | - ); |
|
67 | - return apply_filters( 'lsx_sharing_get_hp_post_types', $post_types ); |
|
60 | + $post_types = array( |
|
61 | + 'workout', |
|
62 | + 'exercise', |
|
63 | + 'recipe', |
|
64 | + 'meal', |
|
65 | + 'tip', |
|
66 | + ); |
|
67 | + return apply_filters( 'lsx_sharing_get_hp_post_types', $post_types ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * @return boolean |
74 | 74 | */ |
75 | 75 | function is_button_disabled( $post_type = '', $service = '' ) { |
76 | - $sharing = lsx_sharing(); |
|
77 | - $option = false; |
|
78 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_' . $service ] ) ) { |
|
79 | - $option = true; |
|
80 | - } elseif ( true === $sharing->is_new_options && ! empty( $sharing->options[ $post_type . '_disable_' . $service ] ) ) { |
|
81 | - $option = true; |
|
82 | - } |
|
83 | - return apply_filters( 'lsx_sharing_is_button_disabled', $option ); |
|
76 | + $sharing = lsx_sharing(); |
|
77 | + $option = false; |
|
78 | + if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_' . $service ] ) ) { |
|
79 | + $option = true; |
|
80 | + } elseif ( true === $sharing->is_new_options && ! empty( $sharing->options[ $post_type . '_disable_' . $service ] ) ) { |
|
81 | + $option = true; |
|
82 | + } |
|
83 | + return apply_filters( 'lsx_sharing_is_button_disabled', $option ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | * @return boolean |
90 | 90 | */ |
91 | 91 | function is_pt_disabled( $post_type = '' ) { |
92 | - $sharing = lsx_sharing(); |
|
93 | - $option = false; |
|
94 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_pt_' . $post_type ] ) ) { |
|
95 | - $option = true; |
|
96 | - } elseif ( true === $sharing->is_new_options && isset( $sharing->options[ $post_type . '_disable_pt' ] ) ) { |
|
97 | - $option = true; |
|
98 | - } |
|
99 | - return apply_filters( 'lsx_sharing_is_pt_disabled', $option ); |
|
92 | + $sharing = lsx_sharing(); |
|
93 | + $option = false; |
|
94 | + if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_pt_' . $post_type ] ) ) { |
|
95 | + $option = true; |
|
96 | + } elseif ( true === $sharing->is_new_options && isset( $sharing->options[ $post_type . '_disable_pt' ] ) ) { |
|
97 | + $option = true; |
|
98 | + } |
|
99 | + return apply_filters( 'lsx_sharing_is_pt_disabled', $option ); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @return boolean |
106 | 106 | */ |
107 | 107 | function is_disabled() { |
108 | - $sharing = lsx_sharing(); |
|
109 | - $option = false; |
|
110 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_disable_all'] ) ) { |
|
111 | - $option = true; |
|
112 | - } elseif ( true === $sharing->is_new_options && isset( $sharing->options['global_disable_all'] ) ) { |
|
113 | - $option = true; |
|
114 | - } |
|
115 | - return apply_filters( 'lsx_sharing_is_disabled', $option ); |
|
108 | + $sharing = lsx_sharing(); |
|
109 | + $option = false; |
|
110 | + if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_disable_all'] ) ) { |
|
111 | + $option = true; |
|
112 | + } elseif ( true === $sharing->is_new_options && isset( $sharing->options['global_disable_all'] ) ) { |
|
113 | + $option = true; |
|
114 | + } |
|
115 | + return apply_filters( 'lsx_sharing_is_disabled', $option ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | * @return string |
122 | 122 | */ |
123 | 123 | function get_sharing_text( $post_type = '' ) { |
124 | - $sharing = lsx_sharing(); |
|
125 | - $text = ''; |
|
126 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_label_text'] ) ) { |
|
127 | - $text = $sharing->options['display']['sharing_label_text']; |
|
128 | - } elseif ( true === $sharing->is_new_options ) { |
|
129 | - if ( isset( $sharing->options[ $post_type . '_label_text' ] ) ) { |
|
130 | - $text = $sharing->options[ $post_type . '_label_text' ]; |
|
131 | - } elseif ( isset( $sharing->options['global_label_text'] ) ) { |
|
132 | - $text = $sharing->options['global_label_text']; |
|
133 | - } |
|
134 | - } |
|
135 | - return $text; |
|
124 | + $sharing = lsx_sharing(); |
|
125 | + $text = ''; |
|
126 | + if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_label_text'] ) ) { |
|
127 | + $text = $sharing->options['display']['sharing_label_text']; |
|
128 | + } elseif ( true === $sharing->is_new_options ) { |
|
129 | + if ( isset( $sharing->options[ $post_type . '_label_text' ] ) ) { |
|
130 | + $text = $sharing->options[ $post_type . '_label_text' ]; |
|
131 | + } elseif ( isset( $sharing->options['global_label_text'] ) ) { |
|
132 | + $text = $sharing->options['global_label_text']; |
|
133 | + } |
|
134 | + } |
|
135 | + return $text; |
|
136 | 136 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @return array |
14 | 14 | */ |
15 | -function get_restricted_post_types() { |
|
16 | - $post_types = array( |
|
15 | +function get_restricted_post_types(){ |
|
16 | + $post_types=array( |
|
17 | 17 | 'page', |
18 | 18 | 'attachment', |
19 | 19 | 'forum', |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'certificate', |
31 | 31 | 'project', |
32 | 32 | ); |
33 | - return apply_filters( 'lsx_sharing_get_restricted_post_types', $post_types ); |
|
33 | + return apply_filters('lsx_sharing_get_restricted_post_types',$post_types); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return array |
40 | 40 | */ |
41 | -function get_to_post_types() { |
|
42 | - $post_types = array( |
|
41 | +function get_to_post_types(){ |
|
42 | + $post_types=array( |
|
43 | 43 | 'accommodation', |
44 | 44 | 'tour', |
45 | 45 | 'destination', |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'vehicle', |
49 | 49 | 'activity', |
50 | 50 | ); |
51 | - return apply_filters( 'lsx_sharing_get_to_post_types', $post_types ); |
|
51 | + return apply_filters('lsx_sharing_get_to_post_types',$post_types); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return array |
58 | 58 | */ |
59 | -function get_hp_post_types() { |
|
60 | - $post_types = array( |
|
59 | +function get_hp_post_types(){ |
|
60 | + $post_types=array( |
|
61 | 61 | 'workout', |
62 | 62 | 'exercise', |
63 | 63 | 'recipe', |
64 | 64 | 'meal', |
65 | 65 | 'tip', |
66 | 66 | ); |
67 | - return apply_filters( 'lsx_sharing_get_hp_post_types', $post_types ); |
|
67 | + return apply_filters('lsx_sharing_get_hp_post_types',$post_types); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return boolean |
74 | 74 | */ |
75 | -function is_button_disabled( $post_type = '', $service = '' ) { |
|
76 | - $sharing = lsx_sharing(); |
|
77 | - $option = false; |
|
78 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_' . $service ] ) ) { |
|
79 | - $option = true; |
|
80 | - } elseif ( true === $sharing->is_new_options && ! empty( $sharing->options[ $post_type . '_disable_' . $service ] ) ) { |
|
81 | - $option = true; |
|
75 | +function is_button_disabled($post_type='',$service=''){ |
|
76 | + $sharing=lsx_sharing(); |
|
77 | + $option=false; |
|
78 | + if(false===$sharing->is_new_options&&isset($sharing->options['display'])&&!empty($sharing->options['display']['sharing_disable_'.$service])){ |
|
79 | + $option=true; |
|
80 | + } elseif(true===$sharing->is_new_options&&!empty($sharing->options[$post_type.'_disable_'.$service])){ |
|
81 | + $option=true; |
|
82 | 82 | } |
83 | - return apply_filters( 'lsx_sharing_is_button_disabled', $option ); |
|
83 | + return apply_filters('lsx_sharing_is_button_disabled',$option); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return boolean |
90 | 90 | */ |
91 | -function is_pt_disabled( $post_type = '' ) { |
|
92 | - $sharing = lsx_sharing(); |
|
93 | - $option = false; |
|
94 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_pt_' . $post_type ] ) ) { |
|
95 | - $option = true; |
|
96 | - } elseif ( true === $sharing->is_new_options && isset( $sharing->options[ $post_type . '_disable_pt' ] ) ) { |
|
97 | - $option = true; |
|
91 | +function is_pt_disabled($post_type=''){ |
|
92 | + $sharing=lsx_sharing(); |
|
93 | + $option=false; |
|
94 | + if(false===$sharing->is_new_options&&isset($sharing->options['display'])&&!empty($sharing->options['display']['sharing_disable_pt_'.$post_type])){ |
|
95 | + $option=true; |
|
96 | + } elseif(true===$sharing->is_new_options&&isset($sharing->options[$post_type.'_disable_pt'])){ |
|
97 | + $option=true; |
|
98 | 98 | } |
99 | - return apply_filters( 'lsx_sharing_is_pt_disabled', $option ); |
|
99 | + return apply_filters('lsx_sharing_is_pt_disabled',$option); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return boolean |
106 | 106 | */ |
107 | -function is_disabled() { |
|
108 | - $sharing = lsx_sharing(); |
|
109 | - $option = false; |
|
110 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_disable_all'] ) ) { |
|
111 | - $option = true; |
|
112 | - } elseif ( true === $sharing->is_new_options && isset( $sharing->options['global_disable_all'] ) ) { |
|
113 | - $option = true; |
|
107 | +function is_disabled(){ |
|
108 | + $sharing=lsx_sharing(); |
|
109 | + $option=false; |
|
110 | + if(false===$sharing->is_new_options&&isset($sharing->options['display'])&&!empty($sharing->options['display']['sharing_disable_all'])){ |
|
111 | + $option=true; |
|
112 | + } elseif(true===$sharing->is_new_options&&isset($sharing->options['global_disable_all'])){ |
|
113 | + $option=true; |
|
114 | 114 | } |
115 | - return apply_filters( 'lsx_sharing_is_disabled', $option ); |
|
115 | + return apply_filters('lsx_sharing_is_disabled',$option); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string |
122 | 122 | */ |
123 | -function get_sharing_text( $post_type = '' ) { |
|
124 | - $sharing = lsx_sharing(); |
|
125 | - $text = ''; |
|
126 | - if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_label_text'] ) ) { |
|
127 | - $text = $sharing->options['display']['sharing_label_text']; |
|
128 | - } elseif ( true === $sharing->is_new_options ) { |
|
129 | - if ( isset( $sharing->options[ $post_type . '_label_text' ] ) ) { |
|
130 | - $text = $sharing->options[ $post_type . '_label_text' ]; |
|
131 | - } elseif ( isset( $sharing->options['global_label_text'] ) ) { |
|
132 | - $text = $sharing->options['global_label_text']; |
|
123 | +function get_sharing_text($post_type=''){ |
|
124 | + $sharing=lsx_sharing(); |
|
125 | + $text=''; |
|
126 | + if(false===$sharing->is_new_options&&isset($sharing->options['display'])&&!empty($sharing->options['display']['sharing_label_text'])){ |
|
127 | + $text=$sharing->options['display']['sharing_label_text']; |
|
128 | + } elseif(true===$sharing->is_new_options){ |
|
129 | + if(isset($sharing->options[$post_type.'_label_text'])){ |
|
130 | + $text=$sharing->options[$post_type.'_label_text']; |
|
131 | + } elseif(isset($sharing->options['global_label_text'])){ |
|
132 | + $text=$sharing->options['global_label_text']; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | return $text; |