PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.6.0
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.6.0
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 3 months ago dist 3 months ago nps-survey-plugin-loader.php 3 months ago nps-survey.php 3 months ago version.json 3 months ago
nps-survey-plugin-loader.php
111 lines
1 <?php
2 /**
3 * Plugin Loader.
4 *
5 * @package {{package}}
6 * @since {{since}}
7 */
8
9 namespace NPS_Survey;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 if ( ! class_exists( 'NPS_Survey_Plugin_Loader' ) ) {
16
17 /**
18 * Plugin_Loader
19 *
20 * @since 1.0.0
21 */
22 class NPS_Survey_Plugin_Loader {
23 /**
24 * Instance
25 *
26 * @access private
27 * @var object Class Instance.
28 * @since 1.0.0
29 */
30 private static $instance;
31
32 /**
33 * Constructor
34 *
35 * @since 1.0.0
36 */
37 public function __construct() {
38
39 spl_autoload_register( [ $this, 'autoload' ] );
40
41 if ( did_action( 'wp_loaded' ) ) {
42 $this->load_files();
43 } else {
44 add_action( 'wp_loaded', [ $this, 'load_files' ] );
45 }
46 }
47
48 /**
49 * Initiator
50 *
51 * @since 1.0.0
52 * @return object initialized object of class.
53 */
54 public static function get_instance() {
55 if ( null === self::$instance ) {
56 self::$instance = new self();
57 }
58 return self::$instance;
59 }
60
61 /**
62 * Autoload classes.
63 *
64 * @param string $class class name.
65 * @return void
66 */
67 public function autoload( $class ): void {
68 if ( 0 !== strpos( $class, __NAMESPACE__ ) ) {
69 return;
70 }
71
72 $class_to_load = $class;
73
74 $filename = strtolower(
75 strval(
76 preg_replace(
77 [ '/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
78 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
79 $class_to_load
80 )
81 )
82 );
83
84 $file = NPS_SURVEY_DIR . $filename . '.php';
85
86 // if the file redable, include it.
87 if ( is_readable( $file ) ) {
88 // nosemgrep audit.php.lang.security.file.inclusion-arg - To allow the theme or plugin on WooCommerce Marketplace.
89 require_once $file;
90 }
91 }
92
93 /**
94 * Load Files
95 *
96 * @since 1.0.0
97 *
98 * @return void
99 */
100 public function load_files(): void {
101 require_once NPS_SURVEY_DIR . 'classes/nps-survey-script.php';
102 }
103 }
104
105 /**
106 * Kicking this off by calling 'get_instance()' method
107 */
108 NPS_Survey_Plugin_Loader::get_instance();
109
110 }
111