public function widget($args, $instance)
    {
        global $wpdb;

        // Try to get cached widget.
        $cache = wp_cache_get($this->getModel()->getIdentifier(), 'widget');

        if (!is_array($cache)) {
            $cache = [];
        }

        if (!isset($args['widget_id'])) {
            $args['widget_id'] = null;
        }

        // If all elements are in cache, no need to construct the output again.
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }

        // Start output buffering.
        ob_start();

        // Extract data.
        extract($args, EXTR_SKIP);

        // Title
        $title = empty($instance['title']) ? '' : $instance['title'];
        $title = apply_filters('widget_title', $title, $instance, $this->getModel()->getIdentifier());

        // Display content widget
        $this->widget_start($args, $instance, $title);
        $this->display($instance);
        $this->widget_end($args);

        // Renew the cache.
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set($this->getModel()->getIdentifier(), $cache, 'widget');
    }
public function widget($args, $instance)
    {
        global $wpdb;

        // Try to get cached widget.
        $cache = wp_cache_get($this->getModel()->getIdentifier(), 'widget');

        if (!is_array($cache)) {
            $cache = [];
        }

        if (!isset($args['widget_id'])) {
            $args['widget_id'] = null;
        }

        // If all elements are in cache, no need to construct the output again.
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }

        // Start output buffering.
        ob_start();

        // Extract data.
        extract($args, EXTR_SKIP);

        // Title
        $title = empty($instance['title']) ? '' : $instance['title'];
        $title = apply_filters('widget_title', $title, $instance, $this->getModel()->getIdentifier());

        // Display content widget
        $this->widget_start($args, $instance, $title);
        $this->display($instance);
        $this->widget_end($args);

        // Renew the cache.
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set($this->getModel()->getIdentifier(), $cache, 'widget');
    }
public function widget ( $ args , $ instance ) { global $ wpdb ; // Try to get cached widget. $ cache = wp_cache_get ( $ this -> getModel ( ) -> getIdentifier ( ) , 'widget' ) ; if ( ! is_array ( $ cache ) ) { $ cache = [ ] ; } if ( ! isset ( $ args [ 'widget_id' ] ) ) { $ args [ 'widget_id' ] = null ; } // If all elements are in cache, no need to construct the output again. if ( isset ( $ cache [ $ args [ 'widget_id' ] ] ) ) { echo $ cache [ $ args [ 'widget_id' ] ] ; return ; } // Start output buffering. ob_start ( ) ; // Extract data. extract ( $ args , EXTR_SKIP ) ; // Title $ title = empty ( $ instance [ 'title' ] ) ? '' : $ instance [ 'title' ] ; $ title = apply_filters ( 'widget_title' , $ title , $ instance , $ this -> getModel ( ) -> getIdentifier ( ) ) ; // Display content widget $ this -> widget_start ( $ args , $ instance , $ title ) ; $ this -> display ( $ instance ) ; $ this -> widget_end ( $ args ) ; // Renew the cache. $ cache [ $ args [ 'widget_id' ] ] = ob_get_flush ( ) ; wp_cache_set ( $ this -> getModel ( ) -> getIdentifier ( ) , $ cache , 'widget' ) ; }
Outputs the HTML for this widget.

@param array $args
@param array $instance
@return void
Outputs the HTML for this widget .