__( 'Login using Social Apps like Google, Facebook, LinkedIn, Microsoft, Instagram.', 'flw' ), 'customize_selective_refresh' => true, ) ); } public function widget( $args, $instance ) { extract( $args ); echo $args['before_widget']; $this->openidloginForm(); echo $args['after_widget']; } public function update( $new_instance, $old_instance ) { $instance = array(); $instance['wid_title'] = strip_tags( $new_instance['wid_title'] ); return $instance; } public function openidloginForm(){ global $post; //$this->error_message(); $selected_theme = get_option('mo_openid_login_theme'); $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') | get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable'); $spacebetweenicons = get_option('mo_login_icon_space'); $customWidth = get_option('mo_login_icon_custom_width'); $customHeight = get_option('mo_login_icon_custom_height'); $customSize = get_option('mo_login_icon_custom_size'); $customBackground = get_option('mo_login_icon_custom_color'); $customTheme = get_option('mo_openid_login_custom_theme'); $customTextofTitle = get_option('mo_openid_login_button_customize_text'); $customBoundary = get_option('mo_login_icon_custom_boundary'); $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text'); $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text'); if( ! is_user_logged_in() ) { if( $appsConfigured ) { $this->mo_openid_load_login_script(); ?>

Facebook Google Vkontakte Twitter LinkedIn Instagram Amazon Salesforce Microsoft !important;border-radius:px !important;" class="btn btn-block btn-social btn-facebook btn-custom-size login-button" > Facebook !important;font-size:px !important;" class="fa fa-facebook custom-login-button " > !important;border-radius:px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > Google !important;font-size:px !important;" class="fa fa-google-plus custom-login-button " > !important;border-radius:px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > Vkontakte !important;font-size:px !important;" class="fa fa-vk custom-login-button " > !important;border-radius:px !important;" class="btn btn-block btn-social btn-customtheme btn-custom-size login-button" > Twitter !important;font-size:px !important;" class="fa fa-twitter custom-login-button " > !important;border-radius:px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" > LinkedIn !important;font-size:px !important;" class="fa fa-linkedin custom-login-button " > !important;background: !important;border-radius:px !important;" class="btn btn-block btn-social btn-instagram btn-custom-size login-button" > Instagram !important;font-size:px !important;" class="fa fa-instagram custom-login-button "> !important;border-radius:px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" > Amazon !important;font-size:px !important;" class="fa fa-amazon custom-login-button "> !important;border-radius:px !important;" class="btn btn-block btn-social btn-linkedin btn-custom-size login-button" > Salesforce !important;font-size:px " class="fa fa-cloud custom-login-button " > !important;border-radius:px !important;" class="btn btn-block btn-social btn-microsoft btn-custom-size login-button" > Microsoft !important;font-size:px !important;" class=" fa fa-windows custom-login-button ">

No apps configured. Please contact your administrator.
display_name, $customLogoutName); $link_with_username = $customLogoutName; if (empty($customLogoutName) || empty($customLogoutLink)) { ?>
  • error_message(); $selected_theme = isset( $atts['shape'] )? $atts['shape'] : get_option('mo_openid_login_theme'); $appsConfigured = get_option('mo_openid_google_enable') | get_option('mo_openid_salesforce_enable') | get_option('mo_openid_facebook_enable') | get_option('mo_openid_linkedin_enable') | get_option('mo_openid_instagram_enable') | get_option('mo_openid_amazon_enable') | get_option('mo_openid_windowslive_enable') |get_option('mo_openid_twitter_enable') | get_option('mo_openid_vkontakte_enable'); $spacebetweenicons = isset( $atts['space'] )? $atts['space'] : get_option('mo_login_icon_space'); $customWidth = isset( $atts['width'] )? $atts['width'] : get_option('mo_login_icon_custom_width'); $customHeight = isset( $atts['height'] )? $atts['height'] : get_option('mo_login_icon_custom_height'); $customSize = isset( $atts['size'] )? $atts['size'] : get_option('mo_login_icon_custom_size'); $customBackground = isset( $atts['background'] )? $atts['background'] : get_option('mo_login_icon_custom_color'); $customTheme = isset( $atts['theme'] )? $atts['theme'] : get_option('mo_openid_login_custom_theme'); $customText = get_option('mo_openid_login_widget_customize_text'); $buttonText = get_option('mo_openid_login_button_customize_text'); $customTextofTitle = get_option('mo_openid_login_button_customize_text'); $logoutUrl = wp_logout_url( site_url() ); $customBoundary = isset( $atts['edge'] )? $atts['edge'] : get_option('mo_login_icon_custom_boundary'); $customLogoutName = get_option('mo_openid_login_widget_customize_logout_name_text'); $customLogoutLink = get_option('mo_openid_login_widget_customize_logout_text'); if($selected_theme == 'longbuttonwithtext'){ $selected_theme = 'longbutton'; } if($customTheme == 'custombackground'){ $customTheme = 'custom'; } if( ! is_user_logged_in() ) { if( $appsConfigured ) { $this->mo_openid_load_login_script(); $html .= "

    $customText

    "; if($customTheme == 'default'){ if( get_option('mo_openid_facebook_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Facebook"; } else{ $html .= ""; } } if( get_option('mo_openid_google_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Google"; } else{ $html .= ""; } } if( get_option('mo_openid_vkontakte_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Vkontakte"; } else{ $html .= ""; } } if( get_option('mo_openid_twitter_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Twitter"; } else{ $html .= ""; } } if( get_option('mo_openid_linkedin_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " LinkedIn"; } else{ $html .= ""; } }if( get_option('mo_openid_instagram_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Instagram"; } else{ $html .= ""; } }if( get_option('mo_openid_amazon_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Amazon"; } else{ $html .= ""; } }if( get_option('mo_openid_salesforce_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Salesforce"; } else{ $html .= ""; } }if( get_option('mo_openid_windowslive_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Microsoft"; } else{ $html .= ""; } } } if($customTheme == 'custom'){ if( get_option('mo_openid_facebook_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Facebook"; } else{ $html .= ""; } } if( get_option('mo_openid_google_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Google"; } else{ $html .= ""; } } if( get_option('mo_openid_vkontakte_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Vkontakte"; } else{ $html .= ""; } } if( get_option('mo_openid_twitter_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Twitter"; } else{ $html .= ""; } } if( get_option('mo_openid_linkedin_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " LinkedIn"; } else{ $html .= ""; } }if( get_option('mo_openid_instagram_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Instagram"; } else{ $html .= ""; } }if( get_option('mo_openid_amazon_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Amazon"; } else{ $html .= ""; } }if( get_option('mo_openid_salesforce_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Salesforce"; } else{ $html .= ""; } }if( get_option('mo_openid_windowslive_enable') ) { if($selected_theme == 'longbutton'){ $html .= " " . $buttonText . " Microsoft"; } else{ $html .= ""; } } } $html .= '

    '; } else { $html .= '
    No apps configured. Please contact your administrator.
    '; } }else { global $current_user; $current_user = wp_get_current_user(); $customLogoutName = str_replace('##username##', $current_user->display_name, $customLogoutName); $flw = __($customLogoutLink,"flw"); if (empty($customLogoutName) || empty($customLogoutLink)) { $html .= '
    ' . $customLogoutName . ' ' . $flw . '
    '; } else { $html .= '
    ' . $customLogoutName . ' ' . $flw . '
    '; } } return $html; } private function mo_openid_load_login_script() { ?> '.$_SESSION['msg'].''; unset($_SESSION['msg']); unset($_SESSION['msg_class']); } }*/ } /** * Sharing Widget Horizontal * */ class mo_openid_sharing_hor_wid extends WP_Widget { public function __construct() { parent::__construct( 'mo_openid_sharing_hor_wid', 'miniOrange Sharing - Horizontal', array( 'description' => __( 'Share using horizontal widget. Lets you share with Social Apps like Google, Facebook, LinkedIn, Pinterest, Reddit.', 'flw' ), 'customize_selective_refresh' => true, ) ); } public function widget( $args, $instance ) { extract( $args ); echo $args['before_widget']; $this->show_sharing_buttons_horizontal(); echo $args['after_widget']; } public function update( $new_instance, $old_instance ) { $instance = array(); $instance['wid_title'] = strip_tags( $new_instance['wid_title'] ); return $instance; } public function show_sharing_buttons_horizontal(){ global $post; $title = str_replace('+', '%20', urlencode($post->post_title)); $content=strip_shortcodes( strip_tags( get_the_content() ) ); $post_content=$content; $excerpt = ''; $landscape = 'horizontal'; include( plugin_dir_path( __FILE__ ) . 'class-mo-openid-social-share.php'); } } /** * Sharing Vertical Widget * */ class mo_openid_sharing_ver_wid extends WP_Widget { public function __construct() { parent::__construct( 'mo_openid_sharing_ver_wid', 'miniOrange Sharing - Vertical', array( 'description' => __( 'Share using a vertical floating widget. Lets you share with Social Apps like Google, Facebook, LinkedIn, Pinterest, Reddit.', 'flw' ), 'customize_selective_refresh' => true, ) ); } public function widget( $args, $instance ) { extract( $args ); extract( $instance ); $wid_title = apply_filters( 'widget_title', $instance['wid_title'] ); $alignment = apply_filters( 'alignment', isset($instance['alignment'])? $instance['alignment'] : 'left'); $left_offset = apply_filters( 'left_offset', isset($instance['left_offset'])? $instance['left_offset'] : '20'); $right_offset = apply_filters( 'right_offset', isset($instance['right_offset'])? $instance['right_offset'] : '0'); $top_offset = apply_filters( 'top_offset', isset($instance['top_offset'])? $instance['top_offset'] : '100'); $space_icons = apply_filters( 'space_icons', isset($instance['space_icons'])? $instance['space_icons'] : '10'); echo $args['before_widget']; if ( ! empty( $wid_title ) ) echo $args['before_title'] . $wid_title . $args['after_title']; echo "
    "; $this->show_sharing_buttons_vertical($space_icons); echo '
    '; echo $args['after_widget']; } /*Called when user changes configuration in Widget Admin Panel*/ public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['wid_title'] = strip_tags( $new_instance['wid_title'] ); $instance['alignment'] = $new_instance['alignment']; $instance['left_offset'] = $new_instance['left_offset']; $instance['right_offset'] = $new_instance['right_offset']; $instance['top_offset'] = $new_instance['top_offset']; $instance['space_icons'] = $new_instance['space_icons']; return $instance; } public function show_sharing_buttons_vertical($space_icons){ global $post; if($post->post_title) { $title = str_replace('+', '%20', urlencode($post->post_title)); } else { $title = get_bloginfo( 'name' ); } $content=strip_shortcodes( strip_tags( get_the_content() ) ); $post_content=$content; $excerpt = ''; $landscape = 'vertical'; include( plugin_dir_path( __FILE__ ) . 'class-mo-openid-social-share.php'); } /** Widget edit form at admin panel */ function form( $instance ) { /* Set up default widget settings. */ $defaults = array('alignment' => 'left', 'left_offset' => '20', 'right_offset' => '0', 'top_offset' => '100' , 'space_icons' => '10'); foreach( $instance as $key => $value ){ $instance[ $key ] = esc_attr( $value ); } $instance = wp_parse_args( (array)$instance, $defaults ); ?>

    > px
    > px
    px
    px

    = 3 ? 1 : 0; $username = $server_name[$index] . '_' . get_option('mo_openid_user_number'); $user_email = $server_name[$index] . '_' . get_option('mo_openid_user_number') . '@social-user.com'; update_option('mo_openid_user_number', get_option('mo_openid_user_number') + 1); } else { $user_full_name = preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/', '', $user_full_name); $username = strtolower(str_replace(" ","",$user_full_name)); $user_email = str_replace(" ","_",$user_full_name).'@social-user.com'; } } else { $email_explode = array(); $email_explode = explode("@", $user_email); $username = $email_explode[0]; } } //Checking if email or username already exist $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_email = %s", $user_email)); $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users where user_login = %s", $username)); if( !isset($email_user_id) && !isset($username_user_id) && (!empty($orignal_username) || !empty($orignal_email))) { $email_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta where meta_key = 'moopenid_orignal_email' and meta_value = %s", $orignal_email)); $username_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta where meta_key = 'moopenid_orignal_username' and meta_value = %s", $orignal_username)); } mo_openid_start_session(); if( isset($email_user_id)) { // user is a member $user = get_user_by('id', $email_user_id ); $user_id = $user->ID; if(get_option('moopenid_social_login_avatar') && isset($user_picture)) update_user_meta($user_id, 'moopenid_user_avatar', $user_picture); $_SESSION['mo_login'] = true; do_action( 'wp_login', $user->user_login, $user ); wp_set_auth_cookie( $user_id, true ); } else if( isset($username_user_id) ) { // user is a member $user = get_user_by('id', $username_user_id ); $user_id = $user->ID; if(get_option('moopenid_social_login_avatar') && isset($user_picture)) update_user_meta($user_id, 'moopenid_user_avatar', $user_picture); $_SESSION['mo_login'] = true; do_action( 'wp_login', $user->user_login, $user ); wp_set_auth_cookie( $user_id, true ); } else { // this user is a guest if(get_option('mo_openid_auto_register_enable')) { $random_password = wp_generate_password( 10, false ); $userdata = array( 'user_login' => $username, 'user_email' => $user_email, 'user_pass' => $random_password, 'display_name' => $user_full_name, 'first_name' => $first_name, 'last_name' => $last_name, 'user_url' => $user_url, ); $user_id = wp_insert_user( $userdata); if(is_wp_error( $user_id )) { //print_r($user_id); echo '
    There was an error in registration. Please contact your administrator.'; exit(); } $user = get_user_by('email', $user_email ); if(get_option('mo_openid_login_role_mapping') && mo_openid_is_customer_valid()){ $user->set_role( get_option('mo_openid_login_role_mapping') ); } //Add meta if username in other language if(!empty($orignal_username)) { update_user_meta($user_id, 'moopenid_orignal_username', $orignal_username); } //Add meta if email in other language if(!empty($orignal_email)) { update_user_meta($user_id, 'moopenid_orignal_email', $orignal_email); } if(get_option('moopenid_social_login_avatar') && isset($user_picture)){ update_user_meta($user_id, 'moopenid_user_avatar', $user_picture); } $_SESSION['mo_login'] = true; do_action( 'user_register', $user_id); do_action( 'wp_login', $user->user_login, $user ); wp_set_auth_cookie( $user_id, true ); } } } $redirect_url = mo_openid_get_redirect_url(); wp_redirect($redirect_url); exit; } if(isset($_REQUEST['autoregister']) and strpos($_REQUEST['autoregister'],'false') !== false) { if(!is_user_logged_in()) { mo_openid_disabled_register_message(); } } } function mo_openid_decrypt($param) { if(strcmp($param,'null')!=0 && strcmp($param,'')!=0){ $customer_token = get_option('mo_openid_customer_token'); $base64decoded = base64_decode($param); $token_params_decrypt = mcrypt_decrypt( MCRYPT_RIJNDAEL_128, $customer_token, $base64decoded, MCRYPT_MODE_ECB ); return $token_params_decrypt; }else{ return ''; } } function mo_openid_disabled_register_message() { wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); wp_enqueue_script( 'mo-wp-settings-script',plugins_url('includes/js/settings_popup.js', __FILE__), array('jquery')); add_thickbox(); $script = ''; echo $script; } function mo_openid_get_redirect_url() { $option = get_option( 'mo_openid_login_redirect' ); $redirect_url = site_url(); if( $option == 'same' ) { if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){ $http = "https://"; } else { $http = "http://"; } $redirect_url = urldecode(html_entity_decode(esc_url($http . $_SERVER["HTTP_HOST"] . str_replace('option=moopenid','',$_SERVER['REQUEST_URI'])))); if(html_entity_decode(esc_url(remove_query_arg('ss_message', $redirect_url))) == wp_login_url() || strpos($_SERVER['REQUEST_URI'],'wp-login.php') !== FALSE || strpos($_SERVER['REQUEST_URI'],'wp-admin') !== FALSE){ $redirect_url = site_url().'/'; } } else if( $option == 'homepage' ) { $redirect_url = site_url(); } else if( $option == 'dashboard' ) { $redirect_url = admin_url(); } else if( $option == 'custom' ) { $redirect_url = get_option('mo_openid_login_redirect_url'); } if(strpos($redirect_url,'?') !== FALSE) { $redirect_url .= get_option('mo_openid_auto_register_enable') ? '' : '&autoregister=false'; } else{ $redirect_url .= get_option('mo_openid_auto_register_enable') ? '' : '?autoregister=false'; } return $redirect_url; } function mo_openid_redirect_after_logout($logout_url) { if(get_option('mo_openid_logout_redirection_enable')){ $option = get_option( 'mo_openid_logout_redirect' ); $redirect_url = site_url(); if( $option == 'homepage' ) { $redirect_url = $logout_url . '&redirect_to=' .home_url() ; } else if($option == 'currentpage'){ if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){ $http = "https://"; } else { $http = "http://"; } $redirect_url = $logout_url . '&redirect_to=' . $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']; } else if($option == 'login') { $redirect_url = $logout_url . '&redirect_to=' . site_url() . '/wp-admin' ; } else if($option == 'custom') { $redirect_url = $logout_url . '&redirect_to=' . site_url() . (null !== get_option('mo_openid_logout_redirect_url')?get_option('mo_openid_logout_redirect_url'):''); } return $redirect_url; }else{ return $logout_url; } } function mo_openid_login_redirect($username = '', $user = NULL){ mo_openid_start_session(); if(is_string($username) && $username && is_object($user) && !empty($user->ID) && ($user_id = $user->ID) && isset($_SESSION['mo_login']) && $_SESSION['mo_login']){ $_SESSION['mo_login'] = false; wp_set_auth_cookie( $user_id, true ); $redirect_url = mo_openid_get_redirect_url(); wp_redirect($redirect_url); exit; } } if(get_option('mo_openid_logout_redirection_enable') == 1){ add_filter( 'logout_url', 'mo_openid_redirect_after_logout',0,1); } add_action( 'widgets_init', create_function( '', 'register_widget( "mo_openid_login_wid" );' ) ); add_action( 'widgets_init', create_function( '', 'return register_widget( "mo_openid_sharing_ver_wid" );' ) ); add_action( 'widgets_init', create_function( '', 'return register_widget( "mo_openid_sharing_hor_wid" );' ) ); add_action( 'init', 'mo_openid_login_validate' ); //add_action( 'init', 'mo_openid_start_session' ); //add_action( 'wp_logout', 'mo_openid_end_session' ); add_action( 'wp_login', 'mo_openid_login_redirect', 9, 2); } ?>