@@ -60,6 +60,7 @@ discard block |
||
60 | 60 | * @since 3.3.1 Moved from `AdminPageFramework_Page`. |
61 | 61 | * @since 3.5.3 Deprecated the `$aOutput` parameter. |
62 | 62 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. Changed the name from `_getPageHeadingTabs()`. |
63 | + * @param string $sTag |
|
63 | 64 | * @return string the output of page heading tabs. |
64 | 65 | */ |
65 | 66 | private function _getOutput( $aPage, $sTag ) { |
@@ -100,6 +101,7 @@ discard block |
||
100 | 101 | * @internal |
101 | 102 | * @since 3.5.3 |
102 | 103 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
104 | + * @param string $sTag |
|
103 | 105 | * @return string the HTML page heading tab navigation bar output. |
104 | 106 | */ |
105 | 107 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
46 | 46 | |
47 | 47 | // If the page title is disabled, return an empty string. |
48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
48 | + if ( !$_aPage[ 'show_page_title' ] ) { |
|
49 | 49 | return ""; |
50 | 50 | } |
51 | 51 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private function _getOutput( $aPage, $sTag ) { |
66 | 66 | |
67 | - $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
67 | + $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
68 | 68 | |
69 | 69 | // If the page heading tab visibility is disabled, or only one page is registered, return the title. |
70 | - if ( ! $aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
70 | + if ( !$aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
71 | 71 | return "<{$sTag}>" |
72 | 72 | . $aPage[ 'title' ] |
73 | 73 | . "</{$sTag}>"; |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
106 | 106 | |
107 | 107 | $_oTabBar = new AdminPageFramework_TabNavigationBar( |
108 | - $aPages, // tab items |
|
108 | + $aPages, // tab items |
|
109 | 109 | $sCurrentPageSlug, // active tab slug |
110 | - $sTag, // container tag |
|
110 | + $sTag, // container tag |
|
111 | 111 | array( // container attributes |
112 | 112 | // 'class' => '...', |
113 | 113 | ), |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * @since 3.5.10 |
131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
132 | 132 | */ |
133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
134 | - switch( $aSubPage['type'] ) { |
|
133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments = array() ) { |
|
134 | + switch ( $aSubPage[ 'type' ] ) { |
|
135 | 135 | case 'link': |
136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |
137 | 137 | default: |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | */ |
149 | 149 | private function _getFormattedPageHeadingtabNavigationBarPageItem( array $aSubPage, $aStructure ) { |
150 | 150 | |
151 | - if ( ! isset( $aSubPage[ 'page_slug' ] ) ) { |
|
151 | + if ( !isset( $aSubPage[ 'page_slug' ] ) ) { |
|
152 | 152 | return array(); |
153 | 153 | } |
154 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
154 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
155 | 155 | return array(); |
156 | 156 | } |
157 | 157 | return array( |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function _getFormattedPageHeadingtabNavigationBarLinkItem( array $aSubPage, $aStructure ) { |
184 | 184 | |
185 | - if ( ! isset( $aSubPage[ 'href' ] ) ) { |
|
185 | + if ( !isset( $aSubPage[ 'href' ] ) ) { |
|
186 | 186 | return array(); |
187 | 187 | } |
188 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
188 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
189 | 189 | return array(); |
190 | 190 | } |
191 | 191 | $aSubPage = array( |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | + array( 'class' => null ) |
198 | 198 | + $aStructure; |
199 | 199 | |
200 | - $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ] . ' link' ); |
|
200 | + $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ].' link' ); |
|
201 | 201 | return $aSubPage; |
202 | 202 | } |
203 | 203 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
46 | 46 | |
47 | 47 | // If the page title is disabled, return an empty string. |
48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
48 | + if ( ! $_aPage[ 'show_page_title' ] ) { |
|
49 | 49 | return ""; |
50 | 50 | } |
51 | 51 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @since 3.5.10 |
131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
132 | 132 | */ |
133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
134 | 134 | switch( $aSubPage['type'] ) { |
135 | 135 | case 'link': |
136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | /** |
50 | 50 | * @since 3.6.3 |
51 | - * @return boolean |
|
51 | + * @return boolean|null |
|
52 | 52 | */ |
53 | 53 | private function _isScreenIconVisible() { |
54 | 54 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function get() { |
42 | 42 | |
43 | - if ( ! $this->_isScreenIconVisible() ) { |
|
43 | + if ( !$this->_isScreenIconVisible() ) { |
|
44 | 44 | return ''; |
45 | 45 | } |
46 | 46 | return $this->_getScreenIcon( $this->sPageSlug ); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | private function _isScreenIconVisible() { |
54 | 54 | |
55 | - $_bShowPageTitle = $this->getElement( |
|
55 | + $_bShowPageTitle = $this->getElement( |
|
56 | 56 | $this->oFactory->oProp->aPages, |
57 | 57 | array( $this->sPageSlug, 'show_page_title' ) |
58 | 58 | ); |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | array( $sPageSlug, 'href_icon_32x32' ), |
131 | 131 | '' |
132 | 132 | ); |
133 | - if ( ! $_sScreenIconPath ) { |
|
133 | + if ( !$_sScreenIconPath ) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 | |
137 | 137 | $_aAttributes = array( |
138 | 138 | 'style' => $this->generateInlineCSS( |
139 | 139 | array( |
140 | - 'background-image' => "url('" . esc_url( $_sScreenIconPath ) . "')" |
|
140 | + 'background-image' => "url('".esc_url( $_sScreenIconPath )."')" |
|
141 | 141 | ) |
142 | 142 | ) |
143 | 143 | ); |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | array( $sPageSlug, 'screen_icon_id' ), |
162 | 162 | '' |
163 | 163 | ); |
164 | - if ( ! $_sScreenIconID ) { |
|
164 | + if ( !$_sScreenIconID ) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | 168 | $_aAttributes = array( |
169 | - 'id' => "icon-" . $_sScreenIconID, |
|
169 | + 'id' => "icon-".$_sScreenIconID, |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | // Go to the catch clause. |
@@ -189,16 +189,16 @@ discard block |
||
189 | 189 | 'class' => $this->getClassAttribute( |
190 | 190 | $this->getAOrB( |
191 | 191 | empty( $_sIconIDAttribute ) && $_oScreen->post_type, |
192 | - sanitize_html_class( 'icon32-posts-' . $_oScreen->post_type ), |
|
192 | + sanitize_html_class( 'icon32-posts-'.$_oScreen->post_type ), |
|
193 | 193 | '' |
194 | 194 | ), |
195 | 195 | $this->getAOrB( |
196 | 196 | empty( $_sIconIDAttribute ) || $_sIconIDAttribute == $this->oFactory->oProp->sClassName, |
197 | - 'generic', // the default value |
|
197 | + 'generic', // the default value |
|
198 | 198 | '' |
199 | 199 | ) |
200 | 200 | ), |
201 | - 'id' => "icon-" . $_sIconIDAttribute, |
|
201 | + 'id' => "icon-".$_sIconIDAttribute, |
|
202 | 202 | ); |
203 | 203 | return $this->_getScreenIconByAttributes( $_aAttributes ); |
204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | private function _getScreenIDAttribute( $oScreen ) { |
214 | 214 | |
215 | - if ( ! empty( $oScreen->parent_base ) ) { |
|
215 | + if ( !empty( $oScreen->parent_base ) ) { |
|
216 | 216 | return $oScreen->parent_base; |
217 | 217 | } |
218 | 218 | if ( 'page' === $oScreen->post_type ) { |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | private function _getScreenIconByAttributes( array $aAttributes ) { |
234 | 234 | |
235 | 235 | $aAttributes[ 'class' ] = $this->getClassAttribute( |
236 | - 'icon32', // required for a screen icon container element. |
|
236 | + 'icon32', // required for a screen icon container element. |
|
237 | 237 | $this->getElement( $aAttributes, 'class' ) |
238 | 238 | ); |
239 | - return "<div " . $this->getAttributes( $aAttributes ) . ">" |
|
239 | + return "<div ".$this->getAttributes( $aAttributes ).">" |
|
240 | 240 | . "<br />" |
241 | 241 | . "</div>"; |
242 | 242 |
@@ -181,7 +181,7 @@ |
||
181 | 181 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - private function _getDefaultScreenIcon() { |
|
184 | + private function _getDefaultScreenIcon() { |
|
185 | 185 | |
186 | 186 | $_oScreen = get_current_screen(); |
187 | 187 | $_sIconIDAttribute = $this->_getScreenIDAttribute( $_oScreen ); |
@@ -153,9 +153,6 @@ |
||
153 | 153 | * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
154 | 154 | * @access public |
155 | 155 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
156 | - * @param string $sSectionID1 the section ID to remove. |
|
157 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
158 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
159 | 156 | * @return void |
160 | 157 | */ |
161 | 158 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
@@ -140,24 +140,24 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * Removes the given section(s) by section ID. |
|
144 | - * |
|
145 | - * This accesses the property storing the added section arrays and removes the specified ones. |
|
146 | - * |
|
147 | - * <h4>Example</h4> |
|
148 | - * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
149 | - * </code> |
|
150 | - * |
|
151 | - * @since 2.0.0 |
|
152 | - * @since 3.0.0 Changed the scope to public from protected. |
|
153 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
154 | - * @access public |
|
155 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
156 | - * @param string $sSectionID1 the section ID to remove. |
|
157 | - * @param string $sSectionID2 (optional) another section ID to remove. |
|
158 | - * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
159 | - * @return void |
|
160 | - */ |
|
143 | + * Removes the given section(s) by section ID. |
|
144 | + * |
|
145 | + * This accesses the property storing the added section arrays and removes the specified ones. |
|
146 | + * |
|
147 | + * <h4>Example</h4> |
|
148 | + * <code>$this->removeSettingSections( 'text_fields', 'selectors', 'another_section', 'yet_another_section' ); |
|
149 | + * </code> |
|
150 | + * |
|
151 | + * @since 2.0.0 |
|
152 | + * @since 3.0.0 Changed the scope to public from protected. |
|
153 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
154 | + * @access public |
|
155 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
156 | + * @param string $sSectionID1 the section ID to remove. |
|
157 | + * @param string $sSectionID2 (optional) another section ID to remove. |
|
158 | + * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
|
159 | + * @return void |
|
160 | + */ |
|
161 | 161 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
162 | 162 | |
163 | 163 | foreach( func_get_args() as $_sSectionID ) { |
@@ -224,38 +224,38 @@ discard block |
||
224 | 224 | } |
225 | 225 | } |
226 | 226 | /** |
227 | - * Adds the given field array items into the field array property. |
|
228 | - * |
|
229 | - * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
230 | - * |
|
231 | - * @since 2.1.2 |
|
232 | - * @since 3.0.0 Changed the scope to public from protected. |
|
233 | - * @access public |
|
234 | - * @param array|string $asField the field array or the target section ID. If the target section ID is set, the section_id key can be omitted from the next passing field array. |
|
235 | - * @return void |
|
236 | - */ |
|
227 | + * Adds the given field array items into the field array property. |
|
228 | + * |
|
229 | + * Identical to the `addSettingFields()` method except that this method does not accept enumerated parameters. |
|
230 | + * |
|
231 | + * @since 2.1.2 |
|
232 | + * @since 3.0.0 Changed the scope to public from protected. |
|
233 | + * @access public |
|
234 | + * @param array|string $asField the field array or the target section ID. If the target section ID is set, the section_id key can be omitted from the next passing field array. |
|
235 | + * @return void |
|
236 | + */ |
|
237 | 237 | public function addSettingField( $asField ) { |
238 | 238 | $this->oForm->addField( $asField ); |
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
242 | - * Removes the given field(s) by field ID. |
|
243 | - * |
|
244 | - * This accesses the property storing the added field arrays and removes the specified ones. |
|
245 | - * |
|
246 | - * <h4>Example</h4> |
|
247 | - * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
248 | - * </code> |
|
249 | - * |
|
250 | - * @since 2.0.0 |
|
251 | - * @since 3.0.0 Changed the scope to public from protected. |
|
252 | - * @access public |
|
253 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
254 | - * @param string $sFieldID1 the field ID to remove. |
|
255 | - * @param string $sFieldID2 (optional) another field ID to remove. |
|
256 | - * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
257 | - * @return void |
|
258 | - */ |
|
242 | + * Removes the given field(s) by field ID. |
|
243 | + * |
|
244 | + * This accesses the property storing the added field arrays and removes the specified ones. |
|
245 | + * |
|
246 | + * <h4>Example</h4> |
|
247 | + * <code>$this->removeSettingFields( 'fieldID_A', 'fieldID_B', 'fieldID_C', 'fieldID_D' ); |
|
248 | + * </code> |
|
249 | + * |
|
250 | + * @since 2.0.0 |
|
251 | + * @since 3.0.0 Changed the scope to public from protected. |
|
252 | + * @access public |
|
253 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
254 | + * @param string $sFieldID1 the field ID to remove. |
|
255 | + * @param string $sFieldID2 (optional) another field ID to remove. |
|
256 | + * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
|
257 | + * @return void |
|
258 | + */ |
|
259 | 259 | public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
260 | 260 | foreach( func_get_args() as $_sFieldID ) { |
261 | 261 | $this->oForm->removeField( $_sFieldID ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
74 | 74 | |
75 | - foreach( func_get_args() as $asSection ) { |
|
75 | + foreach( func_get_args() as $asSection ) { |
|
76 | 76 | $this->addSettingSection( $asSection ); |
77 | 77 | } |
78 | 78 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param string $_and_more (optional) add more section IDs to the next parameters as many as necessary. |
159 | 159 | * @return void |
160 | 160 | */ |
161 | - public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
|
161 | + public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
|
162 | 162 | |
163 | 163 | foreach( func_get_args() as $_sSectionID ) { |
164 | 164 | $this->oForm->removeSection( $_sSectionID ); |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
219 | 219 | * @remark The actual registration will be performed in the <em>_replyToRegisterSettings()</em> method with the <em>admin_menu</em> hook. |
220 | 220 | */ |
221 | - public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
|
222 | - foreach( func_get_args() as $aField ) { |
|
221 | + public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
|
222 | + foreach( func_get_args() as $aField ) { |
|
223 | 223 | $this->addSettingField( $aField ); |
224 | 224 | } |
225 | 225 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return void |
258 | 258 | */ |
259 | 259 | public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
260 | - foreach( func_get_args() as $_sFieldID ) { |
|
260 | + foreach( func_get_args() as $_sFieldID ) { |
|
261 | 261 | $this->oForm->removeField( $_sFieldID ); |
262 | 262 | } |
263 | 263 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
74 | 74 | |
75 | - foreach( func_get_args() as $asSection ) { |
|
75 | + foreach ( func_get_args() as $asSection ) { |
|
76 | 76 | $this->addSettingSection( $asSection ); |
77 | 77 | } |
78 | 78 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function addSettingSection( $asSection ) { |
97 | 97 | |
98 | - if ( ! is_array( $asSection ) ) { |
|
98 | + if ( !is_array( $asSection ) ) { |
|
99 | 99 | $this->_sTargetPageSlug = is_string( $asSection ) |
100 | 100 | ? $asSection |
101 | 101 | : $this->_sTargetPageSlug; |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | ) |
118 | 118 | ); |
119 | 119 | |
120 | - $aSection[ 'section_tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'section_tab_slug' ] ); |
|
120 | + $aSection[ 'section_tab_slug' ] = $this->oUtil->sanitizeSlug( $aSection[ 'section_tab_slug' ] ); |
|
121 | 121 | |
122 | 122 | // A page slug is required. |
123 | - if ( ! $aSection[ 'page_slug' ] ) { |
|
123 | + if ( !$aSection[ 'page_slug' ] ) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | $this->oForm->addSection( $aSection ); |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | private function _getTargetPageSlug( $aSection ) { |
137 | 137 | |
138 | 138 | $_sTargetPageSlug = $this->oUtil->getElement( |
139 | - $aSection, // subject |
|
140 | - 'page_slug', // key |
|
139 | + $aSection, // subject |
|
140 | + 'page_slug', // key |
|
141 | 141 | $this->_sTargetPageSlug // default |
142 | 142 | ); |
143 | 143 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function _getTargetTabSlug( $aSection ) { |
159 | 159 | $_sTargetTabSlug = $this->oUtil->getElement( |
160 | - $aSection, // subject |
|
161 | - 'tab_slug', // key |
|
160 | + $aSection, // subject |
|
161 | + 'tab_slug', // key |
|
162 | 162 | $this->_sTargetTabSlug // default |
163 | 163 | ); |
164 | 164 | $_sTargetTabSlug = $_sTargetTabSlug |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @return void |
188 | 188 | */ |
189 | 189 | public function removeSettingSections( /* $sSectionID1=null, $sSectionID2=null, $_and_more=null */ ) { |
190 | - foreach( func_get_args() as $_sSectionID ) { |
|
190 | + foreach ( func_get_args() as $_sSectionID ) { |
|
191 | 191 | $this->oForm->removeSection( $_sSectionID ); |
192 | 192 | } |
193 | 193 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @remark The actual registration will be performed in the <em>_replyToRegisterSettings()</em> method with the <em>admin_menu</em> hook. |
246 | 246 | */ |
247 | 247 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
248 | - foreach( func_get_args() as $aField ) { |
|
248 | + foreach ( func_get_args() as $aField ) { |
|
249 | 249 | $this->addSettingField( $aField ); |
250 | 250 | } |
251 | 251 | } |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | * @param string $_and_more (optional) add more field IDs to the next parameters as many as necessary. |
283 | 283 | * @return void |
284 | 284 | */ |
285 | - public function removeSettingFields( $sFieldID1, $sFieldID2=null, $_and_more ) { |
|
286 | - foreach( func_get_args() as $_sFieldID ) { |
|
285 | + public function removeSettingFields( $sFieldID1, $sFieldID2 = null, $_and_more ) { |
|
286 | + foreach ( func_get_args() as $_sFieldID ) { |
|
287 | 287 | $this->oForm->removeField( $_sFieldID ); |
288 | 288 | } |
289 | 289 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $this->oProp->sOptionKey, |
331 | 331 | empty( $_aParams ) |
332 | 332 | ? null // will return the entire options array |
333 | - : $_aDimensionalKeys, // dimensional keys |
|
333 | + : $_aDimensionalKeys, // dimensional keys |
|
334 | 334 | $_mDefault, // default |
335 | 335 | $this->getSavedOptions() + $this->oForm->getDefaultFormValues() |
336 | 336 | ); |
@@ -349,18 +349,18 @@ discard block |
||
349 | 349 | * If the user has not submitted the form, the framework will try to return the default value set in the field definition array. |
350 | 350 | * @deprecated 3.3.0 |
351 | 351 | */ |
352 | - public function getFieldValue( $sFieldID, $sSectionID='' ) { |
|
352 | + public function getFieldValue( $sFieldID, $sSectionID = '' ) { |
|
353 | 353 | |
354 | - trigger_error( 'Admin Page Framework: ' . ' : ' . sprintf( __( 'The method is deprecated: %1$s. Use %2$s instead.', $this->oProp->sTextDomain ), __METHOD__, 'getValue()' ), E_USER_NOTICE ); |
|
354 | + trigger_error( 'Admin Page Framework: '.' : '.sprintf( __( 'The method is deprecated: %1$s. Use %2$s instead.', $this->oProp->sTextDomain ), __METHOD__, 'getValue()' ), E_USER_NOTICE ); |
|
355 | 355 | |
356 | 356 | $_aOptions = $this->oUtil->uniteArrays( $this->oProp->aOptions, $this->oForm->getDefaultFormValues() ); |
357 | 357 | /* If it's saved, return it */ |
358 | - if ( ! $sSectionID ) { |
|
358 | + if ( !$sSectionID ) { |
|
359 | 359 | if ( array_key_exists( $sFieldID, $_aOptions ) ) { |
360 | 360 | return $_aOptions[ $sFieldID ]; |
361 | 361 | } |
362 | 362 | // loop through section elements |
363 | - foreach( $_aOptions as $aOptions ) { |
|
363 | + foreach ( $_aOptions as $aOptions ) { |
|
364 | 364 | if ( array_key_exists( $sFieldID, $aOptions ) ) { |
365 | 365 | return $aOptions[ $sFieldID ]; |
366 | 366 | } |
@@ -48,6 +48,8 @@ discard block |
||
48 | 48 | * <li>a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with 'data:image/svg+xml;base64,'.</li> |
49 | 49 | * </ul> |
50 | 50 | * @param string (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function. |
51 | + * @param string $sIcon16x16 |
|
52 | + * @param integer $iMenuPosition |
|
51 | 53 | * @return void |
52 | 54 | */ |
53 | 55 | public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) { |
@@ -70,6 +72,7 @@ discard block |
||
70 | 72 | * |
71 | 73 | * @since 2.0.0 |
72 | 74 | * @internal |
75 | + * @param string $sMenuLabel |
|
73 | 76 | * @return void|string Returns the associated slug string, if true. |
74 | 77 | */ |
75 | 78 | private function _isBuiltInMenuItem( $sMenuLabel ) { |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | public function addSubMenuLink( array $aSubMenuLink ) { |
216 | 216 | |
217 | 217 | // If required keys are not set, return. |
218 | - if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { |
|
218 | + if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { |
|
219 | 219 | return; |
220 | 220 | } |
221 | 221 | |
222 | 222 | // If the set URL is not valid, return. |
223 | - if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { |
|
223 | + if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function addSubMenuPage( array $aSubMenuPage ) { |
315 | 315 | |
316 | - if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
316 | + if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
317 | 317 | return; |
318 | 318 | } |
319 | 319 |
@@ -173,52 +173,52 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | - * Adds the given sub-menu item on the left sidebar menu of the administration panel. |
|
177 | - * |
|
178 | - * It supports pages and links. Each of them has the specific array structure. |
|
179 | - * |
|
180 | - * <h4>Example</h4> |
|
181 | - * <code> |
|
182 | - * $this->addSubMenuItem( |
|
183 | - * array( |
|
184 | - * 'title' => 'Read Me', |
|
185 | - * 'menu_title' => 'About' |
|
186 | - * 'page_slug' => 'my_plugin_readme', |
|
187 | - * ) |
|
188 | - * ); |
|
189 | - * </code> |
|
190 | - * |
|
191 | - * @since 2.0.0 |
|
192 | - * @since 3.0.0 Changed the scope to public. |
|
193 | - * @remark The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug. |
|
194 | - * @param array a sub-menu array. It can be a page or a link. The array structures are as follows: |
|
195 | - * <h4>Sub-menu Page Array</h4> |
|
196 | - * <ul> |
|
197 | - * <li>**title** - (string) the page title of the page.</li> |
|
198 | - * <li>**page_slug** - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li> |
|
199 | - * <li>**screen_icon** - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below. |
|
200 | - * <pre>edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic</pre> |
|
201 | - * <p>( Notes: the `generic` icon is available WordPress version 3.5 or above.)</p> |
|
202 | - * </li> |
|
203 | - * <li>**capability** - (optional, string) the access level to the created admin pages defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
204 | - * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
205 | - * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
206 | - * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
207 | - * <li>**page_title** - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.</li> |
|
208 | - * <li>**menu_title** - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.</li> |
|
209 | - * </ul> |
|
210 | - * <h4>Sub-menu Link Array</h4> |
|
211 | - * <ul> |
|
212 | - * <li>**title** - (string) the link title.</li> |
|
213 | - * <li>**href** - (string) the URL of the target link.</li> |
|
214 | - * <li>**capability** - (optional, string) the access level to show the item, defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
215 | - * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
216 | - * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
217 | - * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
218 | - * </ul> |
|
219 | - * @access public |
|
220 | - * @return void |
|
221 | - */ |
|
176 | + * Adds the given sub-menu item on the left sidebar menu of the administration panel. |
|
177 | + * |
|
178 | + * It supports pages and links. Each of them has the specific array structure. |
|
179 | + * |
|
180 | + * <h4>Example</h4> |
|
181 | + * <code> |
|
182 | + * $this->addSubMenuItem( |
|
183 | + * array( |
|
184 | + * 'title' => 'Read Me', |
|
185 | + * 'menu_title' => 'About' |
|
186 | + * 'page_slug' => 'my_plugin_readme', |
|
187 | + * ) |
|
188 | + * ); |
|
189 | + * </code> |
|
190 | + * |
|
191 | + * @since 2.0.0 |
|
192 | + * @since 3.0.0 Changed the scope to public. |
|
193 | + * @remark The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug. |
|
194 | + * @param array a sub-menu array. It can be a page or a link. The array structures are as follows: |
|
195 | + * <h4>Sub-menu Page Array</h4> |
|
196 | + * <ul> |
|
197 | + * <li>**title** - (string) the page title of the page.</li> |
|
198 | + * <li>**page_slug** - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li> |
|
199 | + * <li>**screen_icon** - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below. |
|
200 | + * <pre>edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic</pre> |
|
201 | + * <p>( Notes: the `generic` icon is available WordPress version 3.5 or above.)</p> |
|
202 | + * </li> |
|
203 | + * <li>**capability** - (optional, string) the access level to the created admin pages defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
204 | + * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
205 | + * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
206 | + * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
207 | + * <li>**page_title** - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.</li> |
|
208 | + * <li>**menu_title** - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.</li> |
|
209 | + * </ul> |
|
210 | + * <h4>Sub-menu Link Array</h4> |
|
211 | + * <ul> |
|
212 | + * <li>**title** - (string) the link title.</li> |
|
213 | + * <li>**href** - (string) the URL of the target link.</li> |
|
214 | + * <li>**capability** - (optional, string) the access level to show the item, defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li> |
|
215 | + * <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li> |
|
216 | + * <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li> |
|
217 | + * <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li> |
|
218 | + * </ul> |
|
219 | + * @access public |
|
220 | + * @return void |
|
221 | + */ |
|
222 | 222 | public function addSubMenuItem( array $aSubMenuItem ) { |
223 | 223 | if ( isset( $aSubMenuItem[ 'href' ] ) ) { |
224 | 224 | $this->addSubMenuLink( $aSubMenuItem ); |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
231 | - * Adds the given link into the menu on the left sidebar of the administration panel. |
|
232 | - * |
|
233 | - * @since 2.0.0 |
|
234 | - * @since 3.0.0 Changed the scope to public from protected. |
|
235 | - * @since 3.5.0 Changed the scope to public as it was still protected. |
|
236 | - * @param string the menu title. |
|
237 | - * @param string the URL linked to the menu. |
|
238 | - * @param string (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>. |
|
239 | - * @param string (optional) the order number. The larger it is, the lower the position it gets. |
|
240 | - * @param string (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page. |
|
241 | - * @access public |
|
242 | - * @return void |
|
243 | - * @internal |
|
244 | - */ |
|
231 | + * Adds the given link into the menu on the left sidebar of the administration panel. |
|
232 | + * |
|
233 | + * @since 2.0.0 |
|
234 | + * @since 3.0.0 Changed the scope to public from protected. |
|
235 | + * @since 3.5.0 Changed the scope to public as it was still protected. |
|
236 | + * @param string the menu title. |
|
237 | + * @param string the URL linked to the menu. |
|
238 | + * @param string (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>. |
|
239 | + * @param string (optional) the order number. The larger it is, the lower the position it gets. |
|
240 | + * @param string (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page. |
|
241 | + * @access public |
|
242 | + * @return void |
|
243 | + * @internal |
|
244 | + */ |
|
245 | 245 | public function addSubMenuLink( array $aSubMenuLink ) { |
246 | 246 | |
247 | 247 | // If required keys are not set, return. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function. |
77 | 77 | * @return void |
78 | 78 | */ |
79 | - public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) { |
|
79 | + public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16 = null, $iMenuPosition = null ) { |
|
80 | 80 | |
81 | 81 | $sRootMenuLabel = trim( $sRootMenuLabel ); |
82 | 82 | $_sSlug = $this->_isBuiltInMenuItem( $sRootMenuLabel ); // if true, this method returns the slug |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @access public |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2=null, $_and_more=null ) { |
|
169 | + public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2 = null, $_and_more = null ) { |
|
170 | 170 | foreach ( func_get_args() as $_aSubMenuItem ) { |
171 | 171 | $this->addSubMenuItem( $_aSubMenuItem ); |
172 | 172 | } |
@@ -245,16 +245,16 @@ discard block |
||
245 | 245 | public function addSubMenuLink( array $aSubMenuLink ) { |
246 | 246 | |
247 | 247 | // If required keys are not set, return. |
248 | - if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { |
|
248 | + if ( !isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
249 | 249 | return; |
250 | 250 | } |
251 | 251 | |
252 | 252 | // If the set URL is not valid, return. |
253 | - if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { |
|
253 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
254 | 254 | return; |
255 | 255 | } |
256 | 256 | |
257 | - $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
257 | + $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
258 | 258 | $aSubMenuLink, |
259 | 259 | $this, |
260 | 260 | count( $this->oProp->aPages ) + 1 |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function addSubMenuPage( array $aSubMenuPage ) { |
346 | 346 | |
347 | - if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
347 | + if ( !isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
348 | 348 | return; |
349 | 349 | } |
350 | 350 | |
351 | - $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
351 | + $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
352 | 352 | $aSubMenuPage, |
353 | 353 | $this, |
354 | 354 | count( $this->oProp->aPages ) + 1 |
@@ -52,42 +52,6 @@ discard block |
||
52 | 52 | * @since 2.0.0 |
53 | 53 | * @since 3.0.0 Changed the scope to public. Added page slug target support. |
54 | 54 | * @since 3.3.1 Moved from `AdminPageFramework_Page`. |
55 | - * @param array $aTab1 The in-page tab array. |
|
56 | - * <h4>In-Page Tab Array</h4> |
|
57 | - * <ul> |
|
58 | - * <li>**page_slug** - (string) the page slug that the tab belongs to.</li> |
|
59 | - * <li>**tab_slug** - (string) the tab slug. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li> |
|
60 | - * <li>**title** - (string) the title of the tab.</li> |
|
61 | - * <li>**order** - (optional, integer) the order number of the tab. The lager the number is, the lower the position it is placed in the menu.</li> |
|
62 | - * <li>**show_in_page_tab** - (optional, boolean) default: `true`. If this is set to `false`, the tab title will not be displayed in the tab navigation menu; however, it is still accessible from the direct URL.</li> |
|
63 | - * <li>**parent_tab_slug** - (optional, string) this needs to be set if the above `show_in_page_tab` argument is `false` so that the parent tab will be emphasized as active when the hidden page is accessed.</li> |
|
64 | - * <li>**url** - [3.5.0+] (optional, string) If this is set, the link url of the navigation tab will be this url. Use this to create link only tab.</li> |
|
65 | - * <li>**capability** - [3.6.0+] (optional, string) The capability level.</li> |
|
66 | - * <li>**if** - [3.6.0+] (optional, boolean) Whether the tab should be displayed or not.</li> |
|
67 | - * <li>style - [3.6.3+] (optional) (string|array) The path or url of a stylesheet which gets loaded in the head tag. Or inline CSS rules. |
|
68 | - * When custom arguments need to be set such as whether it should be inserted in the footer, set an array holding the following arguments. |
|
69 | - * <ul> |
|
70 | - * <li>src - (required, string) the source url or path.</li> |
|
71 | - * <li>handle_id - (optional, string) The handle ID of the stylesheet.</li> |
|
72 | - * <li>dependencies - (optional, array) The dependency array.</li> |
|
73 | - * <li>version - (optional, string) The stylesheet version number.</li> |
|
74 | - * <li>media - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
75 | - * </ul> |
|
76 | - * </li> |
|
77 | - * <li>script - [3.6.3+] (optional) (string|array) The path or url of a JavaScript script which gets loaded in the head tag. Or an inline JavaScript script. |
|
78 | - * When custom arguments need to be set such as whether it should be inserted in the footer, set an array holding the following arguments. |
|
79 | - * <ul> |
|
80 | - * <li>src - (required, string) the source url or path.</li> |
|
81 | - * <li>handle_id - (optional, string) The handle ID of the stylesheet.</li> |
|
82 | - * <li>dependencies - (optional, array) The dependency array.</li> |
|
83 | - * <li>version - (optional, string) The stylesheet version number.</li> |
|
84 | - * <li>translation - (optional, array) an array holding translation key-value pairs.</li> |
|
85 | - * </ul> |
|
86 | - * </li> |
|
87 | - * </ul> |
|
88 | - * @param array $aTab2 Another in-page tab array. |
|
89 | - * @param array $_and_more (optional) Add in-page tab arrays as many as necessary to the next parameters. |
|
90 | - * @param string $sPageSlug (optional) If the passed parameter item is a string, it will be stored as the target page slug so that it will be applied to the next passed tab arrays as the page_slug element. |
|
91 | 55 | * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
92 | 56 | * @remark In-page tabs are different from page-heading tabs which is automatically added with page titles. |
93 | 57 | * @return void |
@@ -277,6 +241,10 @@ discard block |
||
277 | 241 | /** |
278 | 242 | * Sets a page property. |
279 | 243 | * @since 3.6.0 |
244 | + * @param string $sPropertyName |
|
245 | + * @param string $sPropertyKey |
|
246 | + * @param boolean|string $mValue |
|
247 | + * @param string $sPageSlug |
|
280 | 248 | * @return void |
281 | 249 | */ |
282 | 250 | private function _setPageProperty( $sPropertyName, $sPropertyKey, $mValue, $sPageSlug ) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | public function addInPageTabs( /* $aTab1, $aTab2=null, $_and_more=null */ ) { |
96 | - foreach( func_get_args() as $asTab ) { |
|
96 | + foreach ( func_get_args() as $asTab ) { |
|
97 | 97 | $this->addInPageTab( $asTab ); |
98 | 98 | } |
99 | 99 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // Target page slug - will be applied when no page slug is specified. |
117 | 117 | static $__sTargetPageSlug; |
118 | - if ( ! is_array( $asInPageTab ) ) { |
|
118 | + if ( !is_array( $asInPageTab ) ) { |
|
119 | 119 | $__sTargetPageSlug = is_string( $asInPageTab ) |
120 | 120 | ? $asInPageTab |
121 | 121 | : $__sTargetPageSlug; // set the target page slug |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | ); |
131 | 131 | |
132 | 132 | // Set the target page slug for next calls |
133 | - $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
|
133 | + $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
|
134 | 134 | |
135 | 135 | // Required keys |
136 | - if ( ! isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
136 | + if ( !isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Count - the number of added in-page tabs. |
141 | - $_aElements = $this->oUtil->getElement( |
|
141 | + $_aElements = $this->oUtil->getElement( |
|
142 | 142 | $this->oProp->aInPageTabs, |
143 | 143 | $aInPageTab[ 'page_slug' ], |
144 | 144 | array() |
145 | 145 | ); |
146 | - $_iCountElement = count( $_aElements ); |
|
146 | + $_iCountElement = count( $_aElements ); |
|
147 | 147 | |
148 | 148 | // Pre-format |
149 | - $aInPageTab = array( |
|
149 | + $aInPageTab = array( |
|
150 | 150 | 'page_slug' => $this->oUtil->sanitizeSlug( $aInPageTab[ 'page_slug' ] ), |
151 | 151 | 'tab_slug' => $this->oUtil->sanitizeSlug( $aInPageTab[ 'tab_slug' ] ), |
152 | 152 | 'order' => $this->oUtil->getAOrB( |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param boolean $bShow If false, the page title will not be displayed. |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function setPageTitleVisibility( $bShow=true, $sPageSlug='' ) { |
|
177 | + public function setPageTitleVisibility( $bShow = true, $sPageSlug = '' ) { |
|
178 | 178 | $this->_setPageProperty( |
179 | 179 | 'bShowPageTitle', |
180 | 180 | 'show_page_title', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @remark Page-heading tabs and in-page tabs are different. The former displays page titles and the latter displays tab titles. |
199 | 199 | * @remark If the second parameter is omitted, it sets the default value. |
200 | 200 | */ |
201 | - public function setPageHeadingTabsVisibility( $bShow=true, $sPageSlug='' ) { |
|
201 | + public function setPageHeadingTabsVisibility( $bShow = true, $sPageSlug = '' ) { |
|
202 | 202 | $this->_setPageProperty( |
203 | 203 | 'bShowPageHeadingTabs', |
204 | 204 | 'show_page_heading_tabs', |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param string $sPageSlug The page to apply the visibility setting. If not set, it applies to all the pages. |
220 | 220 | * @remark If the second parameter is omitted, it sets the default value. |
221 | 221 | */ |
222 | - public function setInPageTabsVisibility( $bShow=true, $sPageSlug='' ) { |
|
222 | + public function setInPageTabsVisibility( $bShow = true, $sPageSlug = '' ) { |
|
223 | 223 | $this->_setPageProperty( |
224 | 224 | 'bShowInPageTabs', |
225 | 225 | 'show_in_page_tabs', |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param string $sPageSlug The page slug that applies the setting. |
243 | 243 | * @remark If the second parameter is omitted, it sets the default value. |
244 | 244 | */ |
245 | - public function setInPageTabTag( $sTag='h3', $sPageSlug='' ) { |
|
245 | + public function setInPageTabTag( $sTag = 'h3', $sPageSlug = '' ) { |
|
246 | 246 | $this->_setPageProperty( |
247 | 247 | 'sInPageTabTag', |
248 | 248 | 'in_page_tab_tag', |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | * @param string $sPageSlug The page slug that applies the setting. |
266 | 266 | * @remark If the second parameter is omitted, it sets the default value. |
267 | 267 | */ |
268 | - public function setPageHeadingTabTag( $sTag='h2', $sPageSlug='' ) { |
|
268 | + public function setPageHeadingTabTag( $sTag = 'h2', $sPageSlug = '' ) { |
|
269 | 269 | $this->_setPageProperty( |
270 | - 'sPageHeadingTabTag', // property name |
|
270 | + 'sPageHeadingTabTag', // property name |
|
271 | 271 | 'page_heading_tab_tag', // property key |
272 | 272 | $sTag, // value |
273 | 273 | $sPageSlug // page slug |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | $this->oProp->{$sPropertyName} = $mValue; |
291 | 291 | |
292 | - foreach( $this->oProp->aPages as &$_aPage ) { |
|
292 | + foreach ( $this->oProp->aPages as &$_aPage ) { |
|
293 | 293 | $_aPage[ $sPropertyKey ] = $mValue; |
294 | 294 | |
295 | 295 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | public function addInPageTabs( /* $aTab1, $aTab2=null, $_and_more=null */ ) { |
96 | - foreach( func_get_args() as $asTab ) { |
|
96 | + foreach( func_get_args() as $asTab ) { |
|
97 | 97 | $this->addInPageTab( $asTab ); |
98 | 98 | } |
99 | 99 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @remark In-page tabs are different from page-heading tabs which are automatically added with page titles. |
112 | 112 | * @return void |
113 | 113 | */ |
114 | - public function addInPageTab( $asInPageTab ) { |
|
114 | + public function addInPageTab( $asInPageTab ) { |
|
115 | 115 | |
116 | 116 | // Target page slug - will be applied when no page slug is specified. |
117 | 117 | static $__sTargetPageSlug; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
134 | 134 | |
135 | 135 | // Required keys |
136 | - if ( ! isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
136 | + if ( ! isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param string $sPageSlug The page slug that applies the setting. |
243 | 243 | * @remark If the second parameter is omitted, it sets the default value. |
244 | 244 | */ |
245 | - public function setInPageTabTag( $sTag='h3', $sPageSlug='' ) { |
|
245 | + public function setInPageTabTag( $sTag='h3', $sPageSlug='' ) { |
|
246 | 246 | $this->_setPageProperty( |
247 | 247 | 'sInPageTabTag', |
248 | 248 | 'in_page_tab_tag', |
@@ -455,6 +455,7 @@ |
||
455 | 455 | * @internal |
456 | 456 | * @since 3.5.3 |
457 | 457 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition_Page`. |
458 | + * @param string $sTabSlug |
|
458 | 459 | * @return boolean |
459 | 460 | */ |
460 | 461 | private function _isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ); |
108 | 108 | // @todo Examine whether this check can be removed |
109 | 109 | // as the section that hods this field is already checked above outside this loop. |
110 | - if ( $sPageSlug !== $_aFieldset[ 'page_slug' ] ) { |
|
110 | + if ( $sPageSlug !== $_aFieldset[ 'page_slug' ] ) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition_Page`. |
334 | 334 | * @return array |
335 | 335 | */ |
336 | - public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
336 | + public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
337 | 337 | $_aOtherTabOptions = $this->getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ); |
338 | 338 | return $this->invertCastArrayContents( $aOptions, $_aOtherTabOptions ); |
339 | 339 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug='' ) { |
352 | 352 | |
353 | 353 | $_aStoredOptionsOfTheTab = array(); |
354 | - if ( ! $sTabSlug ) { |
|
354 | + if ( ! $sTabSlug ) { |
|
355 | 355 | return $_aStoredOptionsOfTheTab; |
356 | 356 | } |
357 | 357 |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | public function getPageOnlyOptions( $aOptions, $sPageSlug ) { |
53 | 53 | |
54 | 54 | $_aStoredOptionsOfThePage = array(); |
55 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
55 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
56 | 56 | |
57 | 57 | // Check the section |
58 | - if ( ! $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
58 | + if ( !$this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | |
62 | 62 | // At this point, the element belongs the given page slug as the section is of the given page slug's. |
63 | 63 | $this->_setPageOnlyOptions( |
64 | - $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
64 | + $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
65 | 65 | $aOptions, |
66 | 66 | $_aSubSectionsOrFields, |
67 | 67 | $sPageSlug, |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @internal |
82 | 82 | */ |
83 | 83 | private function _setPageOnlyOptions( array &$_aStoredOptionsOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug, $_sSectionID ) { |
84 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
84 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
85 | 85 | |
86 | 86 | // If it's a sub-section array, |
87 | 87 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function getOtherPageOptions( $aOptions, $sPageSlug ) { |
154 | 154 | |
155 | 155 | $_aStoredOptionsNotOfThePage = array(); |
156 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
156 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
157 | 157 | |
158 | 158 | // Check the section |
159 | 159 | if ( $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @internal |
183 | 183 | */ |
184 | 184 | private function _setOtherPageOptions( array &$_aStoredOptionsNotOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug ) { |
185 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
185 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
186 | 186 | |
187 | 187 | // It's a sub-section array. |
188 | 188 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ) { |
246 | 246 | |
247 | 247 | $_aStoredOptionsNotOfTheTab = array(); |
248 | - foreach( $this->aFieldsets as $_sSectionPath => $_aSubSectionsOrFields ) { |
|
248 | + foreach ( $this->aFieldsets as $_sSectionPath => $_aSubSectionsOrFields ) { |
|
249 | 249 | |
250 | 250 | // If the section is of the given page and the given tab, skip. |
251 | 251 | if ( $this->_isThisSectionSetToThisTab( $_sSectionPath, $sPageSlug, $sTabSlug ) ) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | private function _setOtherTabOptions( array &$_aStoredOptionsNotOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $sSectionPath ) { |
277 | 277 | |
278 | 278 | // At this point, the passed element belongs to the other tabs since the section of the given tab is skipped. |
279 | - foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
279 | + foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
280 | 280 | |
281 | 281 | // If it's a sub section |
282 | 282 | if ( $this->isNumericInteger( $_isSubSectionIndexOrFieldID ) ) { |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition_Page`. |
335 | 335 | * @return array |
336 | 336 | */ |
337 | - public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
337 | + public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
338 | 338 | |
339 | 339 | $_aOtherTabOptions = $this->getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ); |
340 | 340 | $_aTabOptions = $this->invertCastArrayContents( $aOptions, $_aOtherTabOptions ); |
@@ -352,17 +352,17 @@ discard block |
||
352 | 352 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition_Page`. |
353 | 353 | * @return array |
354 | 354 | */ |
355 | - public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
355 | + public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
356 | 356 | |
357 | 357 | $_aStoredOptionsOfTheTab = array(); |
358 | - if ( ! $sTabSlug ) { |
|
358 | + if ( !$sTabSlug ) { |
|
359 | 359 | return $_aStoredOptionsOfTheTab; |
360 | 360 | } |
361 | 361 | |
362 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
362 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
363 | 363 | |
364 | 364 | // Check the section |
365 | - if ( ! $this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
365 | + if ( !$this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
366 | 366 | continue; |
367 | 367 | } |
368 | 368 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | private function _setTabOnlyOptions( array &$_aStoredOptionsOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $_sSectionID ) { |
390 | 390 | |
391 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
391 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aFieldset ) { |
|
392 | 392 | |
393 | 393 | // if it's a sub-section array. |
394 | 394 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | private function _isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) { |
447 | 447 | |
448 | - if ( ! isset( $this->aSectionsets[ $sSectionPath ][ 'page_slug' ] ) ) { |
|
448 | + if ( !isset( $this->aSectionsets[ $sSectionPath ][ 'page_slug' ] ) ) { |
|
449 | 449 | return false; |
450 | 450 | } |
451 | 451 | return ( |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | */ |
464 | 464 | private function _isThisSectionSetToThisTab( $sSectionPath, $sPageSlug, $sTabSlug ) { |
465 | 465 | |
466 | - if ( ! $this->_isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) ) { |
|
466 | + if ( !$this->_isThisSectionSetToThisPage( $sSectionPath, $sPageSlug ) ) { |
|
467 | 467 | return false; |
468 | 468 | } |
469 | - if ( ! isset( $this->aSectionsets[ $sSectionPath ][ 'tab_slug' ] ) ) { |
|
469 | + if ( !isset( $this->aSectionsets[ $sSectionPath ][ 'tab_slug' ] ) ) { |
|
470 | 470 | return false; |
471 | 471 | } |
472 | 472 | return ( |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | */ |
484 | 484 | private function _setOptionValue( &$aSubject, $asDimensionalPath, $aOptions ) { |
485 | 485 | $_aDimensionalPath = $this->getAsArray( $asDimensionalPath ); |
486 | - $_mValue = $this->getElement( |
|
486 | + $_mValue = $this->getElement( |
|
487 | 487 | $aOptions, |
488 | - $_aDimensionalPath, // as of 3.7.0, it can be an array or string |
|
488 | + $_aDimensionalPath, // as of 3.7.0, it can be an array or string |
|
489 | 489 | null |
490 | 490 | ); |
491 | 491 | if ( isset( $_mValue ) ) { |
@@ -23,6 +23,7 @@ |
||
23 | 23 | * Sets up internal properties. |
24 | 24 | * |
25 | 25 | * @since 3.2.0 |
26 | + * @param AdminPageFramework_Widget_Model $oCaller |
|
26 | 27 | * @return void |
27 | 28 | */ |
28 | 29 | public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @since 3.2.0 |
28 | 28 | * @return void |
29 | 29 | */ |
30 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
30 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
31 | 31 | |
32 | 32 | $aArguments = $aArguments |
33 | 33 | + array( |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | 'description' => '', |
36 | 36 | ); |
37 | 37 | |
38 | - parent::__construct( |
|
38 | + parent::__construct( |
|
39 | 39 | $oCaller->oProp->sClassName, // base id |
40 | 40 | $sWidgetTitle, // widget title |
41 | 41 | $aArguments // widget arguments |
42 | 42 | ); |
43 | 43 | $this->oCaller = $oCaller; |
44 | 44 | |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Displays the widget contents in the front end. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * whether the title should be visible or not depending on the content. |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function widget( $aArguments, $aFormData ) { |
|
55 | + public function widget( $aArguments, $aFormData ) { |
|
56 | 56 | |
57 | 57 | echo $aArguments[ 'before_widget' ]; |
58 | 58 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | echo $_sContent; |
77 | 77 | |
78 | - echo $aArguments[ 'after_widget' ]; |
|
78 | + echo $aArguments[ 'after_widget' ]; |
|
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | /** |
82 | 82 | * Returns the widget title. |
83 | 83 | * |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if ( ! $_sTitle ) { |
107 | 107 | return ''; |
108 | 108 | } |
109 | - return $aArguments['before_title'] |
|
109 | + return $aArguments['before_title'] |
|
110 | 110 | . $_sTitle |
111 | 111 | . $aArguments['after_title']; |
112 | 112 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @since 3.2.0 |
119 | 119 | * @return mixed The validated form data. The type should be an array but it is dealt by the framework user it will be unknown. |
120 | 120 | */ |
121 | - public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
121 | + public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
122 | 122 | |
123 | 123 | return $this->oCaller->oUtil->addAndApplyFilters( |
124 | 124 | $this->oCaller, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $this->oCaller |
132 | 132 | ); |
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(); |
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 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @since 3.2.0 |
28 | 28 | * @return void |
29 | 29 | */ |
30 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
30 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments = array() ) { |
|
31 | 31 | |
32 | 32 | $aArguments = $aArguments |
33 | 33 | + array( |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | ); |
37 | 37 | |
38 | 38 | parent::__construct( |
39 | - $oCaller->oProp->sClassName, // base id |
|
40 | - $sWidgetTitle, // widget title |
|
39 | + $oCaller->oProp->sClassName, // base id |
|
40 | + $sWidgetTitle, // widget title |
|
41 | 41 | $aArguments // widget arguments |
42 | 42 | ); |
43 | 43 | $this->oCaller = $oCaller; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->oCaller->oUtil->addAndDoActions( |
60 | 60 | $this->oCaller, |
61 | - 'do_' . $this->oCaller->oProp->sClassName, |
|
61 | + 'do_'.$this->oCaller->oProp->sClassName, |
|
62 | 62 | $this->oCaller |
63 | 63 | ); |
64 | 64 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function _getTitle( array $aArguments, array $aFormData ) { |
91 | 91 | |
92 | - if ( ! $this->oCaller->oProp->bShowWidgetTitle ) { |
|
92 | + if ( !$this->oCaller->oProp->bShowWidgetTitle ) { |
|
93 | 93 | return ''; |
94 | 94 | } |
95 | 95 | |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | $aFormData, |
104 | 104 | $this->id_base |
105 | 105 | ); |
106 | - if ( ! $_sTitle ) { |
|
106 | + if ( !$_sTitle ) { |
|
107 | 107 | return ''; |
108 | 108 | } |
109 | - return $aArguments['before_title'] |
|
109 | + return $aArguments[ 'before_title' ] |
|
110 | 110 | . $_sTitle |
111 | - . $aArguments['after_title']; |
|
111 | + . $aArguments[ 'after_title' ]; |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->oCaller, |
125 | 125 | "validation_{$this->oCaller->oProp->sClassName}", |
126 | 126 | call_user_func_array( |
127 | - array( $this->oCaller, 'validate' ), // triggers __call() |
|
127 | + array( $this->oCaller, 'validate' ), // triggers __call() |
|
128 | 128 | array( $aSubmittedFormData, $aSavedFormData, $this->oCaller ) // parameters |
129 | 129 | ), // 3.5.3+ |
130 | 130 | $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. |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Call the load method only once per class. Also the added field registrations in the class also done once. |
195 | 195 | * @since 3.7.9 |
196 | 196 | */ |
197 | - if ( $this->oCaller->oUtil->hasBeenCalled( '_widget_load_' . $this->oCaller->oProp->sClassName ) ) { |
|
197 | + if ( $this->oCaller->oUtil->hasBeenCalled( '_widget_load_'.$this->oCaller->oProp->sClassName ) ) { |
|
198 | 198 | |
199 | 199 | // The saved option callback is done with the below load_... callback so for widget form instances called from the second time |
200 | 200 | // need to call the callback manually. |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $this->oCaller->oUtil->addAndDoActions( |
209 | 209 | $this->oCaller, |
210 | 210 | array( |
211 | - 'load_' . $this->oCaller->oProp->sClassName, |
|
211 | + 'load_'.$this->oCaller->oProp->sClassName, |
|
212 | 212 | ), |
213 | 213 | $this->oCaller |
214 | 214 | ); |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | */ |
223 | 223 | private function _getFormCallbacks() { |
224 | 224 | return array( |
225 | - 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
226 | - 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
227 | - 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
225 | + 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
226 | + 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
227 | + 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
228 | 228 | 'hfInputName' => array( $this, '_replyToGetFieldInputName' ), |
229 | 229 | |
230 | 230 | 'saved_data' => array( $this, '_replyToGetSavedFormData' ), |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | public function _replyToGetSavedFormData() { |
242 | 242 | return $this->oCaller->oUtil->addAndApplyFilter( |
243 | 243 | $this->oCaller, // the caller factory object |
244 | - 'options_' . $this->oCaller->oProp->sClassName, |
|
245 | - $this->oCaller->oProp->aOptions, // subject value to be filtered |
|
244 | + 'options_'.$this->oCaller->oProp->sClassName, |
|
245 | + $this->oCaller->oProp->aOptions, // subject value to be filtered |
|
246 | 246 | $this->id // 3.7.9+ |
247 | 247 | ); |
248 | 248 | } |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | ? "[{$aFieldset[ '_section_index' ]}]" |
276 | 276 | : ""; |
277 | 277 | $_sDimensions = $this->oCaller->isSectionSet( $aFieldset ) |
278 | - ? $aFieldset[ 'section_id' ] . "]" . $_sSectionIndex . "[" . $aFieldset[ 'field_id' ] |
|
278 | + ? $aFieldset[ 'section_id' ]."]".$_sSectionIndex."[".$aFieldset[ 'field_id' ] |
|
279 | 279 | : $aFieldset[ 'field_id' ]; |
280 | - return 'widget-' . $this->id_base . '[' . $this->number . '][' . $_sDimensions . ']'; |
|
280 | + return 'widget-'.$this->id_base.'['.$this->number.']['.$_sDimensions.']'; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | $_sIndex = $this->oCaller->oUtil->getAOrB( |
295 | 295 | '0' !== $sIndex && empty( $sIndex ), |
296 | 296 | '', |
297 | - "[" . $sIndex . "]" |
|
297 | + "[".$sIndex."]" |
|
298 | 298 | ); |
299 | - return $this->_replyToGetFieldName( '', $aFieldset ) . $_sIndex; |
|
299 | + return $this->_replyToGetFieldName( '', $aFieldset ).$_sIndex; |
|
300 | 300 | |
301 | 301 | } |
302 | 302 |
@@ -81,7 +81,6 @@ discard block |
||
81 | 81 | * 'code_block' => ..., |
82 | 82 | * |
83 | 83 | * )` |
84 | - * @param array $aOptions The options array which determines the behaviour of the class. |
|
85 | 84 | * @since 3.5.0 |
86 | 85 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
87 | 86 | */ |
@@ -156,6 +155,7 @@ discard block |
||
156 | 155 | * Returns the parsed text. |
157 | 156 | * @since 3.5.0 |
158 | 157 | * @internal |
158 | + * @param string $sContent |
|
159 | 159 | */ |
160 | 160 | private function _getParsedText( $sContent ) { |
161 | 161 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @since 3.5.0 |
86 | 86 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
87 | 87 | */ |
88 | - public function __construct( $sFilePathOrContent='', array $aReplacements=array(), array $aCallbacks=array() ) { |
|
88 | + public function __construct( $sFilePathOrContent = '', array $aReplacements = array(), array $aCallbacks = array() ) { |
|
89 | 89 | |
90 | 90 | $this->sText = file_exists( $sFilePathOrContent ) |
91 | 91 | ? file_get_contents( $sFilePathOrContent ) |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
122 | 122 | $sText, |
123 | 123 | -1, |
124 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
124 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
125 | 125 | ); |
126 | 126 | return $_aSections; |
127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @since 3.5.0 |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public function get( $sSectionName='' ) { |
|
135 | + public function get( $sSectionName = '' ) { |
|
136 | 136 | return $sSectionName |
137 | 137 | ? $this->getSection( $sSectionName ) |
138 | 138 | : $this->_getParsedText( $this->sText ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function _replyToReplaceCodeBlocks( $aMatches ) { |
196 | 196 | |
197 | - if ( ! isset( $aMatches[ 1 ] ) ) { |
|
197 | + if ( !isset( $aMatches[ 1 ] ) ) { |
|
198 | 198 | return $aMatches[ 0 ]; |
199 | 199 | } |
200 | 200 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function getRawSection( $sSectionName ) { |
219 | 219 | |
220 | - $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
220 | + $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
221 | 221 | return false === $_iIndex |
222 | 222 | ? '' |
223 | 223 | : trim( $this->_aSections[ $_iIndex + 1 ] ); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | // If <?php notation is missing, highlight_string() will not highlight the syntax so add it. |
238 | 238 | $_bHasPHPTag = "<?php" === substr( $sCode, 0, 5 ); |
239 | 239 | |
240 | - $sCode = $_bHasPHPTag ? $sCode : "<?php " . $sCode; |
|
240 | + $sCode = $_bHasPHPTag ? $sCode : "<?php ".$sCode; |
|
241 | 241 | |
242 | 242 | $sCode = str_replace( '"', "'", $sCode ); // highlight_string() crashes if double quotes are contained in the code. |
243 | 243 | $sCode = highlight_string( $sCode, true ); |
@@ -20,6 +20,8 @@ |
||
20 | 20 | /** |
21 | 21 | * |
22 | 22 | * @since 3.5.3 |
23 | + * @param string $sFilePath |
|
24 | + * @param string $sTOCTitle |
|
23 | 25 | */ |
24 | 26 | protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections=array() ) { |
25 | 27 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | return $_oTOC->get(); |
47 | 47 | } |
48 | 48 | return '' |
49 | - . $_sContent; |
|
49 | + . $_sContent; |
|
50 | 50 | |
51 | 51 | } |
52 | 52 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @since 3.5.3 |
23 | 23 | */ |
24 | - protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections=array() ) { |
|
24 | + protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections = array() ) { |
|
25 | 25 | |
26 | 26 | $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser( |
27 | 27 | $sFilePath, |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | ) |
35 | 35 | ); |
36 | 36 | $_sContent = ''; |
37 | - foreach( ( array ) $asSections as $_sSection ) { |
|
37 | + foreach ( ( array ) $asSections as $_sSection ) { |
|
38 | 38 | $_sContent .= $_oWPReadmeParser->getSection( $_sSection ); |
39 | 39 | } |
40 | 40 | if ( $sTOCTitle ) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @since 3.6.1 |
67 | 67 | * @return string The generate HTML output. |
68 | 68 | */ |
69 | - public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode='' ) { |
|
69 | + public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode = '' ) { |
|
70 | 70 | |
71 | 71 | $sURL = isset( $aAttributes[ 'src' ] ) ? $aAttributes[ 'src' ] : $sURL; |
72 | 72 | $_sHTML = wp_oembed_get( $sURL ); |
@@ -108,27 +108,27 @@ discard block |
||
108 | 108 | * array( 'Second Heading' => 'Another text', ), |
109 | 109 | * ) |
110 | 110 | */ |
111 | - public function getContentsByHeader( $sContents, $iHeaderNumber=2 ) { |
|
111 | + public function getContentsByHeader( $sContents, $iHeaderNumber = 2 ) { |
|
112 | 112 | |
113 | 113 | $_aContents = array(); |
114 | 114 | $_aSplitContents = preg_split( |
115 | 115 | // '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
116 | - '/(<h[' . $iHeaderNumber . ']*[^>]*>.*?<\/h[' . $iHeaderNumber . ']>)/i', |
|
116 | + '/(<h['.$iHeaderNumber.']*[^>]*>.*?<\/h['.$iHeaderNumber.']>)/i', |
|
117 | 117 | $sContents, |
118 | 118 | -1, |
119 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
119 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
120 | 120 | ); |
121 | 121 | |
122 | - foreach( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
123 | - if ( ! preg_match( '/<h[' . $iHeaderNumber . ']*[^>]*>(.*?)<\/h[' . $iHeaderNumber . ']>/i', $_sSplitContent , $_aMatches ) ) { |
|
122 | + foreach ( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
123 | + if ( !preg_match( '/<h['.$iHeaderNumber.']*[^>]*>(.*?)<\/h['.$iHeaderNumber.']>/i', $_sSplitContent, $_aMatches ) ) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | - if ( ! isset( $_aMatches[ 1 ] ) ) { |
|
127 | + if ( !isset( $_aMatches[ 1 ] ) ) { |
|
128 | 128 | continue; |
129 | 129 | } |
130 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
131 | - $_aContents[] = array( |
|
130 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
131 | + $_aContents[ ] = array( |
|
132 | 132 | $_aMatches[ 1 ], |
133 | 133 | $_aSplitContents[ $_iIndex + 1 ] |
134 | 134 | ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | foreach( ( array ) $asSections as $_sSection ) { |
38 | 38 | $_sContent .= $_oWPReadmeParser->getSection( $_sSection ); |
39 | 39 | } |
40 | - if ( $sTOCTitle ) { |
|
40 | + if ( $sTOCTitle ) { |
|
41 | 41 | $_oTOC = new AdminPageFramework_TableOfContents( |
42 | 42 | $_sContent, |
43 | 43 | 4, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if ( ! isset( $_aMatches[ 1 ] ) ) { |
128 | 128 | continue; |
129 | 129 | } |
130 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
130 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
131 | 131 | $_aContents[] = array( |
132 | 132 | $_aMatches[ 1 ], |
133 | 133 | $_aSplitContents[ $_iIndex + 1 ] |