mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
preg_quote2() unnecessary. preg_quote() supports delimiter escaping if you pass it as second param
git-svn-id: https://develop.svn.wordpress.org/trunk@10856 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b073dfd5cf
commit
4436658f47
@ -12,20 +12,6 @@ header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('b
|
||||
|
||||
if ( ! current_user_can('edit_posts') ) wp_die( __( 'Cheatin’ uh?' ) );
|
||||
|
||||
/**
|
||||
* Replace forward slash with backslash and slash.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Press_This
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
function preg_quote2($string) {
|
||||
return str_replace('/', '\/', preg_quote($string));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert characters.
|
||||
*
|
||||
@ -71,7 +57,7 @@ function press_it() {
|
||||
$upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
|
||||
|
||||
// Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
|
||||
if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote2($image).'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
|
||||
if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote($image, '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
|
||||
}
|
||||
|
||||
// set the post_content and status
|
||||
|
Loading…
x
Reference in New Issue
Block a user