| @@ -1,121 +1,123 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Define common constants used by LearnPress | |
| 4 | - */ | |
| 5 | -require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 6 | -$upload_dir = wp_upload_dir(); | |
| 7 | - | |
| 8 | -$default_headers = array( | |
| 9 | - 'Version' => 'Version', | |
| 10 | - 'TextDomain' => 'Text Domain', | |
| 11 | -); | |
| 12 | -$plugin_info = get_file_data( LP_PLUGIN_FILE, $default_headers, 'plugin' ); | |
| 13 | - | |
| 14 | -// version. | |
| 15 | -define( 'LEARNPRESS_VERSION', $plugin_info['Version'] ); | |
| 16 | -const LP_KEY_DB_VERSION = 'learnpress_db_version'; | |
| 17 | -/** | |
| 18 | - * @since 4.2.6.5 | |
| 19 | - */ | |
| 20 | -define( 'LP_TEXT_DOMAIN', $plugin_info['TextDomain'] ); | |
| 21 | - | |
| 22 | -// Plugin paths and urls. | |
| 23 | -define( 'LP_PLUGIN_PATH', plugin_dir_path( LP_PLUGIN_FILE ) ); | |
| 24 | -define( 'LP_PLUGIN_BASENAME', plugin_basename( LP_PLUGIN_FILE ) ); | |
| 25 | -define( 'LP_PLUGIN_FOLDER_NAME', dirname( LP_PLUGIN_BASENAME ) ); | |
| 26 | -const LP_TEMPLATE_PATH = LP_PLUGIN_PATH . 'templates/'; | |
| 27 | -define( 'LP_PLUGIN_URL', trailingslashit( plugins_url( '/', LP_PLUGIN_FILE ) ) ); | |
| 28 | -const LP_JS_URL = LP_PLUGIN_URL . 'assets/js/'; | |
| 29 | -const LP_CSS_URL = LP_PLUGIN_URL . 'assets/css/'; | |
| 30 | - | |
| 31 | -// Log path. | |
| 32 | -define( 'LP_LOG_PATH', $upload_dir['basedir'] . '/learn-press-logs/' ); | |
| 33 | - | |
| 34 | -// Turn on/off cart. | |
| 35 | -const LP_ENABLE_CART = false; | |
| 36 | - | |
| 37 | -// Table prefix. | |
| 38 | -const LP_TABLE_PREFIX = 'learnpress_'; | |
| 39 | - | |
| 40 | -// Define constants for custom post types. | |
| 41 | -const LP_COURSE_CPT = 'lp_course'; | |
| 42 | -const LP_LESSON_CPT = 'lp_lesson'; | |
| 43 | -const LP_QUESTION_CPT = 'lp_question'; | |
| 44 | -const LP_QUIZ_CPT = 'lp_quiz'; | |
| 45 | -const LP_ORDER_CPT = 'lp_order'; | |
| 46 | - | |
| 47 | -// Define constants for custom taxonomies. | |
| 48 | -const LP_COURSE_CATEGORY_TAX = 'course_category'; | |
| 49 | -const LP_COURSE_TAXONOMY_TAG = 'course_tag'; | |
| 50 | - | |
| 51 | -// Role of user . | |
| 52 | -const LP_TEACHER_ROLE = 'lp_teacher'; | |
| 53 | -const ADMIN_ROLE = 'administrator'; | |
| 54 | - | |
| 55 | -// Options. | |
| 56 | -const LP_USE_ATTRIBUTES = false; | |
| 57 | - | |
| 58 | -// Error codes. | |
| 59 | -const LP_REQUIRE_LOGIN = 120; | |
| 60 | -const LP_INVALID_QUIZ_OR_COURSE = 140; | |
| 61 | -const LP_COURSE_IS_FINISHED = 150; | |
| 62 | -const LP_QUIZ_HAS_STARTED_OR_COMPLETED = 160; | |
| 63 | -const LP_ERROR_NO_PAYMENT_METHOD_SELECTED = 1000; | |
| 64 | -const LP_COMPLETE_ITEM_FAIL = 170; | |
| 65 | - | |
| 66 | -// Pages. | |
| 67 | -const LP_PAGE_CHECKOUT = 'lp_page_checkout'; | |
| 68 | -const LP_PAGE_COURSES = 'lp_page_courses'; | |
| 69 | -const LP_PAGE_SINGLE_COURSE = 'lp_page_single_course'; | |
| 70 | -const LP_PAGE_QUIZ = 'lp_page_quiz'; | |
| 71 | -const LP_PAGE_QUESTION = 'lp_page_question'; | |
| 72 | -const LP_PAGE_PROFILE = 'lp_page_profile'; | |
| 73 | -const LP_PAGE_BECOME_A_TEACHER = 'lp_page_become_a_teacher'; | |
| 74 | -const LP_PAGE_SINGLE_COURSE_CURRICULUM = 'lp_page_single_course_curriculum'; | |
| 75 | -const LP_PAGE_INSTRUCTORS = 'lp_page_instructors'; | |
| 76 | -const LP_PAGE_INSTRUCTOR = 'lp_page_single_instructor'; | |
| 77 | -const LP_PAGE_COURSE_BUILDER = 'lp_page_course_builder'; | |
| 78 | - | |
| 79 | -// Key block course's item. | |
| 80 | -const LP_BLOCK_COURSE_FINISHED = 'block_course_finished'; | |
| 81 | -const LP_BLOCK_COURSE_DURATION_EXPIRE = 'block_course_duration_expire'; | |
| 82 | -const LP_BLOCK_COURSE_PURCHASE = 'block_course_purchased'; | |
| 83 | - | |
| 84 | -// Status user item course. | |
| 85 | -const LP_COURSE_ENROLLED = 'enrolled'; | |
| 86 | -const LP_COURSE_FINISHED = 'finished'; | |
| 87 | -const LP_COURSE_PURCHASED = 'purchased'; | |
| 88 | -const LP_USER_COURSE_CANCEL = 'cancel'; // When Order change complete to another status | |
| 89 | -const LP_ITEM_COMPLETED = 'completed'; | |
| 90 | -const LP_ITEM_STARTED = 'started'; | |
| 91 | - | |
| 92 | -// Status LP Order to compare. | |
| 93 | -const LP_ORDER_COMPLETED = 'completed'; | |
| 94 | -const LP_ORDER_PENDING = 'pending'; | |
| 95 | -const LP_ORDER_PROCESSING = 'processing'; | |
| 96 | -const LP_ORDER_CANCELLED = 'cancelled'; | |
| 97 | -const LP_ORDER_FAILED = 'failed'; | |
| 98 | -const LP_ORDER_TRASH = 'trash'; | |
| 99 | - | |
| 100 | -// Status LP Order to set DB. | |
| 101 | -const LP_ORDER_COMPLETED_DB = 'lp-completed'; | |
| 102 | -const LP_ORDER_PENDING_DB = 'lp-pending'; | |
| 103 | -const LP_ORDER_PROCESSING_DB = 'lp-processing'; | |
| 104 | -const LP_ORDER_CANCELLED_DB = 'lp-cancelled'; | |
| 105 | -const LP_ORDER_FAILED_DB = 'lp-failed'; | |
| 106 | -const LP_ORDER_TRASH_DB = 'lp-trash'; | |
| 107 | - | |
| 108 | -// LP Order type create via. | |
| 109 | -const LP_ORDER_CREATED_VIA_MANUAL = 'manual'; | |
| 110 | - | |
| 111 | -// Graduation user item course | |
| 112 | -const LP_COURSE_GRADUATION_IN_PROGRESS = 'in-progress'; | |
| 113 | -const LP_COURSE_GRADUATION_PASSED = 'passed'; | |
| 114 | -const LP_COURSE_GRADUATION_FAILED = 'failed'; | |
| 115 | -// @since 4.2.7.4 | |
| 116 | -const LP_GRADUATION_IN_PROGRESS = 'in-progress'; | |
| 117 | -const LP_GRADUATION_PASSED = 'passed'; | |
| 118 | -const LP_GRADUATION_FAILED = 'failed'; | |
| 119 | - | |
| 120 | -// Enable lazy-load animation placeholder. | |
| 121 | -const LP_LAZY_LOAD_ANIMATION = true; | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Define common constants used by LearnPress | |
| 4 | + */ | |
| 5 | +require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 6 | +$upload_dir = wp_upload_dir(); | |
| 7 | + | |
| 8 | +$default_headers = array( | |
| 9 | + 'Version' => 'Version', | |
| 10 | + 'TextDomain' => 'Text Domain', | |
| 11 | +); | |
| 12 | +$plugin_info = get_file_data( LP_PLUGIN_FILE, $default_headers, 'plugin' ); | |
| 13 | + | |
| 14 | +// version. | |
| 15 | +define( 'LEARNPRESS_VERSION', $plugin_info['Version'] ); | |
| 16 | +const LP_KEY_DB_VERSION = 'learnpress_db_version'; | |
| 17 | +/** | |
| 18 | + * @since 4.2.6.5 | |
| 19 | + */ | |
| 20 | +define( 'LP_TEXT_DOMAIN', $plugin_info['TextDomain'] ); | |
| 21 | + | |
| 22 | +// Plugin paths and urls. | |
| 23 | +define( 'LP_PLUGIN_PATH', plugin_dir_path( LP_PLUGIN_FILE ) ); | |
| 24 | +define( 'LP_PLUGIN_BASENAME', plugin_basename( LP_PLUGIN_FILE ) ); | |
| 25 | +define( 'LP_PLUGIN_FOLDER_NAME', dirname( LP_PLUGIN_BASENAME ) ); | |
| 26 | +const LP_TEMPLATE_PATH = LP_PLUGIN_PATH . 'templates/'; | |
| 27 | +define( 'LP_PLUGIN_URL', trailingslashit( plugins_url( '/', LP_PLUGIN_FILE ) ) ); | |
| 28 | +const LP_JS_URL = LP_PLUGIN_URL . 'assets/js/'; | |
| 29 | +const LP_CSS_URL = LP_PLUGIN_URL . 'assets/css/'; | |
| 30 | + | |
| 31 | +// Log path. | |
| 32 | +define( 'LP_LOG_PATH', $upload_dir['basedir'] . '/learn-press-logs/' ); | |
| 33 | + | |
| 34 | +// Turn on/off cart. | |
| 35 | +const LP_ENABLE_CART = false; | |
| 36 | + | |
| 37 | +// Table prefix. | |
| 38 | +const LP_TABLE_PREFIX = 'learnpress_'; | |
| 39 | + | |
| 40 | +// Define constants for custom post types. | |
| 41 | +const LP_COURSE_CPT = 'lp_course'; | |
| 42 | +const LP_LESSON_CPT = 'lp_lesson'; | |
| 43 | +const LP_QUESTION_CPT = 'lp_question'; | |
| 44 | +const LP_QUIZ_CPT = 'lp_quiz'; | |
| 45 | +const LP_ORDER_CPT = 'lp_order'; | |
| 46 | + | |
| 47 | +// Define constants for custom taxonomies. | |
| 48 | +const LP_COURSE_CATEGORY_TAX = 'course_category'; | |
| 49 | +const LP_COURSE_TAXONOMY_TAG = 'course_tag'; | |
| 50 | + | |
| 51 | +// Role of user . | |
| 52 | +const LP_TEACHER_ROLE = 'lp_teacher'; | |
| 53 | +const ADMIN_ROLE = 'administrator'; | |
| 54 | + | |
| 55 | +// Options. | |
| 56 | +const LP_USE_ATTRIBUTES = false; | |
| 57 | + | |
| 58 | +// Error codes. | |
| 59 | +const LP_REQUIRE_LOGIN = 120; | |
| 60 | +const LP_INVALID_QUIZ_OR_COURSE = 140; | |
| 61 | +const LP_COURSE_IS_FINISHED = 150; | |
| 62 | +const LP_QUIZ_HAS_STARTED_OR_COMPLETED = 160; | |
| 63 | +const LP_ERROR_NO_PAYMENT_METHOD_SELECTED = 1000; | |
| 64 | +const LP_COMPLETE_ITEM_FAIL = 170; | |
| 65 | + | |
| 66 | +// Pages. | |
| 67 | +const LP_PAGE_CHECKOUT = 'lp_page_checkout'; | |
| 68 | +const LP_PAGE_COURSES = 'lp_page_courses'; | |
| 69 | +const LP_PAGE_SINGLE_COURSE = 'lp_page_single_course'; | |
| 70 | +const LP_PAGE_QUIZ = 'lp_page_quiz'; | |
| 71 | +const LP_PAGE_QUESTION = 'lp_page_question'; | |
| 72 | +const LP_PAGE_PROFILE = 'lp_page_profile'; | |
| 73 | +const LP_PAGE_BECOME_A_TEACHER = 'lp_page_become_a_teacher'; | |
| 74 | +const LP_PAGE_SINGLE_COURSE_CURRICULUM = 'lp_page_single_course_curriculum'; | |
| 75 | +const LP_PAGE_INSTRUCTORS = 'lp_page_instructors'; | |
| 76 | +const LP_PAGE_INSTRUCTOR = 'lp_page_single_instructor'; | |
| 77 | +const LP_PAGE_COURSE_BUILDER = 'lp_page_course_builder'; | |
| 78 | + | |
| 79 | +// Key block course's item. | |
| 80 | +const LP_BLOCK_COURSE_FINISHED = 'block_course_finished'; | |
| 81 | +const LP_BLOCK_COURSE_DURATION_EXPIRE = 'block_course_duration_expire'; | |
| 82 | +const LP_BLOCK_COURSE_PURCHASE = 'block_course_purchased'; | |
| 83 | + | |
| 84 | +// Status user item course. | |
| 85 | +const LP_COURSE_ENROLLED = 'enrolled'; | |
| 86 | +const LP_COURSE_FINISHED = 'finished'; | |
| 87 | +const LP_COURSE_PURCHASED = 'purchased'; | |
| 88 | +const LP_USER_COURSE_CANCEL = 'cancel'; // When Order change complete to another status | |
| 89 | +const LP_ITEM_COMPLETED = 'completed'; | |
| 90 | +const LP_ITEM_STARTED = 'started'; | |
| 91 | + | |
| 92 | +// Status LP Order to compare. | |
| 93 | +const LP_ORDER_COMPLETED = 'completed'; | |
| 94 | +const LP_ORDER_PENDING = 'pending'; | |
| 95 | +const LP_ORDER_PROCESSING = 'processing'; | |
| 96 | +const LP_ORDER_CANCELLED = 'cancelled'; | |
| 97 | +const LP_ORDER_FAILED = 'failed'; | |
| 98 | +const LP_ORDER_REFUNDED = 'refunded'; | |
| 99 | +const LP_ORDER_TRASH = 'trash'; | |
| 100 | + | |
| 101 | +// Status LP Order to set DB. | |
| 102 | +const LP_ORDER_COMPLETED_DB = 'lp-completed'; | |
| 103 | +const LP_ORDER_PENDING_DB = 'lp-pending'; | |
| 104 | +const LP_ORDER_PROCESSING_DB = 'lp-processing'; | |
| 105 | +const LP_ORDER_CANCELLED_DB = 'lp-cancelled'; | |
| 106 | +const LP_ORDER_FAILED_DB = 'lp-failed'; | |
| 107 | +const LP_ORDER_REFUNDED_DB = 'lp-refunded'; | |
| 108 | +const LP_ORDER_TRASH_DB = 'lp-trash'; | |
| 109 | + | |
| 110 | +// LP Order type create via. | |
| 111 | +const LP_ORDER_CREATED_VIA_MANUAL = 'manual'; | |
| 112 | + | |
| 113 | +// Graduation user item course | |
| 114 | +const LP_COURSE_GRADUATION_IN_PROGRESS = 'in-progress'; | |
| 115 | +const LP_COURSE_GRADUATION_PASSED = 'passed'; | |
| 116 | +const LP_COURSE_GRADUATION_FAILED = 'failed'; | |
| 117 | +// @since 4.2.7.4 | |
| 118 | +const LP_GRADUATION_IN_PROGRESS = 'in-progress'; | |
| 119 | +const LP_GRADUATION_PASSED = 'passed'; | |
| 120 | +const LP_GRADUATION_FAILED = 'failed'; | |
| 121 | + | |
| 122 | +// Enable lazy-load animation placeholder. | |
| 123 | +//const LP_LAZY_LOAD_ANIMATION = true; | |