WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/24/2017 02:21:42 PM (3 years ago)
Author:
azaozz
Message:

Retire Press This and extract it to a plugin. First run.

Props kraftbj, azaozz.
See #41689.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r41236 r41584  
    28992899
    29002900/**
    2901  * Retrieves the Press This bookmarklet link.
    2902  *
    2903  * @since 2.6.0
    2904  *
    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 for
    2918          * 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 your
    2920          * 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.0
    2950      *
    2951      * @param string $link The Press This bookmarklet link.
    2952      */
    2953     return apply_filters( 'shortcut_link', $link );
    2954 }
    2955 
    2956 /**
    29572901 * Retrieves the URL for the current site where the front end is accessible.
    29582902 *
Note: See TracChangeset for help on using the changeset viewer.