Ticket #35191: 35191.patch
File 35191.patch, 8.7 KB (added by , 9 years ago) |
---|
-
src/wp-admin/css/common.css
2167 2167 display: block; 2168 2168 } 2169 2169 2170 .importers td{2171 padding-right: 14px;2170 .importers { 2171 margin-bottom: 2em; 2172 2172 } 2173 2173 2174 .importers { 2175 font-size: 16px; 2176 width: auto; 2174 .importer-title, 2175 .importer-desc, 2176 .importer-status, 2177 .importer-action { 2178 display: block; 2179 margin: 0; 2180 padding: 0; 2177 2181 } 2178 2182 2183 .importer-action { 2184 margin-bottom: 1em; 2185 } 2186 2179 2187 #post-body #post-body-content #namediv h3, /* Back-compat for pre-4.4 */ 2180 2188 #post-body #post-body-content #namediv h2 { 2181 2189 margin-top: 0; -
src/wp-admin/import.php
29 29 '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 30 30 ); 31 31 32 if ( current_user_can( 'install_plugins' ) ) 32 if ( current_user_can( 'install_plugins' ) ) { 33 // List of popular importer plugins from the WordPress.org API. 33 34 $popular_importers = wp_get_popular_importers(); 34 else 35 } else { 35 36 $popular_importers = array(); 37 } 36 38 37 39 // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' 38 40 if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { … … 59 61 <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> 60 62 61 63 <?php 62 64 // Registered (already installed) importers. They're stored in the global $wp_importers. 63 65 $importers = get_importers(); 64 66 65 67 // If a popular importer is not registered, create a dummy registration that links to the plugin installer. … … 68 70 continue; 69 71 if ( isset( $importers[ $pop_data['importer-id'] ] ) ) 70 72 continue; 73 74 // Merge the importers from the WordPress.org API in the array of registered (already installed) importers. 71 75 $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); 72 76 } 73 77 … … 76 80 } else { 77 81 uasort( $importers, '_usort_by_first_member' ); 78 82 ?> 79 <table class="widefat importers striped"> 83 <ul class="importers"><?php 84 foreach ( $importers as $importer_id => $data ) { 85 $action = $status = $status_class = ''; 80 86 81 <?php 82 foreach ($importers as $importer_id => $data) { 83 $action = ''; 84 if ( isset( $data['install'] ) ) { 85 $plugin_slug = $data['install']; 86 if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { 87 // Looks like Importer is installed, But not active 88 $plugins = get_plugins( '/' . $plugin_slug ); 89 if ( !empty($plugins) ) { 90 $keys = array_keys($plugins); 91 $plugin_file = $plugin_slug . '/' . $keys[0]; 92 $action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) . 93 '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>'; 94 } 87 if ( isset( $data['install'] ) ) { 88 $plugin_slug = $data['install']; 89 if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { 90 // Looks like an importer is installed, but not active. 91 $plugins = get_plugins( '/' . $plugin_slug ); 92 if ( ! empty( $plugins ) ) { 93 $keys = array_keys( $plugins ); 94 $plugin_file = $plugin_slug . '/' . $keys[0]; 95 $status = __( 'Installed and not activated.' ); 96 $status_class = ' importer-inactive'; 97 $action = '<a href="' . esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $plugin_file . 98 '&from=import' ), 'activate-plugin_' . $plugin_file ) ) . '">' . __( 'Activate and run the importer' ) . '</a>'; 95 99 } 96 if ( empty($action) ) {97 if ( is_main_site() ) {98 $action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug .99 '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox" title="'.100 esc_attr__('Install importer') . '">' . $data[0]. '</a>';101 102 $action = $data[0];103 $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' ) );104 }100 } 101 if ( empty( $action ) ) { 102 if ( is_main_site() ) { 103 $action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . 104 '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox">' . __( 'Details and installation' ) . '</a>'; 105 } else { 106 $action = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), 107 get_admin_url( $current_site->blog_id, 'import.php' ) 108 ); 105 109 } 106 } else { 107 $action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>"; 110 $status = __( 'Not installed.' ); 108 111 } 112 } else { 113 $action = '<a href="' . esc_url( 'admin.php?import=$importer_id' ) . '">' . __( 'Run the importer' ) . '</a>'; 114 $status = __( 'Installed and activated.' ); 115 $status_class = ' importer-active'; 116 } 109 117 110 echo " 111 <tr> 112 <td class='import-system row-title'>$action</td> 113 <td class='desc'>{$data[1]}</td> 114 </tr>"; 115 } 118 echo " 119 <li class='importer-item{$status_class}'> 120 <span class='importer-title row-title'>{$data[0]}</span> 121 <span class='importer-desc'>{$data[1]}</span> 122 <span class='importer-status'>{$status}</span> 123 <span class='importer-action'>{$action}</span> 124 </li>"; 125 } 116 126 ?> 117 127 118 </ table>128 </ul> 119 129 <?php 120 130 } 121 131 -
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 ),