Changeset 12153 for trunk/wp-includes/class-oembed.php
- Timestamp:
- 11/06/2009 02:22:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-oembed.php
r12138 r12153 48 48 'http://i*.photobucket.com/albums/*' => array( 'http://photobucket.com/oembed', false ), 49 49 'http://gi*.photobucket.com/groups/*' => array( 'http://photobucket.com/oembed', false ), 50 '#http://(www\.)?scribd.com/.*#i' => array( 'http://www.scribd.com/services/oembed', true )50 '#http://(www\.)?scribd.com/.*#i' => array( 'http://www.scribd.com/services/oembed', true ), 51 51 ) ); 52 53 // Fix Scribd embeds. They contain new lines in the middle of the HTML which breaks wpautop(). 54 add_filter( 'oembed_dataparse', array(&$this, 'strip_scribd_newlines'), 10, 3 ); 52 55 } 53 56 … … 88 91 return false; 89 92 90 return apply_filters( 'oembed_ output', $this->data2html( $data, $url ), $url, $args );93 return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args ); 91 94 } 92 95 … … 207 210 208 211 $title = ( !empty($data->title) ) ? $data->title : ''; 209 return '<img src="' . esc_attr( clean_url( $data->url ) ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" />'; 212 $return = '<img src="' . esc_attr( clean_url( $data->url ) ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" />'; 213 break; 210 214 211 215 case 'video': 212 216 case 'rich': 213 return ( !empty($data->html) ) ? $data->html : false; 217 $return = ( !empty($data->html) ) ? $data->html : false; 218 break; 214 219 215 220 case 'link': 216 return ( !empty($data->title) ) ? '<a href="' . clean_url($url) . '">' . esc_html($data->title) . '</a>' : false; 217 } 218 219 return false; 221 $return = ( !empty($data->title) ) ? '<a href="' . clean_url($url) . '">' . esc_html($data->title) . '</a>' : false; 222 break; 223 224 default; 225 $return = false; 226 } 227 228 // You can use this filter to add support for custom data types or to filter the result 229 return apply_filters( 'oembed_dataparse', $return, $data, $url ); 230 } 231 232 /** 233 * Strip new lines from the HTML if it's a Scribd embed. 234 * 235 * @param string $html Existing HTML. 236 * @param object $data Data object from WP_oEmbed::data2html() 237 * @param string $url The original URL passed to oEmbed. 238 * @return string Possibly modified $html 239 */ 240 function strip_scribd_newlines( $html, $data, $url ) { 241 if ( preg_match( '#http://(www\.)?scribd.com/.*#i', $url ) ) 242 $html = str_replace( array( "\r\n", "\n" ), '', $html ); 243 244 return $html; 220 245 } 221 246 }
Note: See TracChangeset
for help on using the changeset viewer.