Changeset 20539
- Timestamp:
- 04/19/2012 07:46:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-oembed.php
r20235 r20539 228 228 */ 229 229 function data2html( $data, $url ) { 230 if ( ! is_object($data) || empty($data->type) )230 if ( ! is_object( $data ) || empty( $data->type ) ) 231 231 return false; 232 233 $return = false; 232 234 233 235 switch ( $data->type ) { 234 236 case 'photo': 235 if ( empty($data->url) || empty($data->width) || empty($data->height) ) 236 return false; 237 238 $title = ( !empty($data->title) ) ? $data->title : ''; 237 if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) ) 238 break; 239 if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) ) 240 break; 241 242 $title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : ''; 239 243 $return = '<a href="' . esc_url( $url ) . '"><img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" /></a>'; 240 244 break; … … 242 246 case 'video': 243 247 case 'rich': 244 $return = ( !empty($data->html) ) ? $data->html : false; 248 if ( ! empty( $data->html ) && is_string( $data->html ) ) 249 $return = $data->html; 245 250 break; 246 251 247 252 case 'link': 248 $return = ( !empty($data->title) ) ? '<a href="' . esc_url($url) . '">' . esc_html($data->title) . '</a>' : false; 253 if ( ! empty( $data->title ) && is_string( $data->title ) ) 254 $return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>'; 249 255 break; 250 256
Note: See TracChangeset
for help on using the changeset viewer.