| @@ -40,10 +40,34 @@ | ||
| 40 | 40 | |
| 41 | 41 | add_action('admin_menu', array($this, 'register_tools_menu')); |
| 42 | 42 | add_action('tool_box', array($this->view_manager, 'tool_box')); |
| 43 | 43 | add_filter('plugin_action_links_' . $this->properties->plugin_basename, array($this, 'add_plugin_links')); |
| 44 | + add_filter('update_footer', [$this, 'add_footer_text_right'], 20); | |
| 45 | + add_filter('admin_footer_text', [$this, 'add_footer_text_left']); | |
| 44 | 46 | } |
| 45 | 47 | |
| 48 | + public function add_footer_text_left($text) | |
| 49 | + { | |
| 50 | + $screen = get_current_screen(); | |
| 51 | + if ($screen->id !== 'tools_page_importwp') { | |
| 52 | + return $text; | |
| 53 | + } | |
| 54 | + | |
| 55 | + return '<a target="_blank" href="https://www.importwp.com/support/">Contact support</a> | Add your <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/jc-importer#postform">★★★★★</a> on <a target="_blank" href="http://wordpress.org/plugins/jc-importer/">wordpress.org</a>'; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public function add_footer_text_right($text) | |
| 59 | + { | |
| 60 | + $screen = get_current_screen(); | |
| 61 | + if ($screen->id !== 'tools_page_importwp') { | |
| 62 | + return $text; | |
| 63 | + } | |
| 64 | + | |
| 65 | + return '<a class="iwp-footer-link" target="_blank" href="https://translate.wordpress.org/projects/wp-plugins/jc-importer/"><span class="dashicons dashicons-translation"></span> Translate</a> | | |
| 66 | + <a class="iwp-footer-link" target="_blank" href="https://www.importwp.com/documentation/?utm_campaign=support%2Bdocs&utm_source=Import%2BWP%2BFree&utm_medium=footer">View Documentation</a> | | |
| 67 | + ImportWP v' . IWP_VERSION . (defined('IWP_PRO_VERSION') ? ' | ImportWP PRO v' . IWP_PRO_VERSION : ''); | |
| 68 | + } | |
| 69 | + | |
| 46 | 70 | public function register_tools_menu() |
| 47 | 71 | { |
| 48 | 72 | $title = __('Import WP', $this->properties->plugin_domain); |
| 49 | 73 | |
| @@ -60,12 +84,12 @@ | ||
| 60 | 84 | return array_merge( |
| 61 | 85 | [ |
| 62 | 86 | '<a href="' . |
| 63 | 87 | admin_url('tools.php?page=' . $this->properties->plugin_domain) . |
| 64 | - '">' . __('Dashboard', 'importwp') . '</a>', | |
| 88 | + '">' . __('Dashboard', 'jc-importer') . '</a>', | |
| 65 | 89 | '<a href="' . |
| 66 | 90 | admin_url('tools.php?page=' . $this->properties->plugin_domain . '&tab=settings') . |
| 67 | - '">' . __('Settings', 'importwp') . '</a>', | |
| 91 | + '">' . __('Settings', 'jc-importer') . '</a>', | |
| 68 | 92 | ], |
| 69 | 93 | $links |
| 70 | 94 | ); |
| 71 | 95 | } |
| @@ -71,10 +95,12 @@ | ||
| 71 | 95 | } |
| 72 | 96 | |
| 73 | 97 | public function load_assets() |
| 74 | 98 | { |
| 75 | - wp_register_script($this->properties->plugin_domain . '-bundle', plugin_dir_url($this->properties->plugin_file_path) . 'dist/base/js/bundle.js', array(), $this->properties->plugin_version, 'all'); | |
| 99 | + $asset_file = include(plugin_dir_path($this->properties->plugin_file_path) . 'dist/index.asset.php'); | |
| 76 | 100 | |
| 101 | + wp_register_script($this->properties->plugin_domain . '-bundle', plugin_dir_url($this->properties->plugin_file_path) . 'dist/index.js', $asset_file['dependencies'], $asset_file['version'], 'all'); | |
| 102 | + | |
| 77 | 103 | $matches = false; |
| 78 | 104 | preg_match('/^https?:\/\/[^\/]+(.*?)$/', admin_url('/tools.php?page=' . $this->properties->plugin_domain), $matches); |
| 79 | 105 | $ajax_base = $matches[1]; |
| 80 | 106 | |
| @@ -85,8 +111,9 @@ | ||
| 85 | 111 | $template_data = []; |
| 86 | 112 | foreach ($templates as $template_id => $template) { |
| 87 | 113 | |
| 88 | 114 | $template_class = $this->template_manager->load_template($template); |
| 115 | + $unique_fields = $this->template_manager->get_template_unique_fields($template_class); | |
| 89 | 116 | |
| 90 | 117 | $template_data[] = [ |
| 91 | 118 | 'id' => $template_id, |
| 92 | 119 | 'label' => $template_class->get_name(), |
| @@ -92,8 +119,9 @@ | ||
| 92 | 119 | 'label' => $template_class->get_name(), |
| 93 | 120 | 'map' => [], |
| 94 | 121 | 'settings' => $template_class->register_settings(), |
| 95 | 122 | 'options' => $template_class->register_options(), |
| 123 | + 'unique_fields' => $unique_fields | |
| 96 | 124 | ]; |
| 97 | 125 | } |
| 98 | 126 | |
| 99 | 127 | $migrations = new Migrations(); |
| @@ -98,19 +126,26 @@ | ||
| 98 | 126 | |
| 99 | 127 | $migrations = new Migrations(); |
| 100 | 128 | $is_setup = $migrations->isSetup() ? 'yes' : 'no'; |
| 101 | 129 | |
| 130 | + $pro_version = ''; | |
| 131 | + if (defined('IWP_PRO_VERSION') && $this->properties->is_pro) { | |
| 132 | + $pro_version .= ' (v' . IWP_PRO_VERSION . ' PRO)'; | |
| 133 | + } | |
| 134 | + | |
| 102 | 135 | wp_localize_script($this->properties->plugin_domain . '-bundle', 'iwp', array( |
| 103 | 136 | 'root' => esc_url_raw(rest_url()), |
| 104 | 137 | 'nonce' => wp_create_nonce('wp_rest'), |
| 138 | + 'download_nonce' => wp_create_nonce('iwp_export_download'), | |
| 105 | 139 | 'admin_base' => $ajax_base, |
| 106 | 140 | 'ajax_base' => rest_url('/' . $this->properties->rest_namespace . '/' . $this->properties->rest_version), |
| 107 | 141 | 'templates' => $template_data, |
| 108 | 142 | 'is_setup' => $is_setup, |
| 109 | 143 | 'plugin_url' => plugin_dir_url($this->properties->plugin_file_path), |
| 110 | - 'version' => $this->properties->plugin_version, | |
| 144 | + 'version' => 'v' . $this->properties->plugin_version . $pro_version, | |
| 111 | 145 | 'encodings' => $this->properties->encodings, |
| 112 | 146 | 'is_pro' => $this->properties->is_pro ? 'yes' : 'no', |
| 147 | + 'is_debug' => $this->importer_manager->is_debug() ? 'yes' : 'no', | |
| 113 | 148 | 'export_fields' => $this->get_export_fields(), |
| 114 | 149 | 'registered_addons' => apply_filters('iwp/register_js', []), |
| 115 | 150 | 'global_notices' => apply_filters('iwp/frontent/notices', []) |
| 116 | 151 | )); |
| @@ -116,9 +151,9 @@ | ||
| 116 | 151 | )); |
| 117 | 152 | |
| 118 | 153 | wp_enqueue_script($this->properties->plugin_domain . '-bundle'); |
| 119 | 154 | |
| 120 | - wp_enqueue_style($this->properties->plugin_domain . '-bundle-styles', plugin_dir_url($this->properties->plugin_file_path) . 'dist/base/css/style.bundle.css', array(), $this->properties->plugin_version, 'all'); | |
| 155 | + wp_enqueue_style($this->properties->plugin_domain . '-bundle-styles', plugin_dir_url($this->properties->plugin_file_path) . 'dist/index.css', array(), $asset_file['version'], 'all'); | |
| 121 | 156 | |
| 122 | 157 | $this->load_help_tabs(); |
| 123 | 158 | |
| 124 | 159 | do_action('iwp/enqueue_assets'); |
| @@ -180,16 +215,16 @@ | ||
| 180 | 215 | |
| 181 | 216 | $screen->add_help_tab(array( |
| 182 | 217 | 'id' => 'iwp_help_tab', |
| 183 | 218 | 'title' => __('Overview'), |
| 184 | - 'content' => '<p>' . __('Import WP allows you to import any XML or CSV file into WordPress posts, pages, users, categories and tags.', 'importwp') . '</p>', | |
| 219 | + 'content' => '<p>' . __('ImportWP allows you to import any XML or CSV file into WordPress posts, pages, users, categories and tags.', 'jc-importer') . '</p>', | |
| 185 | 220 | )); |
| 186 | 221 | |
| 187 | 222 | $screen->add_help_tab([ |
| 188 | 223 | 'id' => 'iwp_support_tab', |
| 189 | - 'title' => __('Plugin Support', 'importwp'), | |
| 190 | - 'content' => '<p>' . __('Import WP has the following support:', 'importwp') . '</p>' | |
| 191 | - . '<p>' . __('<strong>Plugin documentation</strong> — Online documentation can be found at <a href="https://www.importwp.com/documentation/?utm_campaign=support%2Bdocs&utm_source=Import%2BWP%2BFree&utm_medium=help%2Btab" target="_blank">https://www.importwp.com/documentation/</a>', 'importwp') . '</p>' | |
| 192 | - . '<p>' . __('<strong>Support Tickets</strong> — Support requests are handled on our support system at <a href="https://support.jclabs.co.uk/" target="_blank">https://support.jclabs.co.uk/</a>', 'importwp') . '</p>', | |
| 224 | + 'title' => __('Plugin Support', 'jc-importer'), | |
| 225 | + 'content' => '<p>' . __('Import WP has the following support:', 'jc-importer') . '</p>' | |
| 226 | + . '<p>' . sprintf(__('documentation — Online documentation can be found at %s', 'jc-importer'), '<a href="https://www.importwp.com/docs/?utm_campaign=support%2Bdocs&utm_source=Import%2BWP%2BFree&utm_medium=help%2Btab" target="_blank">https://www.importwp.com/docs/</a>') . '</p>' | |
| 227 | + . '<p>' . sprintf(__('Support Tickets — Support requests are handled on our support system at %s', 'jc-importer'), '<a href="https://helpdesk.importwp.com/" target="_blank">https://helpdesk.importwp.com/</a>') . '</p>', | |
| 193 | 228 | ]); |
| 194 | 229 | } |
| 195 | 230 | } |