mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 14:50:29 +00:00
Links widget options. Props DD32. see #9196
git-svn-id: https://develop.svn.wordpress.org/trunk@10712 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+47
-1
@@ -748,14 +748,59 @@ function wp_widget_pages_control() {
|
||||
function wp_widget_links($args) {
|
||||
extract($args, EXTR_SKIP);
|
||||
|
||||
$link_options = get_option('widget_links');
|
||||
$show_description = isset($link_options['description']) ? $link_options['description'] : false;
|
||||
$show_name = isset($link_options['name']) ? $link_options['name'] : false;
|
||||
$show_rating = isset($link_options['rating']) ? $link_options['rating'] : false;
|
||||
$show_images = isset($link_options['images']) ? $link_options['images'] : true;
|
||||
|
||||
$before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
|
||||
wp_list_bookmarks(apply_filters('widget_links_args', array(
|
||||
'title_before' => $before_title, 'title_after' => $after_title,
|
||||
'category_before' => $before_widget, 'category_after' => $after_widget,
|
||||
'show_images' => true, 'class' => 'linkcat widget'
|
||||
'show_images' => $show_images, 'show_description' => $show_description,
|
||||
'show_name' => $show_name, 'show_rating' => $show_rating,
|
||||
'class' => 'linkcat widget'
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display and process links widget options form.
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
function wp_widget_links_control() {
|
||||
$options = $newoptions = get_option('widget_links');
|
||||
|
||||
//Defaults
|
||||
if ( ! $newoptions )
|
||||
$newoptions = array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false);
|
||||
|
||||
if ( isset($_POST['links-submit']) ) {
|
||||
$newoptions['description'] = isset($_POST['links-description']);
|
||||
$newoptions['name'] = isset($_POST['links-name']);
|
||||
$newoptions['rating'] = isset($_POST['links-rating']);
|
||||
$newoptions['images'] = isset($_POST['links-images']);
|
||||
}
|
||||
if ( $options != $newoptions ) {
|
||||
$options = $newoptions;
|
||||
update_option('widget_links', $options);
|
||||
}
|
||||
?>
|
||||
<p>
|
||||
<label for="links-images"><input class="checkbox" type="checkbox" <?php checked($options['images'], true) ?> id="links-images" name="links-images" /> <?php _e('Show Link Image'); ?></label>
|
||||
<br />
|
||||
<label for="links-name"><input class="checkbox" type="checkbox" <?php checked($options['name'], true) ?> id="links-name" name="links-name" /> <?php _e('Show Link Name'); ?></label>
|
||||
<br />
|
||||
<label for="links-description"><input class="checkbox" type="checkbox" <?php checked($options['description'], true) ?> id="links-description" name="links-description" /> <?php _e('Show Link Description'); ?></label>
|
||||
<br />
|
||||
<label for="links-rating"><input class="checkbox" type="checkbox" <?php checked($options['rating'], true) ?> id="links-rating" name="links-rating" /> <?php _e('Show Link Rating'); ?></label>
|
||||
</p>
|
||||
<input type="hidden" id="links-submit" name="links-submit" value="1" />
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display search widget.
|
||||
*
|
||||
@@ -1923,6 +1968,7 @@ function wp_widgets_init() {
|
||||
|
||||
$widget_ops = array('classname' => 'widget_links', 'description' => __( "Your blogroll") );
|
||||
wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $widget_ops);
|
||||
wp_register_widget_control('links', __('Links'), 'wp_widget_links_control' );
|
||||
|
||||
$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
|
||||
wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops);
|
||||
|
||||
Reference in New Issue
Block a user