Update WP and plugins

This commit is contained in:
Oliver Davies 2019-04-16 20:56:22 +01:00
parent 10a4713229
commit 1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions

View file

@ -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' => '<li>', 'after' => '</li>', 'between' => "\n",
'show_rating' => 0, 'link_before' => '', 'link_after' => ''
'show_updated' => 0,
'show_description' => 0,
'show_images' => 1,
'show_name' => 0,
'before' => '<li>',
'after' => '</li>',
'between' => "\n",
'show_rating' => 0,
'link_before' => '',
'link_after' => '',
);
$r = wp_parse_args( $args, $defaults );
@ -72,15 +78,15 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
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 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
}
$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 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
if ( strpos( $bookmark->link_image, 'http' ) === 0 ) {
$output .= "<img src=\"$bookmark->link_image\" $alt $title />";
} else { // If it's a relative path
$output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />";
$output .= '<img src="' . get_option( 'siteurl' ) . "$bookmark->link_image\" $alt $title />";
}
if ( $r['show_name'] ) {
$output .= " $name";
@ -199,15 +205,24 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
*/
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' => '<h2>', 'title_after' => '</h2>',
'category_orderby' => 'name', 'category_order' => 'ASC',
'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class">',
'category_after' => '</li>'
'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' => '<h2>',
'title_after' => '</h2>',
'category_orderby' => 'name',
'category_order' => 'ASC',
'class' => 'linkcat',
'category_before' => '<li id="%id" class="%class">',
'category_after' => '</li>',
);
$r = wp_parse_args( $args, $defaults );
@ -217,18 +232,21 @@ function wp_list_bookmarks( $args = '' ) {
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 @@ function wp_list_bookmarks( $args = '' ) {
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 @@ function wp_list_bookmarks( $args = '' ) {
$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 @@ function wp_list_bookmarks( $args = '' ) {
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'];