elementor
3 years ago
admin-create-shortcode.php
7 years ago
admin-create-user.php
1 week ago
admin-custom-function.php
1 week ago
admin-rest-api.php
1 week ago
admin-settings.php
2 years ago
admin-social-button.php
1 week ago
admin-social-enque-script.php
5 years ago
counter-widget.php
1 week ago
counter.php
1 week ago
custom-function.php
5 years ago
login-widget.php
3 years ago
login.php
5 years ago
share-widget.php
1 week ago
share.php
1 week ago
admin-settings.php
972 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Social\Inc; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use WP_Social\App\Counter_Settings; |
| 8 | use WP_Social\App\Login_Settings; |
| 9 | use WP_Social\App\Providers; |
| 10 | use WP_Social\App\Settings; |
| 11 | use WP_Social\Helper\User_Helper; |
| 12 | use WP_Social\Lib\Onboard\Onboard; |
| 13 | use WP_Social\Xs_Migration\Migration; |
| 14 | use WP_User_Query; |
| 15 | |
| 16 | /** |
| 17 | * Class Name : XS_Social_Login_Settings; |
| 18 | * Class Details : Added menu and sub menu in wordpress main admin menu |
| 19 | * |
| 20 | * @params : void |
| 21 | * @return : added new page link |
| 22 | * |
| 23 | * @since : 1.0 |
| 24 | */ |
| 25 | class Admin_Settings { |
| 26 | |
| 27 | public static $counter_style = ['wslu-counter-box-shaped wslu-counter-fill-colored' => 'Block', 'wslu-counter-line-shaped wslu-counter-fill-colored' => 'Line', 'wslu-counter-line-shaped wslu-counter-fill-colored wslu-counter-rounded' => 'Line with Round']; |
| 28 | |
| 29 | /** |
| 30 | * @var array |
| 31 | */ |
| 32 | public static $horizontal_style = [ |
| 33 | |
| 34 | 'horizontal' => [ |
| 35 | 'class' => 'wslu-share-horizontal', |
| 36 | 'name' => 'Horizontal', |
| 37 | ], |
| 38 | |
| 39 | 'vertical' => [ |
| 40 | 'class' => 'wslu-share-vertical', |
| 41 | 'name' => 'Vertical', |
| 42 | ], |
| 43 | ]; |
| 44 | |
| 45 | |
| 46 | public function __construct($load = true) { |
| 47 | |
| 48 | add_action('wp_ajax_export_users_content_csv', [$this, 'export_users_content_csv']); |
| 49 | |
| 50 | add_action('wp_ajax_sort_providers_login', [$this, 'sort_providers_login']); |
| 51 | |
| 52 | add_action('wp_ajax_sort_providers_share', [$this, 'sort_providers_share']); |
| 53 | |
| 54 | add_action('wp_ajax_sort_providers_counter', [$this, 'sort_providers_counter']); |
| 55 | add_action('wp_ajax_wp_social_admin_consent_action', [$this, 'wp_social_admin_consent_action']); |
| 56 | |
| 57 | if($load) { |
| 58 | // added admin menu |
| 59 | add_action('admin_menu', [$this, 'wp_social_admin_menu']); |
| 60 | } |
| 61 | |
| 62 | if(!did_action('wslu_social_pro/plugin_loaded')) { |
| 63 | add_filter('wslu/share/style_settins', [$this, 'share_style_settings']); |
| 64 | add_filter('wslu/counter/style_settings', [$this, 'counter_style_settings']); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | |
| 69 | public static function share_styles() { |
| 70 | |
| 71 | $share_style = [ |
| 72 | 'style-1' => [ |
| 73 | 'name' => __('Icon with fill color', 'wp-social'), |
| 74 | 'class' => 'wslu-share-box-shaped wslu-fill-colored', |
| 75 | 'design' => 'img-1', |
| 76 | 'package' => 'free', |
| 77 | ], |
| 78 | 'style-2' => [ |
| 79 | 'name' => __('Icon with fill color and space', 'wp-social'), |
| 80 | 'class' => 'wslu-share-box-shaped wslu-fill-colored wslu-share-m-5', |
| 81 | 'design' => 'img-2', |
| 82 | 'package' => 'free', |
| 83 | ], |
| 84 | 'style-3' => [ |
| 85 | 'name' => __('Icon with hover fill color and space', 'wp-social'), |
| 86 | 'class' => 'wslu-share-box-shaped wslu-fill-brand-hover-colored wslu-share-m-5', |
| 87 | 'design' => 'img-3', |
| 88 | 'package' => 'free', |
| 89 | ], |
| 90 | ]; |
| 91 | |
| 92 | return apply_filters('wslu/share/style_settins', $share_style); |
| 93 | } |
| 94 | |
| 95 | public function share_style_settings($share) { |
| 96 | |
| 97 | $array = [ |
| 98 | 'style-4' => [ |
| 99 | 'name' => __('Icon with text', 'wp-social'), |
| 100 | 'class' => 'wslu-go-pro', |
| 101 | 'design' => 'img-4', |
| 102 | 'package' => 'pro', |
| 103 | ], |
| 104 | 'style-5' => [ |
| 105 | 'name' => __('Icon with text & slightly rounded', 'wp-social'), |
| 106 | 'class' => 'wslu-go-pro', |
| 107 | 'design' => 'img-5', |
| 108 | 'package' => 'pro', |
| 109 | ], |
| 110 | 'style-6' => [ |
| 111 | 'name' => __('Circled Icon with fill color', 'wp-social'), |
| 112 | 'class' => 'wslu-go-pro', |
| 113 | 'design' => 'img-6', |
| 114 | 'package' => 'pro', |
| 115 | ], |
| 116 | 'style-7' => [ |
| 117 | 'name' => __('Circled Icon with hover fill color', 'wp-social'), |
| 118 | 'class' => 'wslu-go-pro', |
| 119 | 'design' => 'img-7', |
| 120 | 'package' => 'pro', |
| 121 | ], |
| 122 | 'style-8' => [ |
| 123 | 'name' => __('Icon with colored border', 'wp-social'), |
| 124 | 'class' => 'wslu-go-pro', |
| 125 | 'design' => 'img-8', |
| 126 | 'package' => 'pro', |
| 127 | ], |
| 128 | 'style-9' => [ |
| 129 | 'name' => __('Icon with hover colored border', 'wp-social'), |
| 130 | 'class' => 'wslu-go-pro', |
| 131 | 'design' => 'img-9', |
| 132 | 'package' => 'pro', |
| 133 | ], |
| 134 | 'style-10' => [ |
| 135 | 'name' => __('Icon with colored rounded border', 'wp-social'), |
| 136 | 'class' => 'wslu-go-pro', |
| 137 | 'design' => 'img-10', |
| 138 | 'package' => 'pro', |
| 139 | ], |
| 140 | 'style-11' => [ |
| 141 | 'name' => __('Icon with hover colored rounded border', 'wp-social'), |
| 142 | 'class' => 'wslu-go-pro', |
| 143 | 'design' => 'img-11', |
| 144 | 'package' => 'pro', |
| 145 | ], |
| 146 | 'style-12' => [ |
| 147 | 'name' => __('Icon with hover fill color border', 'wp-social'), |
| 148 | 'class' => 'wslu-go-pro', |
| 149 | 'design' => 'img-12', |
| 150 | 'package' => 'pro', |
| 151 | ], |
| 152 | 'style-13' => [ |
| 153 | 'name' => __('Slightly rounded icon with fill color', 'wp-social'), |
| 154 | 'class' => 'wslu-go-pro', |
| 155 | 'design' => 'img-13', |
| 156 | 'package' => 'pro', |
| 157 | ], |
| 158 | 'style-14' => [ |
| 159 | 'name' => __('Icon with follower count', 'wp-social'), |
| 160 | 'class' => 'wslu-go-pro', |
| 161 | 'design' => 'img-14', |
| 162 | 'package' => 'pro', |
| 163 | ], |
| 164 | 'style-15' => [ |
| 165 | 'name' => __('Rounded filled icon with text', 'wp-social'), |
| 166 | 'class' => 'wslu-go-pro', |
| 167 | 'design' => 'img-15', |
| 168 | 'package' => 'pro', |
| 169 | ], |
| 170 | 'style-16' => [ |
| 171 | 'name' => __('Semi-rounded icon with fill color', 'wp-social'), |
| 172 | 'class' => 'wslu-go-pro', |
| 173 | 'design' => 'img-16', |
| 174 | 'package' => 'pro', |
| 175 | ], |
| 176 | 'style-17' => [ |
| 177 | 'name' => __('Semi-rounded icon and border color', 'wp-social'), |
| 178 | 'class' => 'wslu-go-pro', |
| 179 | 'design' => 'img-17', |
| 180 | 'package' => 'pro', |
| 181 | ], |
| 182 | 'style-18' => [ |
| 183 | 'name' => __('Icon with text and follower count', 'wp-social'), |
| 184 | 'class' => 'wslu-go-pro', |
| 185 | 'design' => 'img-18', |
| 186 | 'package' => 'pro', |
| 187 | ], |
| 188 | ]; |
| 189 | |
| 190 | return array_merge($share, $array); |
| 191 | } |
| 192 | |
| 193 | |
| 194 | /** |
| 195 | * |
| 196 | * @return mixed |
| 197 | */ |
| 198 | public static function counter_styles() { |
| 199 | |
| 200 | $counterStyles = [ |
| 201 | |
| 202 | 'style-1' => [ |
| 203 | 'name' => __('Flat style with fill color', 'wp-social'), |
| 204 | 'class' => 'wslu-counter-box-shaped wslu-counter-fill-colored wslu-counter-space', |
| 205 | 'design' => 'img-1', |
| 206 | 'package' => 'free', |
| 207 | ], |
| 208 | |
| 209 | 'style-2' => [ |
| 210 | 'name' => __('Line style with fill color', 'wp-social'), |
| 211 | 'class' => 'wslu-counter-line-shaped wslu-counter-fill-colored wslu-counter-space', |
| 212 | 'design' => 'img-2', |
| 213 | 'package' => 'free', |
| 214 | ], |
| 215 | |
| 216 | 'style-3' => [ |
| 217 | 'name' => __('Line slightly rounded style with fill color', 'wp-social'), |
| 218 | 'class' => 'wslu-counter-line-shaped wslu-counter-fill-colored wslu-counter-rounded wslu-counter-space', |
| 219 | 'design' => 'img-3', |
| 220 | 'package' => 'free', |
| 221 | ], |
| 222 | ]; |
| 223 | |
| 224 | |
| 225 | return apply_filters('wslu/counter/style_settings', $counterStyles); |
| 226 | } |
| 227 | |
| 228 | public function counter_style_settings($counter) { |
| 229 | $array = [ |
| 230 | 'style-4' => [ |
| 231 | 'name' => __('Flat style with hover fill color', 'wp-social'), |
| 232 | 'class' => 'wslu-counter-go-pro', |
| 233 | 'design' => 'img-4', |
| 234 | 'package' => 'pro', |
| 235 | ], |
| 236 | 'style-5' => [ |
| 237 | 'name' => __('Metro style with fill color', 'wp-social'), |
| 238 | 'class' => 'wslu-counter-go-pro', |
| 239 | 'design' => 'img-5', |
| 240 | 'package' => 'pro', |
| 241 | ], |
| 242 | 'style-6' => [ |
| 243 | 'name' => __('Flat style with hover icon color', 'wp-social'), |
| 244 | 'class' => 'wslu-counter-go-pro', |
| 245 | 'design' => 'img-6', |
| 246 | 'package' => 'pro', |
| 247 | ], |
| 248 | 'style-7' => [ |
| 249 | 'name' => __('Flat style with icon color', 'wp-social'), |
| 250 | 'class' => 'wslu-counter-go-pro', |
| 251 | 'design' => 'img-7', |
| 252 | 'package' => 'pro', |
| 253 | ], |
| 254 | 'style-8' => [ |
| 255 | 'name' => __('Flat style with icon fill color', 'wp-social'), |
| 256 | 'class' => 'wslu-counter-go-pro', |
| 257 | 'design' => 'img-8', |
| 258 | 'package' => 'pro', |
| 259 | ], |
| 260 | 'style-9' => [ |
| 261 | 'name' => __('Flat style with fill color & rounded icon', 'wp-social'), |
| 262 | 'class' => 'wslu-counter-go-pro', |
| 263 | 'design' => 'img-9', |
| 264 | 'package' => 'pro', |
| 265 | ], |
| 266 | 'style-10' => [ |
| 267 | 'name' => __('Vertical line style with icon color', 'wp-social'), |
| 268 | 'class' => 'wslu-counter-go-pro', |
| 269 | 'design' => 'img-10', |
| 270 | 'package' => 'pro', |
| 271 | ], |
| 272 | 'style-11' => [ |
| 273 | 'name' => __('Vertical line style with icon fill color', 'wp-social'), |
| 274 | 'class' => 'wslu-counter-go-pro', |
| 275 | 'design' => 'img-11', |
| 276 | 'package' => 'pro', |
| 277 | ], |
| 278 | 'style-12' => [ |
| 279 | 'name' => __('Vertical line style with fill color & rounded icon', 'wp-social'), |
| 280 | 'class' => 'wslu-counter-go-pro', |
| 281 | 'design' => 'img-12', |
| 282 | 'package' => 'pro', |
| 283 | ], |
| 284 | 'style-13' => [ |
| 285 | 'name' => __('Rounded icon style with fill color', 'wp-social'), |
| 286 | 'class' => 'wslu-counter-go-pro', |
| 287 | 'design' => 'img-13', |
| 288 | 'package' => 'pro', |
| 289 | ], |
| 290 | 'style-14' => [ |
| 291 | 'name' => __('Rounded icon style with hover fill color', 'wp-social'), |
| 292 | 'class' => 'wslu-counter-go-pro', |
| 293 | 'design' => 'img-14', |
| 294 | 'package' => 'pro', |
| 295 | ], |
| 296 | 'style-15' => [ |
| 297 | 'name' => __('Slightly Rounded icon style with fill color', 'wp-social'), |
| 298 | 'class' => 'wslu-counter-go-pro', |
| 299 | 'design' => 'img-15', |
| 300 | 'package' => 'pro', |
| 301 | ], |
| 302 | 'style-16' => [ |
| 303 | 'name' => __('Slightly Rounded icon style with hover fill color', 'wp-social'), |
| 304 | 'class' => 'wslu-counter-go-pro', |
| 305 | 'design' => 'img-16', |
| 306 | 'package' => 'pro', |
| 307 | ], |
| 308 | 'style-17' => [ |
| 309 | 'name' => __('Metro style with hover fill color', 'wp-social'), |
| 310 | 'class' => 'wslu-counter-go-pro', |
| 311 | 'design' => 'img-17', |
| 312 | 'package' => 'pro', |
| 313 | ], |
| 314 | 'style-18' => [ |
| 315 | 'name' => __('Line style with hover fill color', 'wp-social'), |
| 316 | 'class' => 'wslu-counter-go-pro', |
| 317 | 'design' => 'img-18', |
| 318 | 'package' => 'pro', |
| 319 | ], |
| 320 | ]; |
| 321 | |
| 322 | return array_merge($counter, $array); |
| 323 | } |
| 324 | |
| 325 | |
| 326 | /** |
| 327 | * Method Name : wp_social_admin_menu |
| 328 | * Method Details : add menu for social login plugin |
| 329 | * |
| 330 | * @params : void |
| 331 | * @return : void |
| 332 | * |
| 333 | * @since : 1.0 |
| 334 | */ |
| 335 | public function wp_social_admin_menu() { |
| 336 | add_menu_page( __('WP Social Login Ultimate', 'wp-social'), __('WP Social', 'wp-social'), 'manage_options', 'wslu_global_setting', [$this, 'content_xs_global_setting'], WSLU_LOGIN_PLUGIN_URL . 'assets/images/icon-menu.png'); |
| 337 | add_submenu_page('wslu_global_setting', __('Social Login', 'wp-social'), __('Social Login', 'wp-social'), 'manage_options', 'wslu_global_setting', [$this, 'content_xs_global_setting']); |
| 338 | add_submenu_page('wslu_global_setting', __('Social Share', 'wp-social'), __('Social Share', 'wp-social'), 'manage_options', 'wslu_share_setting', [$this, 'content_xs_share_setting']); |
| 339 | add_submenu_page('wslu_global_setting', __('Social Counter', 'wp-social'), __('Social Counter', 'wp-social'), 'manage_options', 'wslu_counter_setting', [$this, 'content_xs_counter_setting']); |
| 340 | add_submenu_page('wslu_global_setting', __('Settings', 'wp-social'), __('Settings', 'wp-social'), 'manage_options', 'wslu_settings', [$this, 'content_xs_settings']); |
| 341 | //add_submenu_page('wslu_global_setting', 'Test123', 'Data conversion', 'manage_options', 'wslu_data_migration', [$this, 'content_xs_data_migration']); |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * Method Name : content_xs_global_setting |
| 346 | * Method Details : content for global setting page |
| 347 | * |
| 348 | * @params : void |
| 349 | * @return : void |
| 350 | * |
| 351 | * @since : 1.0 |
| 352 | */ |
| 353 | public function content_xs_global_setting() { |
| 354 | |
| 355 | if(isset($_GET['wp-social-met-onboard-steps']) && sanitize_text_field($_GET['wp-social-met-onboard-steps']) == 'loaded') { |
| 356 | Onboard::instance()->views(); |
| 357 | } else { |
| 358 | $global_optionKey = 'xs_global_setting_data'; |
| 359 | $message_global = 'hide'; |
| 360 | |
| 361 | if(isset($_POST['global_setting_submit_form'])) { |
| 362 | |
| 363 | if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'global_setting_submit_form_nonce' ) ) { |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | $option_value_global = isset($_POST['xs_global']) ? Self::sanitize($_POST['xs_global']) : []; |
| 368 | |
| 369 | if(update_option($global_optionKey, $option_value_global, 'Yes')) { |
| 370 | $message_global = 'show'; |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | // get returned global setting data from db |
| 375 | $return_data = get_option($global_optionKey); |
| 376 | |
| 377 | $membership = get_option('users_can_register', 0); |
| 378 | $wpUserRole = get_option('default_role', 'subscriber'); |
| 379 | |
| 380 | |
| 381 | // wordpress role options |
| 382 | $active_tab = isset($_GET["tab"]) ? sanitize_text_field($_GET["tab"]) : 'wslu_global_setting'; |
| 383 | |
| 384 | if($active_tab == 'wslu_providers') { |
| 385 | |
| 386 | $this->content_xs_providers(); |
| 387 | |
| 388 | } elseif($active_tab == 'wslu_style_setting') { |
| 389 | |
| 390 | $this->content_xs_style_setting(); |
| 391 | |
| 392 | } else { |
| 393 | |
| 394 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/global-setting.php'); |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | |
| 400 | /** |
| 401 | * Method Name : content_xs_providers |
| 402 | * Method Details : content for social provider page |
| 403 | * |
| 404 | * |
| 405 | * @params : void |
| 406 | * @return : void |
| 407 | * |
| 408 | * @since : 1.0 |
| 409 | */ |
| 410 | public function content_xs_providers() { |
| 411 | $option_key = 'xs_provider_data'; |
| 412 | $message_provider = 'hide'; |
| 413 | |
| 414 | $enabled_providers = \WP_Social\App\Settings::get_enabled_provider_conf_login(); |
| 415 | |
| 416 | /** |
| 417 | * Legacy version support |
| 418 | * After 3/4 version we can hopefully delete the below if block |
| 419 | */ |
| 420 | if(empty($enabled_providers)) { |
| 421 | |
| 422 | $old_settings = \WP_Social\App\Settings::get_login_settings_data(); |
| 423 | |
| 424 | if(!empty($old_settings)) { |
| 425 | |
| 426 | $tmp = []; |
| 427 | |
| 428 | foreach($old_settings as $key => $info) { |
| 429 | |
| 430 | $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1; |
| 431 | } |
| 432 | |
| 433 | \WP_Social\App\Settings::update_enabled_provider_conf_login($tmp); |
| 434 | |
| 435 | $enabled_providers = $tmp; |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | |
| 440 | // save prodivers data in db |
| 441 | if(isset($_POST['xs_provider_submit_form'])) { |
| 442 | |
| 443 | $option_value = isset($_POST['xs_social']) ? self::sanitize($_POST['xs_social']) : []; |
| 444 | |
| 445 | if(update_option($option_key, $option_value, 'Yes')) { |
| 446 | $message_provider = 'show'; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | $saved_settings = \WP_Social\App\Settings::get_login_settings_data(); |
| 451 | $core_provider = \WP_Social\App\Providers::get_core_providers_login(); |
| 452 | |
| 453 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/providers-setting.php'); |
| 454 | } |
| 455 | |
| 456 | |
| 457 | /** |
| 458 | * Method Name : content_xs_style_setting |
| 459 | * Method Details : content for social provider style settings |
| 460 | * |
| 461 | */ |
| 462 | public function content_xs_style_setting() { |
| 463 | |
| 464 | $message_provider = 'hide'; |
| 465 | |
| 466 | if(isset($_POST['style_setting_submit_form'])) { |
| 467 | |
| 468 | if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'style_setting_submit_form_nonce' ) ) { |
| 469 | return; |
| 470 | } |
| 471 | |
| 472 | $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : []; |
| 473 | |
| 474 | if(update_option(Login_Settings::OK_STYLES, $option_value, 'yes')) { |
| 475 | $message_provider = 'show'; |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | $saved_style = Login_Settings::instance()->get_style_settings(); |
| 480 | |
| 481 | |
| 482 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/style-setting.php'); |
| 483 | } |
| 484 | |
| 485 | |
| 486 | /** |
| 487 | * Method Name : content_xs_counter_setting |
| 488 | * Method Details : content for social provider style settings |
| 489 | * |
| 490 | * |
| 491 | */ |
| 492 | public function content_xs_counter_setting() { |
| 493 | $global_optionKey = 'xs_counter_global_setting_data'; |
| 494 | $message_global = 'hide'; |
| 495 | |
| 496 | if(isset($_POST['counter_settings_submit_form_global'])) { |
| 497 | |
| 498 | if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'counter_settings_submit_form_global_nonce' ) ) { |
| 499 | return; |
| 500 | } |
| 501 | |
| 502 | $option_value_global = isset($_POST['xs_counter']) ? self::sanitize($_POST['xs_counter']) : []; |
| 503 | if(update_option($global_optionKey, $option_value_global, 'Yes')) { |
| 504 | $message_global = 'show'; |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | // get returned global setting data from db |
| 509 | $return_data = get_option($global_optionKey); |
| 510 | |
| 511 | // wordpress role options |
| 512 | $active_tab = isset($_GET["tab"]) ? sanitize_text_field($_GET["tab"]) : 'wslu_global_setting'; |
| 513 | |
| 514 | if($active_tab == 'wslu_providers') { |
| 515 | $this->content_xs_providers_counter(); |
| 516 | } else { |
| 517 | if($active_tab == 'wslu_style_setting') { |
| 518 | $this->content_xs_style_setting_counter(); |
| 519 | } else { |
| 520 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/counter-setting.php'); |
| 521 | } |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | |
| 526 | public function export_users_content_csv() { |
| 527 | if(current_user_can('manage_options') && isset($_POST['wslu_export_users_list_nonce']) && wp_verify_nonce($_POST['wslu_export_users_list_nonce'],'wslu_export_users_list_nonce') && isset($_POST['provider'])) { |
| 528 | User_Helper::export_users_content_csv(sanitize_text_field($_POST['provider'])); |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | /** |
| 533 | * Method Name : content_xs_settings |
| 534 | * Method Details : |
| 535 | * |
| 536 | * |
| 537 | * @params : void |
| 538 | * @return : void |
| 539 | * |
| 540 | * @since : 1.0 |
| 541 | */ |
| 542 | public function content_xs_settings() { |
| 543 | |
| 544 | $message_global = ''; |
| 545 | |
| 546 | if(!empty($_POST['sycn_setting'])) { |
| 547 | |
| 548 | if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'sycn_setting_nonce' ) ) { |
| 549 | return; |
| 550 | } |
| 551 | |
| 552 | if(isset($_POST['sync'])) { |
| 553 | update_option('wp_social_login_sync', sanitize_key($_POST['sync'])); |
| 554 | } else { |
| 555 | update_option('wp_social_login_sync', 'no'); |
| 556 | } |
| 557 | |
| 558 | if(isset($_POST['sync_image'])) { |
| 559 | update_option('wp_social_login_sync_image_too', sanitize_key($_POST['sync_image'])); |
| 560 | } else { |
| 561 | update_option('wp_social_login_sync_image_too', 'no'); |
| 562 | } |
| 563 | $message_global = 'show'; |
| 564 | } |
| 565 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/settings.php'); |
| 566 | } |
| 567 | |
| 568 | /** |
| 569 | * Method Name : content_xs_providers_counter |
| 570 | * Method Details : content for social provider counter settings |
| 571 | * |
| 572 | * |
| 573 | * @params : void |
| 574 | * @return : void |
| 575 | * |
| 576 | * @since : 1.0 |
| 577 | */ |
| 578 | public function content_xs_providers_counter() { |
| 579 | |
| 580 | $counter = new Counter(false); |
| 581 | $counter_social_items = $counter->xs_counter_providers(); |
| 582 | $counter_provider = \WP_Social\App\Settings::get_counter_provider_settings(); |
| 583 | |
| 584 | $option_key = 'xs_counter_providers_data'; |
| 585 | $message_provider = 'hide'; |
| 586 | |
| 587 | $enabled_providers = get_option(Settings::$ok_enabled_providers_counter, []); |
| 588 | |
| 589 | /** |
| 590 | * Legacy version support |
| 591 | * After 3/4 version we can hopefully delete the below if block |
| 592 | */ |
| 593 | if(empty($enabled_providers)) { |
| 594 | |
| 595 | $old_settings = get_option($option_key, []); |
| 596 | |
| 597 | if(!empty($old_settings['social'])) { |
| 598 | |
| 599 | $tmp = []; |
| 600 | |
| 601 | foreach($old_settings['social'] as $key => $info) { |
| 602 | |
| 603 | $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1; |
| 604 | } |
| 605 | |
| 606 | update_option(Settings::$ok_enabled_providers_counter, $tmp); |
| 607 | |
| 608 | $enabled_providers = $tmp; |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | |
| 613 | /** |
| 614 | * Here saves all the counter providers updated settings |
| 615 | * |
| 616 | */ |
| 617 | if(isset($_POST['counter_settings_submit_form'])) { |
| 618 | |
| 619 | $option_value = isset($_POST['xs_counter']) ? self::sanitize($_POST['xs_counter']) : []; |
| 620 | |
| 621 | if(update_option($option_key, $option_value, 'yes')) { |
| 622 | |
| 623 | $message_provider = 'show'; |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | |
| 628 | $xsc_options = get_option($option_key, []); |
| 629 | |
| 630 | $counter_provider = isset($xsc_options['social']) ? $xsc_options['social'] : $counter_social_items; |
| 631 | |
| 632 | $saved_settings = get_option($option_key, []); |
| 633 | |
| 634 | $core_provider = \WP_Social\App\Providers::get_core_providers_count(); |
| 635 | |
| 636 | $getType = isset($_GET['xs_access']) ? self::sanitize($_GET['xs_access']) : ''; |
| 637 | |
| 638 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/providers-counter.php'); |
| 639 | } |
| 640 | |
| 641 | |
| 642 | /** |
| 643 | * Method Name : content_xs_style_setting |
| 644 | * Method Details : content for social provider style settings |
| 645 | * |
| 646 | * @params : void |
| 647 | * @return : void |
| 648 | * |
| 649 | * @since : 1.0 |
| 650 | */ |
| 651 | public function content_xs_style_setting_counter() { |
| 652 | |
| 653 | $option_key = 'xs_style_setting_data_counter'; |
| 654 | $message_provider = 'hide'; |
| 655 | |
| 656 | //save providers data in db |
| 657 | if(isset($_POST['style_setting_submit_form'])) { |
| 658 | |
| 659 | if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'style_setting_submit_form_counter_nonce' ) ) { |
| 660 | return; |
| 661 | } |
| 662 | |
| 663 | $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : []; |
| 664 | if(update_option($option_key, $option_value, 'Yes')) { |
| 665 | $message_provider = 'show'; |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | |
| 670 | $return_data = Counter_Settings::instance()->get_style_settings(); |
| 671 | |
| 672 | // style type settings |
| 673 | $styleArr = self::counter_styles(); |
| 674 | |
| 675 | // prodiver settings data |
| 676 | $return_data_prodivers = Settings::get_login_settings_data(); |
| 677 | |
| 678 | if(empty($return_data['login_button_style']['style'])) { |
| 679 | $return_data = []; |
| 680 | $return_data['login_button_style']['style'] = 'style-1:top-tooltip'; |
| 681 | } |
| 682 | |
| 683 | $styleAndEffect = explode(':', $return_data['login_button_style']['style']); |
| 684 | $selectedStyle = $styleAndEffect[0]; |
| 685 | $selectedEffect = empty($styleAndEffect[1]) ? 'top-tooltip' : $styleAndEffect[1]; |
| 686 | |
| 687 | |
| 688 | if(did_action('wslu_social_pro/plugin_loaded')) { |
| 689 | |
| 690 | // Counter Hover effect list |
| 691 | if( method_exists( \WP_Social_Pro\Inc\Admin_Settings::class, 'counter_hover_effects' ) ){ |
| 692 | |
| 693 | $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::counter_hover_effects(); |
| 694 | |
| 695 | }else{ |
| 696 | |
| 697 | $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::$counter_hover_effects; |
| 698 | |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/style-setting.php'); |
| 703 | } |
| 704 | |
| 705 | |
| 706 | /** |
| 707 | * Method Name : content_xs_share_setting |
| 708 | * Method Details : content for social provider style settings for share |
| 709 | * |
| 710 | * @params : void |
| 711 | * @return : void |
| 712 | * |
| 713 | * @since : 1.0 |
| 714 | */ |
| 715 | public function content_xs_share_setting() { |
| 716 | |
| 717 | $global_optionKey = 'xs_share_global_setting_data'; |
| 718 | $message_global = 'hide'; |
| 719 | |
| 720 | if(isset($_POST['share_global_setting_submit_form'])) { |
| 721 | |
| 722 | if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'share_global_setting_submit_form_nonce' ) ) { |
| 723 | return; |
| 724 | } |
| 725 | |
| 726 | $option_value_global = isset($_POST['xs_share']) ? self::sanitize($_POST['xs_share']) : []; |
| 727 | if(update_option($global_optionKey, $option_value_global, 'Yes')) { |
| 728 | $message_global = 'show'; |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | // get returned global setting data from db |
| 733 | $return_data = get_option($global_optionKey); |
| 734 | |
| 735 | // wordpress role options |
| 736 | $active_tab = isset($_GET["tab"]) ? sanitize_text_field($_GET["tab"]) : 'wslu_global_setting'; |
| 737 | |
| 738 | if($active_tab == 'wslu_providers') { |
| 739 | $this->content_xs_share_provider(); |
| 740 | |
| 741 | } elseif($active_tab == 'wslu_style_setting') { |
| 742 | $this->content_xs_style_setting_share(); |
| 743 | |
| 744 | } else { |
| 745 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/share-setting.php'); |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | |
| 750 | /** |
| 751 | * Social share providers |
| 752 | * |
| 753 | * |
| 754 | */ |
| 755 | public function content_xs_share_provider() { |
| 756 | $share = new Share(false); |
| 757 | $counter_social_items = $share->social_share_link(); |
| 758 | |
| 759 | $option_key = 'xs_share_providers_data'; |
| 760 | $message_provider = 'hide'; |
| 761 | $saved_settings = get_option($option_key, []); |
| 762 | $enabled_providers = get_option(Settings::$ok_enabled_providers_share, []); |
| 763 | |
| 764 | /** |
| 765 | * Legacy version support |
| 766 | * After 3/4 version we can hopefully delete the below if block |
| 767 | */ |
| 768 | if(empty($enabled_providers)) { |
| 769 | |
| 770 | $old_settings = get_option($option_key, []); |
| 771 | |
| 772 | if(!empty($old_settings['social'])) { |
| 773 | |
| 774 | $tmp = []; |
| 775 | |
| 776 | foreach($old_settings['social'] as $key => $info) { |
| 777 | |
| 778 | $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1; |
| 779 | } |
| 780 | |
| 781 | update_option(Settings::$ok_enabled_providers_share, $tmp); |
| 782 | |
| 783 | $enabled_providers = $tmp; |
| 784 | } |
| 785 | } |
| 786 | |
| 787 | if(isset($_POST['share_settings_submit_form'])) { |
| 788 | |
| 789 | $option_value = isset($_POST['xs_share']) ? self::sanitize($_POST['xs_share']) : []; |
| 790 | |
| 791 | if(update_option($option_key, $option_value, true)) { |
| 792 | $message_provider = 'show'; |
| 793 | $saved_settings = $option_value; |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | // get returned data from db |
| 798 | $xsc_options = get_option($option_key) ? get_option($option_key) : []; |
| 799 | $share_provider = isset($xsc_options['social']) ? $xsc_options['social'] : $counter_social_items; |
| 800 | $core_provider = \WP_Social\App\Providers::get_core_providers_share(); |
| 801 | |
| 802 | $getType = isset($_GET['xs_access']) ? self::sanitize($_GET['xs_access']) : ''; |
| 803 | |
| 804 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/share-providers.php'); |
| 805 | } |
| 806 | |
| 807 | /** |
| 808 | * Method Name : content_xs_style_setting |
| 809 | * Method Details : content for social provider style settings |
| 810 | * |
| 811 | * @params : void |
| 812 | * @return : void |
| 813 | * |
| 814 | * @since : 1.0 |
| 815 | */ |
| 816 | public function content_xs_style_setting_share() { |
| 817 | |
| 818 | $option_key = 'xs_style_setting_data_share'; |
| 819 | $message_provider = 'hide'; |
| 820 | |
| 821 | // save providers data in db |
| 822 | if(isset($_POST['style_setting_submit_form'])) { |
| 823 | |
| 824 | if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'style_setting_submit_form_share_nonce' ) ) { |
| 825 | return; |
| 826 | } |
| 827 | |
| 828 | $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : []; |
| 829 | if(update_option($option_key, $option_value, 'Yes')) { |
| 830 | $message_provider = 'show'; |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | // get returned data from db |
| 835 | $return_data = get_option($option_key); |
| 836 | |
| 837 | // style type settings |
| 838 | $styleArr = self::share_styles(); |
| 839 | |
| 840 | // prodiver settings data |
| 841 | $return_data_prodivers = Settings::get_login_settings_data(); |
| 842 | |
| 843 | if(did_action('wslu_social_pro/plugin_loaded')) { |
| 844 | |
| 845 | // Share Hover effect list |
| 846 | if( method_exists( \WP_Social_Pro\Inc\Admin_Settings::class, 'share_hover_effects' ) ){ |
| 847 | |
| 848 | $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::share_hover_effects(); |
| 849 | |
| 850 | }else{ |
| 851 | |
| 852 | $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::$share_hover_effects; |
| 853 | |
| 854 | } |
| 855 | |
| 856 | } |
| 857 | |
| 858 | if(empty($return_data['main_content']['style'])) { |
| 859 | $return_data['main_content']['style'] = 'style-1:none-none:horizontal'; |
| 860 | } |
| 861 | if(empty($return_data['fixed_display']['style'])) { |
| 862 | $return_data['fixed_display']['style'] = 'style-1:none-none:vertical'; |
| 863 | } |
| 864 | |
| 865 | |
| 866 | $styleAndEffect = explode(':', $return_data['main_content']['style']); |
| 867 | $mainEffect = empty($styleAndEffect[1]) ? 'none-none' : $styleAndEffect[1]; |
| 868 | |
| 869 | require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/style-setting.php'); |
| 870 | } |
| 871 | |
| 872 | |
| 873 | public static function sanitize($value, $senitize_func = 'sanitize_text_field') { |
| 874 | $senitize_func = (in_array($senitize_func, [ |
| 875 | 'sanitize_email', |
| 876 | 'sanitize_file_name', |
| 877 | 'sanitize_hex_color', |
| 878 | 'sanitize_hex_color_no_hash', |
| 879 | 'sanitize_html_class', |
| 880 | 'sanitize_key', |
| 881 | 'sanitize_meta', |
| 882 | 'sanitize_mime_type', |
| 883 | 'sanitize_sql_orderby', |
| 884 | 'sanitize_option', |
| 885 | 'sanitize_text_field', |
| 886 | 'sanitize_title', |
| 887 | 'sanitize_title_for_query', |
| 888 | 'sanitize_title_with_dashes', |
| 889 | 'sanitize_user', |
| 890 | 'esc_url_raw', |
| 891 | 'wp_filter_nohtml_kses', |
| 892 | ])) ? $senitize_func : 'sanitize_text_field'; |
| 893 | |
| 894 | if(!is_array($value)) { |
| 895 | return $senitize_func($value); |
| 896 | } else { |
| 897 | return array_map(function ($inner_value) use ($senitize_func) { |
| 898 | return self::sanitize($inner_value, $senitize_func); |
| 899 | }, $value); |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | |
| 904 | public function content_xs_data_migration() { |
| 905 | |
| 906 | $migration = new Migration(); |
| 907 | |
| 908 | $ret = $migration->input('wp-social', '1.3.3', '1.3.5'); |
| 909 | |
| 910 | require_once(WSLU_LOGIN_PLUGIN . '/xs_migration/markup/data-conversion.php'); |
| 911 | |
| 912 | } |
| 913 | |
| 914 | public function sort_providers_login() { |
| 915 | |
| 916 | if ( ! isset($_POST['wslu_provider_nonce'] ) || ( isset($_POST['wslu_provider_nonce']) && ! wp_verify_nonce( $_POST['wslu_provider_nonce'], 'wp_rest' )) || ! current_user_can( 'manage_options' ) ) { |
| 917 | return; |
| 918 | } |
| 919 | |
| 920 | $providers = array_map('sanitize_key', $_POST['providers']); |
| 921 | |
| 922 | return update_option(Providers::ORDER_LIST_PROVIDER_LOGIN, $providers); |
| 923 | } |
| 924 | |
| 925 | public function sort_providers_share() { |
| 926 | |
| 927 | if ( ! isset($_POST['wslu_provider_nonce'] ) || ( isset($_POST['wslu_provider_nonce']) && ! wp_verify_nonce( $_POST['wslu_provider_nonce'], 'wp_rest' )) || ! current_user_can( 'manage_options' )) { |
| 928 | return; |
| 929 | } |
| 930 | |
| 931 | $providers = array_map('sanitize_key', $_POST['providers']); |
| 932 | |
| 933 | return update_option(Providers::ORDER_LIST_PROVIDER_SHARE, $providers); |
| 934 | } |
| 935 | |
| 936 | public function sort_providers_counter() { |
| 937 | |
| 938 | if ( ! isset($_POST['wslu_provider_nonce'] ) || ( isset($_POST['wslu_provider_nonce']) && ! wp_verify_nonce( $_POST['wslu_provider_nonce'], 'wp_rest' )) || ! current_user_can( 'manage_options' ) ) { |
| 939 | return; |
| 940 | } |
| 941 | |
| 942 | $providers = array_map('sanitize_key', $_POST['providers']); |
| 943 | |
| 944 | update_option(Counter::ORDER_LIST_PROVIDER_COUNTER, $providers); // frontend sort |
| 945 | |
| 946 | return update_option(Providers::ORDER_LIST_PROVIDER_COUNTER, $providers); // backend sort |
| 947 | } |
| 948 | |
| 949 | /** |
| 950 | * wp_social_admin_consent_action - ajax action |
| 951 | * |
| 952 | * @since 3.0.3 |
| 953 | * @access public |
| 954 | * |
| 955 | * @return void |
| 956 | */ |
| 957 | public function wp_social_admin_consent_action() { |
| 958 | |
| 959 | if ( ! isset($_POST['nonce']) || ! wp_verify_nonce( sanitize_key(wp_unslash($_POST['nonce'])), 'ajax-nonce' ) || ! current_user_can( 'manage_options' ) ) { |
| 960 | |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | if( isset($_POST['wp_social_user_consent_for_promotional_content'])){ |
| 965 | |
| 966 | update_option('wp_social_user_consent_for_promotional_content', sanitize_text_field($_POST['wp_social_user_consent_for_promotional_content'])); |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | } |
| 971 | |
| 972 |