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