* @copyright Copyright (c) 2008 - 2012, Justin Tadlock * @link http://themehybrid.com/hybrid-core * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ /** * Archives widget class. * * @since 0.6.0 */ class Hybrid_Widget_Archives extends WP_Widget { /** * Set up the widget's unique name, ID, class, description, and other options. * * @since 1.2.0 */ function __construct() { /* Set up the widget options. */ $widget_options = array( 'classname' => 'archives', 'description' => esc_html__( 'An advanced widget that gives you total control over the output of your archives.', 'hybrid-core' ) ); /* Set up the widget control options. */ $control_options = array( 'width' => 525, 'height' => 350 ); /* Create the widget. */ $this->WP_Widget( 'hybrid-archives', // $this->id_base __( 'Archives', 'hybrid-core' ), // $this->name $widget_options, // $this->widget_options $control_options // $this->control_options ); } /** * Outputs the widget based on the arguments input through the widget controls. * * @since 0.6.0 */ function widget( $sidebar, $instance ) { extract( $sidebar ); /* Set the $args for wp_get_archives() to the $instance array. */ $args = $instance; /* Overwrite the $echo argument and set it to false. */ $args['echo'] = false; /* Output the theme's $before_widget wrapper. */ echo $before_widget; /* If a title was input by the user, display it. */ if ( !empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; /* Get the archives list. */ $archives = str_replace( array( "\r", "\n", "\t" ), '', wp_get_archives( $args ) ); /* If the archives should be shown in a element and each