elementor
3 years ago
admin-create-shortcode.php
7 years ago
admin-create-user.php
5 months ago
admin-custom-function.php
1 year ago
admin-rest-api.php
7 months ago
admin-settings.php
2 years ago
admin-social-button.php
4 months ago
admin-social-enque-script.php
5 years ago
counter-widget.php
3 years ago
counter.php
7 months ago
custom-function.php
4 years ago
login-widget.php
3 years ago
login.php
5 years ago
share-widget.php
3 years ago
share.php
3 months ago
admin-custom-function.php
138 lines
| 1 | <?php |
| 2 | |
| 3 | use WP_Social\App\Settings; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | /** |
| 8 | * Variable Name : $getLogoutUrl; |
| 9 | * Variable Details : User logout and redirect current url |
| 10 | * |
| 11 | * @params : String() $_GET['XScurrentPageLog']. Get data from URL |
| 12 | * |
| 13 | * @since : 1.0 |
| 14 | */ |
| 15 | if(isset($_GET['loggedout']) && isset($_GET['XScurrentPageLog'])) { |
| 16 | $getLogoutUrl = sanitize_url($_GET['XScurrentPageLog']); |
| 17 | |
| 18 | if(wp_redirect($getLogoutUrl)) { |
| 19 | exit; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Function Name : xs_current_url_custom(); |
| 25 | * Function Details : Set current url with HTTPS | HTTP. |
| 26 | * |
| 27 | * @params : void |
| 28 | * |
| 29 | * @return : String() Current URL when Current URL != base URL |
| 30 | * |
| 31 | * @since : 1.0 |
| 32 | */ |
| 33 | if(!function_exists('xs_current_url_custom')) { |
| 34 | function xs_current_url_custom() { |
| 35 | $current_url = (isset($_SERVER['HTTPS']) && sanitize_text_field($_SERVER['HTTPS']) === 'on' ? 'https' : 'http') . '://' . sanitize_text_field($_SERVER['HTTP_HOST']) . sanitize_url($_SERVER['REQUEST_URI']); |
| 36 | if(get_home_url() . '/' === $current_url) { |
| 37 | $current_url = ''; |
| 38 | } |
| 39 | |
| 40 | return trim($current_url); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Function Name : xs_create_dynamic_shortcode(); |
| 46 | * Function Details : Create shortcode dynamic . if you provide or not |
| 47 | * |
| 48 | * @params : String $atts. if you provide Exam: provider="facebook,twitter,github" |
| 49 | * @params : String $btn-text. if you provide Exam: btn-text="Login with Facebook" |
| 50 | * @params : String $class Set Class. class="test-class" |
| 51 | * |
| 52 | * @return : String Output |
| 53 | * |
| 54 | * @since : 1.0 |
| 55 | */ |
| 56 | if(!function_exists('xs_create_dynamic_shortcode')) { |
| 57 | |
| 58 | function xs_create_dynamic_shortcode($atts, $content = null) { |
| 59 | $atts = shortcode_atts( |
| 60 | array( |
| 61 | 'provider' => 'all', |
| 62 | 'btn-text' => $content, |
| 63 | 'class' => '', |
| 64 | 'style' => '', |
| 65 | ), $atts, 'xs_social_login' |
| 66 | ); |
| 67 | |
| 68 | $str = empty($atts['provider']) ? 'all' : str_replace(' ', '', $atts['provider']); |
| 69 | |
| 70 | $providers = explode(',', $str); |
| 71 | |
| 72 | return xs_social_login_shortcode_widget($providers, $atts['btn-text'], 'show', $atts['class'], $atts['style']); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Function Name : xs_social_login_shortcode_widget(); |
| 78 | * Function Details : Create shortcode button from template page . |
| 79 | * |
| 80 | * @params : String $atts. if you provide Exam: provider="facebook,twitter,github" |
| 81 | * @params : String $btn_content. if you provide Exam: btn-text="Login with Facebook" |
| 82 | * @params : String $typeCurrent. Current URL add or remove from redirect URL |
| 83 | * @params : String $className Set Class. class="test-class" |
| 84 | * |
| 85 | * @return : String Output of button |
| 86 | * |
| 87 | * @since : 1.0 |
| 88 | */ |
| 89 | if(!function_exists('xs_social_login_shortcode_widget')) { |
| 90 | |
| 91 | function xs_social_login_shortcode_widget($attr_provider, $btn_content = null, $typeCurrent = 'show', $className = '', $force_style = '') { |
| 92 | |
| 93 | $provider_data = \WP_Social\App\Settings::get_login_settings_data(); |
| 94 | $style_data = get_option('xs_style_setting_data', []); |
| 95 | |
| 96 | ob_start(); |
| 97 | require(WSLU_LOGIN_PLUGIN . '/template/login/login-btn-html.php'); |
| 98 | $buttonData = ob_get_contents(); |
| 99 | ob_end_clean(); |
| 100 | |
| 101 | return $buttonData; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Function Name : xs_my_login_stylesheet(); |
| 107 | * Function Details : Added style and script page in wp-login.php page |
| 108 | * |
| 109 | * @params : void |
| 110 | * |
| 111 | * @return : link page |
| 112 | * |
| 113 | * @since : 1.0 |
| 114 | */ |
| 115 | if(!function_exists('xs_my_login_stylesheet')) { |
| 116 | function xs_my_login_stylesheet() { |
| 117 | wp_enqueue_script('xs_login_custom_login_js', WSLU_LOGIN_PLUGIN_URL . 'assets/js/login-page/font-login-page.js', ['jquery']); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | |
| 122 | if(!function_exists('xs_my_global_stylesheet')) { |
| 123 | |
| 124 | function xs_my_global_stylesheet() { |
| 125 | wp_enqueue_style('xs-front-style', WSLU_LOGIN_PLUGIN_URL . 'assets/css/frontend.css', [], WSLU_VERSION); |
| 126 | |
| 127 | wp_enqueue_style('xs_login_font_login_css', WSLU_LOGIN_PLUGIN_URL . 'assets/css/font-icon.css', [], WSLU_VERSION); |
| 128 | wp_enqueue_script('xs_front_main_js', WSLU_LOGIN_PLUGIN_URL . 'assets/js/front-main.js', ['jquery'], WSLU_VERSION); |
| 129 | |
| 130 | $data['rest_url'] = get_rest_url(); |
| 131 | $data['nonce'] = wp_create_nonce('wp_rest'); |
| 132 | $data['insta_enabled'] = Settings::instance()->load()->is_instagram_counter_enabled(); |
| 133 | |
| 134 | wp_localize_script('xs_front_main_js', 'rest_config', $data); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 |