| 1 | Index: press-this.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- press-this.php (revision 8548) |
|---|
| 4 | +++ press-this.php (working copy) |
|---|
| 5 | @@ -184,19 +184,21 @@ |
|---|
| 6 | |
|---|
| 7 | $host = parse_url($uri); |
|---|
| 8 | |
|---|
| 9 | - $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif)[^<>\'\"]*)(\2)([^>\/]*)\/*>/is'; |
|---|
| 10 | + $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))[^<>\'\"]*(\2)([^>\/]*)\/*>/is'; |
|---|
| 11 | preg_match_all($pattern, $content, $matches); |
|---|
| 12 | - |
|---|
| 13 | + |
|---|
| 14 | if ( empty($matches[1]) ) return ''; |
|---|
| 15 | |
|---|
| 16 | $sources = array(); |
|---|
| 17 | foreach ($matches[3] as $src) { |
|---|
| 18 | + // if no http in url |
|---|
| 19 | if(strpos($src, 'http') === false) |
|---|
| 20 | - if(strpos($src, '../') === false && strpos($src, './') === false) |
|---|
| 21 | + // if it doesn't have a relative uri |
|---|
| 22 | + if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === true) |
|---|
| 23 | $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); |
|---|
| 24 | else |
|---|
| 25 | - $src = 'http://'.str_replace('//','/', $host['host'].'/'.$host['path'].'/'.$src); |
|---|
| 26 | - |
|---|
| 27 | + $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src); |
|---|
| 28 | + |
|---|
| 29 | $sources[] = clean_url($src); |
|---|
| 30 | } |
|---|
| 31 | return "'" . implode("','", $sources) . "'"; |
|---|
| 32 | @@ -247,12 +249,12 @@ |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | function pick(img, desc) { |
|---|
| 36 | - if (img) { |
|---|
| 37 | - length = jQuery('.photolist input').length; |
|---|
| 38 | + if (img) { |
|---|
| 39 | + if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length; |
|---|
| 40 | if(length == 0) length = 1; |
|---|
| 41 | jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>'); |
|---|
| 42 | jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); |
|---|
| 43 | - append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" /></p>'); |
|---|
| 44 | + append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" class="aligncenter"/></p>'); |
|---|
| 45 | } |
|---|
| 46 | tinyMCE.activeEditor.resizeToContent(); |
|---|
| 47 | return false; |
|---|
| 48 | @@ -267,6 +269,7 @@ |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | jQuery(document).ready(function() { |
|---|
| 52 | + jQuery('#extra_fields').html('<div class="photolist"></div><small id="photo_directions"><?php _e("Click images to select:") ?> <span><a href="#" id="photo_add_url" class="thickbox"><?php _e("Add from URL") ?> +</a></span></small><div class="titlewrap"><div id="img_container"></div></div>'); |
|---|
| 53 | jQuery('#img_container').html(strtoappend); |
|---|
| 54 | jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500'); |
|---|
| 55 | tb_init('a.thickbox, area.thickbox, input.thickbox'); |
|---|
| 56 | @@ -276,13 +279,7 @@ |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | if($_REQUEST['ajax'] == 'photo') { ?> |
|---|
| 60 | - <div class="photolist"></div> |
|---|
| 61 | |
|---|
| 62 | - <small id="photo_directions"><?php _e('Click images to select:') ?> <span><a href="#" id="photo_add_url" class="thickbox"><?php _e('Add from URL') ?> +</a></span></small> |
|---|
| 63 | - |
|---|
| 64 | - <div class="titlewrap"> |
|---|
| 65 | - <div id="img_container"></div> |
|---|
| 66 | - </div> |
|---|
| 67 | <?php die; |
|---|
| 68 | } |
|---|
| 69 | ?> |
|---|
| 70 | @@ -323,6 +320,7 @@ |
|---|
| 71 | editor_selector: "mceEditor", |
|---|
| 72 | language : "<?php echo $language; ?>", |
|---|
| 73 | width: "100%", |
|---|
| 74 | + height: "300", |
|---|
| 75 | theme : "advanced", |
|---|
| 76 | theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,undo,redo,link,unlink", |
|---|
| 77 | theme_advanced_buttons2 : "", |
|---|
| 78 | @@ -446,7 +444,6 @@ |
|---|
| 79 | <?php } ?> |
|---|
| 80 | jQuery('#extra_fields').show(); |
|---|
| 81 | jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /><?php echo js_escape( __( 'Loading...' ) ); ?></h2>'); |
|---|
| 82 | - jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'?ajax=photo&u='.attribute_escape($url); ?>'); |
|---|
| 83 | jQuery.ajax({ |
|---|
| 84 | type: "GET", |
|---|
| 85 | cache : false, |
|---|
| 86 | @@ -473,7 +470,7 @@ |
|---|
| 87 | show('video'); |
|---|
| 88 | <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?> |
|---|
| 89 | show('video'); |
|---|
| 90 | - <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> |
|---|
| 91 | + <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> |
|---|
| 92 | show('photo'); |
|---|
| 93 | <?php } ?> |
|---|
| 94 | }); |
|---|
| 95 | @@ -506,7 +503,7 @@ |
|---|
| 96 | <div class="editor_area"> |
|---|
| 97 | <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> |
|---|
| 98 | <div class="editor-container"> |
|---|
| 99 | - <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</textarea> |
|---|
| 100 | + <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</textarea> |
|---|
| 101 | </div> |
|---|
| 102 | </div> |
|---|
| 103 | </div> |
|---|
| 104 | Index: css/press-this.css |
|---|
| 105 | =================================================================== |
|---|
| 106 | --- css/press-this.css (revision 8548) |
|---|
| 107 | +++ css/press-this.css (working copy) |
|---|
| 108 | @@ -4,6 +4,8 @@ |
|---|
| 109 | margin: 0px; |
|---|
| 110 | padding: 0px; |
|---|
| 111 | } |
|---|
| 112 | + |
|---|
| 113 | +img { border: 0; } |
|---|
| 114 | /* Tabs */ |
|---|
| 115 | @media projection , screen { |
|---|
| 116 | .ui-tabs-hide { |
|---|