PluginProbe
WP-Stateless – Google Cloud Storage / 3.0.3
WP-Stateless – Google Cloud Storage v3.0.3
4.4.3 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 All 62 releases
wp-stateless / vendor / udx / lib-wp-bootstrap / lib / classes / class-scaffold.php

class-scaffold.php in WP-Stateless – Google Cloud Storage 3.0.3, at vendor/udx/lib-wp-bootstrap/lib/classes/class-scaffold.php

152 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Scaffold
4 *
5 * @namespace UsabilityDynamics
6 *
7 * This file can be used to bootstrap any of the UD plugins, it essentially requires that you have
8 * a core file which will be called after 'plugins_loaded'. In addition, if the core class has
9 * 'activate' and 'deactivate' functions, then those will be called automatically by this class.
10 */
11 namespace UsabilityDynamics\WP {
12
13 if( !class_exists( 'UsabilityDynamics\WP\Scaffold' ) ) {
14
15 /**
16 *
17 * @class Scaffold
18 * @author: peshkov@UD
19 */
20 abstract class Scaffold {
21
22 /**
23 * Plugin ( Theme ) Name.
24 *
25 * @public
26 * @property $name
27 * @type string
28 */
29 public $name = false;
30
31 /**
32 * Slug.
33 *
34 * @public
35 * @property $plugin
36 * @type string
37 */
38 public $slug = false;
39
40 /**
41 * Textdomain String
42 *
43 * @public
44 * @property domain
45 * @var string
46 */
47 public $domain = false;
48
49 /**
50 * Root path
51 *
52 * @public
53 * @property root_path
54 * @var string
55 */
56 public $root_path = false;
57
58 /**
59 * Root URL
60 *
61 * @public
62 * @property root_url
63 * @var string
64 */
65 public $root_url = false;
66
67 /**
68 * UserVoice URL
69 *
70 * @public
71 * @property uservoice_url
72 * @var string
73 */
74 public $uservoice_url = false;
75
76 /**
77 * Support URL
78 *
79 * @public
80 * @property support_url
81 * @var string
82 */
83 public $support_url = false;
84
85 /**
86 * Storage for dynamic properties
87 * Used by magic __set, __get
88 *
89 * @protected
90 * @type array
91 */
92 protected $_properties = array();
93
94 /**
95 * Constructor
96 *
97 * @author peshkov@UD
98 */
99 protected function __construct( $args = array() ) {
100 $_args = array();
101 foreach( $args as $k => $v ) {
102 if( property_exists( $this, $k ) ) {
103 $prop = new \ReflectionProperty( $this, $k );
104 if( !$prop->isStatic() ) {
105 switch( $k ) {
106 case 'root_path':
107 $this->root_path = trailingslashit( trim( $v ) );
108 break;
109 case 'name':
110 $this->slug = sanitize_key( trim( $v ) );
111 default:
112 $this->{$k} = trim( $v );
113 break;
114 }
115 } else {
116 $_args[ $k ] = $v;
117 }
118 } else {
119 $_args[ $k ] = $v;
120 }
121 }
122 $this->args = $_args;
123
124 //** Debug data */
125 if( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) {
126 $trace = debug_backtrace();
127 $this->debug = array(
128 /** Where from the current class is called */
129 'backtrace_path' => $trace[0]['file'],
130 );
131 }
132 }
133
134 /**
135 *
136 */
137 public function __get( $key ) {
138 return isset( $this->_properties[ $key ] ) ? $this->_properties[ $key ] : NULL;
139 }
140
141 /**
142 *
143 */
144 public function __set( $key, $value ) {
145 $this->_properties[ $key ] = $value;
146 }
147
148 }
149
150 }
151
152 }