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.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / classes / Options.php
tutor / classes Last commit date
Addons.php 6 years ago Admin.php 6 years ago Ajax.php 6 years ago Assets.php 6 years ago Course.php 6 years ago Course_Widget.php 6 years ago Dashboard.php 6 years ago Gutenberg.php 6 years ago Instructor.php 6 years ago Instructors_List.php 6 years ago Lesson.php 6 years ago Options.php 6 years ago Post_types.php 6 years ago Q_and_A.php 6 years ago Question.php 6 years ago Question_Answers_List.php 6 years ago Quiz.php 6 years ago Quiz_Attempts_List.php 6 years ago Rewrite_Rules.php 6 years ago Shortcode.php 6 years ago Student.php 6 years ago Students_List.php 6 years ago Taxonomies.php 6 years ago Template.php 6 years ago Theme_Compatibility.php 6 years ago Tools.php 6 years ago Tutor.php 6 years ago TutorEDD.php 6 years ago Tutor_Base.php 6 years ago Tutor_List_Table.php 6 years ago Upgrader.php 6 years ago User.php 6 years ago Utils.php 6 years ago Video_Stream.php 6 years ago Withdraw.php 6 years ago Withdraw_Requests_List.php 6 years ago WooCommerce.php 6 years ago
Options.php
514 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 if ( ! isset($_POST['_wpnonce']) || ! wp_verify_nonce( $_POST['_wpnonce'], 'tutor_option_save' ) ){
50 exit();
51 }
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 $attr = array(
77 'general' => array(
78 'label' => __('General', 'tutor'),
79 'sections' => array(
80 'general' => array(
81 'label' => __('General', 'tutor'),
82 'desc' => __('General Settings', 'tutor'),
83 'fields' => array(
84 'tutor_dashboard_page_id' => array(
85 'type' => 'select',
86 'label' => __('Dashboard Page', 'tutor'),
87 'default' => '0',
88 'options' => $pages,
89 'desc' => __('This page will be used for student and instructor dashboard', 'tutor'),
90 ),
91 'enable_public_profile' => array(
92 'type' => 'checkbox',
93 'label' => __('Public Profile', 'tutor'),
94 'label_title' => __('Enable', 'tutor'),
95 'default' => '0',
96 'desc' => __('Enable this to make a profile publicly visible', 'tutor')."<br />" .$student_url,
97 ),
98 'load_tutor_css' => array(
99 'type' => 'checkbox',
100 'label' => __('Load Tutor CSS', 'tutor'),
101 'label_title' => __('Enable', 'tutor'),
102 'desc' => __('If your theme has its own styling, then you can turn it off to load CSS from the plugin directory', 'tutor'),
103 ),
104 'load_tutor_js' => array(
105 'type' => 'checkbox',
106 'label' => __('Load Tutor JavaScript', 'tutor'),
107 'label_title' => __('Enable', 'tutor'),
108 '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'),
109 ),
110 'student_must_login_to_view_course' => array(
111 'type' => 'checkbox',
112 'label' => __('Course Visibility', 'tutor'),
113 'label_title' => __('Logged in only', 'tutor'),
114 'desc' => __('Students must be logged in to view course', 'tutor'),
115 ),
116 'delete_on_uninstall' => array(
117 'type' => 'checkbox',
118 'label' => __('Erase upon uninstallation', 'tutor'),
119 'label_title' => __('Enable', 'tutor'),
120 'desc' => __('Delete all data during uninstall', 'tutor'),
121 ),
122
123 'enable_spotlight_mode' => array(
124 'type' => 'checkbox',
125 'label' => __('Spotlight mode', 'tutor'),
126 'label_title' => __('Enable', 'tutor'),
127 'default' => '0',
128 'desc' => __('This will hide the header & footer and enable Spotlight (full-screen) mode for the course learning interface.', 'tutor'),
129 ),
130 'disable_default_player_youtube' => array(
131 'type' => 'checkbox',
132 'label' => __('YouTube Player', 'tutor'),
133 'label_title' => __('Disable default video player on the youtube video', 'tutor'),
134 'default' => '0',
135 'desc' => __('', 'tutor'),
136 ),
137 'disable_default_player_vimeo' => array(
138 'type' => 'checkbox',
139 'label' => __('Vimeo Player', 'tutor'),
140 'label_title' => __('Disable default video player on the vimeo video', 'tutor'),
141 'default' => '0',
142 'desc' => __('', 'tutor'),
143 ),
144 )
145 )
146 ),
147 ),
148 'course' => array(
149 'label' => __('Course', 'tutor'),
150 'sections' => array(
151 'general' => array(
152 'label' => __('General', 'tutor'),
153 'desc' => __('Course Settings', 'tutor'),
154 'fields' => array(
155 'enable_gutenberg_course_edit' => array(
156 'type' => 'checkbox',
157 'label' => __('Gutenberg Editor', 'tutor'),
158 'label_title' => __('Enable', 'tutor'),
159 'desc' => __('Use Gutenberg editor on course description area.', 'tutor'),
160 ),
161 'display_course_instructors' => array(
162 'type' => 'checkbox',
163 'label' => __('Display Instructor Info', 'tutor'),
164 'label_title' => __('Enable', 'tutor'),
165 'desc' => __('Show tutor bio on each course page.', 'tutor'),
166 ),
167 'enable_q_and_a_on_course' => array(
168 'type' => 'checkbox',
169 'label' => __('Question and Answer', 'tutor'),
170 'label_title' => __('Enable','tutor'),
171 'default' => '0',
172 'desc' => __('Enabling this feature will add a Q&amp;A section on every course.', 'tutor'),
173 ),
174 ),
175 ),
176 'archive' => array(
177 'label' => __('Archive', 'tutor'),
178 'desc' => __('Course Archive Settings', 'tutor'),
179 'fields' => array(
180 'course_archive_page' => array(
181 'type' => 'select',
182 'label' => __('Course Archive Page', 'tutor'),
183 'default' => '0',
184 'options' => $pages,
185 'desc' => __('This page will be used to list all the published courses.', 'tutor'),
186 ),
187 'courses_col_per_row' => array(
188 'type' => 'slider',
189 'label' => __('Column per row', 'tutor'),
190 'default' => '4',
191 'options' => array('min'=> 1, 'max' => 6),
192 'desc' => __('Define how many column you want to show on the course single page', 'tutor'),
193 ),
194 'courses_per_page' => array(
195 'type' => 'slider',
196 'label' => __('Courses Per Page', 'tutor'),
197 'default' => '12',
198 'options' => array('min'=> 1, 'max' => 20),
199 'desc' => __('Define how many courses you want to show per page', 'tutor'),
200 ),
201 ),
202 ),
203 ),
204 ),
205 'lesson' => array(
206 'label' => __('Lessons', 'tutor'),
207 'sections' => array(
208 'lesson_settings' => array(
209 'label' => __('Lesson Settings', 'tutor'),
210 'desc' => __('Lesson settings will be here', 'tutor'),
211 'fields' => array(
212 'lesson_permalink_base' => array(
213 'type' => 'text',
214 'label' => __('Lesson Permalink Base', 'tutor'),
215 'default' => 'lessons',
216 'desc' => $lesson_url,
217 ),
218
219 ),
220 ),
221
222 ),
223 ),
224 'quiz' => array(
225 'label' => __('Quiz', 'tutor'),
226 'sections' => array(
227 'general' => array(
228 'label' => __('Quiz', 'tutor'),
229 'desc' => __('The values you set here define the default values that are used in the settings form when you create a new quiz.', 'tutor'),
230 'fields' => array(
231 'quiz_time_limit' => array(
232 'type' => 'group_fields',
233 'label' => __('Time Limit', 'tutor'),
234 'desc' => __('Default time limit for quizzes. 0 means no time limit.', 'tutor'),
235 'group_fields' => array(
236 'value' => array(
237 'type' => 'text',
238 'default' => '0',
239 ),
240 'time' => array(
241 'type' => 'select',
242 'default' => 'minutes',
243 'select_options' => false,
244 'options' => array(
245 'weeks' => __('Weeks', 'tutor'),
246 'days' => __('Days', 'tutor'),
247 'hours' => __('Hours', 'tutor'),
248 'minutes' => __('Minutes', 'tutor'),
249 'seconds' => __('Seconds', 'tutor'),
250 ),
251 ),
252 ),
253 ),
254 'quiz_when_time_expires' => array(
255 'type' => 'radio',
256 'label' => __('When time expires', 'tutor'),
257 'default' => 'minutes',
258 'select_options' => false,
259 'options' => array(
260 'autosubmit' => __('Current attempts are submitted automatically', 'tutor'),
261 'graceperiod' => __('There is a grace period when current attempts can be submitted, but no more questions answered', 'tutor'),
262 'autoabandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'),
263 ),
264 'desc' => __('What should happen by default if a student does not submit the quiz before time expires.', 'tutor'),
265 ),
266 'quiz_attempts_allowed' => array(
267 'type' => 'number',
268 'label' => __('Attempts allowed', 'tutor'),
269 'default' => '10',
270 'desc' => __('Restriction on the number of attempts students are allowed to take for a quiz. 0 for no limit', 'tutor'),
271 ),
272 'quiz_grade_method' => array(
273 'type' => 'select',
274 'label' => __('Grading method', 'tutor'),
275 'default' => 'minutes',
276 'select_options' => false,
277 'options' => array(
278 'highest_grade' => __('Highest Grade', 'tutor'),
279 'average_grade' => __('Average Grade', 'tutor'),
280 'first_attempt' => __('First Attempt', 'tutor'),
281 'last_attempt' => __('Last Attempt', 'tutor'),
282 ),
283 'desc' => __('When multiple attempts are allowed, which method should be used to calculate a student\'s final grade for the quiz.', 'tutor'),
284 ),
285 )
286 )
287 ),
288 ),
289 'instructors' => array(
290 'label' => __('Instructors', 'tutor'),
291 'sections' => array(
292 'general' => array(
293 'label' => __('Instructor Profile Settings', 'tutor'),
294 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
295 'fields' => array(
296 'enable_course_marketplace' => array(
297 'type' => 'checkbox',
298 'label' => __('Course Marketplace', 'tutor'),
299 'label_title' => __('Enable', 'tutor'),
300 'default' => '0',
301 'desc' => __('By enabling this settings will allow multiple instructors can upload their course.', 'tutor'),
302 ),
303 'instructor_register_page' => array(
304 'type' => 'select',
305 'label' => __('Instructor Registration Page', 'tutor'),
306 'default' => '0',
307 'options' => $pages,
308 'desc' => __('This page will be used to sign up new instructors.', 'tutor'),
309 ),
310 'instructor_can_publish_course' => array(
311 'type' => 'checkbox',
312 'label' => __('Can publish course', 'tutor'),
313 'default' => '0',
314 'desc' => __('Define if a instructor can publish his courses directly or not, if unchecked, they can still add courses, but it will go to admin for review', 'tutor'),
315 ),
316 'enable_become_instructor_btn' => array(
317 'type' => 'checkbox',
318 'label' => __('Become Instructor Button', 'tutor'),
319 'label_title' => __('Enable', 'tutor'),
320 'default' => '0',
321 'desc' => __('Uncheck this option to hide the button from student dashboard.', 'tutor'),
322 ),
323 ),
324 ),
325 ),
326 ),
327 'students' => array(
328 'label' => __('Students', 'tutor'),
329 'sections' => array(
330 'general' => array(
331 'label' => __('Student Profile settings', 'tutor'),
332 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
333 'fields' => array(
334 'student_register_page' => array(
335 'type' => 'select',
336 'label' => __('Student Registration Page', 'tutor'),
337 'default' => '0',
338 'options' => $pages,
339 'desc' => __('Choose the page for student registration page', 'tutor'),
340 ),
341 'students_own_review_show_at_profile' => array(
342 'type' => 'checkbox',
343 'label' => __('Show reviews on profile', 'tutor'),
344 'label_title' => __('Enable', 'tutor'),
345 'default' => '0',
346 'desc' => __('Enabling this will show the reviews written by each student on their profile', 'tutor')."<br />" .$student_url,
347 ),
348 'show_courses_completed_by_student' => array(
349 'type' => 'checkbox',
350 'label' => __('Show Completed Courses', 'tutor'),
351 'label_title' => __('Enable', 'tutor'),
352 'default' => '0',
353 'desc' => __('Completed courses will be show on student profile', 'tutor')."<br />".$student_url,
354 ),
355 ),
356 ),
357 ),
358 ),
359 'tutor_earning' => array(
360 'label' => __('Earning', 'tutor'),
361 'sections' => array(
362 'general' => array(
363 'label' => __('Earning and commission allocation', 'tutor'),
364 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
365 'fields' => array(
366 'enable_tutor_earning' => array(
367 'type' => 'checkbox',
368 'label' => __('Earning', 'tutor'),
369 'label_title' => __('Enable', 'tutor'),
370 'default' => '0',
371 'desc' => __('If disabled, the Admin will receive 100% of the earning', 'tutor'),
372 ),
373 'earning_admin_commission' => array(
374 'type' => 'number',
375 'label' => __('Admin Commission Percentage', 'tutor'),
376 'default' => '20',
377 'desc' => __('Define the commission of the Admin from each sale.(after deducting fees)', 'tutor'),
378 ),
379 'earning_instructor_commission' => array(
380 'type' => 'number',
381 'label' => __('Instructor Commission Percentage', 'tutor'),
382 'default' => '80',
383 'desc' => __('Define the commission for instructors from each sale.(after deducting fees)', 'tutor'),
384 ),
385 'tutor_earning_fees' => array(
386 'type' => 'group_fields',
387 'label' => __('Fee Deduction', 'tutor'),
388 'desc' => __('Fees are charged from the entire sales amount. The remaining amount will be divided among admin and instructors.', 'tutor'),
389 'group_fields' => array(
390
391 'enable_fees_deducting' => array(
392 'type' => 'checkbox',
393 'label' => __('Enable', 'tutor'),
394 'default' => '0',
395 ),
396 'fees_name' => array(
397 'type' => 'text',
398 'label' => __('Fee Name', 'tutor'),
399 'default' => '',
400 ),
401 'fees_amount' => array(
402 'type' => 'number',
403 'label' => __('Fee Amount', 'tutor'),
404 'default' => '',
405 ),
406 'fees_type' => array(
407 'type' => 'select',
408 'default' => 'minutes',
409 'select_options' => false,
410 'options' => array(
411 '' => __('Select Fees Type', 'tutor'),
412 'percent' => __('Percent', 'tutor'),
413 'fixed' => __('Fixed', 'tutor'),
414 ),
415 ),
416
417 ),
418 ),
419 'statement_show_per_page' => array(
420 'type' => 'number',
421 'label' => __('Show Statement Per Page', 'tutor'),
422 'default' => '20',
423 'desc' => __('Define the number of statement should show.', 'tutor'),
424 ),
425 ),
426 ),
427 ),
428 ),
429 'tutor_withdraw' => array(
430 'label' => __('Withdraw', 'tutor'),
431 'sections' => array(
432 'general' => array(
433 'label' => __('Withdrawal Settings', 'tutor'),
434 'fields' => array(
435 'min_withdraw_amount' => array(
436 'type' => 'number',
437 'label' => __('Minimum Withdraw Amount', 'tutor'),
438 'default' => '80',
439 'desc' => __('Define the withdraw amount, anyone can make withdraw request if their earning above or equal this amount.', 'tutor'),
440 ),
441 ),
442 ),
443
444 'withdraw_methods' => array(
445 'label' => __('Withdraw Methods', 'tutor'),
446 'desc' => __('Set withdraw settings', 'tutor'),
447 ),
448 ),
449 ),
450
451 'tutor_style' => array(
452 'label' => __('Style', 'tutor'),
453 'sections' => array(
454 'general' => array(
455 'label' => __('Color Style', 'tutor'),
456 'fields' => array(
457 'tutor_primary_color' => array(
458 'type' => 'color',
459 'label' => __('Primary Color', 'tutor'),
460 'default' => '',
461 ),
462 'tutor_primary_hover_color' => array(
463 'type' => 'color',
464 'label' => __('Primary Hover Color', 'tutor'),
465 'default' => '',
466 ),
467 'tutor_text_color' => array(
468 'type' => 'color',
469 'label' => __('Text color', 'tutor'),
470 'default' => '',
471 ),
472 'tutor_light_color' => array(
473 'type' => 'color',
474 'label' => __('Light color', 'tutor'),
475 'default' => '',
476 ),
477 ),
478 ),
479
480 ),
481 ),
482
483
484 );
485
486 return apply_filters('tutor/options/attr', $attr);
487 }
488
489 /**
490 * @param array $field
491 *
492 * @return string
493 *
494 * Generate Option Field
495 */
496 public function generate_field($field = array()){
497 ob_start();
498 include tutor()->path.'views/options/option_field.php';
499 return ob_get_clean();
500 }
501
502 public function field_type($field = array()){
503 ob_start();
504 include tutor()->path."views/options/field-types/{$field['type']}.php";
505 return ob_get_clean();
506 }
507
508 public function generate(){
509 ob_start();
510 include tutor()->path.'views/options/options_generator.php';
511 return ob_get_clean();
512 }
513
514 }