@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function start() { |
20 | 20 | |
21 | - if ( ! $this->oProp->bIsAdmin ) { |
|
21 | + if ( !$this->oProp->bIsAdmin ) { |
|
22 | 22 | return; |
23 | 23 | } |
24 | - if ( ! is_network_admin() ) { |
|
24 | + if ( !is_network_admin() ) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | // Enable / disable the demo pages |
29 | - if ( isset( $_GET['enable_apfl_demo_pages'] ) ) { |
|
29 | + if ( isset( $_GET[ 'enable_apfl_demo_pages' ] ) ) { |
|
30 | 30 | |
31 | 31 | // Update the options and reload the page |
32 | - $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys['main'] ); |
|
33 | - $_oOption->update( 'enable_demo', $_GET['enable_apfl_demo_pages'] ); |
|
32 | + $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys[ 'main' ] ); |
|
33 | + $_oOption->update( 'enable_demo', $_GET[ 'enable_apfl_demo_pages' ] ); |
|
34 | 34 | |
35 | 35 | $this->setSettingNotice( |
36 | 36 | __( 'Enabled demo!', 'admin-page-framework-loader' ), |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->_getDemoSwitcherLink( $this->oProp->aOptions ) |
58 | 58 | ); |
59 | 59 | $this->addLinkToPluginDescription( |
60 | - "<a href='https://wordpress.org/support/plugin/admin-page-framework' target='_blank'>" . __( 'Support', 'admin-page-framework-loader' ) . "</a>" |
|
60 | + "<a href='https://wordpress.org/support/plugin/admin-page-framework' target='_blank'>".__( 'Support', 'admin-page-framework-loader' )."</a>" |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | } |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * Returns the switch link of the demo pages. |
67 | 67 | */ |
68 | - private function _getDemoSwitcherLink( $mOptions=array() ) { |
|
68 | + private function _getDemoSwitcherLink( $mOptions = array() ) { |
|
69 | 69 | |
70 | - $_bEnabled = isset( $mOptions['enable_demo'] ) && $mOptions['enable_demo']; |
|
71 | - $_sLink = esc_url( |
|
70 | + $_bEnabled = isset( $mOptions[ 'enable_demo' ] ) && $mOptions[ 'enable_demo' ]; |
|
71 | + $_sLink = esc_url( |
|
72 | 72 | add_query_arg( |
73 | 73 | array( |
74 | 74 | 'enable_apfl_demo_pages' => $_bEnabled ? 0 : 1, |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | ) |
77 | 77 | ); |
78 | 78 | return $_bEnabled |
79 | - ? "<a href='{$_sLink}'>" . __( 'Disable Demo', 'admin-page-framework-loader' ) . "</a>" |
|
80 | - : "<a href='{$_sLink}'><strong style='font-size: 1em;'>" . __( 'Enable Demo', 'admin-page-framework-loader' ) . "</strong></a>"; |
|
79 | + ? "<a href='{$_sLink}'>".__( 'Disable Demo', 'admin-page-framework-loader' )."</a>" |
|
80 | + : "<a href='{$_sLink}'><strong style='font-size: 1em;'>".__( 'Enable Demo', 'admin-page-framework-loader' )."</strong></a>"; |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -68,9 +68,9 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * Responds to a request to an undefined property. |
|
72 | - * @since 3.8.17 |
|
73 | - */ |
|
71 | + * Responds to a request to an undefined property. |
|
72 | + * @since 3.8.17 |
|
73 | + */ |
|
74 | 74 | public function __get( $sPropertyName ) { |
75 | 75 | if ( $this->oProp->bAssumedAsWPWidget ) { |
76 | 76 | if ( isset( $this->oProp->aWPWidgetProperties[ $sPropertyName ] ) ) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | * @return mixed |
56 | 56 | * @since 3.8.17 |
57 | 57 | */ |
58 | - public function __call( $sMethodName, $aArguments=null ) { |
|
58 | + public function __call( $sMethodName, $aArguments = null ) { |
|
59 | 59 | if ( $this->oProp->bAssumedAsWPWidget ) { |
60 | 60 | if ( in_array( $sMethodName, $this->oProp->aWPWidgetMethods ) ) { |
61 | 61 | return call_user_func_array( |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | * For the `admin_page` fields type, an option key is prepended. |
44 | 44 | * For `page_meta_box`, no prepended element and it starts with the section or field ID. |
45 | 45 | */ |
46 | - static public function getInputsUnset( array $aInputs, $sFieldsType, $iSkipDepth=0 ) { |
|
46 | + static public function getInputsUnset( array $aInputs, $sFieldsType, $iSkipDepth = 0 ) { |
|
47 | 47 | |
48 | - $_sUnsetKey = '__unset_' . $sFieldsType; |
|
49 | - if ( ! isset( $_POST[ $_sUnsetKey ] ) ) { |
|
48 | + $_sUnsetKey = '__unset_'.$sFieldsType; |
|
49 | + if ( !isset( $_POST[ $_sUnsetKey ] ) ) { |
|
50 | 50 | return $aInputs; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $_aUnsetElements = array_unique( $_POST[ $_sUnsetKey ] ); |
54 | - foreach( $_aUnsetElements as $_sFlatInputName ) { |
|
54 | + foreach ( $_aUnsetElements as $_sFlatInputName ) { |
|
55 | 55 | |
56 | 56 | $_aDimensionalKeys = explode( '|', $_sFlatInputName ); |
57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // The first element is the option key for the `admin_page` field type and section or field dimensional keys follow. |
64 | - for ( $_i = 0; $_i < $iSkipDepth; $_i++) { |
|
64 | + for ( $_i = 0; $_i < $iSkipDepth; $_i++ ) { |
|
65 | 65 | unset( $_aDimensionalKeys[ $_i ] ); |
66 | 66 | } |
67 | 67 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | static public function hasNestedFields( $aFieldset ) { |
120 | 120 | |
121 | - if ( ! self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
121 | + if ( !self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | // At this point, the `content` argument contains either the definition of nested fields or inline-mixed fields. |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | static public function hasFieldDefinitionsInContent( $aFieldset ) { |
142 | 142 | |
143 | - if ( ! isset( $aFieldset[ 'content' ] ) ) { |
|
143 | + if ( !isset( $aFieldset[ 'content' ] ) ) { |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | if ( empty( $aFieldset[ 'content' ] ) ) { |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | * @since 3.8.13 |
176 | 176 | */ |
177 | 177 | static public function isDynamicField( $aField ) { |
178 | - if ( ! empty( $aField[ 'repeatable' ] ) ) { |
|
178 | + if ( !empty( $aField[ 'repeatable' ] ) ) { |
|
179 | 179 | return true; |
180 | 180 | } |
181 | - if ( ! empty( $aField[ 'sortable' ] ) ) { |
|
181 | + if ( !empty( $aField[ 'sortable' ] ) ) { |
|
182 | 182 | return true; |
183 | 183 | } |
184 | 184 | return false; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if ( empty( $sString ) ) { |
208 | 208 | return $sString; |
209 | 209 | } |
210 | - return $sString . '|'; |
|
210 | + return $sString.'|'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -223,17 +223,17 @@ discard block |
||
223 | 223 | */ |
224 | 224 | static public function getFieldsetReformattedBySubFieldIndex( $aFieldset, $iSubFieldIndex, $bHasSubFields, $aParentFieldset ) { |
225 | 225 | |
226 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
226 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
227 | 227 | |
228 | 228 | // Add sub-field index to the parent field path for repeated nested items. |
229 | - $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
229 | + $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
230 | 230 | $bHasSubFields, |
231 | - $aFieldset[ '_parent_field_path' ] . '|' . $iSubFieldIndex, |
|
231 | + $aFieldset[ '_parent_field_path' ].'|'.$iSubFieldIndex, |
|
232 | 232 | $aFieldset[ '_parent_field_path' ] |
233 | 233 | ); |
234 | - $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
234 | + $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
235 | 235 | $bHasSubFields, |
236 | - $aParentFieldset[ 'tag_id' ] . '__' . $iSubFieldIndex, |
|
236 | + $aParentFieldset[ 'tag_id' ].'__'.$iSubFieldIndex, |
|
237 | 237 | $aParentFieldset[ 'tag_id' ] |
238 | 238 | ); |
239 | 239 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $aFieldset, |
243 | 243 | $aFieldset[ '_structure_type' ], |
244 | 244 | $aFieldset[ 'capability' ], |
245 | - ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
245 | + ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
246 | 246 | $aFieldset[ '_subsection_index' ], |
247 | 247 | $aFieldset[ '_is_section_repeatable' ], |
248 | 248 | $aFieldset[ '_caller_object' ] |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | $_oFieldsetOutputFormatter = new AdminPageFramework_Form_Model___Format_FieldsetOutput( |
253 | 253 | $aFieldset, |
254 | - $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
254 | + $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
255 | 255 | $_oCallerForm->aFieldTypeDefinitions |
256 | 256 | ); |
257 | 257 | return $_oFieldsetOutputFormatter->get(); |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | if ( empty( $aArguments ) ) { |
289 | 289 | return ''; |
290 | 290 | } |
291 | - if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_' . $sBoxElementID ) ) { |
|
291 | + if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_'.$sBoxElementID ) ) { |
|
292 | 292 | return ''; |
293 | 293 | } |
294 | 294 | add_thickbox(); // to display a message to the user. |
295 | 295 | return "<div id='{$sBoxElementID}' style='display:none'>" |
296 | - . "<p>" . $aArguments[ 'message' ] . "</p>" |
|
296 | + . "<p>".$aArguments[ 'message' ]."</p>" |
|
297 | 297 | . "</div>"; |
298 | 298 | |
299 | 299 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | // For form sections, a dummy key is set |
59 | 59 | if ( '__dummy_option_key' === $_aDimensionalKeys[ 0 ] ) { |
60 | - array_shift( $_aDimensionalKeys ); |
|
60 | + array_shift( $_aDimensionalKeys ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // The first element is the option key for the `admin_page` field type and section or field dimensional keys follow. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | // If the first element is a string, it is an inline mixed field definition. |
132 | - return is_array( self::getElement( $aFieldset[ 'content' ], 0 ) ); |
|
132 | + return is_array( self::getElement( $aFieldset[ 'content' ], 0 ) ); |
|
133 | 133 | |
134 | 134 | } |
135 | 135 |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | |
76 | 76 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
77 | 77 | ? $this->aSubClassNames[ 'oProp' ] |
78 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
78 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
79 | 79 | $this->oProp = new $_sPropertyClassName( |
80 | - $this, // caller object |
|
81 | - null, // the caller script path |
|
82 | - $sThisClassName, // class name |
|
83 | - $sCapability, // capability |
|
84 | - $sTextDomain, // text domain |
|
80 | + $this, // caller object |
|
81 | + null, // the caller script path |
|
82 | + $sThisClassName, // class name |
|
83 | + $sCapability, // capability |
|
84 | + $sTextDomain, // text domain |
|
85 | 85 | $this->_sStructureType // fields type |
86 | 86 | ); |
87 | 87 | |
@@ -103,22 +103,22 @@ discard block |
||
103 | 103 | * @since 3.8.17 |
104 | 104 | */ |
105 | 105 | private function ___getConstructorParametersUsedForThisClassName( $sClassName ) { |
106 | - if ( ! isset( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
106 | + if ( !isset( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
107 | 107 | return array(); |
108 | 108 | } |
109 | - if ( ! is_object( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
109 | + if ( !is_object( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
110 | 110 | return array(); |
111 | 111 | } |
112 | - if ( ! isset( $GLOBALS[ 'wp_widget_factory' ]->widgets[ $sClassName ] ) ) { |
|
112 | + if ( !isset( $GLOBALS[ 'wp_widget_factory' ]->widgets[ $sClassName ] ) ) { |
|
113 | 113 | return array(); |
114 | 114 | } |
115 | 115 | // At this point, the widget of the given name is already registered. |
116 | 116 | $_oWPWidget = $GLOBALS[ 'wp_widget_factory' ]->widgets[ $sClassName ]; |
117 | 117 | return array( |
118 | - $_oWPWidget->oCaller->oProp->sWidgetTitle, // 1. widget title, |
|
119 | - $_oWPWidget->oCaller->oProp->aWidgetArguments, // 2. widget arguments |
|
120 | - $_oWPWidget->oCaller->oProp->sCapability, // 3. capability |
|
121 | - $_oWPWidget->oCaller->oProp->sTextDomain, // 4. text domain |
|
118 | + $_oWPWidget->oCaller->oProp->sWidgetTitle, // 1. widget title, |
|
119 | + $_oWPWidget->oCaller->oProp->aWidgetArguments, // 2. widget arguments |
|
120 | + $_oWPWidget->oCaller->oProp->sCapability, // 3. capability |
|
121 | + $_oWPWidget->oCaller->oProp->sTextDomain, // 4. text domain |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function _replyToGetSectionName( /* $sAttribute, $aSectionset */ ) { |
29 | 29 | |
30 | - $_aParams = func_get_args() + array( null, null, ); |
|
30 | + $_aParams = func_get_args() + array( null, null,); |
|
31 | 31 | $sNameAttribute = $_aParams[ 0 ]; |
32 | 32 | $aSectionset = $_aParams[ 1 ]; |
33 | 33 | $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
34 | 34 | $_aDimensionalKeys = array( $this->oProp->sOptionKey ); |
35 | - foreach( $_aSectionPath as $_sDimension ) { |
|
36 | - $_aDimensionalKeys[] = '[' . $_sDimension . ']'; |
|
35 | + foreach ( $_aSectionPath as $_sDimension ) { |
|
36 | + $_aDimensionalKeys[ ] = '['.$_sDimension.']'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if ( isset( $aSectionset[ '_index' ] ) ) { |
40 | - $_aDimensionalKeys[] = '[' . $aSectionset[ '_index' ] . ']'; |
|
40 | + $_aDimensionalKeys[ ] = '['.$aSectionset[ '_index' ].']'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return implode( '', $_aDimensionalKeys ); |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function _replyToGetFieldNameAttribute( /* $sAttribute, $aFieldset */ ) { |
52 | 52 | |
53 | - $_aParams = func_get_args() + array( null, null, ); |
|
53 | + $_aParams = func_get_args() + array( null, null,); |
|
54 | 54 | $sNameAttribute = $_aParams[ 0 ]; |
55 | 55 | $aFieldset = $_aParams[ 1 ]; |
56 | 56 | $_aDimensionalKeys = array( |
57 | 57 | $this->oProp->sOptionKey // Use `$this->oProp->sOptionKey` instead of `$aFieldset[ 'option_key' ]` which is not set for nested items. |
58 | 58 | ); |
59 | 59 | if ( $this->isSectionSet( $aFieldset ) ) { |
60 | - $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
61 | - foreach( $_aSectionPath as $_sDimension ) { |
|
62 | - $_aDimensionalKeys[] = '[' . $_sDimension . ']'; |
|
60 | + $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
61 | + foreach ( $_aSectionPath as $_sDimension ) { |
|
62 | + $_aDimensionalKeys[ ] = '['.$_sDimension.']'; |
|
63 | 63 | } |
64 | 64 | if ( isset( $aFieldset[ '_section_index' ] ) ) { |
65 | - $_aDimensionalKeys[] = '[' . $aFieldset[ '_section_index' ] . ']'; |
|
65 | + $_aDimensionalKeys[ ] = '['.$aFieldset[ '_section_index' ].']'; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | 69 | // 3.8.0+ Support for nested fields. |
70 | - foreach( $aFieldset[ '_field_path_array' ] as $_sPathPart ) { |
|
71 | - $_aDimensionalKeys[] = '[' . $_sPathPart . ']'; |
|
70 | + foreach ( $aFieldset[ '_field_path_array' ] as $_sPathPart ) { |
|
71 | + $_aDimensionalKeys[ ] = '['.$_sPathPart.']'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return implode( '', $_aDimensionalKeys ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function _replyToGetFlatFieldName( /* $sAttribute, $aFieldset */ ) { |
83 | 83 | |
84 | - $_aParams = func_get_args() + array( null, null, ); |
|
84 | + $_aParams = func_get_args() + array( null, null,); |
|
85 | 85 | $sNameAttribute = $_aParams[ 0 ]; |
86 | 86 | $aFieldset = $_aParams[ 1 ]; |
87 | 87 | |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | $this->oProp->sOptionKey // Use `$this->oProp->sOptionKey` instead of `$aFieldset[ 'option_key' ]` which is not set for nested items. |
90 | 90 | ); |
91 | 91 | if ( $this->isSectionSet( $aFieldset ) ) { |
92 | - foreach( $aFieldset[ '_section_path_array' ] as $_sDimension ) { |
|
93 | - $_aDimensionalKeys[] = $_sDimension; // $aFieldset[ 'section_id' ]; |
|
92 | + foreach ( $aFieldset[ '_section_path_array' ] as $_sDimension ) { |
|
93 | + $_aDimensionalKeys[ ] = $_sDimension; // $aFieldset[ 'section_id' ]; |
|
94 | 94 | } |
95 | 95 | if ( isset( $aFieldset[ '_section_index' ] ) ) { |
96 | - $_aDimensionalKeys[] = $aFieldset[ '_section_index' ]; |
|
96 | + $_aDimensionalKeys[ ] = $aFieldset[ '_section_index' ]; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | "[{$sKey}]" |
123 | 123 | ); |
124 | 124 | |
125 | - $_sNamePrefix = $this->_replyToGetFieldNameAttribute( '', $aField ); |
|
126 | - return $_sNamePrefix . $sKey; |
|
125 | + $_sNamePrefix = $this->_replyToGetFieldNameAttribute( '', $aField ); |
|
126 | + return $_sNamePrefix.$sKey; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | /** |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | $_sKey = $this->oUtil->getAOrB( |
142 | 142 | '0' !== $_sKey && empty( $_sKey ), |
143 | 143 | '', |
144 | - "|" . $_sKey |
|
144 | + "|".$_sKey |
|
145 | 145 | ); |
146 | 146 | |
147 | - return $this->_replyToGetFlatFieldName( '', $aField ) . $_sKey; |
|
147 | + return $this->_replyToGetFlatFieldName( '', $aField ).$_sKey; |
|
148 | 148 | |
149 | 149 | } |
150 | 150 |
@@ -399,6 +399,8 @@ |
||
399 | 399 | * Sets up necessary property values. |
400 | 400 | * |
401 | 401 | * @remark This class gets instantiated in every factory class so the constructor should be lightest as possible. |
402 | + * @param string $sCapability |
|
403 | + * @param string $sTextDomain |
|
402 | 404 | */ |
403 | 405 | public function __construct( $oCaller, $sCallerPath, $sClassName, $sCapability, $sTextDomain, $sStructureType ) { |
404 | 406 |
@@ -330,14 +330,14 @@ discard block |
||
330 | 330 | * @since 3.7.0 |
331 | 331 | */ |
332 | 332 | public $aFormCallbacks = array( |
333 | - 'hfID' => null, // the input id attribute |
|
334 | - 'hfTagID' => null, // the field container id attribute |
|
335 | - 'hfName' => null, // the field name attribute |
|
336 | - 'hfNameFlat' => null, // the flat field name attribute |
|
333 | + 'hfID' => null, // the input id attribute |
|
334 | + 'hfTagID' => null, // the field container id attribute |
|
335 | + 'hfName' => null, // the field name attribute |
|
336 | + 'hfNameFlat' => null, // the flat field name attribute |
|
337 | 337 | // @todo Document the differences between `hfName` and `hfInputName` |
338 | - 'hfInputName' => null, // 3.6.0+ the field input name attribute |
|
339 | - 'hfInputNameFlat' => null, // 3.6.0+ the flat field input name |
|
340 | - 'hfClass' => null, // the class attribute |
|
338 | + 'hfInputName' => null, // 3.6.0+ the field input name attribute |
|
339 | + 'hfInputNameFlat' => null, // 3.6.0+ the flat field input name |
|
340 | + 'hfClass' => null, // the class attribute |
|
341 | 341 | ); |
342 | 342 | |
343 | 343 | /** |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | private function ___getURLQuery() { |
466 | 466 | |
467 | - if ( ! $this->bIsAdminAjax ) { |
|
467 | + if ( !$this->bIsAdminAjax ) { |
|
468 | 468 | return $_GET; |
469 | 469 | } |
470 | 470 | parse_str( |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @since 3.7.9 |
481 | 481 | */ |
482 | 482 | private function ___setGlobals() { |
483 | - if ( ! isset( $GLOBALS[ 'aAdminPageFramework' ] ) ) { |
|
483 | + if ( !isset( $GLOBALS[ 'aAdminPageFramework' ] ) ) { |
|
484 | 484 | $GLOBALS[ 'aAdminPageFramework' ] = array( |
485 | 485 | 'aFieldFlags' => array() |
486 | 486 | ); |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | 'hfTagID' => array( $this->oCaller, '_replyToGetInputTagIDAttribute' ), // the fields & fieldset & field row container id attribute |
552 | 552 | 'hfName' => array( $this->oCaller, '_replyToGetFieldNameAttribute' ), // the input name attribute |
553 | 553 | 'hfNameFlat' => array( $this->oCaller, '_replyToGetFlatFieldName' ), // the flat input name attribute |
554 | - 'hfInputName' => array( $this->oCaller, '_replyToGetInputNameAttribute' ), // 3.6.0+ the field input name attribute |
|
555 | - 'hfInputNameFlat' => array( $this->oCaller, '_replyToGetFlatInputName' ), // 3.6.0+ the flat field input name |
|
554 | + 'hfInputName' => array( $this->oCaller, '_replyToGetInputNameAttribute' ), // 3.6.0+ the field input name attribute |
|
555 | + 'hfInputNameFlat' => array( $this->oCaller, '_replyToGetFlatInputName' ), // 3.6.0+ the flat field input name |
|
556 | 556 | 'hfClass' => array( $this->oCaller, '_replyToGetInputClassAttribute' ), // the class attribute |
557 | 557 | 'hfSectionName' => array( $this->oCaller, '_replyToGetSectionName' ), // 3.6.0+ |
558 | 558 | ) + $this->aFormCallbacks; |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | * @remark The information can be used to embed into the footer etc. |
627 | 627 | * @return array The information of the script. |
628 | 628 | */ |
629 | - protected function getCallerInfo( $sCallerPath='' ) { |
|
629 | + protected function getCallerInfo( $sCallerPath = '' ) { |
|
630 | 630 | |
631 | 631 | if ( isset( self::$_aScriptDataCaches[ $sCallerPath ] ) ) { |
632 | 632 | return self::$_aScriptDataCaches[ $sCallerPath ]; |
@@ -744,11 +744,11 @@ discard block |
||
744 | 744 | |
745 | 745 | // 3.7.9 Moved from the constructor to make it lighter. |
746 | 746 | if ( 'sClassHash' === $sName ) { |
747 | - $this->sClassHash = md5( $this->sClassName ); |
|
747 | + $this->sClassHash = md5( $this->sClassName ); |
|
748 | 748 | return $this->sClassHash; |
749 | 749 | } |
750 | 750 | if ( 'sScriptType' === $sName ) { |
751 | - $this->sScriptType = $this->_getCallerType( $this->sCallerPath ); // 3.7.6+ |
|
751 | + $this->sScriptType = $this->_getCallerType( $this->sCallerPath ); // 3.7.6+ |
|
752 | 752 | return $this->sScriptType; |
753 | 753 | } |
754 | 754 | if ( 'oUtil' === $sName ) { |
@@ -110,7 +110,6 @@ |
||
110 | 110 | * Retrieves the settings error array set by the user in the validation callback. |
111 | 111 | * |
112 | 112 | * @since 3.7.8 |
113 | - * @param boolean $bDelete whether or not the transient should be deleted after retrieving it. |
|
114 | 113 | * @return array |
115 | 114 | */ |
116 | 115 | public function get() { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $_sPageSlug = $this->getElement( $_GET, 'page', '' ); |
57 | 57 | $_sTabSlug = $this->getElement( $_GET, 'tab', '' ); |
58 | 58 | $_sUserID = get_current_user_id(); |
59 | - return "apf_li_" . md5( |
|
59 | + return "apf_li_".md5( |
|
60 | 60 | $_sPageNow |
61 | 61 | . $_sPageSlug |
62 | 62 | . $_sTabSlug |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | * @return void |
95 | 95 | */ |
96 | 96 | public function _replyToSave() { |
97 | - if ( ! isset( self::$_aLastInputs ) ) { |
|
97 | + if ( !isset( self::$_aLastInputs ) ) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | $this->setTransient( |
101 | 101 | $this->sTransientKey, |
102 | 102 | self::$_aLastInputs, |
103 | - 60*60 // store it for 1 hour |
|
103 | + 60 * 60 // store it for 1 hour |
|
104 | 104 | ); |
105 | 105 | } |
106 | 106 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $_aLastInputs = self::$_aCaches[ $this->sTransientKey ]; |
121 | 121 | } else { |
122 | 122 | $_aLastInputs = $this->getTransient( $this->sTransientKey ); |
123 | - self::$_aCaches[ $this->sTransientKey ] = $_aLastInputs; |
|
123 | + self::$_aCaches[ $this->sTransientKey ] = $_aLastInputs; |
|
124 | 124 | if ( false !== $_aLastInputs ) { |
125 | - $this->delete(); // deletes at the end of the script. |
|
125 | + $this->delete(); // deletes at the end of the script. |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 |
@@ -99,6 +99,7 @@ discard block |
||
99 | 99 | * @since 3.1.1 Added a parameter. Changed to return the formatted sections array. |
100 | 100 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatFields()`. |
101 | 101 | * Added the `$aSectionsets` parameter. |
102 | + * @param string $sCapability |
|
102 | 103 | * @return array |
103 | 104 | */ |
104 | 105 | private function _getFieldsetsFormatted( array $aFieldsets, array $aSectionsets, $sCapability ) { |
@@ -278,6 +279,7 @@ discard block |
||
278 | 279 | * |
279 | 280 | * @since 3.0.0 |
280 | 281 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatField()`. |
282 | + * @param integer $iCountOfElements |
|
281 | 283 | * @return array|void An array of formatted field definition array. If required keys are not set, nothing will be returned. |
282 | 284 | */ |
283 | 285 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | ); |
114 | 114 | |
115 | 115 | $_aNewFieldsets = array(); |
116 | - foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
116 | + foreach ( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
117 | 117 | |
118 | 118 | // If the section is not set, skip. |
119 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
119 | + if ( !isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $_aItems, |
126 | 126 | $this->getElement( // 3.6.0+ Get the section's capability |
127 | 127 | $aSectionsets, |
128 | - array( $_sSectionPath, 'capability', ), |
|
128 | + array( $_sSectionPath, 'capability',), |
|
129 | 129 | $sCapability |
130 | 130 | ), |
131 | 131 | $aSectionsets |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function _getNormalFieldsetsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
184 | 184 | |
185 | - $_aNewItems = array(); |
|
186 | - foreach( $aItems as $_sFieldID => $_aFieldset ) { |
|
185 | + $_aNewItems = array(); |
|
186 | + foreach ( $aItems as $_sFieldID => $_aFieldset ) { |
|
187 | 187 | |
188 | 188 | // Insert the formatted field definition array. The fields count is needed to set each order value. |
189 | - $_aFieldset = $this->_getFieldsetFormatted( |
|
189 | + $_aFieldset = $this->_getFieldsetFormatted( |
|
190 | 190 | $_aFieldset, |
191 | 191 | $aSectionsets, |
192 | 192 | $sCapability, |
193 | 193 | count( $_aNewItems ), // index of elements - zero based |
194 | - null, // sub-section index |
|
194 | + null, // sub-section index |
|
195 | 195 | $_abSectionRepeatable, |
196 | 196 | $this->oCallerForm |
197 | 197 | ); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean |
211 | 211 | */ |
212 | 212 | private function _isSubSections( $aItems, $_abSectionRepeatable ) { |
213 | - if ( ! empty( $_abSectionRepeatable ) ) { |
|
213 | + if ( !empty( $_abSectionRepeatable ) ) { |
|
214 | 214 | return true; |
215 | 215 | } |
216 | 216 | return ( boolean ) count( $this->getIntegerKeyElements( $aItems ) ); |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | private function _getSubSectionsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
222 | 222 | |
223 | 223 | $_aNewFieldset = array(); |
224 | - foreach( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
224 | + foreach ( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
225 | 225 | |
226 | - foreach( $_aFieldsets as $_aFieldset ) { |
|
226 | + foreach ( $_aFieldsets as $_aFieldset ) { |
|
227 | 227 | $_iCountElement = count( $this->getElementAsArray( $_aNewFieldset, $_iSubSectionIndex ) ); |
228 | 228 | $_aFieldset = $this->_getFieldsetFormatted( |
229 | 229 | $_aFieldset, |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | if ( empty( $_aFieldset ) ) { |
238 | 238 | continue; |
239 | 239 | } |
240 | - $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset['field_id'] ] = $_aFieldset; |
|
240 | + $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
|
241 | 241 | } |
242 | 242 | uasort( $_aNewFieldset[ $_iSubSectionIndex ], array( $this, 'sortArrayByKey' ) ); |
243 | 243 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | |
266 | 266 | $_aSortedFields = array(); |
267 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
267 | + foreach ( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
268 | 268 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
269 | 269 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
270 | 270 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
284 | 284 | |
285 | 285 | // 3.8.0+ Dropped the check for $aFieldset[ 'type' ] to allow it to be omitted. |
286 | - if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
286 | + if ( !isset( $aFieldset[ 'field_id' ] ) ) { |
|
287 | 287 | return; |
288 | 288 | } |
289 | 289 |