PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7.3
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7.3
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / admin / sub-menus / class-lp-submenu-settings.php

class-lp-submenu-settings.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.7.3, at inc/admin/sub-menus/class-lp-submenu-settings.php

108 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit();
3
4 /**
5 * Class LP_Submenu_Settings
6 */
7 class LP_Submenu_Settings extends LP_Abstract_Submenu {
8 /**
9 * @var LP_Abstract_Settings_Page[]
10 */
11 protected $tabs = array();
12
13 /**
14 * LP_Submenu_Settings constructor.
15 */
16 public function __construct() {
17 $this->id = 'learn-press-settings';
18 $this->menu_title = esc_html__( 'Settings', 'learnpress' );
19 $this->page_title = esc_html__( 'LearnPress Settings', 'learnpress' );
20 $this->priority = 30;
21 $this->callback = [ $this, 'display' ];
22
23 $this->tabs = apply_filters(
24 'learn-press/admin/settings-tabs-array',
25 array(
26 'general' => include_once LP_PLUGIN_PATH . 'inc/admin/settings/class-lp-settings-general.php',
27 'courses' => new LP_Settings_Courses(),
28 'profile' => include_once LP_PLUGIN_PATH . 'inc/admin/settings/class-lp-settings-profile.php',
29 'payments' => include_once LP_PLUGIN_PATH . 'inc/admin/settings/class-lp-settings-payments.php',
30 'emails' => include_once LP_PLUGIN_PATH . 'inc/admin/settings/class-lp-settings-emails.php',
31 'advanced' => include_once LP_PLUGIN_PATH . 'inc/admin/settings/class-lp-settings-advanced.php',
32 )
33 );
34
35 add_action( 'learn-press/admin/page-content-settings', array( $this, 'page_contents' ) );
36 add_action( 'learn-press/admin/page-' . $this->_get_page() . '/section-content', array( $this, 'section_content' ) );
37
38 /** Save metabox in LP4 */
39 add_action( 'admin_init', array( $this, 'save_settings' ) );
40
41 parent::__construct();
42 }
43
44 /**
45 * Display menu content
46 */
47 public function page_content() {
48 parent::page_content();
49 }
50
51 public function page_contents() {
52 $active_tab = $this->get_active_tab();
53
54 $this->tabs[ $active_tab ]->admin_page_settings( $this->get_active_section(), $this->get_sections() );
55 ?>
56
57 <input type="hidden" name="lp-settings-nonce" value="<?php echo wp_create_nonce( 'lp-settings' ); ?>">
58 <p class="lp-admin-settings-buttons">
59 <button class="button button-primary"><?php esc_html_e( 'Save settings', 'learnpress' ); ?></button>
60 </p>
61
62 <?php
63 }
64
65 public function section_content( $section ) {
66 }
67
68 /**
69 * Update metabox setting
70 *
71 * @return void
72 * @version 4.0.0
73 * @author ThimPress <nhamdv>
74 */
75 public function save_settings() {
76 if ( ! is_admin() || ! isset( $_GET['page'] ) || 'learn-press-settings' !== $_GET['page'] ) {
77 return;
78 }
79
80 $nonce = learn_press_get_request( 'lp-settings-nonce' );
81
82 if ( ! wp_verify_nonce( $nonce, 'lp-settings' ) ) {
83 return;
84 }
85
86 $active_tab = $this->get_active_tab();
87
88 $this->tabs[ $active_tab ]->save_settings( $this->get_active_section(), $this->get_sections() );
89
90 // flush_rewrite_rules();
91
92 do_action( 'learn-press/update-settings/updated', $this );
93
94 // Filter redirect
95 $redirect = apply_filters( 'learn-press/update-settings/redirect', esc_url_raw( add_query_arg( 'settings-updated', 'yes' ) ), $this );
96
97 if ( $redirect ) {
98 wp_redirect( $redirect );
99 exit();
100 }
101 }
102
103 public function save() {
104 }
105 }
106
107 return new LP_Submenu_Settings();
108