PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
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
← All changes | inc/admin/settings/class-lp-settings-permalink.php +40 -1 4.2.04.4.8 View file →
@@ -1,6 +1,8 @@
1 1 <?php
2 2
3 +use LearnPress\Helpers\Config;
4 +
3 5 /**
4 6 * Class LP_Settings_Permalink
5 7 *
6 8 * @author ThimPress
@@ -27,9 +29,46 @@
27 29 *
28 30 * @return mixed
29 31 */
30 32 public function get_settings( $section = '', $tab = '' ) {
31 - return require_once LP_PLUGIN_PATH . 'config/settings/permalink.php';
33 + return Config::instance()->get( 'permalink', 'settings' );
32 34 }
33 35
36 + /**
37 + * @since 4.3.2.3
38 + *
39 + * move from LP_Settings_Courses class to here
40 + */
41 + public function save() {
42 + $course_permalink = trim( LP_Request::get_param( 'learn_press_course_base' ) );
43 + if ( ! $course_permalink ) {
44 + return;
45 + }
46 +
47 + if ( $course_permalink == 'custom' ) {
48 + $course_permalink = trim( LP_Request::get_param( 'course_permalink_structure' ), '/' );
49 +
50 + if ( '%course_category%' == $course_permalink ) {
51 + $course_permalink = _x( 'courses', 'slug', 'learnpress' ) . '/' . $course_permalink;
52 + }
53 +
54 + $course_permalink = '/' . $course_permalink;
55 + update_option( 'learn_press_course_base_type', 'custom' );
56 + } else {
57 + delete_option( 'learn_press_course_base_type' );
58 + }
59 +
60 + $course_base = untrailingslashit( $course_permalink );
61 +
62 + update_option( 'learn_press_course_base', $course_base );
63 + //$courses_page_id = learn_press_get_page_id( 'courses' );
64 + //$courses_permalink = ( $courses_page_id > 0 && get_post( $courses_page_id ) ) ? get_page_uri( $courses_page_id ) : _x( 'courses', 'default-slug', 'learnpress' );
65 +
66 + /*if ( $courses_page_id && trim( $course_base, '/' ) === $courses_permalink ) {
67 + update_option( 'learn_press_use_verbose_page_rules', 'yes' );
68 + } else {
69 + delete_option( 'learn_press_use_verbose_page_rules' );
70 + }*/
71 + }
34 72 }
73 +
35 74 return new LP_Settings_Permalink();