Changeset 41584
- Timestamp:
- 09/24/2017 02:21:42 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Gruntfile.js
r41570 r41584 494 494 495 495 // Exceptions 496 '!wp-admin/js/bookmarklet.*', // Minified and updated in /src with the precommit task. See uglify:bookmarklet.497 496 '!wp-admin/js/custom-header.js', // Why? We should minify this. 498 497 '!wp-admin/js/farbtastic.js', … … 540 539 ext: '.min.js', 541 540 src: ['wp-includes/js/jquery/ui/*.js'] 542 },543 bookmarklet: {544 options: {545 compress: {546 negate_iife: false547 }548 },549 src: SOURCE_DIR + 'wp-admin/js/bookmarklet.js',550 dest: SOURCE_DIR + 'wp-admin/js/bookmarklet.min.js'551 541 }, 552 542 masonry: { … … 824 814 'browserify', 825 815 'jshint:corejs', 826 'uglify:bookmarklet',827 816 'uglify:masonry', 828 817 'qunit:compiled' -
trunk/src/wp-admin/admin-ajax.php
r41120 r41584 62 62 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', 63 63 'save-user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail', 64 'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin', ' press-this-save-post',65 ' press-this-add-category', 'crop-image', 'generate-password', 'save-wporg-username', 'delete-plugin',66 'search- plugins', 'search-install-plugins', 'activate-plugin', 'update-theme', 'delete-theme',67 ' install-theme', 'get-post-thumbnail-html', 'get-community-events',64 'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin', 'crop-image', 65 'generate-password', 'save-wporg-username', 'delete-plugin', 'search-plugins', 66 'search-install-plugins', 'activate-plugin', 'update-theme', 'delete-theme', 'install-theme', 67 'get-post-thumbnail-html', 'get-community-events', 68 68 ); 69 69 70 70 // Deprecated 71 $core_actions_post[] = 'wp-fullscreen-save-post'; 71 $core_actions_post_deprecated = array( 'wp-fullscreen-save-post', 'press-this-save-post', 'press-this-add-category' ); 72 $core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated ); 72 73 73 74 // Register core Ajax calls. -
trunk/src/wp-admin/includes/ajax-actions.php
r41563 r41584 3190 3190 3191 3191 /** 3192 * Ajax handler for saving a post from Press This.3193 *3194 * @since 4.2.03195 */3196 function wp_ajax_press_this_save_post() {3197 include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );3198 $wp_press_this = new WP_Press_This();3199 $wp_press_this->save_post();3200 }3201 3202 /**3203 * Ajax handler for creating new category from Press This.3204 *3205 * @since 4.2.03206 */3207 function wp_ajax_press_this_add_category() {3208 include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );3209 $wp_press_this = new WP_Press_This();3210 $wp_press_this->add_category();3211 }3212 3213 /**3214 3192 * Ajax handler for cropping an image. 3215 3193 * -
trunk/src/wp-admin/includes/class-plugin-installer-skin.php
r41290 r41584 50 50 $from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins'; 51 51 52 if ( 'import' == $from ) 52 if ( 'import' == $from ) { 53 53 $install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin & Run Importer' ) . '</a>'; 54 else 54 } else if ( 'press-this' == $from ) { 55 $install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&from=press-this&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin & Return to Press This' ) . '</a>'; 56 } else { 55 57 $install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>'; 58 } 56 59 57 60 if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { -
trunk/src/wp-admin/includes/update-core.php
r41571 r41584 720 720 'wp-includes/js/swfupload/plugins', 721 721 'wp-includes/js/swfupload/swfupload.swf', 722 'wp-admin/css/press-this-editor.css', 723 'wp-admin/css/press-this-editor-rtl.css', 724 'wp-admin/css/press-this-editor-rtl.min.css', 725 'wp-admin/css/press-this-editor.min.css', 726 'wp-admin/css/press-this.css', 727 'wp-admin/css/press-this-rtl.css', 728 'wp-admin/css/press-this-rtl.min.css', 729 'wp-admin/css/press-this.min.css', 730 'wp-admin/includes/class-wp-press-this.php', 731 'wp-admin/js/press-this.js', 732 'wp-admin/js/press-this.min.js', 733 'wp-admin/js/bookmarklet.js', 734 'wp-admin/js/bookmarklet.min.js', 722 735 ); 723 736 … … 852 865 /* 853 866 * Import $wp_version, $required_php_version, and $required_mysql_version from the new version. 854 * DO NOT globalise any variables imported from `version-current.php` in this function. 867 * DO NOT globalise any variables imported from `version-current.php` in this function. 855 868 * 856 869 * BC Note: $wp_filesystem->wp_content_dir() returned unslashed pre-2.8 -
trunk/src/wp-admin/plugins.php
r41399 r41584 64 64 if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { 65 65 wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix 66 } else if ( isset($_GET['from']) && 'press-this' == $_GET['from'] ) { 67 wp_redirect( self_admin_url( "press-this.php") ); 66 68 } else { 67 69 wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above -
trunk/src/wp-admin/press-this.php
r38470 r41584 7 7 */ 8 8 9 define( 'IFRAME_REQUEST' , true);9 define( 'IFRAME_REQUEST' , true ); 10 10 11 11 /** WordPress Administration Bootstrap */ 12 12 require_once( dirname( __FILE__ ) . '/admin.php' ); 13 13 14 if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { 15 wp_die( 16 '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . 17 '<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>', 18 403 19 ); 14 function wp_load_press_this() { 15 $plugin_slug = 'press-this'; 16 $plugin_file = 'press-this/press-this-plugin.php'; 17 18 if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { 19 wp_die( 20 __( 'Sorry, you are not allowed to create posts as this user.' ), 21 __( 'Cheatin’ uh?' ), 22 403 23 ); 24 } elseif ( is_plugin_active( $plugin_file ) ) { 25 include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); 26 $wp_press_this = new WP_Press_This_Plugin(); 27 $wp_press_this->html(); 28 } elseif ( current_user_can( 'activate_plugins' ) ) { 29 if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_file ) ) { 30 $url = wp_nonce_url( add_query_arg( array( 31 'action' => 'activate', 32 'plugin' => $plugin_file, 33 'from' => 'press-this', 34 ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file ); 35 $action = sprintf( 36 '<a href="%1$s" aria-label="%2$s">%2$s</a>', 37 esc_url( $url ), 38 __( 'Activate Press This' ) 39 ); 40 } else { 41 if ( is_main_site() ) { 42 $url = wp_nonce_url( add_query_arg( array( 43 'action' => 'install-plugin', 44 'plugin' => $plugin_slug, 45 'from' => 'press-this', 46 ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug ); 47 $action = sprintf( 48 '<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%2$s" aria-label="%3$s">%3$s</a>', 49 esc_url( $url ), 50 esc_attr( $plugin_slug ), 51 __( 'Install Now' ) 52 ); 53 } else { 54 $action = sprintf( 55 /* translators: URL to wp-admin/press-this.php */ 56 __( 'Press This is not installed. Please install Press This from <a href="%s">the main site</a>.' ), 57 get_admin_url( get_current_network_id(), 'press-this.php' ) 58 ); 59 } 60 } 61 wp_die( 62 __( 'The Press This plugin is required.' ) . '<br />' . $action, 63 __( 'Install Required' ), 64 200 65 ); 66 } else { 67 wp_die( 68 __( 'Press This is not available. Please contact your site administrator.' ), 69 __( 'Install Required' ), 70 200 71 ); 72 } 20 73 } 21 74 22 include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' ); 23 $wp_press_this = new WP_Press_This(); 24 $wp_press_this->html(); 75 wp_load_press_this(); -
trunk/src/wp-admin/tools.php
r38722 r41584 12 12 $title = __('Tools'); 13 13 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’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 ) );19 14 get_current_screen()->add_help_tab( array( 20 15 'id' => 'converter', … … 35 30 <div class="wrap"> 36 31 <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’re on a page you want to share, simply “press” 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 “Press This” 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’t drag the bookmarklet to your bookmarks, copy the following code and create a new bookmark. Paste the code into the new bookmark’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’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>95 32 <?php 96 endif;97 98 33 if ( current_user_can( 'import' ) ) : 99 34 $cats = get_taxonomy('category'); -
trunk/src/wp-includes/deprecated.php
r41289 r41584 3888 3888 return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); 3889 3889 } 3890 3891 /** 3892 * Retrieves the Press This bookmarklet link. 3893 * 3894 * @since 2.6.0 3895 * @deprecated 4.9.0 3896 * 3897 */ 3898 function get_shortcut_link() { 3899 _deprecated_function( __FUNCTION__, '4.9.0' ); 3900 3901 $link = ''; 3902 3903 /** 3904 * Filters the Press This bookmarklet link. 3905 * 3906 * @since 2.6.0 3907 * @deprecated 4.9.0 3908 * 3909 * @param string $link The Press This bookmarklet link. 3910 */ 3911 return apply_filters( 'shortcut_link', $link ); 3912 } 3913 3914 /** 3915 * Ajax handler for saving a post from Press This. 3916 * 3917 * @since 4.2.0 3918 * @deprecated 4.9.0 3919 */ 3920 function wp_ajax_press_this_save_post() { 3921 _deprecated_function( __FUNCTION__, '4.9.0' ); 3922 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { 3923 include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); 3924 $wp_press_this = new WP_Press_This_Plugin(); 3925 $wp_press_this->save_post(); 3926 } else { 3927 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); 3928 } 3929 } 3930 3931 /** 3932 * Ajax handler for creating new category from Press This. 3933 * 3934 * @since 4.2.0 3935 * @deprecated 4.9.0 3936 */ 3937 function wp_ajax_press_this_add_category() { 3938 _deprecated_function( __FUNCTION__, '4.9.0' ); 3939 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { 3940 include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); 3941 $wp_press_this = new WP_Press_This_Plugin(); 3942 $wp_press_this->add_category(); 3943 } else { 3944 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); 3945 } 3946 } -
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 * -
trunk/src/wp-includes/script-loader.php
r41572 r41584 674 674 ) ); 675 675 676 $scripts->add( 'press-this', "/wp-admin/js/press-this$suffix.js", array( 'jquery', 'tags-box', 'wp-sanitize' ), false, 1 );677 did_action( 'init' ) && $scripts->localize( 'press-this', 'pressThisL10n', array(678 'newPost' => __( 'Title' ),679 'serverError' => __( 'Connection lost or the server is busy. Please try again later.' ),680 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),681 /* translators: %d: nth embed found in a post */682 'suggestedEmbedAlt' => __( 'Suggested embed #%d' ),683 /* translators: %d: nth image found in a post */684 'suggestedImgAlt' => __( 'Suggested image #%d' ),685 ) );686 687 676 $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 ); 688 677 … … 964 953 $styles->add( 'customize-widgets', "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) ); 965 954 $styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) ); 966 $styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array( 'buttons' ) );967 955 968 956 $styles->add( 'ie', "/wp-admin/css/ie$suffix.css" ); … … 1003 991 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 1004 992 'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'customize-preview', 1005 'ie', 'login', 'press-this',993 'ie', 'login', 1006 994 // wp-includes 1007 995 'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
Note: See TracChangeset
for help on using the changeset viewer.