1 | <?php |
||
21 | abstract class AdminPageFramework_Property_Base extends AdminPageFramework_WPUtility { |
||
1 ignored issue
–
show
|
|||
22 | |||
23 | /** |
||
24 | * Represents the structure of the script info array. |
||
25 | * @internal |
||
26 | * @since 2.0.0 |
||
27 | * @since 3.0.0 Moved from the link class. |
||
28 | */ |
||
29 | private static $_aStructure_CallerInfo = array( |
||
30 | 'sPath' => null, |
||
31 | 'sType' => null, |
||
32 | 'sName' => null, |
||
33 | 'sURI' => null, |
||
34 | 'sVersion' => null, |
||
35 | 'sThemeURI' => null, |
||
36 | 'sScriptURI' => null, |
||
37 | 'sAuthorURI' => null, |
||
38 | 'sAuthor' => null, |
||
39 | 'sDescription' => null, |
||
40 | ); |
||
41 | |||
42 | /** |
||
43 | * Stores the library information. |
||
44 | * |
||
45 | * @remark Do not assign anything here because it is checked whether it is set. |
||
46 | * @since 3.0.0 |
||
47 | */ |
||
48 | static public $_aLibraryData; |
||
49 | |||
50 | /** |
||
51 | * Defines the property type. |
||
52 | * |
||
53 | * @since 3.3.1 This was defined in each extended classes. |
||
54 | * @internal |
||
55 | */ |
||
56 | public $_sPropertyType = ''; |
||
57 | |||
58 | /** |
||
59 | * Stores the main (caller) object. |
||
60 | * |
||
61 | * @since 2.1.5 |
||
62 | */ |
||
63 | protected $oCaller; |
||
64 | |||
65 | /** |
||
66 | * Stores the caller script file path. |
||
67 | * |
||
68 | * @since 3.0.0 |
||
69 | */ |
||
70 | public $sCallerPath; |
||
71 | |||
72 | /** |
||
73 | * Stores the caller script data |
||
74 | * |
||
75 | * @remark Do not even declare the variable name so that it triggers the getter method. |
||
76 | * @since Unknown |
||
77 | */ |
||
78 | // public $aScriptInfo; |
||
79 | |||
80 | /** |
||
81 | * Stores the extended class name that instantiated the property object. |
||
82 | * |
||
83 | * @since |
||
84 | */ |
||
85 | public $sClassName; |
||
86 | |||
87 | /** |
||
88 | * The MD5 hash string of the extended class name. |
||
89 | * @since |
||
90 | */ |
||
91 | public $sClassHash; |
||
92 | |||
93 | /** |
||
94 | * Stores the script to be embedded in the head tag. |
||
95 | * |
||
96 | * @remark This should be an empty string by default since the related methods uses the append operator. |
||
97 | * @since 2.0.0 |
||
98 | * @since 2.1.5 Moved from each extended property class. |
||
99 | * @internal |
||
100 | */ |
||
101 | public $sScript = ''; |
||
102 | |||
103 | /** |
||
104 | * Stores the CSS rules to be embedded in the head tag. |
||
105 | * |
||
106 | * @remark This should be an empty string by default since the related methods uses the append operator. |
||
107 | * @since 2.0.0 |
||
108 | * @since 2.1.5 Moved from each extended property class. |
||
109 | * @internal |
||
110 | */ |
||
111 | public $sStyle = ''; |
||
112 | |||
113 | /** |
||
114 | * Stores the CSS rules for IE to be embedded in the head tag. |
||
115 | * |
||
116 | * @remark This should be an empty string by default since the related methods uses the append operator. |
||
117 | * @since 2.0.0 to 2.1.4 |
||
118 | * @internal |
||
119 | */ |
||
120 | public $sStyleIE = ''; |
||
121 | |||
122 | /** |
||
123 | * Stores the field type definitions. |
||
124 | * |
||
125 | * @since 2.1.5 |
||
126 | * @internal |
||
127 | */ |
||
128 | public $aFieldTypeDefinitions = array(); |
||
129 | |||
130 | /** |
||
131 | * The default JavaScript script loaded in the head tag of the created admin pages. |
||
132 | * |
||
133 | * @since 3.0.0 |
||
134 | * @internal |
||
135 | */ |
||
136 | public static $_sDefaultScript = ""; |
||
137 | |||
138 | /** |
||
139 | * The default CSS rules loaded in the head tag of the created admin pages. |
||
140 | * |
||
141 | * @since 2.0.0 |
||
142 | * @var string |
||
143 | * @static |
||
144 | * @remark It is accessed from the main class and meta box class. |
||
145 | * @access public |
||
146 | * @deprecated 3.2.0 |
||
147 | * @internal |
||
148 | */ |
||
149 | public static $_sDefaultStyle =""; |
||
150 | |||
151 | /** |
||
152 | * The default CSS rules for IE loaded in the head tag of the created admin pages. |
||
153 | * @since 2.1.1 |
||
154 | * @since 2.1.5 Moved the contents to the taxonomy field definition so it become an empty string. |
||
155 | * @deprecated 3.2.0 |
||
156 | * @internal |
||
157 | */ |
||
158 | public static $_sDefaultStyleIE = ''; |
||
159 | |||
160 | /** |
||
161 | * Stores enqueuing script URLs and their criteria by md5 hash of the source url. |
||
162 | * @since 2.1.2 |
||
163 | * @since 2.1.5 Moved to the base class. |
||
164 | */ |
||
165 | public $aEnqueuingScripts = array(); |
||
166 | /** |
||
167 | * Stores enqueuing style URLs and their criteria by md5 hash of the source url. |
||
168 | * @since 2.1.2 |
||
169 | * @since 2.1.5 Moved to the base class. |
||
170 | */ |
||
171 | public $aEnqueuingStyles = array(); |
||
172 | |||
173 | |||
174 | /** |
||
175 | * Stores enqueued script/style argument array by its url. |
||
176 | * @since 3.3.0 |
||
177 | */ |
||
178 | public $aResourceAttributes = array(); |
||
179 | |||
180 | |||
181 | /** |
||
182 | * Stores the index of enqueued scripts. |
||
183 | * |
||
184 | * @since 2.1.2 |
||
185 | * @since 2.1.5 Moved to the base class. |
||
186 | */ |
||
187 | public $iEnqueuedScriptIndex = 0; |
||
188 | /** |
||
189 | * Stores the index of enqueued styles. |
||
190 | * |
||
191 | * The index number will be incremented as a script is enqueued regardless a previously added enqueue item has been removed or not. |
||
192 | * This is because this index number will be used for the script handle ID which is automatically generated. |
||
193 | * |
||
194 | * @since 2.1.2 |
||
195 | * @since 2.1.5 Moved to the base class. |
||
196 | */ |
||
197 | public $iEnqueuedStyleIndex = 0; |
||
198 | |||
199 | /** |
||
200 | * Stores is_admin() value to be reused. |
||
201 | * |
||
202 | * @since 3.0.0 |
||
203 | */ |
||
204 | public $bIsAdmin; |
||
205 | |||
206 | /** |
||
207 | * Stores the flag that indicates whether the library is minified or not. |
||
208 | * @since 3.0.0 |
||
209 | * @deprecated 3.1.3 Use AdminPageFramework_Registry::$bIsMinifiedVersion |
||
210 | */ |
||
211 | public $bIsMinifiedVersion; |
||
212 | |||
213 | /** |
||
214 | * Stores the capability for displayable elements. |
||
215 | * |
||
216 | * @since 2.0.0 |
||
217 | */ |
||
218 | public $sCapability; |
||
219 | |||
220 | /** |
||
221 | * Defines the fields type. |
||
222 | * |
||
223 | * Can be either 'admin_page', 'network_admin_page', 'post_meta_box', 'page_meta_box', 'post_type', 'taxonomy_field' |
||
224 | * |
||
225 | * @since 3.0.4 |
||
226 | * @internal |
||
227 | */ |
||
228 | public $sStructureType; |
||
229 | |||
230 | /** |
||
231 | * Stores the text domain. |
||
232 | * |
||
233 | * @since 3.0.4 |
||
234 | * @internal |
||
235 | */ |
||
236 | public $sTextDomain; |
||
237 | |||
238 | /** |
||
239 | * Stores the current page's base name. |
||
240 | * |
||
241 | * @since 3.0.5 |
||
242 | * @internal |
||
243 | */ |
||
244 | public $sPageNow; |
||
245 | |||
246 | /** |
||
247 | * Indicates whether the setUp() method is loaded. |
||
248 | * |
||
249 | * @since 3.1.0 |
||
250 | * @internal |
||
251 | * @deprecated DEVVER To check if the `setUp()` is called, perform did_action( 'set_up_' . {instantiated class name} ) |
||
252 | */ |
||
253 | public $_bSetupLoaded; |
||
254 | |||
255 | /** |
||
256 | * Indicates whether the current page is in admin-ajax.php |
||
257 | * |
||
258 | * @since 3.1.3 |
||
259 | * @internal |
||
260 | */ |
||
261 | public $bIsAdminAjax; |
||
262 | |||
263 | /** |
||
264 | * Stores the label of the settings link embedded to the plugin listing table cell of the plugin title. |
||
265 | * |
||
266 | * @since 3.1.0 |
||
267 | * @since 3.5.5 Moved from `AdminPageFramework_Property_Page` as the post type class also access it. |
||
268 | * @remark The default value should be `null` as the user may explicitly set an empty value. |
||
269 | * The `null` value will be replaced with the system default text 'Settings' while an empty string '' will remove the link. |
||
270 | */ |
||
271 | public $sLabelPluginSettingsLink = null; |
||
272 | |||
273 | /** |
||
274 | * Stores the information to insert into the page footer. |
||
275 | * |
||
276 | * The initially assigned text strings, `__SCRIPT_CREDIT__` and `__FRAMEWORK_CREDIT__` are reserved for the default values which will be replaced when the footer is being rendered. |
||
277 | * |
||
278 | * @since 2.0.0 |
||
279 | * @since 3.5.5 Moved from `AdminpageFramework_Property_Page` as this is used by the post type link class and admin page link class. |
||
280 | */ |
||
281 | public $aFooterInfo = array( |
||
282 | 'sLeft' => '__SCRIPT_CREDIT__', |
||
283 | 'sRight' => '__FRAMEWORK_CREDIT__', |
||
284 | ); |
||
285 | |||
286 | /** |
||
287 | * The utility object. |
||
288 | * @since 3.5.3 |
||
289 | * @deprecated DEVVER |
||
290 | */ |
||
291 | public $oUtil; |
||
292 | |||
293 | /** |
||
294 | * Stores the action hook name that gets triggered when the form registration is performed. |
||
295 | * 'admin_page' and 'network_admin_page' will use a custom hook for it. |
||
296 | * @since DEVVER |
||
297 | * @access public |
||
298 | */ |
||
299 | public $_sFormRegistrationHook = 'current_screen'; |
||
300 | |||
301 | /** |
||
302 | * Stores arguments for the form object. |
||
303 | * @since DEVVER |
||
304 | */ |
||
305 | public $aFormArguments = array( |
||
306 | 'caller_id' => '', |
||
307 | 'structure_type' => '', |
||
308 | 'action_hook_form_registration' => '', |
||
309 | ); |
||
310 | |||
311 | /** |
||
312 | * Stores callbacks for the form object. |
||
313 | * @since DEVVER |
||
314 | */ |
||
315 | public $aFormCallbacks = array( |
||
316 | 'hfID' => null, // the input id attribute |
||
317 | 'hfTagID' => null, // the field container id attribute |
||
318 | 'hfName' => null, // the field name attribute |
||
319 | 'hfNameFlat' => null, // the flat field name attribute |
||
320 | 'hfInputName' => null, // 3.6.0+ the field input name attribute |
||
321 | 'hfInputNameFlat' => null, // 3.6.0+ the flat field input name |
||
322 | 'hfClass' => null, // the class attribute |
||
323 | ); |
||
324 | |||
325 | /** |
||
326 | * Sets up necessary property values. |
||
327 | */ |
||
328 | public function __construct( $oCaller, $sCallerPath, $sClassName, $sCapability, $sTextDomain, $sStructureType ) { |
||
408 | /** |
||
409 | * Sets deprecated property items for backward compatibility. |
||
410 | * @since DEVVER |
||
411 | */ |
||
412 | private function _setDeprecated() { |
||
415 | |||
416 | /** |
||
417 | * Returns the caller object. |
||
418 | * |
||
419 | * This is used from other sub classes that need to retrieve the caller object. |
||
420 | * |
||
421 | * @since 2.1.5 |
||
422 | * @access public |
||
423 | * @return object The caller class object. |
||
424 | * @internal |
||
425 | */ |
||
426 | public function _getCallerObject() { |
||
429 | |||
430 | /** |
||
431 | * Sets the library information property array. |
||
432 | * @internal |
||
433 | * @since 3.0.0 |
||
434 | */ |
||
435 | static public function _setLibraryData() { |
||
459 | /** |
||
460 | * Returns the set library data array. |
||
461 | * |
||
462 | * @internal |
||
463 | * @since 3.0.0 |
||
464 | */ |
||
465 | static public function _getLibraryData() { |
||
470 | |||
471 | /* |
||
472 | * Methods for getting script info. |
||
473 | */ |
||
474 | /** |
||
475 | * Retrieves the caller script information whether it's a theme or plugin or something else. |
||
476 | * |
||
477 | * @since 2.0.0 |
||
478 | * @since 3.0.0 Moved from the link class. |
||
479 | * @remark The information can be used to embed into the footer etc. |
||
480 | * @return array The information of the script. |
||
481 | */ |
||
482 | protected function getCallerInfo( $sCallerPath=null ) { |
||
507 | |||
508 | /** |
||
509 | * Determines the script type. |
||
510 | * |
||
511 | * It tries to find what kind of script this is, theme, plugin or something else from the given path. |
||
512 | * |
||
513 | * @since 2.0.0 |
||
514 | * @since 3.0.0 Moved from the link class. |
||
515 | * @since 3.1.5 Changed the scope to protected as the post type property class access it. |
||
516 | * @return string Returns either 'theme', 'plugin', or 'unknown' |
||
517 | */ |
||
518 | protected function _getCallerType( $sScriptPath ) { |
||
529 | |||
530 | /** |
||
531 | * Retrieves the option array. |
||
532 | * |
||
533 | * This method should be extended in the extended class. |
||
534 | * |
||
535 | * @remark This method is triggered from the __get() overload magic method to set the $aOptions property. |
||
536 | * @since 3.1.0 |
||
537 | * @internal |
||
538 | */ |
||
539 | protected function _getOptions() { |
||
542 | |||
543 | /* |
||
544 | * Magic methods |
||
545 | * */ |
||
546 | /** |
||
547 | * |
||
548 | * @since 3.1.3 |
||
549 | */ |
||
550 | public function __get( $sName ) { |
||
569 | |||
570 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.