@@ -218,8 +218,8 @@ |
||
218 | 218 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
219 | 219 | */ |
220 | 220 | protected $aDefaultKeys = array( |
221 | - 'label_min_width' => '', // disabled as the embedded elements are all inline. |
|
222 | - 'show_debug_info' => false, // 3.8.8+ @todo Examine why this value does not override the default value of field definition arguments and if possible and appropriate, override it. |
|
221 | + 'label_min_width' => '', // disabled as the embedded elements are all inline. |
|
222 | + 'show_debug_info' => false, // 3.8.8+ @todo Examine why this value does not override the default value of field definition arguments and if possible and appropriate, override it. |
|
223 | 223 | ); |
224 | 224 | |
225 | 225 |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | * @since 3.8.8 |
30 | 30 | */ |
31 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='Admin Page Framework' ) { |
|
31 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = 'Admin Page Framework' ) { |
|
32 | 32 | trigger_error( |
33 | - $sProgramName . ': ' . sprintf( |
|
33 | + $sProgramName.': '.sprintf( |
|
34 | 34 | $sAlternative |
35 | 35 | ? '<code>%1$s</code> has been deprecated. Use <code>%2$s</code> instead.' |
36 | 36 | : '<code>%1$s</code> has been deprecated.', |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param callable $oCallable |
53 | 53 | * @param string|array $asParameters Parameters to pass to the callback function. |
54 | 54 | */ |
55 | - public function callBack( $oCallable, $asParameters=array() ) { |
|
56 | - $_aParameters = self::getAsArray( |
|
55 | + public function callBack( $oCallable, $asParameters = array() ) { |
|
56 | + $_aParameters = self::getAsArray( |
|
57 | 57 | $asParameters, |
58 | 58 | true // preserve empty |
59 | 59 | ); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @since 3.6.3 |
90 | 90 | * @return string The captured output buffer. |
91 | 91 | */ |
92 | - static public function getOutputBuffer( $oCallable, array $aParameters=array() ) { |
|
92 | + static public function getOutputBuffer( $oCallable, array $aParameters = array() ) { |
|
93 | 93 | |
94 | 94 | ob_start(); |
95 | 95 | echo call_user_func_array( $oCallable, $aParameters ); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $_iCount = count( get_object_vars( $oInstance ) ); |
112 | 112 | $_sClassName = get_class( $oInstance ); |
113 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
113 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields false. |
128 | 128 | * @return mixed |
129 | 129 | */ |
130 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
130 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
131 | 131 | return $mValue ? $mTrue : $mFalse; |
132 | 132 | } |
133 | 133 |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * @since 3.8.4 When non-true value is passed, `0px` will be returned. |
37 | 37 | * @return string |
38 | 38 | */ |
39 | - static public function getLengthSanitized( $sLength, $sUnit='px' ) { |
|
39 | + static public function getLengthSanitized( $sLength, $sUnit = 'px' ) { |
|
40 | 40 | $sLength = $sLength ? $sLength : 0; |
41 | 41 | return is_numeric( $sLength ) |
42 | - ? $sLength . $sUnit |
|
42 | + ? $sLength.$sUnit |
|
43 | 43 | : $sLength; |
44 | 44 | } |
45 | 45 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @since 2.0.0 |
83 | 83 | * @return string|integer A numeric value will be returned. |
84 | 84 | */ |
85 | - static public function fixNumber( $nToFix, $nDefault, $nMin='', $nMax='' ) { |
|
85 | + static public function fixNumber( $nToFix, $nDefault, $nMin = '', $nMax = '' ) { |
|
86 | 86 | |
87 | - if ( ! is_numeric( trim( $nToFix ) ) ) { |
|
87 | + if ( !is_numeric( trim( $nToFix ) ) ) { |
|
88 | 88 | return $nDefault; |
89 | 89 | } |
90 | 90 | if ( $nMin !== '' && $nToFix < $nMin ) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | static public function getCSSMinified( $sCSSRules ) { |
108 | 108 | return str_replace( |
109 | - array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' '), // remove line breaks, tab, and white sspaces. |
|
109 | + array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), // remove line breaks, tab, and white sspaces. |
|
110 | 110 | '', |
111 | 111 | preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $sCSSRules ) // remove comments |
112 | 112 | ); |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | */ |
144 | 144 | static public function getNumberOfReadableSize( $nSize ) { |
145 | 145 | |
146 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
147 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
146 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
147 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
148 | 148 | case 'P': |
149 | 149 | $_nReturn *= 1024; |
150 | 150 | case 'T': |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $_nLog = log( $nBytes, 1024 ); |
171 | 171 | $_iPower = ( int ) $_nLog; |
172 | 172 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
173 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
173 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @deprecated 3.8.0 Use `getLengthSanitized()` instead. |
32 | 32 | * @since 3.8.8 Moved from `AdminPageFramework_Utility_String`. |
33 | 33 | */ |
34 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
34 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
35 | 35 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getLengthSanitized()' ); |
36 | 36 | return AdminPageFramework_Utility_String::getLengthSanitized( $sLength, $sUnit ); |
37 | 37 | } |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
51 | 51 | * @deprecated 3.5.3 Use `getElement()`. |
52 | 52 | */ |
53 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
53 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault = '', $bBlankToDefault = false ) { |
|
54 | 54 | |
55 | 55 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
56 | 56 | |
57 | 57 | // If $vSubject is null, |
58 | - if ( ! isset( $vSubject ) ) { |
|
58 | + if ( !isset( $vSubject ) ) { |
|
59 | 59 | return $sDefault; |
60 | 60 | } |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | // If $vSubject is not an array, |
68 | - if ( ! is_array( $vSubject ) ) { |
|
68 | + if ( !is_array( $vSubject ) ) { |
|
69 | 69 | return ( string ) $vSubject; |
70 | 70 | } // consider it as string. |
71 | 71 | |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | * @since 3.5.3 Moved from `AdminPageFramework_FieldType_Base`. |
117 | 117 | * @deprecated 3.5.3 Use the `getElement()` method. |
118 | 118 | */ |
119 | - protected function getFieldElementByKey( $asElement, $sKey, $asDefault='' ) { |
|
119 | + protected function getFieldElementByKey( $asElement, $sKey, $asDefault = '' ) { |
|
120 | 120 | |
121 | 121 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
122 | 122 | |
123 | - if ( ! is_array( $asElement ) || ! isset( $sKey ) ) { |
|
123 | + if ( !is_array( $asElement ) || !isset( $sKey ) ) { |
|
124 | 124 | return $asElement; |
125 | 125 | } |
126 | 126 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__ ); |
145 | 145 | |
146 | - foreach( $aArray as &$vElem ) { |
|
146 | + foreach ( $aArray as &$vElem ) { |
|
147 | 147 | |
148 | 148 | if ( $vElem ) { break; } |
149 | 149 | unset( $vElem ); |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | |
178 | 178 | AdminPageFramework_Utility::showDeprecationNotice( __METHOD__, 'AdminPageFramework_WPUtility::getAttributes()' ); |
179 | 179 | |
180 | - $_sQuoteCharactor ="'"; |
|
180 | + $_sQuoteCharactor = "'"; |
|
181 | 181 | $_aOutput = array(); |
182 | - foreach( $aAttributes as $sAttribute => $sProperty ) { |
|
182 | + foreach ( $aAttributes as $sAttribute => $sProperty ) { |
|
183 | 183 | |
184 | 184 | // Must be resolved as a string. |
185 | 185 | if ( in_array( gettype( $sProperty ), array( 'array', 'object' ) ) ) { |
186 | 186 | continue; |
187 | 187 | } |
188 | - $_aOutput[] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
188 | + $_aOutput[ ] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | return implode( ' ', $_aOutput ); |
@@ -50,27 +50,27 @@ |
||
50 | 50 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
51 | 51 | * @deprecated 3.5.3 Use `getElement()`. |
52 | 52 | */ |
53 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
53 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
54 | 54 | |
55 | 55 | AdminPageFramework_Utility::showDeprecationNotice( __FUNCTION__, 'getElement()' ); |
56 | 56 | |
57 | 57 | // If $vSubject is null, |
58 | - if ( ! isset( $vSubject ) ) { |
|
58 | + if ( ! isset( $vSubject ) ) { |
|
59 | 59 | return $sDefault; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // If the $bBlankToDefault flag is set and the subject value is a blank string, return the default value. |
63 | - if ( $bBlankToDefault && $vSubject == '' ) { |
|
63 | + if ( $bBlankToDefault && $vSubject == '' ) { |
|
64 | 64 | return $sDefault; |
65 | 65 | } |
66 | 66 | |
67 | 67 | // If $vSubject is not an array, |
68 | - if ( ! is_array( $vSubject ) ) { |
|
68 | + if ( ! is_array( $vSubject ) ) { |
|
69 | 69 | return ( string ) $vSubject; |
70 | 70 | } // consider it as string. |
71 | 71 | |
72 | 72 | // Consider $vSubject as array. |
73 | - if ( isset( $vSubject[ $sKey ] ) ) { |
|
73 | + if ( isset( $vSubject[ $sKey ] ) ) { |
|
74 | 74 | return $vSubject[ $sKey ]; |
75 | 75 | } |
76 | 76 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @since 3.8.8 |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='' ) { |
|
26 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = '' ) { |
|
27 | 27 | $sProgramName = $sProgramName ? $sProgramName : self::getFrameworkName(); |
28 | 28 | parent::showDeprecationNotice( $sDeprecated, $sAlternative, $sProgramName ); |
29 | 29 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - foreach( ( array ) $GLOBALS[ '_apf_sub_menus_to_sort' ] as $_sIndex => $_sMenuSlug ) { |
|
46 | - if ( ! isset( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ) ) { |
|
45 | + foreach ( ( array ) $GLOBALS[ '_apf_sub_menus_to_sort' ] as $_sIndex => $_sMenuSlug ) { |
|
46 | + if ( !isset( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ) ) { |
|
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | ksort( $GLOBALS[ 'submenu' ][ $_sMenuSlug ] ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param boolean $bTrimDevVer Whether the `.dev` suffix should be removed or not. |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - static public function getFrameworkVersion( $bTrimDevVer=false ) { |
|
71 | + static public function getFrameworkVersion( $bTrimDevVer = false ) { |
|
72 | 72 | $_sVersion = AdminPageFramework_Registry::getVersion(); |
73 | 73 | return $bTrimDevVer |
74 | 74 | ? self::getSuffixRemoved( $_sVersion, '.dev' ) |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return string |
97 | 97 | */ |
98 | 98 | static public function getFrameworkNameVersion() { |
99 | - return self::getFrameworkName() . ' ' . self::getFrameworkVersion(); |
|
99 | + return self::getFrameworkName().' '.self::getFrameworkVersion(); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | } |
@@ -292,18 +292,18 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
295 | - * Adds form fields. |
|
296 | - * |
|
297 | - * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
298 | - * |
|
299 | - * @since 2.0.0 |
|
300 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
301 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
302 | - * @param array the field definition array. |
|
303 | - * @param array (optional) another field array. |
|
304 | - * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
305 | - * @return void |
|
306 | - */ |
|
295 | + * Adds form fields. |
|
296 | + * |
|
297 | + * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
298 | + * |
|
299 | + * @since 2.0.0 |
|
300 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
301 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
302 | + * @param array the field definition array. |
|
303 | + * @param array (optional) another field array. |
|
304 | + * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
305 | + * @return void |
|
306 | + */ |
|
307 | 307 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
308 | 308 | foreach( func_get_args() as $_aFieldset ) { |
309 | 309 | $this->addSettingField( $_aFieldset ); |
@@ -334,159 +334,159 @@ discard block |
||
334 | 334 | * @return void |
335 | 335 | * @remark The $oForm property should be created in each extended class. |
336 | 336 | * @param array|string $asField A field definition array or a string of the target section id. |
337 | - * <h4>Built-in Field Types</h4> |
|
338 | - * <ul> |
|
339 | - * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
340 | - * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
341 | - * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
342 | - * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
343 | - * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
344 | - * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
345 | - * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
346 | - * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
347 | - * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
348 | - * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
349 | - * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
350 | - * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
351 | - * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
352 | - * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
353 | - * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
354 | - * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
355 | - * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
356 | - * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
357 | - * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
358 | - * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
359 | - * </ul> |
|
360 | - * <h4>Field Definition Arguments</h4> |
|
361 | - * <ul> |
|
362 | - * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
363 | - * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
364 | - * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
365 | - * <li>**title** - (optional, string) the title of the section.</li> |
|
366 | - * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
367 | - * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
368 | - * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
369 | - * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
370 | - * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
371 | - * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
372 | - * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
373 | - * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
374 | - * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
375 | - * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
376 | - * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
377 | - * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
378 | - * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
379 | - * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
380 | - * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
381 | - * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
382 | - * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
383 | - * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
384 | - * <h5>Repeatable Fields Setting Array</h5> |
|
385 | - * <ul> |
|
386 | - * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
387 | - * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
388 | - * </ul> |
|
389 | - * </li> |
|
390 | - * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
391 | - * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
392 | - * <ul> |
|
393 | - * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
394 | - * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
395 | - * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
396 | - * <li>**field** - the `div` tag element containing each field.</li> |
|
397 | - * </ul> |
|
398 | - * </li> |
|
399 | - * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
400 | - * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
401 | - * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
402 | - * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
403 | - * <h4>Example</h4> |
|
404 | - * <pre><code> |
|
405 | - * $this->addSettingFields( |
|
406 | - * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
407 | - * array( |
|
408 | - * 'field_id' => 'Y', |
|
409 | - * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
410 | - * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
411 | - * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
412 | - * 'content' => array( |
|
413 | - * array( |
|
414 | - * 'field_id' => 'i', |
|
415 | - * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
416 | - * 'type' => 'textarea', |
|
417 | - * ), |
|
418 | - * array( |
|
419 | - * 'field_id' => 'ii', |
|
420 | - * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
421 | - * 'type' => 'color', |
|
422 | - * ), |
|
423 | - * array( |
|
424 | - * 'field_id' => 'iii', |
|
425 | - * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
426 | - * 'repeatable' => true, |
|
427 | - * 'sortable' => true, |
|
428 | - * 'content' => array( |
|
429 | - * array( |
|
430 | - * 'field_id' => 'a', |
|
431 | - * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
432 | - * 'type' => 'image', |
|
433 | - * 'attributes' => array( |
|
434 | - * 'preview' => array( |
|
435 | - * 'style' => 'max-width: 200px;', |
|
436 | - * ), |
|
437 | - * ), |
|
438 | - * ), |
|
439 | - * array( |
|
440 | - * 'field_id' => 'b', |
|
441 | - * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
442 | - * 'content' => array( |
|
443 | - * array( |
|
444 | - * 'field_id' => 'first', |
|
445 | - * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
446 | - * 'type' => 'color', |
|
447 | - * 'repeatable' => true, |
|
448 | - * 'sortable' => true, |
|
449 | - * ), |
|
450 | - * array( |
|
451 | - * 'field_id' => 'second', |
|
452 | - * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
453 | - * 'type' => 'size', |
|
454 | - * ), |
|
455 | - * array( |
|
456 | - * 'field_id' => 'third', |
|
457 | - * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
458 | - * 'type' => 'select', |
|
459 | - * 'label' => array( |
|
460 | - * 'x' => 'X', |
|
461 | - * 'y' => 'Y', |
|
462 | - * 'z' => 'Z', |
|
463 | - * ), |
|
464 | - * ), |
|
465 | - * ), |
|
466 | - * // 'description' => '', |
|
467 | - * ), |
|
468 | - * array( |
|
469 | - * 'field_id' => 'c', |
|
470 | - * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
471 | - * 'type' => 'radio', |
|
472 | - * 'label' => array( |
|
473 | - * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
474 | - * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
475 | - * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
476 | - * ), |
|
477 | - * 'default' => 'b', |
|
478 | - * ), |
|
479 | - * ) |
|
480 | - * ), |
|
481 | - * ), |
|
482 | - * ) |
|
483 | - * ); |
|
484 | - * </code></pre> |
|
485 | - * </li> |
|
486 | - * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
487 | - * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
488 | - * </ul> |
|
489 | - */ |
|
337 | + * <h4>Built-in Field Types</h4> |
|
338 | + * <ul> |
|
339 | + * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
340 | + * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
341 | + * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
342 | + * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
343 | + * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
344 | + * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
345 | + * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
346 | + * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
347 | + * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
348 | + * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
349 | + * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
350 | + * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
351 | + * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
352 | + * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
353 | + * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
354 | + * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
355 | + * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
356 | + * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
357 | + * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
358 | + * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
359 | + * </ul> |
|
360 | + * <h4>Field Definition Arguments</h4> |
|
361 | + * <ul> |
|
362 | + * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
363 | + * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
364 | + * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
365 | + * <li>**title** - (optional, string) the title of the section.</li> |
|
366 | + * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
367 | + * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
368 | + * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
369 | + * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
370 | + * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
371 | + * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
372 | + * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
373 | + * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
374 | + * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
375 | + * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
376 | + * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
377 | + * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
378 | + * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
379 | + * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
380 | + * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
381 | + * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
382 | + * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
383 | + * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
384 | + * <h5>Repeatable Fields Setting Array</h5> |
|
385 | + * <ul> |
|
386 | + * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
387 | + * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
388 | + * </ul> |
|
389 | + * </li> |
|
390 | + * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
391 | + * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
392 | + * <ul> |
|
393 | + * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
394 | + * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
395 | + * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
396 | + * <li>**field** - the `div` tag element containing each field.</li> |
|
397 | + * </ul> |
|
398 | + * </li> |
|
399 | + * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
400 | + * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
401 | + * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
402 | + * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
403 | + * <h4>Example</h4> |
|
404 | + * <pre><code> |
|
405 | + * $this->addSettingFields( |
|
406 | + * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
407 | + * array( |
|
408 | + * 'field_id' => 'Y', |
|
409 | + * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
410 | + * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
411 | + * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
412 | + * 'content' => array( |
|
413 | + * array( |
|
414 | + * 'field_id' => 'i', |
|
415 | + * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
416 | + * 'type' => 'textarea', |
|
417 | + * ), |
|
418 | + * array( |
|
419 | + * 'field_id' => 'ii', |
|
420 | + * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
421 | + * 'type' => 'color', |
|
422 | + * ), |
|
423 | + * array( |
|
424 | + * 'field_id' => 'iii', |
|
425 | + * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
426 | + * 'repeatable' => true, |
|
427 | + * 'sortable' => true, |
|
428 | + * 'content' => array( |
|
429 | + * array( |
|
430 | + * 'field_id' => 'a', |
|
431 | + * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
432 | + * 'type' => 'image', |
|
433 | + * 'attributes' => array( |
|
434 | + * 'preview' => array( |
|
435 | + * 'style' => 'max-width: 200px;', |
|
436 | + * ), |
|
437 | + * ), |
|
438 | + * ), |
|
439 | + * array( |
|
440 | + * 'field_id' => 'b', |
|
441 | + * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
442 | + * 'content' => array( |
|
443 | + * array( |
|
444 | + * 'field_id' => 'first', |
|
445 | + * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
446 | + * 'type' => 'color', |
|
447 | + * 'repeatable' => true, |
|
448 | + * 'sortable' => true, |
|
449 | + * ), |
|
450 | + * array( |
|
451 | + * 'field_id' => 'second', |
|
452 | + * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
453 | + * 'type' => 'size', |
|
454 | + * ), |
|
455 | + * array( |
|
456 | + * 'field_id' => 'third', |
|
457 | + * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
458 | + * 'type' => 'select', |
|
459 | + * 'label' => array( |
|
460 | + * 'x' => 'X', |
|
461 | + * 'y' => 'Y', |
|
462 | + * 'z' => 'Z', |
|
463 | + * ), |
|
464 | + * ), |
|
465 | + * ), |
|
466 | + * // 'description' => '', |
|
467 | + * ), |
|
468 | + * array( |
|
469 | + * 'field_id' => 'c', |
|
470 | + * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
471 | + * 'type' => 'radio', |
|
472 | + * 'label' => array( |
|
473 | + * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
474 | + * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
475 | + * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
476 | + * ), |
|
477 | + * 'default' => 'b', |
|
478 | + * ), |
|
479 | + * ) |
|
480 | + * ), |
|
481 | + * ), |
|
482 | + * ) |
|
483 | + * ); |
|
484 | + * </code></pre> |
|
485 | + * </li> |
|
486 | + * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
487 | + * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
488 | + * </ul> |
|
489 | + */ |
|
490 | 490 | public function addSettingField( $asFieldset ) { |
491 | 491 | if ( method_exists( $this->oForm, 'addField' ) ) { |
492 | 492 | $this->oForm->addField( $asFieldset ); |
@@ -550,28 +550,28 @@ discard block |
||
550 | 550 | } |
551 | 551 | |
552 | 552 | /** |
553 | - * Sets the given message to be displayed in the next page load. |
|
554 | - * |
|
555 | - * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
556 | - * and normally used in validation callback methods. |
|
557 | - * |
|
558 | - * <h4>Example</h4> |
|
559 | - * ` |
|
560 | - * if ( ! $bVerified ) { |
|
561 | - * $this->setFieldErrors( $aErrors ); |
|
562 | - * $this->setSettingNotice( 'There was an error in your input.' ); |
|
563 | - * return $aOldPageOptions; |
|
564 | - * } |
|
565 | - * ` |
|
566 | - * |
|
567 | - * @since 3.0.4 |
|
568 | - * @access public |
|
569 | - * @param string $sMessage the text message to be displayed. |
|
570 | - * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
571 | - * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
572 | - * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
573 | - * @return void |
|
574 | - */ |
|
553 | + * Sets the given message to be displayed in the next page load. |
|
554 | + * |
|
555 | + * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
556 | + * and normally used in validation callback methods. |
|
557 | + * |
|
558 | + * <h4>Example</h4> |
|
559 | + * ` |
|
560 | + * if ( ! $bVerified ) { |
|
561 | + * $this->setFieldErrors( $aErrors ); |
|
562 | + * $this->setSettingNotice( 'There was an error in your input.' ); |
|
563 | + * return $aOldPageOptions; |
|
564 | + * } |
|
565 | + * ` |
|
566 | + * |
|
567 | + * @since 3.0.4 |
|
568 | + * @access public |
|
569 | + * @param string $sMessage the text message to be displayed. |
|
570 | + * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
571 | + * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
572 | + * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
573 | + * @return void |
|
574 | + */ |
|
575 | 575 | public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
576 | 576 | $this->oForm->setSubmitNotice( |
577 | 577 | $sMessage, |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( $oProp, $oMsg ) { |
30 | 30 | |
31 | - if ( ! $this->_shouldProceed( $oProp ) ) { |
|
31 | + if ( !$this->_shouldProceed( $oProp ) ) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | private function _shouldProceed( $oProp ) { |
47 | 47 | |
48 | - if ( $oProp->bIsAdminAjax || ! $oProp->bIsAdmin ) { |
|
48 | + if ( $oProp->bIsAdminAjax || !$oProp->bIsAdmin ) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | return ( boolean ) $oProp->bShowDebugInfo; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function _replyToGetPageLoadInfo( $sFooterHTML ) { |
73 | 73 | |
74 | 74 | // 3.8.8+ The `bShowDebugInfo` property may be updated by the user during the page load. |
75 | - if ( ! $this->oProp->bShowDebugInfo ) { |
|
75 | + if ( !$this->oProp->bShowDebugInfo ) { |
|
76 | 76 | return $sFooterHTML; |
77 | 77 | } |
78 | 78 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | $_sInitialMemoryUsage = round( $this->_convertBytesToHR( $this->_nInitialMemoryUsage ), 2 ); |
101 | 101 | return "<div id='admin-page-framework-page-load-stats'>" |
102 | 102 | . "<ul>" |
103 | - . "<li>" . sprintf( $this->oMsg->get( 'queries_in_seconds' ), $_nQueryCount, $_nSeconds ) . "</li>" |
|
104 | - . "<li>" . sprintf( $this->oMsg->get( 'out_of_x_memory_used' ), $_nMemoryUsage, $_nMemoryLimit, round( ( $_nMemoryUsage / $_nMemoryLimit ), 2 ) * 100 . '%' ) . "</li>" |
|
105 | - . "<li>" . sprintf( $this->oMsg->get( 'peak_memory_usage' ), $_nMemoryPeakUsage ) . "</li>" |
|
106 | - . "<li>" . sprintf( $this->oMsg->get( 'initial_memory_usage' ), $_sInitialMemoryUsage ) . "</li>" |
|
103 | + . "<li>".sprintf( $this->oMsg->get( 'queries_in_seconds' ), $_nQueryCount, $_nSeconds )."</li>" |
|
104 | + . "<li>".sprintf( $this->oMsg->get( 'out_of_x_memory_used' ), $_nMemoryUsage, $_nMemoryLimit, round( ( $_nMemoryUsage / $_nMemoryLimit ), 2 ) * 100.'%' )."</li>" |
|
105 | + . "<li>".sprintf( $this->oMsg->get( 'peak_memory_usage' ), $_nMemoryPeakUsage )."</li>" |
|
106 | + . "<li>".sprintf( $this->oMsg->get( 'initial_memory_usage' ), $_sInitialMemoryUsage )."</li>" |
|
107 | 107 | . "</ul>" |
108 | 108 | . "</div>"; |
109 | 109 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | */ |
122 | 122 | private function _convertToNumber( $nSize ) { |
123 | 123 | |
124 | - $_nReturn = substr( $nSize, 0, -1 ); |
|
125 | - switch( strtoupper( substr( $nSize, -1 ) ) ) { |
|
124 | + $_nReturn = substr( $nSize, 0, -1 ); |
|
125 | + switch ( strtoupper( substr( $nSize, -1 ) ) ) { |
|
126 | 126 | case 'P': |
127 | 127 | $_nReturn *= 1024; |
128 | 128 | case 'T': |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $_nLog = log( $nBytes, 1024 ); |
152 | 152 | $_iPower = ( int ) $_nLog; |
153 | 153 | $_iSize = pow( 1024, $_nLog - $_iPower ); |
154 | - return $_iSize . $_aUnits[ $_iPower ]; |
|
154 | + return $_iSize.$_aUnits[ $_iPower ]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | } |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @since 3.3.0 |
29 | 29 | */ |
30 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
30 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
31 | 31 | |
32 | 32 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
33 | 33 | ? $this->aSubClassNames[ 'oProp' ] |
34 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
34 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
35 | 35 | |
36 | 36 | $this->oProp = new $_sProprtyClassName( |
37 | 37 | $this, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ( $this->oProp->bIsAdminAjax ) { |
48 | 48 | return; |
49 | 49 | } |
50 | - if ( ! $this->oProp->bIsAdmin ) { |
|
50 | + if ( !$this->oProp->bIsAdmin ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
94 | 94 | * @internal |
95 | 95 | */ |
96 | - public function __call( $sMethodName, $aArgs=null ) { |
|
96 | + public function __call( $sMethodName, $aArgs = null ) { |
|
97 | 97 | |
98 | 98 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
99 | 99 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | 'load_pre_', |
105 | 105 | ); |
106 | 106 | |
107 | - switch( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
107 | + switch ( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
108 | 108 | |
109 | 109 | // add_settings_section() callback |
110 | 110 | case 'section_pre_': |
111 | - return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
111 | + return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
112 | 112 | |
113 | 113 | // add_settings_field() callback |
114 | 114 | case 'field_pre_': |
115 | - return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
115 | + return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
116 | 116 | |
117 | 117 | // load-{page} callback |
118 | 118 | case 'load_pre_': |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @return string The found callback method name or the prefix of a known callback method name. An empty string if not found. |
131 | 131 | * @internal |
132 | 132 | */ |
133 | - private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes=array() ) { |
|
133 | + private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes = array() ) { |
|
134 | 134 | |
135 | - foreach( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
135 | + foreach ( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
136 | 136 | if ( $this->oUtil->hasPrefix( $_sMethodPrefix, $sMethodName ) ) { |
137 | 137 | return $_sMethodPrefix; |
138 | 138 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function _doPageLoadCall( $sMethodName, $sPageSlug, $sTabSlug, $oScreen ) { |
158 | 158 | |
159 | - if ( ! $this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
159 | + if ( !$this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen->id ) ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $this->_setShowDebugInfoProperty( $sPageSlug ); // 3.8.8+ |
167 | 167 | |
168 | 168 | // Do actions in this order, class -> page -> in-page tab. This order is important as some methods rely on it. |
169 | - $this->load(); // 3.7.12+ |
|
169 | + $this->load(); // 3.7.12+ |
|
170 | 170 | $this->oUtil->addAndDoActions( |
171 | 171 | $this, // the caller object |
172 | 172 | array( |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | $sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
184 | 184 | |
185 | 185 | if ( strlen( $sTabSlug ) ) { |
186 | - $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
186 | + $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
187 | 187 | $this->oUtil->addAndDoActions( |
188 | 188 | $this, // the caller object |
189 | - array( "load_{$sPageSlug}_" . $sTabSlug ), |
|
189 | + array( "load_{$sPageSlug}_".$sTabSlug ), |
|
190 | 190 | $this // the admin page object - this lets third-party scripts use the framework methods. |
191 | 191 | ); |
192 | 192 | } |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | * @since 3.8.8 |
212 | 212 | * @return void |
213 | 213 | */ |
214 | - private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug='' ) { |
|
214 | + private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug = '' ) { |
|
215 | 215 | |
216 | 216 | // For the page, |
217 | - if ( ! strlen( $sTabSlug ) ) { |
|
217 | + if ( !strlen( $sTabSlug ) ) { |
|
218 | 218 | $this->oProp->bShowDebugInfo = $this->oUtil->getElement( |
219 | 219 | $this->oProp->aPages, |
220 | 220 | array( $sPageSlug, 'show_debug_info' ), |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | if ( substr( $sMethodName, strlen( 'load_pre_' ) ) !== $sPageSlug ) { |
260 | 260 | return false; |
261 | 261 | } |
262 | - if ( ! isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
262 | + if ( !isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | if ( $sScreenID !== $this->oProp->aPageHooks[ $sPageSlug ] ) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | // Nothing to do in the network admin area. |
289 | - return ! is_network_admin(); |
|
289 | + return !is_network_admin(); |
|
290 | 290 | |
291 | 291 | } |
292 | 292 | |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | public function _isInThePage() { |
302 | 302 | |
303 | 303 | // If the setUp method is not loaded yet, |
304 | - if ( ! did_action( 'set_up_' . $this->oProp->sClassName ) ) { |
|
304 | + if ( !did_action( 'set_up_'.$this->oProp->sClassName ) ) { |
|
305 | 305 | return true; |
306 | 306 | } |
307 | 307 | |
308 | - if ( ! isset( $_GET[ 'page' ] ) ) { |
|
308 | + if ( !isset( $_GET[ 'page' ] ) ) { |
|
309 | 309 | return false; |
310 | 310 | } |
311 | 311 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
94 | 94 | * @internal |
95 | 95 | */ |
96 | - public function __call( $sMethodName, $aArgs=null ) { |
|
96 | + public function __call( $sMethodName, $aArgs=null ) { |
|
97 | 97 | |
98 | 98 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
99 | 99 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // Note that the if the tab is the first item, and the user arrives the page by clicking on the sidebar menu, the tab slug will be empty unless an in-page tab is added. |
183 | 183 | $sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
184 | 184 | |
185 | - if ( strlen( $sTabSlug ) ) { |
|
185 | + if ( strlen( $sTabSlug ) ) { |
|
186 | 186 | $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
187 | 187 | $this->oUtil->addAndDoActions( |
188 | 188 | $this, // the caller object |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | return true; |
306 | 306 | } |
307 | 307 | |
308 | - if ( ! isset( $_GET[ 'page' ] ) ) { |
|
308 | + if ( ! isset( $_GET[ 'page' ] ) ) { |
|
309 | 309 | return false; |
310 | 310 | } |
311 | 311 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public static function instantiate( $oProp, $oMsg ) { |
30 | 30 | |
31 | - if ( in_array( $oProp->sClassName, self::$aClassNames ) ) { |
|
31 | + if ( in_array( $oProp->sClassName, self::$aClassNames ) ) { |
|
32 | 32 | return self::$_oInstance; |
33 | 33 | } |
34 | 34 |