@@ -1,156 +1,156 @@ |
||
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 $class = ''; } ?> |
37 | 37 | |
38 | - <?php if ( class_exists( 'LSX_Blog_Customizer' ) ) { ?> |
|
39 | - <?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'; ?> |
|
40 | - <li><a href="#ui-blog-customizer" class="<?php echo esc_attr( $class_active ); ?>"> |
|
41 | - <?php esc_html_e( 'Blog Customizer (posts widget)', 'lsx-sharing' ); ?></a></li> |
|
38 | + <?php if (class_exists('LSX_Blog_Customizer')) { ?> |
|
39 | + <?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'; ?> |
|
40 | + <li><a href="#ui-blog-customizer" class="<?php echo esc_attr($class_active); ?>"> |
|
41 | + <?php esc_html_e('Blog Customizer (posts widget)', 'lsx-sharing'); ?></a></li> |
|
42 | 42 | <?php } ?> |
43 | 43 | |
44 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { ?> |
|
45 | - <?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'; ?> |
|
46 | - <li><a href="#ui-sharing" class="<?php echo esc_attr( $class_active ); ?>"> |
|
47 | - <?php esc_html_e( 'Sharing', 'lsx-sharing' ); ?></a></li> |
|
44 | + <?php if (class_exists('LSX_Sharing')) { ?> |
|
45 | + <?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'; ?> |
|
46 | + <li><a href="#ui-sharing" class="<?php echo esc_attr($class_active); ?>"> |
|
47 | + <?php esc_html_e('Sharing', 'lsx-sharing'); ?></a></li> |
|
48 | 48 | <?php } ?> |
49 | 49 | |
50 | - <?php if ( class_exists( 'LSX_Videos' ) ) { ?> |
|
51 | - <?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'; ?> |
|
52 | - <li><a href="#ui-videos" class="<?php echo esc_attr( $class_active ); ?>"> |
|
53 | - <?php esc_html_e( 'Videos', 'lsx-sharing' ); ?></a></li> |
|
50 | + <?php if (class_exists('LSX_Videos')) { ?> |
|
51 | + <?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'; ?> |
|
52 | + <li><a href="#ui-videos" class="<?php echo esc_attr($class_active); ?>"> |
|
53 | + <?php esc_html_e('Videos', 'lsx-sharing'); ?></a></li> |
|
54 | 54 | <?php } ?> |
55 | 55 | </ul> |
56 | 56 | |
57 | - <?php if ( class_exists( 'LSX_Banners' ) ) { ?> |
|
57 | + <?php if (class_exists('LSX_Banners')) { ?> |
|
58 | 58 | <div id="ui-placeholders" class="ui-tab active"> |
59 | 59 | <table class="form-table"> |
60 | 60 | <tbody> |
61 | - <?php do_action( 'lsx_framework_display_tab_content', 'placeholders' ); ?> |
|
61 | + <?php do_action('lsx_framework_display_tab_content', 'placeholders'); ?> |
|
62 | 62 | </tbody> |
63 | 63 | </table> |
64 | 64 | </div> |
65 | 65 | <?php } ?> |
66 | 66 | |
67 | - <?php if ( class_exists( 'LSX_Currencies' ) ) { ?> |
|
68 | - <?php $class_active = class_exists( 'LSX_Banners' ) ? '' : 'active'; ?> |
|
69 | - <div id="ui-currencies" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
67 | + <?php if (class_exists('LSX_Currencies')) { ?> |
|
68 | + <?php $class_active = class_exists('LSX_Banners') ? '' : 'active'; ?> |
|
69 | + <div id="ui-currencies" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
70 | 70 | <table class="form-table"> |
71 | 71 | <tbody> |
72 | - <?php do_action( 'lsx_framework_display_tab_content', 'currency_switcher' ); ?> |
|
72 | + <?php do_action('lsx_framework_display_tab_content', 'currency_switcher'); ?> |
|
73 | 73 | </tbody> |
74 | 74 | </table> |
75 | 75 | </div> |
76 | 76 | <?php } ?> |
77 | 77 | |
78 | - <?php if ( class_exists( 'LSX_Team' ) ) { ?> |
|
79 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) ) ? '' : 'active'; ?> |
|
80 | - <div id="ui-team" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
78 | + <?php if (class_exists('LSX_Team')) { ?> |
|
79 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies')) ? '' : 'active'; ?> |
|
80 | + <div id="ui-team" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
81 | 81 | <table class="form-table"> |
82 | 82 | <tbody> |
83 | - <?php do_action( 'lsx_framework_display_tab_content', 'team' ); ?> |
|
83 | + <?php do_action('lsx_framework_display_tab_content', 'team'); ?> |
|
84 | 84 | </tbody> |
85 | 85 | </table> |
86 | 86 | </div> |
87 | 87 | <?php } ?> |
88 | 88 | |
89 | - <?php if ( class_exists( 'LSX_Testimonials' ) ) { ?> |
|
90 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) ) ? '' : 'active'; ?> |
|
91 | - <div id="ui-testimonials" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
89 | + <?php if (class_exists('LSX_Testimonials')) { ?> |
|
90 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team')) ? '' : 'active'; ?> |
|
91 | + <div id="ui-testimonials" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
92 | 92 | <table class="form-table"> |
93 | 93 | <tbody> |
94 | - <?php do_action( 'lsx_framework_display_tab_content', 'testimonials' ); ?> |
|
94 | + <?php do_action('lsx_framework_display_tab_content', 'testimonials'); ?> |
|
95 | 95 | </tbody> |
96 | 96 | </table> |
97 | 97 | </div> |
98 | 98 | <?php } ?> |
99 | 99 | |
100 | - <?php if ( class_exists( 'LSX_Projects' ) ) { ?> |
|
101 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) ) ? '' : 'active'; ?> |
|
102 | - <div id="ui-projects" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
100 | + <?php if (class_exists('LSX_Projects')) { ?> |
|
101 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials')) ? '' : 'active'; ?> |
|
102 | + <div id="ui-projects" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
103 | 103 | <table class="form-table"> |
104 | 104 | <tbody> |
105 | - <?php do_action( 'lsx_framework_display_tab_content', 'projects' ); ?> |
|
105 | + <?php do_action('lsx_framework_display_tab_content', 'projects'); ?> |
|
106 | 106 | </tbody> |
107 | 107 | </table> |
108 | 108 | </div> |
109 | 109 | <?php } ?> |
110 | 110 | |
111 | - <?php if ( class_exists( 'LSX_Services' ) ) { ?> |
|
112 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) ) ? '' : 'active'; ?> |
|
113 | - <div id="ui-services" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
111 | + <?php if (class_exists('LSX_Services')) { ?> |
|
112 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects')) ? '' : 'active'; ?> |
|
113 | + <div id="ui-services" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
114 | 114 | <table class="form-table"> |
115 | 115 | <tbody> |
116 | - <?php do_action( 'lsx_framework_display_tab_content', 'services' ); ?> |
|
116 | + <?php do_action('lsx_framework_display_tab_content', 'services'); ?> |
|
117 | 117 | </tbody> |
118 | 118 | </table> |
119 | 119 | </div> |
120 | 120 | <?php } ?> |
121 | 121 | |
122 | - <?php if ( class_exists( 'LSX_Blog_Customizer' ) ) { ?> |
|
123 | - <?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'; ?> |
|
124 | - <div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
122 | + <?php if (class_exists('LSX_Blog_Customizer')) { ?> |
|
123 | + <?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'; ?> |
|
124 | + <div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
125 | 125 | <table class="form-table"> |
126 | 126 | <tbody> |
127 | - <?php do_action( 'lsx_framework_display_tab_content', 'blog-customizer' ); ?> |
|
127 | + <?php do_action('lsx_framework_display_tab_content', 'blog-customizer'); ?> |
|
128 | 128 | </tbody> |
129 | 129 | </table> |
130 | 130 | </div> |
131 | 131 | <?php } ?> |
132 | 132 | |
133 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { ?> |
|
134 | - <?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'; ?> |
|
135 | - <div id="ui-sharing" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
133 | + <?php if (class_exists('LSX_Sharing')) { ?> |
|
134 | + <?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'; ?> |
|
135 | + <div id="ui-sharing" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
136 | 136 | <table class="form-table"> |
137 | 137 | <tbody> |
138 | - <?php do_action( 'lsx_framework_display_tab_content', 'sharing' ); ?> |
|
138 | + <?php do_action('lsx_framework_display_tab_content', 'sharing'); ?> |
|
139 | 139 | </tbody> |
140 | 140 | </table> |
141 | 141 | </div> |
142 | 142 | <?php } ?> |
143 | 143 | |
144 | - <?php if ( class_exists( 'LSX_Videos' ) ) { ?> |
|
145 | - <?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'; ?> |
|
146 | - <div id="ui-videos" class="ui-tab <?php echo esc_attr( $class_active ); ?>"> |
|
144 | + <?php if (class_exists('LSX_Videos')) { ?> |
|
145 | + <?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'; ?> |
|
146 | + <div id="ui-videos" class="ui-tab <?php echo esc_attr($class_active); ?>"> |
|
147 | 147 | <table class="form-table"> |
148 | 148 | <tbody> |
149 | - <?php do_action( 'lsx_framework_display_tab_content', 'videos' ); ?> |
|
149 | + <?php do_action('lsx_framework_display_tab_content', 'videos'); ?> |
|
150 | 150 | </tbody> |
151 | 151 | </table> |
152 | 152 | </div> |
153 | 153 | <?php } ?> |
154 | 154 | |
155 | - <?php do_action( 'lsx_framework_display_tab_bottom', 'display' ); ?> |
|
155 | + <?php do_action('lsx_framework_display_tab_bottom', 'display'); ?> |
|
156 | 156 | </div> |
@@ -13,14 +13,14 @@ |
||
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.1.3' ); |
|
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.1.3'); |
|
24 | 24 | |
25 | 25 | /* ======================= Below is the Plugin Class init ========================= */ |
26 | 26 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @package lsx-sharing |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! class_exists( 'LSX_Sharing' ) ) { |
|
8 | +if ( ! class_exists('LSX_Sharing')) { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * LSX Sharing class. |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package lsx-sharing |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! class_exists( 'LSX_Sharing_Admin' ) ) { |
|
8 | +if ( ! class_exists('LSX_Sharing_Admin')) { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * LSX Sharing admin class. |
@@ -18,24 +18,24 @@ discard block |
||
18 | 18 | * Constructor. |
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | - add_action( 'init', array( $this, 'set_options' ), 50 ); |
|
22 | - add_action( 'init', array( $this, 'create_settings_page' ), 100 ); |
|
21 | + add_action('init', array($this, 'set_options'), 50); |
|
22 | + add_action('init', array($this, 'create_settings_page'), 100); |
|
23 | 23 | |
24 | - add_filter( 'lsx_to_framework_settings_tabs', array( $this, 'register_tabs' ), 100, 1 ); |
|
25 | - add_filter( 'lsx_framework_settings_tabs', array( $this, 'register_tabs' ), 100, 1 ); |
|
24 | + add_filter('lsx_to_framework_settings_tabs', array($this, 'register_tabs'), 100, 1); |
|
25 | + add_filter('lsx_framework_settings_tabs', array($this, 'register_tabs'), 100, 1); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Set options. |
30 | 30 | */ |
31 | 31 | public function set_options() { |
32 | - if ( function_exists( 'tour_operator' ) ) { |
|
33 | - $this->options = get_option( '_lsx-to_settings', false ); |
|
32 | + if (function_exists('tour_operator')) { |
|
33 | + $this->options = get_option('_lsx-to_settings', false); |
|
34 | 34 | } else { |
35 | - $this->options = get_option( '_lsx_settings', false ); |
|
35 | + $this->options = get_option('_lsx_settings', false); |
|
36 | 36 | |
37 | - if ( false === $this->options ) { |
|
38 | - $this->options = get_option( '_lsx_lsx-settings', false ); |
|
37 | + if (false === $this->options) { |
|
38 | + $this->options = get_option('_lsx_lsx-settings', false); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | * Returns the array of settings to the UIX Class. |
45 | 45 | */ |
46 | 46 | public function create_settings_page() { |
47 | - if ( is_admin() ) { |
|
48 | - if ( ! class_exists( '\lsx\ui\uix' ) && ! function_exists( 'tour_operator' ) ) { |
|
47 | + if (is_admin()) { |
|
48 | + if ( ! class_exists('\lsx\ui\uix') && ! function_exists('tour_operator')) { |
|
49 | 49 | include_once LSX_SHARING_PATH . 'vendor/uix/uix.php'; |
50 | 50 | $pages = $this->settings_page_array(); |
51 | - $uix = \lsx\ui\uix::get_instance( 'lsx' ); |
|
52 | - $uix->register_pages( $pages ); |
|
51 | + $uix = \lsx\ui\uix::get_instance('lsx'); |
|
52 | + $uix->register_pages($pages); |
|
53 | 53 | } |
54 | 54 | |
55 | - if ( function_exists( 'tour_operator' ) ) { |
|
56 | - add_action( 'lsx_to_framework_display_tab_content', array( $this, 'display_settings' ), 11 ); |
|
55 | + if (function_exists('tour_operator')) { |
|
56 | + add_action('lsx_to_framework_display_tab_content', array($this, 'display_settings'), 11); |
|
57 | 57 | } else { |
58 | - add_action( 'lsx_framework_display_tab_content', array( $this, 'display_settings' ), 11 ); |
|
58 | + add_action('lsx_framework_display_tab_content', array($this, 'display_settings'), 11); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | * Returns the array of settings to the UIX Class. |
65 | 65 | */ |
66 | 66 | public function settings_page_array() { |
67 | - $tabs = apply_filters( 'lsx_framework_settings_tabs', array() ); |
|
67 | + $tabs = apply_filters('lsx_framework_settings_tabs', array()); |
|
68 | 68 | |
69 | 69 | return array( |
70 | 70 | 'settings' => array( |
71 | - 'page_title' => esc_html__( 'Theme Options', 'lsx-sharing' ), |
|
72 | - 'menu_title' => esc_html__( 'Theme Options', 'lsx-sharing' ), |
|
71 | + 'page_title' => esc_html__('Theme Options', 'lsx-sharing'), |
|
72 | + 'menu_title' => esc_html__('Theme Options', 'lsx-sharing'), |
|
73 | 73 | 'capability' => 'manage_options', |
74 | 74 | 'icon' => 'dashicons-book-alt', |
75 | 75 | 'parent' => 'themes.php', |
76 | - 'save_button' => esc_html__( 'Save Changes', 'lsx-sharing' ), |
|
76 | + 'save_button' => esc_html__('Save Changes', 'lsx-sharing'), |
|
77 | 77 | 'tabs' => $tabs, |
78 | 78 | ), |
79 | 79 | ); |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * Register tabs. |
84 | 84 | */ |
85 | - public function register_tabs( $tabs ) { |
|
85 | + public function register_tabs($tabs) { |
|
86 | 86 | $default = true; |
87 | 87 | |
88 | - if ( false !== $tabs && is_array( $tabs ) && count( $tabs ) > 0 ) { |
|
88 | + if (false !== $tabs && is_array($tabs) && count($tabs) > 0) { |
|
89 | 89 | $default = false; |
90 | 90 | } |
91 | 91 | |
92 | - if ( ! function_exists( 'tour_operator' ) ) { |
|
93 | - if ( ! array_key_exists( 'display', $tabs ) ) { |
|
92 | + if ( ! function_exists('tour_operator')) { |
|
93 | + if ( ! array_key_exists('display', $tabs)) { |
|
94 | 94 | $tabs['display'] = array( |
95 | 95 | 'page_title' => '', |
96 | 96 | 'page_description' => '', |
97 | - 'menu_title' => esc_html__( 'Display', 'lsx-sharing' ), |
|
97 | + 'menu_title' => esc_html__('Display', 'lsx-sharing'), |
|
98 | 98 | 'template' => LSX_SHARING_PATH . 'includes/settings/display.php', |
99 | 99 | 'default' => $default, |
100 | 100 | ); |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * Outputs the display tabs settings. |
111 | 111 | */ |
112 | - public function display_settings( $tab = 'general' ) { |
|
113 | - if ( 'sharing' === $tab ) { |
|
112 | + public function display_settings($tab = 'general') { |
|
113 | + if ('sharing' === $tab) { |
|
114 | 114 | $this->general_fields(); |
115 | 115 | $this->post_type_fields_disable_all(); |
116 | 116 | $this->post_type_fields(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ?> |
126 | 126 | <tr class="form-field"> |
127 | 127 | <th scope="row"> |
128 | - <label for="sharing_label_text"><?php esc_html_e( 'Label text', 'lsx-sharing' ); ?></label> |
|
128 | + <label for="sharing_label_text"><?php esc_html_e('Label text', 'lsx-sharing'); ?></label> |
|
129 | 129 | </th> |
130 | 130 | <td> |
131 | 131 | <input type="text" {{#if sharing_label_text}} value="{{sharing_label_text}}" {{/if}} name="sharing_label_text" /> |
@@ -159,16 +159,16 @@ discard block |
||
159 | 159 | ?> |
160 | 160 | <tr class="form-field"> |
161 | 161 | <th scope="row" colspan="2"> |
162 | - <h3><?php esc_html_e( 'Disable all share buttons on the site', 'lsx-sharing' ); ?></h3> |
|
162 | + <h3><?php esc_html_e('Disable all share buttons on the site', 'lsx-sharing'); ?></h3> |
|
163 | 163 | </th> |
164 | 164 | </tr> |
165 | 165 | <tr class="form-field"> |
166 | 166 | <th scope="row"> |
167 | - <label for="sharing_disable_all"><?php esc_html_e( 'Disable All', 'lsx-sharing' ); ?></label> |
|
167 | + <label for="sharing_disable_all"><?php esc_html_e('Disable All', 'lsx-sharing'); ?></label> |
|
168 | 168 | </th> |
169 | 169 | <td> |
170 | 170 | <input type="checkbox" {{#if sharing_disable_all}} checked="checked" {{/if}} name="sharing_disable_all" /> |
171 | - <small><?php esc_html_e( 'Disable All share button.', 'lsx-sharing' ); ?></small> |
|
171 | + <small><?php esc_html_e('Disable All share button.', 'lsx-sharing'); ?></small> |
|
172 | 172 | </td> |
173 | 173 | </tr> |
174 | 174 | <?php |
@@ -181,33 +181,33 @@ discard block |
||
181 | 181 | ?> |
182 | 182 | <tr class="form-field"> |
183 | 183 | <th scope="row" colspan="2"> |
184 | - <h3><?php esc_html_e( 'Disable share buttons by post type', 'lsx-sharing' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Disable share buttons by post type', 'lsx-sharing'); ?></h3> |
|
185 | 185 | </th> |
186 | 186 | </tr> |
187 | 187 | <?php |
188 | - $post_types = get_post_types( array( |
|
188 | + $post_types = get_post_types(array( |
|
189 | 189 | 'public' => true, |
190 | - ) ); |
|
190 | + )); |
|
191 | 191 | |
192 | - $key = array_search( 'attachment', $post_types, true ); |
|
192 | + $key = array_search('attachment', $post_types, true); |
|
193 | 193 | |
194 | - if ( false !== $key ) { |
|
195 | - unset( $post_types[ $key ] ); |
|
194 | + if (false !== $key) { |
|
195 | + unset($post_types[$key]); |
|
196 | 196 | } |
197 | 197 | ?> |
198 | - <?php foreach ( $post_types as $key => $value ) : ?> |
|
198 | + <?php foreach ($post_types as $key => $value) : ?> |
|
199 | 199 | <tr class="form-field"> |
200 | 200 | <th scope="row"> |
201 | - <label for="sharing_disable_pt_<?php echo esc_attr( $key ); ?>"><?php echo esc_html( ucfirst( $key ) ); ?></label> |
|
201 | + <label for="sharing_disable_pt_<?php echo esc_attr($key); ?>"><?php echo esc_html(ucfirst($key)); ?></label> |
|
202 | 202 | </th> |
203 | 203 | <td> |
204 | - <input type="checkbox" {{#if sharing_disable_pt_<?php echo esc_attr( $key ); ?>}} checked="checked" {{/if}} name="sharing_disable_pt_<?php echo esc_attr( $key ); ?>" /> |
|
204 | + <input type="checkbox" {{#if sharing_disable_pt_<?php echo esc_attr($key); ?>}} checked="checked" {{/if}} name="sharing_disable_pt_<?php echo esc_attr($key); ?>" /> |
|
205 | 205 | <small> |
206 | 206 | <?php |
207 | 207 | printf( |
208 | 208 | /* Translators: 1: post type */ |
209 | - esc_html__( 'Disable share buttons on post type: %s', 'lsx-sharing' ), |
|
210 | - esc_html( $key ) |
|
209 | + esc_html__('Disable share buttons on post type: %s', 'lsx-sharing'), |
|
210 | + esc_html($key) |
|
211 | 211 | ); |
212 | 212 | ?> |
213 | 213 | </small> |
@@ -224,34 +224,34 @@ discard block |
||
224 | 224 | ?> |
225 | 225 | <tr class="form-field"> |
226 | 226 | <th scope="row" colspan="2"> |
227 | - <h3><?php esc_html_e( 'Disable share buttons by social network', 'lsx-sharing' ); ?></h3> |
|
227 | + <h3><?php esc_html_e('Disable share buttons by social network', 'lsx-sharing'); ?></h3> |
|
228 | 228 | </th> |
229 | 229 | </tr> |
230 | 230 | <tr class="form-field"> |
231 | 231 | <th scope="row"> |
232 | - <label for="sharing_disable_facebook"><?php esc_html_e( 'Disable Facebook', 'lsx-sharing' ); ?></label> |
|
232 | + <label for="sharing_disable_facebook"><?php esc_html_e('Disable Facebook', 'lsx-sharing'); ?></label> |
|
233 | 233 | </th> |
234 | 234 | <td> |
235 | 235 | <input type="checkbox" {{#if sharing_disable_facebook}} checked="checked" {{/if}} name="sharing_disable_facebook" /> |
236 | - <small><?php esc_html_e( 'Disable Facebook share button.', 'lsx-sharing' ); ?></small> |
|
236 | + <small><?php esc_html_e('Disable Facebook share button.', 'lsx-sharing'); ?></small> |
|
237 | 237 | </td> |
238 | 238 | </tr> |
239 | 239 | <tr class="form-field"> |
240 | 240 | <th scope="row"> |
241 | - <label for="sharing_disable_twitter"><?php esc_html_e( 'Disable Twitter', 'lsx-sharing' ); ?></label> |
|
241 | + <label for="sharing_disable_twitter"><?php esc_html_e('Disable Twitter', 'lsx-sharing'); ?></label> |
|
242 | 242 | </th> |
243 | 243 | <td> |
244 | 244 | <input type="checkbox" {{#if sharing_disable_twitter}} checked="checked" {{/if}} name="sharing_disable_twitter" /> |
245 | - <small><?php esc_html_e( 'Disable Twitter share button.', 'lsx-sharing' ); ?></small> |
|
245 | + <small><?php esc_html_e('Disable Twitter share button.', 'lsx-sharing'); ?></small> |
|
246 | 246 | </td> |
247 | 247 | </tr> |
248 | 248 | <tr class="form-field"> |
249 | 249 | <th scope="row"> |
250 | - <label for="sharing_disable_pinterest"><?php esc_html_e( 'Disable Pinterest', 'lsx-sharing' ); ?></label> |
|
250 | + <label for="sharing_disable_pinterest"><?php esc_html_e('Disable Pinterest', 'lsx-sharing'); ?></label> |
|
251 | 251 | </th> |
252 | 252 | <td> |
253 | 253 | <input type="checkbox" {{#if sharing_disable_pinterest}} checked="checked" {{/if}} name="sharing_disable_pinterest" /> |
254 | - <small><?php esc_html_e( 'Disable Pinterest share button.', 'lsx-sharing' ); ?></small> |
|
254 | + <small><?php esc_html_e('Disable Pinterest share button.', 'lsx-sharing'); ?></small> |
|
255 | 255 | </td> |
256 | 256 | </tr> |
257 | 257 | <?php |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package lsx-sharing |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! class_exists( 'LSX_Sharing_Frontend' ) ) { |
|
8 | +if ( ! class_exists('LSX_Sharing_Frontend')) { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * LSX Sharing front-end class. |
@@ -18,31 +18,31 @@ discard block |
||
18 | 18 | * Constructor. |
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | - add_action( 'init', array( $this, 'set_options' ), 50 ); |
|
22 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
21 | + add_action('init', array($this, 'set_options'), 50); |
|
22 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
23 | 23 | |
24 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
24 | + add_filter('wp_kses_allowed_html', array($this, 'wp_kses_allowed_html'), 10, 2); |
|
25 | 25 | |
26 | - add_shortcode( 'lsx_sharing_buttons', array( $this, 'sharing_buttons_shortcode' ) ); |
|
26 | + add_shortcode('lsx_sharing_buttons', array($this, 'sharing_buttons_shortcode')); |
|
27 | 27 | |
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 | |
31 | 31 | // WooCommerce. |
32 | - add_action( 'woocommerce_share', array( $this, 'sharing_buttons_template' ) ); |
|
32 | + add_action('woocommerce_share', array($this, 'sharing_buttons_template')); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Set options. |
37 | 37 | */ |
38 | 38 | public function set_options() { |
39 | - if ( function_exists( 'tour_operator' ) ) { |
|
40 | - $this->options = get_option( '_lsx-to_settings', false ); |
|
39 | + if (function_exists('tour_operator')) { |
|
40 | + $this->options = get_option('_lsx-to_settings', false); |
|
41 | 41 | } else { |
42 | - $this->options = get_option( '_lsx_settings', false ); |
|
42 | + $this->options = get_option('_lsx_settings', false); |
|
43 | 43 | |
44 | - if ( false === $this->options ) { |
|
45 | - $this->options = get_option( '_lsx_lsx-settings', false ); |
|
44 | + if (false === $this->options) { |
|
45 | + $this->options = get_option('_lsx_lsx-settings', false); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
@@ -56,37 +56,37 @@ discard block |
||
56 | 56 | global $post; |
57 | 57 | $post_id = false; |
58 | 58 | $share_post = $post; |
59 | - if ( false !== $post_id ) { |
|
60 | - $share_post = get_post( $post_id ); |
|
61 | - $post_type = get_post_type( $post_id ); |
|
59 | + if (false !== $post_id) { |
|
60 | + $share_post = get_post($post_id); |
|
61 | + $post_type = get_post_type($post_id); |
|
62 | 62 | } else { |
63 | 63 | $post_type = get_post_type(); |
64 | 64 | } |
65 | 65 | |
66 | - if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) { |
|
66 | + if (defined('WP_DEBUG') && true === WP_DEBUG) { |
|
67 | 67 | $min = ''; |
68 | 68 | } else { |
69 | 69 | $min = '.min'; |
70 | 70 | } |
71 | 71 | |
72 | 72 | /* Remove assets completely if all sharing options are off */ |
73 | - if ( isset( $this->options['display'] ) && ! empty( $this->options['display']['sharing_disable_all'] ) ) { |
|
73 | + if (isset($this->options['display']) && ! empty($this->options['display']['sharing_disable_all'])) { |
|
74 | 74 | return ''; |
75 | 75 | } |
76 | 76 | |
77 | 77 | /* Only show the assets if the post type sharing option is on */ |
78 | - if ( isset( $this->options['display'] ) && empty( $this->options['display'][ 'sharing_disable_pt_' . $post_type ] ) ) { |
|
78 | + if (isset($this->options['display']) && empty($this->options['display']['sharing_disable_pt_' . $post_type])) { |
|
79 | 79 | |
80 | - wp_enqueue_script( 'lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array( 'jquery' ), LSX_SHARING_VER, true ); |
|
80 | + wp_enqueue_script('lsx-sharing', LSX_SHARING_URL . 'assets/js/lsx-sharing' . $min . '.js', array('jquery'), LSX_SHARING_VER, true); |
|
81 | 81 | |
82 | - $params = apply_filters( 'lsx_sharing_js_params', array( |
|
83 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
82 | + $params = apply_filters('lsx_sharing_js_params', array( |
|
83 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
84 | 84 | )); |
85 | 85 | |
86 | - wp_localize_script( 'lsx-sharing', 'lsx_sharing_params', $params ); |
|
86 | + wp_localize_script('lsx-sharing', 'lsx_sharing_params', $params); |
|
87 | 87 | |
88 | - wp_enqueue_style( 'lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER ); |
|
89 | - wp_style_add_data( 'lsx-sharing', 'rtl', 'replace' ); |
|
88 | + wp_enqueue_style('lsx-sharing', LSX_SHARING_URL . 'assets/css/lsx-sharing.css', array(), LSX_SHARING_VER); |
|
89 | + wp_style_add_data('lsx-sharing', 'rtl', 'replace'); |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
@@ -95,48 +95,48 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * Display/return sharing buttons. |
97 | 97 | */ |
98 | - public function sharing_buttons( $buttons = array( 'facebook', 'twitter', 'pinterest' ), $echo = false, $post_id = false ) { |
|
98 | + public function sharing_buttons($buttons = array('facebook', 'twitter', 'pinterest'), $echo = false, $post_id = false) { |
|
99 | 99 | $sharing_content = ''; |
100 | 100 | |
101 | - if ( ( is_preview() || is_admin() ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
101 | + if ((is_preview() || is_admin()) && ! (defined('DOING_AJAX') && DOING_AJAX)) { |
|
102 | 102 | return ''; |
103 | 103 | } |
104 | 104 | |
105 | 105 | //Set our variables |
106 | 106 | global $post; |
107 | 107 | $share_post = $post; |
108 | - if ( false !== $post_id ) { |
|
109 | - $share_post = get_post( $post_id ); |
|
110 | - $post_type = get_post_type( $post_id ); |
|
108 | + if (false !== $post_id) { |
|
109 | + $share_post = get_post($post_id); |
|
110 | + $post_type = get_post_type($post_id); |
|
111 | 111 | } else { |
112 | 112 | $post_type = get_post_type(); |
113 | 113 | } |
114 | 114 | |
115 | - if ( isset( $this->options['display'] ) && ! empty( $this->options['display'][ 'sharing_disable_pt_' . $post_type ] ) && ! empty( $this->options['display']['sharing_disable_all'] ) ) { |
|
115 | + if (isset($this->options['display']) && ! empty($this->options['display']['sharing_disable_pt_' . $post_type]) && ! empty($this->options['display']['sharing_disable_all'])) { |
|
116 | 116 | return ''; |
117 | 117 | } |
118 | 118 | |
119 | - if ( ( is_array( $buttons ) && count( $buttons ) > 0 ) && empty( $this->options['display'][ 'sharing_disable_pt_' . $post_type ] ) && empty( $this->options['display']['sharing_disable_all'] ) ) { |
|
119 | + if ((is_array($buttons) && count($buttons) > 0) && empty($this->options['display']['sharing_disable_pt_' . $post_type]) && empty($this->options['display']['sharing_disable_all'])) { |
|
120 | 120 | $sharing_content .= '<div class="lsx-sharing-content"><p>'; |
121 | 121 | |
122 | - if ( isset( $this->options['display'] ) && ! empty( $this->options['display']['sharing_label_text'] ) ) { |
|
122 | + if (isset($this->options['display']) && ! empty($this->options['display']['sharing_label_text'])) { |
|
123 | 123 | $sharing_content .= '<span class="lsx-sharing-label">' . $this->options['display']['sharing_label_text'] . '</span>'; |
124 | 124 | } |
125 | 125 | |
126 | - foreach ( $buttons as $id => $button ) { |
|
127 | - $button_obj = new LSX_Sharing_Button( $button, $this->options ); |
|
126 | + foreach ($buttons as $id => $button) { |
|
127 | + $button_obj = new LSX_Sharing_Button($button, $this->options); |
|
128 | 128 | |
129 | - if ( ! empty( $button_obj ) ) { |
|
130 | - $url = $button_obj->get_link( $share_post ); |
|
129 | + if ( ! empty($button_obj)) { |
|
130 | + $url = $button_obj->get_link($share_post); |
|
131 | 131 | |
132 | - if ( ! empty( $url ) ) { |
|
133 | - if ( 'email' === $button ) { |
|
134 | - if ( ! isset( $this->options['display'] ) || empty( $this->options['display']['sharing_email_form_id'] ) ) { |
|
132 | + if ( ! empty($url)) { |
|
133 | + if ('email' === $button) { |
|
134 | + if ( ! isset($this->options['display']) || empty($this->options['display']['sharing_email_form_id'])) { |
|
135 | 135 | continue; |
136 | 136 | } |
137 | - $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>'; |
|
137 | + $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>'; |
|
138 | 138 | } else { |
139 | - $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>'; |
|
139 | + $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>'; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | $sharing_content .= '</p></div>'; |
146 | 146 | } |
147 | 147 | |
148 | - if ( $echo ) { |
|
149 | - echo wp_kses_post( $sharing_content ); |
|
148 | + if ($echo) { |
|
149 | + echo wp_kses_post($sharing_content); |
|
150 | 150 | } else { |
151 | 151 | return $sharing_content; |
152 | 152 | } |
@@ -155,20 +155,20 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * Sharing buttons shortcode. |
157 | 157 | */ |
158 | - public function sharing_buttons_shortcode( $atts ) { |
|
159 | - $atts = shortcode_atts( array( |
|
158 | + public function sharing_buttons_shortcode($atts) { |
|
159 | + $atts = shortcode_atts(array( |
|
160 | 160 | 'buttons' => '', |
161 | - ), $atts, 'lsx_sharing_buttons' ); |
|
161 | + ), $atts, 'lsx_sharing_buttons'); |
|
162 | 162 | |
163 | - if ( empty( $atts['buttons'] ) ) { |
|
163 | + if (empty($atts['buttons'])) { |
|
164 | 164 | return ''; |
165 | 165 | } |
166 | 166 | |
167 | - $no_whitespaces = preg_replace( '/\s*,\s*/', ',', filter_var( $atts['buttons'], FILTER_SANITIZE_STRING ) ); |
|
168 | - $buttons = explode( ',', $no_whitespaces ); |
|
167 | + $no_whitespaces = preg_replace('/\s*,\s*/', ',', filter_var($atts['buttons'], FILTER_SANITIZE_STRING)); |
|
168 | + $buttons = explode(',', $no_whitespaces); |
|
169 | 169 | |
170 | - if ( is_array( $buttons ) && count( $buttons ) > 0 ) { |
|
171 | - return $this->sharing_buttons( $buttons ); |
|
170 | + if (is_array($buttons) && count($buttons) > 0) { |
|
171 | + return $this->sharing_buttons($buttons); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | * Display buttons (template hook). |
177 | 177 | */ |
178 | 178 | public function sharing_buttons_template() { |
179 | - echo wp_kses_post( $this->sharing_buttons() ); |
|
179 | + echo wp_kses_post($this->sharing_buttons()); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | 183 | * Allow data params for Bootstrap modal. |
184 | 184 | */ |
185 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
185 | + public function wp_kses_allowed_html($allowedtags, $context) { |
|
186 | 186 | $allowedtags['a']['data-toggle'] = true; |
187 | 187 | $allowedtags['a']['data-link'] = true; |
188 | 188 | return $allowedtags; |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package lsx-sharing |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! class_exists( 'LSX_Sharing_Button' ) ) { |
|
8 | +if ( ! class_exists('LSX_Sharing_Button')) { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * LSX Sharing buttons class. |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * Constructor. |
37 | 37 | */ |
38 | - public function __construct( $service, $options ) { |
|
38 | + public function __construct($service, $options) { |
|
39 | 39 | $this->options = $options; |
40 | 40 | |
41 | - if ( ! in_array( $service, $this->services, true ) ) { |
|
41 | + if ( ! in_array($service, $this->services, true)) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - if ( isset( $this->options['display'] ) && ! empty( $this->options['display'][ 'sharing_disable_' . $service ] ) ) { |
|
45 | + if (isset($this->options['display']) && ! empty($this->options['display']['sharing_disable_' . $service])) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
@@ -52,42 +52,42 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Get service link to share. |
54 | 54 | */ |
55 | - public function get_link( $post ) { |
|
56 | - if ( empty( $post ) ) { |
|
55 | + public function get_link($post) { |
|
56 | + if (empty($post)) { |
|
57 | 57 | return ''; |
58 | 58 | } |
59 | 59 | |
60 | - if ( 'email' === $this->service ) { |
|
61 | - return $this->get_link_email( $post ); |
|
62 | - } elseif ( 'facebook' === $this->service ) { |
|
63 | - return $this->get_link_facebook( $post ); |
|
64 | - } elseif ( 'twitter' === $this->service ) { |
|
65 | - return $this->get_link_twitter( $post ); |
|
66 | - } elseif ( 'pinterest' === $this->service ) { |
|
67 | - return $this->get_link_pinterest( $post ); |
|
60 | + if ('email' === $this->service) { |
|
61 | + return $this->get_link_email($post); |
|
62 | + } elseif ('facebook' === $this->service) { |
|
63 | + return $this->get_link_facebook($post); |
|
64 | + } elseif ('twitter' === $this->service) { |
|
65 | + return $this->get_link_twitter($post); |
|
66 | + } elseif ('pinterest' === $this->service) { |
|
67 | + return $this->get_link_pinterest($post); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Get Facebook link to share. |
73 | 73 | */ |
74 | - public function get_link_facebook( $post ) { |
|
75 | - $permalink = get_permalink( $post->ID ); |
|
76 | - $permalink = apply_filters( 'lsx_sharing_facebook_url', $permalink, $post ); |
|
77 | - $title = apply_filters( 'the_title', $post->post_title ); |
|
74 | + public function get_link_facebook($post) { |
|
75 | + $permalink = get_permalink($post->ID); |
|
76 | + $permalink = apply_filters('lsx_sharing_facebook_url', $permalink, $post); |
|
77 | + $title = apply_filters('the_title', $post->post_title); |
|
78 | 78 | |
79 | - return 'https://www.facebook.com/sharer.php?display=page&u=' . rawurlencode( $permalink ) . '&t=' . rawurlencode( $title ); |
|
79 | + return 'https://www.facebook.com/sharer.php?display=page&u=' . rawurlencode($permalink) . '&t=' . rawurlencode($title); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Get Twitter link to share. |
84 | 84 | */ |
85 | - public function get_link_twitter( $post ) { |
|
86 | - $permalink = get_permalink( $post->ID ); |
|
87 | - $permalink = apply_filters( 'lsx_sharing_twitter_url', $permalink, $post ); |
|
88 | - $title = apply_filters( 'the_title', $post->post_title ); |
|
85 | + public function get_link_twitter($post) { |
|
86 | + $permalink = get_permalink($post->ID); |
|
87 | + $permalink = apply_filters('lsx_sharing_twitter_url', $permalink, $post); |
|
88 | + $title = apply_filters('the_title', $post->post_title); |
|
89 | 89 | |
90 | - if ( function_exists( 'mb_stripos' ) ) { |
|
90 | + if (function_exists('mb_stripos')) { |
|
91 | 91 | $strlen = 'mb_strlen'; |
92 | 92 | $substr = 'mb_substr'; |
93 | 93 | } else { |
@@ -97,34 +97,34 @@ discard block |
||
97 | 97 | |
98 | 98 | $short_url_length = 24; |
99 | 99 | |
100 | - if ( ( $strlen( $title ) + $short_url_length ) > 140 ) { |
|
101 | - $text = $substr( $title, 0, ( 140 - $short_url_length - 1 ) ) . "\xE2\x80\xA6"; |
|
100 | + if (($strlen($title) + $short_url_length) > 140) { |
|
101 | + $text = $substr($title, 0, (140 - $short_url_length - 1)) . "\xE2\x80\xA6"; |
|
102 | 102 | } else { |
103 | 103 | $text = $title; |
104 | 104 | } |
105 | 105 | |
106 | - return 'https://twitter.com/intent/tweet?text=' . rawurlencode( $text ) . '&url=' . rawurlencode( $permalink ); |
|
106 | + return 'https://twitter.com/intent/tweet?text=' . rawurlencode($text) . '&url=' . rawurlencode($permalink); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Get Pinterest link to share. |
111 | 111 | */ |
112 | - public function get_link_pinterest( $post ) { |
|
113 | - $permalink = get_permalink( $post->ID ); |
|
114 | - $permalink = apply_filters( 'lsx_sharing_pinterest_url', $permalink, $post ); |
|
115 | - $title = apply_filters( 'the_title', $post->post_title ); |
|
116 | - |
|
117 | - if ( ! has_post_thumbnail( $post ) ) { |
|
118 | - if ( class_exists( 'lsx\legacy\Placeholders' ) ) { |
|
119 | - $image = lsx\legacy\Placeholders::placeholder_url( null, $post->post_type ); |
|
120 | - } elseif ( class_exists( 'LSX_Placeholders' ) ) { |
|
121 | - $image = LSX_Placeholders::placeholder_url( null, $post->post_type ); |
|
112 | + public function get_link_pinterest($post) { |
|
113 | + $permalink = get_permalink($post->ID); |
|
114 | + $permalink = apply_filters('lsx_sharing_pinterest_url', $permalink, $post); |
|
115 | + $title = apply_filters('the_title', $post->post_title); |
|
116 | + |
|
117 | + if ( ! has_post_thumbnail($post)) { |
|
118 | + if (class_exists('lsx\legacy\Placeholders')) { |
|
119 | + $image = lsx\legacy\Placeholders::placeholder_url(null, $post->post_type); |
|
120 | + } elseif (class_exists('LSX_Placeholders')) { |
|
121 | + $image = LSX_Placeholders::placeholder_url(null, $post->post_type); |
|
122 | 122 | } |
123 | 123 | } else { |
124 | - $image = get_the_post_thumbnail_url( $post->ID, 'large' ); |
|
124 | + $image = get_the_post_thumbnail_url($post->ID, 'large'); |
|
125 | 125 | } |
126 | 126 | |
127 | - return 'https://www.pinterest.com/pin/create/button/?url=' . rawurlencode( $permalink ) . '&media=' . rawurlencode( $image ) . '&description=' . rawurlencode( $title ); |
|
127 | + return 'https://www.pinterest.com/pin/create/button/?url=' . rawurlencode($permalink) . '&media=' . rawurlencode($image) . '&description=' . rawurlencode($title); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | } |