| @@ -1,88 +1,88 @@ | ||
| 1 | -<?php | |
| 2 | -//flush_rewrite_rules(); | |
| 3 | - | |
| 4 | -$settings = LP_Settings::instance(); | |
| 5 | -global $wp_post_types; | |
| 6 | - | |
| 7 | -if ( ! empty( $wp_post_types[ LP_COURSE_CPT ] ) ) { | |
| 8 | - $course_type = $wp_post_types[ LP_COURSE_CPT ]; | |
| 9 | - $default_courses_slug = $course_type->rewrite['slug']; | |
| 10 | -} else { | |
| 11 | - $default_courses_slug = ''; | |
| 12 | -} | |
| 13 | - | |
| 14 | -$courses_page_id = learn_press_get_page_id( 'courses' ); | |
| 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 | - | |
| 19 | -$structures = array( | |
| 20 | - 1 => array( | |
| 21 | - 'value' => '/' . trailingslashit( $course_base ), | |
| 22 | - 'text' => esc_html__( 'Course', 'learnpress' ), | |
| 23 | - 'code' => esc_html( sprintf( '%s/%s/sample-course/', home_url(), $course_base ) ), | |
| 24 | - ), | |
| 25 | - 2 => array( | |
| 26 | - 'value' => '/' . trailingslashit( $base_slug ), | |
| 27 | - 'text' => esc_html__( 'Courses base', 'learnpress' ), | |
| 28 | - 'code' => esc_html( sprintf( '%s/%s/sample-course/', home_url(), $base_slug ) ), | |
| 29 | - ), | |
| 30 | - 3 => array( | |
| 31 | - 'value' => '/' . trailingslashit( $base_slug ) . trailingslashit( '%course_category%' ), | |
| 32 | - 'text' => esc_html__( 'Courses base with category', 'learnpress' ), | |
| 33 | - 'code' => esc_html( sprintf( '%s/%s/course-category/sample-course/', home_url(), $base_slug ) ), | |
| 34 | - ), | |
| 35 | -); | |
| 36 | - | |
| 37 | -$base_type = get_option( 'learn_press_course_base_type' ); | |
| 38 | -$is_custom = ( $base_type == 'custom' && $course_permalink != '' ); | |
| 39 | -?> | |
| 40 | - | |
| 41 | -<tr valign="top"> | |
| 42 | - <th scope="row" class="titledesc"> | |
| 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> | |
| 46 | - </th> | |
| 47 | - <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">‎ | |
| 48 | - <ul> | |
| 49 | - <?php foreach ( $structures as $k => $structure ) : ?> | |
| 50 | - <li class="learn-press-single-course-permalink | |
| 51 | - <?php | |
| 52 | - if ( $k == 2 || $k == 3 ) { | |
| 53 | - echo ' learn-press-courses-page-id'; | |
| 54 | - echo ! $courses_page_id ? ' hide-if-js' : ''; | |
| 55 | - } | |
| 56 | - ?> | |
| 57 | - " style="margin-bottom: 20px;"> | |
| 58 | - <?php | |
| 59 | - $is_checked = ( $course_permalink == '' && $structure['value'] == '' ) || ( $structure['value'] == trailingslashit( $course_permalink ) ); | |
| 60 | - $is_checked = checked( $is_checked, true, false ); | |
| 61 | - | |
| 62 | - if ( $is_custom && $is_checked ) { | |
| 63 | - $is_custom = false; | |
| 64 | - } | |
| 65 | - ?> | |
| 66 | - <label> | |
| 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 | - </label> | |
| 74 | - </li> | |
| 75 | - <?php endforeach; ?> | |
| 76 | - | |
| 77 | - <li class="learn-press-single-course-permalink custom-base"> | |
| 78 | - <label> | |
| 79 | - <input name="<?php echo esc_attr( $value['id'] ); ?>" id="learn_press_custom_permalink" type="radio" value="custom" <?php checked( $is_custom, true ); ?> /> | |
| 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" | |
| 82 | - value="<?php echo esc_attr( trailingslashit( $course_permalink ) ); ?>" class="regular-text code"/> | |
| 83 | - </label> | |
| 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> | |
| 85 | - </li> | |
| 86 | - </ul> | |
| 87 | - </td> | |
| 88 | -</tr> | |
| 1 | +<?php | |
| 2 | +//flush_rewrite_rules(); | |
| 3 | + | |
| 4 | +$settings = LP_Settings::instance(); | |
| 5 | +global $wp_post_types; | |
| 6 | + | |
| 7 | +if ( ! empty( $wp_post_types[ LP_COURSE_CPT ] ) ) { | |
| 8 | + $course_type = $wp_post_types[ LP_COURSE_CPT ]; | |
| 9 | + $default_courses_slug = $course_type->rewrite['slug']; | |
| 10 | +} else { | |
| 11 | + $default_courses_slug = ''; | |
| 12 | +} | |
| 13 | + | |
| 14 | +$courses_page_id = learn_press_get_page_id( 'courses' ); | |
| 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 | + | |
| 19 | +$structures = array( | |
| 20 | + 1 => array( | |
| 21 | + 'value' => '/' . trailingslashit( $course_base ), | |
| 22 | + 'text' => esc_html__( 'Course', 'learnpress' ), | |
| 23 | + 'code' => esc_html( sprintf( '%s/%s/sample-course/', home_url(), $course_base ) ), | |
| 24 | + ), | |
| 25 | + 2 => array( | |
| 26 | + 'value' => '/' . trailingslashit( $base_slug ), | |
| 27 | + 'text' => esc_html__( 'Courses base', 'learnpress' ), | |
| 28 | + 'code' => esc_html( sprintf( '%s/%s/sample-course/', home_url(), $base_slug ) ), | |
| 29 | + ), | |
| 30 | + 3 => array( | |
| 31 | + 'value' => '/' . trailingslashit( $base_slug ) . trailingslashit( '%course_category%' ), | |
| 32 | + 'text' => esc_html__( 'Courses base with category', 'learnpress' ), | |
| 33 | + 'code' => esc_html( sprintf( '%s/%s/course-category/sample-course/', home_url(), $base_slug ) ), | |
| 34 | + ), | |
| 35 | +); | |
| 36 | + | |
| 37 | +$base_type = get_option( 'learn_press_course_base_type' ); | |
| 38 | +$is_custom = ( $base_type == 'custom' && $course_permalink != '' ); | |
| 39 | +?> | |
| 40 | + | |
| 41 | +<tr valign="top"> | |
| 42 | + <th scope="row" class="titledesc"> | |
| 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> | |
| 46 | + </th> | |
| 47 | + <td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">‎ | |
| 48 | + <ul> | |
| 49 | + <?php foreach ( $structures as $k => $structure ) : ?> | |
| 50 | + <li class="learn-press-single-course-permalink | |
| 51 | + <?php | |
| 52 | + if ( $k == 2 || $k == 3 ) { | |
| 53 | + echo ' learn-press-courses-page-id'; | |
| 54 | + echo ! $courses_page_id ? ' hide-if-js' : ''; | |
| 55 | + } | |
| 56 | + ?> | |
| 57 | + " style="margin-bottom: 20px;"> | |
| 58 | + <?php | |
| 59 | + $is_checked = ( $course_permalink == '' && $structure['value'] == '' ) || ( $structure['value'] == trailingslashit( $course_permalink ) ); | |
| 60 | + $is_checked = checked( $is_checked, true, false ); | |
| 61 | + | |
| 62 | + if ( $is_custom && $is_checked ) { | |
| 63 | + $is_custom = false; | |
| 64 | + } | |
| 65 | + ?> | |
| 66 | + <label> | |
| 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 | + </label> | |
| 74 | + </li> | |
| 75 | + <?php endforeach; ?> | |
| 76 | + | |
| 77 | + <li class="learn-press-single-course-permalink custom-base"> | |
| 78 | + <label> | |
| 79 | + <input name="<?php echo esc_attr( $value['id'] ); ?>" id="learn_press_custom_permalink" type="radio" value="custom" <?php checked( $is_custom, true ); ?> /> | |
| 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" | |
| 82 | + value="<?php echo esc_attr( trailingslashit( $course_permalink ) ); ?>" class="regular-text code"/> | |
| 83 | + </label> | |
| 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> | |
| 85 | + </li> | |
| 86 | + </ul> | |
| 87 | + </td> | |
| 88 | +</tr> | |