forked from xeno010/Wp-Pro-Quiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-pro-quiz.php
95 lines (75 loc) · 2.35 KB
/
wp-pro-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
<?php
/*
Plugin Name: WP-Pro-Quiz
Plugin URI: http://wordpress.org/extend/plugins/wp-pro-quiz
Description: A powerful and beautiful quiz plugin for WordPress.
Version: 0.37
Author: Julius Fischer
Author URI: http://www.it-gecko.de
Text Domain: wp-pro-quiz
Domain Path: /languages
*/
define('WPPROQUIZ_VERSION', '0.37');
define('WPPROQUIZ_DEV', false);
define('WPPROQUIZ_PATH', dirname(__FILE__));
define('WPPROQUIZ_URL', plugins_url('', __FILE__));
define('WPPROQUIZ_FILE', __FILE__);
define('WPPROQUIZ_PPATH', dirname(plugin_basename(__FILE__)));
define('WPPROQUIZ_PLUGIN_PATH', WPPROQUIZ_PATH . '/plugin');
$uploadDir = wp_upload_dir();
define('WPPROQUIZ_CAPTCHA_DIR', $uploadDir['basedir'] . '/wp_pro_quiz_captcha');
define('WPPROQUIZ_CAPTCHA_URL', $uploadDir['baseurl'] . '/wp_pro_quiz_captcha');
spl_autoload_register('wpProQuiz_autoload');
register_activation_hook(__FILE__, array('WpProQuiz_Helper_Upgrade', 'upgrade'));
add_action('plugins_loaded', 'wpProQuiz_pluginLoaded');
if (is_admin()) {
new WpProQuiz_Controller_Admin();
} else {
new WpProQuiz_Controller_Front();
}
function wpProQuiz_autoload($class)
{
$c = explode('_', $class);
if ($c === false || count($c) != 3 || $c[0] !== 'WpProQuiz') {
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 = WPPROQUIZ_PATH . '/lib/' . $dir . '/' . $class . '.php';
if (file_exists($classPath)) {
/** @noinspection PhpIncludeInspection */
include_once $classPath;
}
}
function wpProQuiz_pluginLoaded()
{
load_plugin_textdomain('wp-pro-quiz', false, WPPROQUIZ_PPATH . '/languages');
if (get_option('wpProQuiz_version') !== WPPROQUIZ_VERSION) {
WpProQuiz_Helper_Upgrade::upgrade();
}
}
function wpProQuiz_achievementsV3()
{
if (function_exists('achievements')) {
achievements()->extensions->wp_pro_quiz = new WpProQuiz_Plugin_BpAchievementsV3();
do_action('wpProQuiz_achievementsV3');
}
}
add_action('dpa_ready', 'wpProQuiz_achievementsV3');