| @@ -12,8 +12,17 @@ | ||
| 12 | 12 | $iwp->register(); |
| 13 | 13 | return $iwp; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | +/** | |
| 17 | + * @return \ImportWP\ImportWP | |
| 18 | + */ | |
| 19 | +function iwp() | |
| 20 | +{ | |
| 21 | + global $iwp; | |
| 22 | + return $iwp; | |
| 23 | +} | |
| 24 | + | |
| 16 | 25 | function iwp_is_pro_disabled() |
| 17 | 26 | { |
| 18 | 27 | return defined('IWP_PRO_VERSION') && version_compare(IWP_PRO_VERSION, IWP_CORE_MIN_PRO_VERSION, '<'); |
| 19 | 28 | } |
| @@ -30,9 +39,9 @@ | ||
| 30 | 39 | if (iwp_is_pro_disabled()) { |
| 31 | 40 | remove_action('plugins_loaded', 'iwp_pro_loaded'); |
| 32 | 41 | |
| 33 | 42 | // Display compatability message |
| 34 | - $message = '<strong>Import WP v' . IWP_VERSION . '</strong> requires <strong>Import WP PRO v' . IWP_CORE_MIN_PRO_VERSION . ' or greater</strong>, Download the lastest version of Import WP Pro or Rollback Import WP to a compatable version.'; | |
| 43 | + $message = sprintf(__('ImportWP v%s requires ImportWP PRO v%s or greater, Download the lastest version of Import WP Pro or Rollback Import WP to a compatable version.', 'jc-importer'), IWP_VERSION, IWP_CORE_MIN_PRO_VERSION); | |
| 35 | 44 | add_action('admin_notices', function () use ($message) { |
| 36 | 45 | |
| 37 | 46 | global $pagenow; |
| 38 | 47 | |
| @@ -70,9 +79,9 @@ | ||
| 70 | 79 | border-left: 4px solid #00a0d2; |
| 71 | 80 | background-color: #f7fcfe; |
| 72 | 81 | } |
| 73 | 82 | </style> |
| 74 | -<?php | |
| 83 | + <?php | |
| 75 | 84 | }; |
| 76 | 85 | add_action('after_plugin_row_' . plugin_basename(dirname(__FILE__) . '/importwp-pro.php'), $upgrade_mesasge); |
| 77 | 86 | add_action('after_plugin_row_' . plugin_basename(dirname(__FILE__) . '/jc-importer.php'), $upgrade_mesasge); |
| 78 | 87 | |
| @@ -83,8 +92,48 @@ | ||
| 83 | 92 | } |
| 84 | 93 | } |
| 85 | 94 | add_action('plugins_loaded', 'iwp_has_required_version_of_pro', 0); |
| 86 | 95 | |
| 96 | + | |
| 97 | +function iwp_check_installed_plugins() | |
| 98 | +{ | |
| 99 | + | |
| 100 | + // Check and disable loading of zip archive plugin | |
| 101 | + if (function_exists('iwp_zip_archive_setup') && has_filter('plugins_loaded', 'iwp_zip_archive_setup')) { | |
| 102 | + remove_action('plugins_loaded', 'iwp_zip_archive_setup', 9); | |
| 103 | + | |
| 104 | + $upgrade_mesasge = function () { | |
| 105 | + ?> | |
| 106 | + <tr class="iwp-zip-remove-row-error iwp-invalid"> | |
| 107 | + <td colspan="4"><?php _e('Import WP - Zip Archive Importer Addon is now included in ImportWP, please deactivate and remove this plugin.', 'jc-importer'); ?></td> | |
| 108 | + </tr> | |
| 109 | + <style> | |
| 110 | + .iwp-zip-remove-row-error td { | |
| 111 | + -webkit-box-shadow: 0px -1px 0 rgba(255, 255, 255, 0.1), | |
| 112 | + inset 0 -1px 0 rgba(0, 0, 0, 0.1); | |
| 113 | + box-shadow: 0px -1px 0 rgba(255, 255, 255, 0.1), | |
| 114 | + inset 0 -1px 0 rgba(0, 0, 0, 0.1); | |
| 115 | + border-left: 4px solid #ffb900; | |
| 116 | + background-color: #fff8e5; | |
| 117 | + } | |
| 118 | + | |
| 119 | + .iwp-zip-remove-row-error.iwp-invalid td { | |
| 120 | + border-left: 4px solid #dc3232; | |
| 121 | + background-color: #fef1f1; | |
| 122 | + } | |
| 123 | + | |
| 124 | + .iwp-zip-remove-row-error.iwp-valid td { | |
| 125 | + border-left: 4px solid #00a0d2; | |
| 126 | + background-color: #f7fcfe; | |
| 127 | + } | |
| 128 | + </style> | |
| 129 | +<?php | |
| 130 | + }; | |
| 131 | + add_action('after_plugin_row_importwp-zip-archive/zip-archive.php', $upgrade_mesasge); | |
| 132 | + } | |
| 133 | +} | |
| 134 | +add_action('plugins_loaded', 'iwp_check_installed_plugins', 0); | |
| 135 | + | |
| 87 | 136 | function iwp_loaded() |
| 88 | 137 | { |
| 89 | 138 | if (function_exists('import_wp_pro') && !iwp_is_pro_disabled()) { |
| 90 | 139 | return; |
| @@ -101,8 +150,9 @@ | ||
| 101 | 150 | * |
| 102 | 151 | * @param string $name |
| 103 | 152 | * @param string $id |
| 104 | 153 | * @param callable(AddonInterface) $callback |
| 154 | + * @deprecated 2.14.0 | |
| 105 | 155 | * |
| 106 | 156 | * @return ImportWP\Common\Addon\AddonInterface |
| 107 | 157 | */ |
| 108 | 158 | function iwp_register_importer_addon($name, $id, $callback) |
| @@ -108,4 +158,14 @@ | ||
| 108 | 158 | function iwp_register_importer_addon($name, $id, $callback) |
| 109 | 159 | { |
| 110 | 160 | return new ImportWP\Common\Addon\AddonBase($name, $id, $callback); |
| 111 | 161 | } |
| 162 | + | |
| 163 | +function iwp_register_muplugin_uninstall() | |
| 164 | +{ | |
| 165 | + do_action('iwp/compat/register_muplugin_uninstall'); | |
| 166 | +} | |
| 167 | + | |
| 168 | + | |
| 169 | +add_action('init', function () { | |
| 170 | + load_plugin_textdomain('jc-importer', false, basename(dirname(__FILE__)) . '/languages/'); | |
| 171 | +}); | |