@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | 95 | public function addInPageTabs( /* $aTab1, $aTab2=null, $_and_more=null */ ) { |
| 96 | - foreach( func_get_args() as $asTab ) { |
|
| 96 | + foreach ( func_get_args() as $asTab ) { |
|
| 97 | 97 | $this->addInPageTab( $asTab ); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // Target page slug - will be applied when no page slug is specified. |
| 117 | 117 | static $__sTargetPageSlug; |
| 118 | - if ( ! is_array( $asInPageTab ) ) { |
|
| 118 | + if ( !is_array( $asInPageTab ) ) { |
|
| 119 | 119 | $__sTargetPageSlug = is_string( $asInPageTab ) |
| 120 | 120 | ? $asInPageTab |
| 121 | 121 | : $__sTargetPageSlug; // set the target page slug |
@@ -130,23 +130,23 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | 132 | // Set the target page slug for next calls |
| 133 | - $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
|
| 133 | + $__sTargetPageSlug = $aInPageTab[ 'page_slug' ]; |
|
| 134 | 134 | |
| 135 | 135 | // Required keys |
| 136 | - if ( ! isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
| 136 | + if ( !isset( $aInPageTab[ 'page_slug' ], $aInPageTab[ 'tab_slug' ] ) ) { |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // Count - the number of added in-page tabs. |
| 141 | - $_aElements = $this->oUtil->getElement( |
|
| 141 | + $_aElements = $this->oUtil->getElement( |
|
| 142 | 142 | $this->oProp->aInPageTabs, |
| 143 | 143 | $aInPageTab[ 'page_slug' ], |
| 144 | 144 | array() |
| 145 | 145 | ); |
| 146 | - $_iCountElement = count( $_aElements ); |
|
| 146 | + $_iCountElement = count( $_aElements ); |
|
| 147 | 147 | |
| 148 | 148 | // Pre-format |
| 149 | - $aInPageTab = array( |
|
| 149 | + $aInPageTab = array( |
|
| 150 | 150 | 'page_slug' => $this->oUtil->sanitizeSlug( $aInPageTab[ 'page_slug' ] ), |
| 151 | 151 | 'tab_slug' => $this->oUtil->sanitizeSlug( $aInPageTab[ 'tab_slug' ] ), |
| 152 | 152 | 'order' => $this->oUtil->getAOrB( |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param boolean $bShow If false, the page title will not be displayed. |
| 175 | 175 | * @return void |
| 176 | 176 | */ |
| 177 | - public function setPageTitleVisibility( $bShow=true, $sPageSlug='' ) { |
|
| 177 | + public function setPageTitleVisibility( $bShow = true, $sPageSlug = '' ) { |
|
| 178 | 178 | $this->_setPageProperty( |
| 179 | 179 | 'bShowPageTitle', |
| 180 | 180 | 'show_page_title', |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @remark Page-heading tabs and in-page tabs are different. The former displays page titles and the latter displays tab titles. |
| 199 | 199 | * @remark If the second parameter is omitted, it sets the default value. |
| 200 | 200 | */ |
| 201 | - public function setPageHeadingTabsVisibility( $bShow=true, $sPageSlug='' ) { |
|
| 201 | + public function setPageHeadingTabsVisibility( $bShow = true, $sPageSlug = '' ) { |
|
| 202 | 202 | $this->_setPageProperty( |
| 203 | 203 | 'bShowPageHeadingTabs', |
| 204 | 204 | 'show_page_heading_tabs', |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param string $sPageSlug The page to apply the visibility setting. If not set, it applies to all the pages. |
| 220 | 220 | * @remark If the second parameter is omitted, it sets the default value. |
| 221 | 221 | */ |
| 222 | - public function setInPageTabsVisibility( $bShow=true, $sPageSlug='' ) { |
|
| 222 | + public function setInPageTabsVisibility( $bShow = true, $sPageSlug = '' ) { |
|
| 223 | 223 | $this->_setPageProperty( |
| 224 | 224 | 'bShowInPageTabs', |
| 225 | 225 | 'show_in_page_tabs', |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param string $sPageSlug The page slug that applies the setting. |
| 243 | 243 | * @remark If the second parameter is omitted, it sets the default value. |
| 244 | 244 | */ |
| 245 | - public function setInPageTabTag( $sTag='h3', $sPageSlug='' ) { |
|
| 245 | + public function setInPageTabTag( $sTag = 'h3', $sPageSlug = '' ) { |
|
| 246 | 246 | $this->_setPageProperty( |
| 247 | 247 | 'sInPageTabTag', |
| 248 | 248 | 'in_page_tab_tag', |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | * @param string $sPageSlug The page slug that applies the setting. |
| 266 | 266 | * @remark If the second parameter is omitted, it sets the default value. |
| 267 | 267 | */ |
| 268 | - public function setPageHeadingTabTag( $sTag='h2', $sPageSlug='' ) { |
|
| 268 | + public function setPageHeadingTabTag( $sTag = 'h2', $sPageSlug = '' ) { |
|
| 269 | 269 | $this->_setPageProperty( |
| 270 | - 'sPageHeadingTabTag', // property name |
|
| 270 | + 'sPageHeadingTabTag', // property name |
|
| 271 | 271 | 'page_heading_tab_tag', // property key |
| 272 | 272 | $sTag, // value |
| 273 | 273 | $sPageSlug // page slug |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $this->oProp->{$sPropertyName} = $mValue; |
| 291 | 291 | |
| 292 | - foreach( $this->oProp->aPages as &$_aPage ) { |
|
| 292 | + foreach ( $this->oProp->aPages as &$_aPage ) { |
|
| 293 | 293 | $_aPage[ $sPropertyKey ] = $mValue; |
| 294 | 294 | |
| 295 | 295 | } |
@@ -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 | - foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
| 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. |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function __construct( array $aPostElement ) { |
| 36 | 36 | |
| 37 | 37 | $this->aPost = $aPostElement; |
| 38 | - $this->sInputID = $this->getInputID( $aPostElement['submit'] ); // the submit element must be set by the field type. |
|
| 38 | + $this->sInputID = $this->getInputID( $aPostElement[ 'submit' ] ); // the submit element must be set by the field type. |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | * @since 2.0.0 |
| 48 | 48 | * @since 3.4.0 Changed the name from `getElement()`. |
| 49 | 49 | */ |
| 50 | - protected function getSubmitValueByType( $aElement, $sInputID, $sElementKey='format' ) { |
|
| 50 | + protected function getSubmitValueByType( $aElement, $sInputID, $sElementKey = 'format' ) { |
|
| 51 | 51 | |
| 52 | 52 | return $this->getElement( |
| 53 | - $aElement, // subject array |
|
| 53 | + $aElement, // subject array |
|
| 54 | 54 | array( $sInputID, $sElementKey ), // dimensional keys |
| 55 | 55 | null // default |
| 56 | 56 | ); |
@@ -80,7 +80,7 @@ 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 ) { // $aSubmitElement should have been set in the constructor. |
|
| 84 | 84 | $this->sInputID = $sInputID; |
| 85 | 85 | return $this->sInputID; |
| 86 | 86 | } |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * @since 2.0.0 |
| 95 | 95 | * @since 3.5.4 Added the `$aHeader` parameter. Deprecated the `$sFileName` parameter as it is included in the $aHeader definition. |
| 96 | 96 | */ |
| 97 | - public function doExport( $vData, $sFormatType=null, array $aHeader=array() ) { |
|
| 97 | + public function doExport( $vData, $sFormatType = null, array $aHeader = array() ) { |
|
| 98 | 98 | |
| 99 | - $sFormatType = isset( $sFormatType ) |
|
| 99 | + $sFormatType = isset( $sFormatType ) |
|
| 100 | 100 | ? $sFormatType |
| 101 | 101 | : $this->sFormatType; |
| 102 | 102 | |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | * @since 3.5.4 |
| 123 | 123 | * @return void |
| 124 | 124 | */ |
| 125 | - private function _outputHTTPHeader( array $aHeader, $sKey='' ) { |
|
| 125 | + private function _outputHTTPHeader( array $aHeader, $sKey = '' ) { |
|
| 126 | 126 | |
| 127 | - foreach( $aHeader as $_sKey => $_asValue ) { |
|
| 127 | + foreach ( $aHeader as $_sKey => $_asValue ) { |
|
| 128 | 128 | |
| 129 | 129 | // Nested items. Set the key to overrider array keys. |
| 130 | 130 | if ( is_array( $_asValue ) ) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return; |
| 165 | 165 | case 'json': // for json. |
| 166 | 166 | echo json_encode( ( array ) $vData ); |
| 167 | - return ; |
|
| 167 | + return; |
|
| 168 | 168 | case 'array': // for serialized PHP array. |
| 169 | 169 | default: // for anything else, |
| 170 | 170 | echo serialize( ( array ) $vData ); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Send mail. |
| 88 | - $_bSent = wp_mail( |
|
| 88 | + $_bSent = wp_mail( |
|
| 89 | 89 | $this->_getEmailArgument( $aInput, $aEmailOptions, 'to', $sSubmitSectionID ), |
| 90 | 90 | $this->_getEmailArgument( $aInput, $aEmailOptions, 'subject', $sSubmitSectionID ), |
| 91 | 91 | $_bIsHTML |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | remove_filter( 'wp_mail_from_name', array( $this, '_replyToSetEmailSenderAddress' ) ); |
| 101 | 101 | |
| 102 | 102 | // Clean up. |
| 103 | - foreach( $this->_aPathsToDelete as $_sPath ) { |
|
| 103 | + foreach ( $this->_aPathsToDelete as $_sPath ) { |
|
| 104 | 104 | unlink( $_sPath ); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $_aAttachments = $this->getAsArray( $asAttachments ); |
| 124 | - foreach( $_aAttachments as $_iIndex => $_sPathORURL ) { |
|
| 124 | + foreach ( $_aAttachments as $_iIndex => $_sPathORURL ) { |
|
| 125 | 125 | |
| 126 | 126 | // If it is a file path, fine. |
| 127 | 127 | if ( is_file( $_sPathORURL ) ) { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | // If the key element is empty, search the corresponding item in the same section. |
| 214 | - if ( ! $aEmailOptions[ $sKey ] ) { |
|
| 214 | + if ( !$aEmailOptions[ $sKey ] ) { |
|
| 215 | 215 | return $this->getArrayValueByArrayKeys( $aInput, array( $sSectionID, $sKey ) ); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - private function getElementInFilesArray( array $aFilesImport, $sInputID, $sElementKey='error' ) { |
|
| 60 | + private function getElementInFilesArray( array $aFilesImport, $sInputID, $sElementKey = 'error' ) { |
|
| 61 | 61 | |
| 62 | 62 | $sElementKey = strtolower( $sElementKey ); |
| 63 | 63 | return $this->getElement( |
| 64 | - $aFilesImport, // subject array |
|
| 64 | + $aFilesImport, // subject array |
|
| 65 | 65 | array( $sElementKey, $sInputID ), // dimensional keys |
| 66 | 66 | null // default |
| 67 | 67 | ); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return $vData; |
| 90 | 90 | |
| 91 | 91 | } |
| 92 | - public function formatImportData( &$vData, $sFormatType=null ) { |
|
| 92 | + public function formatImportData( &$vData, $sFormatType = null ) { |
|
| 93 | 93 | |
| 94 | 94 | $sFormatType = isset( $sFormatType ) ? $sFormatType : $this->getFormatType(); |
| 95 | 95 | switch ( strtolower( $sFormatType ) ) { |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function __construct( $oFactory ) { |
| 30 | 30 | |
| 31 | - $this->oFactory = $oFactory; |
|
| 31 | + $this->oFactory = $oFactory; |
|
| 32 | 32 | |
| 33 | 33 | // Form emails. |
| 34 | - if ( ! isset( $_GET[ 'apf_action' ], $_GET[ 'transient' ] ) ) { |
|
| 34 | + if ( !isset( $_GET[ 'apf_action' ], $_GET[ 'transient' ] ) ) { |
|
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | if ( 'email' !== $_GET[ 'apf_action' ] ) { |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | self::$_bDoneEmail = true; |
| 74 | 74 | |
| 75 | 75 | $_sTransient = $this->getElement( $_GET, 'transient', '' ); |
| 76 | - if ( ! $_sTransient ) { |
|
| 76 | + if ( !$_sTransient ) { |
|
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | 79 | $_aFormEmail = $this->getTransient( $_sTransient ); |
| 80 | 80 | $this->deleteTransient( $_sTransient ); |
| 81 | - if ( ! is_array( $_aFormEmail ) ) { |
|
| 81 | + if ( !is_array( $_aFormEmail ) ) { |
|
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -46,12 +46,12 @@ |
||
| 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 | - foreach( $aPostElements as $_sInputID => $_aSubElements ) { |
|
| 51 | + foreach ( $aPostElements as $_sInputID => $_aSubElements ) { |
|
| 52 | 52 | |
| 53 | 53 | // The 'name' key must be set. |
| 54 | - if ( ! isset( $_aSubElements[ 'name' ] ) ) { |
|
| 54 | + if ( !isset( $_aSubElements[ 'name' ] ) ) { |
|
| 55 | 55 | continue; |
| 56 | 56 | } |
| 57 | 57 | $_aNameKeys = explode( '|', $_aSubElements[ 'name' ] ); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | : 'add_filter'; |
| 37 | 37 | |
| 38 | 38 | $_sFunctionName( |
| 39 | - $this->sActionHookPrefix . $this->oFactory->oProp->sClassName, |
|
| 39 | + $this->sActionHookPrefix.$this->oFactory->oProp->sClassName, |
|
| 40 | 40 | array( $this, $this->sCallbackName ), |
| 41 | 41 | $this->iHookPriority, |
| 42 | 42 | $this->iCallbackParameters |
@@ -56,17 +56,17 @@ discard block |
||
| 56 | 56 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
| 57 | 57 | * @return array The intact stored options. |
| 58 | 58 | */ |
| 59 | - protected function _confirmSubmitButtonAction( $sPressedInputName, $sSectionID, $sType='reset' ) { |
|
| 59 | + protected function _confirmSubmitButtonAction( $sPressedInputName, $sSectionID, $sType = 'reset' ) { |
|
| 60 | 60 | |
| 61 | - switch( $sType ) { |
|
| 61 | + switch ( $sType ) { |
|
| 62 | 62 | default: |
| 63 | 63 | case 'reset': |
| 64 | 64 | $_sFieldErrorMessage = $this->oFactory->oMsg->get( 'reset_options' ); |
| 65 | - $_sTransientKey = 'apf_rc_' . md5( $sPressedInputName . get_current_user_id() ); |
|
| 65 | + $_sTransientKey = 'apf_rc_'.md5( $sPressedInputName.get_current_user_id() ); |
|
| 66 | 66 | break; |
| 67 | 67 | case 'email': |
| 68 | 68 | $_sFieldErrorMessage = $this->oFactory->oMsg->get( 'send_email' ); |
| 69 | - $_sTransientKey = 'apf_ec_' . md5( $sPressedInputName . get_current_user_id() ); |
|
| 69 | + $_sTransientKey = 'apf_ec_'.md5( $sPressedInputName.get_current_user_id() ); |
|
| 70 | 70 | break; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->oFactory->setFieldErrors( $_aErrors ); |
| 89 | 89 | |
| 90 | 90 | // Set a flag that the confirmation is displayed |
| 91 | - $this->setTransient( $_sTransientKey, $sPressedInputName, 60*2 ); |
|
| 91 | + $this->setTransient( $_sTransientKey, $sPressedInputName, 60 * 2 ); |
|
| 92 | 92 | |
| 93 | 93 | // Set the admin notice |
| 94 | 94 | $this->oFactory->setSettingNotice( $this->oFactory->oMsg->get( 'confirm_perform_task' ), 'error confirmation' ); |