'contact_us', 'description' => esc_html__( 'Your contact information.', 'bloggers-lite' ), ); parent::__construct( 'contact-information', 'S →' . esc_html__( 'Contact Information', 'bloggers-lite' ), $widget_ops ); $this->alt_option_name = 'widget-contact_us'; add_action( 'save_post', array( $this, 'flush_widget_cache1' ) ); add_action( 'deleted_post', array( $this, 'flush_widget_cache1' ) ); add_action( 'switch_theme', array( $this, 'flush_widget_cache1' ) ); } /** * @since Bloggers Lite 1.0 * @param array $args arguments from sidebar * @param array $instance instance of widget * @return return html for front end display */ function widget( $args, $instance ) { $cache = array(); if ( ! $this->is_preview() ) { $cache = wp_cache_get( 'widget-contact_us', 'widget' ); } if ( ! is_array( $cache ) ) { $cache = array(); } if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } if ( isset( $cache[ $args['widget_id'] ] ) ) { echo $cache[ $args['widget_id'] ]; return; } ob_start(); extract( $args ); $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : esc_html__( 'Contact Us', 'bloggers-lite' ); /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $address = isset( $instance['address'] ) ? $instance['address'] : ''; $phon_number = isset( $instance['phon_number'] ) ? $instance['phon_number'] : ''; $fax = isset( $instance['fax'] ) ? $instance['fax'] : ''; $email = isset( $instance['email'] ) ? $instance['email'] : ''; echo $before_widget; echo $before_title . $title . $after_title; ?>
is_preview() ) { $cache[ $args['widget_id'] ] = ob_get_flush(); wp_cache_set( 'widget-contact_us', $cache, 'widget' ); } else { ob_end_flush(); } } /** * @since Bloggers Lite 1.0 * @param array $new_instance updated array * @param array $old_instance old array * @return array $instance instance with new value */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['address'] = $new_instance['address']; $instance['phon_number'] = strip_tags( $new_instance['phon_number'] ); $instance['fax'] = strip_tags( $new_instance['fax'] ); $instance['email'] = strip_tags( $new_instance['email'] ); $this->flush_widget_cache1(); $alloptions = wp_cache_get( 'alloptions', 'options' ); if ( isset( $alloptions['widget-contact_us'] ) ) { delete_option( 'widget-contact_us' ); } return $instance; } function flush_widget_cache1() { wp_cache_delete( 'widget-contact_us', 'widget' ); } /** * @since Bloggers Lite 1.0 * @param array $instance instance of widget * @return html return html for admin side display */ function form( $instance ) { $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; $address = isset( $instance['address'] ) ? $instance['address'] : ''; $phon_number = isset( $instance['phon_number'] ) ? $instance['phon_number'] : ''; $email = isset( $instance['email'] ) ? $instance['email'] : ''; $fax = isset( $instance['fax'] ) ? $instance['fax'] : ''; ?>