@@ -56,7 +56,7 @@ |
||
| 56 | 56 | * @param string $sCapability (optional) sets the overall access level to the admin pages created by the framework. The used capabilities are listed <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. The capability can be set per page, tab, setting section, setting field. Default: `manage_options` |
| 57 | 57 | * @param string $sTextDomain (optional) the <a href="http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains" target="_blank">text domain</a> used for the framework's system messages. Default: admin-page-framework. |
| 58 | 58 | */ |
| 59 | - public function __construct( $isOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ){ |
|
| 59 | + public function __construct( $isOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
| 60 | 60 | |
| 61 | 61 | if ( ! $this->_isInstantiatable() ) { |
| 62 | 62 | return; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | 95 | public function addInPageTabs( /* $aTab1, $aTab2=null, $_and_more=null */ ) { |
| 96 | - foreach( func_get_args() as $asTab ) { |
|
| 96 | + foreach( func_get_args() as $asTab ) { |
|
| 97 | 97 | $this->addInPageTab( $asTab ); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @remark In-page tabs are different from page-heading tabs which are automatically added with page titles. |
| 112 | 112 | * @return void |
| 113 | 113 | */ |
| 114 | - public function addInPageTab( $asInPageTab ) { |
|
| 114 | + public function addInPageTab( $asInPageTab ) { |
|
| 115 | 115 | |
| 116 | 116 | // Target page slug - will be applied when no page slug is specified. |
| 117 | 117 | static $__sTargetPageSlug; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
| 134 | 134 | |
| 135 | 135 | // Required keys |
| 136 | - if ( ! isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
| 136 | + if ( ! isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param string $sPageSlug The page slug that applies the setting. |
| 243 | 243 | * @remark If the second parameter is omitted, it sets the default value. |
| 244 | 244 | */ |
| 245 | - public function setInPageTabTag( $sTag='h3', $sPageSlug='' ) { |
|
| 245 | + public function setInPageTabTag( $sTag='h3', $sPageSlug='' ) { |
|
| 246 | 246 | $this->_setPageProperty( |
| 247 | 247 | 'sInPageTabTag', |
| 248 | 248 | 'in_page_tab_tag', |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function _replyToFinalizeInPageTabs() { |
| 39 | 39 | |
| 40 | - if ( ! $this->oProp->isPageAdded() ) { |
|
| 40 | + if ( ! $this->oProp->isPageAdded() ) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
| 45 | 45 | |
| 46 | - if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 46 | + if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @since 3.6.0 |
| 81 | 81 | */ |
| 82 | 82 | private function _getDefaultInPageTab( $sPageSlug, $aInPageTabs ) { |
| 83 | - foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | - if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 83 | + foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | + if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | // Regardless of whether it's a hidden tab, it is stored as the default in-page tab. |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @since 2.1.5 |
| 64 | 64 | */ |
| 65 | - public function getSiblingValue( $sKey ) { |
|
| 65 | + public function getSiblingValue( $sKey ) { |
|
| 66 | 66 | return $this->getSubmitValueByType( $this->aPost, $this->sInputID, $sKey ); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -80,7 +80,8 @@ discard block |
||
| 80 | 80 | // Only the pressed element will be stored in the array. |
| 81 | 81 | // The input tag: name="__import[submit][my_section_my_import_field_the_index]" value="Import Button" |
| 82 | 82 | // The array structure: array( 'my_section_my_import_field_the_index' => 'Import Button' ) |
| 83 | - foreach( $aSubmitElement as $sInputID => $v ) { // $aSubmitElement should have been set in the constructor. |
|
| 83 | + foreach( $aSubmitElement as $sInputID => $v ) { |
|
| 84 | +// $aSubmitElement should have been set in the constructor. |
|
| 84 | 85 | $this->sInputID = $sInputID; |
| 85 | 86 | return $this->sInputID; |
| 86 | 87 | } |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | |
| 160 | 160 | // Download the file. It returns a string value on success. WP Error object on failure. |
| 161 | 161 | $_sPath = $this->download( $sURL, 10 ); |
| 162 | - if ( is_string( $_sPath ) ) { |
|
| 162 | + if ( is_string( $_sPath ) ) { |
|
| 163 | 163 | $this->_aPathsToDelete[ $_sPath ] = $_sPath; |
| 164 | 164 | return $_sPath; |
| 165 | 165 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | // Save the data. |
| 140 | 140 | $_bUpdated = false; |
| 141 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
| 141 | + if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
| 142 | 142 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -181,14 +181,15 @@ discard block |
||
| 181 | 181 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
| 182 | 182 | $_POST[ '_wp_http_referer' ] |
| 183 | 183 | ) |
| 184 | - ) { |
|
| 184 | + ) { |
|
| 185 | 185 | return false; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // Referrer |
| 189 | 189 | $_sRequestURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), wp_unslash( $_SERVER[ 'REQUEST_URI' ] ) ); |
| 190 | 190 | $_sReffererURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), $_POST[ '_wp_http_referer' ] ); |
| 191 | - if ( $_sRequestURI != $_sReffererURI ) { // see the function definition of wp_referer_field() in functions.php. |
|
| 191 | + if ( $_sRequestURI != $_sReffererURI ) { |
|
| 192 | +// see the function definition of wp_referer_field() in functions.php. |
|
| 192 | 193 | return false; |
| 193 | 194 | } |
| 194 | 195 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @return null|string Returns `null` if no value is found and the associated link url if found. |
| 47 | 47 | * Otherwise, the found value. |
| 48 | 48 | */ |
| 49 | - protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey='field_id' ) { |
|
| 49 | + protected function _getPressedSubmitButtonData( array $aPostElements, $sTargetKey='field_id' ) { |
|
| 50 | 50 | |
| 51 | 51 | foreach( $aPostElements as $_sInputID => $_aSubElements ) { |
| 52 | 52 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function _setSettingNoticeAfterValidation( $bIsInputEmtpy ) { |
| 86 | 86 | |
| 87 | - if ( $this->oFactory->hasSettingNotice() ) { |
|
| 87 | + if ( $this->oFactory->hasSettingNotice() ) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | $this->oFactory->setSettingNotice( |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @internal |
| 121 | 121 | * @return string the filtered export data. |
| 122 | 122 | */ |
| 123 | - private function _getFilteredExportingData( array $aArguments, $mData ) { |
|
| 123 | + private function _getFilteredExportingData( array $aArguments, $mData ) { |
|
| 124 | 124 | return $this->_getFilteredItemForPortByPrefix( |
| 125 | 125 | 'export_', |
| 126 | 126 | $mData, |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @internal |
| 135 | 135 | * @return string The export file name. |
| 136 | 136 | */ |
| 137 | - private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
|
| 137 | + private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
|
| 138 | 138 | return $this->addAndApplyFilters( |
| 139 | 139 | $this->oFactory, |
| 140 | 140 | $this->_getPortFilterHookNames( 'export_name_', $aArguments ), |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @internal |
| 153 | 153 | * @return string The export format type. |
| 154 | 154 | */ |
| 155 | - private function _getExportFormatType( array $aArguments, $sExportFileFormat ) { |
|
| 155 | + private function _getExportFormatType( array $aArguments, $sExportFileFormat ) { |
|
| 156 | 156 | return $this->_getFilteredItemForPortByPrefix( |
| 157 | 157 | 'export_format_', |
| 158 | 158 | $sExportFileFormat, |
@@ -181,7 +181,8 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | private function _validateEachField( array $aData, array $aInputsToParse ) { |
| 183 | 183 | |
| 184 | - foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
| 184 | + foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { |
|
| 185 | +// $_sID is either a section id or a field id |
|
| 185 | 186 | |
| 186 | 187 | // For each section |
| 187 | 188 | if ( $this->oFactory->oForm->isSection( $_sID ) ) { |
@@ -192,7 +193,8 @@ discard block |
||
| 192 | 193 | } |
| 193 | 194 | |
| 194 | 195 | // Call the validation callback method. |
| 195 | - foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
| 196 | + foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { |
|
| 197 | +// For fields |
|
| 196 | 198 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ] = $this->_getValidatedData( |
| 197 | 199 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}_{$_sFieldID}", |
| 198 | 200 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ], |
@@ -276,7 +278,7 @@ discard block |
||
| 276 | 278 | */ |
| 277 | 279 | private function _validateTabFields( array $aData ) { |
| 278 | 280 | |
| 279 | - if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
| 281 | + if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
| 280 | 282 | return $aData; |
| 281 | 283 | } |
| 282 | 284 | |
@@ -337,7 +339,7 @@ discard block |
||
| 337 | 339 | */ |
| 338 | 340 | private function _validatePageFields( array $aData ) { |
| 339 | 341 | |
| 340 | - if ( ! $aData[ 'sPageSlug' ] ) { |
|
| 342 | + if ( ! $aData[ 'sPageSlug' ] ) { |
|
| 341 | 343 | return $aData[ 'aInput' ]; |
| 342 | 344 | } |
| 343 | 345 | |