| @@ -1,62 +1,116 @@ | ||
| 1 | 1 | <?php |
| 2 | +/* | |
| 3 | +Plugin Name: Tutor LMS | |
| 4 | +Plugin URI: https://www.themeum.com/product/tutor-lms/ | |
| 5 | +Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes. | |
| 6 | +Author: Themeum | |
| 7 | +Version: 1.9.4 | |
| 8 | +Author URI: https://themeum.com | |
| 9 | +Requires at least: 4.5 | |
| 10 | +Tested up to: 5.7 | |
| 11 | +License: GPLv2 or later | |
| 12 | +Text Domain: tutor | |
| 13 | +*/ | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) | |
| 15 | + exit; | |
| 16 | + | |
| 2 | 17 | /** |
| 3 | - * Plugin Name: Tutor LMS | |
| 4 | - * Plugin URI: https://tutorlms.com | |
| 5 | - * Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes. | |
| 6 | - * Author: Themeum | |
| 7 | - * Version: 3.9.15 | |
| 8 | - * Author URI: https://themeum.com | |
| 9 | - * Requires PHP: 7.4 | |
| 10 | - * Requires at least: 5.3 | |
| 11 | - * Tested up to: 7.0 | |
| 12 | - * License: GPLv2 or later | |
| 13 | - * Text Domain: tutor | |
| 18 | + * Defined the tutor main file | |
| 19 | + */ | |
| 20 | +define( 'TUTOR_VERSION', '1.9.4' ); | |
| 21 | +define( 'TUTOR_FILE', __FILE__ ); | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * Load tutor text domain for translation | |
| 25 | + */ | |
| 26 | +add_action( 'init', function() { | |
| 27 | + load_plugin_textdomain( 'tutor', false, basename( dirname( __FILE__ ) ) . '/languages' ); | |
| 28 | +}); | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * Tutor Helper function | |
| 14 | 32 | * |
| 15 | - * @package Tutor | |
| 33 | + * @since v.1.0.0 | |
| 16 | 34 | */ |
| 17 | 35 | |
| 18 | -use TUTOR\Tutor; | |
| 36 | +if ( ! function_exists('tutor') ) { | |
| 37 | + function tutor() { | |
| 38 | + $path = plugin_dir_path( TUTOR_FILE ); | |
| 39 | + $hasPro = defined('TUTOR_PRO_VERSION'); | |
| 19 | 40 | |
| 20 | -defined( 'ABSPATH' ) || exit; | |
| 41 | + $info = array( | |
| 42 | + 'path' => $path, | |
| 43 | + 'url' => plugin_dir_url( TUTOR_FILE ), | |
| 44 | + 'basename' => plugin_basename( TUTOR_FILE ), | |
| 45 | + 'version' => TUTOR_VERSION, | |
| 46 | + 'nonce_action' => 'tutor_nonce_action', | |
| 47 | + 'nonce' => '_tutor_nonce', | |
| 48 | + 'course_post_type' => apply_filters( 'tutor_course_post_type', 'courses' ), | |
| 49 | + 'lesson_post_type' => apply_filters( 'tutor_lesson_post_type', 'lesson' ), | |
| 50 | + 'instructor_role' => apply_filters( 'tutor_instructor_role', 'tutor_instructor' ), | |
| 51 | + 'instructor_role_name' => apply_filters( 'tutor_instructor_role_name', __( 'Tutor Instructor', 'tutor' ) ), | |
| 52 | + 'template_path' => apply_filters( 'tutor_template_path', 'tutor/' ), | |
| 53 | + 'has_pro' => apply_filters( 'tutor_has_pro', $hasPro), | |
| 54 | + ); | |
| 21 | 55 | |
| 22 | -require_once __DIR__ . '/vendor/autoload.php'; | |
| 56 | + return (object) $info; | |
| 57 | + } | |
| 58 | +} | |
| 23 | 59 | |
| 60 | +if ( ! class_exists('Tutor') ) { | |
| 61 | + include_once 'classes/Tutor.php'; | |
| 62 | +} | |
| 63 | + | |
| 24 | 64 | /** |
| 25 | - * Constants for tutor plugin. | |
| 65 | + * @return \TUTOR\Utils | |
| 26 | 66 | * |
| 27 | - * @since 1.0.0 | |
| 67 | + * Get all helper functions/methods | |
| 68 | + * | |
| 28 | 69 | */ |
| 29 | -define( 'TUTOR_VERSION', '3.9.15' ); | |
| 30 | -define( 'TUTOR_FILE', __FILE__ ); | |
| 31 | 70 | |
| 71 | +if ( ! class_exists('\TUTOR\Utils') ) { | |
| 72 | + include_once 'classes/Utils.php'; | |
| 73 | +} | |
| 74 | + | |
| 75 | +if ( ! function_exists('tutor_utils') ) { | |
| 76 | + function tutor_utils() { | |
| 77 | + return new \TUTOR\Utils(); | |
| 78 | + } | |
| 79 | +} | |
| 80 | + | |
| 32 | 81 | /** |
| 33 | - * Load text domain for translations. | |
| 82 | + * @return \TUTOR\Utils | |
| 34 | 83 | * |
| 35 | - * @since 1.0.0 | |
| 84 | + * alis of tutor_utils() | |
| 85 | + * | |
| 86 | + * @since v.1.3.4 | |
| 36 | 87 | */ |
| 37 | -add_action( 'init', fn () => load_plugin_textdomain( 'tutor', false, basename( __DIR__ ) . '/languages' ) ); | |
| 38 | 88 | |
| 89 | +if ( ! function_exists('tutils') ) { | |
| 90 | + function tutils() { | |
| 91 | + return tutor_utils(); | |
| 92 | + } | |
| 93 | +} | |
| 94 | + | |
| 39 | 95 | /** |
| 40 | 96 | * Do some task during activation |
| 97 | + * @moved here from Tutor Class | |
| 98 | + * @since v.1.5.2 | |
| 99 | + */ | |
| 100 | +register_activation_hook( TUTOR_FILE, array('\TUTOR\Tutor', 'tutor_activate') ); | |
| 101 | +register_deactivation_hook( TUTOR_FILE, array('\TUTOR\Tutor', 'tutor_deactivation') ); | |
| 102 | + | |
| 103 | +/** | |
| 104 | + * @return null|\TUTOR\Tutor | |
| 105 | + * Run main instance of the Tutor | |
| 41 | 106 | * |
| 42 | - * @since 1.5.2 | |
| 43 | - * @since 2.6.2 Uninstall hook registered | |
| 107 | + * @since v.1.2.0 | |
| 44 | 108 | */ |
| 45 | -register_activation_hook( TUTOR_FILE, array( Tutor::class, 'tutor_activate' ) ); | |
| 46 | -register_deactivation_hook( TUTOR_FILE, array( Tutor::class, 'tutor_deactivation' ) ); | |
| 47 | -register_uninstall_hook( TUTOR_FILE, array( Tutor::class, 'tutor_uninstall' ) ); | |
| 48 | - | |
| 49 | -if ( ! function_exists( 'tutor_lms' ) ) { | |
| 50 | - /** | |
| 51 | - * Run main instance of the Tutor | |
| 52 | - * | |
| 53 | - * @since 1.2.0 | |
| 54 | - * | |
| 55 | - * @return Tutor | |
| 56 | - */ | |
| 109 | +if ( ! function_exists('tutor_lms') ) { | |
| 57 | 110 | function tutor_lms() { |
| 58 | - return Tutor::get_instance(); | |
| 111 | + return \TUTOR\Tutor::instance(); | |
| 59 | 112 | } |
| 60 | 113 | } |
| 61 | 114 | |
| 115 | +//add_action('plugins_loaded', 'tutor_lms'); | |
| 62 | 116 | $GLOBALS['tutor'] = tutor_lms(); |