| 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 |
'database' => __( 'Database', 'learnpress' ), |
| 22 |
'template' => __( 'Templates', 'learnpress' ), |
| 23 |
'lp_beta_version' => __( 'LearnPress Beta Version', 'learnpress' ), |
| 24 |
) |
| 25 |
); |
| 26 |
|
| 27 |
parent::__construct(); |
| 28 |
//$this->_process_actions(); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* @deprecated 4.1.7.3 |
| 33 |
*/ |
| 34 |
protected function _process_actions() { |
| 35 |
_deprecated_function( __METHOD__, '4.1.7.3' ); |
| 36 |
/*$has_action = true; |
| 37 |
switch ( LP_Request::get( 'page' ) ) { |
| 38 |
default: |
| 39 |
$has_action = false; |
| 40 |
} |
| 41 |
|
| 42 |
$nonce = LP_Request::get( '_wpnonce' ); |
| 43 |
|
| 44 |
if ( LP_Request::get( 'generate-cron-url' ) && $nonce ) { |
| 45 |
if ( wp_verify_nonce( $nonce ) ) { |
| 46 |
delete_option( 'learnpress_cron_url_nonce' ); |
| 47 |
|
| 48 |
wp_redirect( esc_url_raw( remove_query_arg( array( 'generate-cron-url', '_wpnonce' ) ) ) ); |
| 49 |
die(); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
if ( $has_action ) { |
| 54 |
die(); |
| 55 |
}*/ |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Show tools for database. |
| 60 |
* |
| 61 |
* @return void |
| 62 |
*/ |
| 63 |
public function page_content_database() { |
| 64 |
learn_press_admin_view( 'tools/html-database' ); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Show template override by theme. |
| 69 |
* |
| 70 |
* @return void |
| 71 |
*/ |
| 72 |
public function page_content_template() { |
| 73 |
learn_press_admin_view( 'tools/html-template' ); |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* Show tools course data. |
| 78 |
* |
| 79 |
* @return void |
| 80 |
*/ |
| 81 |
public function page_content_course() { |
| 82 |
learn_press_admin_view( 'tools/html-course' ); |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Show beta version LP. |
| 87 |
* |
| 88 |
* @return void |
| 89 |
*/ |
| 90 |
public function page_content_lp_beta_version() { |
| 91 |
$lp_beta_version_info = LP_Admin_Notice::check_lp_beta_version(); |
| 92 |
learn_press_admin_view( |
| 93 |
'admin-notices/beta-version', |
| 94 |
[ |
| 95 |
'data' => [ |
| 96 |
'check' => 1, |
| 97 |
'info' => $lp_beta_version_info, |
| 98 |
], |
| 99 |
] |
| 100 |
); |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* Display page |
| 105 |
*/ |
| 106 |
public function page_content() { |
| 107 |
parent::page_content(); |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
return new LP_Submenu_Tools(); |
| 112 |
|