-
Notifications
You must be signed in to change notification settings - Fork 0
/
seosharing.php
249 lines (192 loc) · 9.68 KB
/
seosharing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<?php
/**
* Plugin Name: SEO Book PRO Sharing
* Plugin URI: https://seobookpro.com/sharing/
* Description: Sharing Plugin for WordPress websites
* Version: 1.0.7
* Author: Dimitar Krumov
* Author URI: https://seobookpro.com/
* Text Domain: seobookprosharing
* Contributors: (this should be a list of wordpress.org userid's)
* Tags: SEO Book Pro Sharing Buttons, SEO Sharing Buttons, WordPress Sharing Buttons Plugin, WordPress SEO Plugin for Share Buttons
* Donate link: https://www.paypal.com/donate/?hosted_button_id=C36EVYX8YLQKN
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
* @package SEO_Book_PRO_Sharing_Buttons_For_WordPress
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Define constants.
define( 'SEOBPSBFW_VERSION', '1.0.0' );
define( 'SEOBPSBFW_PLUGIN_FILE', __FILE__ );
define( 'SEOBPSBFW_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'SEOBPSBFW_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
// Include required files.
require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/md.php';
require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/mdo.php';
require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/seo/basic-seo.php';
//require_once SEOBPSBFW_PLUGIN_DIR . 'inc/admin/update-share-container.php';
//require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/admin/tabs/tabpanel-design-layout.php';
//require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/admin/tabs/tabpanel-social-networks.php';
//require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/admin/tabs/tabpanel-display-options.php';
//require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/admin/tabs/tabpanel-sharing-options.php';
//require_once SEOBPSBFW_PLUGIN_DIR . 'inc/func/admin/tabs/tabpanel-page-speed-options.php';
// /wp-content/plugins/seobookprosharing/inc/func/seo/pro/seo-nav.php
// Include all .php files automatically from a specifc folder
//foreach ( glob( plugin_dir_path( __FILE__ ) . "inc/func/router/*.php" ) as $file ) {
// include_once $file;
//}
// Enque Bootstrap Framework
function seobpsbfw_load_bootstrap() {
wp_enqueue_style( 'material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons&display=swap');
wp_enqueue_style( 'material-symbols', 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined&display=swap');
wp_enqueue_style( 'bootstrap', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css');
wp_enqueue_style( 'bootstrap-icons', 'https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css');
wp_enqueue_script( 'bundle', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js');
wp_enqueue_script( 'popper', 'https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js');
wp_enqueue_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js');
wp_enqueue_script( 'jquery-3-5-0', 'https://code.jquery.com/jquery-3.5.0.js');
wp_enqueue_script( 'jquery-min', 'https://code.jquery.com/jquery-3.3.1.min.js');
wp_enqueue_script( 'platform', 'https://apis.google.com/js/platform.js');
// Add Loader for all CSS files included in to the /css/ folder to load on new file when it's created in the feature
foreach( glob( plugin_dir_path( __FILE__ ) . 'inc/assets/css/*.css' ) as $file ) {
$filename = substr($file, strrpos($file, '/') + 1);
wp_enqueue_style( $filename, plugin_dir_url( __FILE__ ) . 'inc/assets/css/' . $filename );
}
// Add Loader for all JavaScript files included in to the /js/ folder to load on new file when it's created in the feature
foreach( glob( plugin_dir_path( __FILE__ ) . 'inc/assets/js/*.js' ) as $file ) {
$filename = substr($file, strrpos($file, '/') + 1);
wp_enqueue_script( $filename, plugin_dir_url( __FILE__ ) . 'inc/assets/js/' . $filename );
}
}
add_action( 'admin_enqueue_scripts', 'seobpsbfw_load_bootstrap' );
function seobpsbfw_enqueue_custom_styles() {
// Load All CSS Styles and JavaScripts from the main Assets Folder for the Front End
wp_enqueue_style('custom-styles', plugin_dir_url( __FILE__ ) . 'inc/css/custom.css');
// Load All CSS Styles from the /inc/css/ Folder
foreach( glob( plugin_dir_path( __FILE__ ) . 'inc/css/*.css' ) as $file ) {
$filename = substr($file, strrpos($file, '/') + 1);
wp_enqueue_style( $filename, plugin_dir_url( __FILE__ ) . 'inc/css/' . $filename );
}
}
add_action( 'wp_enqueue_scripts', 'seobpsbfw_enqueue_custom_styles' );
// Loading External Styles and Scripts to Get Work in to the Front End of the Plugin for the Public not the admin part
function seobpsbfw_load_external_styles() {
wp_enqueue_style( 'bootstrap-min', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' );
wp_enqueue_style( 'bootstrap-icons-front', 'https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css' );
}
add_action( 'wp_enqueue_scripts', 'seobpsbfw_load_external_styles' );
// Loading External Styles and Scripts to Get Work in to the Front End of the Plugin for the Public not the admin part
function seobpsbfw_load_external_javascripts() {
wp_enqueue_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js');
wp_enqueue_script( 'jquery-3-5-0', 'https://code.jquery.com/jquery-3.5.0.js');
wp_enqueue_script( 'jquery-min', 'https://code.jquery.com/jquery-3.3.1.min.js');
wp_enqueue_script( 'platform', 'https://apis.google.com/js/platform.js');
wp_enqueue_script( 'bootstrap', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js' );
wp_enqueue_script( 'popper', 'https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js' );
}
add_action( 'wp_enqueue_scripts', 'seobpsbfw_load_external_javascripts' );
function seobpsbfw_enqueue_scripts() {
wp_enqueue_script('button-styles', plugin_dir_url(__FILE__) . 'inc/js/button-styles.js', array('jquery'), '1.9', true);
wp_localize_script('button-styles', 'seobpsbfw_ajax_object', array(
'ajaxurl' => admin_url('admin-ajax.php'), // Corrected AJAX URL
));
}
add_action('wp_enqueue_scripts', 'seobpsbfw_enqueue_scripts');
function seobpsbfw_add_menu_pages() {
add_menu_page(
__( 'SEO Share Buttons', 'seobookprosharing' ),
__( 'SEO Share Buttons', 'seobookprosharing' ),
'manage_options',
'seobpsbfw',
'seobpsbfw_main_page',
'dashicons-admin-settings',
44
);
add_submenu_page(
'seobpsbfw',
__( 'Share Buttons Options', 'seobookprosharing' ),
__( 'Share Buttons Options', 'seobookprosharing' ),
'manage_options',
'seobpsb-social-networks',
'seobpsbfw_social_networks_page',
45
);
add_submenu_page(
'seobpsbfw',
__( 'Basic SEO Options', 'seobookprosharing' ),
__( 'Basic SEO Options', 'seobookprosharing' ),
'manage_options',
'seobpsb-basic-seo',
'seobpsbfw_basic_seo_page',
46
);
}
// Add admin dashboard sidebar Main menu pages
add_action( 'admin_menu', 'seobpsbfw_add_menu_pages' );
function seobpsbfw_sharing_register_settings() {
register_setting( 'seobpsbfw_sharing_options', 'seobpsbfw_sharing_options' );
// Register the style settings
// register_setting('seobpsbfw_sharing_options', 'seobpsbfw_share_container_style');
// register_setting('seobpsbfw_sharing_options', 'seobpsbfw_share_column_style');
// register_setting('seobpsbfw_sharing_options', 'seobpsbfw_buttons_column_style');
// register_setting('seobpsbfw_sharing_options', 'seobpsbfw_share_buttons_style');
// register_setting('seobpsbfw_sharing_options', 'seobpsbfw_sne_style');
}
add_action( 'admin_init', 'seobpsbfw_sharing_register_settings' );
add_filter( 'the_content', 'seobpsbfw_add_share_buttons' );
function seobpsbfw_add_sharing_options() {
add_option( 'seobpsbfw_sharing_options', array(
'include_seobpsbfw_facebook' => 1,
'include_seobpsbfw_twitter' => 1,
'include_seobpsbfw_linkedin' => 1,
'include_seobpsbfw_reddit' => 1,
'include_seobpsbfw_pinterest' => 1,
'include_seobpsbfw_email' => 1,
'include_seobpsbfw_pdf' => 1,
'display_before_content' => 1,
'display_after_content' => 1,
) );
// Start Enqueue color picker scripts and styles
add_settings_field(
'seobpsbfw_share_container_style',
'Share Container Style',
'seobpsbfw_share_container_style_callback',
'seobpsbfw_add_sharing_options',
'seobpsbfw_style_settings'
);
add_settings_section(
'seobpsbfw_style_settings',
'Share Buttons Style Settings',
'seobpsbfw_style_settings_callback',
'seobpsbfw_add_sharing_options'
);
add_settings_field(
'seobpsbfw_share_container_background',
'Share Container Background',
'seobpsbfw_share_container_background_callback',
'seobpsbfw_add_sharing_options',
'seobpsbfw_style_settings'
);
// End Enqueue color picker scripts and styles
wp_enqueue_style('wp-color-picker');
wp_enqueue_script('wp-color-picker');
// Register the style setting
register_setting('seobpsbfw_add_sharing_options', 'seobpsbfw_share_container_style');
register_setting('seobpsbfw_add_sharing_options', 'seobpsbfw_share_container_background');
}
add_action( 'admin_init', 'seobpsbfw_add_sharing_options' );
add_action('admin_head', 'seobpsbfw_share_buttons_admin_styles');
// Register plugin activation and deactivation hooks.
register_activation_hook( __FILE__, 'seobpsbfw_activate' );
register_deactivation_hook( __FILE__, 'seobpsbfw_deactivate' );
// Define activation and deactivation functions.
function seobpsbfw_activate() {
// Do something on activation.
}
function seobpsbfw_deactivate() {
// Do something on deactivation.
}