printf(_x('%1$s %2$s %3$s', 'product category widget width / height option', 'wpsc'), wpsc_form_label(_x('Height:', 'product category widget', 'wpsc'), $this->get_field_id('height'), array(), false), wpsc_form_input($this->get_field_name('height'), $height, array('id' => $this->get_field_id('height'), 'size' => 3), false), __('px', 'wpsc')); ?> </li> </ul> <p> <?php echo _x('Select Categories:', 'product category widget', 'wpsc'); ?> <br /> <small><?php esc_html_e('Leave all unchecked if you want to display all', 'wpsc'); ?> </small><br> </p> <ul style="margin-left: 18px;"> <?php foreach ($categories as $category) { ?> <li> <?php wpsc_form_checkbox($this->get_field_name('categories') . '[]', $category->term_id, esc_html($category->name), in_array($category->term_id, (array) $instance['categories'])); ?> <br /> </li> <?php } ?> </ul>
public function filter_output_checkboxes($output, $field_array) { extract($field_array); $description_html = apply_filters('wpsc_settings_' . $name . '_description', $description, $field_array); if (!isset($class)) { $class = 'wpsc-checkbox'; } // For checkboxes, we should assume these are in a set. As such, they need to be POSTed as an array. $name .= '[]' !== substr($name, -2) ? '[]' : ''; $output = ''; foreach ($options as $checkbox_value => $checkbox_label) { $checkbox_id = $id . '-' . sanitize_title_with_dashes($checkbox_value); $checked = in_array($checkbox_value, (array) $value); $output .= wpsc_form_checkbox($name, $checkbox_value, $checkbox_label, $checked, array('id' => $checkbox_id, 'class' => $class), false); } $output .= '<p class="howto">' . $description_html . '</p>'; return $output; }
function wpsc_form_checkboxes($name, $selected_values = '', $options = array(), $atts = array(), $echo = true) { if (!is_array($atts)) { $atts = array(); } $selected_values = (array) $selected_values; $output = ''; foreach ($options as $value => $title) { $option_atts = $atts; $option_atts['id'] = $atts['id'] . '-' . sanitize_title($value); $checked = in_array($value, $selected_values); $output .= wpsc_form_checkbox($name, $value, $title, $checked, $option_atts, false); } if (!$echo) { return $output; } echo $output; }
<p> <?php wpsc_form_checkbox($this->get_field_name('show_count'), 1, _x('Show Product Count', 'product category widget', 'wp-e-commerce'), $show_count); ?> </p> <p> <?php wpsc_form_checkbox($this->get_field_name('show_hierarchy'), 1, _x('Show Hierarchy', 'product category widget', 'wp-e-commerce'), $show_hierarchy); ?> </p> <p> <?php wpsc_form_checkbox($this->get_field_name('show_image'), 1, _x('Show Thumbnails', 'product category widget', 'wp-e-commerce'), !empty($instance['show_image'])); ?> </p> <ul style="margin-left:18px;"> <li> <?php printf(_x('%1$s %2$s %3$s', 'product category widget width / height option', 'wp-e-commerce'), wpsc_form_label(_x('Width:', 'product category widget', 'wp-e-commerce'), $this->get_field_id('width'), array(), false), wpsc_form_input($this->get_field_name('width'), $width, array('id' => $this->get_field_id('width'), 'size' => 3), false), __('px', 'wp-e-commerce')); ?> </li> <li> <?php printf(_x('%1$s %2$s %3$s', 'product category widget width / height option', 'wp-e-commerce'), wpsc_form_label(_x('Height:', 'product category widget', 'wp-e-commerce'), $this->get_field_id('height'), array(), false), wpsc_form_input($this->get_field_name('height'), $height, array('id' => $this->get_field_id('height'), 'size' => 3), false), __('px', 'wp-e-commerce')); ?> </li> </ul>
</p> <p> <?php wpsc_form_checkbox($this->get_field_name('show_you_save'), 1, _x('Show "You save"', 'on sale widget', 'wpsc'), $instance['show_you_save']); ?> </p> <p> <?php wpsc_form_checkbox($this->get_field_name('show_description'), 1, _x('Show Description', 'on sale widget', 'wpsc'), $instance['show_description']); ?> </p> <p> <?php wpsc_form_checkbox($this->get_field_name('show_image'), 1, _x('Show Thumbnails', 'on sale widget', 'wpsc'), !empty($instance['show_image'])); ?> </p> <ul style="margin-left:18px;"> <li> <?php printf(_x('%1$s %2$s %3$s', 'on sale widget width / height option', 'wpsc'), wpsc_form_label(_x('Width:', 'on sale widget', 'wpsc'), $this->get_field_id('width'), array(), false), wpsc_form_input($this->get_field_name('width'), $instance['width'], array('id' => $this->get_field_id('width'), 'size' => 3), false), __('px', 'wpsc')); ?> </li> <li> <?php printf(_x('%1$s %2$s %3$s', 'on sale widget width / height option', 'wpsc'), wpsc_form_label(_x('Height:', 'on sale widget', 'wpsc'), $this->get_field_id('height'), array(), false), wpsc_form_input($this->get_field_name('height'), $instance['width'], array('id' => $this->get_field_id('height'), 'size' => 3), false), __('px', 'wpsc')); ?> </li> </ul>