| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPSpeedo_Team; |
| 4 |
|
| 5 |
if ( !defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
class Plugin { |
| 9 |
public static $instance = null; |
| 10 |
|
| 11 |
public $tabs = []; |
| 12 |
|
| 13 |
public $controls_manager; |
| 14 |
|
| 15 |
public $admin; |
| 16 |
|
| 17 |
public $translations; |
| 18 |
|
| 19 |
public $translations_adv; |
| 20 |
|
| 21 |
public $api; |
| 22 |
|
| 23 |
public $assets; |
| 24 |
|
| 25 |
public $notifications; |
| 26 |
|
| 27 |
public $integrations; |
| 28 |
|
| 29 |
private function __construct() { |
| 30 |
$this->load(); |
| 31 |
} |
| 32 |
|
| 33 |
public static function instance() { |
| 34 |
if ( is_null( self::$instance ) ) { |
| 35 |
self::$instance = new self(); |
| 36 |
} |
| 37 |
return self::$instance; |
| 38 |
} |
| 39 |
|
| 40 |
public function load() { |
| 41 |
$this->set_tabs(); |
| 42 |
new Variables(); |
| 43 |
$this->translations = new Translations(); |
| 44 |
$this->controls_manager = new Controls_Manager(); |
| 45 |
$this->admin = new Admin(); |
| 46 |
new Hooks(); |
| 47 |
// Drag-and-drop ordering directly on native admin list screens. |
| 48 |
// Replaces the legacy "Team → Sort Order" page while reusing the |
| 49 |
// same storage (menu_order / term_order) so existing ordering for |
| 50 |
// posts, taxonomy terms, frontend, shortcodes, sliders & filters |
| 51 |
// continues to work unchanged. |
| 52 |
if ( is_admin() ) { |
| 53 |
new Admin_Sortable(); |
| 54 |
} |
| 55 |
// Resolves per-term effective ordering for frontend queries |
| 56 |
// (shortcodes, AJAX filters, archives). Handles single-term and |
| 57 |
// multi-term selection using SQL FIELD()+LEAST() — no PHP sorting. |
| 58 |
// PRO-only; the constructor bails on free installs. |
| 59 |
new Term_Order_Resolver(); |
| 60 |
$this->api = new API(); |
| 61 |
$this->notifications = new Notifications(); |
| 62 |
$this->assets = new Assets(); |
| 63 |
$this->integrations = new Integrations(); |
| 64 |
new Data(); |
| 65 |
new Shortcode(); |
| 66 |
new Demo_Import(); |
| 67 |
new Template_Status(); |
| 68 |
new Compatibility(); |
| 69 |
new Export_Import_Manager(); |
| 70 |
new Erase_Reset_Manager(); |
| 71 |
do_action( 'wpspeedo_team/loaded', $this ); |
| 72 |
} |
| 73 |
|
| 74 |
public function set_tabs() { |
| 75 |
$this->tabs = [ |
| 76 |
'general' => [ |
| 77 |
'key' => 'general', |
| 78 |
'title' => 'General', |
| 79 |
'icon' => '<i class="fas fa-globe"></i>', |
| 80 |
], |
| 81 |
'elements' => [ |
| 82 |
'key' => 'elements', |
| 83 |
'title' => 'Elements', |
| 84 |
'icon' => '<i class="fas fa-th-list"></i>', |
| 85 |
], |
| 86 |
'query' => [ |
| 87 |
'key' => 'query', |
| 88 |
'title' => 'Query', |
| 89 |
'icon' => '<i class="fas fa-database"></i>', |
| 90 |
], |
| 91 |
'style' => [ |
| 92 |
'key' => 'style', |
| 93 |
'title' => 'Style', |
| 94 |
'icon' => '<i class="fas fa-palette"></i>', |
| 95 |
], |
| 96 |
'typo' => [ |
| 97 |
'key' => 'typo', |
| 98 |
'title' => 'Typo', |
| 99 |
'icon' => '<i class="fas fa-text-height"></i>', |
| 100 |
], |
| 101 |
'advance' => [ |
| 102 |
'key' => 'advance', |
| 103 |
'title' => 'Advance', |
| 104 |
'icon' => '<i class="fas fa-tools"></i>', |
| 105 |
], |
| 106 |
]; |
| 107 |
add_filter( 'wpspeedo_team/controls/tabs', function () { |
| 108 |
return wp_list_pluck( $this->tabs, 'title' ); |
| 109 |
} ); |
| 110 |
add_filter( 'wpspeedo_team/controls/default_tab', function () { |
| 111 |
return array_key_first( $this->tabs ); |
| 112 |
} ); |
| 113 |
} |
| 114 |
|
| 115 |
public function get_install_time() { |
| 116 |
return get_option( '_wpspeedo_team_installed_time' ); |
| 117 |
} |
| 118 |
|
| 119 |
} |
| 120 |
|