Ticket #35191: 35191.10.diff
File 35191.10.diff, 12.6 KB (added by , 8 years ago) |
---|
-
src/wp-admin/css/common.css
2277 2277 2278 2278 .importers td { 2279 2279 padding-right: 14px; 2280 line-height: 1.5em; 2280 2281 } 2281 2282 2282 2283 .importers { … … 2284 2285 width: auto; 2285 2286 } 2286 2287 2288 .importer-title, 2289 .importer-desc, 2290 .importer-action { 2291 display: block; 2292 } 2293 2294 .importer-title { 2295 color: #000; 2296 font-size: 14px; 2297 font-weight: 400; 2298 margin-bottom: .2em; 2299 } 2300 2301 .importer-action { 2302 margin-bottom: 1em; 2303 color: #ddd; 2304 } 2305 2287 2306 #post-body #post-body-content #namediv h3, /* Back-compat for pre-4.4 */ 2288 2307 #post-body #post-body-content #namediv h2 { 2289 2308 margin-top: 0; -
src/wp-admin/import.php
30 30 '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 31 31 ); 32 32 33 if ( current_user_can( 'install_plugins' ) ) 33 if ( current_user_can( 'install_plugins' ) ) { 34 // List of popular importer plugins from the WordPress.org API. 34 35 $popular_importers = wp_get_popular_importers(); 35 else 36 $popular_importers = array(); 36 } else { 37 $popular_importers = array(); 38 } 37 39 38 40 // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' 39 41 if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { … … 66 68 <p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p> 67 69 68 70 <?php 69 71 // Registered (already installed) importers. They're stored in the global $wp_importers. 70 72 $importers = get_importers(); 71 73 72 74 // If a popular importer is not registered, create a dummy registration that links to the plugin installer. … … 75 77 continue; 76 78 if ( isset( $importers[ $pop_data['importer-id'] ] ) ) 77 79 continue; 80 81 // Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API. 78 82 $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); 79 83 } 80 84 … … 87 91 88 92 <?php 89 93 foreach ($importers as $importer_id => $data) { 90 $action = ''; 94 $plugin_slug = $action = ''; 95 $plugin_installed = false; 96 91 97 if ( isset( $data['install'] ) ) { 92 98 $plugin_slug = $data['install']; 99 93 100 if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { 94 // Looks like Importer is installed, But not active101 // Looks like an importer is installed, but not active. 95 102 $plugins = get_plugins( '/' . $plugin_slug ); 96 103 if ( !empty($plugins) ) { 97 104 $keys = array_keys($plugins); 98 105 $plugin_file = $plugin_slug . '/' . $keys[0]; 99 $action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) . 100 '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>'; 106 $url = esc_url( wp_nonce_url( add_query_arg( array( 107 'action' => 'activate', 108 'plugin' => $plugin_file, 109 'from' => 'import', 110 ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file ) ); 111 $action = sprintf( '<a href="%1$s">%2$s</a>', $url, __( 'Run Importer' ) ); 112 $plugin_installed = true; 101 113 } 102 114 } 115 103 116 if ( empty($action) ) { 104 117 if ( is_main_site() ) { 105 $action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . 106 '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal" title="' . 107 esc_attr__('Install importer') . '">' . $data[0] . '</a>'; 118 $url = esc_url( wp_nonce_url( add_query_arg( array( 119 'action' => 'install-plugin', 120 'plugin' => $plugin_slug, 121 'from' => 'import', 122 ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug ) ); 123 $action = sprintf( 124 '<a href="%1$s" class="install-now" data-slug="%2$s">%3$s</a>', 125 $url, 126 esc_attr( $plugin_slug ), 127 __( 'Install Now' ) 128 ); 108 129 } else { 109 $action = $data[0]; 110 $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) ); 130 $action = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), 131 get_admin_url( get_current_network_id(), 'import.php' ) 132 ); 111 133 } 112 134 } 113 135 } else { 114 $action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>"; 136 $plugin_installed = true; 137 $url = esc_url( add_query_arg( array( 138 'import' => $importer_id, 139 ), self_admin_url( 'admin.php' ) ) ); 140 $action = sprintf( '<a href="%1$s">%2$s</a>', $url, __( 'Run Importer' ) ); 115 141 } 116 142 143 if ( ! $plugin_installed ) { 144 $url = esc_url( add_query_arg( array( 145 'tab' => 'plugin-information', 146 'plugin' => $plugin_slug, 147 'from' => 'import', 148 'TB_iframe' => 'true', 149 'width' => 600, 150 'height' => 550, 151 ), network_admin_url( 'plugin-install.php' ) ) ); 152 $action .= sprintf( ' | <a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>', $url, __( 'Details' ) ); 153 } 154 117 155 echo " 118 <tr> 119 <td class='import-system row-title'>$action</td> 120 <td class='desc'>{$data[1]}</td> 156 <tr class='importer-item'> 157 <td class='import-system'> 158 <span class='importer-title'>{$data[0]}</span> 159 <span class='importer-action'>{$action}</span> 160 </td> 161 <td class='desc'> 162 <span class='importer-desc'>{$data[1]}</span> 163 </td> 121 164 </tr>"; 122 165 } 123 166 ?> -
src/wp-admin/includes/import.php
157 157 // slug => name, description, plugin slug, and register_importer() slug 158 158 'blogger' => array( 159 159 'name' => __( 'Blogger' ), 160 'description' => __( 'I nstall the Blogger importer to import posts, comments, and users from a Blogger blog.' ),160 'description' => __( 'Import posts, comments, and users from a Blogger blog.' ), 161 161 'plugin-slug' => 'blogger-importer', 162 162 'importer-id' => 'blogger', 163 163 ), 164 164 'wpcat2tag' => array( 165 165 'name' => __( 'Categories and Tags Converter' ), 166 'description' => __( ' Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.' ),166 'description' => __( 'Convert existing categories to tags or tags to categories, selectively.' ), 167 167 'plugin-slug' => 'wpcat2tag-importer', 168 168 'importer-id' => 'wp-cat2tag', 169 169 ), 170 170 'livejournal' => array( 171 171 'name' => __( 'LiveJournal' ), 172 'description' => __( 'I nstall the LiveJournal importer to import posts from LiveJournal using their API.' ),172 'description' => __( 'Import posts from LiveJournal using their API.' ), 173 173 'plugin-slug' => 'livejournal-importer', 174 174 'importer-id' => 'livejournal', 175 175 ), 176 176 'movabletype' => array( 177 177 'name' => __( 'Movable Type and TypePad' ), 178 'description' => __( 'I nstall the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.' ),178 'description' => __( 'Import posts and comments from a Movable Type or TypePad blog.' ), 179 179 'plugin-slug' => 'movabletype-importer', 180 180 'importer-id' => 'mt', 181 181 ), 182 182 'opml' => array( 183 183 'name' => __( 'Blogroll' ), 184 'description' => __( 'I nstall the blogroll importer to import links in OPML format.' ),184 'description' => __( 'Import links in OPML format.' ), 185 185 'plugin-slug' => 'opml-importer', 186 186 'importer-id' => 'opml', 187 187 ), 188 188 'rss' => array( 189 189 'name' => __( 'RSS' ), 190 'description' => __( 'I nstall the RSS importer to import posts from an RSS feed.' ),190 'description' => __( 'Import posts from an RSS feed.' ), 191 191 'plugin-slug' => 'rss-importer', 192 192 'importer-id' => 'rss', 193 193 ), 194 194 'tumblr' => array( 195 195 'name' => __( 'Tumblr' ), 196 'description' => __( 'I nstall the Tumblr importer to import posts & media from Tumblr using their API.' ),196 'description' => __( 'Import posts & media from Tumblr using their API.' ), 197 197 'plugin-slug' => 'tumblr-importer', 198 198 'importer-id' => 'tumblr', 199 199 ), 200 200 'wordpress' => array( 201 201 'name' => 'WordPress', 202 'description' => __( 'I nstall the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ),202 'description' => __( 'Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ), 203 203 'plugin-slug' => 'wordpress-importer', 204 204 'importer-id' => 'wordpress', 205 205 ), -
src/wp-admin/js/updates.js
503 503 }, args ); 504 504 505 505 if ( 'import' === pagenow ) { 506 $message = $( ' a[href*="' + args.slug + '"]' );506 $message = $( '[data-slug="' + args.slug + '"]' ); 507 507 } else { 508 508 $message.text( wp.updates.l10n.installing ); 509 509 } … … 621 621 message: wp.updates.l10n.importerInstalledMsg.replace( '%s', response.activateUrl + '&from=import' ) 622 622 } ); 623 623 624 $( ' a[href*="' + response.slug + '"]' )625 .removeClass( ' thickbox open-plugin-details-modalupdating-message' )626 . off( 'click' )624 $( '[data-slug="' + response.slug + '"]' ) 625 .removeClass( 'install-now updating-message' ) 626 .addClass( 'activate-now' ) 627 627 .attr( 'href', response.activateUrl + '&from=import' ) 628 . attr( 'title',wp.updates.l10n.activateImporter );628 .text( wp.updates.l10n.activateImporter ); 629 629 630 630 wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' ); 631 631 … … 661 661 message: errorMessage 662 662 } ); 663 663 664 $( ' a[href*="' + response.slug + '"]' ).removeClass( 'updating-message' );664 $( '[data-slug="' + response.slug + '"]' ).removeClass( 'updating-message' ); 665 665 666 666 wp.a11y.speak( errorMessage, 'assertive' ); 667 667 … … 1758 1758 } ); 1759 1759 1760 1760 /** 1761 * Click handler for plugin installs in plugin install view. 1762 * 1763 * @since 4.6.0 1764 * 1765 * @param {Event} event Event interface. 1766 */ 1767 $document.on( 'click', '.importer-item .install-now', function( event ) { 1768 var $button = $( event.target ); 1769 event.preventDefault(); 1770 1771 if ( $button.hasClass( 'updating-message' ) ) { 1772 return; 1773 } 1774 1775 if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) { 1776 wp.updates.requestFilesystemCredentials( event ); 1777 1778 $document.on( 'credential-modal-cancel', function() { 1779 var $message = $( '.install-now.updating-message' ); 1780 1781 $message 1782 .removeClass( 'updating-message' ) 1783 .text( wp.updates.l10n.installNow ); 1784 1785 wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' ); 1786 } ); 1787 } 1788 1789 wp.updates.installPlugin( { 1790 slug: $button.data( 'slug' ), 1791 success: wp.updates.installImporterSuccess, 1792 error: wp.updates.installImporterError 1793 } ); 1794 } ); 1795 1796 /** 1761 1797 * Click handler for plugin deletions. 1762 1798 * 1763 1799 * @since 4.6.0 -
src/wp-includes/script-loader.php
651 651 'livePreview' => __( 'Live Preview' ), 652 652 'activatePlugin' => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ), 653 653 'activateTheme' => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ), 654 'activateImporter' => __( ' Activate importer' ),654 'activateImporter' => __( 'Run Importer' ), 655 655 'unknownError' => __( 'An unknown error occured' ), 656 656 'pluginsFound' => __( 'Number of plugins found: %d' ), 657 657 'noPluginsFound' => __( 'No plugins found. Try a different search.' ), -
tests/qunit/fixtures/updates.js
38 38 'livePreview': 'Live Preview', 39 39 'activatePlugin': 'Activate', 40 40 'activateTheme': 'Activate', 41 'activateImporter': ' Activate importer',41 'activateImporter': 'Run Importer', 42 42 'unknownError': 'An unknown error occured', 43 43 'pluginsFound': 'Number of plugins found: %d', 44 44 'noPluginsFound': 'No plugins found. Try a different search.'