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-admin/tools.php

    r38722 r41584  
    1212$title = __('Tools');
    1313
    14 get_current_screen()->add_help_tab( array(
    15     'id'      => 'press-this',
    16     'title'   => __('Press This'),
    17     'content' => '<p>' . __('Press This is a bookmarklet that makes it easy to blog about something you come across on the web. You can use it to just grab a link, or to post an excerpt. Press This will even allow you to choose from images included on the page and use them in your post. Just drag the Press This link on this screen to your bookmarks bar in your browser, and you&#8217;ll be on your way to easier content creation. Clicking on it while on another website opens a popup window with all these options.') . '</p>',
    18 ) );
    1914get_current_screen()->add_help_tab( array(
    2015    'id'      => 'converter',
     
    3530<div class="wrap">
    3631<h1><?php echo esc_html( $title ); ?></h1>
    37 
    38 <?php if ( current_user_can('edit_posts') ) : ?>
    39 <div class="card pressthis">
    40     <h2><?php _e('Press This') ?></h2>
    41     <p><?php _e( 'Press This is a little tool that lets you grab bits of the web and create new posts with ease.' );?></p>
    42     <p><?php _e( 'Use Press This to clip text, images and videos from any web page. Then edit and add more straight from Press This before you save or publish it in a post on your site.' ); ?></p>
    43 
    44 
    45     <form>
    46         <h3><?php _e( 'Install Press This' ); ?></h3>
    47         <h4><?php _e( 'Bookmarklet' ); ?></h4>
    48         <p><?php _e( 'Drag the bookmarklet below to your bookmarks bar. Then, when you&#8217;re on a page you want to share, simply &#8220;press&#8221; it.' ); ?></p>
    49 
    50         <p class="pressthis-bookmarklet-wrapper">
    51             <a class="pressthis-bookmarklet" onclick="return false;" href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>"><span><?php _e( 'Press This' ); ?></span></a>
    52             <button type="button" class="button pressthis-js-toggle js-show-pressthis-code-wrap" aria-expanded="false" aria-controls="pressthis-code-wrap">
    53                 <span class="dashicons dashicons-clipboard"></span>
    54                 <span class="screen-reader-text"><?php _e( 'Copy &#8220;Press This&#8221; bookmarklet code' ) ?></span>
    55             </button>
    56         </p>
    57 
    58         <div class="hidden js-pressthis-code-wrap clear" id="pressthis-code-wrap">
    59             <p id="pressthis-code-desc">
    60                 <?php _e( 'If you can&#8217;t drag the bookmarklet to your bookmarks, copy the following code and create a new bookmark. Paste the code into the new bookmark&#8217;s URL field.' ) ?>
    61             </p>
    62             <p>
    63                 <textarea class="js-pressthis-code" rows="5" cols="120" readonly="readonly" aria-labelledby="pressthis-code-desc"><?php echo htmlspecialchars( get_shortcut_link() ); ?></textarea>
    64             </p>
    65         </div>
    66 
    67         <h4><?php _e( 'Direct link (best for mobile)' ); ?></h4>
    68         <p><?php _e( 'Follow the link to open Press This. Then add it to your device&#8217;s bookmarks or home screen.' ); ?></p>
    69 
    70         <p>
    71             <a class="button" href="<?php echo htmlspecialchars( admin_url( 'press-this.php' ) ); ?>"><?php _e( 'Open Press This' ) ?></a>
    72         </p>
    73         <script>
    74             jQuery( document ).ready( function( $ ) {
    75                 var $showPressThisWrap = $( '.js-show-pressthis-code-wrap' );
    76                 var $pressthisCode = $( '.js-pressthis-code' );
    77 
    78                 $showPressThisWrap.on( 'click', function( event ) {
    79                     var $this = $( this );
    80 
    81                     $this.parent().next( '.js-pressthis-code-wrap' ).slideToggle( 200 );
    82                     $this.attr( 'aria-expanded', $this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
    83                 });
    84 
    85                 // Select Press This code when focusing (tabbing) or clicking the textarea.
    86                 $pressthisCode.on( 'click focus', function() {
    87                     var self = this;
    88                     setTimeout( function() { self.select(); }, 50 );
    89                 });
    90 
    91             });
    92         </script>
    93     </form>
    94 </div>
    9532<?php
    96 endif;
    97 
    9833if ( current_user_can( 'import' ) ) :
    9934$cats = get_taxonomy('category');
Note: See TracChangeset for help on using the changeset viewer.