Update WP and plugins
This commit is contained in:
parent
10a4713229
commit
1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions
|
@ -23,8 +23,8 @@
|
|||
* @param string $show See get_bloginfo() for possible values.
|
||||
* @return string
|
||||
*/
|
||||
function get_bloginfo_rss($show = '') {
|
||||
$info = strip_tags(get_bloginfo($show));
|
||||
function get_bloginfo_rss( $show = '' ) {
|
||||
$info = strip_tags( get_bloginfo( $show ) );
|
||||
/**
|
||||
* Filters the bloginfo for use in RSS feeds.
|
||||
*
|
||||
|
@ -51,7 +51,7 @@ function get_bloginfo_rss($show = '') {
|
|||
*
|
||||
* @param string $show See get_bloginfo() for possible values.
|
||||
*/
|
||||
function bloginfo_rss($show = '') {
|
||||
function bloginfo_rss( $show = '' ) {
|
||||
/**
|
||||
* Filters the bloginfo for display in RSS feeds.
|
||||
*
|
||||
|
@ -182,13 +182,14 @@ function the_title_rss() {
|
|||
* @param string $feed_type The type of feed. rss2 | atom | rss | rdf
|
||||
* @return string The filtered content.
|
||||
*/
|
||||
function get_the_content_feed($feed_type = null) {
|
||||
if ( !$feed_type )
|
||||
function get_the_content_feed( $feed_type = null ) {
|
||||
if ( ! $feed_type ) {
|
||||
$feed_type = get_default_feed();
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/post-template.php */
|
||||
$content = apply_filters( 'the_content', get_the_content() );
|
||||
$content = str_replace(']]>', ']]>', $content);
|
||||
$content = str_replace( ']]>', ']]>', $content );
|
||||
/**
|
||||
* Filters the post content for use in feeds.
|
||||
*
|
||||
|
@ -208,8 +209,8 @@ function get_the_content_feed($feed_type = null) {
|
|||
*
|
||||
* @param string $feed_type The type of feed. rss2 | atom | rss | rdf
|
||||
*/
|
||||
function the_content_feed($feed_type = null) {
|
||||
echo get_the_content_feed($feed_type);
|
||||
function the_content_feed( $feed_type = null ) {
|
||||
echo get_the_content_feed( $feed_type );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,8 +271,8 @@ function comments_link_feed() {
|
|||
*
|
||||
* @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object.
|
||||
*/
|
||||
function comment_guid($comment_id = null) {
|
||||
echo esc_url( get_comment_guid($comment_id) );
|
||||
function comment_guid( $comment_id = null ) {
|
||||
echo esc_url( get_comment_guid( $comment_id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,13 +283,14 @@ function comment_guid($comment_id = null) {
|
|||
* @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object.
|
||||
* @return false|string false on failure or guid for comment on success.
|
||||
*/
|
||||
function get_comment_guid($comment_id = null) {
|
||||
$comment = get_comment($comment_id);
|
||||
function get_comment_guid( $comment_id = null ) {
|
||||
$comment = get_comment( $comment_id );
|
||||
|
||||
if ( !is_object($comment) )
|
||||
if ( ! is_object( $comment ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
|
||||
return get_the_guid( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -371,35 +373,42 @@ function comment_text_rss() {
|
|||
* @param string $type Optional, default is the type returned by get_default_feed().
|
||||
* @return string All of the post categories for displaying in the feed.
|
||||
*/
|
||||
function get_the_category_rss($type = null) {
|
||||
if ( empty($type) )
|
||||
function get_the_category_rss( $type = null ) {
|
||||
if ( empty( $type ) ) {
|
||||
$type = get_default_feed();
|
||||
}
|
||||
$categories = get_the_category();
|
||||
$tags = get_the_tags();
|
||||
$the_list = '';
|
||||
$cat_names = array();
|
||||
$tags = get_the_tags();
|
||||
$the_list = '';
|
||||
$cat_names = array();
|
||||
|
||||
$filter = 'rss';
|
||||
if ( 'atom' == $type )
|
||||
if ( 'atom' == $type ) {
|
||||
$filter = 'raw';
|
||||
|
||||
if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
|
||||
$cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
|
||||
}
|
||||
|
||||
if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
|
||||
$cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
|
||||
if ( ! empty( $categories ) ) {
|
||||
foreach ( (array) $categories as $category ) {
|
||||
$cat_names[] = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', $filter );
|
||||
}
|
||||
}
|
||||
|
||||
$cat_names = array_unique($cat_names);
|
||||
if ( ! empty( $tags ) ) {
|
||||
foreach ( (array) $tags as $tag ) {
|
||||
$cat_names[] = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'post_tag', $filter );
|
||||
}
|
||||
}
|
||||
|
||||
$cat_names = array_unique( $cat_names );
|
||||
|
||||
foreach ( $cat_names as $cat_name ) {
|
||||
if ( 'rdf' == $type )
|
||||
if ( 'rdf' == $type ) {
|
||||
$the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
|
||||
elseif ( 'atom' == $type )
|
||||
} elseif ( 'atom' == $type ) {
|
||||
$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
|
||||
else
|
||||
$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n";
|
||||
} else {
|
||||
$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option( 'blog_charset' ) ) . "]]></category>\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -422,8 +431,8 @@ function get_the_category_rss($type = null) {
|
|||
*
|
||||
* @param string $type Optional, default is the type returned by get_default_feed().
|
||||
*/
|
||||
function the_category_rss($type = null) {
|
||||
echo get_the_category_rss($type);
|
||||
function the_category_rss( $type = null ) {
|
||||
echo get_the_category_rss( $type );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -434,11 +443,12 @@ function the_category_rss($type = null) {
|
|||
* @since 2.2.0
|
||||
*/
|
||||
function html_type_rss() {
|
||||
$type = get_bloginfo('html_type');
|
||||
if (strpos($type, 'xhtml') !== false)
|
||||
$type = get_bloginfo( 'html_type' );
|
||||
if ( strpos( $type, 'xhtml' ) !== false ) {
|
||||
$type = 'xhtml';
|
||||
else
|
||||
} else {
|
||||
$type = 'html';
|
||||
}
|
||||
echo $type;
|
||||
}
|
||||
|
||||
|
@ -457,16 +467,17 @@ function html_type_rss() {
|
|||
* @since 1.5.0
|
||||
*/
|
||||
function rss_enclosure() {
|
||||
if ( post_password_required() )
|
||||
if ( post_password_required() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( (array) get_post_custom() as $key => $val) {
|
||||
if ($key == 'enclosure') {
|
||||
foreach ( (array) get_post_custom() as $key => $val ) {
|
||||
if ( $key == 'enclosure' ) {
|
||||
foreach ( (array) $val as $enc ) {
|
||||
$enclosure = explode("\n", $enc);
|
||||
$enclosure = explode( "\n", $enc );
|
||||
|
||||
// only get the first element, e.g. audio/mpeg from 'audio/mpeg mpga mp2 mp3'
|
||||
$t = preg_split('/[ \t]/', trim($enclosure[2]) );
|
||||
$t = preg_split( '/[ \t]/', trim( $enclosure[2] ) );
|
||||
$type = $t[0];
|
||||
|
||||
/**
|
||||
|
@ -496,13 +507,14 @@ function rss_enclosure() {
|
|||
* @since 2.2.0
|
||||
*/
|
||||
function atom_enclosure() {
|
||||
if ( post_password_required() )
|
||||
if ( post_password_required() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( (array) get_post_custom() as $key => $val ) {
|
||||
if ($key == 'enclosure') {
|
||||
if ( $key == 'enclosure' ) {
|
||||
foreach ( (array) $val as $enc ) {
|
||||
$enclosure = explode("\n", $enc);
|
||||
$enclosure = explode( "\n", $enc );
|
||||
/**
|
||||
* Filters the atom enclosure HTML link tag for the current post.
|
||||
*
|
||||
|
@ -533,9 +545,9 @@ function atom_enclosure() {
|
|||
* @param string $data Input string
|
||||
* @return array array(type, value)
|
||||
*/
|
||||
function prep_atom_text_construct($data) {
|
||||
if (strpos($data, '<') === false && strpos($data, '&') === false) {
|
||||
return array('text', $data);
|
||||
function prep_atom_text_construct( $data ) {
|
||||
if ( strpos( $data, '<' ) === false && strpos( $data, '&' ) === false ) {
|
||||
return array( 'text', $data );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'xml_parser_create' ) ) {
|
||||
|
@ -545,23 +557,23 @@ function prep_atom_text_construct($data) {
|
|||
}
|
||||
|
||||
$parser = xml_parser_create();
|
||||
xml_parse($parser, '<div>' . $data . '</div>', true);
|
||||
$code = xml_get_error_code($parser);
|
||||
xml_parser_free($parser);
|
||||
xml_parse( $parser, '<div>' . $data . '</div>', true );
|
||||
$code = xml_get_error_code( $parser );
|
||||
xml_parser_free( $parser );
|
||||
|
||||
if (!$code) {
|
||||
if (strpos($data, '<') === false) {
|
||||
return array('text', $data);
|
||||
if ( ! $code ) {
|
||||
if ( strpos( $data, '<' ) === false ) {
|
||||
return array( 'text', $data );
|
||||
} else {
|
||||
$data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>";
|
||||
return array('xhtml', $data);
|
||||
return array( 'xhtml', $data );
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($data, ']]>') === false) {
|
||||
return array('html', "<![CDATA[$data]]>");
|
||||
if ( strpos( $data, ']]>' ) === false ) {
|
||||
return array( 'html', "<![CDATA[$data]]>" );
|
||||
} else {
|
||||
return array('html', htmlspecialchars($data));
|
||||
return array( 'html', htmlspecialchars( $data ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -611,7 +623,7 @@ function rss2_site_icon() {
|
|||
* @since 2.5.0
|
||||
*/
|
||||
function self_link() {
|
||||
$host = @parse_url(home_url());
|
||||
$host = @parse_url( home_url() );
|
||||
/**
|
||||
* Filters the current feed URL.
|
||||
*
|
||||
|
@ -633,18 +645,19 @@ function self_link() {
|
|||
* @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'.
|
||||
*/
|
||||
function feed_content_type( $type = '' ) {
|
||||
if ( empty($type) )
|
||||
if ( empty( $type ) ) {
|
||||
$type = get_default_feed();
|
||||
}
|
||||
|
||||
$types = array(
|
||||
'rss' => 'application/rss+xml',
|
||||
'rss2' => 'application/rss+xml',
|
||||
'rss-http' => 'text/xml',
|
||||
'atom' => 'application/atom+xml',
|
||||
'rdf' => 'application/rdf+xml'
|
||||
'rdf' => 'application/rdf+xml',
|
||||
);
|
||||
|
||||
$content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream';
|
||||
$content_type = ( ! empty( $types[ $type ] ) ) ? $types[ $type ] : 'application/octet-stream';
|
||||
|
||||
/**
|
||||
* Filters the content type for a specific feed type.
|
||||
|
@ -664,7 +677,7 @@ function feed_content_type( $type = '' ) {
|
|||
*
|
||||
* @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged
|
||||
* using SimplePie's multifeed feature.
|
||||
* See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas}
|
||||
* See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas}
|
||||
*
|
||||
* @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success
|
||||
*/
|
||||
|
@ -703,8 +716,9 @@ function fetch_feed( $url ) {
|
|||
$feed->init();
|
||||
$feed->set_output_encoding( get_option( 'blog_charset' ) );
|
||||
|
||||
if ( $feed->error() )
|
||||
if ( $feed->error() ) {
|
||||
return new WP_Error( 'simplepie-error', $feed->error() );
|
||||
}
|
||||
|
||||
return $feed;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue