Ticket #7342: press-this_7-17.patch
| File press-this_7-17.patch, 2.0 KB (added by , 18 years ago) |
|---|
-
wp-includes/functions.php
1489 1489 1490 1490 // $dir is absolute, $path is (maybe) relative to ABSPATH 1491 1491 $dir = path_join( ABSPATH, $dir ); 1492 1492 1493 1493 if ( !$url = get_option( 'upload_url_path' ) ) { 1494 if ( empty($upload_path) )1494 if ( empty($upload_path) or ( $upload_path == $dir ) ) 1495 1495 $url = WP_CONTENT_URL . '/uploads'; 1496 1496 else 1497 1497 $url = trailingslashit( $siteurl ) . $upload_path; … … 1523 1523 $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir ); 1524 1524 return array( 'error' => $message ); 1525 1525 } 1526 1527 $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ); 1526 1528 1527 $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );1528 1529 return apply_filters( 'upload_dir', $uploads ); 1529 1530 } 1530 1531 -
wp-admin/press-this.php
34 34 $content = $_REQUEST['content']; 35 35 36 36 foreach( (array) $_REQUEST['photo_src'] as $key => $image) { 37 // escape quote for matching 38 $quoted = preg_quote2($image); 39 37 40 38 // see if files exist in content - we don't want to upload non-used selected files. 41 if( strpos($_REQUEST['content'], $ quoted) !== false ) {39 if( strpos($_REQUEST['content'], $image) !== false ) { 42 40 $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]); 41 43 42 // Replace the POSTED content <img> with correct uploaded ones. 43 // escape quote for matching 44 $quoted = preg_quote2($image); 44 45 if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content); 45 46 } 46 47 }