-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbulk-edit-question-category-for-learndash.php
More file actions
76 lines (61 loc) · 2.43 KB
/
bulk-edit-question-category-for-learndash.php
File metadata and controls
76 lines (61 loc) · 2.43 KB
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
<?php
/**
* Plugin Name: Bulk Edit Questions Category for LearnDash
* Plugin URI: https://github.com/j2machado/bulk-edit-question-category-for-learndash
* Description: Bulk edit questions category for LearnDash
* Version: 1.0.0
* Author: Obi Juan Dev
* Author URI: https://obijuan.dev
* License: GPL-2.0+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: bulk-edit-question-category-for-learndash
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
require_once __DIR__ . '/vendor/autoload.php';
use Bulk_Edit_Questions_Category_For_LearnDash\MainPlugin;
final class Bulk_Edit_Questions_Category_For_LearnDash {
public static function init() {
self::define_constants();
self::load_textdomain();
add_action( 'plugins_loaded', array( __CLASS__, 'on_plugins_loaded' ) );
add_action( 'init', array( __CLASS__, 'main_plugin_init' ) );
}
public static function define_constants() {
define( 'BULK_EDIT_QUESTIONS_CATEGORY_FOR_LEARNDASH_VERSION', '1.0.0' );
define( 'BULK_EDIT_QUESTIONS_CATEGORY_FOR_LEARNDASH_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'BULK_EDIT_QUESTIONS_CATEGORY_FOR_LEARNDASH_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
public static function load_textdomain() {
load_plugin_textdomain(
'bulk-edit-question-category-for-learndash',
false,
BULK_EDIT_QUESTIONS_CATEGORY_FOR_LEARNDASH_PLUGIN_DIR . 'languages/'
);
}
/**
* Runs on plugins loaded
*/
public static function on_plugins_loaded() {
if (!class_exists('SFWD_LMS')) {
add_action('admin_notices', array(__CLASS__, 'learndash_not_active_notice'));
return;
}
}
/**
* Display notice if LearnDash is not active
*/
public static function learndash_not_active_notice() {
$message = sprintf(
/* translators: %s is a link to the LearnDash website. */
__('Bulk Edit Question Category for LearnDash requires LearnDash LMS plugin to be installed and active. You can download %s here.', 'bulk-edit-question-category-for-learndash'),
'<a href="https://www.learndash.com" target="_blank">LearnDash</a>'
);
echo '<div class="error"><p>' . $message . '</p></div>';
}
public static function main_plugin_init() {
MainPlugin::instance();
}
}
Bulk_Edit_Questions_Category_For_LearnDash::init();