PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 2.7.3
Tutor LMS – eLearning and online course solution v2.7.3
3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.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 / Tools_V2.php
tutor / classes Last commit date
Addons.php 2 years ago Admin.php 2 years ago Ajax.php 2 years ago Announcements.php 3 years ago Assets.php 2 years ago Backend_Page_Trait.php 3 years ago Course.php 1 year ago Course_Embed.php 3 years ago Course_Filter.php 1 year ago Course_List.php 1 year ago Course_Settings_Tabs.php 3 years ago Course_Widget.php 3 years ago Custom_Validation.php 3 years ago Dashboard.php 3 years ago FormHandler.php 2 years ago Frontend.php 2 years ago Gutenberg.php 3 years ago Input.php 3 years ago Instructor.php 2 years ago Instructors_List.php 1 year ago Lesson.php 2 years ago Options_V2.php 1 year ago Permalink.php 2 years ago Post_types.php 2 years ago Private_Course_Access.php 3 years ago Q_And_A.php 1 year ago Question_Answers_List.php 3 years ago Quiz.php 2 years ago Quiz_Attempts_List.php 2 years ago RestAPI.php 2 years ago Reviews.php 3 years ago Rewrite_Rules.php 2 years ago Shortcode.php 1 year ago Student.php 2 years ago Students_List.php 3 years ago Taxonomies.php 3 years ago Template.php 2 years ago Theme_Compatibility.php 3 years ago Tools.php 3 years ago Tools_V2.php 2 years ago Tutor.php 2 years ago TutorEDD.php 2 years ago Tutor_Base.php 2 years ago Tutor_Setup.php 2 years ago Upgrader.php 2 years ago User.php 2 years ago Utils.php 1 year ago Video_Stream.php 3 years ago WhatsNew.php 2 years ago Withdraw.php 2 years ago Withdraw_Requests_List.php 3 years ago WooCommerce.php 2 years ago
Tools_V2.php
603 lines
1 <?php
2 /**
3 * Options for TutorLMS
4 *
5 * @package Tutor\Tools
6 * @author Themeum <support@themeum.com>
7 * @link https://themeum.com
8 * @since 2.0.0
9 */
10
11 namespace Tutor;
12
13 use TUTOR\Admin;
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 /**
20 * Tools class
21 *
22 * @since 2.0.0
23 */
24 class Tools_V2 {
25
26 /**
27 * Environment status
28 *
29 * @since 2.0.0
30 *
31 * @var string
32 */
33 private $environment_status;
34
35 /**
36 * Tools filed
37 *
38 * @since 2.0.0
39 *
40 * @var mixed
41 */
42 private $tools_fields;
43
44 /**
45 * Apply settings
46 *
47 * @since 2.0.0
48 *
49 * @return void send wp_json response
50 */
51 public function tutor_apply_settings() {
52 $tutor_settings_log = get_option( 'tutor_settings_log' );
53 $apply_id = $this->get_request_data( 'apply_id' );
54
55 update_option( 'tutor_option', $tutor_settings_log[ $apply_id ]['dataset'] );
56
57 wp_send_json_success( $tutor_settings_log[ $apply_id ] );
58 }
59
60 /**
61 * Get request data
62 *
63 * @since 2.0.0
64 *
65 * @param mixed $var var.
66 *
67 * @return mixed
68 */
69 public function get_request_data( $var ) {
70 return Input::sanitize_request_data( $var, null );
71 }
72
73 /**
74 * Tools page
75 *
76 * @since 2.0.0
77 *
78 * @return void including template
79 */
80 public function load_tools_page() {
81 $tools_fields = $this->get_tools_fields();
82 $tutor_setup = array( 'tutor-setup' => $tools_fields['tutor-setup'] );
83 unset( $tools_fields['tutor-setup'] );
84 $tools_fields = array_merge( $tools_fields, $tutor_setup );
85
86 $active_tab = Input::get( 'sub_page', 'status' );
87 include tutor()->path . '/views/options/tools.php';
88 }
89
90 /**
91 * Function options_tools
92 *
93 * @since 2.0.0
94 *
95 * @return array
96 */
97 private function get_tools_fields() {
98 global $wpdb;
99
100 if ( $this->tools_fields ) {
101 // Return fields if already prepared.
102 return $this->tools_fields;
103 }
104
105 $attr_tools = array(
106 'status' => array(
107 'label' => __( 'Status', 'tutor' ),
108 'slug' => 'status',
109 'desc' => __( 'Status Settings', 'tutor' ),
110 'template' => 'status',
111 'view_path' => tutor()->path . 'views/options/template/',
112 'icon' => 'tutor-icon-chart-pie',
113 'blocks' => array(
114 'wordpress_environment' => array(
115 'label' => __( 'WordPress environment', 'tutor' ),
116 'slug' => 'wordpress_environment',
117 'classes' => 'wordpress_environment',
118 'block_type' => 'column',
119 'fieldset' => array(
120 array(
121 array(
122 'key' => 'home_url',
123 'type' => 'info_row',
124 'label' => __( 'Home URL', 'tutor' ),
125 'status' => 'default',
126 'default' => $this->status( 'home_url' ),
127 ),
128 ),
129 array(
130 array(
131 'key' => 'wordpress_version',
132 'type' => 'info_col',
133 'label' => __( 'WordPress version', 'tutor' ),
134 'status' => 'default',
135 'default' => $this->status( 'wordpress_version' ),
136
137 ),
138 array(
139 'key' => 'wordpress_multisite',
140 'type' => 'info_col',
141 'label' => __( 'WordPress multisite', 'tutor' ),
142 'status' => 'default',
143 'default' => $this->status( 'wordpress_multisite' ),
144
145 ),
146 array(
147 'key' => 'wordpress_debug_mode',
148 'type' => 'info_col',
149 'label' => __( 'WordPress debug mode', 'tutor' ),
150 'status' => ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) ? 'success' : 'default',
151 'default' => $this->status( 'wordpress_debug_mode' ),
152
153 ),
154 array(
155 'key' => 'language',
156 'type' => 'info_col',
157 'label' => __( 'Language', 'tutor' ),
158 'status' => 'default',
159 'default' => $this->status( 'language' ),
160
161 ),
162 ),
163 array(
164 array(
165 'key' => 'site_url',
166 'type' => 'info_row',
167 'label' => __( 'Site URL', 'tutor' ),
168 'status' => 'default',
169 'default' => $this->status( 'site_url' ),
170
171 ),
172 ),
173 array(
174 array(
175 'key' => 'tutor_version',
176 'type' => 'info_col',
177 'label' => __( 'Tutor version', 'tutor' ),
178 'status' => 'success',
179 'default' => $this->status( 'tutor_version' ),
180
181 ),
182 array(
183 'key' => 'wordpress_memory_limit',
184 'type' => 'info_col',
185 'label' => __( 'WordPress memory limit', 'tutor' ),
186 'status' => 'success',
187 'default' => $this->status( 'wordpress_memory_limit' ),
188
189 ),
190 array(
191 'key' => 'wordpress_cron',
192 'type' => 'info_col',
193 'label' => __( 'WordPress Cron', 'tutor' ),
194 'status' => ! empty( _get_cron_array() ) ? 'success' : 'default',
195 'default' => $this->status( 'wordpress_cron' ),
196
197 ),
198 array(
199 'key' => 'external_object_cache',
200 'type' => 'info_col',
201 'label' => __( 'External object cache', 'tutor' ),
202 'status' => 'default',
203 'default' => $this->status( 'external_object_cache' ),
204
205 ),
206 ),
207 ),
208 ),
209 'server_environment' => array(
210 'label' => __( 'Server environment', 'tutor' ),
211 'slug' => 'server_environment',
212 'block_type' => 'column',
213 'fieldset' => array(
214 array(
215 array(
216 'key' => 'server_info',
217 'type' => 'info_col',
218 'label' => __( 'Server info', 'tutor' ),
219 'status' => 'default',
220 'default' => $this->status( 'server_info' ),
221
222 ),
223 array(
224 'key' => 'php_version',
225 'type' => 'info_col',
226 'label' => __( 'PHP version', 'tutor' ),
227 'status' => 'default',
228 'default' => $this->status( 'php_version' ),
229
230 ),
231 array(
232 'key' => 'php_post_max_size',
233 'type' => 'info_col',
234 'label' => __( 'PHP post max size', 'tutor' ),
235 'status' => 'default',
236 'default' => $this->status( 'php_post_max_size' ),
237
238 ),
239 array(
240 'key' => 'php_time_limit',
241 'type' => 'info_col',
242 'label' => __( 'PHP time limit', 'tutor' ),
243 'status' => 'default',
244 'default' => $this->status( 'php_time_limit' ),
245
246 ),
247 array(
248 'key' => 'curl_version',
249 'type' => 'info_col',
250 'label' => __( 'cURL version', 'tutor' ),
251 'status' => 'default',
252 'default' => $this->status( 'curl_version' ),
253
254 ),
255 array(
256 'key' => 'language',
257 'type' => 'info_col',
258 'label' => __( 'Language', 'tutor' ),
259 'status' => 'default',
260 'default' => $this->status( 'language' ),
261
262 ),
263 ),
264 array(
265 array(
266 'key' => 'tutor_version',
267 'type' => 'info_col',
268 'label' => __( 'MySQL version', 'tutor' ),
269 'status' => 'default',
270 'default' => sprintf( 'Server: %s, Client: %s', $wpdb->dbh->server_info, $wpdb->dbh->client_info ),
271 ),
272 array(
273 'key' => 'wordpress_memory_limit',
274 'type' => 'info_col',
275 'label' => __( 'Default timezone is UTC', 'tutor' ),
276 'status' => 'default',
277 'default' => $this->status( 'default_timezone_is_utc' ),
278 ),
279 array(
280 'key' => 'wordpress_cron',
281 'type' => 'info_col',
282 'label' => __( 'fsockopen/cURL', 'tutor' ),
283 'status' => 'default',
284 'default' => $this->status( 'fsockopen_curl' ),
285 ),
286 array(
287 'key' => 'external_object_cache',
288 'type' => 'info_col',
289 'label' => __( 'DOMDocument', 'tutor' ),
290 'status' => 'default',
291 'default' => $this->status( 'dom_document' ),
292 ),
293 array(
294 'key' => 'external_object_cache',
295 'type' => 'info_col',
296 'label' => __( 'GZip', 'tutor' ),
297 'status' => 'default',
298 'default' => $this->status( 'gzip' ),
299 ),
300 array(
301 'key' => 'external_object_cache',
302 'type' => 'info_col',
303 'label' => __( 'Multibyte string', 'tutor' ),
304 'status' => 'default',
305 'default' => $this->status( 'multibyte_string' ),
306 ),
307 ),
308 ),
309 ),
310 ),
311 ),
312 'import_export' => array(
313 'label' => __( 'Import/Export', 'tutor' ),
314 'slug' => 'import_export',
315 'desc' => __( 'Import/Export Settings', 'tutor' ),
316 'template' => 'import_export',
317 'view_path' => tutor()->path . 'views/options/template/',
318 'icon' => 'tutor-icon-import-export',
319 'blocks' => array(),
320 ),
321 'tutor_pages' => array(
322 'label' => __( 'Tutor Pages', 'tutor' ),
323 'slug' => 'tutor_pages',
324
325 'desc' => __( 'Tutor Pages Settings', 'tutor' ),
326 'template' => 'tutor_pages',
327 'view_path' => tutor()->path . 'views/options/template/',
328 'icon' => 'tutor-icon-page-review',
329 'blocks' => array(
330 'block' => array(),
331 ),
332 ),
333 'tutor_rest_api' => array(
334 'label' => __( 'Rest API', 'tutor' ),
335 'slug' => 'tutor_rest_api',
336 'desc' => __( 'Token List', 'tutor' ),
337 'template' => 'manage-tokens',
338 'view_path' => tutor()->path . 'views/pages/tools/',
339 'icon' => 'tutor-icon-api',
340 'blocks' => array(
341 'block' => array(),
342 ),
343 ),
344 'tutor-setup' => array(
345 'label' => __( 'Setup Wizard', 'tutor' ),
346 'slug' => 'tutor-setup',
347 'desc' => __( 'Setup Wizard Settings', 'tutor' ),
348 'icon' => 'tutor-icon-earth',
349 'blocks' => array(
350 'block' => array(),
351 ),
352 ),
353 );
354
355 $attr_tools = apply_filters( 'tutor/tools/extend/attr', apply_filters( 'tutor/tools/attr', apply_filters( 'tutor_tool_pages', $attr_tools ) ) );
356
357 $this->tools_fields = $attr_tools;
358
359 return $this->tools_fields;
360 }
361
362 /**
363 * Get environment info
364 *
365 * @since 2.0.0
366 *
367 * @return array
368 */
369 private function get_environment_info() {
370
371 if ( $this->environment_status ) {
372 // Use runtime cache for repetitive call.
373 return $this->environment_status;
374 }
375
376 // Figure out cURL version, if installed.
377 $curl_version = '';
378 if ( function_exists( 'curl_version' ) ) {
379 $curl_version = curl_version();
380 $curl_version = $curl_version['version'] . ', ' . $curl_version['ssl_version'];
381 }
382
383 // WP memory limit.
384 $wp_memory_limit = tutor_utils()->let_to_num( WP_MEMORY_LIMIT );
385 if ( function_exists( 'memory_get_usage' ) ) {
386 $wp_memory_limit = max( $wp_memory_limit, tutor_utils()->let_to_num( @ini_get( 'memory_limit' ) ) );
387 }
388
389 $database_version = tutor_utils()->get_db_version();
390
391 $this->environment_status = array(
392 'home_url' => get_option( 'home' ),
393 'site_url' => get_option( 'siteurl' ),
394 'version' => TUTOR_VERSION,
395 'wp_version' => get_bloginfo( 'version' ),
396 'wp_multisite' => is_multisite(),
397 'wp_memory_limit' => $wp_memory_limit,
398 'wp_debug_mode' => ( defined( 'WP_DEBUG' ) && WP_DEBUG ),
399 'wp_cron' => ! ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ),
400 'language' => get_locale(),
401 'external_object_cache' => wp_using_ext_object_cache(),
402 'server_info' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '',
403 'php_version' => phpversion(),
404 'php_post_max_size' => tutor_utils()->let_to_num( ini_get( 'post_max_size' ) ),
405 'php_max_execution_time' => ini_get( 'max_execution_time' ),
406 'php_max_input_vars' => ini_get( 'max_input_vars' ),
407 'curl_version' => $curl_version,
408 'suhosin_installed' => extension_loaded( 'suhosin' ),
409 'max_upload_size' => wp_max_upload_size(),
410 'mysql_version' => $database_version['number'],
411 'mysql_version_string' => $database_version['string'],
412 'default_timezone' => date_default_timezone_get(),
413 'fsockopen_or_curl_enabled' => ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ),
414 'soapclient_enabled' => class_exists( 'SoapClient' ),
415 'domdocument_enabled' => class_exists( 'DOMDocument' ),
416 'gzip_enabled' => is_callable( 'gzopen' ),
417 'mbstring_enabled' => extension_loaded( 'mbstring' ),
418 );
419
420 return $this->environment_status;
421 }
422
423 /**
424 * Status
425 *
426 * @since 2.0.0
427 *
428 * @param string $type type.
429 *
430 * @return mixed
431 */
432 public function status( $type = '' ) {
433
434 $data = array();
435 $data[ null ] = 'null';
436
437 $environment = $this->get_environment_info();
438
439 $data['home_url'] = $environment['home_url'] ?? null;
440 $data['site_url'] = $environment['site_url'] ?? null;
441
442 $latest_version = get_transient( 'tutor_system_status_wp_version_check' );
443
444 // WordPress already has efficient update notification mechanism.
445 // We don't need to slow down the page for no reason.
446 // phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
447 $data['wordpress_version'] = esc_html( $environment['wp_version'] );
448
449 $data['tutor_version'] = esc_html( $environment['version'] );
450
451 $data['wordpress_multisite'] = $environment['wp_multisite'] ? '' : '-';
452
453 $data['wordpress_debug_mode'] = $environment['wp_debug_mode'] ? '' : '-';
454
455 $data['language'] = esc_html( $environment['language'] );
456
457 $data['wordpress_memory_limit'] = ( $environment['wp_memory_limit'] < 67108864 )
458 ? sprintf( esc_html__( '%1$s - We recommend setting memory to at least 64MB. See: %2$s', 'tutor' ), esc_html( size_format( $environment['wp_memory_limit'] ) ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . esc_html__( 'Increasing memory allocated to PHP', 'tutor' ) . '</a>' )
459 : esc_html( size_format( $environment['wp_memory_limit'] ) );
460
461 $data['wordpress_cron'] = $environment['wp_cron'] ? '' : '-';
462
463 $data['external_object_cache'] = $environment['external_object_cache'] ? '' : '-';
464
465 $data['server_info'] = $environment['server_info'] ?? null;
466
467 $data['php_version'] = ( version_compare( $environment['php_version'], '7.2', '>=' ) )
468 ? esc_html( $environment['php_version'] )
469 : ( ( version_compare( $environment['php_version'], '5.6', '<' ) )
470 ? __( 'Tutor will run under this version of PHP, however, it has reached end of life. We recommend using PHP version 7.2 or above for greater performance and security.', 'tutor' )
471 : __( 'We recommend using PHP version 7.2 or above for greater performance and security.', 'tutor' ) );
472
473 $data['php_post_max_size'] = esc_html( size_format( $environment['php_post_max_size'] ) ) ?? null;
474
475 $data['php_time_limit'] = esc_html( $environment['php_max_execution_time'] ) ?? null;
476
477 $data['php_max_input_vars'] = esc_html( $environment['php_max_input_vars'] ) ?? null;
478
479 $data['curl_version'] = esc_html( $environment['curl_version'] ) ?? null;
480
481 $data['suhosin_installed'] = $environment['suhosin_installed'] ? '' : '-';
482
483 $data['max_upload_size'] = esc_html( size_format( $environment['max_upload_size'] ) ) ?? null;
484
485 $data['mysql_version'] = ( version_compare( $environment['mysql_version'], '5.6', '<' ) && ! strstr( $environment['mysql_version_string'], 'MariaDB' ) )
486 ?
487 /* translators: 1: MySQL version number, 2: WordPress requirements URL */
488 sprintf( esc_html__( '%1$s - We recommend a minimum MySQL version of 5.6. See: %2$s', 'tutor' ), esc_html( $environment['mysql_version_string'] ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . esc_html__( 'WordPress requirements', 'tutor' ) . '</a>' )
489 : esc_html( $environment['mysql_version_string'] );
490
491 $data['default_timezone_is_utc'] = ( 'UTC' !== $environment['default_timezone'] )
492 ?
493 /* translators: %s: default timezone */
494 sprintf( esc_html__( 'Default timezone is %s - it should be UTC', 'tutor' ), esc_html( $environment['default_timezone'] ) )
495 : '';
496
497 $data['fsockopen_curl'] = $environment['fsockopen_or_curl_enabled']
498 ? ''
499 : esc_html__( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'tutor' );
500
501 $data['dom_document'] = $environment['domdocument_enabled']
502 ? ''
503 :
504 /* translators: %s: DOMDocument class */
505 sprintf( esc_html__( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'tutor' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' );
506
507 $data['gzip'] = ( $environment['gzip_enabled'] )
508 ? ''
509 :
510 /* translators: %s: gzopen function */
511 sprintf( esc_html__( 'Your server does not support the %s function - this is required to use the GeoIP database from MaxMind.', 'tutor' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' );
512
513 $data['multibyte_string'] = ( $environment['mbstring_enabled'] )
514 ? ''
515 :
516 /* translators: %s: mbstring functions */
517 sprintf( esc_html__( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'tutor' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' );
518
519 if ( ! null == $type ) {
520 return $data[ $type ];
521 }
522
523 return $data[ null ];
524 }
525
526 /**
527 * Generate Option Field
528 *
529 * @since 2.0.0
530 *
531 * @param array $field fields.
532 *
533 * @return string
534 */
535 public function generate_field( $field = array() ) {
536 ob_start();
537 include tutor()->path . "views/options/field-types/{$field['type']}.php";
538
539 return ob_get_clean();
540 }
541
542 /**
543 * Get field type template
544 *
545 * @since 2.0.0
546 *
547 * @param array $field field.
548 *
549 * @return string
550 */
551 public function field_type( $field = array() ) {
552 ob_start();
553 include tutor()->path . "views/options/field-types/{$field['type']}.php";
554 return ob_get_clean();
555 }
556
557 /**
558 * Blocks template content
559 *
560 * @since 2.0.0
561 *
562 * @param array $blocks field.
563 *
564 * @return string
565 */
566 public function blocks( $blocks = array() ) {
567 ob_start();
568 include tutor()->path . 'views/options/option_blocks.php';
569 return ob_get_clean();
570 }
571
572 /**
573 * Template content
574 *
575 * @since 2.0.0
576 *
577 * @param array $section field.
578 *
579 * @return string
580 */
581 public function template( $section = array() ) {
582 ob_start();
583 include $section['view_path'] . $section['template'] . '.php';
584 return ob_get_clean();
585 }
586
587 /**
588 * Load template inside template directory
589 *
590 * @since 2.0.0
591 *
592 * @param string $template_slug template slug.
593 * @param array $section sections array.
594 *
595 * @return string
596 */
597 public function view_template( $template_slug, $section = array() ) {
598 ob_start();
599 require tutor()->path . "views/options/template/{$template_slug}";
600 return ob_get_clean();
601 }
602 }
603