| 1 | Index: wp-admin/includes/media.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/media.php (revision 8041) |
|---|
| 4 | +++ wp-admin/includes/media.php (working copy) |
|---|
| 5 | @@ -116,6 +116,83 @@ |
|---|
| 6 | } |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | +function media_sideload_image($file, $post_id) { |
|---|
| 10 | + |
|---|
| 11 | + if (!empty($file) ) { |
|---|
| 12 | + // Upload File button was clicked |
|---|
| 13 | + |
|---|
| 14 | + $file_array['name'] = basename($file); |
|---|
| 15 | + $file_array['tmp_name'] = download_url($file); |
|---|
| 16 | + |
|---|
| 17 | + $sideload = media_handle_sideload($file_array, $post_id); |
|---|
| 18 | + |
|---|
| 19 | + $id = $sideload['id']; |
|---|
| 20 | + $src = $sideload['src']; |
|---|
| 21 | + |
|---|
| 22 | + unset($file_array['tmp_name']); |
|---|
| 23 | + unset($file_array); |
|---|
| 24 | + |
|---|
| 25 | + if ( is_wp_error($id) ) { |
|---|
| 26 | + $errors['upload_error'] = $id; |
|---|
| 27 | + $id = false; |
|---|
| 28 | + } |
|---|
| 29 | + } |
|---|
| 30 | + |
|---|
| 31 | + if ( !empty($src) && !strpos($src, '://') ) |
|---|
| 32 | + |
|---|
| 33 | + $src = "http://$src"; |
|---|
| 34 | + /*$alt = attribute_escape($_POST['insertonly']['alt']); |
|---|
| 35 | + if ( isset($_POST['insertonly']['align']) ) { |
|---|
| 36 | + $align = attribute_escape($_POST['insertonly']['align']); |
|---|
| 37 | + $class = " class='align$align'"; |
|---|
| 38 | + } */ |
|---|
| 39 | + if ( !empty($src) ) |
|---|
| 40 | + $html = "<img src='$src' alt='$alt'$class />"; |
|---|
| 41 | + return $html; |
|---|
| 42 | + |
|---|
| 43 | +} |
|---|
| 44 | + |
|---|
| 45 | +function media_handle_sideload($file_array, $post_id, $post_data = array()) { |
|---|
| 46 | + $overrides = array('test_form'=>false); |
|---|
| 47 | + $file = wp_handle_sideload($file_array, $overrides); |
|---|
| 48 | + |
|---|
| 49 | + if ( isset($file['error']) ) |
|---|
| 50 | + return new wp_error( 'upload_error', $file['error'] ); |
|---|
| 51 | + |
|---|
| 52 | + $url = $file['url']; |
|---|
| 53 | + $type = $file['type']; |
|---|
| 54 | + $file = $file['file']; |
|---|
| 55 | + $title = preg_replace('/\.[^.]+$/', '', basename($file)); |
|---|
| 56 | + $content = ''; |
|---|
| 57 | + |
|---|
| 58 | + // use image exif/iptc data for title and caption defaults if possible |
|---|
| 59 | + if ( $image_meta = @wp_read_image_metadata($file) ) { |
|---|
| 60 | + if ( trim($image_meta['title']) ) |
|---|
| 61 | + $title = $image_meta['title']; |
|---|
| 62 | + if ( trim($image_meta['caption']) ) |
|---|
| 63 | + $content = $image_meta['caption']; |
|---|
| 64 | + } |
|---|
| 65 | + |
|---|
| 66 | + // Construct the attachment array |
|---|
| 67 | + $attachment = array_merge( array( |
|---|
| 68 | + 'post_mime_type' => $type, |
|---|
| 69 | + 'guid' => $url, |
|---|
| 70 | + 'post_parent' => $post_id, |
|---|
| 71 | + 'post_title' => $title, |
|---|
| 72 | + 'post_content' => $content, |
|---|
| 73 | + ), $post_data ); |
|---|
| 74 | + |
|---|
| 75 | + // Save the data |
|---|
| 76 | + $id = wp_insert_attachment($attachment, $file, $post_parent); |
|---|
| 77 | + if ( !is_wp_error($id) ) { |
|---|
| 78 | + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); |
|---|
| 79 | + } |
|---|
| 80 | + |
|---|
| 81 | + return array('id' => $id, 'src' => $url); |
|---|
| 82 | + |
|---|
| 83 | +} |
|---|
| 84 | + |
|---|
| 85 | + |
|---|
| 86 | // wrap iframe content (produced by $content_func) in a doctype, html head/body etc |
|---|
| 87 | // any additional function args will be passed to content_func |
|---|
| 88 | function wp_iframe($content_func /* ... */) { |
|---|
| 89 | Index: wp-admin/includes/file.php |
|---|
| 90 | =================================================================== |
|---|
| 91 | --- wp-admin/includes/file.php (revision 8041) |
|---|
| 92 | +++ wp-admin/includes/file.php (working copy) |
|---|
| 93 | @@ -184,7 +184,99 @@ |
|---|
| 94 | |
|---|
| 95 | return $return; |
|---|
| 96 | } |
|---|
| 97 | +// Pass this function an array similar to that of a $_FILES POST array. |
|---|
| 98 | +function wp_handle_sideload( &$file, $overrides = false ) { |
|---|
| 99 | + // The default error handler. |
|---|
| 100 | + if (! function_exists( 'wp_handle_upload_error' ) ) { |
|---|
| 101 | + function wp_handle_upload_error( &$file, $message ) { |
|---|
| 102 | + return array( 'error'=>$message ); |
|---|
| 103 | + } |
|---|
| 104 | + } |
|---|
| 105 | |
|---|
| 106 | + // You may define your own function and pass the name in $overrides['upload_error_handler'] |
|---|
| 107 | + $upload_error_handler = 'wp_handle_upload_error'; |
|---|
| 108 | + |
|---|
| 109 | + // $_POST['action'] must be set and its value must equal $overrides['action'] or this: |
|---|
| 110 | + $action = 'wp_handle_sideload'; |
|---|
| 111 | + |
|---|
| 112 | + // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error']. |
|---|
| 113 | + $upload_error_strings = array( false, |
|---|
| 114 | + __( "The file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ), |
|---|
| 115 | + __( "The file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ), |
|---|
| 116 | + __( "The file was only partially uploaded." ), |
|---|
| 117 | + __( "No file was sent." ), |
|---|
| 118 | + __( "Missing a temporary folder." ), |
|---|
| 119 | + __( "Failed to write file to disk." )); |
|---|
| 120 | + |
|---|
| 121 | + // All tests are on by default. Most can be turned off by $override[{test_name}] = false; |
|---|
| 122 | + $test_form = true; |
|---|
| 123 | + $test_size = true; |
|---|
| 124 | + |
|---|
| 125 | + // If you override this, you must provide $ext and $type!!!! |
|---|
| 126 | + $test_type = true; |
|---|
| 127 | + $mimes = false; |
|---|
| 128 | + |
|---|
| 129 | + // Install user overrides. Did we mention that this voids your warranty? |
|---|
| 130 | + if ( is_array( $overrides ) ) |
|---|
| 131 | + extract( $overrides, EXTR_OVERWRITE ); |
|---|
| 132 | + |
|---|
| 133 | + // A correct form post will pass this test. |
|---|
| 134 | + if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) ) |
|---|
| 135 | + return $upload_error_handler( $file, __( 'Invalid form submission.' )); |
|---|
| 136 | + |
|---|
| 137 | + // A successful upload will pass this test. It makes no sense to override this one. |
|---|
| 138 | + if ( $file['error'] > 0 ) |
|---|
| 139 | + return $upload_error_handler( $file, $upload_error_strings[$file['error']] ); |
|---|
| 140 | + |
|---|
| 141 | + // A non-empty file will pass this test. |
|---|
| 142 | + if ( $test_size && !(filesize($file['tmp_name']) > 0 ) ) |
|---|
| 143 | + return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' )); |
|---|
| 144 | + |
|---|
| 145 | + // A properly uploaded file will pass this test. There should be no reason to override this one. |
|---|
| 146 | + if (! @ is_file( $file['tmp_name'] ) ) |
|---|
| 147 | + return $upload_error_handler( $file, __( 'Specified file does not exist.' )); |
|---|
| 148 | + |
|---|
| 149 | + // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. |
|---|
| 150 | + if ( $test_type ) { |
|---|
| 151 | + $wp_filetype = wp_check_filetype( $file['name'], $mimes ); |
|---|
| 152 | + |
|---|
| 153 | + extract( $wp_filetype ); |
|---|
| 154 | + |
|---|
| 155 | + if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) ) |
|---|
| 156 | + return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' )); |
|---|
| 157 | + |
|---|
| 158 | + if ( !$ext ) |
|---|
| 159 | + $ext = ltrim(strrchr($file['name'], '.'), '.'); |
|---|
| 160 | + |
|---|
| 161 | + if ( !$type ) |
|---|
| 162 | + $type = $file['type']; |
|---|
| 163 | + } |
|---|
| 164 | + |
|---|
| 165 | + // A writable uploads dir will pass this test. Again, there's no point overriding this one. |
|---|
| 166 | + if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) |
|---|
| 167 | + return $upload_error_handler( $file, $uploads['error'] ); |
|---|
| 168 | + |
|---|
| 169 | + $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); |
|---|
| 170 | + |
|---|
| 171 | + // Move the file to the uploads dir |
|---|
| 172 | + $new_file = $uploads['path'] . "/$filename"; |
|---|
| 173 | + if ( false === @ rename( $file['tmp_name'], $new_file ) ) { |
|---|
| 174 | + return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); |
|---|
| 175 | + } |
|---|
| 176 | + |
|---|
| 177 | + // Set correct file permissions |
|---|
| 178 | + $stat = stat( dirname( $new_file )); |
|---|
| 179 | + $perms = $stat['mode'] & 0000666; |
|---|
| 180 | + @ chmod( $new_file, $perms ); |
|---|
| 181 | + |
|---|
| 182 | + // Compute the URL |
|---|
| 183 | + $url = $uploads['url'] . "/$filename"; |
|---|
| 184 | + |
|---|
| 185 | + $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) ); |
|---|
| 186 | + |
|---|
| 187 | + return $return; |
|---|
| 188 | +} |
|---|
| 189 | + |
|---|
| 190 | /** |
|---|
| 191 | * Downloads a url to a local file using the Snoopy HTTP Class |
|---|
| 192 | * |
|---|
| 193 | Index: wp-admin/press-this.php |
|---|
| 194 | =================================================================== |
|---|
| 195 | --- wp-admin/press-this.php (revision 8041) |
|---|
| 196 | +++ wp-admin/press-this.php (working copy) |
|---|
| 197 | @@ -1,114 +1,226 @@ |
|---|
| 198 | <?php |
|---|
| 199 | require_once('admin.php'); |
|---|
| 200 | |
|---|
| 201 | -if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin’ uh?' )); |
|---|
| 202 | +if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin’ uh?' )); ?> |
|---|
| 203 | |
|---|
| 204 | -if ( 'post' == $_REQUEST['action'] ) { |
|---|
| 205 | - check_admin_referer('press-this'); |
|---|
| 206 | - $post_ID = press_it(); ?> |
|---|
| 207 | - <script>if(confirm("<?php _e('Your post is saved. Do you want to view the post?') ?>")) {window.opener.location.replace("<?php echo get_permalink($post_ID);?>");}window.close();</script> |
|---|
| 208 | <?php |
|---|
| 209 | -die; |
|---|
| 210 | -} |
|---|
| 211 | - |
|---|
| 212 | function press_it() { |
|---|
| 213 | - $quick['post_status'] = 'publish'; |
|---|
| 214 | - $quick['post_category'] = $_REQUEST['post_category']; |
|---|
| 215 | - $quick['tags_input'] = $_REQUEST['tags_input']; |
|---|
| 216 | - $quick['post_title'] = $_REQUEST['post_title']; |
|---|
| 217 | + $quick['post_status'] = 'publish'; |
|---|
| 218 | + $quick['post_category'] = $_REQUEST['post_category']; |
|---|
| 219 | + $quick['tags_input'] = $_REQUEST['tags_input']; |
|---|
| 220 | + $quick['post_title'] = $_REQUEST['post_title']; |
|---|
| 221 | + $quick['post_content'] = ''; |
|---|
| 222 | + |
|---|
| 223 | + // insert the post with nothing in it, to get an ID |
|---|
| 224 | + $post_ID = wp_insert_post($quick, true); |
|---|
| 225 | + |
|---|
| 226 | + $content = ''; |
|---|
| 227 | + switch ( $_REQUEST['post_type'] ) { |
|---|
| 228 | + case 'text': |
|---|
| 229 | + $content .= $_REQUEST['content']; |
|---|
| 230 | |
|---|
| 231 | - $content = ''; |
|---|
| 232 | - switch ( $_REQUEST['post_type'] ) { |
|---|
| 233 | - case 'text': |
|---|
| 234 | - $content = $_REQUEST['content']; |
|---|
| 235 | + case 'quote': |
|---|
| 236 | + $content .= $_REQUEST['content']; |
|---|
| 237 | + break; |
|---|
| 238 | |
|---|
| 239 | - case 'quote': |
|---|
| 240 | - $content = $_REQUEST['content']; |
|---|
| 241 | - break; |
|---|
| 242 | + case 'photo': |
|---|
| 243 | + if ($_REQUEST['photo_link']) |
|---|
| 244 | + $content .= '<a href="' . $_REQUEST['photo_link'] . '">'; |
|---|
| 245 | + |
|---|
| 246 | + $content .= media_sideload_image($_REQUEST['photo_src'], $post_ID); |
|---|
| 247 | |
|---|
| 248 | - case 'photo': |
|---|
| 249 | - |
|---|
| 250 | -// http_post_data(); |
|---|
| 251 | - |
|---|
| 252 | - if ($_REQUEST['photo_link']) |
|---|
| 253 | - $content = '<a href="' . $_REQUEST['photo_link'] . '">'; |
|---|
| 254 | + if ($_REQUEST['photo_link']) |
|---|
| 255 | + $content .= '</a>'; |
|---|
| 256 | |
|---|
| 257 | - $content .= '<img src="' . $_REQUEST['photo_src'] . '" alt=""/>'; |
|---|
| 258 | + if ($_REQUEST['content']) |
|---|
| 259 | + $content .= $content . "\n\n".$_REQUEST['content']; |
|---|
| 260 | |
|---|
| 261 | - if ($_REQUEST['photo_link']) |
|---|
| 262 | - $content .= '</a> |
|---|
| 263 | - '; |
|---|
| 264 | + break; |
|---|
| 265 | + case "video": |
|---|
| 266 | + if($_REQUEST['embed_code']) |
|---|
| 267 | + $content .= $_REQUEST['embed_code']."\n\n"; |
|---|
| 268 | + $content .= $_REQUEST['content']; |
|---|
| 269 | + break; |
|---|
| 270 | + } |
|---|
| 271 | |
|---|
| 272 | - if ($_REQUEST['content']) |
|---|
| 273 | - $content = $content . "\n".$_REQUEST['content']; |
|---|
| 274 | + $quick['post_content'] = $content; |
|---|
| 275 | |
|---|
| 276 | - break; |
|---|
| 277 | - case "video": |
|---|
| 278 | - $content = $_REQUEST['content']; |
|---|
| 279 | - |
|---|
| 280 | - break; |
|---|
| 281 | + if ( is_wp_error($post_ID) ) { |
|---|
| 282 | + wp_die($id); |
|---|
| 283 | + wp_delete_post($post_ID); |
|---|
| 284 | + } else { |
|---|
| 285 | + $quick['ID'] = $post_ID; |
|---|
| 286 | + wp_update_post($quick); |
|---|
| 287 | } |
|---|
| 288 | + return $post_ID; |
|---|
| 289 | +} |
|---|
| 290 | |
|---|
| 291 | - $quick['post_content'] = $content; |
|---|
| 292 | + function tag_div() { ?> |
|---|
| 293 | + <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p> |
|---|
| 294 | + <div id="tagchecklist"></div> |
|---|
| 295 | + <?php |
|---|
| 296 | + } |
|---|
| 297 | |
|---|
| 298 | - $post_ID = wp_insert_post($quick, true); |
|---|
| 299 | + function category_div() { |
|---|
| 300 | + ?> |
|---|
| 301 | + <div id="categories"> |
|---|
| 302 | + <div class="submitbox" id="submitpost"> |
|---|
| 303 | + <div id="previewview"> <h2><?php _e('Categories') ?></h2></div> |
|---|
| 304 | + <div class="inside"> |
|---|
| 305 | + <div id="categories-all"> |
|---|
| 306 | + <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
|---|
| 307 | + <?php wp_category_checklist() ?> |
|---|
| 308 | + </ul> |
|---|
| 309 | + </div> |
|---|
| 310 | + </div> |
|---|
| 311 | + <p class="submit"> |
|---|
| 312 | + <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/> |
|---|
| 313 | + <img src="images/loading.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/> |
|---|
| 314 | + </p> |
|---|
| 315 | + </div> |
|---|
| 316 | + <?php |
|---|
| 317 | + } |
|---|
| 318 | |
|---|
| 319 | - if ( is_wp_error($post_ID) ) |
|---|
| 320 | - wp_die($wp_error); |
|---|
| 321 | - |
|---|
| 322 | - return $post_ID; |
|---|
| 323 | +// For posts submitted |
|---|
| 324 | +if ( 'post' == $_REQUEST['action'] ) { |
|---|
| 325 | + check_admin_referer('press-this'); $post_ID = press_it(); ?> |
|---|
| 326 | + <script>if(confirm("<?php _e('Your post is saved. Do you want to view the post?') ?>")){window.opener.location.replace("<?php echo get_permalink($post_ID);?>");}window.close();</script> |
|---|
| 327 | + <?php die; |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | -function tag_div() { ?> |
|---|
| 331 | - <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p> |
|---|
| 332 | - <div id="tagchecklist"></div> |
|---|
| 333 | -<?php |
|---|
| 334 | -} |
|---|
| 335 | +// Ajax Requests |
|---|
| 336 | +$url = $_REQUEST['url']; |
|---|
| 337 | +$selection = $_REQUEST['selection']; |
|---|
| 338 | |
|---|
| 339 | -function category_div() { |
|---|
| 340 | -?> |
|---|
| 341 | -<div id="categories"> |
|---|
| 342 | - <div class="submitbox" id="submitpost"> |
|---|
| 343 | - <div id="previewview"> <h2><?php _e('Categories') ?></h2></div> |
|---|
| 344 | - <div class="inside"> |
|---|
| 345 | - <div id="categories-all"> |
|---|
| 346 | - <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
|---|
| 347 | - <?php wp_category_checklist() ?> |
|---|
| 348 | - </ul> |
|---|
| 349 | - </div> |
|---|
| 350 | - </div> |
|---|
| 351 | - <p class="submit"> |
|---|
| 352 | - <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/> |
|---|
| 353 | - <img src="images/loading.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/> |
|---|
| 354 | - </p> |
|---|
| 355 | - </div> |
|---|
| 356 | -<?php |
|---|
| 357 | +if($_REQUEST['ajax'] == 'video') { ?> |
|---|
| 358 | + <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2> |
|---|
| 359 | + <div class="titlewrap" > |
|---|
| 360 | + <textarea name="embed_code" id="embed_code" rows="8" cols="40"><?php echo $selection; ?></textarea> |
|---|
| 361 | + </div> |
|---|
| 362 | +<?php die; |
|---|
| 363 | } |
|---|
| 364 | |
|---|
| 365 | -function get_images_from_uri($uri) { |
|---|
| 366 | +if($_REQUEST['ajax'] == 'photo_images') { |
|---|
| 367 | + function get_images_from_uri($uri) { |
|---|
| 368 | + $content = wp_remote_fopen($uri); |
|---|
| 369 | + $host = parse_url($uri); |
|---|
| 370 | + if ( false === $content ) return ''; |
|---|
| 371 | |
|---|
| 372 | - $content = wp_remote_fopen($uri); |
|---|
| 373 | - $uri = str_replace(basename($uri), '', $uri); |
|---|
| 374 | - $host = parse_url($uri); |
|---|
| 375 | - |
|---|
| 376 | - if ( false === $content ) return ''; |
|---|
| 377 | + $pattern = '/<img[^>]+src=[\'"]([^\'" >]+?)[\'" >]/is'; |
|---|
| 378 | + preg_match_all($pattern, $content, $matches); |
|---|
| 379 | + if ( empty($matches[1]) ) return ''; |
|---|
| 380 | + |
|---|
| 381 | + $sources = array(); |
|---|
| 382 | |
|---|
| 383 | - $pattern = '/<img[^>]+src=[\'"]([^\'" >]+?)[\'" >]/is'; |
|---|
| 384 | - preg_match_all($pattern, $content, $matches); |
|---|
| 385 | - if ( empty($matches[1]) ) return ''; |
|---|
| 386 | - |
|---|
| 387 | - $sources = array(); |
|---|
| 388 | - foreach ($matches[1] as $src) { |
|---|
| 389 | - if ( false !== strpos($src, '&') ) |
|---|
| 390 | - continue; |
|---|
| 391 | - if ( !strstr( $src, 'http://' ) ) |
|---|
| 392 | - $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); |
|---|
| 393 | + foreach ($matches[1] as $src) { |
|---|
| 394 | + if ( false !== strpos($src, '&') ) continue; |
|---|
| 395 | + if(strpos($src, 'http') === false) { |
|---|
| 396 | + if(strpos($src, '../') === false && strpos($src, './') === false) { |
|---|
| 397 | + $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); |
|---|
| 398 | + } else { |
|---|
| 399 | + $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); |
|---|
| 400 | + } |
|---|
| 401 | + } |
|---|
| 402 | + $sources[] = $src; |
|---|
| 403 | + } |
|---|
| 404 | + return "'" . implode("','", $sources) . "'"; |
|---|
| 405 | + } |
|---|
| 406 | |
|---|
| 407 | - $sources[] = $src; |
|---|
| 408 | - } |
|---|
| 409 | - return "'" . implode("','", $sources) . "'"; |
|---|
| 410 | + echo 'new Array('.get_images_from_uri($url).')'; |
|---|
| 411 | +die; |
|---|
| 412 | } |
|---|
| 413 | |
|---|
| 414 | +if($_REQUEST['ajax'] == 'photo_js') { ?> |
|---|
| 415 | + |
|---|
| 416 | + var last = null |
|---|
| 417 | + function pick(img) { |
|---|
| 418 | + |
|---|
| 419 | + if (last) last.style.backgroundColor = '#f4f4f4'; |
|---|
| 420 | + if (img) { |
|---|
| 421 | + jQuery('#photo_src').val(img.src); |
|---|
| 422 | + img.style.backgroundColor = '#44f'; |
|---|
| 423 | + } |
|---|
| 424 | + last = img; |
|---|
| 425 | + |
|---|
| 426 | + /*noel's code to select more than one image.... |
|---|
| 427 | + jQuery('.photolist').append('<h2><?php _e("Photo URL") ?></h2>' + |
|---|
| 428 | + '<div class="titlewrap">' + |
|---|
| 429 | + '<a href="#" class="remove">remove <input name="photo_src" id="photo_src[]" value ="'+ img.src +'" class="text" onkeydown="pick(0);"/></a>' + |
|---|
| 430 | + '</div>');*/ |
|---|
| 431 | + |
|---|
| 432 | + return false; |
|---|
| 433 | + } |
|---|
| 434 | + |
|---|
| 435 | + jQuery('.remove').click(function() { |
|---|
| 436 | + jQuery(this).remove; |
|---|
| 437 | + }); |
|---|
| 438 | + |
|---|
| 439 | + |
|---|
| 440 | + var my_src, img, img_tag, aspect, w, h, skip, i, strtoappend = ""; |
|---|
| 441 | + |
|---|
| 442 | + var my_src =eval( |
|---|
| 443 | + jQuery.ajax({ |
|---|
| 444 | + type: "GET", |
|---|
| 445 | + url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>", |
|---|
| 446 | + cache : false, |
|---|
| 447 | + async : false, |
|---|
| 448 | + data: "ajax=photo_images&url=<?php echo $url?>", |
|---|
| 449 | + dataType : "script" |
|---|
| 450 | + }).responseText); |
|---|
| 451 | + |
|---|
| 452 | + for (i = 0; i < my_src.length; i++) { |
|---|
| 453 | + img = new Image(); |
|---|
| 454 | + img.src = my_src[i]; |
|---|
| 455 | + img_attr = 'id="img' + i + '" onclick="pick(this);"'; |
|---|
| 456 | + skip = false; |
|---|
| 457 | + |
|---|
| 458 | + if (img.width && img.height) { |
|---|
| 459 | + if (img.width * img.height < 2500) skip = true; |
|---|
| 460 | + aspect = img.width / img.height; |
|---|
| 461 | + if (aspect > 1) { // Image is wide |
|---|
| 462 | + scale = 75 / img.width; |
|---|
| 463 | + } else { // Image is tall or square |
|---|
| 464 | + scale = 75 / img.height; |
|---|
| 465 | + } |
|---|
| 466 | + if (scale < 1) { |
|---|
| 467 | + w = parseInt(img.width * scale); |
|---|
| 468 | + h = parseInt(img.height * scale); |
|---|
| 469 | + } else { |
|---|
| 470 | + w = img.width; |
|---|
| 471 | + h = img.height; |
|---|
| 472 | + } |
|---|
| 473 | + img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; |
|---|
| 474 | + } |
|---|
| 475 | + |
|---|
| 476 | + if (!skip) strtoappend += '<a href="' + img.src + '" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; |
|---|
| 477 | + |
|---|
| 478 | + } |
|---|
| 479 | + |
|---|
| 480 | + jQuery('#img_container').html(strtoappend); |
|---|
| 481 | + |
|---|
| 482 | + tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox |
|---|
| 483 | + |
|---|
| 484 | +<?php die; } |
|---|
| 485 | + |
|---|
| 486 | +if($_REQUEST['ajax'] == 'photo') { ?> |
|---|
| 487 | + <h2><?php _e('Photo URL') ?></h2> |
|---|
| 488 | + <div class="titlewrap"> |
|---|
| 489 | + <input name="photo_src" id="photo_src" class="text" onkeydown="pick(0);"/> |
|---|
| 490 | + </div> |
|---|
| 491 | + |
|---|
| 492 | + <div class="photolist"></div> |
|---|
| 493 | + |
|---|
| 494 | + <h2><?php _e('Link Photo to following URL') ?></h2><?php _e('(leave blank to leave the photo unlinked)') ?> |
|---|
| 495 | + <div class="titlewrap"> |
|---|
| 496 | + <input name="photo_link" id="photo_link" class="text" value="<?php echo attribute_escape($url);?>"/> |
|---|
| 497 | + </div> |
|---|
| 498 | + |
|---|
| 499 | + <small><?php _e('Click images to select:') ?></small> |
|---|
| 500 | + <div class="titlewrap"> |
|---|
| 501 | + <div id="img_container">Loading Images...</div> |
|---|
| 502 | + </div> |
|---|
| 503 | +<?php die; } |
|---|
| 504 | + |
|---|
| 505 | // Clean up the data being passed in |
|---|
| 506 | $title = wp_specialchars(stripslashes($_GET['t'])); |
|---|
| 507 | $selection = trim(wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s'])))); |
|---|
| 508 | @@ -122,7 +234,6 @@ |
|---|
| 509 | |
|---|
| 510 | <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script> |
|---|
| 511 | <?php |
|---|
| 512 | - wp_enqueue_script('jquery-ui-tabs'); |
|---|
| 513 | add_thickbox(); |
|---|
| 514 | wp_enqueue_style('press-this'); |
|---|
| 515 | wp_enqueue_style( 'colors' ); |
|---|
| 516 | @@ -153,6 +264,7 @@ |
|---|
| 517 | width: "100%", |
|---|
| 518 | theme : "advanced", |
|---|
| 519 | theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,undo,redo,link,unlink", |
|---|
| 520 | + extended_valid_elements : "object[width|height],param[name|value],embed[src|type|wmode|width|height], a[name|href|target|title|onclick], img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name], hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
|---|
| 521 | theme_advanced_buttons2 : "", |
|---|
| 522 | theme_advanced_buttons3 : "", |
|---|
| 523 | theme_advanced_toolbar_location : "top", |
|---|
| 524 | @@ -174,26 +286,26 @@ |
|---|
| 525 | }); |
|---|
| 526 | <?php } ?> |
|---|
| 527 | |
|---|
| 528 | - jQuery('#tags-input').hide(); |
|---|
| 529 | + jQuery('#tags-input').hide(); |
|---|
| 530 | |
|---|
| 531 | - tag_update_quickclicks(); |
|---|
| 532 | + tag_update_quickclicks(); |
|---|
| 533 | |
|---|
| 534 | - // add the quickadd form |
|---|
| 535 | - jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="submit" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" onclick="return false;" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>'); |
|---|
| 536 | + // add the quickadd form |
|---|
| 537 | + jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="submit" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" onclick="return false;" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>'); |
|---|
| 538 | |
|---|
| 539 | - jQuery('#tagadd').click( tag_flush_to_text ); |
|---|
| 540 | - jQuery('#newtag').focus(function() { |
|---|
| 541 | - if ( this.value == postL10n.addTag ) |
|---|
| 542 | - jQuery(this).val( '' ).removeClass( 'form-input-tip' ); |
|---|
| 543 | - }); |
|---|
| 544 | - jQuery('#newtag').blur(function() { |
|---|
| 545 | - if ( this.value == '' ) |
|---|
| 546 | - jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); |
|---|
| 547 | - }); |
|---|
| 548 | + jQuery('#tagadd').click( tag_flush_to_text ); |
|---|
| 549 | + jQuery('#newtag').focus(function() { |
|---|
| 550 | + if ( this.value == postL10n.addTag ) |
|---|
| 551 | + jQuery(this).val( '' ).removeClass( 'form-input-tip' ); |
|---|
| 552 | + }); |
|---|
| 553 | + jQuery('#newtag').blur(function() { |
|---|
| 554 | + if ( this.value == '' ) |
|---|
| 555 | + jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); |
|---|
| 556 | + }); |
|---|
| 557 | |
|---|
| 558 | - // auto-save tags on post save/publish |
|---|
| 559 | - jQuery('#publish').click( tag_save_on_publish ); |
|---|
| 560 | - jQuery('#save-post').click( tag_save_on_publish ); |
|---|
| 561 | + // auto-save tags on post save/publish |
|---|
| 562 | + jQuery('#publish').click( tag_save_on_publish ); |
|---|
| 563 | + jQuery('#save-post').click( tag_save_on_publish ); |
|---|
| 564 | |
|---|
| 565 | function set_menu(type) { |
|---|
| 566 | jQuery('#text_button').removeClass('ui-tabs-selected'); |
|---|
| 567 | @@ -202,129 +314,113 @@ |
|---|
| 568 | jQuery("#post_type").val(type); |
|---|
| 569 | } |
|---|
| 570 | function set_editor(text) { |
|---|
| 571 | - tinyMCE.activeEditor.setContent(''); |
|---|
| 572 | - tinyMCE.execCommand('mceInsertContent' ,false, text); |
|---|
| 573 | + if(tinyMCE.activeEditor) tinyMCE.activeEditor.setContent(''); |
|---|
| 574 | + if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); |
|---|
| 575 | } |
|---|
| 576 | function set_title(title) { jQuery("#content_type").text(title); } |
|---|
| 577 | - |
|---|
| 578 | - var last = null; |
|---|
| 579 | - function pick(img) { |
|---|
| 580 | - if (last) last.style.backgroundColor = '#f4f4f4'; |
|---|
| 581 | - if (img) { |
|---|
| 582 | - document.getElementById('photo_src').value = img.src; |
|---|
| 583 | - img.style.backgroundColor = '#44f'; |
|---|
| 584 | - } |
|---|
| 585 | - last = img; |
|---|
| 586 | - |
|---|
| 587 | - /*noel's code to select more than one image.... |
|---|
| 588 | - jQuery('.photolist').append('<h2><?php _e("Photo URL") ?></h2>' + |
|---|
| 589 | - '<div class="titlewrap">' + |
|---|
| 590 | - '<a href="#" class="remove">remove <input name="photo_src" id="photo_src[]" value ="'+ img.src +'" class="text" onkeydown="pick(0);"/></a>' + |
|---|
| 591 | - '</div>');*/ |
|---|
| 592 | - |
|---|
| 593 | - return false; |
|---|
| 594 | + function reset_height() { |
|---|
| 595 | + tinyMCE.height = '170px'; |
|---|
| 596 | } |
|---|
| 597 | + function show(tab_name) { |
|---|
| 598 | + jQuery('body').removeClass('video_split'); |
|---|
| 599 | + jQuery('#extra_fields').hide(); |
|---|
| 600 | + switch(tab_name) { |
|---|
| 601 | + case 'text' : |
|---|
| 602 | + reset_height(); |
|---|
| 603 | + jQuery('.editor-container').show(); |
|---|
| 604 | + jQuery('#content_type').show(); |
|---|
| 605 | + set_menu('text'); |
|---|
| 606 | + set_title('<?php _e('Text') ?>'); |
|---|
| 607 | + set_editor('<?php echo $selection; ?>'); |
|---|
| 608 | + return false; |
|---|
| 609 | + break; |
|---|
| 610 | + case 'quote' : |
|---|
| 611 | + reset_height(); |
|---|
| 612 | + jQuery('.editor-container').show(); |
|---|
| 613 | + jQuery('#content_type').show(); |
|---|
| 614 | + set_menu('quote'); |
|---|
| 615 | + set_title('<?php _e('Quote') ?>'); |
|---|
| 616 | + set_editor('<blockquote><p><?php echo $selection; ?> </p><p><cite><a href="<?php echo $url; ?>"><?php echo $title; ?></a></cite> </p></blockquote>'); |
|---|
| 617 | |
|---|
| 618 | - jQuery(document).ready(function() { |
|---|
| 619 | - |
|---|
| 620 | - |
|---|
| 621 | - <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> |
|---|
| 622 | - |
|---|
| 623 | - <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> |
|---|
| 624 | + return false; |
|---|
| 625 | + break; |
|---|
| 626 | + case 'video' : |
|---|
| 627 | + reset_height(); |
|---|
| 628 | + jQuery('.editor-container').show(); |
|---|
| 629 | + jQuery('#content_type').show(); |
|---|
| 630 | + set_menu('video'); |
|---|
| 631 | + set_title('<?php _e('Caption') ?>'); |
|---|
| 632 | + |
|---|
| 633 | + jQuery('#extra_fields').show(); |
|---|
| 634 | + jQuery('body').addClass('video_split'); |
|---|
| 635 | |
|---|
| 636 | - <?php } else { ?> |
|---|
| 637 | + |
|---|
| 638 | + jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', selection: '<?php echo attribute_escape($selection); ?>'}, function() { |
|---|
| 639 | + |
|---|
| 640 | + <?php |
|---|
| 641 | + if ( preg_match("/youtube\.com\/watch/i", $url) ) { |
|---|
| 642 | + list($domain, $video_id) = split("v=", $url); |
|---|
| 643 | + $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; ?> |
|---|
| 644 | + |
|---|
| 645 | + <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { |
|---|
| 646 | + |
|---|
| 647 | + list($domain, $video_id) = split(".com/", $url); |
|---|
| 648 | + $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /> <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>'; |
|---|
| 649 | + |
|---|
| 650 | + if(trim($selection) == '') $selection = '<a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a>'; |
|---|
| 651 | + }else { |
|---|
| 652 | + $content = $selection; |
|---|
| 653 | + } ?> |
|---|
| 654 | + jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>'); |
|---|
| 655 | + set_editor('<?php echo $title; ?>'); |
|---|
| 656 | + |
|---|
| 657 | + }); |
|---|
| 658 | |
|---|
| 659 | - <?php } ?> |
|---|
| 660 | - |
|---|
| 661 | - |
|---|
| 662 | - jQuery("#text_button").click(function () { |
|---|
| 663 | - jQuery('.editor-container').show(); |
|---|
| 664 | - jQuery('#content_type').show(); |
|---|
| 665 | - jQuery('#photo_fields').hide(); |
|---|
| 666 | - set_menu('text'); |
|---|
| 667 | - set_title('<?php _e('Text') ?>'); |
|---|
| 668 | - set_editor('<?php echo $selection; ?>'); |
|---|
| 669 | - return false; |
|---|
| 670 | - }); |
|---|
| 671 | - |
|---|
| 672 | - jQuery("#quote_button").click(function () { |
|---|
| 673 | - jQuery('.editor-container').show(); |
|---|
| 674 | - jQuery('#content_type').show(); |
|---|
| 675 | - jQuery('#photo_fields').hide(); |
|---|
| 676 | - set_menu('quote'); |
|---|
| 677 | - set_title('<?php _e('Quote') ?>'); |
|---|
| 678 | - set_editor('<blockquote><p><?php echo $selection; ?> </p><p><cite><a href="<?php echo $url; ?>"><?php echo $title; ?></a></cite> </p></blockquote>'); |
|---|
| 679 | + |
|---|
| 680 | + return false; |
|---|
| 681 | + break; |
|---|
| 682 | |
|---|
| 683 | - return false; |
|---|
| 684 | - }); |
|---|
| 685 | - |
|---|
| 686 | + case 'photo' : |
|---|
| 687 | + reset_height(); |
|---|
| 688 | + set_menu('photo'); |
|---|
| 689 | + set_title('Caption'); |
|---|
| 690 | + set_editor('<a href="<?php echo $url; ?>"><?php echo $title; ?></a>'); |
|---|
| 691 | + |
|---|
| 692 | + jQuery('#extra_fields').show(); |
|---|
| 693 | + jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&url='.attribute_escape($url); ?>'); |
|---|
| 694 | + jQuery('#extra_fields').prepend('<h2><img src="images/loading.gif" alt="" /> Loading...</h2>'); |
|---|
| 695 | + jQuery.ajax({ |
|---|
| 696 | + type: "GET", |
|---|
| 697 | + cache : false, |
|---|
| 698 | + url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>", |
|---|
| 699 | + data: "ajax=photo_js&url=<?php echo $url?>", |
|---|
| 700 | + dataType : "script", |
|---|
| 701 | + success : function() { |
|---|
| 702 | + } |
|---|
| 703 | + }); |
|---|
| 704 | + return false; |
|---|
| 705 | + break; |
|---|
| 706 | |
|---|
| 707 | - jQuery("#video_button").click(function () { |
|---|
| 708 | - jQuery('.editor-container').show(); |
|---|
| 709 | - jQuery('#content_type').show(); |
|---|
| 710 | - jQuery('#photo_fields').hide(); |
|---|
| 711 | - set_menu('video'); |
|---|
| 712 | - set_title('<?php _e('Video') ?>'); |
|---|
| 713 | - set_editor('<a href="<?php echo $url; ?>"><?php echo $title; ?></a>'); |
|---|
| 714 | - <?php /* |
|---|
| 715 | - <!--list($garbage,$video_id) = split("v=", $_REQUEST['content']); |
|---|
| 716 | - $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';--> |
|---|
| 717 | - */?> |
|---|
| 718 | - return false; |
|---|
| 719 | - }); |
|---|
| 720 | + } |
|---|
| 721 | |
|---|
| 722 | - |
|---|
| 723 | - jQuery("#photo_button").click(function () { |
|---|
| 724 | - set_menu('photo'); |
|---|
| 725 | - set_title('Caption'); |
|---|
| 726 | - set_editor('<a href="<?php echo $url; ?>"><?php echo $title; ?></a>'); |
|---|
| 727 | - jQuery('#photo_fields').show(); |
|---|
| 728 | - jQuery('.remove').click(function() { |
|---|
| 729 | - jQuery(this).remove; |
|---|
| 730 | - |
|---|
| 731 | + } |
|---|
| 732 | + |
|---|
| 733 | + jQuery(document).ready(function() { |
|---|
| 734 | + jQuery('#menu li').click(function (){ |
|---|
| 735 | + tab_name = this.id.split('_'); |
|---|
| 736 | + tab_name = tab_name[0]; |
|---|
| 737 | + show(tab_name); |
|---|
| 738 | }); |
|---|
| 739 | |
|---|
| 740 | - |
|---|
| 741 | - var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; |
|---|
| 742 | - var my_src = [<?php echo get_images_from_uri($url); ?>]; |
|---|
| 743 | - |
|---|
| 744 | - for (i = 0; i < my_src.length; i++) { |
|---|
| 745 | - img = new Image(); |
|---|
| 746 | - img.src = my_src[i]; |
|---|
| 747 | - img_attr = 'id="img' + i + '" onclick="pick(this);"'; |
|---|
| 748 | - skip = false; |
|---|
| 749 | - |
|---|
| 750 | - if (img.width && img.height) { |
|---|
| 751 | - if (img.width * img.height < 2500) skip = true; |
|---|
| 752 | - aspect = img.width / img.height; |
|---|
| 753 | - if (aspect > 1) { // Image is wide |
|---|
| 754 | - scale = 75 / img.width; |
|---|
| 755 | - } else { // Image is tall or square |
|---|
| 756 | - scale = 75 / img.height; |
|---|
| 757 | - } |
|---|
| 758 | - if (scale < 1) { |
|---|
| 759 | - w = parseInt(img.width * scale); |
|---|
| 760 | - h = parseInt(img.height * scale); |
|---|
| 761 | - } else { |
|---|
| 762 | - w = img.width; |
|---|
| 763 | - h = img.height; |
|---|
| 764 | - } |
|---|
| 765 | - img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; |
|---|
| 766 | - } |
|---|
| 767 | - |
|---|
| 768 | - if (!skip) strtoappend += '<a href="' + img.src + '" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; |
|---|
| 769 | - |
|---|
| 770 | - } |
|---|
| 771 | - |
|---|
| 772 | - jQuery('#img_container').html(strtoappend); |
|---|
| 773 | - |
|---|
| 774 | - tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox |
|---|
| 775 | - |
|---|
| 776 | - }); |
|---|
| 777 | + <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> |
|---|
| 778 | + show('video'); |
|---|
| 779 | + <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?> |
|---|
| 780 | + show('video'); |
|---|
| 781 | + <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> |
|---|
| 782 | + show('photo'); |
|---|
| 783 | + <?php } ?> |
|---|
| 784 | }); |
|---|
| 785 | - </script> |
|---|
| 786 | - |
|---|
| 787 | - |
|---|
| 788 | +</script> |
|---|
| 789 | </head> |
|---|
| 790 | <body class="press-this"> |
|---|
| 791 | <div id="wphead"> |
|---|
| 792 | @@ -339,8 +435,8 @@ |
|---|
| 793 | </ul> |
|---|
| 794 | |
|---|
| 795 | <form action="press-this.php?action=post" method="post"> |
|---|
| 796 | + |
|---|
| 797 | <?php wp_nonce_field('press-this') ?> |
|---|
| 798 | - <input type="hidden" name="source" value="bookmarklet"/> |
|---|
| 799 | <input type="hidden" name="post_type" id="post_type" value="text"/> |
|---|
| 800 | <div id="posting"> |
|---|
| 801 | |
|---|
| 802 | @@ -348,49 +444,20 @@ |
|---|
| 803 | <div class="titlewrap"> |
|---|
| 804 | <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> |
|---|
| 805 | </div> |
|---|
| 806 | - <div id="photo_fields" style="display: none;"> |
|---|
| 807 | - <h2><label for="photo_src"><?php _e('Photo URL') ?></label></h2> |
|---|
| 808 | - <div class="titlewrap"> |
|---|
| 809 | - <input name="photo_src" id="photo_src" class="text" onkeydown="pick(0);"/> |
|---|
| 810 | - </div> |
|---|
| 811 | - |
|---|
| 812 | - <div class="photolist"></div> |
|---|
| 813 | - |
|---|
| 814 | - <h2><label for="photo_link"><?php _e('Link Photo to following URL') ?></label></h2><?php _e('(leave blank to leave the photo unlinked)') ?> |
|---|
| 815 | - <div class="titlewrap"> |
|---|
| 816 | - <input name="photo_link" id="photo_link" class="text" value="<?php echo attribute_escape($url);?>"/> |
|---|
| 817 | - </div> |
|---|
| 818 | - |
|---|
| 819 | - <small><?php _e('Click images to select:') ?></small> |
|---|
| 820 | - <div class="titlewrap"> |
|---|
| 821 | - <div id="img_container"></div> |
|---|
| 822 | - </div> |
|---|
| 823 | - |
|---|
| 824 | - </div> |
|---|
| 825 | - |
|---|
| 826 | + |
|---|
| 827 | + <div id="extra_fields" style="display: none"></div> |
|---|
| 828 | + <div class="editor_area"> |
|---|
| 829 | <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> |
|---|
| 830 | <div class="editor-container"> |
|---|
| 831 | - <textarea name="content" id="content" style="height:170px;width:100%;" class="mceEditor"> |
|---|
| 832 | + <textarea name="content" id="content" style="width:100%;" class="mceEditor"> |
|---|
| 833 | <?php echo $selection; ?> |
|---|
| 834 | </textarea> |
|---|
| 835 | </div> |
|---|
| 836 | - |
|---|
| 837 | + </div> |
|---|
| 838 | <?php tag_div(); ?> |
|---|
| 839 | - |
|---|
| 840 | </div> |
|---|
| 841 | <?php category_div(); ?> |
|---|
| 842 | </form> |
|---|
| 843 | - <?php /* |
|---|
| 844 | - if ( preg_match("/youtube\.com\/watch/i", $url) ) { |
|---|
| 845 | - list($domain, $video_id) = split("v=", $url); |
|---|
| 846 | - ?> |
|---|
| 847 | - <input type="hidden" name="content" value="<?php echo attribute_escape($url); ?>" /> |
|---|
| 848 | - <img src="http://img.youtube.com/vi/<?php echo $video_id; ?>/default.jpg" align="right" style="border:solid 1px #aaa;" width="130" height="97"/> |
|---|
| 849 | - <?php } else { ?> |
|---|
| 850 | |
|---|
| 851 | - <h2><label for="video_post_one"><?php _e('Embed Code') ?></label></h2> |
|---|
| 852 | - <textarea name="content" id="video_post_one" style="height:80px;width:100%;"></textarea> |
|---|
| 853 | - <?php } */?> |
|---|
| 854 | - |
|---|
| 855 | </body> |
|---|
| 856 | -</html> |
|---|
| 857 | +</html> |
|---|
| 858 | \ No newline at end of file |
|---|
| 859 | Index: wp-admin/css/press-this.css |
|---|
| 860 | =================================================================== |
|---|
| 861 | --- wp-admin/css/press-this.css (revision 8041) |
|---|
| 862 | +++ wp-admin/css/press-this.css (working copy) |
|---|
| 863 | @@ -91,10 +91,27 @@ |
|---|
| 864 | border-top: none; |
|---|
| 865 | } |
|---|
| 866 | |
|---|
| 867 | -.submit input { |
|---|
| 868 | - |
|---|
| 869 | +.button { |
|---|
| 870 | +font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; |
|---|
| 871 | +padding: 3px 5px; |
|---|
| 872 | +font-size: 12px; |
|---|
| 873 | +line-height: 1.5em; |
|---|
| 874 | +border-width: 1px; |
|---|
| 875 | +border-style: solid; |
|---|
| 876 | +-moz-border-radius: 3px; |
|---|
| 877 | +-khtml-border-radius: 3px; |
|---|
| 878 | +-webkit-border-radius: 3px; |
|---|
| 879 | +border-radius: 3px; |
|---|
| 880 | +cursor: pointer; |
|---|
| 881 | +margin-left: 5px; |
|---|
| 882 | +text-decoration: none; |
|---|
| 883 | } |
|---|
| 884 | |
|---|
| 885 | +.howto { |
|---|
| 886 | +font-size: 11px; |
|---|
| 887 | +} |
|---|
| 888 | +#newtag { padding: 3px; } |
|---|
| 889 | + |
|---|
| 890 | #wphead { |
|---|
| 891 | height: 2em; |
|---|
| 892 | padding-top: 8px; |
|---|
| 893 | @@ -189,7 +206,7 @@ |
|---|
| 894 | div#categories { |
|---|
| 895 | font-size: 85%; |
|---|
| 896 | position: absolute; |
|---|
| 897 | - |
|---|
| 898 | + top: 50px; |
|---|
| 899 | right: 16px; |
|---|
| 900 | width: 27%; |
|---|
| 901 | z-index: 2; |
|---|
| 902 | @@ -269,7 +286,6 @@ |
|---|
| 903 | |
|---|
| 904 | #img_container { |
|---|
| 905 | background-color: #fff; |
|---|
| 906 | - margin-top: 10px; |
|---|
| 907 | overflow: auto; |
|---|
| 908 | height: 100px; |
|---|
| 909 | } |
|---|
| 910 | @@ -283,42 +299,39 @@ |
|---|
| 911 | margin-bottom: 7px; |
|---|
| 912 | cursor: pointer; |
|---|
| 913 | } |
|---|
| 914 | - |
|---|
| 915 | +.submit { |
|---|
| 916 | +-moz-border-radius-bottomleft: 3px; |
|---|
| 917 | +-khtml-border-bottom-left-radius: 3px; |
|---|
| 918 | +-webkit-border-bottom-left-radius: 3px; |
|---|
| 919 | +border-bottom-left-radius: 3px; |
|---|
| 920 | +-moz-border-radius-bottomright: 3px; |
|---|
| 921 | +-khtml-border-bottom-right-radius: 3px; |
|---|
| 922 | +-webkit-border-bottom-right-radius: 3px; |
|---|
| 923 | +border-bottom-right-radius: 3px; |
|---|
| 924 | +margin: 0; |
|---|
| 925 | +padding: 0; |
|---|
| 926 | +} |
|---|
| 927 | .submitbox { |
|---|
| 928 | width: 100%; |
|---|
| 929 | float: right; |
|---|
| 930 | } |
|---|
| 931 | |
|---|
| 932 | -.submitbox .submit { |
|---|
| 933 | - text-align: left; |
|---|
| 934 | - padding: 12px 10px 10px 10px; |
|---|
| 935 | - font-size: 11px; |
|---|
| 936 | -} |
|---|
| 937 | - |
|---|
| 938 | -.submit { |
|---|
| 939 | - border-top: 1px solid #ccc; |
|---|
| 940 | - padding: 1.5em 0 0 0; |
|---|
| 941 | - margin: 10px 0 0 0; |
|---|
| 942 | - -moz-border-radius-bottomleft: 3px; |
|---|
| 943 | - -khtml-border-bottom-left-radius: 3px; |
|---|
| 944 | - -webkit-border-bottom-left-radius: 3px; |
|---|
| 945 | - border-bottom-left-radius: 3px; |
|---|
| 946 | - -moz-border-radius-bottomright: 3px; |
|---|
| 947 | - -khtml-border-bottom-right-radius: 3px; |
|---|
| 948 | - -webkit-border-bottom-right-radius: 3px; |
|---|
| 949 | - border-bottom-right-radius: 3px; |
|---|
| 950 | -} |
|---|
| 951 | - |
|---|
| 952 | .submitbox .submit a:hover { |
|---|
| 953 | border-bottom-width: 1px; |
|---|
| 954 | border-bottom-style: solid; |
|---|
| 955 | } |
|---|
| 956 | |
|---|
| 957 | .submitbox .submit input { |
|---|
| 958 | - margin-bottom: 8px; |
|---|
| 959 | - margin-right: 3px; |
|---|
| 960 | - padding: 6px 4px; |
|---|
| 961 | border: none; |
|---|
| 962 | + text-align: left; |
|---|
| 963 | + padding: 12px 10px 10px 10px; |
|---|
| 964 | + font-size: 12px; |
|---|
| 965 | + margin: 10px; |
|---|
| 966 | + |
|---|
| 967 | + -moz-border-radius: 3px; |
|---|
| 968 | + -khtml-border-radius: 3px; |
|---|
| 969 | + -webkit-border-radius: 3px; |
|---|
| 970 | + border-radius: 3px; |
|---|
| 971 | cursor: pointer; |
|---|
| 972 | } |
|---|
| 973 | |
|---|
| 974 | @@ -337,3 +350,22 @@ |
|---|
| 975 | .hidden { |
|---|
| 976 | display: none; |
|---|
| 977 | } |
|---|
| 978 | + |
|---|
| 979 | +.video_split #extra_fields { |
|---|
| 980 | +width: 27%; |
|---|
| 981 | +height: 300px; |
|---|
| 982 | +float: left; |
|---|
| 983 | +} |
|---|
| 984 | +#embed_code { |
|---|
| 985 | +border: 0; |
|---|
| 986 | +width: 99%; |
|---|
| 987 | +height: 200px; |
|---|
| 988 | +} |
|---|
| 989 | +.video_split .editor_area { |
|---|
| 990 | +width: 70%; |
|---|
| 991 | +float: right; |
|---|
| 992 | +} |
|---|
| 993 | + |
|---|
| 994 | +#jaxtag { |
|---|
| 995 | +clear: both; |
|---|
| 996 | +} |
|---|
| 997 | \ No newline at end of file |
|---|