Exemplo n.º 1
0
 /**
  * Display Widget Control Form
  *
  * @param unknown_type $instance
  */
 public function form($instance)
 {
     // displays the widget admin form
     $instance = wp_parse_args((array) $instance, array('title' => '', 'rssimage' => ''));
     $selected_cats = avhGetArrayValue($instance, 'post_group_category') !== '' ? unserialize($instance['post_group_category']) : false;
     ob_start();
     echo '<p>';
     avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
     echo '</p>';
     echo '<p>';
     avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) avhGetArrayValue($instance, 'count'));
     avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) avhGetArrayValue($instance, 'hierarchical'));
     avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) avhGetArrayValue($instance, 'hide_empty'));
     avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) avhGetArrayValue($instance, 'use_desc_for_title'));
     echo '</p>';
     echo '<p>';
     $options['ID'] = __('ID', 'avh-ec');
     $options['name'] = __('Name', 'avh-ec');
     $options['count'] = __('Count', 'avh-ec');
     $options['slug'] = __('Slug', 'avh-ec');
     avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_column'));
     unset($options);
     $options['asc'] = __('Ascending', 'avh-ec');
     $options['desc'] = __('Descending', 'avh-ec');
     avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_order'));
     unset($options);
     $options['list'] = __('List', 'avh-ec');
     $options['drop'] = __('Drop down', 'avh-ec');
     avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, avhGetArrayValue($instance, 'style'));
     unset($options);
     echo '</p>';
     echo '<p>';
     avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) avhGetArrayValue($instance, 'rssfeed'));
     avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), avhGetArrayValue($instance, 'rssimage'));
     echo '</p>';
     echo '<p>';
     echo '<b>' . __('Select Groups', 'avh-ec') . '</b><hr />';
     echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear" style="list-style-type: none; margin-left: 5px; padding-left: 0px; margin-bottom: 20px;">';
     echo '<li id="' . $this->get_field_id('group_category--1') . '" class="popular-group_category">';
     echo '<label for="' . $this->get_field_id('group_post_category') . '" class="selectit">';
     echo '<input value="all" id="' . $this->get_field_id('group_post_category') . '" name="' . $this->get_field_name('post_group_category') . '[all]" type="checkbox" ' . (false === $selected_cats ? ' CHECKED' : '') . '> ';
     _e('Any Group', 'avh-ec');
     echo '</label>';
     echo '</li>';
     $this->avh_wp_group_category_checklist($selected_cats, $this->number);
     echo '</ul>';
     echo '</p>';
     echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
     ob_end_flush();
 }
 /** Echo the settings update form
  *
  * @param array $instance Current settings
  */
 function form($instance)
 {
     // displays the widget admin form
     $instance = wp_parse_args((array) $instance, array('title' => '', 'rssimage' => ''));
     // Prepare data for display
     if (!($amount = (int) $instance['amount'])) {
         $amount = 5;
     }
     if ($amount < 1) {
         $amount = 1;
     }
     echo '<p>';
     avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
     echo '</p>';
     echo '<p>';
     avh_doWidgetFormText($this->get_field_id('amount'), $this->get_field_name('amount'), __('How many categories to show', 'avh-ec'), $amount);
     echo '</p>';
     echo '<p>';
     avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
     echo '<br />';
     avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
     echo '</p>';
     echo '<p>';
     $options['ID'] = __('ID', 'avh-ec');
     $options['name'] = __('Name', 'avh-ec');
     $options['count'] = __('Count', 'avh-ec');
     $options['slug'] = __('Slug', 'avh-ec');
     avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
     unset($options);
     $options['asc'] = __('Ascending', 'avh-ec');
     $options['desc'] = __('Descending', 'avh-ec');
     avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
     unset($options);
     $options['list'] = __('List', 'avh-ec');
     $options['drop'] = __('Drop down', 'avh-ec');
     avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
     unset($options);
     echo '</p>';
     echo '<p>';
     avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
     avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
     echo '</p>';
     echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
 }