D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
cwd
/
wp-content
/
plugins
/
aeen-core
/
widgets
/
Filename :
contact.php
back
Copy
<?php /** * @author RadiusTheme * @since 1.0 * @version 1.0 */ namespace radiustheme\Aeen_Core; use \WP_Widget; use \RT_Widget_Fields; use radiustheme\Aeen\Helper; class Contact_Widget extends WP_Widget { public function __construct() { $id = AEEN_CORE_THEME_PREFIX . '_contact'; parent::__construct( $id, // Base ID esc_html__( 'Aeen: Contact', 'aeen-core' ), // Name array( 'description' => esc_html__( 'Aeen: Contact Widget', 'aeen-core' ) ) ); } public function widget( $args, $instance ){ echo wp_kses_post( $args['before_widget'] ); if ( ! empty( $instance['title'] ) ) { echo wp_kses_post( $args['before_title'] ) . apply_filters( 'widget_title', esc_html( $instance['title'] ) ) . wp_kses_post( $args['after_title'] ); } ?> <ul class="footer-address"> <?php if( !empty( $instance['phone'] ) ){ ?><li><?php esc_html_e( 'Phone', 'aeen-core' ); ?>: <a href="tel:<?php echo esc_attr( $instance['phone'] ); ?>"><span><?php echo esc_html( $instance['phone'] ); ?></span></a></li><?php } if( !empty( $instance['email'] ) ){ ?><li><?php esc_html_e( 'E-mail', 'aeen-core' ); ?>: <a href="mailto:<?php echo esc_attr( $instance['email'] ); ?>"><span><?php echo esc_html( $instance['email'] ); ?></span></a></li><?php } if( !empty( $instance['address'] ) ){ ?><li><?php esc_html_e( 'Address', 'aeen-core' ); ?>: <span><?php echo wp_kses_post( $instance['address'] ); ?></span></li><?php } ?> </ul> <?php echo wp_kses_post( $args['after_widget'] ); } public function update( $new_instance, $old_instance ){ $instance = array(); $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field( $new_instance['title'] ) : ''; $instance['phone'] = ( ! empty( $new_instance['phone'] ) ) ? sanitize_text_field( $new_instance['phone'] ) : ''; $instance['email'] = ( ! empty( $new_instance['email'] ) ) ? sanitize_email( $new_instance['email'] ) : ''; $instance['address'] = ( ! empty( $new_instance['address'] ) ) ? wp_kses_post( $new_instance['address'] ) : ''; return $instance; } public function form( $instance ){ $defaults = array( 'title' => esc_html__( 'Contact Us' , 'aeen-core' ), 'phone' => '', 'email' => '', 'address' => '', ); $instance = wp_parse_args( (array) $instance, $defaults ); $fields = array( 'title' => array( 'label' => esc_html__( 'Title', 'aeen-core' ), 'type' => 'text', ), 'phone' => array( 'label' => esc_html__( 'Phone', 'aeen-core' ), 'type' => 'text', ), 'email' => array( 'label' => esc_html__( 'Email', 'aeen-core' ), 'type' => 'text', ), 'address' => array( 'label' => esc_html__( 'Address', 'aeen-core' ), 'type' => 'textarea', ), ); RT_Widget_Fields::display( $fields, $instance, $this ); } }