Changeset 41584 for trunk/src/wp-includes/link-template.php
- Timestamp:
- 09/24/2017 02:21:42 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r41236 r41584 2899 2899 2900 2900 /** 2901 * Retrieves the Press This bookmarklet link.2902 *2903 * @since 2.6.02904 *2905 * @global bool $is_IE Whether the browser matches an Internet Explorer user agent.2906 */2907 function get_shortcut_link() {2908 global $is_IE;2909 2910 include_once( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );2911 2912 $link = '';2913 2914 if ( $is_IE ) {2915 /*2916 * Return the old/shorter bookmarklet code for MSIE 8 and lower,2917 * since they only support a max length of ~2000 characters for2918 * bookmark[let] URLs, which is way to small for our smarter one.2919 * Do update the version number so users do not get the "upgrade your2920 * bookmarklet" notice when using PT in those browsers.2921 */2922 $ua = $_SERVER['HTTP_USER_AGENT'];2923 2924 if ( ! empty( $ua ) && preg_match( '/\bMSIE (\d)/', $ua, $matches ) && (int) $matches[1] <= 8 ) {2925 $url = wp_json_encode( admin_url( 'press-this.php' ) );2926 2927 $link = 'javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,' .2928 's=(e?e():(k)?k():(x?x.createRange().text:0)),f=' . $url . ',l=d.location,e=encodeURIComponent,' .2929 'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v=' . WP_Press_This::VERSION . '";' .2930 'a=function(){if(!w.open(u,"t","toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700"))l.href=u;};' .2931 'if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();void(0)';2932 }2933 }2934 2935 if ( empty( $link ) ) {2936 $src = @file_get_contents( ABSPATH . 'wp-admin/js/bookmarklet.min.js' );2937 2938 if ( $src ) {2939 $url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . WP_Press_This::VERSION );2940 $link = 'javascript:' . str_replace( 'window.pt_url', $url, $src );2941 }2942 }2943 2944 $link = str_replace( array( "\r", "\n", "\t" ), '', $link );2945 2946 /**2947 * Filters the Press This bookmarklet link.2948 *2949 * @since 2.6.02950 *2951 * @param string $link The Press This bookmarklet link.2952 */2953 return apply_filters( 'shortcut_link', $link );2954 }2955 2956 /**2957 2901 * Retrieves the URL for the current site where the front end is accessible. 2958 2902 *
Note: See TracChangeset
for help on using the changeset viewer.