/** * Form * * Outputs the Widget form on the /wp-admin/widgets.php Page * * @see WP_Widget::form() * */ function form($instance) { global $simple_links; $instance = $this->migrateOldData($instance); $instance = wp_parse_args($instance, $this->defaults); ?> <input type="hidden" name="<?php echo $this->get_field_name('simple_links_version'); ?> " value="<?php echo SIMPLE_LINKS_VERSION; ?> "/> <em><?php _e('Be sure the see the Help section in the top right corner of the screen for questions!', 'simple-links'); ?> </em> <p> <strong><?php _e('Links Title', 'simple-links'); ?> :</strong> <input class="simple-links-title widefat" type="text" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo esc_attr($instance['title']); ?> " /> </p> <strong><?php _e('Order Links By', 'simple-links'); ?> </strong> <select id="<?php echo $this->get_field_id('orderby'); ?> " name="<?php echo $this->get_field_name('orderby'); ?> "> <?php simple_links::orderby_options($instance['orderby']); ?> </select> <p> <strong> <?php _e('Order', 'simple-links'); ?> : </strong> <select id="<?php echo $this->get_field_id('order'); ?> " name="<?php echo $this->get_field_name('order'); ?> "> <option value="ASC" <?php selected($instance['order'], 'ASC'); ?> > <?php _e('Ascending', 'simple-links'); ?> </option> <option value="DESC" <?php selected($instance['order'], 'DESC'); ?> > <?php _e('Descending', 'simple-links'); ?> </option> </select> </p> <p> <strong> <?php _e('Categories (optional)', 'simple-links'); ?> : </strong> <?php $cats = Simple_Links_Categories::get_category_names(); if (!empty($cats)) { $term_args = array('walker' => new Simple_Links_Category_Checklist($this->get_field_name('category'), $instance['category']), 'taxonomy' => Simple_Links_Categories::TAXONOMY, 'checked_ontop' => false); ?> <ul class="sl-categories"> <?php wp_terms_checklist(0, $term_args); ?> </ul> <?php } else { _e('No link categories have been created yet.', 'simple-links'); } ?> </p> <p> <strong><?php _e('Include Child Categories Of Selected Categories', 'simple-links'); ?> </strong> <input type="checkbox" id="<?php echo $this->get_field_id('include_child_categories'); ?> " name="<?php echo $this->get_field_name('include_child_categories'); ?> " <?php checked($instance['include_child_categories']); ?> value="1"/> </p> <hr> <p> <strong><?php _e('Number Of Links', 'simple-links'); ?> :</strong> <select id="<?php echo $this->get_field_id('numberposts'); ?> " name="<?php echo $this->get_field_name('numberposts'); ?> "> <option value="-1">All</option> <?php for ($i = 1; $i < 50; $i++) { printf('<option value="%s" %s>%s</option>', $i, selected($instance['numberposts'], $i), $i); } ?> </select> </p> <strong><?php _e('Show Description', 'simple-links'); ?> </strong> <input type="checkbox" id="<?php echo $this->get_field_id('description'); ?> " name="<?php echo $this->get_field_name('description'); ?> " <?php checked($instance['description']); ?> value="1"/> <br> <p> <strong><?php _e('Include Description Paragraph Format', 'simple-links'); ?> </strong> <input type="checkbox" id="<?php echo $this->get_field_id('show_description_formatting'); ?> " name="<?php echo $this->get_field_name('show_description_formatting'); ?> " <?php checked($instance['show_description_formatting']); ?> value="1"/> </p> <hr> <p> <strong><?php _e('Show Image', 'simple-links'); ?> </strong> <input type="checkbox" id="<?php echo $this->get_field_id('show_image'); ?> " name="<?php echo $this->get_field_name('show_image'); ?> " <?php checked($instance['show_image']); ?> value="1"/> </p> <p> <strong><?php _e('Remove Line Break Between Image and Link', 'simple-links'); ?> </strong> <input type="checkbox" id="<?php echo $this->get_field_id('remove_line_break'); ?> " name="<?php echo $this->get_field_name('remove_line_break'); ?> " <?php checked($instance['remove_line_break']); ?> value="1"/> </p> <strong><?php _e('Display Image Without Title', 'simple-links'); ?> </strong> <input type="checkbox" id="<?php echo $this->get_field_id('show_image_only'); ?> " name="<?php echo $this->get_field_name('show_image_only'); ?> " <?php checked($instance['show_image_only']); ?> value="1"/> <br> <p> <strong><?php _e('Image Size', 'simple-links'); ?> :</strong> <select id="<?php echo $this->get_field_id('image_size'); ?> " name="<?php echo $this->get_field_name('image_size'); ?> "> <?php foreach ($simple_links->image_sizes() as $size) { printf('<option value="%s" %s>%s</option>', $size, selected($instance['image_size'], $size), $size); } ?> </select> </p> <hr> <br> <strong> <?php _e('Display Additional Fields', 'simple-links'); ?> : </strong> <br> <?php $fields = $simple_links->getAdditionalFields(); if (empty($fields)) { echo '<em>' . __('There have been no additional fields added.', 'simple-links') . '</em>'; } else { foreach ($fields as $field) { if (!isset($instance['fields'][$field])) { $instance['fields'][$field] = 0; } printf(' <input type="checkbox" style="margin: 3px 0" value="%s" name="%s[%s]" %s/> %s <br>', $field, $this->get_field_name('fields'), $field, checked($instance['fields'][$field], $field, false), $field); } } ?> <p> <strong><?php _e('Field Separator', 'simple-links'); ?> :</strong> <br> <em><?php _e('HTML is allowed', 'simple-links'); ?> : - e.g. '<br>'</em> <br> <input type="text" id="<?php echo $this->get_field_id('separator'); ?> " name="<?php echo $this->get_field_name('separator'); ?> " value="<?php echo esc_attr($instance['separator']); ?> " class="widefat"/> </p> <?php do_action('simple_links_widget_form', $instance, $this); }
</label> </p> <p> <label><?php _e('Order By', 'simple-links'); ?> : <select id="orderby"> <option value=""><?php _e('- select an order by - ', 'simple-links'); ?> </option> <?php simple_links::orderby_options(); ?> </select> </label> </p> <p> <label><?php _e('Order', 'simple-links'); ?> : <select id="order"> <option value=""><?php _e('- select an order -', 'simple-links'); ?> </option>