PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.2.11
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.2.11
5.6.9 5.6.8 5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / kit / nps-survey / nps-survey-plugin-loader.php
latepoint / lib / kit / nps-survey Last commit date
classes 4 months ago dist 4 months ago changelog.txt 4 months ago nps-survey-plugin-loader.php 4 months ago nps-survey.php 4 months ago version.json 4 months ago
nps-survey-plugin-loader.php
102 lines
1 <?php
2 /**
3 * Plugin Loader.
4 *
5 * @package {{package}}
6 * @since {{since}}
7 */
8
9 namespace NPS_Survey;
10
11 if ( ! class_exists( 'NPS_Survey_Plugin_Loader' ) ) {
12
13 /**
14 * Plugin_Loader
15 *
16 * @since 1.0.0
17 */
18 class NPS_Survey_Plugin_Loader {
19 /**
20 * Instance
21 *
22 * @access private
23 * @var object Class Instance.
24 * @since 1.0.0
25 */
26 private static $instance;
27
28 /**
29 * Constructor
30 *
31 * @since 1.0.0
32 */
33 public function __construct() {
34
35 spl_autoload_register( [ $this, 'autoload' ] );
36 add_action( 'wp_loaded', [ $this, 'load_files' ] );
37 }
38
39 /**
40 * Initiator
41 *
42 * @since 1.0.0
43 * @return object initialized object of class.
44 */
45 public static function get_instance() {
46 if ( null === self::$instance ) {
47 self::$instance = new self();
48 }
49 return self::$instance;
50 }
51
52 /**
53 * Autoload classes.
54 *
55 * @param string $class class name.
56 * @return void
57 */
58 public function autoload( $class ): void {
59 if ( 0 !== strpos( $class, __NAMESPACE__ ) ) {
60 return;
61 }
62
63 $class_to_load = $class;
64
65 $filename = strtolower(
66 strval(
67 preg_replace(
68 [ '/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
69 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
70 $class_to_load
71 )
72 )
73 );
74
75 $file = NPS_SURVEY_DIR . $filename . '.php';
76
77 // if the file redable, include it.
78 if ( is_readable( $file ) ) {
79 // nosemgrep audit.php.lang.security.file.inclusion-arg - To allow the theme or plugin on WooCommerce Marketplace.
80 require_once $file;
81 }
82 }
83
84 /**
85 * Load Files
86 *
87 * @since 1.0.0
88 *
89 * @return void
90 */
91 public function load_files(): void {
92 require_once NPS_SURVEY_DIR . 'classes/nps-survey-script.php';
93 }
94 }
95
96 /**
97 * Kicking this off by calling 'get_instance()' method
98 */
99 NPS_Survey_Plugin_Loader::get_instance();
100
101 }
102