| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class LP_Submenu_Tools |
| 4 |
*/ |
| 5 |
class LP_Submenu_Tools extends LP_Abstract_Submenu { |
| 6 |
|
| 7 |
/** |
| 8 |
* LP_Submenu_Tools constructor. |
| 9 |
*/ |
| 10 |
public function __construct() { |
| 11 |
$this->id = 'learn-press-tools'; |
| 12 |
$this->menu_title = __( 'Tools', 'learnpress' ); |
| 13 |
$this->page_title = __( 'LearnPress Tools', 'learnpress' ); |
| 14 |
$this->priority = 40; |
| 15 |
$this->callback = [ $this, 'display' ]; |
| 16 |
|
| 17 |
$this->tabs = apply_filters( |
| 18 |
'learn-press/admin/tools-tabs', |
| 19 |
array( |
| 20 |
'course' => __( 'Course Data', 'learnpress' ), |
| 21 |
'assign_course' => __( 'Assign/Unassigned Course', 'learnpress' ), |
| 22 |
'database' => __( 'Database', 'learnpress' ), |
| 23 |
'template' => __( 'Templates', 'learnpress' ), |
| 24 |
'lp_beta_version' => __( 'LearnPress Beta Version', 'learnpress' ), |
| 25 |
'cache' => __( 'Cache', 'learnpress' ), |
| 26 |
) |
| 27 |
); |
| 28 |
|
| 29 |
parent::__construct(); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Show tools for database. |
| 34 |
* |
| 35 |
* @return void |
| 36 |
*/ |
| 37 |
public function page_content_database() { |
| 38 |
learn_press_admin_view( 'tools/html-database' ); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Show template override by theme. |
| 43 |
* |
| 44 |
* @return void |
| 45 |
*/ |
| 46 |
public function page_content_template() { |
| 47 |
learn_press_admin_view( 'tools/html-template' ); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Show tools course data. |
| 52 |
* |
| 53 |
* @return void |
| 54 |
*/ |
| 55 |
public function page_content_course() { |
| 56 |
learn_press_admin_view( 'tools/html-course' ); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Show beta version LP. |
| 61 |
* |
| 62 |
* @return void |
| 63 |
*/ |
| 64 |
public function page_content_lp_beta_version() { |
| 65 |
$lp_beta_version_info = LP_Admin_Notice::check_lp_beta_version(); |
| 66 |
learn_press_admin_view( |
| 67 |
'admin-notices/beta-version', |
| 68 |
[ |
| 69 |
'data' => [ |
| 70 |
'check' => 1, |
| 71 |
'info' => $lp_beta_version_info, |
| 72 |
], |
| 73 |
] |
| 74 |
); |
| 75 |
} |
| 76 |
|
| 77 |
public function page_content_assign_course() { |
| 78 |
learn_press_admin_view( 'tools/course/html-assign-course' ); |
| 79 |
learn_press_admin_view( 'tools/course/html-unassign-course' ); |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* Temporary, go to this page run clear all cache |
| 84 |
* |
| 85 |
* @since 4.2.5.4 |
| 86 |
* @version 1.0.0 |
| 87 |
*/ |
| 88 |
public function page_content_cache() { |
| 89 |
$lp_cache = new LP_Cache( true ); |
| 90 |
$lp_cache->clear_all(); |
| 91 |
|
| 92 |
echo sprintf( |
| 93 |
'<form action="" method="post"><button class="button button-primary" type="submit">%s</button></form>', |
| 94 |
__( 'Clear all cache', 'learnpress' ) |
| 95 |
); |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Display page |
| 100 |
*/ |
| 101 |
public function page_content() { |
| 102 |
parent::page_content(); |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
return new LP_Submenu_Tools(); |
| 107 |
|