Changeset 8093 for trunk/wp-admin/press-this.php
- Timestamp:
- 06/15/2008 06:05:01 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/press-this.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/press-this.php
r8071 r8093 77 77 <p class="submit"> 78 78 <input type="submit" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/> 79 <img src="images/loading .gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px;display:none;"/>79 <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/> 80 80 </p> 81 81 </div> … … 155 155 156 156 if($_REQUEST['ajax'] == 'photo_images') { 157 $url = urldecode($url); 158 $url = str_replace(' ', '%20', $url); 159 157 error_log('photo images'); 160 158 function get_images_from_uri($uri) { 161 if(preg_match('/\.(jpg|png|gif)/', $uri)) return "'".$uri."'"; 159 if(preg_match('/\.(jpg|png|gif)/', $uri)) 160 return "'".$uri."'"; 161 162 162 $content = wp_remote_fopen($uri); 163 163 $host = parse_url($uri); 164 164 165 if ( false === $content ) return ''; 165 166 $pattern = '/<img [^>]+src=[\'"]([^\'" >]+?)[\'" >]/is';166 167 $pattern = '/<img ([^>]*)src=(\"|\')(.+?)(\2)([^>\/]*)\/*>/is'; 167 168 preg_match_all($pattern, $content, $matches); 168 if ( empty($matches[1]) ) return ''; 169 169 if ( empty($matches[1]) ) { error_log('empty'); return ''; }; 170 170 $sources = array(); 171 171 172 foreach ($matches[1] as $src) { 173 if ( false !== strpos($src, '&') ) continue; 172 foreach ($matches[3] as $src) { 173 error_log($src); 174 #if ( false !== strpos($src, '&') ) continue; 174 175 if(strpos($src, 'http') === false) { 175 176 if(strpos($src, '../') === false && strpos($src, './') === false) { … … 179 180 } 180 181 } 182 181 183 $sources[] = $src; 182 184 } … … 184 186 } 185 187 186 188 $url = urldecode($url); 189 $url = str_replace(' ', '%20', $url); 187 190 echo 'new Array('.get_images_from_uri($url).')'; 188 191 die; … … 367 370 set_menu('text'); 368 371 set_title('<?php _e('Text') ?>'); 369 set_editor("<?php echo $selection; ?>"); 372 <?php if($selection) { ?> 373 set_editor('<?php echo '<p><a href="'.$url.'">'.$selection.'</a> </p> '; ?>'); 374 <?php } else { ?> 375 set_editor('<?php echo '<p><a href="'.$url.'">'.$title.'</a> </p> '; ?>'); 376 <?php } ?> 370 377 return false; 371 378 break; … … 376 383 set_menu('quote'); 377 384 set_title('<?php _e('Quote') ?>'); 378 set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo ''; ?>'><?php echo ''; ?></a></cite> </p></blockquote>");385 set_editor("<blockquote><p><?php echo $selection; ?> </p><p><cite><a href='<?php echo $url; ?>'><?php echo $title; ?></a></cite> </p></blockquote>"); 379 386 380 387 return false; … … 422 429 <?php if($selection) { ?> 423 430 set_editor("<?php echo $selection; ?>"); 424 <?php } else { ?>425 set_editor('')426 431 <?php } ?> 427 432 jQuery('#extra_fields').show(); 428 jQuery('#extra_fields'). prepend('<h2 id="waiting"><img src="images/loading.gif" alt="" /> Loading...</h2>');433 jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /> Loading...</h2>'); 429 434 jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&u='.attribute_escape($url); ?>'); 430 435 jQuery.ajax({ … … 435 440 dataType : "script", 436 441 success : function() { 437 jQuery('#waiting'). innerHTML('');442 jQuery('#waiting').remove(); 438 443 } 439 444 }); … … 490 495 <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> 491 496 <div class="editor-container"> 492 <textarea name="content" id="content" style="width:100%;" class="mceEditor"> 493 <?php echo $selection; ?> 494 </textarea> 497 <textarea name="content" id="content" style="width:100%;" class="mceEditor"><?php if($selection) { ?><a href='<?php echo $url ?>'><?php echo $selection ?></a><?php } else { ?><a href='<?php echo $url ?>'><?php echo $title; ?></a><?php } ?></textarea> 495 498 </div> 496 499 </div>
Note: See TracChangeset
for help on using the changeset viewer.