Addons.php
4 years ago
Admin.php
4 years ago
Ajax.php
4 years ago
Assets.php
4 years ago
Course.php
4 years ago
Course_Filter.php
4 years ago
Course_Settings_Tabs.php
4 years ago
Course_Widget.php
4 years ago
Custom_Validation.php
5 years ago
Dashboard.php
4 years ago
Email.php
5 years ago
FormHandler.php
4 years ago
Frontend.php
5 years ago
Gutenberg.php
4 years ago
Instructor.php
4 years ago
Instructors_List.php
4 years ago
Lesson.php
4 years ago
Options.php
4 years ago
Post_types.php
4 years ago
Private_Course_Access.php
5 years ago
Q_and_A.php
4 years ago
Question_Answers_List.php
4 years ago
Quiz.php
4 years ago
Quiz_Attempts_List.php
4 years ago
RestAPI.php
4 years ago
Rewrite_Rules.php
4 years ago
Shortcode.php
4 years ago
Student.php
4 years ago
Students_List.php
4 years ago
Taxonomies.php
4 years ago
Template.php
4 years ago
Theme_Compatibility.php
5 years ago
Tools.php
4 years ago
Tutor.php
4 years ago
TutorEDD.php
4 years ago
Tutor_Base.php
5 years ago
Tutor_List_Table.php
4 years ago
Tutor_Setup.php
4 years ago
Upgrader.php
4 years ago
User.php
4 years ago
Utils.php
4 years ago
Video_Stream.php
4 years ago
Withdraw.php
4 years ago
Withdraw_Requests_List.php
4 years ago
WooCommerce.php
4 years ago
Options.php
841 lines
| 1 | <?php |
| 2 | namespace Tutor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) |
| 5 | exit; |
| 6 | |
| 7 | class Options { |
| 8 | |
| 9 | private $option; |
| 10 | |
| 11 | public function __construct() { |
| 12 | //Saving option |
| 13 | add_action('wp_ajax_tutor_option_save', array($this, 'tutor_option_save')); |
| 14 | } |
| 15 | |
| 16 | private function get($key = null, $default = false){ |
| 17 | !$this->option ? $this->option = (array) maybe_unserialize(get_option('tutor_option')) : 0; |
| 18 | if (empty($this->option) || ! is_array($this->option)){ |
| 19 | return $default; |
| 20 | } |
| 21 | if ( ! $key){ |
| 22 | return $this->option; |
| 23 | } |
| 24 | if (array_key_exists($key, $this->option)){ |
| 25 | return apply_filters($key, $this->option[$key]); |
| 26 | } |
| 27 | //Access array value via dot notation, such as option->get('value.subvalue') |
| 28 | if (strpos($key, '.')){ |
| 29 | $option_key_array = explode('.', $key); |
| 30 | $new_option = $this->option; |
| 31 | foreach ($option_key_array as $dotKey){ |
| 32 | if (isset($new_option[$dotKey])){ |
| 33 | $new_option = $new_option[$dotKey]; |
| 34 | }else{ |
| 35 | return $default; |
| 36 | } |
| 37 | } |
| 38 | return apply_filters($key, $new_option); |
| 39 | } |
| 40 | |
| 41 | return $default; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Sanitize settings options |
| 46 | */ |
| 47 | public function tutor_sanitize_settings_options( $input ) { |
| 48 | if ( ! empty( $_POST['tutor_option'][$input] ) ) { |
| 49 | return sanitize_text_field( $_POST['tutor_option'][$input] ); |
| 50 | } |
| 51 | |
| 52 | return ''; |
| 53 | } |
| 54 | |
| 55 | public function tutor_option_save(){ |
| 56 | tutils()->checking_nonce(); |
| 57 | |
| 58 | !current_user_can( 'manage_options' ) ? wp_send_json_error( ) : 0; |
| 59 | |
| 60 | do_action('tutor_option_save_before'); |
| 61 | |
| 62 | $option = (array) tutils()->array_get('tutor_option', $_POST, array()); |
| 63 | $option = tutor_sanitize_data($option); |
| 64 | |
| 65 | foreach ( $option as $key => $value ) { |
| 66 | if ( 'login_error_message' === $key ) { |
| 67 | $option['login_error_message'] = $this->tutor_sanitize_settings_options( 'login_error_message' ); |
| 68 | } elseif ( 'lesson_permalink_base' === $key ) { |
| 69 | $option['lesson_permalink_base'] = $this->tutor_sanitize_settings_options( 'lesson_permalink_base' ); |
| 70 | } elseif ( 'lesson_video_duration_youtube_api_key' === $key ) { |
| 71 | $option['lesson_video_duration_youtube_api_key'] = $this->tutor_sanitize_settings_options( 'lesson_video_duration_youtube_api_key' ); |
| 72 | } elseif ( 'email_from_name' === $key ) { |
| 73 | $option['email_from_name'] = $this->tutor_sanitize_settings_options( 'email_from_name' ); |
| 74 | } elseif ( 'email_from_address' === $key ) { |
| 75 | $option['email_from_address'] = $this->tutor_sanitize_settings_options( 'email_from_address' ); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | $option = apply_filters('tutor_option_input', $option); |
| 80 | |
| 81 | update_option('tutor_option', $option); |
| 82 | |
| 83 | do_action('tutor_option_save_after'); |
| 84 | //re-sync settings |
| 85 | //init::tutor_activate(); |
| 86 | |
| 87 | wp_send_json_success( array('msg' => __('Option Updated', 'tutor') ) ); |
| 88 | } |
| 89 | |
| 90 | public function options_attr(){ |
| 91 | $pages = tutor_utils()->get_pages(); |
| 92 | $current_user = wp_get_current_user(); |
| 93 | //$course_base = tutor_utils()->course_archive_page_url(); |
| 94 | $lesson_sample_url_text = __( "/course/sample-course/<code>lessons</code>/sample-lesson/", 'tutor' ); |
| 95 | $lesson_url = site_url().$lesson_sample_url_text; |
| 96 | |
| 97 | $student_url = site_url().'/'._x( 'profile', 'tutor student profile', 'tutor' ).'/'.$current_user->display_name ; |
| 98 | |
| 99 | $attempts_allowed = array(); |
| 100 | $attempts_allowed['unlimited'] = __('Unlimited' , 'tutor'); |
| 101 | $attempts_allowed = array_merge($attempts_allowed, array_combine(range(1,20), range(1,20))); |
| 102 | |
| 103 | $video_sources = array( |
| 104 | 'html5' => __('HTML 5 (mp4)', 'tutor'), |
| 105 | 'external_url' => __('External URL', 'tutor'), |
| 106 | 'youtube' => __('Youtube', 'tutor'), |
| 107 | 'vimeo' => __('Vimeo', 'tutor'), |
| 108 | 'embedded' => __('Embedded', 'tutor'), |
| 109 | 'shortcode' => __('Shortcode', 'tutor') |
| 110 | ); |
| 111 | |
| 112 | $course_filters = array( |
| 113 | 'search' => __('Keyword Search', 'tutor'), |
| 114 | 'category' => __('Category', 'tutor'), |
| 115 | 'tag' => __('Tag', 'tutor'), |
| 116 | 'difficulty_level' => __('Difficulty Level', 'tutor'), |
| 117 | 'price_type' => __('Price Type', 'tutor') |
| 118 | ); |
| 119 | |
| 120 | $attr = array( |
| 121 | 'general' => array( |
| 122 | 'label' => __('General', 'tutor'), |
| 123 | 'sections' => array( |
| 124 | 'general' => array( |
| 125 | 'label' => __('General', 'tutor'), |
| 126 | 'desc' => __('General Settings', 'tutor'), |
| 127 | 'fields' => array( |
| 128 | 'tutor_dashboard_page_id' => array( |
| 129 | 'type' => 'select', |
| 130 | 'label' => __('Dashboard Page', 'tutor'), |
| 131 | 'default' => '0', |
| 132 | 'options' => $pages, |
| 133 | 'desc' => __('This page will be used for student and instructor dashboard', 'tutor'), |
| 134 | ), |
| 135 | 'enable_public_profile' => array( |
| 136 | 'type' => 'checkbox', |
| 137 | 'label' => __('Public Profile', 'tutor'), |
| 138 | 'label_title' => __('Enable', 'tutor'), |
| 139 | 'default' => '0', |
| 140 | 'desc' => __('Enable this to make a profile publicly visible', 'tutor')."<br />" .$student_url, |
| 141 | ), |
| 142 | 'enable_profile_completion' => array( |
| 143 | 'type' => 'checkbox', |
| 144 | 'label' => __('Profile Completion', 'tutor'), |
| 145 | 'label_title' => __('Enable', 'tutor'), |
| 146 | 'default' => '0', |
| 147 | 'desc' => __('Enabling this feature will show a notification bar to students and instructors to complete their profile information', 'tutor'), |
| 148 | ), |
| 149 | 'disable_tutor_native_login' => array( |
| 150 | 'type' => 'checkbox', |
| 151 | 'label' => __('Tutor Native Login', 'tutor'), |
| 152 | 'label_title' => __('Disable', 'tutor'), |
| 153 | 'default' => '0', |
| 154 | 'desc' => __('Disable to use the default WordPress login page', 'tutor'), |
| 155 | ), |
| 156 | 'student_must_login_to_view_course' => array( |
| 157 | 'type' => 'checkbox', |
| 158 | 'label' => __('Course Visibility', 'tutor'), |
| 159 | 'label_title' => __('Logged in only', 'tutor'), |
| 160 | 'desc' => __('Students must be logged in to view course', 'tutor'), |
| 161 | ), |
| 162 | 'delete_on_uninstall' => array( |
| 163 | 'type' => 'checkbox', |
| 164 | 'label' => __('Erase upon uninstallation', 'tutor'), |
| 165 | 'label_title' => __('Enable', 'tutor'), |
| 166 | 'desc' => __('Delete all data during uninstallation', 'tutor'), |
| 167 | ), |
| 168 | |
| 169 | 'enable_spotlight_mode' => array( |
| 170 | 'type' => 'checkbox', |
| 171 | 'label' => __('Spotlight mode', 'tutor'), |
| 172 | 'label_title' => __('Enable', 'tutor'), |
| 173 | 'default' => '0', |
| 174 | 'desc' => __('This will hide the header and the footer and enable spotlight (full screen) mode when students view lessons.', 'tutor'), |
| 175 | ), |
| 176 | 'disable_default_player_youtube' => array( |
| 177 | 'type' => 'checkbox', |
| 178 | 'label' => __('YouTube Player', 'tutor'), |
| 179 | 'label_title' => __('Enable', 'tutor'), |
| 180 | 'default' => '0', |
| 181 | 'desc' => __('Disable this option to use Tutor LMS video player.', 'tutor'), |
| 182 | ), |
| 183 | 'disable_default_player_vimeo' => array( |
| 184 | 'type' => 'checkbox', |
| 185 | 'label' => __('Vimeo Player', 'tutor'), |
| 186 | 'label_title' => __('Enable', 'tutor'), |
| 187 | 'default' => '0', |
| 188 | 'desc' => __('Disable this option to use Tutor LMS video player.', 'tutor'), |
| 189 | ), |
| 190 | 'pagination_per_page' => array( |
| 191 | 'type' => 'number', |
| 192 | 'label' => __('Pagination', 'tutor'), |
| 193 | 'default' => '20', |
| 194 | 'desc' => __('Number of items you would like displayed "per page" in the pagination', 'tutor'), |
| 195 | ), |
| 196 | 'enable_tutor_maintenance_mode' => array( |
| 197 | 'type' => 'checkbox', |
| 198 | 'label' => __('Maintenance Mode', 'tutor'), |
| 199 | 'label_title' => __('Enable', 'tutor'), |
| 200 | 'default' => '0', |
| 201 | 'desc' => __('Enabling the maintenance mode allows you to display a custom message on the frontend. During this time, visitors can not access the site content. But the wp-admin dashboard will remain accessible.', 'tutor'), |
| 202 | ), |
| 203 | 'hide_admin_bar_for_users' => array( |
| 204 | 'type' => 'checkbox', |
| 205 | 'label' => __('Frontend Admin Bar', 'tutor'), |
| 206 | 'label_title' => __('Hide', 'tutor'), |
| 207 | 'default' => '0', |
| 208 | 'desc' => __('Hide admin bar option allow you to hide WordPress admin bar entirely from the frontend. It will still show to administrator roles user', 'tutor'), |
| 209 | ), |
| 210 | 'login_error_message' => array( |
| 211 | 'type' => 'text', |
| 212 | 'label' => __('Error message for wrong login credentials', 'tutor'), |
| 213 | 'default' => 'Incorrect username or password.', |
| 214 | 'desc' => __('Login error message displayed when the user puts wrong login credentials.', 'tutor'), |
| 215 | ), |
| 216 | ) |
| 217 | ) |
| 218 | ), |
| 219 | ), |
| 220 | 'course' => array( |
| 221 | 'label' => __('Course', 'tutor'), |
| 222 | 'sections' => array( |
| 223 | 'general' => array( |
| 224 | 'label' => __('General', 'tutor'), |
| 225 | 'desc' => __('Course Settings', 'tutor'), |
| 226 | 'fields' => array( |
| 227 | 'enable_gutenberg_course_edit' => array( |
| 228 | 'type' => 'checkbox', |
| 229 | 'label' => __('Gutenberg Editor', 'tutor'), |
| 230 | 'label_title' => __('Enable', 'tutor'), |
| 231 | 'desc' => __('Use Gutenberg editor on course description area.', 'tutor'), |
| 232 | ), |
| 233 | 'hide_course_from_shop_page' => array( |
| 234 | 'type' => 'checkbox', |
| 235 | 'label' => __('Enable / Disable', 'tutor'), |
| 236 | 'label_title' => __('Hide course products from shop page', 'tutor'), |
| 237 | 'desc' => __('Enabling this feature will remove course products from the shop page.', 'tutor'), |
| 238 | ), |
| 239 | 'course_content_access_for_ia' => array( |
| 240 | 'type' => 'checkbox', |
| 241 | 'label' => __('Enable / Disable', 'tutor'), |
| 242 | 'label_title' => __('Course Content Access', 'tutor'), |
| 243 | 'desc' => __('Allow instructors and admins to view the course content without enrolling', 'tutor'), |
| 244 | ), |
| 245 | 'wc_automatic_order_complete_redirect_to_courses' => array( |
| 246 | 'type' => 'checkbox', |
| 247 | 'label' => __('Auto redirect to courses', 'tutor'), |
| 248 | 'label_title' => __('Enable', 'tutor'), |
| 249 | 'desc' => __('When a user\'s WooCommerce order is auto-completed, they will be redirected to enrolled courses', 'tutor'), |
| 250 | ), |
| 251 | 'course_completion_process' => array( |
| 252 | 'type' => 'radio', |
| 253 | 'label' => __('Course Completion Process', 'tutor'), |
| 254 | 'default' => 'flexible', |
| 255 | 'select_options' => false, |
| 256 | 'options' => array( |
| 257 | 'flexible' => __('Flexible', 'tutor'), |
| 258 | 'strict' => __('Strict Mode', 'tutor'), |
| 259 | ), |
| 260 | 'desc' => __('Students can complete courses anytime in the Flexible mode. In the Strict mode, students have to complete, pass all the lessons and quizzes (if any) to mark a course as complete.', 'tutor'), |
| 261 | ), |
| 262 | 'course_retake_feature' => array( |
| 263 | 'type' => 'checkbox', |
| 264 | 'label' => __('Course Retake', 'tutor'), |
| 265 | 'label_title' => __('Enable', 'tutor'), |
| 266 | 'desc' => __('Enabling this feature will allow students to reset course progress and start over.', 'tutor'), |
| 267 | ) |
| 268 | ), |
| 269 | ), |
| 270 | 'archive' => array( |
| 271 | 'label' => __('Archive', 'tutor'), |
| 272 | 'desc' => __('Course Archive Settings', 'tutor'), |
| 273 | 'fields' => array( |
| 274 | 'course_archive_page' => array( |
| 275 | 'type' => 'select', |
| 276 | 'label' => __('Course Archive Page', 'tutor'), |
| 277 | 'default' => '0', |
| 278 | 'options' => $pages, |
| 279 | 'desc' => __('This page will be used to list all the published courses.', 'tutor'), |
| 280 | ), |
| 281 | 'courses_col_per_row' => array( |
| 282 | 'type' => 'slider', |
| 283 | 'label' => __('Column Per Row', 'tutor'), |
| 284 | 'default' => '4', |
| 285 | 'options' => array('min'=> 1, 'max' => 6), |
| 286 | 'desc' => __('Define how many column you want to use to display courses.', 'tutor'), |
| 287 | ), |
| 288 | 'courses_per_page' => array( |
| 289 | 'type' => 'slider', |
| 290 | 'label' => __('Courses Per Page', 'tutor'), |
| 291 | 'default' => '12', |
| 292 | 'options' => array('min'=> 1, 'max' => 20), |
| 293 | 'desc' => __('Define how many courses you want to show per page', 'tutor'), |
| 294 | ), |
| 295 | 'course_archive_filter' => array( |
| 296 | 'type' => 'checkbox', |
| 297 | 'label' => __('Course Filter', 'tutor'), |
| 298 | 'label_title' => __('Enable', 'tutor'), |
| 299 | 'desc' => __('Show sorting and filtering options on course archive page', 'tutor'), |
| 300 | ), |
| 301 | 'supported_course_filters' => array( |
| 302 | 'type' => 'checkbox', |
| 303 | 'label' => __('Preferred Course Filters', 'tutor'), |
| 304 | 'options' => $course_filters, |
| 305 | 'desc' => __('Choose preferred filter options you\'d like to show in course archive page.', 'tutor'), |
| 306 | ), |
| 307 | ), |
| 308 | ), |
| 309 | 'enable_disable' => array( |
| 310 | 'label' => __('Enable / Disable', 'tutor'), |
| 311 | 'desc' => __('Course Display Settings', 'tutor'), |
| 312 | 'fields' => array( |
| 313 | 'display_course_instructors' => array( |
| 314 | 'type' => 'checkbox', |
| 315 | 'label' => __('Display Instructor Info', 'tutor'), |
| 316 | 'label_title' => __('Enable', 'tutor'), |
| 317 | 'desc' => __('Show instructor bio on each page', 'tutor'), |
| 318 | ), |
| 319 | 'enable_q_and_a_on_course' => array( |
| 320 | 'type' => 'checkbox', |
| 321 | 'label' => __('Question and Answer', 'tutor'), |
| 322 | 'label_title' => __('Enable','tutor'), |
| 323 | 'default' => '0', |
| 324 | 'desc' => __('Enabling this feature will add a Q&A section on every course.', 'tutor'), |
| 325 | ), |
| 326 | 'disable_course_author' => array( |
| 327 | 'type' => 'checkbox', |
| 328 | 'label' => __('Course Author', 'tutor'), |
| 329 | 'label_title' => __('Disable','tutor'), |
| 330 | 'default' => '0', |
| 331 | 'desc' => __('Disabling this feature will be removed course author name from the course page.', 'tutor'), |
| 332 | ), |
| 333 | 'disable_course_level' => array( |
| 334 | 'type' => 'checkbox', |
| 335 | 'label' => __('Course Level', 'tutor'), |
| 336 | 'label_title' => __('Disable','tutor'), |
| 337 | 'default' => '0', |
| 338 | 'desc' => __('Disabling this feature will be removed course level from the course page.', 'tutor'), |
| 339 | ), |
| 340 | 'disable_course_share' => array( |
| 341 | 'type' => 'checkbox', |
| 342 | 'label' => __('Course Share', 'tutor'), |
| 343 | 'label_title' => __('Disable','tutor'), |
| 344 | 'default' => '0', |
| 345 | 'desc' => __('Disabling this feature will be removed course share option from the course page.', 'tutor'), |
| 346 | ), |
| 347 | 'disable_course_duration' => array( |
| 348 | 'type' => 'checkbox', |
| 349 | 'label' => __('Course Duration', 'tutor'), |
| 350 | 'label_title' => __('Disable','tutor'), |
| 351 | 'default' => '0', |
| 352 | 'desc' => __('Disabling this feature will be removed course duration from the course page.', 'tutor'), |
| 353 | ), |
| 354 | 'disable_course_total_enrolled' => array( |
| 355 | 'type' => 'checkbox', |
| 356 | 'label' => __('Course Total Enrolled', 'tutor'), |
| 357 | 'label_title' => __('Disable','tutor'), |
| 358 | 'default' => '0', |
| 359 | 'desc' => __('Disabling this feature will be removed course total enrolled from the course page.', 'tutor'), |
| 360 | ), |
| 361 | 'disable_course_update_date' => array( |
| 362 | 'type' => 'checkbox', |
| 363 | 'label' => __('Course Update Date', 'tutor'), |
| 364 | 'label_title' => __('Disable','tutor'), |
| 365 | 'default' => '0', |
| 366 | 'desc' => __('Disabling this feature will be removed course update date from the course page.', 'tutor'), |
| 367 | ), |
| 368 | 'disable_course_progress_bar' => array( |
| 369 | 'type' => 'checkbox', |
| 370 | 'label' => __('Course Progress Bar', 'tutor'), |
| 371 | 'label_title' => __('Disable','tutor'), |
| 372 | 'default' => '0', |
| 373 | 'desc' => __('Disabling this feature will be removed completing progress bar from the course page.', 'tutor'), |
| 374 | ), |
| 375 | 'disable_course_material' => array( |
| 376 | 'type' => 'checkbox', |
| 377 | 'label' => __('Course Material', 'tutor'), |
| 378 | 'label_title' => __('Disable','tutor'), |
| 379 | 'default' => '0', |
| 380 | 'desc' => __('Disabling this feature will be removed course material from the course page.', 'tutor'), |
| 381 | ), |
| 382 | 'disable_course_about' => array( |
| 383 | 'type' => 'checkbox', |
| 384 | 'label' => __('Course About', 'tutor'), |
| 385 | 'label_title' => __('Disable','tutor'), |
| 386 | 'default' => '0', |
| 387 | 'desc' => __('Disabling this feature will be removed course about from the course page.', 'tutor'), |
| 388 | ), |
| 389 | 'disable_course_description' => array( |
| 390 | 'type' => 'checkbox', |
| 391 | 'label' => __('Course Description', 'tutor'), |
| 392 | 'label_title' => __('Disable','tutor'), |
| 393 | 'default' => '0', |
| 394 | 'desc' => __('Disabling this feature will be removed course description from the course page.', 'tutor'), |
| 395 | ), |
| 396 | 'disable_course_benefits' => array( |
| 397 | 'type' => 'checkbox', |
| 398 | 'label' => __('Course Benefits', 'tutor'), |
| 399 | 'label_title' => __('Disable','tutor'), |
| 400 | 'default' => '0', |
| 401 | 'desc' => __('Disabling this feature will be removed course benefits from the course page.', 'tutor'), |
| 402 | ), |
| 403 | 'disable_course_requirements' => array( |
| 404 | 'type' => 'checkbox', |
| 405 | 'label' => __('Course Requirements', 'tutor'), |
| 406 | 'label_title' => __('Disable','tutor'), |
| 407 | 'default' => '0', |
| 408 | 'desc' => __('Disabling this feature will be removed course requirements from the course page.', 'tutor'), |
| 409 | ), |
| 410 | 'disable_course_target_audience' => array( |
| 411 | 'type' => 'checkbox', |
| 412 | 'label' => __('Course Target Audience', 'tutor'), |
| 413 | 'label_title' => __('Disable','tutor'), |
| 414 | 'default' => '0', |
| 415 | 'desc' => __('Disabling this feature will be removed course target audience from the course page.', 'tutor'), |
| 416 | ), |
| 417 | 'disable_course_announcements' => array( |
| 418 | 'type' => 'checkbox', |
| 419 | 'label' => __('Course Announcements', 'tutor'), |
| 420 | 'label_title' => __('Disable','tutor'), |
| 421 | 'default' => '0', |
| 422 | 'desc' => __('Disabling this feature will be removed course announcements from the course page.', 'tutor'), |
| 423 | ), |
| 424 | 'disable_course_review' => array( |
| 425 | 'type' => 'checkbox', |
| 426 | 'label' => __('Course Review', 'tutor'), |
| 427 | 'label_title' => __('Disable','tutor'), |
| 428 | 'default' => '0', |
| 429 | 'desc' => __('Disabling this feature will be removed course review system from the course page.', 'tutor'), |
| 430 | ), |
| 431 | 'supported_video_sources' => array( |
| 432 | 'type' => 'checkbox', |
| 433 | 'label' => __('Preferred Video Source', 'tutor'), |
| 434 | 'options' => $video_sources, |
| 435 | 'desc' => __('Choose video sources you\'d like to support. Unchecking all will not disable video feature.', 'tutor'), |
| 436 | ), |
| 437 | 'default_video_source' => array( |
| 438 | 'type' => 'select', |
| 439 | 'label' => __('Default Video Source', 'tutor'), |
| 440 | 'default' => '', |
| 441 | 'options' => $video_sources, |
| 442 | 'desc' => __('Choose video source to be selected by default.', 'tutor'), |
| 443 | ), |
| 444 | ), |
| 445 | ), |
| 446 | ), |
| 447 | ), |
| 448 | 'lesson' => array( |
| 449 | 'label' => __('Lessons', 'tutor'), |
| 450 | 'sections' => array( |
| 451 | 'lesson_settings' => array( |
| 452 | 'label' => __('Lesson Settings', 'tutor'), |
| 453 | 'desc' => __('Lesson settings will be here', 'tutor'), |
| 454 | 'fields' => array( |
| 455 | 'enable_lesson_classic_editor' => array( |
| 456 | 'type' => 'checkbox', |
| 457 | 'label' => __('Classic Editor', 'tutor'), |
| 458 | 'label_title' => __('Enable', 'tutor'), |
| 459 | 'desc' => __('Enable classic editor to get full support of any editor/page builder.', 'tutor'), |
| 460 | ), |
| 461 | 'autoload_next_course_content' => array( |
| 462 | 'type' => 'checkbox', |
| 463 | 'label' => __('Enable / Disable', 'tutor'), |
| 464 | 'label_title' => __('Automatically load next course content.', 'tutor'), |
| 465 | 'desc' => __('Enabling this feature will be load next course content automatically after finishing current video.', 'tutor'), |
| 466 | ), |
| 467 | 'lesson_permalink_base' => array( |
| 468 | 'type' => 'text', |
| 469 | 'label' => __('Lesson Permalink Base', 'tutor'), |
| 470 | 'default' => 'lessons', |
| 471 | 'desc' => $lesson_url, |
| 472 | ), |
| 473 | 'lesson_video_duration_youtube_api_key' => array( |
| 474 | 'type' => 'text', |
| 475 | 'label' => __('Youtube API Key', 'tutor'), |
| 476 | 'desc' => __('To get dynamic video duration from Youtube, you need to set API key first'), |
| 477 | ), |
| 478 | ), |
| 479 | ), |
| 480 | |
| 481 | ), |
| 482 | ), |
| 483 | 'quiz' => array( |
| 484 | 'label' => __('Quiz', 'tutor'), |
| 485 | 'sections' => array( |
| 486 | 'general' => array( |
| 487 | 'label' => __('Quiz', 'tutor'), |
| 488 | 'desc' => __('The values you set here define the default values that are used in the settings form when you create a new quiz.', 'tutor'), |
| 489 | 'fields' => array( |
| 490 | 'quiz_time_limit' => array( |
| 491 | 'type' => 'group_fields', |
| 492 | 'label' => __('Time Limit', 'tutor'), |
| 493 | 'desc' => __('0 means unlimited time.', 'tutor'), |
| 494 | 'group_fields' => array( |
| 495 | 'value' => array( |
| 496 | 'type' => 'text', |
| 497 | 'default' => '0', |
| 498 | ), |
| 499 | 'time' => array( |
| 500 | 'type' => 'select', |
| 501 | 'default' => 'minutes', |
| 502 | 'select_options' => false, |
| 503 | 'options' => array( |
| 504 | 'weeks' => __('Weeks', 'tutor'), |
| 505 | 'days' => __('Days', 'tutor'), |
| 506 | 'hours' => __('Hours', 'tutor'), |
| 507 | 'minutes' => __('Minutes', 'tutor'), |
| 508 | 'seconds' => __('Seconds', 'tutor'), |
| 509 | ), |
| 510 | ), |
| 511 | ), |
| 512 | ), |
| 513 | 'quiz_when_time_expires' => array( |
| 514 | 'type' => 'radio', |
| 515 | 'label' => __('When time expires', 'tutor'), |
| 516 | 'default' => 'minutes', |
| 517 | 'select_options' => false, |
| 518 | 'options' => array( |
| 519 | 'autosubmit' => __('The current quiz answers are submitted automatically.', 'tutor'), |
| 520 | 'graceperiod' => __('The current quiz answers are submitted by students.', 'tutor'), |
| 521 | 'autoabandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'), |
| 522 | ), |
| 523 | 'desc' => __('Choose which action to follow when the quiz time expires.', 'tutor'), |
| 524 | ), |
| 525 | 'quiz_attempts_allowed' => array( |
| 526 | 'type' => 'number', |
| 527 | 'label' => __('Attempts allowed', 'tutor'), |
| 528 | 'default' => '10', |
| 529 | 'desc' => __('The highest number of attempts students are allowed to take for a quiz. 0 means unlimited attempts.', 'tutor'), |
| 530 | ), |
| 531 | 'quiz_previous_button_disabled' => array( |
| 532 | 'type' => 'checkbox', |
| 533 | 'label' => __('Show Previous button', 'tutor'), |
| 534 | 'label_title' => __('Disable', 'tutor'), |
| 535 | 'default' => '0', |
| 536 | 'desc' => __('Choose whether to show or hide previous button for single question.', 'tutor'), |
| 537 | ), |
| 538 | 'quiz_grade_method' => array( |
| 539 | 'type' => 'select', |
| 540 | 'label' => __('Final grade calculation', 'tutor'), |
| 541 | 'default' => 'minutes', |
| 542 | 'select_options' => false, |
| 543 | 'options' => array( |
| 544 | 'highest_grade' => __('Highest Grade', 'tutor'), |
| 545 | 'average_grade' => __('Average Grade', 'tutor'), |
| 546 | 'first_attempt' => __('First Attempt', 'tutor'), |
| 547 | 'last_attempt' => __('Last Attempt', 'tutor'), |
| 548 | ), |
| 549 | 'desc' => __('When multiple attempts are allowed, which method should be used to calculate a student\'s final grade for the quiz.', 'tutor'), |
| 550 | ), |
| 551 | ) |
| 552 | ) |
| 553 | ), |
| 554 | ), |
| 555 | 'instructors' => array( |
| 556 | 'label' => __('Instructors', 'tutor'), |
| 557 | 'sections' => array( |
| 558 | 'general' => array( |
| 559 | 'label' => __('Instructor Profile Settings', 'tutor'), |
| 560 | 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'), |
| 561 | 'fields' => array( |
| 562 | 'enable_course_marketplace' => array( |
| 563 | 'type' => 'checkbox', |
| 564 | 'label' => __('Course Marketplace', 'tutor'), |
| 565 | 'label_title' => __('Enable', 'tutor'), |
| 566 | 'default' => '0', |
| 567 | 'desc' => __('Allow multiple instructors to upload their courses.', 'tutor'), |
| 568 | ), |
| 569 | 'instructor_register_page' => array( |
| 570 | 'type' => 'select', |
| 571 | 'label' => __('Instructor Registration Page', 'tutor'), |
| 572 | 'default' => '0', |
| 573 | 'options' => $pages, |
| 574 | 'desc' => __('This page will be used to sign up new instructors.', 'tutor'), |
| 575 | ), |
| 576 | 'instructor_can_publish_course' => array( |
| 577 | 'type' => 'checkbox', |
| 578 | 'label' => __('Allow publishing course', 'tutor'), |
| 579 | 'label_title' => __('Enable', 'tutor'), |
| 580 | 'default' => '0', |
| 581 | 'desc' => __('Enable instructors to publish course directly. <strong>Do not select</strong> if admins want to review courses before publishing.', 'tutor'), |
| 582 | ), |
| 583 | 'enable_become_instructor_btn' => array( |
| 584 | 'type' => 'checkbox', |
| 585 | 'label' => __('Become Instructor Button', 'tutor'), |
| 586 | 'label_title' => __('Enable', 'tutor'), |
| 587 | 'default' => '0', |
| 588 | 'desc' => __('Uncheck this option to hide the button from student dashboard.', 'tutor'), |
| 589 | ), |
| 590 | ), |
| 591 | ), |
| 592 | ), |
| 593 | ), |
| 594 | 'students' => array( |
| 595 | 'label' => __('Students', 'tutor'), |
| 596 | 'sections' => array( |
| 597 | 'general' => array( |
| 598 | 'label' => __('Student Profile settings', 'tutor'), |
| 599 | 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'), |
| 600 | 'fields' => array( |
| 601 | 'student_register_page' => array( |
| 602 | 'type' => 'select', |
| 603 | 'label' => __('Student Registration Page', 'tutor'), |
| 604 | 'default' => '0', |
| 605 | 'options' => $pages, |
| 606 | 'desc' => __('Choose the page for student registration page', 'tutor'), |
| 607 | ), |
| 608 | 'students_own_review_show_at_profile' => array( |
| 609 | 'type' => 'checkbox', |
| 610 | 'label' => __('Show reviews on profile', 'tutor'), |
| 611 | 'label_title' => __('Enable', 'tutor'), |
| 612 | 'default' => '0', |
| 613 | 'desc' => __('Enabling this will show the reviews written by each student on their profile', 'tutor')."<br />" .$student_url, |
| 614 | ), |
| 615 | 'show_courses_completed_by_student' => array( |
| 616 | 'type' => 'checkbox', |
| 617 | 'label' => __('Show completed courses', 'tutor'), |
| 618 | 'label_title' => __('Enable', 'tutor'), |
| 619 | 'default' => '0', |
| 620 | 'desc' => __('Completed courses will be shown on student profiles. <br/> For example, you can see this link-', 'tutor').$student_url, |
| 621 | ), |
| 622 | ), |
| 623 | ), |
| 624 | ), |
| 625 | ), |
| 626 | 'tutor_earning' => array( |
| 627 | 'label' => __('Earning', 'tutor'), |
| 628 | 'sections' => array( |
| 629 | 'general' => array( |
| 630 | 'label' => __('Earning and commission allocation', 'tutor'), |
| 631 | 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'), |
| 632 | 'fields' => array( |
| 633 | 'enable_tutor_earning' => array( |
| 634 | 'type' => 'checkbox', |
| 635 | 'label' => __('Earning', 'tutor'), |
| 636 | 'label_title' => __('Enable', 'tutor'), |
| 637 | 'default' => '0', |
| 638 | 'desc' => __('If disabled, the Admin will receive 100% of the earning', 'tutor'), |
| 639 | ), |
| 640 | 'earning_admin_commission' => array( |
| 641 | 'type' => 'number', |
| 642 | 'label' => __('Admin Commission Percentage', 'tutor'), |
| 643 | 'default' => '0', |
| 644 | 'desc' => __('Define the commission of the Admin from each sale.(after deducting fees)', 'tutor'), |
| 645 | ), |
| 646 | 'earning_instructor_commission' => array( |
| 647 | 'type' => 'number', |
| 648 | 'label' => __('Instructor Commission Percentage', 'tutor'), |
| 649 | 'default' => '0', |
| 650 | 'desc' => __('Define the commission for instructors from each sale.(after deducting fees)', 'tutor'), |
| 651 | ), |
| 652 | 'tutor_earning_fees' => array( |
| 653 | 'type' => 'group_fields', |
| 654 | 'label' => __('Fee Deduction', 'tutor'), |
| 655 | 'desc' => __('Fees are charged from the entire sales amount. The remaining amount will be divided among admin and instructors.', 'tutor'), |
| 656 | 'group_fields' => array( |
| 657 | |
| 658 | 'enable_fees_deducting' => array( |
| 659 | 'type' => 'checkbox', |
| 660 | 'label' => __('Enable', 'tutor'), |
| 661 | 'default' => '0', |
| 662 | ), |
| 663 | 'fees_name' => array( |
| 664 | 'type' => 'text', |
| 665 | 'label' => __('Fee Name', 'tutor'), |
| 666 | 'default' => '', |
| 667 | ), |
| 668 | 'fees_amount' => array( |
| 669 | 'type' => 'number', |
| 670 | 'label' => __('Fee Amount', 'tutor'), |
| 671 | 'default' => '', |
| 672 | ), |
| 673 | 'fees_type' => array( |
| 674 | 'type' => 'select', |
| 675 | 'default' => 'minutes', |
| 676 | 'select_options' => false, |
| 677 | 'options' => array( |
| 678 | '' => __('Select Fees Type', 'tutor'), |
| 679 | 'percent' => __('Percent', 'tutor'), |
| 680 | 'fixed' => __('Fixed', 'tutor'), |
| 681 | ), |
| 682 | ), |
| 683 | |
| 684 | ), |
| 685 | ), |
| 686 | 'statement_show_per_page' => array( |
| 687 | 'type' => 'number', |
| 688 | 'label' => __('Show Statement Per Page', 'tutor'), |
| 689 | 'default' => '20', |
| 690 | 'desc' => __('Define the number of statements to show.', 'tutor'), |
| 691 | ), |
| 692 | ), |
| 693 | ), |
| 694 | ), |
| 695 | ), |
| 696 | 'tutor_withdraw' => array( |
| 697 | 'label' => __('Withdrawal', 'tutor'), |
| 698 | 'sections' => array( |
| 699 | 'general' => array( |
| 700 | 'label' => __('Withdrawal Settings', 'tutor'), |
| 701 | 'fields' => array( |
| 702 | 'min_withdraw_amount' => array( |
| 703 | 'type' => 'number', |
| 704 | 'label' => __('Minimum Withdraw Amount', 'tutor'), |
| 705 | 'default' => '80', |
| 706 | 'desc' => __('Instructors should earn equal or above this amount to make a withdraw request.', 'tutor'), |
| 707 | ), |
| 708 | ), |
| 709 | ), |
| 710 | |
| 711 | 'withdraw_methods' => array( |
| 712 | 'label' => __('Withdraw Methods', 'tutor'), |
| 713 | 'desc' => __('Set withdraw settings', 'tutor'), |
| 714 | ), |
| 715 | ), |
| 716 | ), |
| 717 | |
| 718 | 'tutor_style' => array( |
| 719 | 'label' => __('Style', 'tutor'), |
| 720 | 'sections' => array( |
| 721 | 'general' => array( |
| 722 | 'label' => __('Color Style', 'tutor'), |
| 723 | 'fields' => array( |
| 724 | 'tutor_primary_color' => array( |
| 725 | 'type' => 'color', |
| 726 | 'label' => __('Primary Color', 'tutor'), |
| 727 | 'default' => '', |
| 728 | ), |
| 729 | 'tutor_primary_hover_color' => array( |
| 730 | 'type' => 'color', |
| 731 | 'label' => __('Primary Hover Color', 'tutor'), |
| 732 | 'default' => '', |
| 733 | ), |
| 734 | 'tutor_text_color' => array( |
| 735 | 'type' => 'color', |
| 736 | 'label' => __('Text color', 'tutor'), |
| 737 | 'default' => '', |
| 738 | ), |
| 739 | 'tutor_light_color' => array( |
| 740 | 'type' => 'color', |
| 741 | 'label' => __('Light color', 'tutor'), |
| 742 | 'default' => '', |
| 743 | ), |
| 744 | //tutor button style options |
| 745 | |
| 746 | 'tutor_button_primary' => array( |
| 747 | 'type' => 'color', |
| 748 | 'label' => __('Button Primary Color','tutor'), |
| 749 | 'default' => '' |
| 750 | ), |
| 751 | |
| 752 | 'tutor_button_danger' => array( |
| 753 | 'type' => 'color', |
| 754 | 'label' => __('Button Danger Color','tutor'), |
| 755 | 'default' => '' |
| 756 | ), |
| 757 | 'tutor_button_success' => array( |
| 758 | 'type' => 'color', |
| 759 | 'label' => __('Button Success Color','tutor'), |
| 760 | 'default' => '' |
| 761 | ), |
| 762 | 'tutor_button_warning' => array( |
| 763 | 'type' => 'color', |
| 764 | 'label' => __('Button Warning Color','tutor'), |
| 765 | 'default' => '' |
| 766 | ), |
| 767 | ), |
| 768 | ), |
| 769 | |
| 770 | ), |
| 771 | ), |
| 772 | |
| 773 | 'monetization' => array( |
| 774 | 'label' => __('Monetization', 'tutor'), |
| 775 | 'sections' => array( |
| 776 | 'general' => array( |
| 777 | 'label' => __('Monetization', 'tutor'), |
| 778 | 'desc' => __('You can monetize your LMS website by selling courses in a various way.', 'tutor'), |
| 779 | 'fields' => array( |
| 780 | |
| 781 | 'monetize_by' => array( |
| 782 | 'type' => 'radio', |
| 783 | 'label' => __('Monetize Option', 'tutor'), |
| 784 | 'default' => 'free', |
| 785 | 'select_options' => false, |
| 786 | 'options' => apply_filters('tutor_monetization_options', array( |
| 787 | 'free' => __('Disable Monetization', 'tutor'), |
| 788 | )), |
| 789 | 'desc' => __('Select a monetization option to generate revenue by selling courses. Supports: WooCommerce, Easy Digital Downloads, Paid Memberships Pro', 'tutor'), |
| 790 | ), |
| 791 | |
| 792 | ) |
| 793 | ) |
| 794 | ), |
| 795 | ), |
| 796 | |
| 797 | ); |
| 798 | |
| 799 | $attrs = apply_filters('tutor/options/attr', $attr); |
| 800 | $extends = apply_filters('tutor/options/extend/attr', array()); |
| 801 | |
| 802 | if (tutils()->count($extends)){ |
| 803 | foreach ($extends as $extend_key => $extend_option){ |
| 804 | if (isset($attrs[$extend_key])&& tutils()->count($extend_option['sections']) ){ |
| 805 | $sections = $attrs[$extend_key]['sections']; |
| 806 | $sections = array_merge($sections, $extend_option['sections']); |
| 807 | $attrs[$extend_key]['sections'] = $sections; |
| 808 | } |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | return $attrs; |
| 813 | |
| 814 | } |
| 815 | |
| 816 | /** |
| 817 | * @param array $field |
| 818 | * |
| 819 | * @return string |
| 820 | * |
| 821 | * Generate Option Field |
| 822 | */ |
| 823 | public function generate_field($field = array()){ |
| 824 | ob_start(); |
| 825 | include tutor()->path.'views/options/option_field.php'; |
| 826 | echo ob_get_clean(); |
| 827 | } |
| 828 | |
| 829 | public function field_type($field = array()){ |
| 830 | ob_start(); |
| 831 | include tutor()->path.'views/options/field-types/'.$field['type'].'.php'; |
| 832 | echo ob_get_clean(); |
| 833 | } |
| 834 | |
| 835 | public function generate(){ |
| 836 | ob_start(); |
| 837 | include tutor()->path.'views/options/options_generator.php'; |
| 838 | return ob_get_clean(); |
| 839 | } |
| 840 | |
| 841 | } |