| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class LP_Submenu_Addons |
| 4 |
* |
| 5 |
* @since 3.0.0 |
| 6 |
*/ |
| 7 |
class LP_Submenu_Addons extends LP_Abstract_Submenu { |
| 8 |
|
| 9 |
/** |
| 10 |
* LP_Submenu_Addons constructor. |
| 11 |
*/ |
| 12 |
public function __construct() { |
| 13 |
$this->id = 'learn-press-addons'; |
| 14 |
$this->menu_title = __( 'Add-ons', 'learnpress' ); |
| 15 |
$this->page_title = __( 'LearnPress Add-ons', 'learnpress' ); |
| 16 |
$this->priority = 20; |
| 17 |
|
| 18 |
$this->add_ons_tabs(); |
| 19 |
|
| 20 |
parent::__construct(); |
| 21 |
} |
| 22 |
|
| 23 |
public function add_ons_tabs() { |
| 24 |
// Check is page addons |
| 25 |
$current_page = LP_Helper::getUrlCurrent(); |
| 26 |
$pattern = '/.*page=learn-press-addons.*/'; |
| 27 |
$match = preg_match( $pattern, $current_page, $matches ); |
| 28 |
if ( ! $match ) { |
| 29 |
return; |
| 30 |
} |
| 31 |
|
| 32 |
$tabs = array( |
| 33 |
'more' => sprintf( __( 'Get more (%d)', 'learnpress' ), LP_Plugins_Helper::count_plugins() ), |
| 34 |
'installed' => sprintf( __( 'Installed (%d)', 'learnpress' ), LP_Plugins_Helper::count_plugins( 'installed' ) ), |
| 35 |
'themes' => sprintf( __( 'Themes (%d)', 'learnpress' ), LP_Plugins_Helper::count_themes() ), |
| 36 |
); |
| 37 |
|
| 38 |
$this->tabs = apply_filters( |
| 39 |
'learn-press/admin/page-addons-tabs', |
| 40 |
$tabs |
| 41 |
); |
| 42 |
} |
| 43 |
|
| 44 |
public function page_content_installed() { |
| 45 |
$this->page_content_search_form(); |
| 46 |
learn_press_admin_view( 'addons/html-plugins-installed' ); |
| 47 |
} |
| 48 |
|
| 49 |
public function page_content_more() { |
| 50 |
$this->page_content_search_form(); |
| 51 |
learn_press_admin_view( 'addons/html-plugins-more' ); |
| 52 |
} |
| 53 |
|
| 54 |
public function page_content_themes() { |
| 55 |
$this->page_content_search_form(); |
| 56 |
learn_press_admin_view( 'addons/html-themes' ); |
| 57 |
} |
| 58 |
|
| 59 |
public function page_content_search_form() { |
| 60 |
?> |
| 61 |
|
| 62 |
<p class="search-box"> |
| 63 |
<input type="text" class="lp-search-addon" value="" placeholder="<?php esc_attr_e( 'Search...', 'learnpress' ); ?>"> |
| 64 |
</p> |
| 65 |
|
| 66 |
<?php |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
return new LP_Submenu_Addons(); |
| 71 |
|