id || 'appearance_page_nexos-dashboard' === $screen->id || 'appearance_page_tgmpa-install-plugins' === $screen->id) {
return;
}
if ( in_array( 'wpdirectorykit/wpdirectorykit.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && function_exists('wdk_get_instance')) {
$WMVC = &wdk_get_instance();
$WMVC->model('field_m');
$wdk_fields = $WMVC->field_m->get();
if(count($wdk_fields) > 0)
return true;
}
?>
esc_html__('Installing Demo Importer Plugin', 'apartment'),
'activating_text' => esc_html__('Activating Demo Importer Plugin', 'apartment'),
'importer_page' => esc_html__('Go to Demo Importer Page', 'apartment'),
'importer_url' => admin_url('themes.php?page=one-click-demo-import'),
'error' => esc_html__('Error! Reload the page and try again.', 'apartment'),
'success_redirect' => 1,
'tgmpa_link' => esc_url(get_admin_url() . "themes.php?page=tgmpa-install-plugins"),
'success_import' => esc_html__('For best experience please install and active all recommended plugin from theme before demo content import here.', 'apartment'),
'wpnonce' => wp_create_nonce( 'activate_plugin' ),
);
wp_enqueue_style('apartment-welcome', get_stylesheet_directory_uri() . '/assets/css/welcome.css', array(), '1.0');
wp_enqueue_script('apartment-welcome', get_stylesheet_directory_uri() . '/assets/js/welcome.js', ['jquery'], '1.0', true );
wp_localize_script('apartment-welcome', 'importer_params', $importer_params);
}
add_action('admin_enqueue_scripts', 'apartment_admin_scripts');
if(!function_exists('apartment_activate_plugin')) {
add_action('wp_ajax_apartment_activate_plugin', 'apartment_activate_plugin');
function apartment_activate_plugin() {
if(!current_user_can( 'activate_plugins' )) {
echo esc_html__('Disable for current user', 'apartment');
exit();
}
if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'activate_plugin' ) ) {
echo esc_html__('Wrong _wpnonce', 'apartment');
exit();
}
$slug = isset($_POST['slug']) ? $_POST['slug'] : '';
$file = isset($_POST['file']) ? $_POST['file'] : '';
$success = false;
if (!empty($slug) && !empty($file)) {
$result = activate_plugin($slug . '/' . $file . '.php');
update_option('apartment_hide_notice', true);
if (!is_wp_error($result)) {
$success = true;
}
}
echo wp_json_encode(array('success' => $success));
die();
}
}