Esempio n. 1
0
 /**
  * Outputs the widget.
  * 
  * @since 	0.8.2
  * @since 	0.12.1	Added filters.
  * @since 	0.12.1	Fixed PHP warnings. See #146.
  *
  * @param 	array 	$args		Display arguments including before_title, after_title,
  *                        		before_widget, and after_widget.
  * @param 	array	$instance	The settings for the particular instance of the widget.
  * @return 	void
  */
 public function widget($args, $instance)
 {
     global $wp_theatre;
     $defaults = array('title' => '', 'template' => false, 'production' => false);
     $instance = wp_parse_args($instance, $defaults);
     $html = '';
     if (is_numeric($instance['production'])) {
         $production = new WPT_Production($instance['production']);
         /**
          * Filter the widget title.
          * 
          * @since	0.12.1
          * @param	string	$title	The widget title.
          * @param 	array 	$args		Display arguments including before_title, after_title,
          *                        		before_widget, and after_widget.
          * @param 	array	$instance	The settings for the particular instance of the widget.
          */
         $title = apply_filters('wpt/production/widget/title', $instance['title'], $args, $instance);
         if (!empty($title)) {
             $html .= $args['before_title'] . $title . $args['after_title'];
         }
         /**
          * Filter the production template.
          * 
          * @since	0.12.1
          * @param	string	$template	The production template.
          * @param	array	$args
          * @param	array	$instance
          */
         $template = apply_filters('wpt/production/widget/template', $instance['template'], $args, $instance);
         $html_production = $production->html($template);
         /**
          * Filter the HTML of the production.
          * 
          * @since	0.12.1
          * @param	string	$html_production	The HTML of the production.
          */
         $html_production = apply_filters('wpt/production/widget/production/html', $html_production, $production);
         $html .= $html_production;
         $html = $args['before_widget'] . $html . $args['after_widget'];
     }
     /**
      * Filter the HTML of the widget.
      *
      * @since	0.12.1
      * @param	string	$html		The HTML of the widget.
      * @param 	array 	$args		Display arguments including before_title, after_title,
      *                        		before_widget, and after_widget.
      * @param 	array	$instance	The settings for the particular instance of the widget.
      */
     $html = apply_filters('wpt/production/widget', $html, $args, $instance);
     echo $html;
 }
Esempio n. 2
0
 public function widget($args, $instance)
 {
     global $wp_theatre;
     if (!empty($instance['production'])) {
         echo $args['before_widget'];
         if (!empty($instance['title'])) {
             $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
             echo $args['before_title'] . $title . $args['after_title'];
         }
         $filters = array('limit' => $instance['limit']);
         if (!empty($instance['template'])) {
             $filters['template'] = $instance['template'];
         }
         $production = new WPT_Production($instance['production']);
         $production_args = array();
         if (!empty($instance['template'])) {
             $production_args['template'] = $instance['template'];
         }
         $html .= $production->html($production_args);
         echo $html;
         echo $args['after_widget'];
     }
 }