diff -r c7c34916027a -r 177826044cd9 wp/wp-includes/bookmark-template.php
--- a/wp/wp-includes/bookmark-template.php Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/bookmark-template.php Mon Oct 14 18:28:13 2019 +0200
@@ -28,7 +28,7 @@
*
* @type int|bool $show_updated Whether to show the time the bookmark was last updated.
* Accepts 1|true or 0|false. Default 0|false.
- * @type int|bool $show_description Whether to show the bookmakr description. Accepts 1|true,
+ * @type int|bool $show_description Whether to show the bookmark description. Accepts 1|true,
* Accepts 1|true or 0|false. Default 0|false.
* @type int|bool $show_images Whether to show the link image if available. Accepts 1|true
* or 0|false. Default 1|true.
@@ -50,10 +50,16 @@
*/
function _walk_bookmarks( $bookmarks, $args = '' ) {
$defaults = array(
- 'show_updated' => 0, 'show_description' => 0,
- 'show_images' => 1, 'show_name' => 0,
- 'before' => '
', 'after' => '', 'between' => "\n",
- 'show_rating' => 0, 'link_before' => '', 'link_after' => ''
+ 'show_updated' => 0,
+ 'show_description' => 0,
+ 'show_images' => 1,
+ 'show_name' => 0,
+ 'before' => '',
+ 'after' => '',
+ 'between' => "\n",
+ 'show_rating' => 0,
+ 'link_before' => '',
+ 'link_after' => '',
);
$r = wp_parse_args( $args, $defaults );
@@ -72,15 +78,15 @@
if ( ! empty( $bookmark->link_url ) ) {
$the_link = esc_url( $bookmark->link_url );
}
- $desc = esc_attr( sanitize_bookmark_field( 'link_description', $bookmark->link_description, $bookmark->link_id, 'display' ) );
- $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) );
- $title = $desc;
+ $desc = esc_attr( sanitize_bookmark_field( 'link_description', $bookmark->link_description, $bookmark->link_id, 'display' ) );
+ $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) );
+ $title = $desc;
if ( $r['show_updated'] ) {
if ( '00' != substr( $bookmark->link_updated_f, 0, 2 ) ) {
$title .= ' (';
$title .= sprintf(
- __('Last updated: %s'),
+ __( 'Last updated: %s' ),
date(
get_option( 'links_updated_date_format' ),
$bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )
@@ -96,7 +102,7 @@
}
$rel = $bookmark->link_rel;
if ( '' != $rel ) {
- $rel = ' rel="' . esc_attr($rel) . '"';
+ $rel = ' rel="' . esc_attr( $rel ) . '"';
}
$target = $bookmark->link_target;
if ( '' != $target ) {
@@ -110,7 +116,7 @@
if ( strpos( $bookmark->link_image, 'http' ) === 0 ) {
$output .= "
link_image\" $alt $title />";
} else { // If it's a relative path
- $output .= "
link_image\" $alt $title />";
+ $output .= '
link_image\" $alt $title />";
}
if ( $r['show_name'] ) {
$output .= " $name";
@@ -199,15 +205,24 @@
*/
function wp_list_bookmarks( $args = '' ) {
$defaults = array(
- 'orderby' => 'name', 'order' => 'ASC',
- 'limit' => -1, 'category' => '', 'exclude_category' => '',
- 'category_name' => '', 'hide_invisible' => 1,
- 'show_updated' => 0, 'echo' => 1,
- 'categorize' => 1, 'title_li' => __('Bookmarks'),
- 'title_before' => '', 'title_after' => '
',
- 'category_orderby' => 'name', 'category_order' => 'ASC',
- 'class' => 'linkcat', 'category_before' => '',
- 'category_after' => ''
+ 'orderby' => 'name',
+ 'order' => 'ASC',
+ 'limit' => -1,
+ 'category' => '',
+ 'exclude_category' => '',
+ 'category_name' => '',
+ 'hide_invisible' => 1,
+ 'show_updated' => 0,
+ 'echo' => 1,
+ 'categorize' => 1,
+ 'title_li' => __( 'Bookmarks' ),
+ 'title_before' => '',
+ 'title_after' => '
',
+ 'category_orderby' => 'name',
+ 'category_order' => 'ASC',
+ 'class' => 'linkcat',
+ 'category_before' => '',
+ 'category_after' => '',
);
$r = wp_parse_args( $args, $defaults );
@@ -217,18 +232,21 @@
if ( ! is_array( $r['class'] ) ) {
$r['class'] = explode( ' ', $r['class'] );
}
- $r['class'] = array_map( 'sanitize_html_class', $r['class'] );
- $r['class'] = trim( join( ' ', $r['class'] ) );
+ $r['class'] = array_map( 'sanitize_html_class', $r['class'] );
+ $r['class'] = trim( join( ' ', $r['class'] ) );
if ( $r['categorize'] ) {
- $cats = get_terms( 'link_category', array(
- 'name__like' => $r['category_name'],
- 'include' => $r['category'],
- 'exclude' => $r['exclude_category'],
- 'orderby' => $r['category_orderby'],
- 'order' => $r['category_order'],
- 'hierarchical' => 0
- ) );
+ $cats = get_terms(
+ 'link_category',
+ array(
+ 'name__like' => $r['category_name'],
+ 'include' => $r['category'],
+ 'exclude' => $r['exclude_category'],
+ 'orderby' => $r['category_orderby'],
+ 'order' => $r['category_order'],
+ 'hierarchical' => 0,
+ )
+ );
if ( empty( $cats ) ) {
$r['categorize'] = false;
}
@@ -237,7 +255,7 @@
if ( $r['categorize'] ) {
// Split the bookmarks into ul's for each category
foreach ( (array) $cats as $cat ) {
- $params = array_merge( $r, array( 'category' => $cat->term_id ) );
+ $params = array_merge( $r, array( 'category' => $cat->term_id ) );
$bookmarks = get_bookmarks( $params );
if ( empty( $bookmarks ) ) {
continue;
@@ -248,11 +266,11 @@
$r['category_before']
);
/**
- * Filters the bookmarks category name.
+ * Filters the category name.
*
* @since 2.2.0
*
- * @param string $cat_name The category name of bookmarks.
+ * @param string $cat_name The category name.
*/
$catname = apply_filters( 'link_category', $cat->name );
@@ -272,7 +290,7 @@
if ( ! empty( $r['title_li'] ) ) {
$output .= str_replace(
array( '%id', '%class' ),
- array( "linkcat-" . $r['category'], $r['class'] ),
+ array( 'linkcat-' . $r['category'], $r['class'] ),
$r['category_before']
);
$output .= $r['title_before'];