Ticket #35191: 35191.4.patch
File 35191.4.patch, 8.5 KB (added by , 8 years ago) |
---|
-
src/wp-admin/css/common.css
2276 2276 2277 2277 .importers td { 2278 2278 padding-right: 14px; 2279 line-height: 1.5em; 2279 2280 } 2280 2281 2281 2282 .importers { … … 2283 2284 width: auto; 2284 2285 } 2285 2286 2287 .importer-title, 2288 .importer-desc, 2289 .importer-status, 2290 .importer-action { 2291 display: block; 2292 } 2293 2294 .importer-action { 2295 margin-bottom: 1em; 2296 color: #ddd; 2297 } 2298 2286 2299 #post-body #post-body-content #namediv h3, /* Back-compat for pre-4.4 */ 2287 2300 #post-body #post-body-content #namediv h2 { 2288 2301 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 $popular_importers = array(); 35 } else { 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'] ] ) ) { … … 65 67 <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> 66 68 67 69 <?php 68 70 // Registered (already installed) importers. They're stored in the global $wp_importers. 69 71 $importers = get_importers(); 70 72 71 73 // If a popular importer is not registered, create a dummy registration that links to the plugin installer. … … 74 76 continue; 75 77 if ( isset( $importers[ $pop_data['importer-id'] ] ) ) 76 78 continue; 79 80 // Merge the importers from the WordPress.org API in the array of registered (already installed) importers. 77 81 $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); 78 82 } 79 83 … … 86 90 87 91 <?php 88 92 foreach ($importers as $importer_id => $data) { 89 $action = ''; 93 $action = $status = $status_class = ''; 94 90 95 if ( isset( $data['install'] ) ) { 91 96 $plugin_slug = $data['install']; 92 97 if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { 93 // Looks like Importer is installed, But not active98 // Looks like an importer is installed, but not active. 94 99 $plugins = get_plugins( '/' . $plugin_slug ); 95 100 if ( !empty($plugins) ) { 96 101 $keys = array_keys($plugins); 97 102 $plugin_file = $plugin_slug . '/' . $keys[0]; 98 $action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) . 99 '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>'; 103 $status = _x( 'Installed and not activated', 'importer plugin' ); 104 $status_class = ' importer-inactive'; 105 $action = '<a href="' . esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $plugin_file . 106 '&from=import' ), 'activate-plugin_' . $plugin_file ) ) . '">' . __( 'Activate and run' ) . '</a>'; 100 107 } 101 108 } 102 109 if ( empty($action) ) { 103 110 if ( is_main_site() ) { 104 $action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . 105 '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal" title="' . 106 esc_attr__('Install importer') . '">' . $data[0] . '</a>'; 111 $url = esc_url( wp_nonce_url( add_query_arg( 'from', 'import', self_admin_url( 'update.php?action=install-plugin&plugin=' . $plugin_slug ) ), 'install-plugin_' . $plugin_slug ) ); 112 $action = '<a class="" href="' . $url . '">' . __( 'Install' ) . '</a>'; 107 113 } else { 108 $action = $data[0]; 109 $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' ) ); 114 $action = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), 115 get_admin_url( $current_site->blog_id, 'import.php' ) 116 ); 110 117 } 118 $status = _x( 'Not installed', 'importer plugin' ); 111 119 } 112 120 } else { 113 $action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>"; 121 $action = '<a href="' . esc_url( 'admin.php?import=$importer_id' ) . '">' . __( 'Run the importer' ) . '</a>'; 122 $status = _x( 'Installed and activated', 'importer plugin' ); 123 $status_class = ' importer-active'; 114 124 } 115 125 126 $action .= ' | <a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . 127 '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox">' . __( 'Details' ) . '</a>'; 128 116 129 echo " 117 <tr> 118 <td class='import-system row-title'>$action</td> 119 <td class='desc'>{$data[1]}</td> 130 <tr class='importer-item{$status_class}'> 131 <td class='import-system'> 132 <span class='importer-title row-title'>{$data[0]}</span> 133 <span class='importer-action'>{$action}</span> 134 </td> 135 <td class='desc'> 136 <span class='importer-status'>{$status}</span> 137 <span class='importer-desc'>{$data[1]}</span> 138 </td> 120 139 </tr>"; 121 140 } 122 141 ?> -
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 ),