diff --git src/wp-admin/css/common.css src/wp-admin/css/common.css
index 906fd5b..49e0f53 100644
|
|
body.iframe { |
2276 | 2276 | |
2277 | 2277 | .importers td { |
2278 | 2278 | padding-right: 14px; |
| 2279 | line-height: 1.5em; |
2279 | 2280 | } |
2280 | 2281 | |
2281 | 2282 | .importers { |
… |
… |
body.iframe { |
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; |
diff --git src/wp-admin/import.php src/wp-admin/import.php
index 962db68..5c500d1 100644
|
|
get_current_screen()->set_help_sidebar( |
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'] ] ) ) { |
… |
… |
$parent_file = 'tools.php'; |
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. |
… |
… |
foreach ( $popular_importers as $pop_importer => $pop_data ) { |
75 | 77 | continue; |
76 | 78 | if ( isset( $importers[ $pop_data['importer-id'] ] ) ) |
77 | 79 | continue; |
| 80 | |
| 81 | // Merge the importers from the WordPress.org API in the array of registered (already installed) importers. |
78 | 82 | $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); |
79 | 83 | } |
80 | 84 | |
… |
… |
if ( empty( $importers ) ) { |
87 | 91 | |
88 | 92 | <?php |
89 | 93 | foreach ($importers as $importer_id => $data) { |
90 | | $action = ''; |
| 94 | $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 active |
| 100 | // 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( 'Installed and not activated', '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 and run' ) ); |
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' ) ); |
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( 'Installed and activated', '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, __( 'Activate and run' ) ); |
| 139 | } |
| 140 | |
| 141 | if ( isset( $plugin_slug ) ) { |
| 142 | $url = esc_url( add_query_arg( array( |
| 143 | 'tab' => 'plugin-information', |
| 144 | 'plugin' => $plugin_slug, |
| 145 | 'from' => 'impport', |
| 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' ) ); |
115 | 151 | } |
116 | 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 | ?> |
diff --git src/wp-admin/includes/import.php src/wp-admin/includes/import.php
index fa980e6..5f2d944 100644
|
|
function wp_get_popular_importers() { |
157 | 157 | // slug => name, description, plugin slug, and register_importer() slug |
158 | 158 | 'blogger' => array( |
159 | 159 | 'name' => __( 'Blogger' ), |
160 | | 'description' => __( 'Install 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' => __( 'Install 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' => __( 'Install 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' => __( 'Install 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' => __( 'Install 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' => __( 'Install 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' => __( 'Install 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 | ), |
diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
index a9d3504..02de378 100644
|
|
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { |
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 | /** |