Changeset 31534 for trunk/src/wp-includes/link-template.php
- Timestamp:
- 02/25/2015 01:49:26 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r31480 r31534 2595 2595 */ 2596 2596 function get_shortcut_link() { 2597 // In case of breaking changes, version this. #WP20071 2598 $link = "javascript: 2599 var d=document, 2600 w=window, 2601 e=w.getSelection, 2602 k=d.getSelection, 2603 x=d.selection, 2604 s=(e?e():(k)?k():(x?x.createRange().text:0)), 2605 f='" . admin_url('press-this.php') . "', 2606 l=d.location, 2607 e=encodeURIComponent, 2608 u=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=4'; 2609 a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570'))l.href=u;}; 2610 if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a(); 2611 void(0)"; 2612 2613 $link = str_replace(array("\r", "\n", "\t"), '', $link); 2597 global $is_IE, $wp_version; 2598 2599 $bookmarklet_version = 5; 2600 $link = ''; 2601 2602 if ( $is_IE ) { 2603 /** 2604 * Return the old/shorter bookmarklet code for MSIE 8 and lower, 2605 * since they only support a max length of ~2000 characters for 2606 * bookmark[let] URLs, which is way to small for our smarter one. 2607 * Do update the version number so users do not get the "upgrade your 2608 * bookmarklet" notice when using PT in those browsers. 2609 */ 2610 $ua = $_SERVER['HTTP_USER_AGENT']; 2611 2612 if ( ! empty( $ua ) && preg_match( '/\bMSIE (\d)/', $ua, $matches ) && (int) $matches[1] <= 8 ) { 2613 $link = "javascript: 2614 var d=document, 2615 w=window, 2616 e=w.getSelection, 2617 k=d.getSelection, 2618 x=d.selection, 2619 s=(e?e():(k)?k():(x?x.createRange().text:0)), 2620 f='" . admin_url('press-this.php') . "', 2621 l=d.location, 2622 e=encodeURIComponent, 2623 u=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=" . $bookmarklet_version . "'; 2624 a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700'))l.href=u;}; 2625 if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a(); 2626 void(0)"; 2627 } 2628 } 2629 2630 if ( empty( $link ) ) { 2631 $suffix = '.min'; 2632 $develop_src = false !== strpos( $wp_version, '-src' ); 2633 2634 if ( $develop_src || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) { 2635 $suffix = ''; 2636 } 2637 2638 $url = admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version; 2639 2640 $link = 'javascript:' . file_get_contents( ABSPATH . "wp-admin/js/bookmarklet$suffix.js" ); 2641 $link = str_replace( 'window.pt_url', wp_json_encode( $url ), $link ); 2642 } 2643 2644 $link = str_replace( array( "\r", "\n", "\t" ), '', $link ); 2614 2645 2615 2646 /**
Note: See TracChangeset
for help on using the changeset viewer.