X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..e08b42e8ad054ec67522d7ac1aaae5dc68cb3d01:/wp-includes/default-widgets.php
diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php
index bcbae03d..6c6e321f 100644
--- a/wp-includes/default-widgets.php
+++ b/wp-includes/default-widgets.php
@@ -14,7 +14,7 @@
class WP_Widget_Pages extends WP_Widget {
function __construct() {
- $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'Your site’s WordPress Pages') );
+ $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A list of your site’s Pages.') );
parent::__construct('pages', __('Pages'), $widget_ops);
}
@@ -190,7 +190,7 @@ class WP_Widget_Links extends WP_Widget {
class WP_Widget_Search extends WP_Widget {
function __construct() {
- $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site") );
+ $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") );
parent::__construct('search', __('Search'), $widget_ops);
}
@@ -233,7 +233,7 @@ class WP_Widget_Search extends WP_Widget {
class WP_Widget_Archives extends WP_Widget {
function __construct() {
- $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s posts') );
+ $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site’s Posts.') );
parent::__construct('archives', __('Archives'), $widget_ops);
}
@@ -298,7 +298,7 @@ class WP_Widget_Archives extends WP_Widget {
class WP_Widget_Meta extends WP_Widget {
function __construct() {
- $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
+ $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, & WordPress.org links.") );
parent::__construct('meta', __('Meta'), $widget_ops);
}
@@ -315,10 +315,11 @@ class WP_Widget_Meta extends WP_Widget {
RSS'); ?>
RSS'); ?>
-
+ %s',
+ esc_url( __( 'http://wordpress.org/' ) ),
+ esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ),
+ _x( 'WordPress.org', 'meta widget link text' )
+ ) ); ?>
'widget_calendar', 'description' => __( 'A calendar of your site’s posts') );
+ $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s Posts.') );
parent::__construct('calendar', __('Calendar'), $widget_ops);
}
@@ -390,7 +391,7 @@ class WP_Widget_Calendar extends WP_Widget {
class WP_Widget_Text extends WP_Widget {
function __construct() {
- $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));
+ $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.'));
$control_ops = array('width' => 400, 'height' => 350);
parent::__construct('text', __('Text'), $widget_ops, $control_ops);
}
@@ -440,7 +441,7 @@ class WP_Widget_Text extends WP_Widget {
class WP_Widget_Categories extends WP_Widget {
function __construct() {
- $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories" ) );
+ $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
parent::__construct('categories', __('Categories'), $widget_ops);
}
@@ -532,7 +533,7 @@ class WP_Widget_Categories extends WP_Widget {
class WP_Widget_Recent_Posts extends WP_Widget {
function __construct() {
- $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your site") );
+ $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site’s most recent Posts.") );
parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
$this->alt_option_name = 'widget_recent_entries';
@@ -558,8 +559,10 @@ class WP_Widget_Recent_Posts extends WP_Widget {
ob_start();
extract($args);
- $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base);
- if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' );
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
+ $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 10;
+ if ( ! $number )
$number = 10;
$show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
@@ -571,7 +574,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
have_posts() ) : $r->the_post(); ?>
-
-
+
@@ -593,7 +596,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['number'] = (int) $new_instance['number'];
- $instance['show_date'] = (bool) $new_instance['show_date'];
+ $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
$this->flush_widget_cache();
$alloptions = wp_cache_get( 'alloptions', 'options' );
@@ -632,7 +635,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
class WP_Widget_Recent_Comments extends WP_Widget {
function __construct() {
- $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'The most recent comments' ) );
+ $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'Your site’s most recent comments.' ) );
parent::__construct('recent-comments', __('Recent Comments'), $widget_ops);
$this->alt_option_name = 'widget_recent_comments';
@@ -640,6 +643,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
add_action( 'wp_head', array($this, 'recent_comments_style') );
add_action( 'comment_post', array($this, 'flush_widget_cache') );
+ add_action( 'edit_comment', array($this, 'flush_widget_cache') );
add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
}
@@ -674,9 +678,11 @@ class WP_Widget_Recent_Comments extends WP_Widget {
extract($args, EXTR_SKIP);
$output = '';
- $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title'], $instance, $this->id_base );
- if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' );
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
+ $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
+ if ( ! $number )
$number = 5;
$comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) );
@@ -716,14 +722,14 @@ class WP_Widget_Recent_Comments extends WP_Widget {
}
function form( $instance ) {
- $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
- $number = isset($instance['number']) ? absint($instance['number']) : 5;
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
+ $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
?>
-
-
+
+
-
-
+
+
__('Entries from any RSS or Atom feed') );
+ $widget_ops = array( 'description' => __('Entries from any RSS or Atom feed.') );
$control_ops = array( 'width' => 400, 'height' => 200 );
parent::__construct( 'rss', __('RSS'), $widget_ops, $control_ops );
}
@@ -861,18 +867,18 @@ function wp_widget_rss_output( $rss, $args = array() ) {
$title = __('Untitled');
$desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
- $desc = wp_html_excerpt( $desc, 360 );
+ $excerpt = wp_html_excerpt( $desc, 360 );
// Append ellipsis. Change existing [...] to […].
- if ( '[...]' == substr( $desc, -5 ) )
- $desc = substr( $desc, 0, -5 ) . '[…]';
- elseif ( '[…]' != substr( $desc, -10 ) )
- $desc .= ' […]';
+ if ( '[...]' == substr( $excerpt, -5 ) )
+ $excerpt = substr( $excerpt, 0, -5 ) . '[…]';
+ elseif ( '[…]' != substr( $excerpt, -10 ) && $desc != $excerpt )
+ $excerpt .= ' […]';
- $desc = esc_html( $desc );
+ $excerpt = esc_html( $excerpt );
if ( $show_summary ) {
- $summary = "";
+ $summary = "";
} else {
$summary = '';
}
@@ -923,7 +929,7 @@ function wp_widget_rss_form( $args, $inputs = null ) {
$default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true );
$inputs = wp_parse_args( $inputs, $default_inputs );
extract( $args );
- extract( $inputs, EXTR_SKIP);
+ extract( $inputs, EXTR_SKIP );
$number = esc_attr( $number );
$title = esc_attr( $title );
@@ -994,11 +1000,11 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
$items = (int) $widget_rss['items'];
if ( $items < 1 || 20 < $items )
$items = 10;
- $url = esc_url_raw(strip_tags( $widget_rss['url'] ));
- $title = trim(strip_tags( $widget_rss['title'] ));
- $show_summary = isset($widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;
- $show_author = isset($widget_rss['show_author']) ? (int) $widget_rss['show_author'] :0;
- $show_date = isset($widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;
+ $url = esc_url_raw( strip_tags( $widget_rss['url'] ) );
+ $title = isset( $widget_rss['title'] ) ? trim( strip_tags( $widget_rss['title'] ) ) : '';
+ $show_summary = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
+ $show_author = isset( $widget_rss['show_author'] ) ? (int) $widget_rss['show_author'] :0;
+ $show_date = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0;
if ( $check_feed ) {
$rss = fetch_feed($url);
@@ -1027,7 +1033,7 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
class WP_Widget_Tag_Cloud extends WP_Widget {
function __construct() {
- $widget_ops = array( 'description' => __( "Your most used tags in cloud format") );
+ $widget_ops = array( 'description' => __( "A cloud of your most used tags.") );
parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
}
@@ -1094,7 +1100,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
class WP_Nav_Menu_Widget extends WP_Widget {
function __construct() {
- $widget_ops = array( 'description' => __('Use this widget to add one of your custom menus as a widget.') );
+ $widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
}
@@ -1128,7 +1134,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
// Get menus
- $menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
+ $menus = wp_get_nav_menus( array( 'orderby' => 'name' ) );
// If no menus exists, direct the user to go and create some.
if ( !$menus ) {