@@ -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( |
@@ -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 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @since 3.2.0 |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
29 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
30 | 30 | |
31 | 31 | $aArguments = $aArguments |
32 | 32 | + array( |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | 'description' => '', |
35 | 35 | ); |
36 | 36 | |
37 | - parent::__construct( |
|
37 | + parent::__construct( |
|
38 | 38 | $oCaller->oProp->sClassName, // base id |
39 | 39 | $sWidgetTitle, // widget title |
40 | 40 | $aArguments // widget arguments |
41 | 41 | ); |
42 | 42 | $this->oCaller = $oCaller; |
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Displays the widget contents in the front end. |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * whether the title should be visible or not depending on the content. |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function widget( $aArguments, $aFormData ) { |
|
54 | + public function widget( $aArguments, $aFormData ) { |
|
55 | 55 | |
56 | 56 | echo $aArguments[ 'before_widget' ]; |
57 | 57 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | |
75 | 75 | echo $_sContent; |
76 | 76 | |
77 | - echo $aArguments[ 'after_widget' ]; |
|
77 | + echo $aArguments[ 'after_widget' ]; |
|
78 | 78 | |
79 | - } |
|
79 | + } |
|
80 | 80 | /** |
81 | 81 | * Returns the widget title. |
82 | 82 | * |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if ( ! $_sTitle ) { |
106 | 106 | return ''; |
107 | 107 | } |
108 | - return $aArguments['before_title'] |
|
108 | + return $aArguments['before_title'] |
|
109 | 109 | . $_sTitle |
110 | 110 | . $aArguments['after_title']; |
111 | 111 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @since 3.2.0 |
118 | 118 | * @return mixed The validated form data. The type should be an array but it is dealt by the framework user it will be unknown. |
119 | 119 | */ |
120 | - public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
120 | + public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
121 | 121 | |
122 | 122 | $aSubmittedFormData = $this->oCaller->oUtil->addAndApplyFilters( |
123 | 123 | $this->oCaller, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | ); |
132 | 132 | return $this->oCaller->oForm->getInputsUnset( $aSubmittedFormData, $this->oCaller->oForm->sStructureType ); // 3.8.17+ |
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Constructs the widget form with the given saved form data. |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return void |
144 | 144 | */ |
145 | - public function form( $aSavedFormData ) { |
|
145 | + public function form( $aSavedFormData ) { |
|
146 | 146 | |
147 | 147 | $this->oCaller->oForm->aCallbacks = $this->_getFormCallbacks() + $this->oCaller->oForm->aCallbacks; |
148 | 148 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->oCaller->oForm->aSectionsets = $_aSectionsets; |
182 | 182 | $this->oCaller->oForm->aFieldsets = $_aFieldsets; |
183 | 183 | |
184 | - } |
|
184 | + } |
|
185 | 185 | /** |
186 | 186 | * Calls the load() method of the caller factory object. |
187 | 187 | * |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @since 3.2.0 |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
29 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments = array() ) { |
|
30 | 30 | |
31 | 31 | $aArguments = $aArguments |
32 | 32 | + array( |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | ); |
36 | 36 | |
37 | 37 | parent::__construct( |
38 | - $oCaller->oProp->sClassName, // base id |
|
39 | - $sWidgetTitle, // widget title |
|
38 | + $oCaller->oProp->sClassName, // base id |
|
39 | + $sWidgetTitle, // widget title |
|
40 | 40 | $aArguments // widget arguments |
41 | 41 | ); |
42 | 42 | $this->oCaller = $oCaller; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $this->oCaller->oUtil->addAndDoActions( |
59 | 59 | $this->oCaller, |
60 | - 'do_' . $this->oCaller->oProp->sClassName, |
|
60 | + 'do_'.$this->oCaller->oProp->sClassName, |
|
61 | 61 | $this->oCaller |
62 | 62 | ); |
63 | 63 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function _getTitle( array $aArguments, array $aFormData ) { |
90 | 90 | |
91 | - if ( ! $this->oCaller->oProp->bShowWidgetTitle ) { |
|
91 | + if ( !$this->oCaller->oProp->bShowWidgetTitle ) { |
|
92 | 92 | return ''; |
93 | 93 | } |
94 | 94 | |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $aFormData, |
103 | 103 | $this->id_base |
104 | 104 | ); |
105 | - if ( ! $_sTitle ) { |
|
105 | + if ( !$_sTitle ) { |
|
106 | 106 | return ''; |
107 | 107 | } |
108 | - return $aArguments['before_title'] |
|
108 | + return $aArguments[ 'before_title' ] |
|
109 | 109 | . $_sTitle |
110 | - . $aArguments['after_title']; |
|
110 | + . $aArguments[ 'after_title' ]; |
|
111 | 111 | |
112 | 112 | } |
113 | 113 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $this->oCaller, |
124 | 124 | "validation_{$this->oCaller->oProp->sClassName}", |
125 | 125 | call_user_func_array( |
126 | - array( $this->oCaller, 'validate' ), // triggers __call() |
|
126 | + array( $this->oCaller, 'validate' ), // triggers __call() |
|
127 | 127 | array( $aSubmittedFormData, $aSavedFormData, $this->oCaller ) // parameters |
128 | 128 | ), // 3.5.3+ |
129 | 129 | $aSavedFormData, |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $this->oCaller->oForm = new AdminPageFramework_Form_widget( |
173 | 173 | array( |
174 | 174 | 'register_if_action_already_done' => false, // do not register fields right away |
175 | - ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
176 | - $this->oCaller->oForm->aCallbacks, // callbacks |
|
175 | + ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
176 | + $this->oCaller->oForm->aCallbacks, // callbacks |
|
177 | 177 | $this->oCaller->oMsg |
178 | 178 | ); |
179 | 179 | // Reuse the data of the previous widget instance. |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * Call the load method only once per class. Also the added field registrations in the class also done once. |
200 | 200 | * @since 3.7.9 |
201 | 201 | */ |
202 | - if ( $this->oCaller->oUtil->hasBeenCalled( '_widget_load_' . $this->oCaller->oProp->sClassName ) ) { |
|
202 | + if ( $this->oCaller->oUtil->hasBeenCalled( '_widget_load_'.$this->oCaller->oProp->sClassName ) ) { |
|
203 | 203 | |
204 | 204 | /** |
205 | 205 | * The saved option callback is done with the below load_... callback so for widget form instances called from the second time |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->oCaller->oUtil->addAndDoActions( |
218 | 218 | $this->oCaller, |
219 | 219 | array( |
220 | - 'load_' . $this->oCaller->oProp->sClassName, |
|
220 | + 'load_'.$this->oCaller->oProp->sClassName, |
|
221 | 221 | ), |
222 | 222 | $this->oCaller |
223 | 223 | ); |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private function _getFormCallbacks() { |
233 | 233 | return array( |
234 | - 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
235 | - 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
236 | - 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
234 | + 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
235 | + 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
236 | + 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
237 | 237 | 'hfInputName' => array( $this, '_replyToGetFieldInputName' ), |
238 | 238 | |
239 | 239 | 'saved_data' => array( $this, '_replyToGetSavedFormData' ), |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | public function _replyToGetSavedFormData() { |
250 | 250 | return $this->oCaller->oUtil->addAndApplyFilter( |
251 | 251 | $this->oCaller, // the caller factory object |
252 | - 'options_' . $this->oCaller->oProp->sClassName, |
|
253 | - $this->oCaller->oProp->aOptions, // subject value to be filtered |
|
252 | + 'options_'.$this->oCaller->oProp->sClassName, |
|
253 | + $this->oCaller->oProp->aOptions, // subject value to be filtered |
|
254 | 254 | $this->id // 3.7.9+ |
255 | 255 | ); |
256 | 256 | } |
@@ -280,25 +280,25 @@ discard block |
||
280 | 280 | */ |
281 | 281 | private function _getNameAttributeDimensions( $aFieldset ) { |
282 | 282 | |
283 | - $_sNamePrefix = 'widget-' . $this->id_base . '[' . $this->number . ']'; |
|
283 | + $_sNamePrefix = 'widget-'.$this->id_base.'['.$this->number.']'; |
|
284 | 284 | |
285 | 285 | $_sDimensions = ''; |
286 | 286 | if ( $this->oCaller->isSectionSet( $aFieldset ) ) { |
287 | - $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
288 | - foreach( $_aSectionPath as $_sDimension ) { |
|
289 | - $_sDimensions .= '[' . $_sDimension . ']'; |
|
287 | + $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
288 | + foreach ( $_aSectionPath as $_sDimension ) { |
|
289 | + $_sDimensions .= '['.$_sDimension.']'; |
|
290 | 290 | } |
291 | 291 | if ( isset( $aFieldset[ '_section_index' ] ) ) { |
292 | - $_sDimensions .= '[' . $aFieldset[ '_section_index' ] . ']'; |
|
292 | + $_sDimensions .= '['.$aFieldset[ '_section_index' ].']'; |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
296 | 296 | // 3.8.18+ Support for nested fields. @see https://github.com/michaeluno/admin-page-framework/issues/274 |
297 | - foreach( $aFieldset[ '_field_path_array' ] as $_sPathPart ) { |
|
298 | - $_sDimensions .= '[' . $_sPathPart . ']'; |
|
297 | + foreach ( $aFieldset[ '_field_path_array' ] as $_sPathPart ) { |
|
298 | + $_sDimensions .= '['.$_sPathPart.']'; |
|
299 | 299 | } |
300 | 300 | |
301 | - return $_sNamePrefix . $_sDimensions; |
|
301 | + return $_sNamePrefix.$_sDimensions; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | $_sIndex = $this->oCaller->oUtil->getAOrB( |
316 | 316 | '0' !== $sIndex && empty( $sIndex ), |
317 | 317 | '', |
318 | - "[" . $sIndex . "]" |
|
318 | + "[".$sIndex."]" |
|
319 | 319 | ); |
320 | - $_sNamePrefix = $this->_replyToGetFieldName( '', $aFieldset ); |
|
321 | - return $_sNamePrefix . $_sIndex; |
|
320 | + $_sNamePrefix = $this->_replyToGetFieldName( '', $aFieldset ); |
|
321 | + return $_sNamePrefix.$_sIndex; |
|
322 | 322 | |
323 | 323 | } |
324 | 324 |
@@ -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 |
@@ -43,16 +43,16 @@ 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 ] ) ) { // sanitization unnecessary |
|
48 | + $_sUnsetKey = '__unset_'.$sFieldsType; |
|
49 | + if ( !isset( $_POST[ $_sUnsetKey ] ) ) { // sanitization unnecessary |
|
50 | 50 | return $aInputs; |
51 | 51 | } |
52 | 52 | |
53 | - $_aUnsetElements = self::getHTTPRequestSanitized( self::getElementAsArray( $_POST, array( $_sUnsetKey ) ) ); // sanitization done |
|
53 | + $_aUnsetElements = self::getHTTPRequestSanitized( self::getElementAsArray( $_POST, array( $_sUnsetKey ) ) ); // sanitization done |
|
54 | 54 | $_aUnsetElements = array_unique( $_aUnsetElements ); |
55 | - foreach( $_aUnsetElements as $_sFlatInputName ) { |
|
55 | + foreach ( $_aUnsetElements as $_sFlatInputName ) { |
|
56 | 56 | |
57 | 57 | $_aDimensionalKeys = explode( '|', $_sFlatInputName ); |
58 | 58 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // The first element is the option key for the `admin_page` field type and section or field dimensional keys follow. |
65 | - for ( $_i = 0; $_i < $iSkipDepth; $_i++) { |
|
65 | + for ( $_i = 0; $_i < $iSkipDepth; $_i++ ) { |
|
66 | 66 | unset( $_aDimensionalKeys[ $_i ] ); |
67 | 67 | } |
68 | 68 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | static public function hasNestedFields( $aFieldset ) { |
121 | 121 | |
122 | - if ( ! self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
122 | + if ( !self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | // At this point, the `content` argument contains either the definition of nested fields or inline-mixed fields. |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | static public function hasFieldDefinitionsInContent( $aFieldset ) { |
143 | 143 | |
144 | - if ( ! isset( $aFieldset[ 'content' ] ) ) { |
|
144 | + if ( !isset( $aFieldset[ 'content' ] ) ) { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | if ( empty( $aFieldset[ 'content' ] ) ) { |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | * @since 3.8.13 |
177 | 177 | */ |
178 | 178 | static public function isDynamicField( $aField ) { |
179 | - if ( ! empty( $aField[ 'repeatable' ] ) ) { |
|
179 | + if ( !empty( $aField[ 'repeatable' ] ) ) { |
|
180 | 180 | return true; |
181 | 181 | } |
182 | - if ( ! empty( $aField[ 'sortable' ] ) ) { |
|
182 | + if ( !empty( $aField[ 'sortable' ] ) ) { |
|
183 | 183 | return true; |
184 | 184 | } |
185 | 185 | return false; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ( empty( $sString ) ) { |
209 | 209 | return $sString; |
210 | 210 | } |
211 | - return $sString . '|'; |
|
211 | + return $sString.'|'; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | */ |
225 | 225 | static public function getFieldsetReformattedBySubFieldIndex( $aFieldset, $iSubFieldIndex, $bHasSubFields, $aParentFieldset ) { |
226 | 226 | |
227 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
227 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
228 | 228 | |
229 | 229 | // Add sub-field index to the parent field path for repeated nested items. |
230 | - $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
230 | + $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
231 | 231 | $bHasSubFields, |
232 | - $aFieldset[ '_parent_field_path' ] . '|' . $iSubFieldIndex, |
|
232 | + $aFieldset[ '_parent_field_path' ].'|'.$iSubFieldIndex, |
|
233 | 233 | $aFieldset[ '_parent_field_path' ] |
234 | 234 | ); |
235 | - $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
235 | + $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
236 | 236 | $bHasSubFields, |
237 | - $aParentFieldset[ 'tag_id' ] . '__' . $iSubFieldIndex, |
|
237 | + $aParentFieldset[ 'tag_id' ].'__'.$iSubFieldIndex, |
|
238 | 238 | $aParentFieldset[ 'tag_id' ] |
239 | 239 | ); |
240 | 240 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $aFieldset, |
244 | 244 | $aFieldset[ '_structure_type' ], |
245 | 245 | $aFieldset[ 'capability' ], |
246 | - ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
246 | + ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
247 | 247 | $aFieldset[ '_subsection_index' ], |
248 | 248 | $aFieldset[ '_is_section_repeatable' ], |
249 | 249 | $aFieldset[ '_caller_object' ] |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | $_oFieldsetOutputFormatter = new AdminPageFramework_Form_Model___Format_FieldsetOutput( |
254 | 254 | $aFieldset, |
255 | - $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
255 | + $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
256 | 256 | $_oCallerForm->aFieldTypeDefinitions |
257 | 257 | ); |
258 | 258 | return $_oFieldsetOutputFormatter->get(); |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | if ( empty( $aArguments ) ) { |
290 | 290 | return ''; |
291 | 291 | } |
292 | - if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_' . $sBoxElementID ) ) { |
|
292 | + if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_'.$sBoxElementID ) ) { |
|
293 | 293 | return ''; |
294 | 294 | } |
295 | 295 | add_thickbox(); // to display a message to the user. |
296 | 296 | return "<div id='{$sBoxElementID}' style='display:none'>" |
297 | - . "<p>" . $aArguments[ 'message' ] . "</p>" |
|
297 | + . "<p>".$aArguments[ 'message' ]."</p>" |
|
298 | 298 | . "</div>"; |
299 | 299 | |
300 | 300 | } |
@@ -46,7 +46,8 @@ |
||
46 | 46 | static public function getInputsUnset( array $aInputs, $sFieldsType, $iSkipDepth=0 ) { |
47 | 47 | |
48 | 48 | $_sUnsetKey = '__unset_' . $sFieldsType; |
49 | - if ( ! isset( $_POST[ $_sUnsetKey ] ) ) { // sanitization unnecessary |
|
49 | + if ( ! isset( $_POST[ $_sUnsetKey ] ) ) { |
|
50 | +// sanitization unnecessary |
|
50 | 51 | return $aInputs; |
51 | 52 | } |
52 | 53 |
@@ -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 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | * @return string the flat input name attribute |
37 | 37 | */ |
38 | 38 | public function _replyToGetFlatInputName( /* $sFlatNameAttribute, $aField, $sKey, $sSectionIndex */ ) { |
39 | - $_aParams = func_get_args() + array( null, null, null ); |
|
39 | + $_aParams = func_get_args() + array( null, null, null ); |
|
40 | 40 | return $_aParams[ 0 ]; |
41 | 41 | } |
42 | 42 |
@@ -20,6 +20,6 @@ |
||
20 | 20 | /** |
21 | 21 | * The callback function name or the callable object to retrieve meta data. |
22 | 22 | */ |
23 | - protected $osCallable = 'get_term_meta'; |
|
23 | + protected $osCallable = 'get_term_meta'; |
|
24 | 24 | |
25 | 25 | } |