| 1 |
<?php |
| 2 |
/** |
| 3 |
* Settings Courses |
| 4 |
*/ |
| 5 |
$generate_course_thumbnail = get_option( 'learn_press_generate_course_thumbnail', 'no' ); |
| 6 |
$des_option_redirect_finish_course = wp_sprintf( |
| 7 |
'%s<br>%s', |
| 8 |
esc_html__( 'The site will be redirected to the URL added after clicking the finish course button.', 'learnpress' ), |
| 9 |
esc_html__( 'Set blank, the site will be redirected to the single course page', 'learnpress' ) |
| 10 |
); |
| 11 |
$layout_single_course_default = LP_Settings::get_option( 'layout_single_course', '' ); |
| 12 |
if ( empty( $layout_single_course_default ) ) { |
| 13 |
$layout_single_course_default = 'classic'; |
| 14 |
} |
| 15 |
|
| 16 |
// Temporary hide fields for the Modern layout. |
| 17 |
add_filter( |
| 18 |
'learn-press/course-settings-fields/curriculum', |
| 19 |
function ( $fields ) use ( $layout_single_course_default ) { |
| 20 |
if ( $layout_single_course_default === 'modern' ) { |
| 21 |
unset( $fields[2] ); |
| 22 |
unset( $fields[3] ); |
| 23 |
} |
| 24 |
|
| 25 |
return $fields; |
| 26 |
} |
| 27 |
); |
| 28 |
|
| 29 |
return apply_filters( |
| 30 |
'learn-press/courses-settings-fields', |
| 31 |
array_merge( |
| 32 |
apply_filters( |
| 33 |
'learn-press/course-settings-fields/general', |
| 34 |
array( |
| 35 |
array( |
| 36 |
'title' => esc_html__( 'General', 'learnpress' ), |
| 37 |
'type' => 'title', |
| 38 |
), |
| 39 |
array( |
| 40 |
'title' => esc_html__( 'Layout single course', 'learnpress' ), |
| 41 |
'desc' => esc_html__( 'Layout default display for single course. (Not apply for theme Gutenberg)', 'learnpress' ), |
| 42 |
'id' => 'layout_single_course', |
| 43 |
'default' => $layout_single_course_default, |
| 44 |
'type' => 'select', |
| 45 |
'options' => array( |
| 46 |
'modern' => esc_html__( 'Modern', 'learnpress' ), |
| 47 |
'classic' => esc_html__( 'Classic', 'learnpress' ), |
| 48 |
), |
| 49 |
), |
| 50 |
array( |
| 51 |
'title' => esc_html__( 'Review courses', 'learnpress' ), |
| 52 |
'desc' => esc_html__( 'Courses created by instructors will be pending review first.', 'learnpress' ), |
| 53 |
'id' => 'required_review', |
| 54 |
'default' => 'yes', |
| 55 |
'type' => 'checkbox', |
| 56 |
), |
| 57 |
array( |
| 58 |
'title' => esc_html__( 'Auto start', 'learnpress' ), |
| 59 |
'id' => 'auto_enroll', |
| 60 |
'default' => 'yes', |
| 61 |
'type' => 'checkbox', |
| 62 |
'desc' => esc_html__( 'Students will get started on courses immediately after successfully purchasing them.', 'learnpress' ), |
| 63 |
), |
| 64 |
array( |
| 65 |
'title' => __( 'Confirmation popup', 'learnpress' ), |
| 66 |
'desc' => __( 'Show a confirmation popup before finishing the course or completing the item.', 'learnpress' ), |
| 67 |
'id' => 'enable_popup_confirm_finish', |
| 68 |
'default' => 'yes', |
| 69 |
'type' => 'checkbox', |
| 70 |
), |
| 71 |
array( |
| 72 |
'title' => esc_html__( 'Archive page layout', 'learnpress' ), |
| 73 |
'desc' => esc_html__( 'Display the List course type on the Course Archive page.', 'learnpress' ), |
| 74 |
'id' => 'archive_courses_layout', |
| 75 |
'default' => 'list', |
| 76 |
'type' => 'select', |
| 77 |
'options' => learn_press_courses_layouts(), |
| 78 |
), |
| 79 |
array( |
| 80 |
'title' => esc_html__( 'Courses per page', 'learnpress' ), |
| 81 |
'desc' => esc_html__( 'The number of displayed courses per page.', 'learnpress' ), |
| 82 |
'id' => 'archive_course_limit', |
| 83 |
'default' => '8', |
| 84 |
'type' => 'number', |
| 85 |
'custom_attributes' => array( |
| 86 |
'min' => '1', |
| 87 |
), |
| 88 |
'css' => 'min-width: 70px; width: 70px;', |
| 89 |
), |
| 90 |
array( |
| 91 |
'title' => esc_html__( 'Include courses in subcategory', 'learnpress' ), |
| 92 |
'desc' => esc_html__( 'Show all courses within the subcategory that have not been chosen in the parent category.', 'learnpress' ), |
| 93 |
'id' => 'get_courses_of_subcategory', |
| 94 |
'default' => 'no', |
| 95 |
'type' => 'checkbox', |
| 96 |
'css' => 'min-width: 50px; width: 50px;', |
| 97 |
), |
| 98 |
array( |
| 99 |
'title' => esc_html__( 'Loading ajax Courses', 'learnpress' ), |
| 100 |
'desc' => __( 'On/Off <i>loading ajax courses on the Course Archive page </i>.', 'learnpress' ), |
| 101 |
'id' => 'courses_load_ajax', |
| 102 |
'default' => 'yes', |
| 103 |
'type' => 'checkbox', |
| 104 |
), |
| 105 |
array( |
| 106 |
'title' => esc_html__( 'Do not run Ajax when reloading the Course Archive page', 'learnpress' ), |
| 107 |
'desc' => esc_html__( 'Ajax is only applied when selecting pagination, filtering, searching, and sorting. Not applicable when reloading the Course Archive page.', 'learnpress' ), |
| 108 |
'id' => 'courses_first_no_ajax', |
| 109 |
'default' => 'no', |
| 110 |
'type' => 'checkbox', |
| 111 |
'show_if_checked' => 'courses_load_ajax', |
| 112 |
), |
| 113 |
array( |
| 114 |
'title' => esc_html__( 'Pagination Type', 'learnpress' ), |
| 115 |
'desc' => esc_html__( 'Display the pagination type on the Course Archive page.', 'learnpress' ), |
| 116 |
'id' => 'course_pagination_type', |
| 117 |
'default' => 'standard', |
| 118 |
'type' => 'select', |
| 119 |
'options' => array( |
| 120 |
'number' => esc_html__( 'Number', 'learnpress' ), |
| 121 |
'load-more' => esc_html__( 'Load More', 'learnpress' ), |
| 122 |
'infinite' => esc_html__( 'Infinite Scroll', 'learnpress' ), |
| 123 |
), |
| 124 |
'show_if_checked' => 'courses_load_ajax', |
| 125 |
), |
| 126 |
array( |
| 127 |
'title' => esc_html__( 'Thumbnail dimensions', 'learnpress' ), |
| 128 |
'id' => 'course_thumbnail_dimensions', |
| 129 |
'default' => array( 500, 300, 'yes' ), |
| 130 |
'type' => 'image-dimensions', |
| 131 |
), |
| 132 |
array( |
| 133 |
'title' => esc_html__( 'Redirect when finishing the course', 'learnpress' ), |
| 134 |
'id' => 'course_finish_redirect', |
| 135 |
'default' => '', |
| 136 |
'type' => 'url', |
| 137 |
'placeholder' => 'https://learnpresslms.com/', |
| 138 |
'desc' => $des_option_redirect_finish_course, |
| 139 |
), |
| 140 |
array( |
| 141 |
'type' => 'sectionend', |
| 142 |
), |
| 143 |
) |
| 144 |
), |
| 145 |
apply_filters( |
| 146 |
'learn-press/course-settings-fields/curriculum', |
| 147 |
array( |
| 148 |
array( |
| 149 |
'type' => 'title', |
| 150 |
'title' => esc_html__( 'Curriculum Settings', 'learnpress' ), |
| 151 |
'id' => 'lp_metabox_curriculum_setting', |
| 152 |
), |
| 153 |
array( |
| 154 |
'title' => esc_html__( 'Curriculum display', 'learnpress' ), |
| 155 |
'id' => 'curriculum_display', |
| 156 |
'default' => 'expand_first_section', |
| 157 |
'type' => 'select', |
| 158 |
'options' => array( |
| 159 |
'expand_first_section' => esc_html__( 'Expand first section', 'learnpress' ), |
| 160 |
'expand_all' => esc_html__( 'Expand all sections', 'learnpress' ), |
| 161 |
'collapse_all' => esc_html__( 'Collapse all sections', 'learnpress' ), |
| 162 |
), |
| 163 |
'desc' => esc_html__( 'Currently, apply for the Modern single course layout only.', 'learnpress' ), |
| 164 |
), |
| 165 |
array( |
| 166 |
'title' => esc_html__( 'Section Per Page', 'learnpress' ), |
| 167 |
'id' => 'section_per_page', |
| 168 |
'default' => -1, |
| 169 |
'type' => 'number', |
| 170 |
'min' => '-1', |
| 171 |
'desc' => esc_html__( 'The number of displayed sections per page (Enter -1 to display all sections).', 'learnpress' ), |
| 172 |
), |
| 173 |
array( |
| 174 |
'title' => esc_html__( 'Course Item Per Page', 'learnpress' ), |
| 175 |
'id' => 'course_item_per_page', |
| 176 |
'default' => -1, |
| 177 |
'type' => 'number', |
| 178 |
'min' => '-1', |
| 179 |
'desc' => esc_html__( 'The number of displayed course items per page in a section (Enter -1 to display all course items).', 'learnpress' ), |
| 180 |
), |
| 181 |
array( |
| 182 |
'type' => 'sectionend', |
| 183 |
'id' => 'lp_metabox_curriculum_setting', |
| 184 |
), |
| 185 |
) |
| 186 |
), |
| 187 |
apply_filters( |
| 188 |
'learn-press/course-settings-fields/quiz', |
| 189 |
array( |
| 190 |
array( |
| 191 |
'type' => 'title', |
| 192 |
'title' => esc_html__( 'Quiz Settings', 'learnpress' ), |
| 193 |
'id' => 'lp_metabox_setting_quiz', |
| 194 |
), |
| 195 |
array( |
| 196 |
'title' => esc_html__( 'Sticky Quiz Paging', 'learnpress' ), |
| 197 |
'id' => 'navigation_position', |
| 198 |
'default' => 'yes', |
| 199 |
'type' => 'checkbox', |
| 200 |
'desc' => esc_html__( 'The question\'s navigation position is sticky. If this option is disabled, the question navigation position will be below the quiz content', 'learnpress' ), |
| 201 |
), |
| 202 |
array( |
| 203 |
'type' => 'sectionend', |
| 204 |
'id' => 'lp_metabox_setting_quiz', |
| 205 |
), |
| 206 |
) |
| 207 |
), |
| 208 |
apply_filters( |
| 209 |
'learn-press/course-settings-fields/material', |
| 210 |
array( |
| 211 |
array( |
| 212 |
'type' => 'title', |
| 213 |
'title' => esc_html__( 'Material Settings', 'learnpress' ), |
| 214 |
'id' => 'lp_course_material_setting', |
| 215 |
), |
| 216 |
array( |
| 217 |
'title' => esc_html__( 'File Type', 'learnpress' ), |
| 218 |
'id' => 'material_allow_file_type', |
| 219 |
'type' => 'multiselect', |
| 220 |
'is_optgroup' => '1', |
| 221 |
'class' => 'lp-tom-select', |
| 222 |
'default' => array( 'pdf', 'txt' ), |
| 223 |
'desc' => esc_html__( 'Which types of file will be allowed uploading?', 'learnpress' ), |
| 224 |
'options' => array( |
| 225 |
'document' => array( |
| 226 |
'txt' => '.txt(text/plain)', |
| 227 |
'doc,docx' => '.doc, .docx (Microsoft Word)', |
| 228 |
'pdf' => '.pdf (Portable Document Format)', |
| 229 |
), |
| 230 |
'image' => array( |
| 231 |
'jpg,jpeg' => '.jpg, .jpeg (Joint Photographic Experts Group)', |
| 232 |
'png' => '.png (Portable Network Graphics)', |
| 233 |
'gif' => '.gif (Graphics Interchange Format)', |
| 234 |
'bmp' => '.bmp (Bitmap)', |
| 235 |
), |
| 236 |
'audio' => array( |
| 237 |
'mp3' => '.mp3 (MPEG Audio Layer 3)', |
| 238 |
'wav' => '.wav (Waveform Audio File Format)', |
| 239 |
'wma' => '.wma (Windows Media Audio)', |
| 240 |
), |
| 241 |
'video' => array( |
| 242 |
'mp4' => '.mp4 (MPEG-4 Part 14)', |
| 243 |
'avi' => '.avi (Audio Video Interleave)', |
| 244 |
'mov' => '.mov (QuickTime Movie)', |
| 245 |
'wmv' => '.wmv (Windows Media Video)', |
| 246 |
), |
| 247 |
'spreadsheet' => array( |
| 248 |
'xls,xlsx' => '.xls, .xlsx (Microsoft Excel)', |
| 249 |
'ods' => '.ods (OpenDocument Spreadsheet)', |
| 250 |
'csv' => '.csv (Comma-Separated Values)', |
| 251 |
'numbers' => '.numbers (Apple Numbers)', |
| 252 |
'tsv' => '.tsv (Tab-Separated Values)', |
| 253 |
), |
| 254 |
'compressed archive' => array( |
| 255 |
'zip' => 'ZIP archive', |
| 256 |
), |
| 257 |
), |
| 258 |
'custom_attributes' => array( |
| 259 |
'required' => '1', |
| 260 |
), |
| 261 |
), |
| 262 |
array( |
| 263 |
'title' => esc_html__( 'Upload Files', 'learnpress' ), |
| 264 |
'id' => 'material_upload_files', |
| 265 |
'default' => 2, |
| 266 |
'type' => 'number', |
| 267 |
'desc' => esc_html__( 'Number files the user can upload. Set to 0 to disable', 'learnpress' ), |
| 268 |
'custom_attributes' => array( |
| 269 |
'min' => '0', |
| 270 |
), |
| 271 |
), |
| 272 |
array( |
| 273 |
'title' => esc_html__( 'File Size Limit', 'learnpress' ), |
| 274 |
'id' => 'material_max_file_size', |
| 275 |
'default' => 2, |
| 276 |
'type' => 'number', |
| 277 |
'desc' => esc_html__( 'Set Maximum Attachment size for upload (MB)', 'learnpress' ), |
| 278 |
'custom_attributes' => array( |
| 279 |
'min' => '1', |
| 280 |
), |
| 281 |
), |
| 282 |
array( |
| 283 |
'title' => esc_html__( 'File Per Page', 'learnpress' ), |
| 284 |
'id' => 'material_file_per_page', |
| 285 |
'default' => -1, |
| 286 |
'type' => 'number', |
| 287 |
'desc' => esc_html__( 'The number of displayed files per page (Enter -1 to display all files, set to 0 to disable).', 'learnpress' ), |
| 288 |
'custom_attributes' => array( |
| 289 |
'min' => '-1', |
| 290 |
), |
| 291 |
), |
| 292 |
array( |
| 293 |
'title' => esc_html__( 'Url nofollow', 'learnpress' ), |
| 294 |
'desc' => esc_html__( 'Add rel="nofollow" to material external link.', 'learnpress' ), |
| 295 |
'id' => 'material_url_nofollow', |
| 296 |
'default' => 'yes', |
| 297 |
'type' => 'checkbox', |
| 298 |
), |
| 299 |
array( |
| 300 |
'type' => 'sectionend', |
| 301 |
'id' => 'lp_course_material_setting', |
| 302 |
), |
| 303 |
) |
| 304 |
), |
| 305 |
apply_filters( |
| 306 |
'learn-press/course-settings-fields/instructor', |
| 307 |
array( |
| 308 |
array( |
| 309 |
'type' => 'title', |
| 310 |
'title' => esc_html__( 'Instructor Settings', 'learnpress' ), |
| 311 |
'id' => 'lp_metabox_instructor_setting', |
| 312 |
), |
| 313 |
array( |
| 314 |
'title' => esc_html__( 'Instructor Per Page', 'learnpress' ), |
| 315 |
'id' => 'instructor_per_page', |
| 316 |
'default' => 12, |
| 317 |
'type' => 'number', |
| 318 |
'desc' => esc_html__( 'The number of displayed instructors per page (Enter -1 to display all sections).', 'learnpress' ), |
| 319 |
), |
| 320 |
array( |
| 321 |
'title' => esc_html__( 'Show Admin on list', 'learnpress' ), |
| 322 |
'id' => 'show_admin_on_list_instructors', |
| 323 |
'default' => 'yes', |
| 324 |
'type' => 'checkbox', |
| 325 |
'desc' => esc_html__( 'Show author Admin on list instructors.', 'learnpress' ), |
| 326 |
), |
| 327 |
array( |
| 328 |
'type' => 'sectionend', |
| 329 |
'id' => 'lp_metabox_instructor_setting', |
| 330 |
), |
| 331 |
) |
| 332 |
) |
| 333 |
) |
| 334 |
); |
| 335 |
|