| @@ -1,20 +1,29 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Define common constants used by LearnPress |
| 4 | 4 | */ |
| 5 | -include_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 6 | -$upload_dir = wp_upload_dir(); | |
| 7 | -$plugin_info = get_plugin_data( LP_PLUGIN_FILE ); | |
| 5 | +require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 6 | +$upload_dir = wp_upload_dir(); | |
| 8 | 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 | + | |
| 9 | 14 | // version. |
| 10 | 15 | define( 'LEARNPRESS_VERSION', $plugin_info['Version'] ); |
| 11 | 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'] ); | |
| 12 | 21 | |
| 13 | 22 | // Plugin paths and urls. |
| 14 | 23 | define( 'LP_PLUGIN_PATH', plugin_dir_path( LP_PLUGIN_FILE ) ); |
| 15 | 24 | define( 'LP_PLUGIN_BASENAME', plugin_basename( LP_PLUGIN_FILE ) ); |
| 16 | -define( 'LP_PLUGIN_FOLDER_NAME', str_replace( array( '/', basename( LP_PLUGIN_FILE ) ), '', LP_PLUGIN_BASENAME ) ); | |
| 25 | +define( 'LP_PLUGIN_FOLDER_NAME', dirname( LP_PLUGIN_BASENAME ) ); | |
| 17 | 26 | const LP_TEMPLATE_PATH = LP_PLUGIN_PATH . 'templates/'; |
| 18 | 27 | define( 'LP_PLUGIN_URL', trailingslashit( plugins_url( '/', LP_PLUGIN_FILE ) ) ); |
| 19 | 28 | const LP_JS_URL = LP_PLUGIN_URL . 'assets/js/'; |
| 20 | 29 | const LP_CSS_URL = LP_PLUGIN_URL . 'assets/css/'; |
| @@ -34,8 +43,12 @@ | ||
| 34 | 43 | const LP_QUESTION_CPT = 'lp_question'; |
| 35 | 44 | const LP_QUIZ_CPT = 'lp_quiz'; |
| 36 | 45 | const LP_ORDER_CPT = 'lp_order'; |
| 37 | 46 | |
| 47 | +// Define constants for custom taxonomies. | |
| 48 | +const LP_COURSE_CATEGORY_TAX = 'course_category'; | |
| 49 | +const LP_COURSE_TAXONOMY_TAG = 'course_tag'; | |
| 50 | + | |
| 38 | 51 | // Role of user . |
| 39 | 52 | const LP_TEACHER_ROLE = 'lp_teacher'; |
| 40 | 53 | const ADMIN_ROLE = 'administrator'; |
| 41 | 54 | |
| @@ -58,8 +71,11 @@ | ||
| 58 | 71 | const LP_PAGE_QUESTION = 'lp_page_question'; |
| 59 | 72 | const LP_PAGE_PROFILE = 'lp_page_profile'; |
| 60 | 73 | const LP_PAGE_BECOME_A_TEACHER = 'lp_page_become_a_teacher'; |
| 61 | 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'; | |
| 62 | 78 | |
| 63 | 79 | // Key block course's item. |
| 64 | 80 | const LP_BLOCK_COURSE_FINISHED = 'block_course_finished'; |
| 65 | 81 | const LP_BLOCK_COURSE_DURATION_EXPIRE = 'block_course_duration_expire'; |
| @@ -65,13 +81,14 @@ | ||
| 65 | 81 | const LP_BLOCK_COURSE_DURATION_EXPIRE = 'block_course_duration_expire'; |
| 66 | 82 | const LP_BLOCK_COURSE_PURCHASE = 'block_course_purchased'; |
| 67 | 83 | |
| 68 | 84 | // Status user item course. |
| 69 | -const LP_COURSE_ENROLLED = 'enrolled'; | |
| 70 | -const LP_COURSE_FINISHED = 'finished'; | |
| 71 | -const LP_COURSE_PURCHASED = 'purchased'; | |
| 72 | -const LP_ITEM_COMPLETED = 'completed'; | |
| 73 | -const LP_ITEM_STARTED = 'started'; | |
| 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'; | |
| 74 | 91 | |
| 75 | 92 | // Status LP Order to compare. |
| 76 | 93 | const LP_ORDER_COMPLETED = 'completed'; |
| 77 | 94 | const LP_ORDER_PENDING = 'pending'; |
| @@ -77,8 +94,10 @@ | ||
| 77 | 94 | const LP_ORDER_PENDING = 'pending'; |
| 78 | 95 | const LP_ORDER_PROCESSING = 'processing'; |
| 79 | 96 | const LP_ORDER_CANCELLED = 'cancelled'; |
| 80 | 97 | const LP_ORDER_FAILED = 'failed'; |
| 98 | +const LP_ORDER_REFUNDED = 'refunded'; | |
| 99 | +const LP_ORDER_TRASH = 'trash'; | |
| 81 | 100 | |
| 82 | 101 | // Status LP Order to set DB. |
| 83 | 102 | const LP_ORDER_COMPLETED_DB = 'lp-completed'; |
| 84 | 103 | const LP_ORDER_PENDING_DB = 'lp-pending'; |
| @@ -84,12 +103,21 @@ | ||
| 84 | 103 | const LP_ORDER_PENDING_DB = 'lp-pending'; |
| 85 | 104 | const LP_ORDER_PROCESSING_DB = 'lp-processing'; |
| 86 | 105 | const LP_ORDER_CANCELLED_DB = 'lp-cancelled'; |
| 87 | 106 | const LP_ORDER_FAILED_DB = 'lp-failed'; |
| 107 | +const LP_ORDER_REFUNDED_DB = 'lp-refunded'; | |
| 108 | +const LP_ORDER_TRASH_DB = 'lp-trash'; | |
| 88 | 109 | |
| 110 | +// LP Order type create via. | |
| 111 | +const LP_ORDER_CREATED_VIA_MANUAL = 'manual'; | |
| 112 | + | |
| 89 | 113 | // Graduation user item course |
| 90 | 114 | const LP_COURSE_GRADUATION_IN_PROGRESS = 'in-progress'; |
| 91 | 115 | const LP_COURSE_GRADUATION_PASSED = 'passed'; |
| 92 | 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'; | |
| 93 | 121 | |
| 94 | 122 | // Enable lazy-load animation placeholder. |
| 95 | -const LP_LAZY_LOAD_ANIMATION = true; | |
| 123 | +//const LP_LAZY_LOAD_ANIMATION = true; | |