-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwp-adv-quiz.php
103 lines (82 loc) · 2.56 KB
/
wp-adv-quiz.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
<?php
/**
* WP-Adv-Quiz
*
* @wordpress-plugin
* Plugin Name: WP-Adv-Quiz
* Plugin URI: http://wordpress.org/extend/plugins/wp-adv-quiz
* Description: A powerful and beautiful quiz plugin for WordPress.
* Version: 1.0.2
* Requires at least: 4.6
* Requires PHP: 5.6
* Author: Markus Begerow
* Author URI: https://github.com/markusbegerow
* Text Domain: wp-adv-quiz
* License: GPL v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
define('WPADVQUIZ_VERSION', '1.0.1');
define('WPADVQUIZ_DEV', false);
define('WPADVQUIZ_PATH', dirname(__FILE__));
define('WPADVQUIZ_URL', plugins_url('', __FILE__));
define('WPADVQUIZ_FILE', __FILE__);
define('WPADVQUIZ_PPATH', dirname(plugin_basename(__FILE__)));
define('WPADVQUIZ_PLUGIN_PATH', WPADVQUIZ_PATH . '/plugin');
$uploadDir = wp_upload_dir();
define('WPADVQUIZ_CAPTCHA_DIR', $uploadDir['basedir'] . '/wp_adv_quiz_captcha');
define('WPADVQUIZ_CAPTCHA_URL', $uploadDir['baseurl'] . '/wp_adv_quiz_captcha');
spl_autoload_register('wpAdvQuiz_autoload');
register_activation_hook(__FILE__, ['WpAdvQuiz_Helper_Upgrade', 'upgrade']);
add_action('plugins_loaded', 'wpAdvQuiz_pluginLoaded');
WpAdvQuiz_Helper_GutenbergBlock::init();
if (is_admin()) {
new WpAdvQuiz_Controller_Admin();
} else {
new WpAdvQuiz_Controller_Front();
}
function wpAdvQuiz_autoload($class)
{
$c = explode('_', $class);
if ($c === false || count($c) != 3 || $c[0] !== 'WpAdvQuiz') {
return;
}
switch ($c[1]) {
case 'View':
$dir = 'view';
break;
case 'Model':
$dir = 'model';
break;
case 'Helper':
$dir = 'helper';
break;
case 'Controller':
$dir = 'controller';
break;
case 'Plugin':
$dir = 'plugin';
break;
default:
return;
}
$classPath = WPADVQUIZ_PATH . '/lib/' . $dir . '/' . $class . '.php';
if (file_exists($classPath)) {
/** @noinspection PhpIncludeInspection */
include_once $classPath;
}
}
function wpAdvQuiz_pluginLoaded()
{
load_plugin_textdomain('wp-adv-quiz', false, WPADVQUIZ_PPATH . '/languages');
if (get_option('wpAdvQuiz_version') !== WPADVQUIZ_VERSION) {
WpAdvQuiz_Helper_Upgrade::upgrade();
}
}
function wpAdvQuiz_achievementsV3()
{
if (function_exists('achievements')) {
achievements()->extensions->wp_adv_quiz = new WpAdvQuiz_Plugin_BpAchievementsV3();
do_action('wpAdvQuiz_achievementsV3');
}
}
add_action('dpa_ready', 'wpAdvQuiz_achievementsV3');