Sindbad~EG File Manager
<?php
/**
* Special product
*/
class WP_Realpro_Widget_Login extends WP_Widget {
function __construct() {
$widget_ops = array( 'classname' => 'realpro_widget_login', 'description' => esc_html( "Realpro login option.", "realpro" ) );
parent::__construct( 'realpro-login', esc_html( '[Realpro] Login', 'realpro' ), $widget_ops );
$this->alt_option_name = 'realpro_widget_login';
}
public function widget( $args, $instance ) {
ob_start();
echo wp_kses_post( $args['before_widget'] );
?>
<div class="realpro-login-regis">
<?php
$registration_enabled = get_option( 'users_can_register' );
if ( is_user_logged_in() ) {
if ( ( isset( $instance['text_profile'] ) && $instance['text_profile'] ) ) {
echo '<a class="profile" href="' . esc_url( $instance['profile_url'] ) . '"><i class="rp-author"></i>';
echo esc_html( $instance['text_profile'] );
echo '</a>';
}
if ( ( isset( $instance['text_logout'] ) && $instance['text_logout'] ) ) {
echo '<a class="logout" href="' . esc_url( wp_logout_url( home_url() ) ) . '"><i class="rp-author"></i>';
echo esc_html( $instance['text_logout'] );
echo '</a>';
}
} else {
if ( $registration_enabled && ( isset( $instance['text_register'] ) && $instance['text_register'] ) ) {
echo '<a class="register" href="' . esc_url( $instance['url_register'] ) . '"><i class="rp-author"></i>';
echo esc_html( $instance['text_register'], );
echo '</a>';
}
if ( ( isset( $instance['text_login'] ) && $instance['text_login'] ) ) {
echo '<a class="login" href="' . esc_url( $instance['login_url'] ) . '"><i class="rp-author"></i>';
echo esc_html( $instance['text_login'] );
echo '</a>';
}
}
?>
</div>
<?php
echo wp_kses_post( $args['after_widget'] );
$content = ob_get_clean();
echo wp_kses_post($content);
}
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['text_register'] = $new_instance['text_register'];
$instance['url_register'] = $new_instance['url_register'];
$instance['text_profile'] = $new_instance['text_profile'];
$instance['profile_url'] = $new_instance['profile_url'];
$instance['text_login'] = $new_instance['text_login'];
$instance['login_url'] = $new_instance['login_url'];
$instance['text_logout'] = $new_instance['text_logout'];
return $instance;
}
public function form( $instance ) {
$text_register = isset( $instance['text_register'] ) ? esc_html( $instance['text_register'], 'realpro' ) : esc_html( 'Register', 'realpro' );
$url_register = isset( $instance['url_register'] ) ? esc_attr( $instance['url_register'] ) : '#';
$text_profile = isset( $instance['text_profile'] ) ? esc_html( $instance['text_profile'], 'realpro' ) : esc_html( 'Profile', 'realpro' );
$profile_url = isset( $instance['profile_url'] ) ? esc_attr( $instance['profile_url'] ) : '#';
$text_login = isset( $instance['text_login'] ) ? esc_html( $instance['text_login'], 'realpro' ) : esc_html( 'Login', 'realpro' );
$login_url = isset( $instance['login_url'] ) ? esc_attr( $instance['login_url'] ) : '#';
$text_logout = isset( $instance['text_logout'] ) ? esc_html( $instance['text_logout'], 'realpro' ) : esc_html( 'Logout', 'realpro' );
?>
<h3 class="title"><?php echo esc_html('Register', 'realpro'); ?></h3>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'text_register' ) ); ?>"><?php echo esc_html( 'Register Label:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'text_register' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'text_register' ) ); ?>" type="text" value="<?php echo esc_attr( $text_register ); ?>"/>
</p>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'url_register' ) ); ?>"><?php echo esc_html( 'Register Redirect Link:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'url_register' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'url_register' ) ); ?>" type="text" value="<?php echo esc_attr( $url_register ); ?>"/>
</p>
<hr>
<h3 class="title"><?php echo esc_html('Profile', 'realpro'); ?></h3>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'text_profile' ) ); ?>"><?php echo esc_html( 'Profile Label:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'text_profile' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'text_profile' ) ); ?>" type="text" value="<?php echo esc_attr( $text_profile ); ?>"/>
</p>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'profile_url' ) ); ?>"><?php echo esc_html( 'Profile Redirect Link:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'profile_url' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'profile_url' ) ); ?>" type="text" value="<?php echo esc_attr( $profile_url ); ?>"/>
</p>
<hr>
<h3 class="title"><?php echo esc_html('Login', 'realpro'); ?></h3>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'text_login' ) ); ?>"><?php echo esc_html( 'Login Label:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'text_login' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'text_login' ) ); ?>" type="text" value="<?php echo esc_attr( $text_login ); ?>"/>
</p>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'profile_url' ) ); ?>"><?php echo esc_html( 'Login Redirect Link:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'login_url' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'login_url' ) ); ?>" type="text" value="<?php echo esc_attr( $login_url ); ?>"/>
</p>
<hr>
<h3 class="title"><?php echo esc_html('Logout', 'realpro'); ?></h3>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'text_logout' ) ); ?>"><?php echo esc_html( 'Logout Label:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'text_logout' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'text_logout' ) ); ?>" type="text" value="<?php echo esc_attr( $text_logout ); ?>"/>
</p>
<?php
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists