@@ -24,6 +24,7 @@ |
||
24 | 24 | * Registers necessary callbacks and sets up properties. |
25 | 25 | * |
26 | 26 | * @internal |
27 | + * @param string $sCallerPath |
|
27 | 28 | */ |
28 | 29 | public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
29 | 30 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @internal |
27 | 27 | */ |
28 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
28 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
29 | 29 | |
30 | 30 | parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain ); |
31 | 31 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | foreach ( $this->oProp->aPages as $_aPage ) { |
128 | 128 | |
129 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
129 | + if ( !isset( $_aPage[ 'page_slug' ] ) ) { |
|
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | $this->oProp->sDefaultPageSlug = $_aPage[ 'page_slug' ]; |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private function _registerRootMenuPage() { |
146 | 146 | $this->oProp->aRootMenu[ '_page_hook' ] = add_menu_page( |
147 | - $this->oProp->sClassName, // Page title - will be invisible anyway |
|
148 | - $this->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
149 | - $this->oProp->sCapability, // Capability - access right |
|
150 | - $this->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
151 | - '', // Page content displaying function - the root page will be removed so no need to register a function. |
|
152 | - $this->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
147 | + $this->oProp->sClassName, // Page title - will be invisible anyway |
|
148 | + $this->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
149 | + $this->oProp->sCapability, // Capability - access right |
|
150 | + $this->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
151 | + '', // Page content displaying function - the root page will be removed so no need to register a function. |
|
152 | + $this->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
153 | 153 | $this->oUtil->getElement( |
154 | 154 | $this->oProp->aRootMenu, |
155 | 155 | 'iPosition', |
@@ -173,32 +173,32 @@ discard block |
||
173 | 173 | */ |
174 | 174 | private function _registerSubMenuItem( array $aArgs ) { |
175 | 175 | |
176 | - if ( ! current_user_can( $aArgs['capability'] ) ) { |
|
176 | + if ( !current_user_can( $aArgs[ 'capability' ] ) ) { |
|
177 | 177 | return ''; |
178 | 178 | } |
179 | 179 | |
180 | - $_sRootPageSlug = $this->oProp->aRootMenu['sPageSlug']; |
|
180 | + $_sRootPageSlug = $this->oProp->aRootMenu[ 'sPageSlug' ]; |
|
181 | 181 | $_sMenuSlug = plugin_basename( $_sRootPageSlug ); // to be compatible with add_submenu_page() |
182 | 182 | |
183 | - switch( $aArgs['type'] ) { |
|
183 | + switch ( $aArgs[ 'type' ] ) { |
|
184 | 184 | case 'page': |
185 | 185 | // it's possible that the page_slug key is not set if the user uses a method like setPageHeadingTabsVisibility() prior to addSubMenuItam(). |
186 | 186 | return $this->_addPageSubmenuItem( |
187 | 187 | $_sRootPageSlug, |
188 | 188 | $_sMenuSlug, |
189 | - $aArgs['page_slug'], |
|
190 | - $this->oUtil->getElement( $aArgs, 'page_title', $aArgs['title'] ), |
|
191 | - $this->oUtil->getElement( $aArgs, 'menu_title', $aArgs['title'] ), |
|
192 | - $aArgs['capability'], |
|
193 | - $aArgs['show_in_menu'] |
|
189 | + $aArgs[ 'page_slug' ], |
|
190 | + $this->oUtil->getElement( $aArgs, 'page_title', $aArgs[ 'title' ] ), |
|
191 | + $this->oUtil->getElement( $aArgs, 'menu_title', $aArgs[ 'title' ] ), |
|
192 | + $aArgs[ 'capability' ], |
|
193 | + $aArgs[ 'show_in_menu' ] |
|
194 | 194 | ); |
195 | 195 | case 'link': |
196 | 196 | return $this->_addLinkSubmenuItem( |
197 | 197 | $_sMenuSlug, |
198 | - $aArgs['title'], |
|
199 | - $aArgs['capability'], |
|
200 | - $aArgs['href'], |
|
201 | - $aArgs['show_in_menu'] |
|
198 | + $aArgs[ 'title' ], |
|
199 | + $aArgs[ 'capability' ], |
|
200 | + $aArgs[ 'href' ], |
|
201 | + $aArgs[ 'show_in_menu' ] |
|
202 | 202 | ); |
203 | 203 | default: |
204 | 204 | return ''; |
@@ -214,43 +214,43 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu ) { |
216 | 216 | |
217 | - if ( ! $sPageSlug ) { |
|
217 | + if ( !$sPageSlug ) { |
|
218 | 218 | return ''; |
219 | 219 | } |
220 | 220 | $_sPageHook = add_submenu_page( |
221 | - $sRootPageSlug, // the root(parent) page slug |
|
222 | - $sPageTitle, // page title |
|
223 | - $sMenuTitle, // menu title |
|
224 | - $sCapability, // capability |
|
225 | - $sPageSlug, // menu slug |
|
221 | + $sRootPageSlug, // the root(parent) page slug |
|
222 | + $sPageTitle, // page title |
|
223 | + $sMenuTitle, // menu title |
|
224 | + $sCapability, // capability |
|
225 | + $sPageSlug, // menu slug |
|
226 | 226 | // In admin.php ( line 149 of WordPress v3.6.1 ), do_action($page_hook) ( where $page_hook is $_sPageHook ) |
227 | 227 | // will be executed and it triggers the __call() magic method with the method name of "md5 class hash + _page_ + this page slug". |
228 | - array( $this, $this->oProp->sClassHash . '_page_' . $sPageSlug ) |
|
228 | + array( $this, $this->oProp->sClassHash.'_page_'.$sPageSlug ) |
|
229 | 229 | ); |
230 | 230 | |
231 | 231 | // Ensure only it is added one time per page slug. |
232 | - if ( ! isset( $this->oProp->aPageHooks[ $_sPageHook ] ) ) { |
|
232 | + if ( !isset( $this->oProp->aPageHooks[ $_sPageHook ] ) ) { |
|
233 | 233 | // 3.4.1+ Give a lower priority as the page meta box class also hooks the current_screen to register form elements. |
234 | 234 | // When the validation callback is triggered, their form registration should be done already. So this hook should be loaded later than them. |
235 | - add_action( 'current_screen' , array( $this, "load_pre_" . $sPageSlug ), 20 ); |
|
235 | + add_action( 'current_screen', array( $this, "load_pre_".$sPageSlug ), 20 ); |
|
236 | 236 | |
237 | 237 | // 3.6.3+ |
238 | 238 | // It is possible that an in-page tab is added during the above hooks and the current page is the default tab without the tab GET query key in the url. |
239 | 239 | // Set a low priority because the user may add in-page tabs in their callback method of this action hook. |
240 | - add_action( "load_" . $sPageSlug, array( $this, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
240 | + add_action( "load_".$sPageSlug, array( $this, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
241 | 241 | |
242 | 242 | // 3.6.3+ |
243 | - add_action( "load_after_" . $sPageSlug, array( $this, '_replyToEnqueuePageAssets' ) ); |
|
243 | + add_action( "load_after_".$sPageSlug, array( $this, '_replyToEnqueuePageAssets' ) ); |
|
244 | 244 | |
245 | 245 | } |
246 | 246 | $this->oProp->aPageHooks[ $sPageSlug ] = $this->oUtil->getAOrB( |
247 | 247 | is_network_admin(), |
248 | - $_sPageHook . '-network', |
|
248 | + $_sPageHook.'-network', |
|
249 | 249 | $_sPageHook |
250 | 250 | ); |
251 | 251 | |
252 | 252 | // If the visibility option is false, remove the one just added from the sub-menu array |
253 | - if ( ! $bShowInMenu ) { |
|
253 | + if ( !$bShowInMenu ) { |
|
254 | 254 | $this->_removePageSubmenuItem( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ); |
255 | 255 | } |
256 | 256 | return $_sPageHook; |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
264 | 264 | * @return void |
265 | 265 | */ |
266 | - private function _removePageSubmenuItem( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ){ |
|
266 | + private function _removePageSubmenuItem( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) { |
|
267 | 267 | |
268 | - foreach( ( array ) $GLOBALS['submenu'][ $sMenuSlug ] as $_iIndex => $_aSubMenu ) { |
|
268 | + foreach ( ( array ) $GLOBALS[ 'submenu' ][ $sMenuSlug ] as $_iIndex => $_aSubMenu ) { |
|
269 | 269 | |
270 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
270 | + if ( !isset( $_aSubMenu[ 3 ] ) ) { |
|
271 | 271 | continue; |
272 | 272 | } |
273 | 273 | |
@@ -318,15 +318,15 @@ discard block |
||
318 | 318 | |
319 | 319 | // If it is in the network admin area, do not remove the menu; otherwise, it gets not accessible. |
320 | 320 | if ( is_network_admin() ) { |
321 | - unset( $GLOBALS['submenu'][ $sMenuSlug ][ $_iIndex ] ); |
|
321 | + unset( $GLOBALS[ 'submenu' ][ $sMenuSlug ][ $_iIndex ] ); |
|
322 | 322 | return; |
323 | 323 | } |
324 | 324 | |
325 | 325 | if ( |
326 | - ! isset( $_GET['page'] ) |
|
327 | - || isset( $_GET['page'] ) && $sPageSlug != $_GET['page'] |
|
326 | + !isset( $_GET[ 'page' ] ) |
|
327 | + || isset( $_GET[ 'page' ] ) && $sPageSlug != $_GET[ 'page' ] |
|
328 | 328 | ) { |
329 | - unset( $GLOBALS['submenu'][ $sMenuSlug ][ $_iIndex ] ); |
|
329 | + unset( $GLOBALS[ 'submenu' ][ $sMenuSlug ][ $_iIndex ] ); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | } |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | * @return void |
340 | 340 | */ |
341 | 341 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu ) { |
342 | - if ( ! $bShowInMenu ) { |
|
342 | + if ( !$bShowInMenu ) { |
|
343 | 343 | return; |
344 | 344 | } |
345 | - if ( ! isset( $GLOBALS['submenu'][ $sMenuSlug ] ) ) { |
|
346 | - $GLOBALS['submenu'][ $sMenuSlug ] = array(); |
|
345 | + if ( !isset( $GLOBALS[ 'submenu' ][ $sMenuSlug ] ) ) { |
|
346 | + $GLOBALS[ 'submenu' ][ $sMenuSlug ] = array(); |
|
347 | 347 | } |
348 | - $GLOBALS['submenu'][ $sMenuSlug ][] = array ( |
|
348 | + $GLOBALS[ 'submenu' ][ $sMenuSlug ][ ] = array( |
|
349 | 349 | $sTitle, |
350 | 350 | $sCapability, |
351 | 351 | $sHref, |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @internal |
361 | 361 | */ |
362 | 362 | public function _replyToFixPageTitleForHiddenPages( $sAdminTitle, $sPageTitle ) { |
363 | - if ( isset( $_GET['page'], $this->oProp->aHiddenPages[ $_GET['page'] ] ) ) { |
|
364 | - return $this->oProp->aHiddenPages[ $_GET['page'] ] . $sAdminTitle; |
|
363 | + if ( isset( $_GET[ 'page' ], $this->oProp->aHiddenPages[ $_GET[ 'page' ] ] ) ) { |
|
364 | + return $this->oProp->aHiddenPages[ $_GET[ 'page' ] ].$sAdminTitle; |
|
365 | 365 | } |
366 | 366 | return $sAdminTitle; |
367 | 367 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | foreach ( $this->oProp->aPages as $_aPage ) { |
128 | 128 | |
129 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
129 | + if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | $this->oProp->sDefaultPageSlug = $_aPage[ 'page_slug' ]; |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
264 | 264 | * @return void |
265 | 265 | */ |
266 | - private function _removePageSubmenuItem( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ){ |
|
266 | + private function _removePageSubmenuItem( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) { |
|
267 | 267 | |
268 | 268 | foreach( ( array ) $GLOBALS['submenu'][ $sMenuSlug ] as $_iIndex => $_aSubMenu ) { |
269 | 269 | |
270 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
270 | + if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
271 | 271 | continue; |
272 | 272 | } |
273 | 273 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $sPageTitle, |
283 | 283 | $sPageSlug, |
284 | 284 | ); |
285 | - if ( $_aA !== $_aB ) { |
|
285 | + if ( $_aA !== $_aB ) { |
|
286 | 286 | continue; |
287 | 287 | } |
288 | 288 |
@@ -112,6 +112,7 @@ |
||
112 | 112 | * |
113 | 113 | * @internal |
114 | 114 | * @since 3.5.10 |
115 | + * @param string $sMenuKey |
|
115 | 116 | * @return void |
116 | 117 | */ |
117 | 118 | private function _removeAddNewSidebarSubMenu( $sMenuKey, $sPostTypeSlug ) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->_removeAddNewSidebarSubMenu( |
77 | 77 | is_string( $_bsShowInMenu ) |
78 | 78 | ? $_bsShowInMenu |
79 | - : 'edit.php?post_type=' . $this->oProp->sPostType, |
|
79 | + : 'edit.php?post_type='.$this->oProp->sPostType, |
|
80 | 80 | $this->oProp->sPostType |
81 | 81 | ); |
82 | 82 | |
@@ -117,20 +117,20 @@ discard block |
||
117 | 117 | private function _removeAddNewSidebarSubMenu( $sMenuKey, $sPostTypeSlug ) { |
118 | 118 | |
119 | 119 | // Remove the default post type menu item. |
120 | - if ( ! isset( $GLOBALS['submenu'][ $sMenuKey ] ) ) { |
|
120 | + if ( !isset( $GLOBALS[ 'submenu' ][ $sMenuKey ] ) ) { |
|
121 | 121 | // logged-in users of an insufficient access level don't have the menu to be registered. |
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | - foreach ( $GLOBALS['submenu'][ $sMenuKey ] as $_iIndex => $_aSubMenu ) { |
|
125 | + foreach ( $GLOBALS[ 'submenu' ][ $sMenuKey ] as $_iIndex => $_aSubMenu ) { |
|
126 | 126 | |
127 | - if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
127 | + if ( !isset( $_aSubMenu[ 2 ] ) ) { |
|
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Remove the default Add New entry. |
132 | - if ( 'post-new.php?post_type=' . $sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
133 | - unset( $GLOBALS['submenu'][ $sMenuKey ][ $_iIndex ] ); |
|
132 | + if ( 'post-new.php?post_type='.$sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
133 | + unset( $GLOBALS[ 'submenu' ][ $sMenuKey ][ $_iIndex ] ); |
|
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function _replyToAddAuthorTableFilter() { |
147 | 147 | |
148 | - if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
148 | + if ( !$this->oProp->bEnableAuthorTableFileter ) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | 152 | if ( |
153 | - ! ( isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) |
|
154 | - && in_array( strtolower( $_GET['post_type'] ), array( $this->oProp->sPostType ) ) ) |
|
153 | + !( isset( $_GET[ 'post_type' ] ) && post_type_exists( $_GET[ 'post_type' ] ) |
|
154 | + && in_array( strtolower( $_GET[ 'post_type' ] ), array( $this->oProp->sPostType ) ) ) |
|
155 | 155 | ) { |
156 | 156 | return; |
157 | 157 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | 'show_option_all' => $this->oMsg->get( 'show_all_authors' ), |
162 | 162 | 'show_option_none' => false, |
163 | 163 | 'name' => 'author', |
164 | - 'selected' => ! empty( $_GET[ 'author' ] ) |
|
164 | + 'selected' => !empty( $_GET[ 'author' ] ) |
|
165 | 165 | ? $_GET[ 'author' ] |
166 | 166 | : 0, |
167 | 167 | 'include_selected' => false, |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | return; |
188 | 188 | } |
189 | 189 | |
190 | - foreach ( get_object_taxonomies( $GLOBALS['typenow'] ) as $_sTaxonomySulg ) { |
|
190 | + foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $_sTaxonomySulg ) { |
|
191 | 191 | |
192 | - if ( ! in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
192 | + if ( !in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
193 | 193 | continue; |
194 | 194 | } |
195 | 195 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | // Echo the drop down list based on the passed array argument. |
204 | 204 | wp_dropdown_categories( |
205 | 205 | array( |
206 | - 'show_option_all' => $this->oMsg->get( 'show_all' ) . ' ' . $_oTaxonomy->label, |
|
206 | + 'show_option_all' => $this->oMsg->get( 'show_all' ).' '.$_oTaxonomy->label, |
|
207 | 207 | 'taxonomy' => $_sTaxonomySulg, |
208 | 208 | 'name' => $_oTaxonomy->name, |
209 | 209 | 'orderby' => 'name', |
@@ -223,24 +223,24 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @internal |
225 | 225 | */ |
226 | - public function _replyToGetTableFilterQueryForTaxonomies( $oQuery=null ) { |
|
226 | + public function _replyToGetTableFilterQueryForTaxonomies( $oQuery = null ) { |
|
227 | 227 | |
228 | 228 | if ( 'edit.php' != $this->oProp->sPageNow ) { |
229 | 229 | return $oQuery; |
230 | 230 | } |
231 | 231 | |
232 | - if ( ! isset( $GLOBALS['typenow'] ) ) { |
|
232 | + if ( !isset( $GLOBALS[ 'typenow' ] ) ) { |
|
233 | 233 | return $oQuery; |
234 | 234 | } |
235 | 235 | |
236 | - foreach ( get_object_taxonomies( $GLOBALS['typenow'] ) as $sTaxonomySlug ) { |
|
236 | + foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $sTaxonomySlug ) { |
|
237 | 237 | |
238 | - if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
238 | + if ( !in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | |
242 | 242 | $sVar = &$oQuery->query_vars[ $sTaxonomySlug ]; |
243 | - if ( ! isset( $sVar ) ) { |
|
243 | + if ( !isset( $sVar ) ) { |
|
244 | 244 | continue; |
245 | 245 | } |
246 | 246 | |
@@ -268,14 +268,14 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | // If the screen icon url is specified |
271 | - if ( isset( $this->oProp->aPostTypeArgs['screen_icon'] ) && $this->oProp->aPostTypeArgs['screen_icon'] ) { |
|
272 | - $this->oProp->sStyle .= $this->_getStylesForPostTypeScreenIcon( $this->oProp->aPostTypeArgs['screen_icon'] ); |
|
271 | + if ( isset( $this->oProp->aPostTypeArgs[ 'screen_icon' ] ) && $this->oProp->aPostTypeArgs[ 'screen_icon' ] ) { |
|
272 | + $this->oProp->sStyle .= $this->_getStylesForPostTypeScreenIcon( $this->oProp->aPostTypeArgs[ 'screen_icon' ] ); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | $this->oProp->sStyle = $this->oUtil->addAndApplyFilters( $this, "style_{$this->oProp->sClassName}", $this->oProp->sStyle ); |
276 | 276 | |
277 | 277 | // Print out the filtered styles. |
278 | - if ( ! empty( $this->oProp->sStyle ) ) { |
|
278 | + if ( !empty( $this->oProp->sStyle ) ) { |
|
279 | 279 | echo "<style type='text/css' id='admin-page-framework-style-post-type'>" |
280 | 280 | . $this->oProp->sStyle |
281 | 281 | . "</style>"; |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function _replyToFilterPostTypeContent( $sContent ) { |
328 | 328 | |
329 | - if ( ! is_singular() ) { |
|
329 | + if ( !is_singular() ) { |
|
330 | 330 | return $sContent; |
331 | 331 | } |
332 | - if ( ! is_main_query() ) { |
|
332 | + if ( !is_main_query() ) { |
|
333 | 333 | return $sContent; |
334 | 334 | } |
335 | 335 | global $post; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @package AdminPageFramework |
18 | 18 | * @subpackage PostType |
19 | 19 | */ |
20 | -abstract class AdminPageFramework_PostType_View extends AdminPageFramework_PostType_Model { |
|
20 | +abstract class AdminPageFramework_PostType_View extends AdminPageFramework_PostType_Model { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Sets up hooks. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | parent::__construct( $oProp ); |
31 | 31 | |
32 | - if ( $this->_isInThePage() ) { |
|
32 | + if ( $this->_isInThePage() ) { |
|
33 | 33 | |
34 | 34 | // Table filters |
35 | 35 | add_action( 'restrict_manage_posts', array( $this, '_replyToAddAuthorTableFilter' ) ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | foreach ( $GLOBALS['submenu'][ $sMenuKey ] as $_iIndex => $_aSubMenu ) { |
126 | 126 | |
127 | - if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
127 | + if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function _replyToAddAuthorTableFilter() { |
147 | 147 | |
148 | - if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
148 | + if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function _replyToAddTaxonomyTableFilter() { |
179 | 179 | |
180 | - if ( $GLOBALS[ 'typenow' ] != $this->oProp->sPostType ) { |
|
180 | + if ( $GLOBALS[ 'typenow' ] != $this->oProp->sPostType ) { |
|
181 | 181 | return; |
182 | 182 | } |
183 | 183 | |
@@ -225,22 +225,22 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function _replyToGetTableFilterQueryForTaxonomies( $oQuery=null ) { |
227 | 227 | |
228 | - if ( 'edit.php' != $this->oProp->sPageNow ) { |
|
228 | + if ( 'edit.php' != $this->oProp->sPageNow ) { |
|
229 | 229 | return $oQuery; |
230 | 230 | } |
231 | 231 | |
232 | - if ( ! isset( $GLOBALS['typenow'] ) ) { |
|
232 | + if ( ! isset( $GLOBALS['typenow'] ) ) { |
|
233 | 233 | return $oQuery; |
234 | 234 | } |
235 | 235 | |
236 | 236 | foreach ( get_object_taxonomies( $GLOBALS['typenow'] ) as $sTaxonomySlug ) { |
237 | 237 | |
238 | - if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
238 | + if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | |
242 | 242 | $sVar = &$oQuery->query_vars[ $sTaxonomySlug ]; |
243 | - if ( ! isset( $sVar ) ) { |
|
243 | + if ( ! isset( $sVar ) ) { |
|
244 | 244 | continue; |
245 | 245 | } |
246 | 246 |
@@ -24,6 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @since 3.2.0 |
26 | 26 | * @internal |
27 | + * @param AdminPageFramework_Property_Widget $oProp |
|
27 | 28 | */ |
28 | 29 | function __construct( $oProp ) { |
29 | 30 |
@@ -44,22 +44,22 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | - * The method for necessary set-ups. |
|
48 | - * |
|
49 | - * <h4>Example</h4> |
|
50 | - * <code> |
|
51 | - * public function setUp() { |
|
52 | - * $this->setArguments( |
|
53 | - * array( |
|
54 | - * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
55 | - * ) |
|
56 | - * ); |
|
57 | - * } |
|
58 | - * </code> |
|
59 | - * |
|
60 | - * @abstract |
|
61 | - * @since 3.2.0 |
|
62 | - */ |
|
47 | + * The method for necessary set-ups. |
|
48 | + * |
|
49 | + * <h4>Example</h4> |
|
50 | + * <code> |
|
51 | + * public function setUp() { |
|
52 | + * $this->setArguments( |
|
53 | + * array( |
|
54 | + * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
55 | + * ) |
|
56 | + * ); |
|
57 | + * } |
|
58 | + * </code> |
|
59 | + * |
|
60 | + * @abstract |
|
61 | + * @since 3.2.0 |
|
62 | + */ |
|
63 | 63 | public function setUp() {} |
64 | 64 | |
65 | 65 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @since 3.2.0 |
151 | 151 | * @internal Temporarily marked internal |
152 | 152 | */ |
153 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
153 | + public function enqueueStyles( $aSRCs, $aCustomArgs = array() ) { |
|
154 | 154 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
155 | 155 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
156 | 156 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @since 3.2.0 |
164 | 164 | * @internal Temporarily marked internal |
165 | 165 | */ |
166 | - public function enqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
166 | + public function enqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
167 | 167 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
168 | 168 | return $this->oResource->_enqueueStyle( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
169 | 169 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @since 3.2.0 |
177 | 177 | * @internal Temporarily marked internal |
178 | 178 | */ |
179 | - public function enqueueScripts( $aSRCs, $aCustomArgs=array() ) { |
|
179 | + public function enqueueScripts( $aSRCs, $aCustomArgs = array() ) { |
|
180 | 180 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
181 | 181 | return $this->oResource->_enqueueScripts( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
182 | 182 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @since 3.2.0 |
190 | 190 | * @internal Temporarily marked internal |
191 | 191 | */ |
192 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
192 | + public function enqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
193 | 193 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
194 | 194 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
195 | 195 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @since 3.2.0 |
204 | 204 | * @return void |
205 | 205 | */ |
206 | - protected function setArguments( array $aArguments=array() ) { |
|
206 | + protected function setArguments( array $aArguments = array() ) { |
|
207 | 207 | $this->oProp->aWidgetArguments = $aArguments; |
208 | 208 | } |
209 | 209 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @package AdminPageFramework |
18 | 18 | * @subpackage Widget |
19 | 19 | */ |
20 | -abstract class AdminPageFramework_Widget_Controller extends AdminPageFramework_Widget_View { |
|
20 | +abstract class AdminPageFramework_Widget_Controller extends AdminPageFramework_Widget_View { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Sets up hooks and properties. |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | // Other admin page framework factory classes uses wp_loaded hook but widget_init hook is called before that. |
35 | 35 | // So we use widgets_init hook for this factory. |
36 | - if ( did_action( 'widgets_init' ) ) { // For the activation hook. |
|
36 | + if ( did_action( 'widgets_init' ) ) { |
|
37 | +// For the activation hook. |
|
37 | 38 | $this->setup_pre(); |
38 | 39 | } { |
39 | 40 | add_action( 'widgets_init', array( $this, 'setup_pre' ) ); |
@@ -150,7 +151,7 @@ discard block |
||
150 | 151 | * @since 3.2.0 |
151 | 152 | * @internal Temporarily marked internal |
152 | 153 | */ |
153 | - public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
154 | + public function enqueueStyles( $aSRCs, $aCustomArgs=array() ) { |
|
154 | 155 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
155 | 156 | return $this->oResource->_enqueueStyles( $aSRCs, array( $this->oProp->sPostType ), $aCustomArgs ); |
156 | 157 | } |
@@ -189,7 +190,7 @@ discard block |
||
189 | 190 | * @since 3.2.0 |
190 | 191 | * @internal Temporarily marked internal |
191 | 192 | */ |
192 | - public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
193 | + public function enqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
193 | 194 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
194 | 195 | return $this->oResource->_enqueueScript( $sSRC, array( $this->oProp->sPostType ), $aCustomArgs ); |
195 | 196 | } |
@@ -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() ) { |
@@ -25,21 +25,21 @@ discard block |
||
25 | 25 | * @since 3.2.0 |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
28 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
29 | 29 | |
30 | 30 | $aArguments = $aArguments |
31 | 31 | + array( |
32 | 32 | 'classname' => 'admin_page_framework_widget', |
33 | 33 | 'description' => '', |
34 | 34 | ); |
35 | - parent::__construct( |
|
35 | + parent::__construct( |
|
36 | 36 | $oCaller->oProp->sClassName, // base id |
37 | 37 | $sWidgetTitle, // widget title |
38 | 38 | $aArguments // widget arguments |
39 | 39 | ); |
40 | 40 | $this->oCaller = $oCaller; |
41 | 41 | |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Displays the widget contents in the front end. |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * whether the title should be visible or not depending on the content. |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function widget( $aArguments, $aFormData ) { |
|
52 | + public function widget( $aArguments, $aFormData ) { |
|
53 | 53 | |
54 | 54 | echo $aArguments[ 'before_widget' ]; |
55 | 55 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | echo $_sContent; |
74 | 74 | |
75 | - echo $aArguments[ 'after_widget' ]; |
|
75 | + echo $aArguments[ 'after_widget' ]; |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | /** |
79 | 79 | * Returns the widget title. |
80 | 80 | * |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if ( ! $_sTitle ) { |
104 | 104 | return ''; |
105 | 105 | } |
106 | - return $aArguments['before_title'] |
|
106 | + return $aArguments['before_title'] |
|
107 | 107 | . $_sTitle |
108 | 108 | . $aArguments['after_title']; |
109 | 109 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @since 3.2.0 |
116 | 116 | * @return mixed The validated form data. The type should be an array but it is dealt by the framework user it will be unknown. |
117 | 117 | */ |
118 | - public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
118 | + public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
119 | 119 | |
120 | 120 | return $this->oCaller->oUtil->addAndApplyFilters( |
121 | 121 | $this->oCaller, |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | $this->oCaller |
129 | 129 | ); |
130 | 130 | |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Constructs the widget form. |
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | - public function form( $aFormData ) { |
|
138 | + public function form( $aFormData ) { |
|
139 | 139 | |
140 | 140 | // Trigger the load() method and load_{...} actions. The user sets up the form. |
141 | 141 | $this->oCaller->load( $this->oCaller ); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // $this->oCaller |
194 | 194 | // ); |
195 | 195 | |
196 | - } |
|
196 | + } |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @since 3.2.0 |
25 | 25 | * @return void |
26 | 26 | */ |
27 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
27 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments = array() ) { |
|
28 | 28 | |
29 | 29 | $aArguments = $aArguments |
30 | 30 | + array( |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | 'description' => '', |
33 | 33 | ); |
34 | 34 | parent::__construct( |
35 | - $oCaller->oProp->sClassName, // base id |
|
36 | - $sWidgetTitle, // widget title |
|
35 | + $oCaller->oProp->sClassName, // base id |
|
36 | + $sWidgetTitle, // widget title |
|
37 | 37 | $aArguments // widget arguments |
38 | 38 | ); |
39 | 39 | $this->oCaller = $oCaller; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->oCaller->oUtil->addAndDoActions( |
56 | 56 | $this->oCaller, |
57 | - 'do_' . $this->oCaller->oProp->sClassName, |
|
57 | + 'do_'.$this->oCaller->oProp->sClassName, |
|
58 | 58 | $this->oCaller |
59 | 59 | ); |
60 | 60 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | private function _getTitle( array $aArguments, array $aFormData ) { |
87 | 87 | |
88 | - if ( ! $this->oCaller->oProp->bShowWidgetTitle ) { |
|
88 | + if ( !$this->oCaller->oProp->bShowWidgetTitle ) { |
|
89 | 89 | return ''; |
90 | 90 | } |
91 | 91 | |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | $aFormData, |
100 | 100 | $this->id_base |
101 | 101 | ); |
102 | - if ( ! $_sTitle ) { |
|
102 | + if ( !$_sTitle ) { |
|
103 | 103 | return ''; |
104 | 104 | } |
105 | - return $aArguments['before_title'] |
|
105 | + return $aArguments[ 'before_title' ] |
|
106 | 106 | . $_sTitle |
107 | - . $aArguments['after_title']; |
|
107 | + . $aArguments[ 'after_title' ]; |
|
108 | 108 | |
109 | 109 | } |
110 | 110 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->oCaller, |
121 | 121 | "validation_{$this->oCaller->oProp->sClassName}", |
122 | 122 | call_user_func_array( |
123 | - array( $this->oCaller, 'validate' ), // triggers __call() |
|
123 | + array( $this->oCaller, 'validate' ), // triggers __call() |
|
124 | 124 | array( $aSubmittedFormData, $aSavedFormData, $this->oCaller ) // parameters |
125 | 125 | ), // 3.5.3+ |
126 | 126 | $aSavedFormData, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $this->oCaller->load( $this->oCaller ); |
141 | 141 | $this->oCaller->oUtil->addAndDoActions( |
142 | 142 | $this->oCaller, |
143 | - 'load_' . $this->oCaller->oProp->sClassName, |
|
143 | + 'load_'.$this->oCaller->oProp->sClassName, |
|
144 | 144 | $this->oCaller |
145 | 145 | ); |
146 | 146 | |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | |
150 | 150 | // Set up callbacks for field element outputs such as for name and it attributes. |
151 | 151 | $this->oCaller->oProp->aFieldCallbacks = array( |
152 | - 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
153 | - 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
154 | - 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
152 | + 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
153 | + 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
154 | + 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
155 | 155 | 'hfInputName' => array( $this, '_replyToGetFieldInputName' ), |
156 | 156 | // 'hfClass' => array( $this, '_replyToAddClassSelector' ), |
157 | 157 | // 'hfNameFlat' => array( $this, '_replyToGetFlatFieldName' ), // @deprecated 3.6.0+ the same as the framework factory method. |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | $_aParams = func_get_args() + array( null, null, null ); |
186 | 186 | $aField = $_aParams[ 1 ]; |
187 | 187 | |
188 | - $_sSectionIndex = isset( $aField['section_id'], $aField['_section_index'] ) |
|
189 | - ? "[{$aField['_section_index']}]" |
|
188 | + $_sSectionIndex = isset( $aField[ 'section_id' ], $aField[ '_section_index' ] ) |
|
189 | + ? "[{$aField[ '_section_index' ]}]" |
|
190 | 190 | : ""; |
191 | 191 | $_sID = $this->oCaller->isSectionSet( $aField ) |
192 | - ? $aField['section_id'] . "]" . $_sSectionIndex . "[" . $aField[ 'field_id' ] |
|
193 | - : $aField['field_id']; |
|
192 | + ? $aField[ 'section_id' ]."]".$_sSectionIndex."[".$aField[ 'field_id' ] |
|
193 | + : $aField[ 'field_id' ]; |
|
194 | 194 | return $this->get_field_name( $_sID ); |
195 | 195 | |
196 | 196 | } |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | $_sIndex = $this->oCaller->oUtil->getAOrB( |
210 | 210 | '0' !== $sIndex && empty( $sIndex ), |
211 | 211 | '', |
212 | - "[" . $sIndex . "]" |
|
212 | + "[".$sIndex."]" |
|
213 | 213 | ); |
214 | - $_sSectionIndex = isset( $aField['section_id'], $aField['_section_index'] ) |
|
215 | - ? "[{$aField['_section_index']}]" |
|
214 | + $_sSectionIndex = isset( $aField[ 'section_id' ], $aField[ '_section_index' ] ) |
|
215 | + ? "[{$aField[ '_section_index' ]}]" |
|
216 | 216 | : ""; |
217 | 217 | $_sID = $this->oCaller->isSectionSet( $aField ) |
218 | - ? $aField['section_id'] . "]" . $_sSectionIndex . "[" . $aField[ 'field_id' ] |
|
218 | + ? $aField[ 'section_id' ]."]".$_sSectionIndex."[".$aField[ 'field_id' ] |
|
219 | 219 | : $aField[ 'field_id' ]; |
220 | - return $this->get_field_name( $_sID ) . $_sIndex; |
|
220 | + return $this->get_field_name( $_sID ).$_sIndex; |
|
221 | 221 | |
222 | 222 | } |
223 | 223 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * @param string $sPluginFilePath The plugin file path. |
39 | 39 | * @param string $sPluginHookPrefix The plugin hook slug without underscore. This will be used to construct hook names. |
40 | 40 | * @param string $sSetUpHook The action hook name for the setUp callback. Default 'plugins_loaded'. |
41 | - * @param string $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
|
41 | + * @param integer $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
|
42 | 42 | */ |
43 | 43 | public function __construct( $sPluginFilePath, $sPluginHookPrefix='', $sSetUpHook='plugins_loaded', $iPriority=10 ) { |
44 | 44 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param string $sSetUpHook The action hook name for the setUp callback. Default 'plugins_loaded'. |
41 | 41 | * @param string $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
42 | 42 | */ |
43 | - public function __construct( $sPluginFilePath, $sPluginHookPrefix='', $sSetUpHook='plugins_loaded', $iPriority=10 ) { |
|
43 | + public function __construct( $sPluginFilePath, $sPluginHookPrefix = '', $sSetUpHook = 'plugins_loaded', $iPriority = 10 ) { |
|
44 | 44 | |
45 | 45 | // Check if it has been loaded. |
46 | 46 | if ( $this->_hasLoaded() ) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | register_deactivation_hook( $this->sFilePath, array( $this, 'replyToPluginDeactivation' ) ); |
77 | 77 | |
78 | 78 | // 8. Schedule to load plugin specific components. |
79 | - if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
79 | + if ( !$this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
80 | 80 | $this->_replyToLoadPluginComponents(); |
81 | 81 | } else { |
82 | 82 | add_action( $this->sSetUpHook, array( $this, '_replyToLoadPluginComponents' ), $this->iPriority ); |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function _registerClasses() { |
115 | 115 | |
116 | - if ( ! class_exists( 'AdminPageFramework_RegisterClasses' ) ) { |
|
116 | + if ( !class_exists( 'AdminPageFramework_RegisterClasses' ) ) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | // Register classes |
120 | 120 | new AdminPageFramework_RegisterClasses( |
121 | - $this->getScanningDirs(), // scanning directory paths |
|
122 | - array(), // autoloader options |
|
121 | + $this->getScanningDirs(), // scanning directory paths |
|
122 | + array(), // autoloader options |
|
123 | 123 | $this->getClasses() // pre-generated class list |
124 | 124 | ); |
125 | 125 |
@@ -76,7 +76,7 @@ |
||
76 | 76 | register_deactivation_hook( $this->sFilePath, array( $this, 'replyToPluginDeactivation' ) ); |
77 | 77 | |
78 | 78 | // 8. Schedule to load plugin specific components. |
79 | - if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
79 | + if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
80 | 80 | $this->_replyToLoadPluginComponents(); |
81 | 81 | } else { |
82 | 82 | add_action( $this->sSetUpHook, array( $this, '_replyToLoadPluginComponents' ), $this->iPriority ); |
@@ -134,6 +134,7 @@ discard block |
||
134 | 134 | * Returns a php warning if present. |
135 | 135 | * @since 3.5.3 |
136 | 136 | * @internal |
137 | + * @param string $sType |
|
137 | 138 | * @return string The warning. |
138 | 139 | */ |
139 | 140 | private function _getWarningByType( $sType ) { |
@@ -226,6 +227,7 @@ discard block |
||
226 | 227 | * if it returns non true (false), it stores the subject warning and returns the array holding the warnings. |
227 | 228 | * |
228 | 229 | * @since 3.4.6 |
230 | + * @param string $sFuncName |
|
229 | 231 | * @return array The warning array. |
230 | 232 | */ |
231 | 233 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
@@ -285,6 +287,7 @@ discard block |
||
285 | 287 | /** |
286 | 288 | * Deactivates the plugin. |
287 | 289 | * @since 3.4.6 |
290 | + * @param string $sPluginFilePath |
|
288 | 291 | */ |
289 | 292 | public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
290 | 293 |
@@ -278,7 +278,7 @@ |
||
278 | 278 | ? "<strong>" . $this->_sScriptName . "</strong>: " |
279 | 279 | : ''; |
280 | 280 | return $_sScripTitle |
281 | - . implode( '<br />', $_aWarnings ); |
|
281 | + . implode( '<br />', $_aWarnings ); |
|
282 | 282 | |
283 | 283 | } |
284 | 284 |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @since 3.4.6 |
78 | 78 | */ |
79 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
79 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
80 | 80 | |
81 | 81 | // Avoid undefined index warnings. |
82 | 82 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
83 | 83 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
84 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
84 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
85 | 85 | if ( isset( $aRequirements[ $_sName ] ) ) { |
86 | 86 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
87 | 87 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | $_aWarnings = array(); |
106 | 106 | |
107 | 107 | // PHP, WordPress, MySQL |
108 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
109 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
110 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
108 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
109 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
110 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
111 | 111 | |
112 | 112 | // Ensure necessary array elements. |
113 | 113 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | // Check the rest. |
121 | 121 | $_aWarnings = array_merge( |
122 | 122 | $_aWarnings, |
123 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
124 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
125 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
126 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
123 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
124 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
125 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
126 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return string The warning. |
138 | 138 | */ |
139 | 139 | private function _getWarningByType( $sType ) { |
140 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
140 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
141 | 141 | return ''; |
142 | 142 | } |
143 | 143 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @since 3.4.6 |
165 | 165 | */ |
166 | 166 | private function _checkWordPressVersion( $sWordPressVersion ) { |
167 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
167 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
232 | 232 | $_aWarnings = array(); |
233 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
234 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
235 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
233 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
234 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
235 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | return $_aWarnings; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function _replyToPrintAdminNotices() { |
254 | 254 | |
255 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
255 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
256 | 256 | if ( empty( $_aWarnings ) ) { |
257 | 257 | return; |
258 | 258 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | */ |
271 | 271 | private function _getWarnings() { |
272 | 272 | |
273 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
273 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
274 | 274 | if ( empty( $_aWarnings ) ) { |
275 | 275 | return ''; |
276 | 276 | } |
277 | - $_sScripTitle = $this->_sScriptName |
|
278 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
277 | + $_sScripTitle = $this->_sScriptName |
|
278 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
279 | 279 | : ''; |
280 | 280 | return $_sScripTitle |
281 | 281 | . implode( '<br />', $_aWarnings ); |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | * Deactivates the plugin. |
287 | 287 | * @since 3.4.6 |
288 | 288 | */ |
289 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
289 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
290 | 290 | |
291 | 291 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
292 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
293 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
294 | - if ( ! @include( ABSPATH . '/wp-admin/includes/plugin.php' ) ) { |
|
292 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
293 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
294 | + if ( !@include( ABSPATH.'/wp-admin/includes/plugin.php' ) ) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 | } |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | // Before that, we can display messages to the user. |
302 | 302 | if ( $bIsOnActivation ) { |
303 | 303 | |
304 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
305 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
304 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
305 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
306 | 306 | |
307 | 307 | } |
308 | 308 |
@@ -100,7 +100,7 @@ |
||
100 | 100 | * @since 3.4.6 |
101 | 101 | * @return integer The number of warnings. |
102 | 102 | */ |
103 | - public function check() { |
|
103 | + public function check() { |
|
104 | 104 | |
105 | 105 | $_aWarnings = array(); |
106 | 106 |
@@ -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 ); |
@@ -37,7 +37,7 @@ |
||
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, |
@@ -257,6 +257,7 @@ discard block |
||
257 | 257 | * Generates the framework zip data. |
258 | 258 | * |
259 | 259 | * @since 3.5.4 |
260 | + * @param string $sFrameworkDirPath |
|
260 | 261 | * @return string The binary zip data. |
261 | 262 | */ |
262 | 263 | private function _getDownloadFrameworkZipFile( $sFrameworkDirPath, $sDestinationPath ) { |
@@ -308,11 +309,7 @@ discard block |
||
308 | 309 | * |
309 | 310 | * @since 3.5.4 |
310 | 311 | * @remark string $sPath The path to check. It can be a directory or a file. |
311 | - * @param string $sPathInArchive The parsing directory path set to the archive. |
|
312 | - * The passed path for the archive has a trailing slash. It starts with a directory name. |
|
313 | - * e.g. |
|
314 | - * `utility/AdminPageFramework_WPReadmeParser/` |
|
315 | - * `factory/widget/model/` |
|
312 | + * @param string $sPath |
|
316 | 313 | * @return boolean |
317 | 314 | */ |
318 | 315 | private function _isAllowedArchivePath( $sPath ) { |
@@ -567,6 +564,7 @@ discard block |
||
567 | 564 | * Modifies the text domain in the given file contents. |
568 | 565 | * |
569 | 566 | * @since 3.5.4 |
567 | + * @param string $sFileContents |
|
570 | 568 | * @return string |
571 | 569 | */ |
572 | 570 | private function _modifyTextDomain( $sFileContents ) { |
@@ -585,6 +583,7 @@ discard block |
||
585 | 583 | * Retrieves the value from the $_POST array by the given field ID. |
586 | 584 | * |
587 | 585 | * @since 3.5.4 |
586 | + * @param string $sFieldID |
|
588 | 587 | * @return string |
589 | 588 | */ |
590 | 589 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->oFactory = $oFactory; |
31 | 31 | |
32 | 32 | add_action( |
33 | - 'export_name_' . $this->sPageSlug . '_' . $this->sTabSlug, |
|
33 | + 'export_name_'.$this->sPageSlug.'_'.$this->sTabSlug, |
|
34 | 34 | array( $this, 'replyToFilterFileName' ), |
35 | 35 | 10, |
36 | 36 | 5 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | 'title' => __( 'Class Prefix', 'admin-page-framework-loader' ), |
77 | 77 | 'type' => 'text', |
78 | 78 | 'description' => __( 'Set alphanumeric characters for the class names.', 'admin-page-framework-loader' ) |
79 | - . ' ' . __( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
79 | + . ' '.__( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
80 | 80 | . ' e.g.<code>MyPluginName_</code>', |
81 | 81 | 'attributes' => array( |
82 | 82 | 'size' => 30, |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | 'label_min_width' => 0, |
127 | 127 | 'order' => 100, |
128 | 128 | 'value' => __( 'Download', 'adimn-page-framework-demo' ), |
129 | - 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
130 | - 'format' => 'text', // 'json', 'text', 'array' |
|
129 | + 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
130 | + 'format' => 'text', // 'json', 'text', 'array' |
|
131 | 131 | 'description' => $oFactory->oUtil->getAOrB( |
132 | 132 | class_exists( 'ZipArchive' ), |
133 | 133 | __( 'Download the compiled framework files as a zip file.', 'admin-page-framework-loader' ), |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | |
182 | 182 | // the class prefix must not contain white spaces and some other characters not supported in PHP class names. |
183 | 183 | preg_match( |
184 | - '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
185 | - $aInput[ 'class_prefix' ], // subject |
|
184 | + '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
185 | + $aInput[ 'class_prefix' ], // subject |
|
186 | 186 | $_aMatches |
187 | 187 | ); |
188 | 188 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | $_bVerified = false; |
191 | 191 | } |
192 | 192 | |
193 | - if ( ! $aInput[ 'text_domain' ] ) { |
|
193 | + if ( !$aInput[ 'text_domain' ] ) { |
|
194 | 194 | $_aErrors[ 'text_domain' ] = __( 'The text domain cannot be empty.', 'admin-page-framework-loader' ); |
195 | 195 | $_bVerified = false; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // An invalid value is found. Set a field error array and an admin notice and return the old values. |
199 | - if ( ! $_bVerified ) { |
|
199 | + if ( !$_bVerified ) { |
|
200 | 200 | $oAdminPage->setFieldErrors( $_aErrors ); |
201 | 201 | $oAdminPage->setSettingNotice( __( 'There was something wrong with your input.', 'admin-page-framework-loader' ) ); |
202 | 202 | return $aOldInput; |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function replyToDownloadFramework( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
240 | 240 | |
241 | - $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/admin-page-framework'; |
|
242 | - if ( ! file_exists( $_sFrameworkDirPath ) ) { |
|
241 | + $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/admin-page-framework'; |
|
242 | + if ( !file_exists( $_sFrameworkDirPath ) ) { |
|
243 | 243 | return $aSavedData; |
244 | 244 | } |
245 | 245 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $_sFrameworkDirPath, |
249 | 249 | $_sTempFile |
250 | 250 | ); |
251 | - header( "Content-Length: " . strlen( $_sData ) ); |
|
251 | + header( "Content-Length: ".strlen( $_sData ) ); |
|
252 | 252 | unlink( $_sTempFile ); |
253 | 253 | return $_sData; |
254 | 254 | |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | $sFrameworkDirPath, |
266 | 266 | $sDestinationPath, |
267 | 267 | array( |
268 | - 'include_directory' => false, // wrap contents in a sub-directory |
|
268 | + 'include_directory' => false, // wrap contents in a sub-directory |
|
269 | 269 | 'additional_source_directories' => apply_filters( |
270 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_additional_source_directories', |
|
270 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_additional_source_directories', |
|
271 | 271 | array() // directory paths |
272 | 272 | ), |
273 | 273 | ), |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | ) |
279 | 279 | ); |
280 | 280 | $_bSucceed = $_oZip->compress(); |
281 | - if ( ! $_bSucceed ) { |
|
281 | + if ( !$_bSucceed ) { |
|
282 | 282 | return ''; |
283 | 283 | } |
284 | 284 | return file_get_contents( $sDestinationPath ); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | // Check if it belongs to selected components. |
300 | 300 | if ( false === $this->_isAllowedArchivePath( $sPathInArchive ) ) { |
301 | - return ''; // empty value will drop the entry |
|
301 | + return ''; // empty value will drop the entry |
|
302 | 302 | } |
303 | 303 | return $sPathInArchive; |
304 | 304 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | private function _isAllowedArchivePath( $sPath ) { |
319 | 319 | |
320 | - foreach( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
320 | + foreach ( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
321 | 321 | $_bHasPrefix = $this->oFactory->oUtil->hasPrefix( |
322 | 322 | ltrim( $_sDisallowedPath, '/' ), // needle |
323 | 323 | ltrim( $sPath, '/' ) // haystack |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | // List paths. |
387 | 387 | $_aAllComponentsPaths = array(); |
388 | 388 | $_aSelectedComponentsPaths = array(); |
389 | - foreach( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
389 | + foreach ( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
390 | 390 | |
391 | 391 | // Extract all component paths. |
392 | 392 | $_aAllComponentsPaths = array_merge( |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | public function _replyToModifyFileContents( $sFileContents, $sPathInArchive ) { |
441 | 441 | |
442 | 442 | $sFileContents = apply_filters( |
443 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_file_contents', |
|
443 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_file_contents', |
|
444 | 444 | $sFileContents, |
445 | 445 | $sPathInArchive, |
446 | 446 | $this->oFactory->oUtil->getElement( |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | ); |
455 | 455 | |
456 | 456 | // Check the file extension. |
457 | - if ( ! in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), array( 'php', 'css', 'js' ) ) ) { |
|
457 | + if ( !in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), array( 'php', 'css', 'js' ) ) ) { |
|
458 | 458 | return $sFileContents; |
459 | 459 | } |
460 | 460 | |
@@ -506,12 +506,12 @@ discard block |
||
506 | 506 | $this->_getCheckedComponents() |
507 | 507 | ); |
508 | 508 | $_aInsert = array( |
509 | - 'Included Components: ' . implode( ', ', $_aCheckedComponents ), |
|
510 | - 'Generated on ' . date( 'Y-m-d' ), // today's date |
|
509 | + 'Included Components: '.implode( ', ', $_aCheckedComponents ), |
|
510 | + 'Generated on '.date( 'Y-m-d' ), // today's date |
|
511 | 511 | ); |
512 | 512 | return preg_replace( |
513 | 513 | '#\*/#', // needle - matches '*/' |
514 | - implode( PHP_EOL . ' ', $_aInsert ) . ' \0', // replacement \0 is a back-reference to '*/' |
|
514 | + implode( PHP_EOL.' ', $_aInsert ).' \0', // replacement \0 is a back-reference to '*/' |
|
515 | 515 | $sFileContents, // subject |
516 | 516 | 1 // replace only the first occurrence |
517 | 517 | ); |
@@ -525,14 +525,14 @@ discard block |
||
525 | 525 | private function _modifyClassNameOfInclusionList( $sFileContents ) { |
526 | 526 | // Replace the array key names. |
527 | 527 | $sFileContents = preg_replace_callback( |
528 | - '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
529 | - array( $this, '_replyToModifyPathName' ), // callable |
|
528 | + '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
529 | + array( $this, '_replyToModifyPathName' ), // callable |
|
530 | 530 | $sFileContents // subject |
531 | 531 | ); |
532 | 532 | // Replace the registry class names. |
533 | 533 | return preg_replace_callback( |
534 | - '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
535 | - array( $this, '_replyToModifyPathName' ), // callable |
|
534 | + '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
535 | + array( $this, '_replyToModifyPathName' ), // callable |
|
536 | 536 | $sFileContents // subject |
537 | 537 | ); |
538 | 538 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | return strlen( $_sPrefix ) |
558 | 558 | ? str_replace( |
559 | 559 | 'AdminPageFramework', // search |
560 | - $_sPrefix . 'AdminPageFramework', // replace |
|
560 | + $_sPrefix.'AdminPageFramework', // replace |
|
561 | 561 | $sSubject // subject |
562 | 562 | ) |
563 | 563 | : $sSubject; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | */ |
590 | 590 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
591 | 591 | |
592 | - static $_aCaches=array(); |
|
592 | + static $_aCaches = array(); |
|
593 | 593 | $_aCaches[ $sFieldID ] = isset( $_aCaches[ $sFieldID ] ) |
594 | 594 | ? $_aCaches[ $sFieldID ] |
595 | 595 | : $this->oFactory->oUtil->getElement( |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | 'public', |
624 | 624 | ), |
625 | 625 | 'Content-Description' => 'File Transfer', |
626 | - 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
626 | + 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
627 | 627 | 'Content-Transfer-Encoding' => 'binary', |
628 | - 'Content-Disposition' => 'attachment; filename="' . $sFileName .'";', |
|
628 | + 'Content-Disposition' => 'attachment; filename="'.$sFileName.'";', |
|
629 | 629 | // 'Content-Length' => strlen( $mData ), |
630 | 630 | ) + $aHeader; |
631 | 631 | |
@@ -662,10 +662,10 @@ discard block |
||
662 | 662 | $_sFileNameWOExtension = trim( $_sFileNameWOExtension ); |
663 | 663 | return $this->oFactory->oUtil->getAOrB( |
664 | 664 | $_sFileNameWOExtension, |
665 | - $_sFileNameWOExtension . '-admin-page-framework', |
|
665 | + $_sFileNameWOExtension.'-admin-page-framework', |
|
666 | 666 | 'admin-page-framework' |
667 | 667 | ) |
668 | - . '.' . AdminPageFramework_Registry::VERSION |
|
668 | + . '.'.AdminPageFramework_Registry::VERSION |
|
669 | 669 | . '.zip'; |
670 | 670 | |
671 | 671 | } |
@@ -168,7 +168,7 @@ |
||
168 | 168 | * ) |
169 | 169 | * </code> |
170 | 170 | */ |
171 | - public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
171 | + public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
172 | 172 | |
173 | 173 | return isset( |
174 | 174 | $_POST[ $this->oFactory->oProp->sOptionKey ][ $this->sSectionID ][ 'minified_script_name' ] |
@@ -139,6 +139,7 @@ |
||
139 | 139 | * Modifies the class names of the minified script. |
140 | 140 | * |
141 | 141 | * @since 3.4.6 |
142 | + * @param string $sCode |
|
142 | 143 | */ |
143 | 144 | private function _modifyClassNames( $sCode ) { |
144 | 145 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 4 |
27 | 27 | ); |
28 | 28 | add_action( |
29 | - 'export_name_' . $this->sPageSlug . '_' . $this->sTabSlug, |
|
29 | + 'export_name_'.$this->sPageSlug.'_'.$this->sTabSlug, |
|
30 | 30 | array( $this, 'replyToFilterFileName' ), 10, 5 |
31 | 31 | ); |
32 | 32 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'title' => __( 'Class Prefix', 'admin-page-framework-loader' ), |
42 | 42 | 'type' => 'text', |
43 | 43 | 'description' => __( 'Set alphanumeric characters for the class names', 'admin-page-framework-loader' ) |
44 | - . ' ' . __( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
44 | + . ' '.__( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
45 | 45 | . ' e.g.<code>MyPluginName_</code>', |
46 | 46 | 'attributes' => array( |
47 | 47 | 'size' => 30, |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | 'type' => 'export', |
69 | 69 | 'label_min_width' => 0, |
70 | 70 | 'value' => __( 'Download', 'adimn-page-framework-demo' ), |
71 | - 'file_name' => 'admin-page-framework.min.php', // the default file name. This will be modified by the filter. |
|
72 | - 'format' => 'text', // 'json', 'text', 'array' |
|
71 | + 'file_name' => 'admin-page-framework.min.php', // the default file name. This will be modified by the filter. |
|
72 | + 'format' => 'text', // 'json', 'text', 'array' |
|
73 | 73 | 'description' => __( 'Download the minified version.', 'admin-page-framework-loader' ), |
74 | 74 | ) |
75 | 75 | ); |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
102 | 102 | |
103 | 103 | // $variable[ 'sectioni_id' ]['field_id'] |
104 | - $_aErrors['class_prefix'] = __( 'The prefix must consist of alphanumeric with underscores.', 'admin-page-framework-loader' ); |
|
104 | + $_aErrors[ 'class_prefix' ] = __( 'The prefix must consist of alphanumeric with underscores.', 'admin-page-framework-loader' ); |
|
105 | 105 | $_bVerified = false; |
106 | 106 | |
107 | 107 | } |
108 | 108 | |
109 | 109 | /* 4. An invalid value is found. */ |
110 | - if ( ! $_bVerified ) { |
|
110 | + if ( !$_bVerified ) { |
|
111 | 111 | |
112 | 112 | /* 4-1. Set the error array for the input fields. */ |
113 | 113 | $oAdminPage->setFieldErrors( $_aErrors ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function replyToDownloadMinifiedVersion( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
130 | 130 | |
131 | - $_sMinifiedVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/admin-page-framework.min.php'; |
|
131 | + $_sMinifiedVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/admin-page-framework.min.php'; |
|
132 | 132 | if ( file_exists( $_sMinifiedVersionPath ) ) { |
133 | 133 | return $this->_modifyClassNames( file_get_contents( $_sMinifiedVersionPath ) ); |
134 | 134 | } |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | : ''; |
148 | 148 | |
149 | 149 | return str_replace( |
150 | - 'AdminPageFramework', // search |
|
151 | - $_sPrefix . 'AdminPageFramework', // replace |
|
150 | + 'AdminPageFramework', // search |
|
151 | + $_sPrefix.'AdminPageFramework', // replace |
|
152 | 152 | $sCode // subject |
153 | 153 | ); |
154 | 154 |
@@ -168,7 +168,7 @@ |
||
168 | 168 | * ) |
169 | 169 | * </code> |
170 | 170 | */ |
171 | - public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
171 | + public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
172 | 172 | |
173 | 173 | return isset( |
174 | 174 | $_POST[ $this->oFactory->oProp->sOptionKey ][ $this->sSectionID ][ 'minified_script_name' ] |