@@ -92,7 +92,7 @@ |
||
| 92 | 92 | protected function _getFormattedSubMenuLinkArray( array $aSubMenuLink ) { |
| 93 | 93 | |
| 94 | 94 | // If the set URL is not valid, return. |
| 95 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 95 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 96 | 96 | return array(); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function _replyToEnableMetaBox() { |
| 53 | 53 | |
| 54 | - if ( ! $this->_isMetaBoxAdded() ) { |
|
| 54 | + if ( !$this->_isMetaBoxAdded() ) { |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $_sCurrentScreenID = $this->getCurrentScreenID(); |
|
| 58 | + $_sCurrentScreenID = $this->getCurrentScreenID(); |
|
| 59 | 59 | |
| 60 | 60 | // Trigger the add_meta_boxes hooks to allow meta boxes to be added. |
| 61 | 61 | do_action( "add_meta_boxes_{$_sCurrentScreenID}", null ); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | // the network admin adds '-network' in the screen ID and the hooks with that id won't be triggered so use the 'page_hook' global variable. |
| 86 | 86 | if ( isset( $GLOBALS[ 'page_hook' ] ) ) { |
| 87 | 87 | add_action( |
| 88 | - "admin_footer-{$GLOBALS['page_hook']}", |
|
| 88 | + "admin_footer-{$GLOBALS[ 'page_hook' ]}", |
|
| 89 | 89 | array( $this, '_replyToAddMetaboxScript' ) |
| 90 | 90 | ); |
| 91 | 91 | } |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $_sPageSlug = $this->getElement( $_GET, 'page', '' ); |
| 112 | - if ( ! $_sPageSlug ) { |
|
| 112 | + if ( !$_sPageSlug ) { |
|
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - foreach( $_aPageMetaBoxClasses as $_sClassName => $_oMetaBox ) { |
|
| 116 | + foreach ( $_aPageMetaBoxClasses as $_sClassName => $_oMetaBox ) { |
|
| 117 | 117 | if ( $this->_isPageOfMetaBox( $_sPageSlug, $_oMetaBox ) ) { |
| 118 | 118 | return true; |
| 119 | 119 | } |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private function _isPageOfMetaBox( $sPageSlug, $oMetaBox ) { |
| 134 | 134 | |
| 135 | - if ( in_array( $sPageSlug , $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 135 | + if ( in_array( $sPageSlug, $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 136 | 136 | return true; // for numeric keys with a string value. |
| 137 | 137 | } |
| 138 | - if ( ! array_key_exists( $sPageSlug , $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 138 | + if ( !array_key_exists( $sPageSlug, $oMetaBox->oProp->aPageSlugs ) ) { |
|
| 139 | 139 | return false; // for keys of page slugs, the key does not exist, it means not added. |
| 140 | 140 | } |
| 141 | 141 | |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | */ |
| 82 | 82 | public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
| 83 | 83 | foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
| 84 | - if ( is_string( $_asPage ) ) { |
|
| 84 | + if ( is_string( $_asPage ) ) { |
|
| 85 | 85 | $this->_registerMetaBox( $_asPage ); |
| 86 | 86 | continue; |
| 87 | 87 | } |
@@ -256,7 +256,7 @@ |
||
| 256 | 256 | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - /** |
|
| 259 | + /** |
|
| 260 | 260 | * Extracts meta box form fields options array from the given options array of an admin page. |
| 261 | 261 | * |
| 262 | 262 | * @since 3.5.6 |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | public function _replyToSetUpValidationHooks( $oScreen ) { |
| 46 | 46 | |
| 47 | 47 | // Validation hooks |
| 48 | - foreach( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 48 | + foreach ( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 49 | 49 | |
| 50 | 50 | if ( is_scalar( $_asTabArrayOrPageSlug ) ) { |
| 51 | 51 | $_sPageSlug = $_asTabArrayOrPageSlug; |
| 52 | - add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 52 | + add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 53 | 53 | add_filter( "validation_{$_sPageSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 54 | 54 | add_filter( "options_update_status_{$_sPageSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
| 55 | 55 | continue; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | // At this point, the array key is the page slug. It means the user specified the tab(s). |
| 59 | 59 | $_sPageSlug = $_sIndexOrPageSlug; |
| 60 | 60 | $_aTabs = $_asTabArrayOrPageSlug; |
| 61 | - foreach( $_aTabs as $_sTabSlug ) { |
|
| 61 | + foreach ( $_aTabs as $_sTabSlug ) { |
|
| 62 | 62 | add_filter( "validation_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 63 | 63 | add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
| 64 | 64 | add_filter( "options_update_status_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @return void |
| 79 | 79 | * @callback action add_meta_boxes |
| 80 | 80 | */ |
| 81 | - public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
|
| 82 | - foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 83 | - if ( is_string( $_asPage ) ) { |
|
| 81 | + public function _replyToRegisterMetaBoxes( $sPageHook = '' ) { |
|
| 82 | + foreach ( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 83 | + if ( is_string( $_asPage ) ) { |
|
| 84 | 84 | $this->_registerMetaBox( $_asPage ); |
| 85 | 85 | continue; |
| 86 | 86 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @return void |
| 97 | 97 | */ |
| 98 | 98 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
| 99 | - foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 100 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 99 | + foreach ( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 100 | + if ( !$this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 101 | 101 | continue; |
| 102 | 102 | } |
| 103 | 103 | $this->_registerMetaBox( $sPageSlug ); |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | private function _registerMetaBox( $sPageSlug ) { |
| 116 | 116 | add_meta_box( |
| 117 | - $this->oProp->sMetaBoxID, // id |
|
| 118 | - $this->oProp->sTitle, // title |
|
| 117 | + $this->oProp->sMetaBoxID, // id |
|
| 118 | + $this->oProp->sTitle, // title |
|
| 119 | 119 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
| 120 | 120 | $this->oProp->_getScreenIDOfPage( $sPageSlug ), // screen ID |
| 121 | - $this->oProp->sContext, // context |
|
| 122 | - $this->oProp->sPriority, // priority |
|
| 121 | + $this->oProp->sContext, // context |
|
| 122 | + $this->oProp->sPriority, // priority |
|
| 123 | 123 | null // argument (deprecated) |
| 124 | 124 | ); |
| 125 | 125 | } |
@@ -167,17 +167,17 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $_aNewMetaBoxInputs = $this->oForm->getSubmittedData( $_POST ); |
| 169 | 169 | $_aOldMetaBoxInputs = $this->oUtil->castArrayContents( |
| 170 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 170 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 171 | 171 | $aOldPageOptions // data source |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | 174 | // Apply filters - third party scripts will have access to the input. |
| 175 | 175 | $_aNewMetaBoxInputsRaw = $_aNewMetaBoxInputs; // copy one for validation errors. |
| 176 | 176 | $_aNewMetaBoxInputs = call_user_func_array( |
| 177 | - array( $this, 'validate' ), // triggers __call() |
|
| 177 | + array( $this, 'validate' ), // triggers __call() |
|
| 178 | 178 | array( $_aNewMetaBoxInputs, $_aOldMetaBoxInputs, $this, $aSubmitInfo ) |
| 179 | 179 | ); // 3.5.3+ |
| 180 | - $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 180 | + $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 181 | 181 | $this, |
| 182 | 182 | "validation_{$this->oProp->sClassName}", |
| 183 | 183 | $_aNewMetaBoxInputs, |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function _replyToModifyOptionsUpdateStatus( $aStatus ) { |
| 217 | 217 | |
| 218 | - if ( ! $this->hasFieldError() ) { |
|
| 218 | + if ( !$this->hasFieldError() ) { |
|
| 219 | 219 | return $aStatus; |
| 220 | 220 | } |
| 221 | 221 | return array( |
@@ -245,12 +245,12 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $_aPageOptions = $this->oUtil->addAndApplyFilter( |
| 247 | 247 | $this, // the caller factory object |
| 248 | - 'options_' . $this->oProp->sClassName, |
|
| 248 | + 'options_'.$this->oProp->sClassName, |
|
| 249 | 249 | $_aPageOptions |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | 252 | return $this->oUtil->castArrayContents( |
| 253 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 253 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 254 | 254 | $_aPageOptions // data source |
| 255 | 255 | ); |
| 256 | 256 | |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | private function _getPageMetaBoxOptionsFromPageOptions( array $aPageOptions, array $aFieldsets ) { |
| 268 | 268 | |
| 269 | 269 | $_aOptions = array(); |
| 270 | - foreach( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 271 | - if ( '_default' === $_sSectionID ) { |
|
| 272 | - foreach( $_aFieldsets as $_aField ) { |
|
| 270 | + foreach ( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 271 | + if ( '_default' === $_sSectionID ) { |
|
| 272 | + foreach ( $_aFieldsets as $_aField ) { |
|
| 273 | 273 | if ( array_key_exists( $_aField[ 'field_id' ], $aPageOptions ) ) { |
| 274 | 274 | $_aOptions[ $_aField[ 'field_id' ] ] = $aPageOptions[ $_aField[ 'field_id' ] ]; |
| 275 | 275 | } |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | */ |
| 136 | 136 | public function _replyToModifyActionLinks( $aActionLinks, $oPost ) { |
| 137 | 137 | |
| 138 | - if ( $oPost->post_type !== $this->oProp->sPostType ){ |
|
| 138 | + if ( $oPost->post_type !== $this->oProp->sPostType ) { |
|
| 139 | 139 | return $aActionLinks; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | if ( $this->oProp->bIsAdmin ) { |
| 33 | 33 | |
| 34 | - add_action( 'load_' . $this->oProp->sPostType, array( $this, '_replyToSetUpHooksForView' ) ); |
|
| 34 | + add_action( 'load_'.$this->oProp->sPostType, array( $this, '_replyToSetUpHooksForView' ) ); |
|
| 35 | 35 | |
| 36 | 36 | // 3.5.10+ |
| 37 | 37 | add_action( 'admin_menu', array( $this, '_replyToRemoveAddNewSidebarMenu' ) ); |
@@ -105,19 +105,19 @@ discard block |
||
| 105 | 105 | private function _removeAddNewSidebarSubMenu( $sMenuKey, $sPostTypeSlug ) { |
| 106 | 106 | |
| 107 | 107 | // Remove the default post type menu item. |
| 108 | - if ( ! isset( $GLOBALS[ 'submenu' ][ $sMenuKey ] ) ) { |
|
| 108 | + if ( !isset( $GLOBALS[ 'submenu' ][ $sMenuKey ] ) ) { |
|
| 109 | 109 | // logged-in users of an insufficient access level don't have the menu to be registered. |
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | foreach ( $GLOBALS[ 'submenu' ][ $sMenuKey ] as $_iIndex => $_aSubMenu ) { |
| 114 | 114 | |
| 115 | - if ( ! isset( $_aSubMenu[ 2 ] ) ) { |
|
| 115 | + if ( !isset( $_aSubMenu[ 2 ] ) ) { |
|
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // Remove the default Add New entry. |
| 120 | - if ( 'post-new.php?post_type=' . $sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
| 120 | + if ( 'post-new.php?post_type='.$sPostTypeSlug === $_aSubMenu[ 2 ] ) { |
|
| 121 | 121 | unset( $GLOBALS[ 'submenu' ][ $sMenuKey ][ $_iIndex ] ); |
| 122 | 122 | break; |
| 123 | 123 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function _replyToModifyActionLinks( $aActionLinks, $oPost ) { |
| 136 | 136 | |
| 137 | - if ( $oPost->post_type !== $this->oProp->sPostType ){ |
|
| 137 | + if ( $oPost->post_type !== $this->oProp->sPostType ) { |
|
| 138 | 138 | return $aActionLinks; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function _replyToAddAuthorTableFilter() { |
| 158 | 158 | |
| 159 | - if ( ! $this->oProp->bEnableAuthorTableFileter ) { |
|
| 159 | + if ( !$this->oProp->bEnableAuthorTableFileter ) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if ( |
| 164 | - ! ( isset( $_GET[ 'post_type' ] ) && post_type_exists( $_GET[ 'post_type' ] ) |
|
| 164 | + !( isset( $_GET[ 'post_type' ] ) && post_type_exists( $_GET[ 'post_type' ] ) |
|
| 165 | 165 | && in_array( strtolower( $_GET[ 'post_type' ] ), array( $this->oProp->sPostType ) ) ) |
| 166 | 166 | ) { |
| 167 | 167 | return; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $_sTaxonomySulg ) { |
| 203 | 203 | |
| 204 | - if ( ! in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 204 | + if ( !in_array( $_sTaxonomySulg, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 205 | 205 | continue; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // Echo the drop down list based on the passed array argument. |
| 216 | 216 | wp_dropdown_categories( |
| 217 | 217 | array( |
| 218 | - 'show_option_all' => $this->oMsg->get( 'show_all' ) . ' ' . $_oTaxonomy->label, |
|
| 218 | + 'show_option_all' => $this->oMsg->get( 'show_all' ).' '.$_oTaxonomy->label, |
|
| 219 | 219 | 'taxonomy' => $_sTaxonomySulg, |
| 220 | 220 | 'name' => $_oTaxonomy->name, |
| 221 | 221 | 'orderby' => 'name', |
@@ -235,24 +235,24 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @internal |
| 237 | 237 | */ |
| 238 | - public function _replyToGetTableFilterQueryForTaxonomies( $oQuery=null ) { |
|
| 238 | + public function _replyToGetTableFilterQueryForTaxonomies( $oQuery = null ) { |
|
| 239 | 239 | |
| 240 | 240 | if ( 'edit.php' != $this->oProp->sPageNow ) { |
| 241 | 241 | return $oQuery; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - if ( ! isset( $GLOBALS[ 'typenow' ] ) ) { |
|
| 244 | + if ( !isset( $GLOBALS[ 'typenow' ] ) ) { |
|
| 245 | 245 | return $oQuery; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | foreach ( get_object_taxonomies( $GLOBALS[ 'typenow' ] ) as $sTaxonomySlug ) { |
| 249 | 249 | |
| 250 | - if ( ! in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 250 | + if ( !in_array( $sTaxonomySlug, $this->oProp->aTaxonomyTableFilters ) ) { |
|
| 251 | 251 | continue; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $sVar = &$oQuery->query_vars[ $sTaxonomySlug ]; |
| 255 | - if ( ! isset( $sVar ) ) { |
|
| 255 | + if ( !isset( $sVar ) ) { |
|
| 256 | 256 | continue; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $_sStyle = trim( $_sStyle ); |
| 292 | 292 | |
| 293 | 293 | // Print out the filtered styles. |
| 294 | - if ( ! empty( $_sStyle ) ) { |
|
| 294 | + if ( !empty( $_sStyle ) ) { |
|
| 295 | 295 | echo "<style type='text/css' id='admin-page-framework-style-post-type'>" |
| 296 | 296 | . $this->oProp->sStyle |
| 297 | 297 | . "</style>"; |
@@ -347,10 +347,10 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | public function _replyToFilterPostTypeContent( $sContent ) { |
| 349 | 349 | |
| 350 | - if ( ! is_singular() ) { |
|
| 350 | + if ( !is_singular() ) { |
|
| 351 | 351 | return $sContent; |
| 352 | 352 | } |
| 353 | - if ( ! is_main_query() ) { |
|
| 353 | + if ( !is_main_query() ) { |
|
| 354 | 354 | return $sContent; |
| 355 | 355 | } |
| 356 | 356 | global $post; |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | /** |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - private function getReadMeContents() { |
|
| 55 | + private function getReadMeContents() { |
|
| 56 | 56 | return $this->_getReadmeContents( |
| 57 | 57 | AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/examples.txt', |
| 58 | 58 | '', |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $_aItems = $this->getContentsByHeader( $this->getReadmeContents(), 3 ); |
| 25 | 25 | $_iLastIndex = count( $_aItems ) - 1; |
| 26 | - foreach( $_aItems as $_iIndex => $_aContent ) { |
|
| 26 | + foreach ( $_aItems as $_iIndex => $_aContent ) { |
|
| 27 | 27 | |
| 28 | 28 | $_oParser = new AdminPageFramework_WPReadmeParser; |
| 29 | 29 | $_oParser->setText( $_aContent[ 1 ] ); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $oAdminPage->addSettingSections( |
| 32 | 32 | $this->sPageSlug, // the target page slug |
| 33 | 33 | array( |
| 34 | - 'section_id' => 'examples_' . $_iIndex, |
|
| 34 | + 'section_id' => 'examples_'.$_iIndex, |
|
| 35 | 35 | 'title' => $_aContent[ 0 ], |
| 36 | 36 | 'collapsible' => array( |
| 37 | 37 | 'toggle_all_button' => $_iLastIndex === $_iIndex |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @return string |
| 54 | 54 | */ |
| 55 | - private function getReadMeContents() { |
|
| 55 | + private function getReadMeContents() { |
|
| 56 | 56 | return $this->_getReadmeContents( |
| 57 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/examples.txt', |
|
| 57 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/text/examples.txt', |
|
| 58 | 58 | '', |
| 59 | 59 | array( 'Examples' ) |
| 60 | 60 | ); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | /** |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - private function getReadMeContents() { |
|
| 56 | + private function getReadMeContents() { |
|
| 57 | 57 | return $this->_getReadmeContents( |
| 58 | 58 | AdminPageFrameworkLoader_Registry::$sDirPath . '/readme.txt', // source path |
| 59 | 59 | '', // TOC title |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $_aItems = $this->getContentsByHeader( $this->getReadmeContents(), 4 ); |
| 27 | 27 | $_iLastIndex = count( $_aItems ) - 1; |
| 28 | - foreach( $_aItems as $_iIndex => $_aContent ) { |
|
| 28 | + foreach ( $_aItems as $_iIndex => $_aContent ) { |
|
| 29 | 29 | |
| 30 | 30 | $_oParser = new AdminPageFramework_WPReadmeParser( $_aContent[ 1 ] ); |
| 31 | 31 | $_sContent = $_oParser->get(); |
| 32 | 32 | $oAdminPage->addSettingSections( |
| 33 | 33 | $this->sPageSlug, // the target page slug |
| 34 | 34 | array( |
| 35 | - 'section_id' => 'tips_' . $_iIndex, |
|
| 35 | + 'section_id' => 'tips_'.$_iIndex, |
|
| 36 | 36 | 'title' => $_aContent[ 0 ], |
| 37 | 37 | 'collapsible' => array( |
| 38 | 38 | 'toggle_all_button' => $_iLastIndex === $_iIndex |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - private function getReadMeContents() { |
|
| 56 | + private function getReadMeContents() { |
|
| 57 | 57 | return $this->_getReadmeContents( |
| 58 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/readme.txt', // source path |
|
| 58 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/readme.txt', // source path |
|
| 59 | 59 | '', // TOC title |
| 60 | 60 | array( 'Other Notes' ) // sections |
| 61 | 61 | ); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | ), |
| 35 | 35 | 2 => __( 'Header already sent.', 'admin-page-framework-loader' ), |
| 36 | 36 | ); |
| 37 | - if ( ! class_exists( 'AdminPageFramework_AdminNotice' ) ) { |
|
| 37 | + if ( !class_exists( 'AdminPageFramework_AdminNotice' ) ) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | new AdminPageFramework_AdminNotice( |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * Sets up properties and performs registering classes. |
| 76 | 76 | * |
| 77 | 77 | * |
| 78 | - * @param array|string $asScanDirPath the target directory path to scan |
|
| 78 | + * @param array|string $asScanDirPaths the target directory path to scan |
|
| 79 | 79 | * @param array $aOptions The recursive settings. |
| 80 | 80 | * <ul> |
| 81 | 81 | * <li><code>is_recursive</code> - (boolean) determines whether the scan should be performed recursively.</li> |
@@ -217,6 +217,7 @@ discard block |
||
| 217 | 217 | /** |
| 218 | 218 | * The recursive version of the glob() function. |
| 219 | 219 | * @internal |
| 220 | + * @param string $sPathPatten |
|
| 220 | 221 | */ |
| 221 | 222 | protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
| 222 | 223 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'is_recursive' => true, |
| 67 | 67 | 'exclude_dir_paths' => array(), |
| 68 | 68 | 'exclude_dir_names' => array( 'asset', 'assets', 'css', 'js', 'image', 'images', 'license', 'document', 'documents' ), |
| 69 | - 'allowed_extensions' => array( 'php', ), // 'inc' |
|
| 69 | + 'allowed_extensions' => array( 'php',), // 'inc' |
|
| 70 | 70 | 'include_function' => 'include', |
| 71 | 71 | 'exclude_class_names' => array( /* 'SomeClass', 'SomeOtherClass' */ ), |
| 72 | 72 | ); |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @remark The directory paths set for the 'exclude_dir_paths' option should use the system directory separator. |
| 107 | 107 | */ |
| 108 | - public function __construct( $asScanDirPaths, array $aOptions=array(), array $aClasses=array() ) { |
|
| 108 | + public function __construct( $asScanDirPaths, array $aOptions = array(), array $aClasses = array() ) { |
|
| 109 | 109 | |
| 110 | 110 | $_aOptions = $aOptions + self::$_aStructure_Options; |
| 111 | - $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
| 111 | + $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
| 112 | 112 | $this->_registerClasses( $_aOptions[ 'include_function' ] ); |
| 113 | 113 | |
| 114 | 114 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | return array(); |
| 135 | 135 | } |
| 136 | 136 | $_aFilePaths = array(); |
| 137 | - foreach( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
| 137 | + foreach ( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
| 138 | 138 | if ( realpath( $_sClassDirPath ) ) { |
| 139 | 139 | $_aFilePaths = array_merge( $this->getFilePaths( $_sClassDirPath, $aSearchOptions ), $_aFilePaths ); |
| 140 | 140 | } |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // Store classes in an array. |
| 144 | 144 | $_aClasses = array(); |
| 145 | - foreach( $_aFilePaths as $_sFilePath ) { |
|
| 145 | + foreach ( $_aFilePaths as $_sFilePath ) { |
|
| 146 | 146 | |
| 147 | 147 | // Class name without a file extension. |
| 148 | 148 | $_sClassNameWOExt = pathinfo( $_sFilePath, PATHINFO_FILENAME ); |
| 149 | - if ( in_array( $_sClassNameWOExt, $aSearchOptions['exclude_class_names'] ) ) { |
|
| 149 | + if ( in_array( $_sClassNameWOExt, $aSearchOptions[ 'exclude_class_names' ] ) ) { |
|
| 150 | 150 | continue; |
| 151 | 151 | } |
| 152 | 152 | $_aClasses[ $_sClassNameWOExt ] = $_sFilePath; |
@@ -176,26 +176,26 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function getFilePaths( $sClassDirPath, array $aSearchOptions ) { |
| 178 | 178 | |
| 179 | - $sClassDirPath = rtrim( $sClassDirPath, '\\/' ) . DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
| 180 | - $_aAllowedExtensions = $aSearchOptions['allowed_extensions']; |
|
| 181 | - $_aExcludeDirPaths = ( array ) $aSearchOptions['exclude_dir_paths']; |
|
| 182 | - $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
|
| 179 | + $sClassDirPath = rtrim( $sClassDirPath, '\\/' ).DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
| 180 | + $_aAllowedExtensions = $aSearchOptions[ 'allowed_extensions' ]; |
|
| 181 | + $_aExcludeDirPaths = ( array ) $aSearchOptions[ 'exclude_dir_paths' ]; |
|
| 182 | + $_aExcludeDirNames = ( array ) $aSearchOptions[ 'exclude_dir_names' ]; |
|
| 183 | 183 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
| 184 | 184 | |
| 185 | 185 | if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
| 186 | 186 | $_aFilePaths = $_bIsRecursive |
| 187 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
| 188 | - : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
| 187 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
| 188 | + : ( array ) glob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
| 189 | 189 | return array_filter( $_aFilePaths ); // drop non-value elements. |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // For the Solaris operation system. |
| 193 | 193 | $_aFilePaths = array(); |
| 194 | - foreach( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
| 194 | + foreach ( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
| 195 | 195 | |
| 196 | 196 | $__aFilePaths = $_bIsRecursive |
| 197 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
| 198 | - : ( array ) glob( $sClassDirPath . '*.' . $__sAllowedExtension ); |
|
| 197 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
| 198 | + : ( array ) glob( $sClassDirPath.'*.'.$__sAllowedExtension ); |
|
| 199 | 199 | |
| 200 | 200 | $_aFilePaths = array_merge( $__aFilePaths, $_aFilePaths ); |
| 201 | 201 | |
@@ -208,28 +208,28 @@ discard block |
||
| 208 | 208 | * Constructs the file pattern of the file extension part used for the glob() function with the given file extensions. |
| 209 | 209 | * @internal |
| 210 | 210 | */ |
| 211 | - protected function _getGlobPatternExtensionPart( array $aExtensions=array( 'php', 'inc' ) ) { |
|
| 211 | + protected function _getGlobPatternExtensionPart( array $aExtensions = array( 'php', 'inc' ) ) { |
|
| 212 | 212 | return empty( $aExtensions ) |
| 213 | 213 | ? '*' |
| 214 | - : '{' . implode( ',', $aExtensions ) . '}'; |
|
| 214 | + : '{'.implode( ',', $aExtensions ).'}'; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | 218 | * The recursive version of the glob() function. |
| 219 | 219 | * @internal |
| 220 | 220 | */ |
| 221 | - protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
|
| 221 | + protected function doRecursiveGlob( $sPathPatten, $nFlags = 0, array $aExcludeDirs = array(), array $aExcludeDirNames = array() ) { |
|
| 222 | 222 | |
| 223 | 223 | $_aFiles = glob( $sPathPatten, $nFlags ); |
| 224 | 224 | $_aFiles = is_array( $_aFiles ) ? $_aFiles : array(); // glob() can return false. |
| 225 | - $_aDirs = glob( dirname( $sPathPatten ) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR|GLOB_NOSORT ); |
|
| 225 | + $_aDirs = glob( dirname( $sPathPatten ).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR | GLOB_NOSORT ); |
|
| 226 | 226 | $_aDirs = is_array( $_aDirs ) ? $_aDirs : array(); |
| 227 | 227 | foreach ( $_aDirs as $_sDirPath ) { |
| 228 | 228 | |
| 229 | 229 | if ( in_array( $_sDirPath, $aExcludeDirs ) ) { continue; } |
| 230 | 230 | if ( in_array( pathinfo( $_sDirPath, PATHINFO_DIRNAME ), $aExcludeDirNames ) ) { continue; } |
| 231 | 231 | |
| 232 | - $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath . DIRECTORY_SEPARATOR . basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
| 232 | + $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath.DIRECTORY_SEPARATOR.basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | return $_aFiles; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @return void |
| 245 | 245 | */ |
| 246 | 246 | protected function _registerClasses( $sIncludeFunction ) { |
| 247 | - spl_autoload_register( array( $this, '_replyToAutoLoad_' . $sIncludeFunction ) ); |
|
| 247 | + spl_autoload_register( array( $this, '_replyToAutoLoad_'.$sIncludeFunction ) ); |
|
| 248 | 248 | } |
| 249 | 249 | /**#@+ |
| 250 | 250 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
@@ -252,25 +252,25 @@ discard block |
||
| 252 | 252 | * @return void |
| 253 | 253 | */ |
| 254 | 254 | public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
| 255 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 255 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 256 | 256 | return; |
| 257 | 257 | } |
| 258 | 258 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
| 259 | 259 | } |
| 260 | 260 | public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
| 261 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 261 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 262 | 262 | return; |
| 263 | 263 | } |
| 264 | 264 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
| 265 | 265 | } |
| 266 | 266 | public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
| 267 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 267 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 268 | 268 | return; |
| 269 | 269 | } |
| 270 | 270 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
| 271 | 271 | } |
| 272 | 272 | public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
| 273 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 273 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 274 | 274 | return; |
| 275 | 275 | } |
| 276 | 276 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
@@ -181,7 +181,8 @@ discard block |
||
| 181 | 181 | $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
| 182 | 182 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
| 183 | 183 | |
| 184 | - if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
|
| 184 | + if ( defined( 'GLOB_BRACE' ) ) { |
|
| 185 | +// in some OSes this flag constant is not available. |
|
| 185 | 186 | $_aFilePaths = $_bIsRecursive |
| 186 | 187 | ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
| 187 | 188 | : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
@@ -250,26 +251,26 @@ discard block |
||
| 250 | 251 | * @internal |
| 251 | 252 | * @return void |
| 252 | 253 | */ |
| 253 | - public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
| 254 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 254 | + public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
| 255 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 255 | 256 | return; |
| 256 | 257 | } |
| 257 | 258 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
| 258 | 259 | } |
| 259 | - public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
| 260 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 260 | + public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
| 261 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 261 | 262 | return; |
| 262 | 263 | } |
| 263 | 264 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
| 264 | 265 | } |
| 265 | - public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
| 266 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 266 | + public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
| 267 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 267 | 268 | return; |
| 268 | 269 | } |
| 269 | 270 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
| 270 | 271 | } |
| 271 | - public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
| 272 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 272 | + public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
| 273 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
| 273 | 274 | return; |
| 274 | 275 | } |
| 275 | 276 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * Creates an object instance with dynamic parameters. |
| 46 | 46 | * |
| 47 | 47 | * @since 3.7.10 |
| 48 | - * @param string $sCalssName The class name for testing. |
|
| 48 | + * @param string $sClassName The class name for testing. |
|
| 49 | 49 | * @param array $aParameters The parameters to pass to the constructor of the class set in the first parameter. |
| 50 | 50 | * @return object An object instance of the class specified in the first parameter. |
| 51 | 51 | */ |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @since 3.7.10 |
| 63 | 63 | * @param object $oClass The subject class object. |
| 64 | - * @param string $sMathodName The subject method name. |
|
| 64 | + * @param string $sMethodName The subject method name. |
|
| 65 | 65 | * @param array $aParameters The parameters to pass to the method set in the second parameter. |
| 66 | 66 | * @remark This supports private methods to be executed. |
| 67 | 67 | */ |
@@ -87,6 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | /** |
| 89 | 89 | * @since 3.7.10 |
| 90 | + * @param string $sClassName |
|
| 90 | 91 | * @return object |
| 91 | 92 | * @internal |
| 92 | 93 | */ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param array $aParameters The parameters to pass to the constructor of the class set in the first parameter. |
| 49 | 49 | * @return object An object instance of the class specified in the first parameter. |
| 50 | 50 | */ |
| 51 | - static public function getInstance( $sClassName, array $aParameters=array() ) { |
|
| 51 | + static public function getInstance( $sClassName, array $aParameters = array() ) { |
|
| 52 | 52 | |
| 53 | 53 | $_oReflection = new ReflectionClass( $sClassName ); |
| 54 | 54 | return $_oReflection->newInstanceArgs( $aParameters ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // For PHP 5.2.x or below |
| 70 | 70 | if ( version_compare( phpversion(), '<', '5.3.0' ) ) { |
| 71 | 71 | trigger_error( |
| 72 | - 'Program Name' . ': ' |
|
| 72 | + 'Program Name'.': ' |
|
| 73 | 73 | . sprintf( |
| 74 | 74 | 'The method cannot run with your PHP version: %1$s', |
| 75 | 75 | phpversion() |