| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | -flush_rewrite_rules(); | |
| 2 | +//flush_rewrite_rules(); | |
| 3 | 3 | |
| 4 | 4 | $settings = LP_Settings::instance(); |
| 5 | 5 | global $wp_post_types; |
| 6 | 6 | |
| @@ -10,19 +10,14 @@ | ||
| 10 | 10 | } else { |
| 11 | 11 | $default_courses_slug = ''; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -$course_permalink = $settings->get( 'course_base' ); | |
| 15 | 14 | $courses_page_id = learn_press_get_page_id( 'courses' ); |
| 16 | -$base_slug = urldecode( ( $courses_page_id > 0 && get_post( $courses_page_id ) ) ? get_page_uri( $courses_page_id ) : _x( 'courses', 'default-slug', 'learnpress' ) ); | |
| 17 | -$course_base = _x( 'course', 'default-slug', 'learnpress' ); | |
| 15 | +$base_slug = urldecode( ( $courses_page_id > 0 && get_post( $courses_page_id ) ) ? get_page_uri( $courses_page_id ) : 'courses' ); | |
| 16 | +$course_permalink = LP_Settings::get_option( 'course_base', '/' . trailingslashit( $base_slug ) ); // option 2 | |
| 17 | +$course_base = 'course'; | |
| 18 | 18 | |
| 19 | 19 | $structures = array( |
| 20 | - 0 => array( | |
| 21 | - 'value' => '', | |
| 22 | - 'text' => esc_html__( 'Default', 'learnpress' ), | |
| 23 | - 'code' => home_url() . '/?lp_course=sample-course', | |
| 24 | - ), | |
| 25 | 20 | 1 => array( |
| 26 | 21 | 'value' => '/' . trailingslashit( $course_base ), |
| 27 | 22 | 'text' => esc_html__( 'Course', 'learnpress' ), |
| 28 | 23 | 'code' => esc_html( sprintf( '%s/%s/sample-course/', home_url(), $course_base ) ), |
| @@ -44,9 +39,11 @@ | ||
| 44 | 39 | ?> |
| 45 | 40 | |
| 46 | 41 | <tr valign="top"> |
| 47 | 42 | <th scope="row" class="titledesc"> |
| 48 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['title']; ?> <?php echo $tooltip_html; ?></label> | |
| 43 | + <label for="<?php echo esc_attr( $value['id'] ); ?>"> | |
| 44 | + <?php echo wp_kses_post( $value['title'] ); ?><?php echo wp_kses_post( $tooltip_html ); ?> | |
| 45 | + </label> | |
| 49 | 46 | </th> |
| 50 | 47 | <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">‎ |
| 51 | 48 | <ul> |
| 52 | 49 | <?php foreach ( $structures as $k => $structure ) : ?> |
| @@ -66,11 +63,14 @@ | ||
| 66 | 63 | $is_custom = false; |
| 67 | 64 | } |
| 68 | 65 | ?> |
| 69 | 66 | <label> |
| 70 | - <input name="<?php echo $value['id']; ?>" type="radio" value="<?php echo esc_attr( $structure['value'] ); ?>" class="learn-press-course-base" <?php echo $is_checked; ?> /> | |
| 71 | - <?php echo $structure['text']; ?> | |
| 72 | - <p><code><?php echo $structure['code']; ?></code></p> | |
| 67 | + <input name="<?php echo esc_attr( $value['id'] ); ?>" type="radio" | |
| 68 | + value="<?php echo esc_attr( $structure['value'] ); ?>" | |
| 69 | + class="learn-press-course-base" | |
| 70 | + <?php learn_press_echo_vuejs_write_on_php( $is_checked ); ?> /> | |
| 71 | + <?php echo wp_kses_post( $structure['text'] ); ?> | |
| 72 | + <p><code><?php echo wp_kses_post( $structure['code'] ); ?></code></p> | |
| 73 | 73 | </label> |
| 74 | 74 | </li> |
| 75 | 75 | <?php endforeach; ?> |
| 76 | 76 | |
| @@ -75,11 +75,12 @@ | ||
| 75 | 75 | <?php endforeach; ?> |
| 76 | 76 | |
| 77 | 77 | <li class="learn-press-single-course-permalink custom-base"> |
| 78 | 78 | <label> |
| 79 | - <input name="<?php echo $value['id']; ?>" id="learn_press_custom_permalink" type="radio" value="custom" <?php checked( $is_custom, true ); ?> /> | |
| 79 | + <input name="<?php echo esc_attr( $value['id'] ); ?>" id="learn_press_custom_permalink" type="radio" value="custom" <?php checked( $is_custom, true ); ?> /> | |
| 80 | 80 | <?php esc_html_e( 'Custom Base', 'learnpress' ); ?> |
| 81 | - <input name="course_permalink_structure" id="course_permalink_structure" readonly="<?php echo ! $is_custom ? 'readonly' : false; ?>" type="text" value="<?php echo $course_permalink ? esc_attr( trailingslashit( $course_permalink ) ) : ''; ?>" class="regular-text code"/> | |
| 81 | + <input name="course_permalink_structure" id="course_permalink_structure" readonly="<?php echo ! $is_custom ? 'readonly' : false; ?>" type="text" | |
| 82 | + value="<?php echo esc_attr( trailingslashit( $course_permalink ) ); ?>" class="regular-text code"/> | |
| 82 | 83 | </label> |
| 83 | 84 | <p class="description"><?php esc_html_e( 'Enter a custom base to use. A base must be set or WordPress will use default values instead.', 'learnpress' ); ?></p> |
| 84 | 85 | </li> |
| 85 | 86 | </ul> |