From 967ee06a3226fd5681045f9db803c68e4dfe51bf Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 13 May 2008 22:12:52 +0000 Subject: [PATCH] Don't pass image list via GET. Fetch images remotely. Load photo tab via AJAX. see #6813 git-svn-id: http://svn.automattic.com/wordpress/trunk@7927 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/quick-post.php | 289 +++++++++++++++++++++------------- wp-includes/link-template.php | 13 +- 2 files changed, 179 insertions(+), 123 deletions(-) diff --git a/wp-admin/quick-post.php b/wp-admin/quick-post.php index fbde41d912..06b17fe488 100644 --- a/wp-admin/quick-post.php +++ b/wp-admin/quick-post.php @@ -21,7 +21,7 @@ function quick_post() { case 'quote': $content = '
' . $_REQUEST['content']; if ($_REQUEST['content2']) { - $content = $content . '
'; + $content .= ''; $content = $content . '

' . $_REQUEST['content2']; } break; @@ -43,7 +43,7 @@ function quick_post() { list($garbage,$video_id) = split("v=", $_REQUEST['content']); $content = ''; if ($_REQUEST['content2']) - $content = $content . '

' . $_REQUEST['content2'] . '

'; + $content .= '

' . $_REQUEST['content2'] . '

'; break; } @@ -67,6 +67,175 @@ function tag_input() { return $s; } +function get_images_from_uri($uri) { + $content = wp_remote_fopen($uri); + if ( false === $content ) + return ''; + + $pattern = '/src=[\'"]?([^\'" >]+)[\'" >]/'; + preg_match_all($pattern, $content, $matches); + if ( empty($matches[1]) ) + return ''; + + $from_host = parse_url($uri); + $from_host = $from_host['host']; + $from_host = explode('.', $from_host); + $count = count($from_host); + $from_host = $from_host[$count - 2] . '.' . $from_host[$count - 1]; + + $sources = array(); + foreach ($matches[1] as $src) { + if ( false !== strpos($src, '&') ) + continue; + + $img_host = parse_url($src); + $img_host = $img_host['host']; + if ( false === strpos($img_host, $from_host) ) + continue; + + $sources[] = $src; + } + return "'" . implode("','", $sources) . "'"; +} + +// Clean up the data being passed in +$title = stripslashes($_GET['t']); + +if ( !empty($_GET['load']) && 'photo' == $_GET['load'] ) { +?> + + +
+ + + +
+

+ + +

+
+ +
+ +

+ + + +
+
+ +

+ + + + +
+    + +    + +
+
+
+

+
    + +
+
+
+ > @@ -127,14 +296,14 @@ function tag_input() { jQuery(document).ready(function() { - jQuery('#container > ul').tabs({ selected: 4 })({ fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } }); + jQuery('#container > ul').tabs({ selected: 3, fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } }); - jQuery('#container > ul').tabs({ selected: 2 })({ fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } }); + jQuery('#container > ul').tabs({ selected: 1, fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } }); - jQuery('#container > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } }); + jQuery('#container > ul').tabs({ selected: 1, fx: { height: 'toggle', opacity: 'toggle', fxSpeed: 'fast' } }); }); - + @@ -150,15 +319,12 @@ if ( 'post' == $_REQUEST['action'] ) { die; } -// Clean up the data being passed in -$title = stripslashes($_GET['t']); - ?>
@@ -195,109 +361,6 @@ $title = stripslashes($_GET['t']);
- -
-
- - - -
-

- - -

-
- -
- -

- - - - -
- -
- -

- - - - -
-    - -    - -
-
-
-

-
    - -
-
-
-
-
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 0ad498d0c6..a945fb4c4e 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -744,13 +744,6 @@ function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nx function get_shortcut_link() { $link = "javascript: - var imgstr=''; - var reg=new RegExp('&'); - for(i=0;i