Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/tutor-pro/addons/calendar/classes/Init.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
/**
3
+
* Initialize Calendar addon
4
+
*
5
+
* @package TutorPro\Addons
6
+
* @subpackage Calendar
7
+
* @author Themeum <support@themeum.com>
8
+
* @link https://themeum.com
9
+
* @since 1.9.10
10
+
*/
11
+
12
+
namespace TUTOR_PRO_C;
13
+
14
+
use TUTOR\Permalink;
15
+
16
+
if ( ! defined( 'ABSPATH' ) ) {
17
+
exit;
18
+
}
19
+
20
+
/**
21
+
* Class Init
22
+
*/
23
+
class Init {
24
+
//phpcs:disable
25
+
public $version = TUTOR_C_VERSION;
26
+
public $path;
27
+
public $url;
28
+
public $basename;
29
+
public $calendar;
30
+
//phpcs:enable
31
+
32
+
/**
33
+
* Constructor
34
+
*
35
+
* @return void
36
+
*/
37
+
public function __construct() {
38
+
if ( ! function_exists( 'tutor' ) ) {
39
+
return;
40
+
}
41
+
42
+
add_action( 'tutor_addon_before_enable_tutor-pro/addons/calendar/calendar.php', array( $this, 'update_permalink' ) );
43
+
44
+
$addon_config = tutor_utils()->get_addon_config( tutor_pro_calendar()->basename );
45
+
$is_enable = (bool) tutor_utils()->avalue_dot( 'is_enable', $addon_config );
46
+
if ( ! $is_enable ) {
47
+
return;
48
+
}
49
+
50
+
$this->path = plugin_dir_path( TUTOR_C_FILE );
51
+
$this->url = plugin_dir_url( TUTOR_C_FILE );
52
+
$this->basename = plugin_basename( TUTOR_C_FILE );
53
+
54
+
$this->load_tutor_calendar();
55
+
}
56
+
57
+
/**
58
+
* Update permalink during addon enable.
59
+
*
60
+
* @since 2.6.0
61
+
*
62
+
* @return void
63
+
*/
64
+
public function update_permalink() {
65
+
Permalink::set_permalink_flag();
66
+
}
67
+
68
+
/**
69
+
* Load addon classes.
70
+
*
71
+
* @return void
72
+
*/
73
+
public function load_tutor_calendar() {
74
+
spl_autoload_register( array( $this, 'loader' ) );
75
+
76
+
$this->calendar = new Tutor_Calendar();
77
+
}
78
+
79
+
/**
80
+
* Auto Load class and the files
81
+
*
82
+
* @param string $class_name class name.
83
+
*/
84
+
private function loader( $class_name ) {
85
+
if ( ! class_exists( $class_name ) ) {
86
+
$class_name = preg_replace(
87
+
array( '/([a-z])([A-Z])/', '/\\\/' ),
88
+
array( '$1$2', DIRECTORY_SEPARATOR ),
89
+
$class_name
90
+
);
91
+
92
+
$class_name = str_replace( 'TUTOR_PRO_C' . DIRECTORY_SEPARATOR, 'classes' . DIRECTORY_SEPARATOR, $class_name );
93
+
$file_name = $this->path . $class_name . '.php';
94
+
95
+
if ( file_exists( $file_name ) && is_readable( $file_name ) ) {
96
+
require_once $file_name;
97
+
}
98
+
}
99
+
}
100
+
}
101
+