84
90
<table class="widefat importers striped">
87
foreach ($importers as $importer_id => $data) {
93
foreach ( $importers as $importer_id => $data ) {
94
$plugin_slug = $action = '';
95
$is_plugin_installed = false;
89
97
if ( isset( $data['install'] ) ) {
90
98
$plugin_slug = $data['install'];
91
100
if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
92
// Looks like Importer is installed, But not active
101
// Looks like an importer is installed, but not active.
93
102
$plugins = get_plugins( '/' . $plugin_slug );
94
if ( !empty($plugins) ) {
95
$keys = array_keys($plugins);
103
if ( ! empty( $plugins ) ) {
104
$keys = array_keys( $plugins );
96
105
$plugin_file = $plugin_slug . '/' . $keys[0];
97
$action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) .
98
'"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>';
106
$url = wp_nonce_url( add_query_arg( array(
107
'action' => 'activate',
108
'plugin' => $plugin_file,
110
), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
112
'<a href="%s" aria-label="%s">%s</a>',
114
/* translators: %s: Importer name */
115
esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
119
$is_plugin_installed = true;
101
if ( empty($action) ) {
123
if ( empty( $action ) ) {
102
124
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 open-plugin-details-modal" title="' .
105
esc_attr__('Install importer') . '">' . $data[0] . '</a>';
125
$url = wp_nonce_url( add_query_arg( array(
126
'action' => 'install-plugin',
127
'plugin' => $plugin_slug,
129
), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
131
'<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%3$s" aria-label="%4$s">%5$s</a>',
133
esc_attr( $plugin_slug ),
134
esc_attr( $data[0] ),
135
/* translators: %s: Importer name */
136
esc_attr( sprintf( __( 'Install %s' ), $data[0] ) ),
108
$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' ) );
141
/* translators: URL to wp-admin/import.php */
142
__( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ),
143
get_admin_url( get_current_network_id(), 'import.php' )
112
$action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>";
148
$url = add_query_arg( array(
149
'import' => $importer_id,
150
), self_admin_url( 'admin.php' ) );
152
'<a href="%1$s" aria-label="%2$s">%3$s</a>',
154
/* translators: %s: Importer name */
155
esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
159
$is_plugin_installed = true;
162
if ( ! $is_plugin_installed && is_main_site() ) {
163
$url = add_query_arg( array(
164
'tab' => 'plugin-information',
165
'plugin' => $plugin_slug,
167
'TB_iframe' => 'true',
170
), network_admin_url( 'plugin-install.php' ) );
172
' | <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
174
/* translators: %s: Importer name */
175
esc_attr( sprintf( __( 'More information about %s' ), $data[0] ) ),
117
<td class='import-system row-title'>$action</td>
118
<td class='desc'>{$data[1]}</td>
181
<tr class='importer-item'>
182
<td class='import-system'>
183
<span class='importer-title'>{$data[0]}</span>
184
<span class='importer-action'>{$action}</span>
187
<span class='importer-desc'>{$data[1]}</span>