Addons.php
3 years ago
Admin.php
3 years ago
Ajax.php
3 years ago
Announcements.php
3 years ago
Assets.php
3 years ago
Backend_Page_Trait.php
3 years ago
Course.php
3 years ago
Course_Embed.php
3 years ago
Course_Filter.php
3 years ago
Course_List.php
3 years 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
3 years ago
Frontend.php
3 years ago
Gutenberg.php
3 years ago
Input.php
3 years ago
Instructor.php
3 years ago
Instructors_List.php
3 years ago
Lesson.php
3 years ago
Options_V2.php
3 years ago
Post_types.php
3 years ago
Private_Course_Access.php
3 years ago
Q_and_A.php
3 years ago
Question_Answers_List.php
3 years ago
Quiz.php
3 years ago
Quiz_Attempts_List.php
3 years ago
RestAPI.php
3 years ago
Reviews.php
3 years ago
Rewrite_Rules.php
4 years ago
Shortcode.php
3 years ago
Student.php
4 years ago
Students_List.php
4 years ago
Taxonomies.php
4 years ago
Template.php
3 years ago
Theme_Compatibility.php
5 years ago
Tools.php
3 years ago
Tools_V2.php
4 years ago
Tutor.php
3 years ago
TutorEDD.php
4 years ago
Tutor_Base.php
5 years ago
Tutor_List_Table.php
3 years ago
Tutor_Setup.php
3 years ago
Upgrader.php
4 years ago
User.php
4 years ago
Utils.php
3 years ago
Video_Stream.php
4 years ago
Withdraw.php
3 years ago
Withdraw_Requests_List.php
3 years ago
WooCommerce.php
3 years ago
Tutor_Setup.php
800 lines
| 1 | <?php |
| 2 | namespace TUTOR; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | exit; |
| 6 | } |
| 7 | |
| 8 | |
| 9 | class Tutor_Setup { |
| 10 | |
| 11 | public function __construct() { |
| 12 | add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
| 13 | add_action( 'admin_init', array( $this, 'setup_wizard' ) ); |
| 14 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| 15 | add_action( 'wp_ajax_setup_action', array( $this, 'tutor_setup_action' ) ); |
| 16 | add_filter( 'tutor_wizard_attributes', array( $this, 'tutor_setup_attributes_callback' ) ); |
| 17 | } |
| 18 | |
| 19 | function tutor_setup_attributes_callback( $attr ) { |
| 20 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 21 | $final_arr = array(); |
| 22 | $data_arr = $this->tutor_setup_attributes(); |
| 23 | foreach ( $data_arr as $key => $section ) { |
| 24 | foreach ( $section['attr'] as $k => $val ) { |
| 25 | $final_arr[ $k ] = isset( $options[ $k ] ) ? $options[ $k ] : ''; |
| 26 | } |
| 27 | } |
| 28 | return $final_arr; |
| 29 | } |
| 30 | |
| 31 | |
| 32 | public function tutor_setup_action() { |
| 33 | tutor_utils()->checking_nonce(); |
| 34 | |
| 35 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 36 | if ( ! isset( $_POST['action'] ) || $_POST['action'] != 'setup_action' || ! current_user_can( 'manage_options' ) ) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | // General Settings |
| 41 | $change_data = apply_filters( 'tutor_wizard_attributes', array() ); |
| 42 | foreach ( $change_data as $key => $value ) { |
| 43 | if ( isset( $_POST[ $key ] ) ) { |
| 44 | if ( $_POST[ $key ] != $change_data[ $key ] ) { |
| 45 | if ( $_POST[ $key ] == '' ) { |
| 46 | unset( $options[ $key ] ); |
| 47 | } else { |
| 48 | $options[ $key ] = tutor_sanitize_data( $_POST[ $key ] ); |
| 49 | } |
| 50 | } |
| 51 | $options_preset[ $key ] = tutor_sanitize_data( $_POST[ $key ] ); |
| 52 | } else { |
| 53 | unset( $options[ $key ] ); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // die(pr($options_preset)); |
| 58 | |
| 59 | update_option( 'tutor_default_option', $options_preset ); |
| 60 | |
| 61 | update_option( 'tutor_option', $options ); |
| 62 | |
| 63 | // Payment Settings |
| 64 | $payments = (array) maybe_unserialize( get_option( 'tutor_withdraw_options' ) ); |
| 65 | $payments_data = array( 'bank_transfer_withdraw', 'echeck_withdraw', 'paypal_withdraw' ); |
| 66 | foreach ( $payments_data as $key ) { |
| 67 | if ( isset( $_POST[ $key ] ) ) { |
| 68 | $payments[ $key ]['enabled'] = 1; |
| 69 | } else { |
| 70 | if ( $key == 'bank_transfer_withdraw' ) { |
| 71 | unset( $payments[ $key ]['enabled'] ); |
| 72 | } else { |
| 73 | unset( $payments[ $key ] ); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | update_option( 'tutor_withdraw_options', $payments ); |
| 78 | |
| 79 | // Add wizard flug |
| 80 | // update_option('tutor_wizard', 'active'); |
| 81 | |
| 82 | wp_send_json_success( array( 'status' => 'success' ) ); |
| 83 | } |
| 84 | |
| 85 | |
| 86 | public function admin_menus() { |
| 87 | add_dashboard_page( '', '', 'manage_options', 'tutor-setup', '' ); |
| 88 | } |
| 89 | |
| 90 | public function setup_wizard() { |
| 91 | if ( isset( $_GET['page'] ) ) { |
| 92 | if ( $_GET['page'] == 'tutor-setup' ) { |
| 93 | $this->tutor_setup_wizard_header(); |
| 94 | $this->tutor_setup_wizard_boarding(); |
| 95 | $this->tutor_setup_wizard_type(); |
| 96 | $this->tutor_setup_wizard_settings(); |
| 97 | $this->tutor_setup_wizard_footer(); |
| 98 | exit; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | public function tutor_setup_generator() { |
| 104 | |
| 105 | $i = 1; |
| 106 | $html = ''; |
| 107 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 108 | $payments = (array) maybe_unserialize( get_option( 'tutor_withdraw_options' ) ); |
| 109 | $field_arr = $this->tutor_setup_attributes(); |
| 110 | |
| 111 | $down_desc_fields = array( 'rows', 'slider', 'text', 'radio', 'dropdown', 'range', 'payments' ); |
| 112 | $full_width_fields = array( 'rows', 'slider', 'radio', 'range', 'payments', 'dropdown' ); |
| 113 | |
| 114 | foreach ( $field_arr as $key_parent => $field_parent ) { |
| 115 | // pr($key_parent); |
| 116 | $html .= '<li class="' . ( $i == 1 ? 'active' : '' ) . '">'; |
| 117 | $html .= '<div class="tutor-setup-content-heading heading">'; |
| 118 | $html .= '<div class="setup-section-title tutor-fs-6 tutor-fw-medium tutor-color-black">' . $field_parent['lable'] . '</div>'; |
| 119 | $html .= '<div class="step-info">'; |
| 120 | $html .= '<span class="tutor-fs-7 tutor-color-muted">' . __( 'Step', 'tutor' ) . ':</span> <strong class="tutor-color-black">' . $i . '/' . count( $field_arr ) . ' </strong>'; |
| 121 | $html .= '</div>'; |
| 122 | $html .= '<div class="tutor-reset-section tutor-text-btn-small tutor-color-secondary tutor-d-flex tutor-align-center">' . __( 'Reset Default', 'tutor' ) . '</div>'; |
| 123 | $html .= '</div>'; |
| 124 | $html .= '<div class="tutor-setup-content-heading body">'; |
| 125 | |
| 126 | foreach ( $field_parent['attr'] as $key => $field ) { |
| 127 | if ( ! isset( $field['lable'] ) ) { |
| 128 | continue; } |
| 129 | |
| 130 | // Generate data attributes if necessary |
| 131 | $data_attr = ''; |
| 132 | if ( isset( $field['data'] ) && is_array( $field['data'] ) ) { |
| 133 | foreach ( $field['data'] as $data_key => $data_value ) { |
| 134 | $data_attr .= ' data-' . $data_key . '="' . $data_value . '" '; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | $html .= '<div class="tutor-setting' . ( in_array( $field['type'], $full_width_fields ) ? ' course-setting-wrapper' : '' ) . ' ' . ( isset( $field['class'] ) ? $field['class'] : '' ) . '">'; |
| 139 | $html .= isset( $field['lable'] ) ? '<div class="tutor-fs-6 tutor-color-black ______">' . $field['lable'] : ''; |
| 140 | // $html .= isset( $field['tooltip'] ) ? '<span id="tooltip-btn" class="tooltip-btn" data-tooltip="'.$field['tooltip'].'"><span></span></span>' : ''; |
| 141 | $html .= isset( $field['tooltip'] ) ? '<span class="tooltip-wrap tooltip-icon"><span class="tooltip-txt tooltip-right">' . $field['tooltip'] . '</span></span>' : ''; |
| 142 | $html .= isset( $field['lable'] ) ? '</div>' : ''; |
| 143 | |
| 144 | if ( ! in_array( $field['type'], $down_desc_fields ) ) { |
| 145 | $html .= isset( $field['desc'] ) ? '<div class="content tutor-fs-7 tutor-color-secondary">' . $field['desc'] . '</div>' : ''; |
| 146 | } |
| 147 | |
| 148 | $html .= '<div class="settings">'; |
| 149 | |
| 150 | switch ( $field['type'] ) { |
| 151 | |
| 152 | case 'switch': |
| 153 | $html .= '<label for="' . $key . '" class="switch-label input-switch-label">'; |
| 154 | $html .= '<span class="label-off">' . __( 'OFF', 'tutor' ) . '</span>'; |
| 155 | $html .= '<div class="switchbox-wrapper">'; |
| 156 | $html .= '<input ' . $data_attr . ' id="' . $key . '" class="input-switchbox" type="checkbox" name="' . $key . '" value="on" ' . ( isset( $options[ $key ] ) && $options[ $key ] ? 'checked' : '' ) . '/>'; |
| 157 | $html .= '<span class="switchbox-icon"></span>'; |
| 158 | $html .= '</div>'; |
| 159 | $html .= '<span class="label-on">' . __( 'ON', 'tutor' ) . '</span>'; |
| 160 | $html .= '</label>'; |
| 161 | break; |
| 162 | |
| 163 | case 'text': |
| 164 | $html .= '<input type="text" name="' . $key . '" class="lesson-permalink" value="' . ( isset( $options[ $key ] ) ? $options[ $key ] : '' ) . '" />'; |
| 165 | break; |
| 166 | |
| 167 | case 'rows': |
| 168 | $html .= '<div class="content">'; |
| 169 | $html .= '<div class="course-per-row">'; |
| 170 | $html .= '<div class="wrapper">'; |
| 171 | $html .= '<label for="' . $key . '1">'; |
| 172 | $html .= '<input type="radio" value="1" name="' . $key . '" class="course" id="' . $key . '1" ' . ( isset( $options[ $key ] ) && $options[ $key ] == 1 ? 'checked' : '' ) . '>'; |
| 173 | $html .= '<span class="span"><span>1</span></span>'; |
| 174 | $html .= '</label>'; |
| 175 | $html .= '</div>'; |
| 176 | $html .= '<div class="wrapper">'; |
| 177 | $html .= '<label for="' . $key . '2">'; |
| 178 | $html .= '<input type="radio" value="2" name="' . $key . '" class="course" id="' . $key . '2" ' . ( isset( $options[ $key ] ) && $options[ $key ] == 2 ? 'checked' : '' ) . '>'; |
| 179 | $html .= '<span class="span"><span>2</span><span>2</span></span>'; |
| 180 | $html .= '</label>'; |
| 181 | $html .= '</div>'; |
| 182 | $html .= '<div class="wrapper">'; |
| 183 | $html .= '<label for="' . $key . '3">'; |
| 184 | $html .= '<input type="radio" value="3" name="' . $key . '" class="course" id="' . $key . '3" ' . ( isset( $options[ $key ] ) && $options[ $key ] == 3 ? 'checked' : '' ) . '>'; |
| 185 | $html .= '<span class="span"><span>3</span><span>3</span><span>3</span></span>'; |
| 186 | $html .= '</label>'; |
| 187 | $html .= '</div>'; |
| 188 | $html .= '<div class="wrapper">'; |
| 189 | $html .= '<label for="' . $key . '4">'; |
| 190 | $html .= '<input type="radio" value="4" name="' . $key . '" class="course" id="' . $key . '4" ' . ( isset( $options[ $key ] ) && $options[ $key ] == 4 ? 'checked' : '' ) . '>'; |
| 191 | $html .= '<span class="span"><span>4</span><span>4</span><span>4</span><span>4</span></span>'; |
| 192 | $html .= '</label>'; |
| 193 | $html .= '</div>'; |
| 194 | $html .= '</div>'; |
| 195 | $html .= '</div>'; |
| 196 | break; |
| 197 | |
| 198 | case 'radio': |
| 199 | if ( isset( $field['options'] ) ) { |
| 200 | foreach ( $field['options'] as $k => $val ) { |
| 201 | $html .= '<label for="' . $key . $k . '" class="time-expires"><input type="radio" id="' . $key . $k . '" name="' . $key . '" value="' . $k . '" ' . ( isset( $options[ $key ] ) && $options[ $key ] == $k ? 'checked' : '' ) . ' /> ' . '<span class="radio-icon"></span>'; |
| 202 | $html .= $val . '</label>'; |
| 203 | } |
| 204 | } |
| 205 | break; |
| 206 | |
| 207 | case 'slider': |
| 208 | $available_times = array( |
| 209 | 'seconds' => __( 'seconds', 'tutor' ), |
| 210 | 'minutes' => __( 'minutes', 'tutor' ), |
| 211 | 'hours' => __( 'hours', 'tutor' ), |
| 212 | 'days' => __( 'days', 'tutor' ), |
| 213 | 'weeks' => __( 'weeks', 'tutor' ), |
| 214 | ); |
| 215 | $html .= '<div class="limit-slider">'; |
| 216 | if ( isset( $field['time'] ) ) { |
| 217 | $html .= '<input type="range" name="' . $key . '[value]" min="' . ( isset( $field['min'] ) ? $field['min'] : 0 ) . '" max="' . ( isset( $field['max'] ) ? $field['max'] : 60 ) . '" step="1" value="' . ( isset( $options[ $key ]['value'] ) ? $options[ $key ]['value'] : '' ) . '" class="range-input"/>'; |
| 218 | $html .= '<input type="hidden" name="' . $key . '[time]" value="' . ( isset( $options[ $key ]['time'] ) ? $options[ $key ]['time'] : __( 'minutes', 'tutor' ) ) . '" class="range-input"/>'; |
| 219 | $html .= '<span class=""><span class="range-value">' . ( isset( $options[ $key ]['value'] ) ? $options[ $key ]['value'] : '' ) . '</span>'; |
| 220 | $html .= isset( $options[ $key ]['time'] ) ? $available_times[ $options[ $key ]['time'] ] : ''; |
| 221 | $html .= '</span>'; |
| 222 | } else { |
| 223 | $html .= '<input type="range" name="' . $key . '" min="' . ( isset( $field['min'] ) ? $field['min'] : '' ) . '" max="' . ( isset( $field['max'] ) ? $field['max'] : 30 ) . '" step="1" value="' . ( isset( $options[ $key ] ) ? $options[ $key ] : '' ) . '" class="range-input"/>'; |
| 224 | $html .= ' <strong class="range-value">' . ( isset( $options[ $key ] ) ? $options[ $key ] : '' ) . '</strong>'; |
| 225 | } |
| 226 | $html .= '</div>'; |
| 227 | break; |
| 228 | |
| 229 | case 'dropdown': |
| 230 | $html .= '<div class="grade-calculation"><div class="select-box"><div class="options-container">'; |
| 231 | $selected_data = ''; |
| 232 | if ( isset( $field['options'] ) ) { |
| 233 | foreach ( $field['options'] as $val ) { |
| 234 | $html .= '<div class="option">'; |
| 235 | $html .= '<input type="radio" class="radio" id="' . $val['value'] . '" name="' . $key . '" value="' . $val['value'] . '" ' . ( isset( $options[ $key ] ) && $options[ $key ] == $val['value'] ? 'checked' : '' ) . ' />'; |
| 236 | $html .= '<label for="' . $val['value'] . '">'; |
| 237 | $html .= '<h3>' . $val['title'] . '</h3>'; |
| 238 | $html .= '<h5>' . $val['desc'] . '</h5>'; |
| 239 | $html .= '</label>'; |
| 240 | $html .= '</div>'; |
| 241 | |
| 242 | if ( isset( $options[ $key ] ) && $options[ $key ] == $val['value'] ) { |
| 243 | $selected_data .= '<div class="selected">'; |
| 244 | $selected_data .= '<h3>' . $val['title'] . '</h3>'; |
| 245 | $selected_data .= '<h5>' . $val['desc'] . '</h5>'; |
| 246 | $selected_data .= '</div>'; |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | $html .= '</div>'; |
| 251 | $html .= $selected_data ? $selected_data : '<div class="selected"><h3>' . $field['options'][0]['title'] . '</h3><h5>' . $field['options'][0]['desc'] . '</h5></div>'; |
| 252 | $html .= '</div></div>'; |
| 253 | break; |
| 254 | |
| 255 | case 'payments': |
| 256 | $html .= '<div class="checkbox-wrapper column-3">'; |
| 257 | $available_withdraw_methods = get_tutor_all_withdrawal_methods(); |
| 258 | if ( ! empty( $available_withdraw_methods ) ) { |
| 259 | foreach ( $available_withdraw_methods as $key => $value ) { |
| 260 | $html .= '<div class="payment-setting">'; |
| 261 | $html .= '<label for="' . $key . '" class="label">'; |
| 262 | $html .= '<div>'; |
| 263 | $html .= '<input type="checkbox" name="' . $key . '" id="' . $key . '" class="checkbox payment" ' . ( isset( $payments[ $key ]['enabled'] ) && $payments[ $key ]['enabled'] ? 'checked' : '' ) . ' />'; |
| 264 | $html .= '<span class="check-icon round"></span>'; |
| 265 | $html .= '</div>'; |
| 266 | $html .= '<div>'; |
| 267 | $html .= '<img src="' . $value['image'] . '" alt="' . $value['method_name'] . '">'; |
| 268 | $html .= '<h4>' . $value['method_name'] . '</h4>'; |
| 269 | $html .= '</div>'; |
| 270 | $html .= '</label>'; |
| 271 | $html .= '</div>'; |
| 272 | } |
| 273 | } |
| 274 | $html .= '</div>'; |
| 275 | break; |
| 276 | |
| 277 | case 'range': |
| 278 | $earning_instructor = isset( $options['earning_instructor_commission'] ) ? $options['earning_instructor_commission'] : 80; |
| 279 | $earning_admin = isset( $options['earning_admin_commission'] ) ? $options['earning_admin_commission'] : 20; |
| 280 | $html .= '<div class="limit-slider column-1">'; |
| 281 | $html .= '<div class="limit-slider-has-parent">'; |
| 282 | $html .= '<input type="range" min="0" max="100" step="1" value="' . $earning_instructor . '" class="range-input double-range-slider" name=""/>'; |
| 283 | $html .= '</div>'; |
| 284 | $html .= '<div class="commision-data">'; |
| 285 | $html .= '<div class="data">'; |
| 286 | $html .= '<h4 class="range-value-1">' . $earning_instructor . '%</h4>'; |
| 287 | $html .= '<h5>' . __( 'Instructor', 'tutor' ) . '</h5>'; |
| 288 | $html .= '<input type="hidden" min="0" max="100" step="1" value="' . $earning_instructor . '" class="range-value-data-1 range-input" name="earning_instructor_commission"/>'; |
| 289 | $html .= '</div>'; |
| 290 | $html .= '<div class="data">'; |
| 291 | $html .= '<h4 class="range-value-2">' . $earning_admin . '%</h4>'; |
| 292 | $html .= '<h5>' . __( 'Admin / Owner', 'tutor' ) . '</h5>'; |
| 293 | $html .= '<input type="hidden" min="0" max="100" step="1" value="' . $earning_admin . '" class="range-value-data-2 range-input" name="earning_admin_commission"/>'; |
| 294 | $html .= '</div>'; |
| 295 | $html .= '</div>'; |
| 296 | $html .= '</div> '; |
| 297 | break; |
| 298 | |
| 299 | case 'checkbox': |
| 300 | $html .= '<div class="checkbox-wrapper column-2">'; |
| 301 | if ( isset( $field['options'] ) ) { |
| 302 | foreach ( $field['options'] as $k => $val ) { |
| 303 | $html .= '<div class="email-notification">'; |
| 304 | $html .= '<label for="' . $key . $k . '" class="label">'; |
| 305 | $html .= '<div>'; |
| 306 | $html .= '<input type="checkbox" value="' . $k . '" ' . ( isset( $options[ $key ] ) && $options[ $key ] == $k ? 'checked' : '' ) . ' name="' . $key . '" id="' . $key . $k . '" class="checkbox" />'; |
| 307 | $html .= '<span class="check-icon square"></span>'; |
| 308 | $html .= '</div>'; |
| 309 | $html .= '<div>'; |
| 310 | $html .= '<h4>' . $val . '</h4>'; |
| 311 | $html .= '</div>'; |
| 312 | $html .= '</label>'; |
| 313 | $html .= '</div>'; |
| 314 | } |
| 315 | } |
| 316 | $html .= '</div>'; |
| 317 | break; |
| 318 | |
| 319 | case 'attempt': |
| 320 | $html .= '<div class="tutor-setting course-setting-wrapper">'; |
| 321 | |
| 322 | $html .= '<input type="hidden" name="quiz_attempts_allowed" value="' . ( isset( $options[ $key ] ) ? $options[ $key ] : 'off' ) . '">'; |
| 323 | |
| 324 | $html .= '<div class="content">'; |
| 325 | $html .= '<div class="course-per-page attempts-allowed">'; |
| 326 | $html .= '<div class="wrapper">'; |
| 327 | $html .= '<label for="attempts-allowed-1">'; |
| 328 | $html .= '<input type="radio" value="single" name="attempts-allowed" class="course-p" id="attempts-allowed-1" ' . ( isset( $options[ $key ] ) && $options[ $key ] ? 'checked' : '' ) . '>'; |
| 329 | $html .= '<span class="radio-icon"></span>'; |
| 330 | $html .= '<span class="label-text label-text-2">'; |
| 331 | $html .= '<input type="number" value="' . $options[ $key ] . '" name="attempts-allowed-number" class="attempts tutor-form-number-verify" id="attempts-allowed-1" min="' . ( isset( $field['min'] ) ? $field['min'] : 0 ) . '" max="' . ( isset( $field['max'] ) ? $field['max'] : 30 ) . '">'; |
| 332 | $html .= '</span>'; |
| 333 | $html .= '</label>'; |
| 334 | $html .= '</div>'; |
| 335 | $html .= '<div class="wrapper tutor-unlimited-value">'; |
| 336 | $html .= '<label for="attempts-allowed-2">'; |
| 337 | $html .= '<input type="radio" name="attempts-allowed" value="unlimited" class="course-p" id="attempts-allowed-2" ' . ( ( ! isset( $options[ $key ] ) ) || $options[ $key ] == 0 ? 'checked' : '' ) . '>'; |
| 338 | $html .= '<span class="radio-icon"></span>'; |
| 339 | $html .= '<span class="label-text">' . __( 'Unlimited', 'tutor' ) . '</span>'; |
| 340 | $html .= '</label>'; |
| 341 | $html .= '</div>'; |
| 342 | $html .= '</div>'; |
| 343 | $html .= '</div>'; |
| 344 | $html .= '</div>'; |
| 345 | break; |
| 346 | |
| 347 | default: |
| 348 | // code... |
| 349 | break; |
| 350 | } |
| 351 | |
| 352 | if ( in_array( $field['type'], $down_desc_fields ) ) { |
| 353 | $html .= isset( $field['desc'] ) ? '<div class="content">' . $field['desc'] . '</div>' : ''; |
| 354 | } |
| 355 | $html .= '</div>'; |
| 356 | $html .= '</div>'; |
| 357 | |
| 358 | } |
| 359 | $html .= '</div>'; |
| 360 | if ( 'payments' !== $field['type'] ) { |
| 361 | $html .= $this->tutor_setup_wizard_action(); |
| 362 | } else { |
| 363 | $html .= $this->tutor_setup_wizard_action_final(); |
| 364 | } |
| 365 | $html .= '</li>'; |
| 366 | $i++; |
| 367 | } |
| 368 | |
| 369 | echo tutor_kses_html( $html ); |
| 370 | } |
| 371 | |
| 372 | |
| 373 | public function tutor_setup_attributes() { |
| 374 | $general_fields = array( |
| 375 | |
| 376 | 'general' => array( |
| 377 | 'lable' => __( 'General Settings', 'tutor' ), |
| 378 | 'attr' => array( |
| 379 | 'enable_course_marketplace' => array( |
| 380 | 'type' => 'marketplace', |
| 381 | ), |
| 382 | 'public_profile_layout' => array( |
| 383 | 'type' => 'switch', |
| 384 | 'data' => array( |
| 385 | 'off' => 'private', |
| 386 | 'on' => 'pp-rectangle', |
| 387 | ), |
| 388 | 'lable' => __( 'Instructor Profile', 'tutor' ), |
| 389 | 'desc' => __( 'Allow users to have a instructor profile to showcase awards and completed courses.', 'tutor' ), |
| 390 | ), |
| 391 | 'student_public_profile_layout' => array( |
| 392 | 'type' => 'switch', |
| 393 | 'data' => array( |
| 394 | 'off' => 'private', |
| 395 | 'on' => 'pp-rectangle', |
| 396 | ), |
| 397 | 'lable' => __( 'Student Profile', 'tutor' ), |
| 398 | 'desc' => __( 'Allow users to have a student profile to showcase awards and completed courses.', 'tutor' ), |
| 399 | ), |
| 400 | 'lesson_permalink_base' => array( |
| 401 | 'type' => 'text', |
| 402 | 'max' => 50, |
| 403 | 'lable' => __( 'Lesson permalink', 'tutor' ), |
| 404 | 'desc' => sprintf( __( 'Example: %s', 'tutor' ), get_home_url() . '/'.tutor()->course_post_type.'/sample-course/<strong>' . ( tutor_utils()->get_option( 'lesson_permalink_base', 'lessons' ) ) . '</strong>/sample-lesson/' ), |
| 405 | ), |
| 406 | ), |
| 407 | ), |
| 408 | |
| 409 | 'course' => array( |
| 410 | 'lable' => __( 'Course Settings', 'tutor' ), |
| 411 | 'attr' => array( |
| 412 | 'display_course_instructors' => array( |
| 413 | 'type' => 'switch', |
| 414 | 'lable' => __( 'Show Instructor Bio', 'tutor' ), |
| 415 | 'desc' => __( 'Let the students know the instructor(s). Display their credentials, professional experience, and more.', 'tutor' ), |
| 416 | ), |
| 417 | 'enable_q_and_a_on_course' => array( |
| 418 | 'type' => 'switch', |
| 419 | 'lable' => __( 'Question and Anwser', 'tutor' ), |
| 420 | 'desc' => __( 'Allows a Q&A forum on each course.', 'tutor' ), |
| 421 | ), |
| 422 | 'courses_col_per_row' => array( |
| 423 | 'type' => 'rows', |
| 424 | 'lable' => __( 'Courses Per Row', 'tutor' ), |
| 425 | 'tooltip' => __( 'How many courses per row on the archive pages.', 'tutor' ), |
| 426 | ), |
| 427 | 'courses_per_page' => array( |
| 428 | 'type' => 'slider', |
| 429 | 'lable' => __( 'Courses Per Page', 'tutor' ), |
| 430 | 'tooltip' => __( 'How many courses per page on the archive pages.', 'tutor' ), |
| 431 | ), |
| 432 | ), |
| 433 | ), |
| 434 | |
| 435 | 'instructor' => array( |
| 436 | 'lable' => __( 'Instructor Settings', 'tutor' ), |
| 437 | 'attr' => array( |
| 438 | 'enable_become_instructor_btn' => array( |
| 439 | 'type' => 'switch', |
| 440 | 'lable' => __( 'New Signup', 'tutor' ), |
| 441 | 'desc' => __( 'Choose between open and closed instructor signup. If you’re creating a course marketplace, instructor signup should be open.', 'tutor' ), |
| 442 | ), |
| 443 | 'instructor_can_publish_course' => array( |
| 444 | 'type' => 'switch', |
| 445 | 'lable' => __( 'Earning', 'tutor' ), |
| 446 | 'desc' => __( 'Enable earning for instructors?', 'tutor' ), |
| 447 | ), |
| 448 | ), |
| 449 | ), |
| 450 | |
| 451 | 'payment' => array( |
| 452 | 'lable' => __( 'Payment Settings ', 'tutor' ), |
| 453 | 'attr' => array( |
| 454 | 'enable_guest_course_cart' => array( |
| 455 | 'type' => 'switch', |
| 456 | 'lable' => __( 'Guest Checkout', 'tutor' ), |
| 457 | 'desc' => __( 'Allow users to buy and consume content without logging in.', 'tutor' ), |
| 458 | ), |
| 459 | 'commission_split' => array( |
| 460 | 'type' => 'range', |
| 461 | 'lable' => __( 'Commission Rate', 'tutor' ), |
| 462 | 'tooltip' => __( 'Control revenue sharing between admin and instructor.', 'tutor' ), |
| 463 | ), |
| 464 | 'earning_instructor_commission' => array( |
| 465 | 'type' => 'commission', |
| 466 | ), |
| 467 | 'earning_admin_commission' => array( |
| 468 | 'type' => 'commission', |
| 469 | ), |
| 470 | 'withdraw_split' => array( |
| 471 | 'type' => 'payments', |
| 472 | 'lable' => __( 'Payment Withdrawal Method', 'tutor' ), |
| 473 | 'desc' => __( 'Choose your preferred withdrawal method from the options.', 'tutor' ), |
| 474 | ), |
| 475 | |
| 476 | ), |
| 477 | ), |
| 478 | |
| 479 | ); |
| 480 | |
| 481 | return $general_fields; |
| 482 | } |
| 483 | |
| 484 | public function tutor_setup_wizard_settings() { |
| 485 | |
| 486 | $options = (array) maybe_unserialize( get_option( 'tutor_option' ) ); |
| 487 | |
| 488 | ?> |
| 489 | <div class="tutor-wizard-container"> |
| 490 | <div class="tutor-wrapper-boarding tutor-setup-wizard-settings"> |
| 491 | <div class="tutor-setup-wrapper"> |
| 492 | <ul class="tutor-setup-title"> |
| 493 | <li data-url="general" class="general active current"><?php _e( 'General', 'tutor' ); ?></li> |
| 494 | <li data-url="course" class="course"><?php _e( 'Course', 'tutor' ); ?></li> |
| 495 | <li data-url="instructor" class="instructor"><?php _e( 'Instructor', 'tutor' ); ?></li> |
| 496 | <li data-url="payment" class="payment"><?php _e( 'Payment', 'tutor' ); ?></li> |
| 497 | <li data-url="finish" style="display:none" class="finish"><?php _e( 'Finish', 'tutor' ); ?></li> |
| 498 | </ul> |
| 499 | |
| 500 | |
| 501 | <form id="tutor-setup-form" method="post"> |
| 502 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 503 | <input type="hidden" name="action" value="setup_action"> |
| 504 | |
| 505 | <?php $course_marketplace = tutor_utils()->get_option( 'enable_course_marketplace' ); ?> |
| 506 | <input type="hidden" name="enable_course_marketplace" class="enable_course_marketplace_data" value="<?php echo ( $course_marketplace ? 'on' : 'off' ); ?>"> |
| 507 | |
| 508 | <ul class="tutor-setup-content"> |
| 509 | <?php $this->tutor_setup_generator(); ?> |
| 510 | <li> |
| 511 | <div class="tutor-setup-content-heading greetings"> |
| 512 | <div class="header"> |
| 513 | <img src="<?php echo tutor()->url . 'assets/images/greeting-img.png'; ?>" alt="greeting"> |
| 514 | </div> |
| 515 | <div class="content"> |
| 516 | <h2><?php _e( 'Congratulations, you’re all set!', 'tutor' ); ?></h2> |
| 517 | <p><?php _e( 'Tutor LMS is up and running on your website! If you really want to become a Tutor LMS genius, read our <a target="_blank" href="https://docs.themeum.com/tutor-lms/">documentation</a> that covers everything!', 'tutor' ); ?></p> |
| 518 | <p><?php _e( 'If you need further assistance, please don’t hesitate to contact us via our <a target="_blank" href="https://www.themeum.com/contact-us/">contact form.</a>', 'tutor' ); ?></p> |
| 519 | </div> |
| 520 | <div class="tutor-setup-content-footer footer"> |
| 521 | <?php |
| 522 | $welcome_url = admin_url( 'admin.php?page=tutor&welcome=1' ); |
| 523 | $addons_url = admin_url( 'admin.php?page=tutor-addons' ); |
| 524 | $course_url = admin_url( 'admin.php?page=tutor' ); |
| 525 | ?> |
| 526 | <a class="tutor-btn tutor-btn-primary" href="<?php echo esc_url( ! self::is_welcome_page_visited() ? $welcome_url : $course_url ); ?>"> |
| 527 | <?php _e( 'Create a New Course', 'tutor' ); ?> |
| 528 | </a> |
| 529 | <a class="tutor-btn tutor-btn-outline-primary" href="<?php echo esc_url( ! self::is_welcome_page_visited() ? $welcome_url : $addons_url ); ?>"> |
| 530 | <?php _e( 'Explore Addons', 'tutor' ); ?> |
| 531 | </a> |
| 532 | </div> |
| 533 | </div> |
| 534 | </li> |
| 535 | </ul> |
| 536 | </form> |
| 537 | </div> |
| 538 | </div> |
| 539 | </div> |
| 540 | <?php |
| 541 | } |
| 542 | |
| 543 | public function tutor_setup_wizard_action() { |
| 544 | $html = '<div class="tutor-setup-content-footer footer">'; |
| 545 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 546 | $html .= '<button class="tutor-btn tutor-btn-outline-primary tutor-btn-md tutor-setup-previous">'; |
| 547 | $html .= '<span>←</span> <span>' . __( 'Previous', 'tutor' ) . '</span>'; |
| 548 | $html .= '</button>'; |
| 549 | $html .= '</div>'; |
| 550 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 551 | $html .= '<button class="tutor-setup-skip tutor-btn tutor-btn-ghost">' . __( 'Skip this step', 'tutor' ) . '</button>'; |
| 552 | $html .= '</div>'; |
| 553 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 554 | $html .= '<button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-setup-next">'; |
| 555 | $html .= '<span>' . __( 'Next', 'tutor' ) . '</span> <span>→</span>'; |
| 556 | $html .= '</button>'; |
| 557 | $html .= '</div>'; |
| 558 | $html .= '</div>'; |
| 559 | |
| 560 | return $html; |
| 561 | } |
| 562 | public function tutor_setup_wizard_action_final() { |
| 563 | $welcome_url = admin_url( 'admin.php?page=tutor&welcome=1' ); |
| 564 | |
| 565 | $html = '<div class="tutor-setup-content-footer footer">'; |
| 566 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 567 | $html .= '<button class="tutor-btn tutor-btn-outline-primary tutor-btn-md tutor-setup-previous">'; |
| 568 | $html .= '<span>←</span> <span>' . __( 'Previous', 'tutor' ) . '</span>'; |
| 569 | $html .= '</button>'; |
| 570 | $html .= '</div>'; |
| 571 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 572 | $html .= '<a href="' . esc_url( $welcome_url ) . '" class="tutor-btn tutor-btn-ghost">' . __( 'Skip this step', 'tutor' ) . '</a>'; |
| 573 | $html .= '</div>'; |
| 574 | $html .= '<div class="tutor-setup-btn-wrapper">'; |
| 575 | $html .= '<a href="' . esc_url( $welcome_url ) . '" class="tutor-btn tutor-btn-primary tutor-btn-md">' . __( 'Finish Setup', 'tutor' ) . '</a>'; |
| 576 | $html .= '</div>'; |
| 577 | $html .= '</div>'; |
| 578 | |
| 579 | return $html; |
| 580 | } |
| 581 | |
| 582 | public function tutor_setup_wizard_boarding() { |
| 583 | global $current_user; |
| 584 | ?> |
| 585 | <div class="tutor-wizard-container"> |
| 586 | <div class="tutor-wrapper-boarding tutor-setup-wizard-boarding active"> |
| 587 | <div class="wizard-boarding-header"> |
| 588 | <div> |
| 589 | <img src="<?php echo tutor()->url . 'assets/images/tutor-logo.svg'; ?>" /> |
| 590 | </div> |
| 591 | <div> |
| 592 | <div class="wizard-boarding-header-sub tutor-fs-5 tutor-color-black"> |
| 593 | <?php printf( __( 'Hello %s, welcome to Tutor LMS!', 'tutor' ), $current_user->user_login ); ?> |
| 594 | </div> |
| 595 | <div class="wizard-boarding-header-main tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mt-10"> |
| 596 | <?php _e( 'Thank You for Choosing Us', 'tutor' ); ?> |
| 597 | </div> |
| 598 | </div> |
| 599 | </div> |
| 600 | <div class="wizard-boarding-body tutor-mt-60"> |
| 601 | <ul class="slider tutor-boarding"> |
| 602 | <li> |
| 603 | <div class="slide-thumb"> |
| 604 | <img src="<?php echo tutor()->url . 'assets/images/scalable_lms_solution.jpg'; ?>" alt="<?php _e( 'A Powerful, Smart, and Scalable LMS Solution', 'tutor' ); ?>"/> |
| 605 | </div> |
| 606 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php _e( 'A Powerful, Smart, and Scalable LMS Solution', 'tutor' ); ?></div> |
| 607 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 608 | <?php _e( 'From individual instructors to vast eLearning platforms, Tutor LMS grows with you to create your ideal vision of an LMS website.', 'tutor' ); ?> |
| 609 | </div> |
| 610 | </li> |
| 611 | <li> |
| 612 | <div class="slide-thumb"> |
| 613 | <img src="<?php echo tutor()->url . 'assets/images/extensive_course_builder.jpg'; ?>" alt="<?php _e( 'Extensive Course Builder', 'tutor' ); ?>"/> |
| 614 | </div> |
| 615 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php _e( 'Extensive Course Builder', 'tutor' ); ?></div> |
| 616 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 617 | <?php _e( 'Tutor LMS comes with a state-of-the-art frontend course builder. Construct rich and resourceful courses with ease.', 'tutor' ); ?> |
| 618 | </div> |
| 619 | </li> |
| 620 | <li> |
| 621 | <div class="slide-thumb"> |
| 622 | <img src="<?php echo tutor()->url . 'assets/images/advanced_quiz_creator.jpg'; ?>" alt="<?php _e( 'Advanced Quiz Creator', 'tutor' ); ?>"/> |
| 623 | </div> |
| 624 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php _e( 'Advanced Quiz Creator', 'tutor' ); ?></div> |
| 625 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 626 | <?php _e( 'Build interactive quizzes with the vast selection of question types and verify the learning of your students.', 'tutor' ); ?> |
| 627 | </div> |
| 628 | </li> |
| 629 | <li> |
| 630 | <div class="slide-thumb"> |
| 631 | <img src="<?php echo tutor()->url . 'assets/images/freedom_with_ecommerce.jpg'; ?>" alt="<?php _e( 'Freedom With eCommerce', 'tutor' ); ?>"/> |
| 632 | </div> |
| 633 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php _e( 'Freedom With eCommerce', 'tutor' ); ?></div> |
| 634 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 635 | <?php _e( 'Select an eCommerce plugin and sell courses any way you like and use any payment gateway you want!', 'tutor' ); ?> |
| 636 | </div> |
| 637 | </li> |
| 638 | <li> |
| 639 | <div class="slide-thumb"> |
| 640 | <img src="<?php echo tutor()->url . 'assets/images/reports_and_analytics.jpg'; ?>" alt="<?php _e( 'Reports and Analytics', 'tutor' ); ?>"/> |
| 641 | </div> |
| 642 | <div class="slide-title tutor-fs-5 tutor-fw-medium tutor-color-black"><?php _e( 'Reports and Analytics', 'tutor' ); ?></div> |
| 643 | <div class="slide-subtitle tutor-fs-6 tutor-color-secondary tutor-mt-16"> |
| 644 | <?php _e( 'Track what type of courses sell the most! Gain insights on user purchases, manage reviews and track quiz attempts.', 'tutor' ); ?> |
| 645 | </div> |
| 646 | </li> |
| 647 | </ul> |
| 648 | </div> |
| 649 | <div class="wizard-boarding-footer"> |
| 650 | <div class=""> |
| 651 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-boarding-next"> |
| 652 | <?php _e( 'Let’s Start', 'tutor' ); ?> |
| 653 | </button> |
| 654 | </div> |
| 655 | <div> |
| 656 | <a href="<?php echo admin_url( 'admin.php?page=tutor' ); ?>" class="tutor-text-btn-medium"> |
| 657 | <?php _e( 'I already know, skip it!', 'tutor' ); ?> |
| 658 | </a> |
| 659 | </div> |
| 660 | </div> |
| 661 | </div> |
| 662 | </div> |
| 663 | <?php |
| 664 | } |
| 665 | |
| 666 | public function tutor_setup_wizard_type() { |
| 667 | $course_marketplace = tutor_utils()->get_option( 'enable_course_marketplace' ); |
| 668 | $course_marketplace = 1 === $course_marketplace ? 'on' : 'off'; |
| 669 | ?> |
| 670 | <div class="tutor-wizard-container"> |
| 671 | <div class="tutor-wrapper-type tutor-setup-wizard-type"> |
| 672 | <div class="wizard-type-header"> |
| 673 | <div class="logo"><img src="<?php echo esc_url( tutor()->url . 'assets/images/tutor-logo.svg' ); ?>" /></div> |
| 674 | <div class="title"><?php _e( 'Let’s get the platform up and running', 'tutor' ); ?></div> |
| 675 | <div class="subtitle"><?php _e( 'Pick a category for your LMS platform. You can always update this later.', 'tutor' ); ?></div> |
| 676 | </div> |
| 677 | <div class="wizard-type-body"> |
| 678 | <div class="wizard-type-item"> |
| 679 | <input id="enable_course_marketplace-0" type="radio" name="enable_course_marketplace" value="off" |
| 680 | <?php |
| 681 | if ( ! $course_marketplace ) { |
| 682 | echo 'checked'; } |
| 683 | ?> |
| 684 | /> |
| 685 | <span class="icon"></span> |
| 686 | <label for="enable_course_marketplace-0"> |
| 687 | <img src="<?php echo esc_url( tutor()->url . 'assets/images/single-marketplace.svg' ); ?>" /> |
| 688 | <div class="title"><?php _e( 'Individual', 'tutor' ); ?></div> |
| 689 | <div class="subtitle"><?php _e( 'Share solo journey as an educator and spared knowledge', 'tutor' ); ?></div> |
| 690 | <div class="action"> |
| 691 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-type-next"> |
| 692 | <?php _e( 'Next', 'tutor' ); ?> |
| 693 | </button> |
| 694 | </div> |
| 695 | </label> |
| 696 | </div> |
| 697 | |
| 698 | <div class="wizard-type-item"> |
| 699 | <input id="enable_course_marketplace-1" type="radio" name="enable_course_marketplace" value="on" |
| 700 | <?php |
| 701 | if ( $course_marketplace ) { |
| 702 | echo 'checked'; } |
| 703 | ?> |
| 704 | /> |
| 705 | <span class="icon"></span> |
| 706 | <label for="enable_course_marketplace-1"> |
| 707 | <img src="<?php echo esc_url( tutor()->url . 'assets/images/multiple-marketplace.svg' ); ?>" /> |
| 708 | <div class="title"><?php _e( 'Marketplace', 'tutor' ); ?></div> |
| 709 | <div class="subtitle"><?php _e( 'Create an eLearning platform to let anyone earn by teaching online', 'tutor' ); ?></div> |
| 710 | <div class="action"> |
| 711 | <button class="tutor-btn tutor-btn-primary tutor-btn-md tutor-type-next"> |
| 712 | <?php _e( 'Next', 'tutor' ); ?> |
| 713 | </button> |
| 714 | </div> |
| 715 | </label> |
| 716 | </div> |
| 717 | </div> |
| 718 | |
| 719 | <div class="wizard-type-footer"> |
| 720 | <div class="tutor-fs-7"> |
| 721 | <span><?php _e( 'Not sure?', 'tutor' ); ?></span> |
| 722 | <a href="#" class="tutor-type-skip" class=""> |
| 723 | <?php _e( 'Let’s go to the next step.', 'tutor' ); ?> |
| 724 | </a> |
| 725 | </div> |
| 726 | </div> |
| 727 | </div> |
| 728 | </div> |
| 729 | <?php |
| 730 | } |
| 731 | |
| 732 | |
| 733 | public function tutor_setup_wizard_header() { |
| 734 | set_current_screen(); |
| 735 | ?> |
| 736 | <!DOCTYPE html> |
| 737 | <html <?php language_attributes(); ?>> |
| 738 | <head> |
| 739 | <meta name="viewport" content="width=device-width" /> |
| 740 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 741 | <title><?php esc_html_e( 'Tutor › Setup Wizard', 'tutor' ); ?></title> |
| 742 | <?php |
| 743 | try { |
| 744 | do_action( 'admin_enqueue_scripts' ); |
| 745 | } catch (\Throwable $th) { |
| 746 | } |
| 747 | ?> |
| 748 | <?php wp_print_scripts( 'tutor-plyr' ); ?> |
| 749 | <?php wp_print_scripts( 'tutor-slick' ); ?> |
| 750 | <?php wp_print_scripts( 'tutor-setup' ); ?> |
| 751 | <?php do_action( 'admin_print_styles' ); ?> |
| 752 | <?php do_action( 'admin_head' ); ?> |
| 753 | </head> |
| 754 | <body class="tutor-setup wp-core-ui"> |
| 755 | <?php |
| 756 | } |
| 757 | |
| 758 | |
| 759 | public function tutor_setup_wizard_footer() { |
| 760 | ?> |
| 761 | </body> |
| 762 | </html> |
| 763 | <?php |
| 764 | } |
| 765 | |
| 766 | public function enqueue_scripts() { |
| 767 | if ( isset( $_GET['page'] ) && $_GET['page'] == 'tutor-setup' ) { |
| 768 | wp_enqueue_style( 'tutor-setup', tutor()->url . 'assets/css/tutor-setup.min.css', array(), TUTOR_VERSION ); |
| 769 | wp_enqueue_style( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.css', array(), TUTOR_VERSION ); |
| 770 | wp_enqueue_style( 'tutor-slick-theme', tutor()->url . 'assets/packages/slick/slick-theme.css', array(), TUTOR_VERSION ); |
| 771 | wp_register_script( 'tutor-slick', tutor()->url . 'assets/packages/slick/slick.min.js', array( 'jquery' ), TUTOR_VERSION, true ); |
| 772 | wp_register_script( 'tutor-setup-v2', tutor()->url . 'assets/js/tutor.min.js', array( 'jquery', 'wp-i18n' ), TUTOR_VERSION, true ); |
| 773 | wp_register_script( 'tutor-setup', tutor()->url . 'assets/js/tutor-setup.min.js', array( 'jquery', 'tutor-slick', 'wp-i18n' ), TUTOR_VERSION, true ); |
| 774 | wp_localize_script( 'tutor-setup', '_tutorobject', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | |
| 779 | /** |
| 780 | * Check if welcome page already visited |
| 781 | * |
| 782 | * @return mixed |
| 783 | */ |
| 784 | public static function is_welcome_page_visited(): bool { |
| 785 | return false; |
| 786 | // $visited = get_option( 'tutor_welcome_page_visited' ); |
| 787 | // return $visited ? true : false; |
| 788 | } |
| 789 | |
| 790 | /** |
| 791 | * Mark as welcome page visited |
| 792 | * |
| 793 | * @return void |
| 794 | */ |
| 795 | public static function mark_as_visited() { |
| 796 | update_option( 'tutor_welcome_page_visited', true ); |
| 797 | } |
| 798 | } |
| 799 | |
| 800 |