Ticket #35191: 35191.4.6.diff
File 35191.4.6.diff, 9.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
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 = $status = $status_class = ''; 95 91 96 if ( isset( $data['install'] ) ) { 92 97 $plugin_slug = $data['install']; 98 93 99 if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { 94 // Looks like Importer is installed, But not active100 // Looks like an importer is installed, but not active. 95 101 $plugins = get_plugins( '/' . $plugin_slug ); 96 102 if ( !empty($plugins) ) { 97 103 $keys = array_keys($plugins); 98 104 $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>'; 105 $status = _x( 'Inactive', 'importer plugin' ); 106 $status_class = ' importer-inactive'; 107 $url = esc_url( wp_nonce_url( add_query_arg( array( 108 'action' => 'activate', 109 'plugin' => $plugin_file, 110 'from' => 'import', 111 ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file ) ); 112 $action = sprintf( '<a href="%1$s">%2$s</a>', $url, __( 'Activate' ) ); 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( '<a href="%1$s">%2$s</a>', $url, __( 'Install Now' ) ); 108 124 } 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' ) ); 125 $action = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), 126 get_admin_url( get_current_network_id(), 'import.php' ) 127 ); 111 128 } 129 130 $status = _x( 'Not installed', 'importer plugin' ); 112 131 } 113 132 } else { 114 $action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>"; 133 $status = _x( 'Active', 'importer plugin' ); 134 $status_class = ' importer-active'; 135 $url = esc_url( add_query_arg( array( 136 'import' => $importer_id, 137 ), self_admin_url( 'admin.php' ) ) ); 138 $action = sprintf( '<a href="%1$s">%2$s</a>', $url, __( 'Run' ) ); 115 139 } 116 140 141 if ( '' !== $plugin_slug ) { 142 $url = esc_url( add_query_arg( array( 143 'tab' => 'plugin-information', 144 'plugin' => $plugin_slug, 145 'from' => 'import', 146 'TB_iframe' => 'true', 147 'width' => 600, 148 'height' => 550, 149 ), network_admin_url( 'plugin-install.php' ) ) ); 150 $action .= sprintf( ' | <a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>', $url, __( 'Details' ) ); 151 } 152 117 153 echo " 118 <tr> 119 <td class='import-system row-title'>$action</td> 120 <td class='desc'>{$data[1]}</td> 154 <tr class='importer-item{$status_class}'> 155 <td class='import-system'> 156 <span class='importer-title row-title'>{$data[0]}</span> 157 <span class='importer-action'>{$action}</span> 158 </td> 159 <td class='desc'> 160 <span class='importer-status'>{$status}</span> 161 <span class='importer-desc'>{$data[1]}</span> 162 </td> 121 163 </tr>"; 122 164 } 123 165 ?> -
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-includes/pluggable.php
1049 1049 if ( -1 == $action ) 1050 1050 _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); 1051 1051 1052 $adminurl = strtolower(admin_url());1053 $referer = strtolower(wp_get_referer());1054 1052 $result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false; 1055 1053 1056 1054 /**