addons.php
1 month ago
help.php
8 years ago
history.php
1 month ago
home.php
8 years ago
import.php
1 month ago
manage.php
1 month ago
partners.php
1 month ago
settings.php
4 days ago
addons.php
178 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Admin Add-ons page |
| 4 | * |
| 5 | * @author Maksym Tsypliakov <maksym.tsypliakov@gmail.com> |
| 6 | */ |
| 7 | class PMXI_Admin_Addons extends PMXI_Controller_Admin { |
| 8 | |
| 9 | public static $addons = array('PMWI_Plugin' => 0, 'PMAI_Plugin' => 0, 'PMWITabs_Plugin' => 0, 'PMLI_Plugin' => 0, 'PMLCA_Plugin' => 0, 'PMUI_Plugin' => 0, 'PMTI_Plugin' => 0); // inactive by default |
| 10 | |
| 11 | public static $premium = array(); |
| 12 | |
| 13 | public static $free = array(); |
| 14 | |
| 15 | public function __construct() { |
| 16 | |
| 17 | parent::__construct(); |
| 18 | |
| 19 | // Woocommerce add-on |
| 20 | self::$premium['PMWI_Plugin'] = array( |
| 21 | 'title' => __("WooCommerce Addon",'wp-all-import'), |
| 22 | 'description' => __("Import Products from any XML or CSV to WooCommerce",'wp-all-import'), |
| 23 | 'thumbnail' => 'http://placehold.it/220x220', |
| 24 | 'active' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'paid'), |
| 25 | 'free_installed' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'free'), |
| 26 | 'required_plugins' => false, |
| 27 | 'url' => 'https://www.wpallimport.com/woocommerce-product-import/' |
| 28 | ); |
| 29 | |
| 30 | // ACF add-on |
| 31 | self::$premium['PMAI_Plugin'] = array( |
| 32 | 'title' => __("ACF Addon",'wp-all-import'), |
| 33 | 'description' => __("Import to advanced custom fields",'wp-all-import'), |
| 34 | 'thumbnail' => 'http://placehold.it/220x220', |
| 35 | 'active' => (class_exists('PMAI_Plugin') and defined('PMAI_EDITION') and PMAI_EDITION == 'paid'), |
| 36 | 'free_installed' => (class_exists('PMAI_Plugin') and defined('PMAI_EDITION') and PMAI_EDITION == 'free'), |
| 37 | 'required_plugins' => array('Advanced Custom Fields' => class_exists('acf')), |
| 38 | 'url' => 'https://www.wpallimport.com/advanced-custom-fields/' |
| 39 | ); |
| 40 | |
| 41 | // Toolset Types add-on |
| 42 | self::$premium['PMTI_Plugin'] = array( |
| 43 | 'title' => __("Toolset Types Addon",'wp-all-import'), |
| 44 | 'description' => __("Import to toolset types",'wp-all-import'), |
| 45 | 'thumbnail' => 'http://placehold.it/220x220', |
| 46 | 'active' => (class_exists('PMTI_Plugin') and defined('PMTI_EDITION') and PMTI_EDITION == 'paid'), |
| 47 | 'free_installed' => (class_exists('PMTI_Plugin') and defined('PMTI_EDITION') and PMTI_EDITION == 'free'), |
| 48 | 'required_plugins' => array('Toolset Types' => defined(TYPES_VERSION)), |
| 49 | 'url' => 'https://www.wpallimport.com/advanced-custom-fields/' |
| 50 | ); |
| 51 | |
| 52 | // WPML add-on |
| 53 | self::$premium['PMLI_Plugin'] = array( |
| 54 | 'title' => __("WPML Addon",'wp-all-import'), |
| 55 | 'description' => __("Import to WPML",'wp-all-import'), |
| 56 | 'thumbnail' => 'http://placehold.it/220x220', |
| 57 | 'active' => (class_exists('PMLI_Plugin') and defined('PMLI_EDITION') and PMLI_EDITION == 'paid'), |
| 58 | 'free_installed' => (class_exists('PMLI_Plugin') and defined('PMLI_EDITION') and PMLI_EDITION == 'free'), |
| 59 | 'required_plugins' => array('WPML' => class_exists('SitePress')), |
| 60 | 'url' => 'https://www.wpallimport.com/add-ons/wpml/' |
| 61 | ); |
| 62 | |
| 63 | // User add-on |
| 64 | self::$premium['PMUI_Plugin'] = array( |
| 65 | 'title' => __("User Addon",'wp-all-import'), |
| 66 | 'description' => __("Import Users",'wp-all-import'), |
| 67 | 'thumbnail' => 'http://placehold.it/220x220', |
| 68 | 'active' => (class_exists('PMUI_Plugin') and defined('PMUI_EDITION') and PMUI_EDITION == 'paid'), |
| 69 | 'free_installed' => (class_exists('PMUI_Plugin') and defined('PMUI_EDITION') and PMUI_EDITION == 'free'), |
| 70 | 'required_plugins' => false, |
| 71 | 'url' => 'https://www.wpallimport.com/import-wordpress-users/' |
| 72 | ); |
| 73 | |
| 74 | // Gravity Forms add-on |
| 75 | self::$premium['PMGI_Plugin'] = array( |
| 76 | 'title' => __("Gravity Forms Addon",'wp-all-import'), |
| 77 | 'description' => __("Import Gravity Forms Entries",'wp-all-import'), |
| 78 | 'thumbnail' => 'http://placehold.it/220x220', |
| 79 | 'active' => (class_exists('PMGI_Plugin') and defined('PMGI_EDITION') and PMGI_EDITION == 'paid'), |
| 80 | 'free_installed' => (class_exists('PMGI_Plugin') and defined('PMGI_EDITION') and PMGI_EDITION == 'free'), |
| 81 | 'required_plugins' => array('Gravity Forms' => class_exists('GFForms')), |
| 82 | 'url' => 'https://www.wpallimport.com/import-gravity-forms-entries-from-xml-csv/' |
| 83 | ); |
| 84 | |
| 85 | // Meta Box add-on |
| 86 | self::$premium['PMMI_Plugin'] = array( |
| 87 | 'title' => __("Meta Box Addon",'wp-all-import'), |
| 88 | 'description' => __("Import Meta Box Custom Fields",'wp-all-import'), |
| 89 | 'thumbnail' => 'http://placehold.it/220x220', |
| 90 | 'active' => (class_exists('PMMI_Plugin') and defined('PMMI_EDITION') and PMMI_EDITION == 'paid'), |
| 91 | 'free_installed' => (class_exists('PMMI_Plugin') and defined('PMMI_EDITION') and PMMI_EDITION == 'free'), |
| 92 | 'required_plugins' => array('Meta Box' => class_exists('RWMB_Loader')), |
| 93 | 'url' => '' |
| 94 | ); |
| 95 | |
| 96 | // Affiliate link cloaking add-on |
| 97 | self::$premium['PMLCA_Plugin'] = array( |
| 98 | 'title' => __("Link cloaking Addon",'wp-all-import'), |
| 99 | 'description' => __("Affiliate link cloaking",'wp-all-import'), |
| 100 | 'thumbnail' => 'http://placehold.it/220x220', |
| 101 | 'active' => (class_exists('PMLCA_Plugin') and defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid'), |
| 102 | 'free_installed' => (class_exists('PMLCA_Plugin') and defined('PMLCA_EDITION') and PMLCA_EDITION == 'free'), |
| 103 | 'required_plugins' => false, |
| 104 | 'url' => 'https://www.wpallimport.com' |
| 105 | ); |
| 106 | |
| 107 | self::$free['PMWI_Plugin'] = array( |
| 108 | 'title' => __("WooCommerce Addon - free edition",'wp-all-import'), |
| 109 | 'description' => __("Import Products from any XML or CSV to WooCommerce",'wp-all-import'), |
| 110 | 'thumbnail' => 'http://placehold.it/220x220', |
| 111 | 'active' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'free'), |
| 112 | 'paid_installed' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'paid'), |
| 113 | 'required_plugins' => false, |
| 114 | 'url' => 'https://wordpress.org/plugins/woocommerce-xml-csv-product-import' |
| 115 | ); |
| 116 | self::$free['PMWITabs_Plugin'] = array( |
| 117 | 'title' => __("WooCommerce Tabs Addon",'wp-all-import'), |
| 118 | 'description' => __("Import data to WooCommerce tabs",'wp-all-import'), |
| 119 | 'thumbnail' => 'http://placehold.it/220x220', |
| 120 | 'active' => class_exists('PMWITabs_Plugin'), |
| 121 | 'paid_installed' => false, |
| 122 | 'required_plugins' => array('WooCommerce Addon' => class_exists('PMWI_Plugin')), |
| 123 | 'url' => 'https://www.wpallimport.com' |
| 124 | ); |
| 125 | |
| 126 | |
| 127 | } |
| 128 | |
| 129 | public function index() { |
| 130 | |
| 131 | $this->data['premium'] = self::$premium; |
| 132 | |
| 133 | $this->data['free'] = self::$free; |
| 134 | |
| 135 | $this->render(); |
| 136 | } |
| 137 | |
| 138 | public function get_premium_addons(){ |
| 139 | return self::$premium; |
| 140 | } |
| 141 | |
| 142 | public function get_free_addons(){ |
| 143 | return self::$free; |
| 144 | } |
| 145 | |
| 146 | protected static function set_addons_status(){ |
| 147 | foreach (self::$addons as $class => $active) |
| 148 | self::$addons[$class] = class_exists($class); |
| 149 | |
| 150 | self::$addons = apply_filters('pmxi_addons', self::$addons); |
| 151 | |
| 152 | } |
| 153 | |
| 154 | public static function get_all_addons(){ |
| 155 | |
| 156 | self::set_addons_status(); |
| 157 | |
| 158 | return self::$addons; |
| 159 | } |
| 160 | |
| 161 | public static function get_addon($addon = false){ |
| 162 | |
| 163 | self::set_addons_status(); |
| 164 | |
| 165 | return ($addon) ? self::$addons[$addon] : false; |
| 166 | } |
| 167 | |
| 168 | public static function get_active_addons(){ |
| 169 | |
| 170 | self::set_addons_status(); |
| 171 | $active_addons = array(); |
| 172 | foreach (self::$addons as $class => $active) if ($active) $active_addons[] = $class; |
| 173 | |
| 174 | return $active_addons; |
| 175 | } |
| 176 | |
| 177 | } |
| 178 |