Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 27 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Brands | |
0.00% |
0 / 27 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| get_brands | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
2 | |||
| get_current_brand | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | namespace NewfoldLabs\WP\Module\Patterns\Data; |
| 3 | |
| 4 | use function NewfoldLabs\WP\ModuleLoader\container; |
| 5 | |
| 6 | /** |
| 7 | * Contains Brand information. |
| 8 | */ |
| 9 | final class Brands { |
| 10 | |
| 11 | /** |
| 12 | * Brand specific data |
| 13 | * |
| 14 | * @return array |
| 15 | */ |
| 16 | public static function get_brands() { |
| 17 | return array( |
| 18 | 'bluehost' => array( |
| 19 | 'brand' => 'bluehost', |
| 20 | 'name' => 'Bluehost', |
| 21 | 'pluginDashboardPage' => \admin_url( 'admin.php?page=bluehost#/settings' ), |
| 22 | ), |
| 23 | 'crazy-domains' => array( |
| 24 | 'brand' => 'crazy-domains', |
| 25 | 'name' => 'Crazy Domains', |
| 26 | 'pluginDashboardPage' => \admin_url( 'admin.php?page=crazy-domains' ), |
| 27 | ), |
| 28 | 'hostgator' => array( |
| 29 | 'brand' => 'hostgator', |
| 30 | 'name' => 'HostGator', |
| 31 | 'pluginDashboardPage' => \admin_url( 'admin.php?page=hostgator' ), |
| 32 | ), |
| 33 | 'wordpress' => array( |
| 34 | 'brand' => 'wordpress', |
| 35 | 'name' => 'WordPress', |
| 36 | 'pluginDashboardPage' => \admin_url(), |
| 37 | ), |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Get the current brand. |
| 43 | * |
| 44 | * @return array |
| 45 | */ |
| 46 | public static function get_current_brand() { |
| 47 | $brand_id = container()->plugin()->brand; |
| 48 | $brands = self::get_brands(); |
| 49 | $brand = isset( $brands[ $brand_id ] ) ? $brands[ $brand_id ] : $brands['wordpress']; |
| 50 | $brand['plugin'] = container()->plugin()->name; |
| 51 | return $brand; |
| 52 | } |
| 53 | } |