| 1 | Index: wp-admin/press-this.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/press-this.php (revision 8118) |
|---|
| 4 | +++ wp-admin/press-this.php (working copy) |
|---|
| 5 | @@ -79,46 +79,64 @@ |
|---|
| 6 | </head> |
|---|
| 7 | <body class="press-this"> |
|---|
| 8 | <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();">Close Window</a></p></div> |
|---|
| 9 | + |
|---|
| 10 | + <div id="footer"> |
|---|
| 11 | + <p><?php |
|---|
| 12 | + do_action('in_admin_footer', ''); |
|---|
| 13 | + $upgrade = apply_filters( 'update_footer', '' ); |
|---|
| 14 | + echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>'); |
|---|
| 15 | + ?></p> |
|---|
| 16 | + </div> |
|---|
| 17 | + <?php do_action('admin_footer', ''); ?> |
|---|
| 18 | + |
|---|
| 19 | </body> |
|---|
| 20 | </html> |
|---|
| 21 | <?php die; |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | + |
|---|
| 25 | +function aposfix($text) { |
|---|
| 26 | + $translation_table[chr(34)] = '"'; |
|---|
| 27 | + $translation_table[chr(38)] = '&'; |
|---|
| 28 | + $translation_table[chr(39)] = '''; |
|---|
| 29 | + return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($text, $translation_table)); |
|---|
| 30 | +} |
|---|
| 31 | + |
|---|
| 32 | // Ajax Requests |
|---|
| 33 | $title = wp_specialchars(stripslashes($_GET['t'])); |
|---|
| 34 | -$selection = trim(str_replace('\\n', "<br />", wp_specialchars(js_escape($_GET['s'])))); |
|---|
| 35 | + |
|---|
| 36 | +$selection = str_replace("\n", "<br />", aposfix( stripslashes($_GET['s']) ) ); |
|---|
| 37 | $url = clean_url($_GET['u']); |
|---|
| 38 | $image = $_GET['i']; |
|---|
| 39 | + |
|---|
| 40 | if($_REQUEST['ajax'] == 'thickbox') { ?> |
|---|
| 41 | - <script type="text/javascript" charset="utf-8"> |
|---|
| 42 | - jQuery('.cancel').click(function() { |
|---|
| 43 | - tb_remove(); |
|---|
| 44 | - }); |
|---|
| 45 | - |
|---|
| 46 | - function image_selector() { |
|---|
| 47 | - desc = jQuery('#this_photo_description').val(); |
|---|
| 48 | - src = jQuery('#this_photo').val(); |
|---|
| 49 | - pick(src, desc); |
|---|
| 50 | - tb_remove(); |
|---|
| 51 | - return false; |
|---|
| 52 | - } |
|---|
| 53 | - |
|---|
| 54 | - jQuery('.select').click(function() { |
|---|
| 55 | - image_selector(); |
|---|
| 56 | - }); |
|---|
| 57 | - </script> |
|---|
| 58 | <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3> |
|---|
| 59 | <div class="titlewrap"> |
|---|
| 60 | <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/> |
|---|
| 61 | </div> |
|---|
| 62 | |
|---|
| 63 | <p><input type="hidden" name="this_photo" value="<?php echo $image; ?>" id="this_photo" /> |
|---|
| 64 | - <a href="#" class="select" rel="<?php echo $image; ?>"><img src="<?php echo $image; ?>" width="475" alt="Click to insert." title="Click to insert." /></a></p> |
|---|
| 65 | + <a href="#" class="select"><img src="<?php echo $image; ?>" width="475" alt="Click to insert." title="Click to insert." /></a></p> |
|---|
| 66 | |
|---|
| 67 | - <p id="options"><a href="#" class="select" rel="<?php echo $image; ?>">Insert Image</a> | <a href="#" class="cancel">Cancel</a></p> |
|---|
| 68 | + <p id="options"><a href="#" class="select">Insert Image</a> | <a href="#" class="cancel">Cancel</a></p> |
|---|
| 69 | <?php die; |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | +if($_REQUEST['ajax'] == 'thickbox_url') { ?> |
|---|
| 73 | + <h3 id="title"><label for="post_title"><?php _e('URL') ?></label></h3> |
|---|
| 74 | + <div class="titlewrap"> |
|---|
| 75 | + <input id="this_photo" name="this_photo" class="text" onkeypress="if(event.keyCode==13) image_selector();" /> |
|---|
| 76 | + </div> |
|---|
| 77 | + |
|---|
| 78 | + |
|---|
| 79 | + <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3> |
|---|
| 80 | + <div class="titlewrap"> |
|---|
| 81 | + <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/> |
|---|
| 82 | + </div> |
|---|
| 83 | + |
|---|
| 84 | + <p id="options"><a href="#" class="select">Insert Image</a> | <a href="#" class="cancel">Cancel</a></p> |
|---|
| 85 | +<?php die; |
|---|
| 86 | +} |
|---|
| 87 | |
|---|
| 88 | if($_REQUEST['ajax'] == 'video') { ?> |
|---|
| 89 | <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2> |
|---|
| 90 | @@ -130,9 +148,9 @@ |
|---|
| 91 | |
|---|
| 92 | if($_REQUEST['ajax'] == 'photo_images') { |
|---|
| 93 | function get_images_from_uri($uri) { |
|---|
| 94 | - if(preg_match('/\.(jpg|png|gif)/', $uri)) |
|---|
| 95 | + if(preg_match('/\.(jpg|png|gif)/', $uri) && !strpos($uri,'blogger.com')) |
|---|
| 96 | return "'".$uri."'"; |
|---|
| 97 | - |
|---|
| 98 | + |
|---|
| 99 | $content = wp_remote_fopen($uri); |
|---|
| 100 | if ( false === $content ) return ''; |
|---|
| 101 | |
|---|
| 102 | @@ -163,9 +181,33 @@ |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | if($_REQUEST['ajax'] == 'photo_js') { ?> |
|---|
| 106 | - |
|---|
| 107 | - var last = null |
|---|
| 108 | + |
|---|
| 109 | + tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox |
|---|
| 110 | |
|---|
| 111 | + function image_selector() { |
|---|
| 112 | + desc = jQuery('#this_photo_description').val(); |
|---|
| 113 | + src = jQuery('#this_photo').val(); |
|---|
| 114 | + pick(src, desc); |
|---|
| 115 | + tb_remove(); |
|---|
| 116 | + return false; |
|---|
| 117 | + } |
|---|
| 118 | + |
|---|
| 119 | + jQuery(document).ready(function() { |
|---|
| 120 | + jQuery('#this_photo').focus(); |
|---|
| 121 | + |
|---|
| 122 | + jQuery('.cancel').click(function() { |
|---|
| 123 | + tb_remove(); |
|---|
| 124 | + }); |
|---|
| 125 | + |
|---|
| 126 | + jQuery('.select').click(function() { |
|---|
| 127 | + image_selector(); |
|---|
| 128 | + }); |
|---|
| 129 | + |
|---|
| 130 | + jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500'); |
|---|
| 131 | + |
|---|
| 132 | + }); |
|---|
| 133 | + |
|---|
| 134 | + |
|---|
| 135 | function pick(img, desc) { |
|---|
| 136 | if (img) { |
|---|
| 137 | length = jQuery('.photolist input').length; |
|---|
| 138 | @@ -173,11 +215,12 @@ |
|---|
| 139 | jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>'); |
|---|
| 140 | jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); |
|---|
| 141 | append_editor('<img src="' + img +'" alt="' + desc + '" />'); } |
|---|
| 142 | + tinyMCE.activeEditor.resizeToContent(); |
|---|
| 143 | return false; |
|---|
| 144 | } |
|---|
| 145 | |
|---|
| 146 | + var last = null |
|---|
| 147 | var my_src, img, img_tag, aspect, w, h, skip, i, strtoappend = ""; |
|---|
| 148 | - |
|---|
| 149 | var my_src = eval( |
|---|
| 150 | jQuery.ajax({ |
|---|
| 151 | type: "GET", |
|---|
| 152 | @@ -189,13 +232,11 @@ |
|---|
| 153 | }).responseText); |
|---|
| 154 | |
|---|
| 155 | for (i = 0; i < my_src.length; i++) { |
|---|
| 156 | - img = new Image(); |
|---|
| 157 | - img.src = my_src[i]; |
|---|
| 158 | - img_attr = 'id="img' + i; |
|---|
| 159 | - skip = false; |
|---|
| 160 | + img = new Image(); img.src = my_src[i]; img_attr = 'id="img' + i; skip = false; |
|---|
| 161 | |
|---|
| 162 | if (img.width && img.height) { |
|---|
| 163 | - if (img.width * img.height < 2500) skip = true; |
|---|
| 164 | + if (img.width * img.height < 2500) |
|---|
| 165 | + skip = true; |
|---|
| 166 | aspect = img.width / img.height; |
|---|
| 167 | scale = (aspect > 1) ? (75 / img.width) : (75 / img.height); |
|---|
| 168 | |
|---|
| 169 | @@ -212,16 +253,15 @@ |
|---|
| 170 | if (!skip) strtoappend += '<a href="?ajax=thickbox&i=' + img.src + '&u=<?php echo $url; ?>&height=400&width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; |
|---|
| 171 | |
|---|
| 172 | } |
|---|
| 173 | - |
|---|
| 174 | jQuery('#img_container').html(strtoappend); |
|---|
| 175 | |
|---|
| 176 | - tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox |
|---|
| 177 | - |
|---|
| 178 | <?php die; } |
|---|
| 179 | |
|---|
| 180 | if($_REQUEST['ajax'] == 'photo') { ?> |
|---|
| 181 | <div class="photolist"></div> |
|---|
| 182 | - <small><?php _e('Click images to select:') ?></small> |
|---|
| 183 | + |
|---|
| 184 | + <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> |
|---|
| 185 | + |
|---|
| 186 | <div class="titlewrap"> |
|---|
| 187 | <div id="img_container"></div> |
|---|
| 188 | </div> |
|---|
| 189 | @@ -323,43 +363,30 @@ |
|---|
| 190 | if(tinyMCE.activeEditor) tinyMCE.execCommand('mceInsertContent' ,false, text); |
|---|
| 191 | } |
|---|
| 192 | function set_title(title) { jQuery("#content_type").text(title); } |
|---|
| 193 | - function reset_height() { |
|---|
| 194 | - tinyMCE.height = '170px'; |
|---|
| 195 | - } |
|---|
| 196 | + |
|---|
| 197 | function show(tab_name) { |
|---|
| 198 | jQuery('body').removeClass('video_split'); |
|---|
| 199 | jQuery('#extra_fields').hide(); |
|---|
| 200 | switch(tab_name) { |
|---|
| 201 | case 'text' : |
|---|
| 202 | - reset_height(); |
|---|
| 203 | - jQuery('.editor-container').show(); |
|---|
| 204 | - jQuery('#content_type').show(); |
|---|
| 205 | set_menu('text'); |
|---|
| 206 | - set_title('<?php _e('Text') ?>'); |
|---|
| 207 | + set_title('<?php _e('Post') ?>'); |
|---|
| 208 | |
|---|
| 209 | return false; |
|---|
| 210 | break; |
|---|
| 211 | case 'quote' : |
|---|
| 212 | - reset_height(); |
|---|
| 213 | - jQuery('.editor-container').show(); |
|---|
| 214 | - jQuery('#content_type').show(); |
|---|
| 215 | set_menu('quote'); |
|---|
| 216 | set_title('<?php _e('Quote') ?>'); |
|---|
| 217 | - set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?></a></cite> </p></blockquote>"); |
|---|
| 218 | - |
|---|
| 219 | + set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?> </a> </cite> </p></blockquote>"); |
|---|
| 220 | return false; |
|---|
| 221 | break; |
|---|
| 222 | case 'video' : |
|---|
| 223 | - reset_height(); |
|---|
| 224 | - jQuery('.editor-container').show(); |
|---|
| 225 | - jQuery('#content_type').show(); |
|---|
| 226 | + |
|---|
| 227 | set_menu('video'); |
|---|
| 228 | set_title('<?php _e('Caption') ?>'); |
|---|
| 229 | |
|---|
| 230 | jQuery('#extra_fields').show(); |
|---|
| 231 | jQuery('body').addClass('video_split'); |
|---|
| 232 | - |
|---|
| 233 | - |
|---|
| 234 | jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() { |
|---|
| 235 | |
|---|
| 236 | <?php |
|---|
| 237 | @@ -377,16 +404,14 @@ |
|---|
| 238 | $content = $selection; |
|---|
| 239 | } ?> |
|---|
| 240 | jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>'); |
|---|
| 241 | + |
|---|
| 242 | set_editor("<?php echo $title; ?>"); |
|---|
| 243 | - |
|---|
| 244 | }); |
|---|
| 245 | - |
|---|
| 246 | |
|---|
| 247 | return false; |
|---|
| 248 | break; |
|---|
| 249 | |
|---|
| 250 | case 'photo' : |
|---|
| 251 | - reset_height(); |
|---|
| 252 | set_menu('photo'); |
|---|
| 253 | set_title('Post'); |
|---|
| 254 | <?php if($selection) { ?> |
|---|
| 255 | Index: wp-admin/css/press-this.css |
|---|
| 256 | =================================================================== |
|---|
| 257 | --- wp-admin/css/press-this.css (revision 8118) |
|---|
| 258 | +++ wp-admin/css/press-this.css (working copy) |
|---|
| 259 | @@ -449,12 +449,57 @@ |
|---|
| 260 | text-decoration: none; |
|---|
| 261 | padding-bottom: 2px; |
|---|
| 262 | } |
|---|
| 263 | + |
|---|
| 264 | +#photo_directions { |
|---|
| 265 | +margin-top: .25em; |
|---|
| 266 | +display: block; |
|---|
| 267 | +position: relative; |
|---|
| 268 | +} |
|---|
| 269 | +#photo_directions span { |
|---|
| 270 | +display: block; |
|---|
| 271 | +position: absolute; |
|---|
| 272 | +top: 0; |
|---|
| 273 | +right: 3px; |
|---|
| 274 | +} |
|---|
| 275 | #photo_saving { |
|---|
| 276 | margin-bottom: 8px; |
|---|
| 277 | +<<<<<<< .mine |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | #post_status { |
|---|
| 281 | margin-left: 10px; |
|---|
| 282 | margin-bottom: 1em; |
|---|
| 283 | display: block; |
|---|
| 284 | +} |
|---|
| 285 | + |
|---|
| 286 | +#footer { |
|---|
| 287 | + height: 65px; |
|---|
| 288 | + display: block; |
|---|
| 289 | + width: 640px; |
|---|
| 290 | + padding: 10px 0 0 60px; |
|---|
| 291 | + margin: 0; |
|---|
| 292 | + position: absolute; |
|---|
| 293 | + bottom: 0; |
|---|
| 294 | + font-size: 12px; |
|---|
| 295 | +} |
|---|
| 296 | + |
|---|
| 297 | +#footer p { |
|---|
| 298 | + margin: 0; |
|---|
| 299 | + padding: 7px 0; |
|---|
| 300 | +} |
|---|
| 301 | + |
|---|
| 302 | +#footer p a { |
|---|
| 303 | + text-decoration: none; |
|---|
| 304 | +} |
|---|
| 305 | + |
|---|
| 306 | +#footer p a:hover { |
|---|
| 307 | + text-decoration: underline; |
|---|
| 308 | +======= |
|---|
| 309 | +} |
|---|
| 310 | + |
|---|
| 311 | +#post_status { |
|---|
| 312 | +margin-left: 10px; |
|---|
| 313 | +margin-bottom: 1em; |
|---|
| 314 | +display: block; |
|---|
| 315 | +>>>>>>> .r8118 |
|---|
| 316 | } |
|---|
| 317 | \ No newline at end of file |
|---|