Changeset 21998 for trunk/wp-includes/media.php
- Timestamp:
- 09/25/2012 07:10:09 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r21948 r21998 1082 1082 function __construct() { 1083 1083 // Hack to get the [embed] shortcode to run before wpautop() 1084 add_filter( 'the_content', array( &$this, 'run_shortcode'), 8 );1084 add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 ); 1085 1085 1086 1086 // Shortcode placeholder for strip_shortcodes() … … 1088 1088 1089 1089 // Attempts to embed all URLs in a post 1090 if ( get_option('embed_autourls') ) 1091 add_filter( 'the_content', array(&$this, 'autoembed'), 8 ); 1090 add_filter( 'the_content', array( $this, 'autoembed' ), 8 ); 1092 1091 1093 1092 // After a post is saved, invalidate the oEmbed cache 1094 add_action( 'save_post', array( &$this, 'delete_oembed_caches') );1093 add_action( 'save_post', array( $this, 'delete_oembed_caches' ) ); 1095 1094 1096 1095 // After a post is saved, cache oEmbed items via AJAX 1097 add_action( 'edit_form_advanced', array( &$this, 'maybe_run_ajax_cache') );1096 add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) ); 1098 1097 } 1099 1098 … … 1120 1119 remove_all_shortcodes(); 1121 1120 1122 add_shortcode( 'embed', array( &$this, 'shortcode') );1121 add_shortcode( 'embed', array( $this, 'shortcode' ) ); 1123 1122 1124 1123 // Do the shortcode (only the [embed] one is registered) … … 1294 1293 1295 1294 $content = $this->run_shortcode( $post->post_content ); 1296 if ( get_option('embed_autourls') ) 1297 $this->autoembed( $content ); 1295 $this->autoembed( $content ); 1298 1296 1299 1297 $this->usecache = true; … … 1310 1308 */ 1311 1309 function autoembed( $content ) { 1312 return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( &$this, 'autoembed_callback'), $content );1310 return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content ); 1313 1311 } 1314 1312 … … 1368 1366 * Create default array of embed parameters. 1369 1367 * 1368 * The width defaults to the content width as specified by the theme. If the 1369 * theme does not specify a content width, then 500px is used. 1370 * 1371 * The default height is 1.5 times the width, or 1000px, whichever is smaller. 1372 * 1373 * The 'embed_defaults' filter can be used to adjust either of these values. 1374 * 1370 1375 * @since 2.9.0 1371 1376 * … … 1373 1378 */ 1374 1379 function wp_embed_defaults() { 1375 if ( !empty($GLOBALS['content_width']) ) 1376 $theme_width = (int) $GLOBALS['content_width']; 1377 1378 $width = get_option('embed_size_w'); 1379 1380 if ( empty($width) && !empty($theme_width) ) 1381 $width = $theme_width; 1382 1383 if ( empty($width) ) 1380 if ( ! empty( $GLOBALS['content_width'] ) ) 1381 $width = (int) $GLOBALS['content_width']; 1382 1383 if ( empty( $width ) ) 1384 1384 $width = 500; 1385 1385 1386 $height = get_option('embed_size_h'); 1387 1388 if ( empty($height) ) 1389 $height = 700; 1390 1391 return apply_filters( 'embed_defaults', array( 1392 'width' => $width, 1393 'height' => $height, 1394 ) ); 1386 $height = min( ceil( $width * 1.5 ), 1000 ); 1387 1388 return apply_filters( 'embed_defaults', compact( 'width', 'height' ) ); 1395 1389 } 1396 1390
Note: See TracChangeset
for help on using the changeset viewer.