PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 8.5.74
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v8.5.74
9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 8.5.4 All 221 releases
wpvr / admin / views / class-wpvr-singleton.php

class-wpvr-singleton.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 8.5.74, at admin/views/class-wpvr-singleton.php

113 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3 /**
4 * The abstract class for maintaing singleton design pattern
5 *
6 * @link http://rextheme.com/
7 * @since 8.0.0
8 *
9 * @package Wpvr
10 * @subpackage Wpvr/admin/views
11 */
12
13 /**
14 * Orginial Singleton class
15 */
16 abstract class Singleton {
17
18 /**
19 * Any Singleton class
20 *
21 * @var Singleton[] $instances
22 * @since 8.0.0
23 */
24 private static $instances = array();
25
26
27 /**
28 * Private construct to avoid 'new'
29 *
30 * @since 8.0.0
31 */
32 private function __construct()
33 {
34
35 }
36
37
38 /**
39 * Get Instacne
40 *
41 * @return Singleton
42 * @since 8.0.0
43 */
44 final public static function get_instance() {
45 $class = get_called_class();
46
47 if ( ! isset( $instances[ $class ] ) ) {
48 self::$instances[ $class ] = new $class();
49 }
50
51 return self::$instances[ $class ];
52 }
53
54
55 /**
56 * Declared to overwrite magic method __clone()
57 * In order to prevent object cloning
58 *
59 * @return void
60 * @since 8.0.0
61 */
62 private function __clone()
63 {
64 // Do nothing
65 }
66
67
68 /**
69 * Declared to overwrite magic method __sleep()
70 * In order to avoid serialize instance
71 *
72 * @return void
73 * @since 8.0.0
74 */
75 public function __sleep()
76 {
77 // Do nothing
78 }
79
80
81 /**
82 * Declared to overwrite magic method __wakeup()
83 * In order to avoid unserialize instance
84 *
85 * @return void
86 * @since 8.0.0
87 */
88 public function __wakeup()
89 {
90 // Do nothing
91 }
92
93
94 /**
95 * Responsible for rendering setting tabs
96 *
97 * @param array $postdata
98 *
99 * @return void
100 * @since 8.0.0
101 */
102 abstract static public function render($postdata);
103
104 /**
105 * Responsible for rendering setting meta fields
106 *
107 * @param array $postdata
108 *
109 * @return void
110 * @since 8.0.0
111 */
112 abstract static public function render_meta_fields($postdata);
113 }