'widget_portfolio_recently_viewed', 'description' => __( 'Display a list of recently viewed portfolio items.', 'a3-portfolio' ) ); parent::__construct('widget_a3_portfolio_recently_viewed', __('a3 Portfolios Recently Viewed', 'a3-portfolio' ), $widget_ops); } function widget( $args, $instance ) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; echo $this->show_portfolio_recently_viewed(); echo $after_widget; } function show_portfolio_recently_viewed() { global $post; $result_html = ''; $current_lang = ''; if ( class_exists('SitePress') ) { $current_lang = ICL_LANGUAGE_CODE; } do_action( 'a3_portfolio_before_recently_widget' ); if ( isset($_COOKIE['portfolio_recentviews' . $current_lang ]) && is_array(json_decode($_COOKIE['portfolio_recentviews' . $current_lang ])) && count(json_decode($_COOKIE['portfolio_recentviews' . $current_lang ])) > 0 ) { $result_html .= '
'; $result_html .= '
' . a3_portfolio_ei_ict_t__( 'Recently Widget - Clear All', __( 'Clear All', 'a3-portfolio' ) ). '
'; $result_html .= '
'; } else { $result_html = '
' . a3_portfolio_ei_ict_t__( 'Recently Widget - No Portfolio', __( 'No Portfolio Recently Viewed !', 'a3-portfolio' ) ). '
'; } do_action( 'a3_portfolio_after_recently_widget' ); return $result_html; } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = esc_attr($new_instance['title']); return $instance; } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $title = esc_attr($instance['title']); ?>