TZX" zxB@  b ` * ( J H   j h 2 0 R P   r p : 8  ZX" zxB@ hb9ca6774fbbd0c1d00b91341f8aa629057a776e5@sa_generateds8d70afb00cb607548bc1515fe666bff37a158f85@sa_generatedse195f91d8ef769c0a8544e8c1592a04d8d6f8f61@sa_generatedsa3e55d0faee7d7ea631ebad7a422ea55001da5fb@sa_generateds88f31227722d5412d225b3898e1a89050d7ff3d3@sa_generateds3e05488f2625e3db8dbbb1e7c52409955502f3d8@sa_generatedsea26cf4b453afb565a423d5885d2037d4531e1c3@sa_generateds17af0ebc7aa9553f6920d1ce0f01170e7e7eeb75@sa_generatedsce8bb904981c1923d4b6eb7d763036367da1d889@sa_generateds85c1169b48ec2ce5e6ccbbf4ee6f1d22ca0024b3@sa_generateds5d66922e12af73242b63e71fa7fe62a562e3fb56@sa_generateds8a07839a6d25855b5b2f54e41b6d5a429ef78b00@sa_generateds230c3f601c82a4b9b3a3f26c569157518034b21c@sa_generateds3eab98dd673543f2760a6ca2e8ab43319b3f6db8@sa_generatedsecd394cd6f9acabe3836a0e91b546a03b24ac1b3@sa_generateds51a3745aaa0b8107d5b4cd6e82423f7f0b6d0d6e@sa_generatedsdddd041c2c8aa5157ab2667fa194caa80fec5d5b@sa_generateds2ca777980b3178a28e3878f1e4b930e9701ccb2b@sa_generatedsbcaf28d33ece6a6570c6848357a31118d3050eed@sa_generateds637393caa0141295981438d1a48d5cc261b51dee@sa_generatedsa5b3c886fd2ce57a6a39012aed56335e71aad0b3@sa_generatedh8834a83a9a38aee6f9a7a62404d3c98d8ddf47b3@sa_generatedsd941eb875978c5d42c6aec9443ea3ccfb0b04dd1@sa_generatedsee5c326ca644fa0d3d5594587f5d780772b3cf10@sa_generateds14af0f4be722fb9b272ab583b2fc46ff43c322a1@sa_generateds8c831d2577e81d49457910ac6be783d5f89272c3@sa_generateds51da4e09806b293bbdc9a3a0104606155e1c46c7@sa_generateds723073d6545531fe4cf54da2b172384301a990d2@sa_generateds3a0fb554200dd9a0ecf9e7a1b6191ca861cd8f83@sa_generateds5909ce726672cb140b6379c4294a0904b4b93f09@sa_generateds2e52a1aa594cf469c83867b169045d5cb5277ceb@sa_generatedsb6bf074058b9ef22a082bb46112a87de10ae4910@sa_generatedsd542d857c883f7329bdae389fc0363f8dc4ee836@sa_generateds01a065b82bdb94def144ad196e98a9e8781a9ab6@sa_generateds551767d4012acb27bc9f532c1ed702c0cc4ddd25@sa_generateds7d9ba110ae5dcf0df8133846f82d772a2a72e9c5@sa_generateds41993668ba82e707a0ccd6864c7857354b718888@sa_generateds5361bcfcd6b0957e4145eb1e5ebd29c7395bd22c@sa_generateds7d5c391688df416ff296db527315f02c1119fadd@sa_generateds98be2c296ff8c91e619f6feac3c78159682b3b5f@sa_generateds3184ec084a54a27896ebfc8554df56d2fb468a20@sa_generatedhffceaee5b7ca1419e5c3492157aa16c2a3242e20@sa_generatedembed_get() * @uses wp_parse_args() * @uses wp_embed_defaults() * @uses WP_Embed::maybe_make_link() * @uses get_option() * @uses author_can() * @uses wp_cache_get() * @uses wp_cache_set() * @uses get_post_meta() * @uses update_post_meta() * * @param array $attr { * Shortcode attributes. Optional. * * @type int $width Width of the embed in pixels. * @type int $height Height of the embed in pixels. * } * @param string $url The URL attempting to be embedded. * @return string The embed HTML on success, otherwise the original URL. */ function shortcode( $attr, $url = '' ) { $post = get_post(); if ( empty( $url ) ) return ''; $rawattr = $attr; $attr = wp_parse_args( $attr, wp_embed_defaults() ); // kses converts & into & and we need to undo this // See http://core.trac.wordpress.org/ticket/11311 $url = str_replace( '&', '&', $url ); // Look for known internal handlers ksort( $this->handlers ); foreach ( $this->handlers as $priority => $handlers ) { foreach ( $handlers as $id => $handler ) { if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) ) /** * Filter the returned embed handler. * * @since 2.9.0 * * @see WP_Embed::shortcode() * * @param mixed $return The shortcode callback function to call. * @param string $url The attempted embed URL. * @param array $attr An array of shortcode attributes. */ return apply_filters( 'embed_handler_html', $return, $url, $attr ); } } } $post_ID = ( ! empty( $post->ID ) ) ? $post->ID : null; if ( ! empty( $this->post_ID ) ) // Potentially set by WP_Embed::cache_oembed() $post_ID = $this->post_ID; // Unknown URL format. Let oEmbed have a go. if ( $post_ID ) { // Check for a cached result (stored in the post meta) $cachekey = '_oembed_' . md5( $url . serialize( $attr ) ); if ( $this->usecache ) { $cache = get_post_meta( $post_ID, $cachekey, true ); // Failures are cached if ( '{{unknown}}' === $cache ) return $this->maybe_make_link( $url ); if ( ! empty( $cache ) ) /** * Filter the cached oEmbed HTML. * * @since 2.9.0 * * @see WP_Embed::shortcode() * * @param mixed $cache The cached HTML result, stored in post meta. * @param string $url The attempted embed URL. * @param array $attr An array of shortcode attributes. * @param int $post_ID Post ID. */ return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID ); } /** * Filter whether to inspect the given URL for discoverable tags. * * @since 2.9.0 * * @see WP_oEmbed::discover() * * @param bool false Whether to enable tag discovery. Default false. */ $attr['discover'] = ( apply_filters( 'embed_oembed_discover', false ) && author_can( $post_ID, 'unfiltered_html' ) ); // Use oEmbed to get the HTML $html = wp_oembed_get( $url, $attr ); // Cache the result $cache = ( $html ) ? $html : '{{unknown}}'; update_post_meta( $post_ID, $cachekey, $cache ); // If there was a result, return it if ( $html ) { /** This filter is documented in wp-includes/class-wp-embed.php */ return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID ); } } // Still unknown return $this->maybe_make_link( $url ); } /** * Delete all oEmbed caches. * * @param int $post_ID Post ID to delete the caches for. */ function delete_oembed_caches( $post_ID ) { $post_metas = get_post_custom_keys( $post_ID ); if ( empty($post_metas) ) return; foreach( $post_metas as $post_meta_key ) { if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) ) delete_post_meta( $post_ID, $post_meta_key ); } } /** * Triggers a caching of all oEmbed results. * * @param int $post_ID Post ID to do the caching for. */ function cache_oembed( $post_ID ) { $post = get_post( $post_ID ); $post_types = array( 'post', 'page' ); /** * Filter the array of post types to cache oEmbed results for. * * @since 2.9.0 * * @param array $post_types Array of post types to cache oEmbed results for. Default 'post', 'page'. */ if ( empty($post->ID) || !in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ) return; // Trigger a caching if ( !empty($post->post_content) ) { $this->post_ID = $post->ID; $this->usecache = false; $content = $this->run_shortcode( $post->post_content ); $this->autoembed( $content ); $this->usecache = true; } } /** * Passes any unlinked URLs that are on their own line to {@link WP_Embed::shortcode()} for potential embedding. * * @uses WP_Embed::autoembed_callback() * * @param string $content The content to be searched. * @return string Potentially modified $content. */ function autoembed( $content ) { return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content ); } /** * Callback function for {@link WP_Embed::autoembed()}. * * @uses WP_Embed::shortcode() * * @param array $match A regex match array. * @return string The embed HTML on success, otherwise the original URL. */ function autoembed_callback( $match ) { $oldval = $this->linkifunknown; $this->linkifunknown = false; $return = $this->shortcode( array(), $match[1] ); $this->linkifunknown = $oldval; return "\n$return\n"; } /** * Conditionally makes a hyperlink based on an internal class variable. * * @param string $url URL to potentially be linked. * @return string Linked URL or the original URL. */ function maybe_make_link( $url ) { $output = ( $this->linkifunknown ) ? '' . esc_html($url) . '' : $url; /** * Filter the returned, maybe-linked embed URL. * * @since 2.9.0 * * @param string $output The linked or original URL. * @param string $url The original URL. */ return apply_filters( 'embed_maybe_make_link', $output, $url ); } } $GLOBALS['wp_embed'] = new WP_Embed();