Sindbad~EG File Manager
<?php
use RealPress\Helpers\Settings;
class WP_Realpro_Widget_Create_listing extends WP_Widget {
function __construct() {
$widget_ops = array( 'classname' => 'realpro_widget_create_listing', 'description' => esc_html( "Realpro create listing option.", "realpro" ) );
parent::__construct( 'realpro-create-listing', esc_html( '[Realpro] Create Listing', 'realpro' ), $widget_ops );
$this->alt_option_name = 'realpro_widget_create_listing';
}
public function widget( $args, $instance ) {
ob_start();
echo wp_kses_post( $args['before_widget'] );
if ( is_user_logged_in() ) {
if ( current_user_can( 'edit_realpress-properties' ) ) {
$url = admin_url( 'post-new.php?post_type=realpress-property' );
} else {
$url = get_permalink( Settings::get_setting_detail( 'group:page:fields:become_an_agent_page' ) );
}
} else {
$url = $instance['redirect_link'];
}
?>
<div class="realpro-button-create-listing">
<a href=" <?php echo esc_url( $url ); ?> " class="realpro-create-listing__link" role="button" target="_blank">
<i class="rp-plus-circle"></i>
<?php
if ( $instance['title'] ) {
echo wp_kses_post( esc_html( $instance['title'] ));
}
?>
</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['title'] = $new_instance['title'];
$instance['redirect_link'] = $new_instance['redirect_link'];
return $instance;
}
public function form( $instance ) {
$redirect_link = isset( $instance['redirect_link'] ) ? esc_attr( $instance['redirect_link'] ) : '#';
$title = isset( $instance['title'] ) ? esc_html( $instance['title'], 'realpro' ) : esc_html( 'Create A Listing', 'realpro' );
?>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html__( 'Text Button:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"/>
</p>
<p>
<label for="<?php echo esc_html( $this->get_field_id( 'redirect_link' ) ); ?>"><?php echo esc_html__( 'Redirect Link:', 'realpro' ); ?></label>
<input class="widefat" id="<?php echo esc_html( $this->get_field_id( 'redirect_link' ) ); ?>" name="<?php echo esc_html( $this->get_field_name( 'redirect_link' ) ); ?>" type="text" value="<?php echo esc_attr( $redirect_link ); ?>"/>
</p>
<?php
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists