-
Notifications
You must be signed in to change notification settings - Fork 3
/
lifterlms-lite-lms-progress-tracker.php
104 lines (91 loc) · 2.49 KB
/
lifterlms-lite-lms-progress-tracker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Main plugin file
*
* @package LifterLMS_Lite_LMS/Main
*
* @since 0.0.1
* @version 0.0.1
*
* Plugin Name: Lite LMS Progress Tracker by LifterLMS
* Plugin URI: https://github.com/gocodebox/lifterlms-lite-lms-progress-tracker
* Description: Easily track progress through simple online courses and other types of public or membership-protected content on your WordPress website.
* Version: 0.1.0
* Author: LifterLMS
* Author URI: https://lifterlms.com/
* Text Domain: llms-lite-progress
* Domain Path: /languages
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Requires at least: 5.4
* Tested up to: 5.7
*
* * * * * * * * * * * * * * * * * * * * * *
* *
* Reporting a Security Vulnerability *
* *
* Please disclose any security issues or *
* vulnerabilities to team@lifterlms.com *
* *
* See our full Security Policy at *
* https://lifterlms.com/security *
* *
* * * * * * * * * * * * * * * * * * * * * *
*/
defined( 'ABSPATH' ) || exit;
/**
* Initialize
*
* @since 0.0.1
*
* @return void
*/
function llms_lite_lms() {
llms_lite_lms_scripts();
llms_lite_lms_i18n();
}
add_action( 'init', 'llms_lite_lms' );
/**
* Register & Enqueue scripts.
*
* @since 0.0.1
*
* @return void
*/
function llms_lite_lms_scripts() {
$dir = dirname( __FILE__ );
$url = plugin_dir_url( __FILE__ );
$slug = is_admin() ? 'editor' : 'client';
$handle = sprintf( 'llms-lite-%s', $slug );
$asset = include $dir . '/assets/js/llms-lite-' . $slug . '.asset.php';
wp_enqueue_script(
$handle,
$url . 'assets/js/llms-lite-' . $slug . '.js',
$asset['dependencies'],
$asset['version'],
true
);
wp_enqueue_style(
'llms-lite-editor',
$url . 'assets/css/llms-lite-' . $slug . '.css',
array( 'wp-edit-blocks' ),
$asset['version']
);
// JS translations.
if ( 'editor' === $slug ) {
wp_set_script_translations( $handle, 'llms-lite-progress' );
}
}
/**
* Load textdomain
*
* @since 0.0.1
*
* @return void
*/
function llms_lite_lms_i18n() {
$locale = apply_filters( 'plugin_locale', determine_locale(), 'lifterlms' );
unload_textdomain( 'llms-lite-progress' );
load_textdomain( 'llms-lite-progress', WP_LANG_DIR . '/lifterlms/lifterlms-' . $locale . '.mo' );
load_plugin_textdomain( 'lifterlms', false, dirname( plugin_basename( __FILE__ ) ) . '/i18n' );
}