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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 7 years ago Admin.php 7 years ago Ajax.php 7 years ago Assets.php 7 years ago Course.php 7 years ago Gutenberg.php 7 years ago Instructor.php 7 years ago Instructors_List.php 7 years ago Lesson.php 7 years ago Options.php 7 years ago Post_types.php 7 years ago Q_and_A.php 7 years ago Question.php 7 years ago Question_Answers_List.php 7 years ago Quiz.php 7 years ago Quiz_Attempts_List.php 7 years ago Rewrite_Rules.php 7 years ago Shortcode.php 7 years ago Student.php 7 years ago Students_List.php 7 years ago Template.php 7 years ago Theme_Compatibility.php 7 years ago Tools.php 7 years ago Tutor.php 7 years ago TutorEDD.php 7 years ago Tutor_Base.php 7 years ago Tutor_List_Table.php 7 years ago User.php 7 years ago Utils.php 7 years ago Video_Stream.php 7 years ago Withdraw.php 7 years ago Withdraw_Requests_List.php 7 years ago WooCommerce.php 7 years ago
Options.php
471 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
61 //re-sync settings
62 //init::tutor_activate();
63
64 wp_send_json_success( array('msg' => __('Option Updated', 'tutor') ) );
65 }
66
67 public function options_attr(){
68 $pages = tutor_utils()->get_pages();
69
70 //$course_base = tutor_utils()->course_archive_page_url();
71 $lesson_url = site_url().'/course/'.'sample-course/<code>lessons</code>/sample-lesson/';
72
73 $student_url = tutor_utils()->profile_url();
74
75 $attempts_allowed = array();
76 $attempts_allowed['unlimited'] = __('Unlimited' , 'tutor');
77 $attempts_allowed = array_merge($attempts_allowed, array_combine(range(1,20), range(1,20)));
78
79 $attr = array(
80 'general' => array(
81 'label' => __('General', 'tutor'),
82 'sections' => array(
83 'general' => array(
84 'label' => __('General', 'tutor'),
85 'desc' => __('General Settings', 'tutor'),
86 'fields' => array(
87 'tutor_dashboard_page_id' => array(
88 'type' => 'select',
89 'label' => __('Tutor Dashboard', 'tutor'),
90 'default' => '0',
91 'options' => $pages,
92 'desc' => __('This page will show dashboard related stuff, like my courses, order, earnings, logout etc', 'tutor'),
93 ),
94 'enable_public_profile' => array(
95 'type' => 'checkbox',
96 'label' => __('Enable Public Profile', 'tutor'),
97 'default' => '0',
98 'desc' => __('Enable this to make a profile publicly visible', 'tutor')."<br />" .$student_url,
99 ),
100 'load_tutor_css' => array(
101 'type' => 'checkbox',
102 'label' => __('Load Tutor default CSS', 'tutor'),
103 'default' => '1',
104 'desc' => __('If your theme has its own styling, then you can turn it off to load CSS from the plugin directory', 'tutor'),
105 ),
106 'load_tutor_js' => array(
107 'type' => 'checkbox',
108 'label' => __('Load Tutor default JavaScript', 'tutor'),
109 'default' => '1',
110 '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'),
111 ),
112 'student_must_login_to_view_course' => array(
113 'type' => 'checkbox',
114 'label' => __('Course Permission', 'tutor'),
115 'desc' => __('Students must be logged in to view course', 'tutor'),
116 ),
117 'delete_on_uninstall' => array(
118 'type' => 'checkbox',
119 'label' => __('Erase upon uninstallation', 'tutor'),
120 'desc' => __('Delete all data during uninstall', 'tutor'),
121 ),
122 )
123 )
124 ),
125 ),
126 'course' => array(
127 'label' => __('Course', 'tutor'),
128 'sections' => array(
129 'general' => array(
130 'label' => __('General', 'tutor'),
131 'desc' => __('Course Settings', 'tutor'),
132 'fields' => array(
133 'display_course_instructors' => array(
134 'type' => 'checkbox',
135 'label' => __('Display instructors profile', 'tutor'),
136 'label_title' => __('Show the instructor profile on course single page.', 'tutor'),
137 ),
138 'enable_q_and_a_on_course' => array(
139 'type' => 'checkbox',
140 'label' => __('Enable Q &amp; A on course', 'tutor'),
141 'default' => '0',
142 'desc' => __('Allow student to place their questions and answers on the course page, only enrolled student can do this', 'tutor'),
143 ),
144 ),
145 ),
146 'archive' => array(
147 'label' => __('Archive', 'tutor'),
148 'desc' => __('Course Archive Settings', 'tutor'),
149 'fields' => array(
150 'course_archive_page' => array(
151 'type' => 'select',
152 'label' => __('Course Archive Page', 'tutor'),
153 'default' => '0',
154 'options' => $pages,
155 'desc' => __('Choose the page from the dropdown list where you want to show all of the courses', 'tutor'),
156 ),
157 'courses_col_per_row' => array(
158 'type' => 'slider',
159 'label' => __('Column per row', 'tutor'),
160 'default' => '4',
161 'options' => array('min'=> 1, 'max' => 6),
162 'desc' => __('Define how many column you want to show on the course single page', 'tutor'),
163 ),
164 'courses_per_page' => array(
165 'type' => 'slider',
166 'label' => __('Courses Per Page', 'tutor'),
167 'default' => '12',
168 'options' => array('min'=> 1, 'max' => 20),
169 'desc' => __('Define how many courses you want to show per page', 'tutor'),
170 ),
171 ),
172 ),
173 ),
174 ),
175 'lesson' => array(
176 'label' => __('Lessons', 'tutor'),
177 'sections' => array(
178 'lesson_settings' => array(
179 'label' => __('Lesson Settings', 'tutor'),
180 'desc' => __('Lesson settings will be here', 'tutor'),
181 'fields' => array(
182 'lesson_permalink_base' => array(
183 'type' => 'text',
184 'label' => __('Lesson Permalink Base', 'tutor'),
185 'default' => 'lessons',
186 'desc' => $lesson_url,
187 ),
188
189 ),
190
191 ),
192
193 ),
194 ),
195 'quiz' => array(
196 'label' => __('Quiz', 'tutor'),
197 'sections' => array(
198 'general' => array(
199 'label' => __('Quiz', 'tutor'),
200 'desc' => __('The values you set here define the default values that are used in the settings form when you create a new quiz.', 'tutor'),
201 'fields' => array(
202 'quiz_time_limit' => array(
203 'type' => 'group_fields',
204 'label' => __('Time Limit', 'tutor'),
205 'desc' => __('Default time limit for quizzes. 0 means no time limit.', 'tutor'),
206 'group_fields' => array(
207 'value' => array(
208 'type' => 'text',
209 'default' => '0',
210 ),
211 'time' => array(
212 'type' => 'select',
213 'default' => 'minutes',
214 'select_options' => false,
215 'options' => array(
216 'weeks' => __('Weeks', 'tutor'),
217 'days' => __('Days', 'tutor'),
218 'hours' => __('Hours', 'tutor'),
219 'minutes' => __('Minutes', 'tutor'),
220 'seconds' => __('Seconds', 'tutor'),
221 ),
222 ),
223 ),
224 ),
225
226 'quiz_when_time_expires' => array(
227 'type' => 'radio',
228 'label' => __('When time expires', 'tutor'),
229 'default' => 'minutes',
230 'select_options' => false,
231 'options' => array(
232 'autosubmit' => __('Current attempts are submitted automatically', 'tutor'),
233 'graceperiod' => __('There is a grace period when current attempts can be submitted, but no more questions answered', 'tutor'),
234 'autoabandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'),
235 ),
236 'desc' => __('What should happen by default if a student does not submit the quiz before time expires.', 'tutor'),
237 ),
238
239 'quiz_attempts_allowed' => array(
240 'type' => 'number',
241 'label' => __('Attempts allowed', 'tutor'),
242 'default' => '10',
243 'desc' => __('Restriction on the number of attempts students are allowed to take for a quiz. 0 for no limit', 'tutor'),
244 ),
245
246 'quiz_grade_method' => array(
247 'type' => 'select',
248 'label' => __('Grading method', 'tutor'),
249 'default' => 'minutes',
250 'select_options' => false,
251 'options' => array(
252 'highest_grade' => __('Highest Grade', 'tutor'),
253 'average_grade' => __('Average Grade', 'tutor'),
254 'first_attempt' => __('First Attempt', 'tutor'),
255 'last_attempt' => __('Last Attempt', 'tutor'),
256 ),
257 'desc' => __('When multiple attempts are allowed, which method should be used to calculate a student\'s final grade for the quiz.', 'tutor'),
258 ),
259 )
260 )
261 ),
262 ),
263 'instructors' => array(
264 'label' => __('Instructors', 'tutor'),
265 'sections' => array(
266 'general' => array(
267 'label' => __('Instructor Profile Settings', 'tutor'),
268 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
269 'fields' => array(
270 'instructor_register_page' => array(
271 'type' => 'select',
272 'label' => __('Instructor Register Page', 'tutor'),
273 'default' => '0',
274 'options' => $pages,
275 'desc' => __('This will be instructor register page', 'tutor'),
276 ),
277 'instructor_can_publish_course' => array(
278 'type' => 'checkbox',
279 'label' => __('Can publish course', 'tutor'),
280 'default' => '0',
281 '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'),
282 ),
283 ),
284 ),
285 ),
286 ),
287
288 'students' => array(
289 'label' => __('Students', 'tutor'),
290 'sections' => array(
291 'general' => array(
292 'label' => __('Student Profile settings', 'tutor'),
293 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
294 'fields' => array(
295 'student_register_page' => array(
296 'type' => 'select',
297 'label' => __('Student Register Page', 'tutor'),
298 'default' => '0',
299 'options' => $pages,
300 'desc' => __('Choose the page for student registration page', 'tutor'),
301 ),
302 'students_own_review_show_at_profile' => array(
303 'type' => 'checkbox',
304 'label' => __('Show reviews on profile', 'tutor'),
305 'label_title' => __('Enable students review on their profile', 'tutor'),
306 'default' => '0',
307 'desc' => __('Enabling this will allow the reviews written by each individual students on their profile', 'tutor')."<br />" .$student_url,
308 ),
309 'show_courses_completed_by_student' => array(
310 'type' => 'checkbox',
311 'label' => __('Show Completed Course', 'tutor'),
312 'default' => '0',
313 'desc' => __('Completed courses will be show on student profile', 'tutor')."<br />".$student_url,
314 ),
315
316 ),
317 ),
318 ),
319 ),
320
321 'tutor_earning' => array(
322 'label' => __('Earning', 'tutor'),
323 'sections' => array(
324 'general' => array(
325 'label' => __('Earning and commission allocation', 'tutor'),
326 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
327 'fields' => array(
328
329 'enable_tutor_earning' => array(
330 'type' => 'checkbox',
331 'label' => __('Enable/Disable', 'tutor'),
332 'label_title' => __('Enable Instructor Earning and commission allocation', 'tutor'),
333 'default' => '0',
334 'desc' => __('You can set commission and generate earning for instructor who interested sell their course with this platform by enabling this feature', 'tutor'),
335 ),
336
337 'earning_admin_commission' => array(
338 'type' => 'number',
339 'label' => __('Admin / Platform Owner Commission', 'tutor'),
340 'default' => '20',
341 'desc' => __('Define the sales commission for admin from every course sell.', 'tutor'),
342 ),
343 'earning_instructor_commission' => array(
344 'type' => 'number',
345 'label' => __('Instructor Commission', 'tutor'),
346 'default' => '80',
347 'desc' => __('Define the sales commission for instructor from every course sell.', 'tutor'),
348 ),
349
350 'tutor_earning_fees' => array(
351 'type' => 'group_fields',
352 'label' => __('Others Fees', 'tutor'),
353 'desc' => __('Deduct the more fees from the instructor, the deducting process will be, first deduct this fees from total course payment, then commission will be allocation on rest amount.', 'tutor'),
354 'group_fields' => array(
355
356 'enable_fees_deducting' => array(
357 'type' => 'checkbox',
358 'label' => __('Enable Deduct Fees', 'tutor'),
359 'default' => '0',
360 ),
361 'fees_name' => array(
362 'type' => 'text',
363 'label' => __('Fees Name', 'tutor'),
364 'default' => '',
365 ),
366 'fees_amount' => array(
367 'type' => 'number',
368 'label' => __('Fees Amount', 'tutor'),
369 'default' => '',
370 ),
371 'fees_type' => array(
372 'type' => 'select',
373 'default' => 'minutes',
374 'select_options' => false,
375 'options' => array(
376 '' => __('Select Fees Type', 'tutor'),
377 'percent' => __('Percent', 'tutor'),
378 'fixed' => __('Fixed', 'tutor'),
379 ),
380 ),
381 ),
382 ),
383 'statement_show_per_page' => array(
384 'type' => 'number',
385 'label' => __('Show Statement Per Page', 'tutor'),
386 'default' => '20',
387 'desc' => __('Define the number of statement should show.', 'tutor'),
388 ),
389
390 ),
391 ),
392
393
394 ),
395 ),
396
397
398
399
400
401
402
403
404 'tutor_withdraw' => array(
405 'label' => __('Withdraw', 'tutor'),
406 'sections' => array(
407 'general' => array(
408 'label' => __('Earning and commission allocation', 'tutor'),
409 'fields' => array(
410
411 'min_withdraw_amount' => array(
412 'type' => 'number',
413 'label' => __('Minimum Withdraw Amount', 'tutor'),
414 'default' => '80',
415 'desc' => __('Define the withdraw amount, anyone can make withdraw request if their earning above or equal this amount.', 'tutor'),
416 ),
417
418 ),
419 ),
420
421 'withdraw_methods' => array(
422 'label' => __('Withdraw Methods', 'tutor'),
423 'desc' => __('Set withdraw settings', 'tutor'),
424 ),
425
426 ),
427 ),
428
429
430
431
432
433
434
435
436
437
438 );
439
440 return apply_filters('tutor/options/attr', $attr);
441 }
442
443
444 /**
445 * @param array $field
446 *
447 * @return string
448 *
449 * Generate Option Field
450 */
451 public function generate_field($field = array()){
452 ob_start();
453 include tutor()->path.'views/options/option_field.php';
454 return ob_get_clean();
455 }
456
457 public function field_type($field = array()){
458 ob_start();
459 include tutor()->path."views/options/field-types/{$field['type']}.php";
460 return ob_get_clean();
461 }
462
463 public function generate(){
464 ob_start();
465 include tutor()->path.'views/options/options_generator.php';
466 return ob_get_clean();
467 }
468
469
470
471 }