| 1 |
<?php |
| 2 |
|
| 3 |
namespace Premmerce\Premmerce\Data; |
| 4 |
|
| 5 |
class Plugins { |
| 6 |
/** |
| 7 |
* @return array |
| 8 |
*/ |
| 9 |
public static function getAll() { |
| 10 |
$plugins = array(); |
| 11 |
$plugins['woocommerce'] = array( |
| 12 |
'name' => 'WooCommerce', |
| 13 |
'plugin' => 'woocommerce.php', |
| 14 |
); |
| 15 |
$plugins['wordpress-seo'] = array( |
| 16 |
'name' => 'Yoast SEO', |
| 17 |
'plugin' => 'wp-seo.php', |
| 18 |
); |
| 19 |
$plugins['contact-form-7'] = array( |
| 20 |
'name' => 'Contact Form 7', |
| 21 |
'plugin' => 'wp-contact-form-7.php', |
| 22 |
); |
| 23 |
$plugins['premmerce-search'] = array( |
| 24 |
'name' => 'Premmerce Search', |
| 25 |
'plugin' => 'premmerce-search.php', |
| 26 |
); |
| 27 |
$plugins['premmerce-user-roles'] = array( |
| 28 |
'name' => 'Premmerce User Roles', |
| 29 |
'plugin' => 'premmerce-users-roles.php', |
| 30 |
); |
| 31 |
$plugins['premmerce-woocommerce-brands'] = array( |
| 32 |
'name' => 'Premmerce WooCommerce Brands', |
| 33 |
'plugin' => 'premmerce-brands.php', |
| 34 |
); |
| 35 |
$plugins['premmerce-woocommerce-product-filter'] = array( |
| 36 |
'name' => 'Premmerce WooCommerce Product Filter', |
| 37 |
'plugin' => 'premmerce-filter.php', |
| 38 |
); |
| 39 |
$plugins['woo-customers-manager'] = array( |
| 40 |
'name' => 'WooCommerce Customers Manager', |
| 41 |
'plugin' => 'premmerce-extended-users.php', |
| 42 |
); |
| 43 |
$plugins['woo-permalink-manager'] = array( |
| 44 |
'name' => 'WooCommerce Permalink Manager', |
| 45 |
'plugin' => 'premmerce-url-manager.php', |
| 46 |
); |
| 47 |
$plugins['woo-seo-addon'] = array( |
| 48 |
'name' => 'WooCommerce SEO Addon', |
| 49 |
'plugin' => 'premmerce-seo-addon.php', |
| 50 |
); |
| 51 |
$plugins['premmerce-woocommerce-wishlist'] = array( |
| 52 |
'name' => 'Premmerce WooCommerce Wishlist', |
| 53 |
'plugin' => 'premmerce-wishlist.php', |
| 54 |
); |
| 55 |
$plugins['premmerce-redirect-manager'] = array( |
| 56 |
'name' => 'Premmerce Redirect Manager', |
| 57 |
'plugin' => 'premmerce-redirect.php', |
| 58 |
); |
| 59 |
$plugins['premmerce-woocommerce-wholesale-pricing'] = array( |
| 60 |
'name' => 'Premmerce Woocommerce Wholesale Pricing', |
| 61 |
'plugin' => 'premmerce-price-types.php', |
| 62 |
); |
| 63 |
$plugins['premmerce-woocommerce-product-bundles'] = array( |
| 64 |
'name' => 'Woocommerce Frequently Bought Together', |
| 65 |
'plugin' => 'premmerce-product-bundles.php', |
| 66 |
); |
| 67 |
$plugins['google-analytics-dashboard-for-wp'] = array( |
| 68 |
'name' => 'Google Analytics Dashboard', |
| 69 |
'plugin' => 'gadwp.php.php', |
| 70 |
); |
| 71 |
$plugins['woocommerce-google-analytics-integration'] = array( |
| 72 |
'name' => 'WooCommerce Google Analytics Integration', |
| 73 |
'plugin' => 'woocommerce-google-analytics-integration.php', |
| 74 |
); |
| 75 |
$plugins['ml-slider'] = array( |
| 76 |
'name' => 'MetaSlider', |
| 77 |
'plugin' => 'ml-slider.php', |
| 78 |
); |
| 79 |
return $plugins; |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* @param $slug |
| 84 |
* |
| 85 |
* @return bool |
| 86 |
*/ |
| 87 |
public static function exists( $slug ) { |
| 88 |
return array_key_exists( $slug, self::getAll() ); |
| 89 |
} |
| 90 |
|
| 91 |
/** |
| 92 |
* @param $slug |
| 93 |
* |
| 94 |
* @return mixed |
| 95 |
*/ |
| 96 |
public static function get( $slug ) { |
| 97 |
if ( self::exists( $slug ) ) { |
| 98 |
return self::getAll()[$slug]; |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* @param $slug |
| 104 |
* |
| 105 |
* @return null|string |
| 106 |
*/ |
| 107 |
public static function getPath( $slug ) { |
| 108 |
if ( $plugin = self::get( $slug ) ) { |
| 109 |
return ( isset( $plugin['link'] ) ? 'extra/' . $plugin['link'] : null ); |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
} |
| 114 |
|