@@ -60,6 +60,7 @@ |
||
| 60 | 60 | /** |
| 61 | 61 | * Applies the subject string to the set callback filter function. |
| 62 | 62 | * @since 3.6.0 |
| 63 | + * @param string $sSubject |
|
| 63 | 64 | */ |
| 64 | 65 | protected function _getFiltered( $sSubject ) { |
| 65 | 66 | return is_callable( $this->hfCallback ) |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | $_sIndex = $this->getAOrB( |
| 52 | 52 | '0' !== $this->sIndex && empty( $this->sIndex ), |
| 53 | 53 | '', |
| 54 | - "[" . $this->sIndex . "]" |
|
| 54 | + "[".$this->sIndex."]" |
|
| 55 | 55 | ); |
| 56 | - return $this->_getFiltered( $this->_getFieldName() . $_sIndex ); |
|
| 56 | + return $this->_getFiltered( $this->_getFieldName().$_sIndex ); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -51,6 +51,7 @@ |
||
| 51 | 51 | /** |
| 52 | 52 | * Applies the subject string to the set callback filter function. |
| 53 | 53 | * @since 3.6.0 |
| 54 | + * @param string $sSubject |
|
| 54 | 55 | */ |
| 55 | 56 | protected function _getFiltered( $sSubject ) { |
| 56 | 57 | return is_callable( $this->hfCallback ) |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $this->hfCallback, |
| 36 | 36 | ); |
| 37 | 37 | $this->aArguments = $_aParameters[ 0 ]; |
| 38 | - $this->hfCallback = $_aParameters[ 1 ]; |
|
| 38 | + $this->hfCallback = $_aParameters[ 1 ]; |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
@@ -202,6 +202,7 @@ |
||
| 202 | 202 | * |
| 203 | 203 | * @since 3.3.0 |
| 204 | 204 | * @since 3.4.2 Moved from the validation class. |
| 205 | + * @param string $sKey |
|
| 205 | 206 | */ |
| 206 | 207 | private function _getEmailArgument( $aInput, array $aEmailOptions, $sKey, $sSectionID ) { |
| 207 | 208 | |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | ); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - /** |
|
| 280 | + /** |
|
| 281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
| 282 | 282 | * |
| 283 | 283 | * @since 3.5.6 |
@@ -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 | |
@@ -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 | } |
@@ -89,6 +89,11 @@ |
||
| 89 | 89 | return $vData; |
| 90 | 90 | |
| 91 | 91 | } |
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * @param string $vData |
|
| 95 | + * @param string $sFormatType |
|
| 96 | + */ |
|
| 92 | 97 | public function formatImportData( &$vData, $sFormatType=null ) { |
| 93 | 98 | |
| 94 | 99 | $sFormatType = isset( $sFormatType ) ? $sFormatType : $this->getFormatType(); |
@@ -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 ) ) { |
@@ -281,6 +281,8 @@ discard block |
||
| 281 | 281 | * @remark Used by the setInPageTabsVisibility() method. |
| 282 | 282 | * @since 2.0.0 |
| 283 | 283 | * @since 2.1.5 The $oCaller parameter was added. |
| 284 | + * @param AdminPageFramework_Router $oCaller |
|
| 285 | + * @param string $sClassName |
|
| 284 | 286 | */ |
| 285 | 287 | public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
| 286 | 288 | |
@@ -419,6 +421,7 @@ discard block |
||
| 419 | 421 | * |
| 420 | 422 | * This is to support transient form data which disappears with the set timeout. |
| 421 | 423 | * |
| 424 | + * @param string $sOptionType |
|
| 422 | 425 | * @return array The retrieved options array. |
| 423 | 426 | */ |
| 424 | 427 | private function _getOptionsByType( $sOptionType ) { |
@@ -486,6 +489,7 @@ discard block |
||
| 486 | 489 | /** |
| 487 | 490 | * |
| 488 | 491 | * @since 3.5.9 |
| 492 | + * @param string $sOptionType |
|
| 489 | 493 | * @return boolean True if saved; otherwise, false. |
| 490 | 494 | */ |
| 491 | 495 | private function _updateOptionsByType( $aOptions, $sOptionType ) { |
@@ -581,6 +585,7 @@ discard block |
||
| 581 | 585 | * @since 2.1.5 Made it public and moved from the AdminPageFramework_Page class since this method is used by the AdminPageFramework_HeadTab class as well. |
| 582 | 586 | * @internal |
| 583 | 587 | * @remark Used in the __call() method in the main class. |
| 588 | + * @param string $sPageSlug |
|
| 584 | 589 | * @return string The default in-page tab slug if found; otherwise, an empty string. |
| 585 | 590 | */ |
| 586 | 591 | public function getDefaultInPageTab( $sPageSlug ) { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public $aDisallowedQueryKeys = array( |
| 218 | 218 | 'settings-updated', |
| 219 | - 'confirmation', // 3.3.0+ |
|
| 219 | + 'confirmation', // 3.3.0+ |
|
| 220 | 220 | 'field_errors' // 3.4.1+ |
| 221 | 221 | ); |
| 222 | 222 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * Stores the cache lifetime of the transient used for the form options when the user passes an integer to the option key parameter. |
| 272 | 272 | * @since 3.5.9 |
| 273 | 273 | */ |
| 274 | - public $iOptionTransientDuration = 0; |
|
| 274 | + public $iOptionTransientDuration = 0; |
|
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | 277 | * Constructs the instance of AdminPageFramework_Property_Page class object. |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * @since 2.0.0 |
| 281 | 281 | * @since 2.1.5 The $oCaller parameter was added. |
| 282 | 282 | */ |
| 283 | - public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
| 283 | + public function __construct( $oCaller, $sCallerPath, $sClassName, $aisOptionKey, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
| 284 | 284 | |
| 285 | 285 | parent::__construct( |
| 286 | 286 | $oCaller, |
@@ -299,10 +299,10 @@ discard block |
||
| 299 | 299 | ); |
| 300 | 300 | |
| 301 | 301 | /* Store the page class objects in the global storage. These will be referred by the meta box class to determine if the passed page slug's screen ID (hook suffix). */ |
| 302 | - $GLOBALS['aAdminPageFramework']['aPageClasses'] = isset( $GLOBALS['aAdminPageFramework']['aPageClasses'] ) && is_array( $GLOBALS['aAdminPageFramework']['aPageClasses'] ) |
|
| 303 | - ? $GLOBALS['aAdminPageFramework']['aPageClasses'] |
|
| 302 | + $GLOBALS[ 'aAdminPageFramework' ][ 'aPageClasses' ] = isset( $GLOBALS[ 'aAdminPageFramework' ][ 'aPageClasses' ] ) && is_array( $GLOBALS[ 'aAdminPageFramework' ][ 'aPageClasses' ] ) |
|
| 303 | + ? $GLOBALS[ 'aAdminPageFramework' ][ 'aPageClasses' ] |
|
| 304 | 304 | : array(); |
| 305 | - $GLOBALS['aAdminPageFramework']['aPageClasses'][ $sClassName ] = $oCaller; // The meta box class for pages needs to access the object. |
|
| 305 | + $GLOBALS[ 'aAdminPageFramework' ][ 'aPageClasses' ][ $sClassName ] = $oCaller; // The meta box class for pages needs to access the object. |
|
| 306 | 306 | |
| 307 | 307 | // The capability for the settings. $this->sOptionKey is the part that is set in the settings_fields() function. |
| 308 | 308 | // This prevents the "Cheatin' huh?" message. |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | // The user want to save options in a transient. |
| 355 | 355 | if ( in_array( $_sType, array( 'integer' ) ) ) { |
| 356 | - return 'apf_' . $sClassName . '_' . get_current_user_id(); |
|
| 356 | + return 'apf_'.$sClassName.'_'.get_current_user_id(); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | // Unknown type - maybe the user is trying to do something advanced. |
@@ -380,10 +380,10 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | protected function _isAdminPage() { |
| 382 | 382 | |
| 383 | - if ( ! is_admin() ) { |
|
| 383 | + if ( !is_admin() ) { |
|
| 384 | 384 | return false; |
| 385 | 385 | } |
| 386 | - return isset( $_GET['page'] ); |
|
| 386 | + return isset( $_GET[ 'page' ] ); |
|
| 387 | 387 | |
| 388 | 388 | } |
| 389 | 389 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | $_aOptions = $this->oUtil->addAndApplyFilter( |
| 401 | 401 | $this->oCaller, // 3.4.1+ changed from $GLOBALS['aAdminPageFramework']['aPageClasses'][ $this->sClassName ], // the caller object |
| 402 | - 'options_' . $this->sClassName, // options_{instantiated class name} |
|
| 402 | + 'options_'.$this->sClassName, // options_{instantiated class name} |
|
| 403 | 403 | $this->_getOptionsByType( $this->sOptionType ) // filtering item |
| 404 | 404 | ); |
| 405 | 405 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | // while getSavedOptions() method is called every time a field is processed for outputs. |
| 409 | 409 | // However, in getSavedOptions, also the last input array is merged when the 'confirmation' query key is set, |
| 410 | 410 | // that should be done here. |
| 411 | - $_aLastInput = isset( $_GET['field_errors'] ) && $_GET['field_errors'] |
|
| 411 | + $_aLastInput = isset( $_GET[ 'field_errors' ] ) && $_GET[ 'field_errors' ] |
|
| 412 | 412 | ? $this->_getLastInput() |
| 413 | 413 | : array(); |
| 414 | 414 | $_aOptions = $_aLastInput + $this->oUtil->getAsArray( $_aOptions ); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | case 'transient': |
| 434 | 434 | return $this->oUtil->getAsArray( |
| 435 | 435 | $this->oUtil->getTransient( |
| 436 | - $this->sOptionKey, // transient key |
|
| 436 | + $this->sOptionKey, // transient key |
|
| 437 | 437 | array() // default |
| 438 | 438 | ) |
| 439 | 439 | ); |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | * @since 3.1.1 Made it return a value. |
| 468 | 468 | * @return boolean True if saved; otherwise, false. |
| 469 | 469 | */ |
| 470 | - public function updateOption( $aOptions=null ) { |
|
| 470 | + public function updateOption( $aOptions = null ) { |
|
| 471 | 471 | |
| 472 | 472 | if ( $this->_bDisableSavingOptions ) { |
| 473 | 473 | return false; |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | ); |
| 496 | 496 | case 'transient': |
| 497 | 497 | return $this->oUtil->setTransient( |
| 498 | - $this->sOptionKey, // transient key |
|
| 498 | + $this->sOptionKey, // transient key |
|
| 499 | 499 | $aOptions, |
| 500 | 500 | $this->iOptionTransientDuration |
| 501 | 501 | ); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | * @since 2.1.0 Set the default value to the parameter and if the parameter value is empty, it applies the current $_GET['page'] value. |
| 511 | 511 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
| 512 | 512 | */ |
| 513 | - public function isPageAdded( $sPageSlug='' ) { |
|
| 513 | + public function isPageAdded( $sPageSlug = '' ) { |
|
| 514 | 514 | |
| 515 | 515 | $sPageSlug = trim( $sPageSlug ); |
| 516 | 516 | $sPageSlug = $sPageSlug |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | */ |
| 530 | 530 | public function getCurrentPageSlug() { |
| 531 | 531 | return $this->oUtil->getElement( |
| 532 | - $_GET, // subject array |
|
| 532 | + $_GET, // subject array |
|
| 533 | 533 | 'page', // key |
| 534 | 534 | '' // default |
| 535 | 535 | ); |
@@ -547,10 +547,10 @@ discard block |
||
| 547 | 547 | * @return string The found tab slug. An empty string if not found. |
| 548 | 548 | * @remark Do not return `null` when not found as some framework methods check the returned value with `isset()` and if null is given, `isset()` yields `false` while it does `true` for an empty string (''). |
| 549 | 549 | */ |
| 550 | - public function getCurrentTabSlug( $sCurrentPageSlug='' ) { |
|
| 550 | + public function getCurrentTabSlug( $sCurrentPageSlug = '' ) { |
|
| 551 | 551 | |
| 552 | - if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { |
|
| 553 | - return $_GET['tab']; |
|
| 552 | + if ( isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] ) { |
|
| 553 | + return $_GET[ 'tab' ]; |
|
| 554 | 554 | } |
| 555 | 555 | $sCurrentPageSlug = $sCurrentPageSlug |
| 556 | 556 | ? $sCurrentPageSlug |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | * |
| 566 | 566 | * @deprecated 3.5.3 |
| 567 | 567 | */ |
| 568 | - public function getCurrentTab( $sCurrentPageSlug='' ) { |
|
| 568 | + public function getCurrentTab( $sCurrentPageSlug = '' ) { |
|
| 569 | 569 | return $this->getCurrentTabSlug( $sCurrentPageSlug ); |
| 570 | 570 | } |
| 571 | 571 | |
@@ -580,11 +580,11 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | public function getDefaultInPageTab( $sPageSlug ) { |
| 582 | 582 | |
| 583 | - if ( ! $sPageSlug ) { |
|
| 583 | + if ( !$sPageSlug ) { |
|
| 584 | 584 | return ''; |
| 585 | 585 | } |
| 586 | 586 | return $this->oUtil->getElement( |
| 587 | - $this->aDefaultInPageTabs, // subject array |
|
| 587 | + $this->aDefaultInPageTabs, // subject array |
|
| 588 | 588 | $sPageSlug, // key |
| 589 | 589 | '' // default |
| 590 | 590 | ); |
@@ -599,14 +599,14 @@ discard block |
||
| 599 | 599 | public function getDefaultOptions( $aFields ) { |
| 600 | 600 | |
| 601 | 601 | $_aDefaultOptions = array(); |
| 602 | - foreach( $aFields as $_sSectionID => $_aFields ) { |
|
| 602 | + foreach ( $aFields as $_sSectionID => $_aFields ) { |
|
| 603 | 603 | |
| 604 | - foreach( $_aFields as $_sFieldID => $_aField ) { |
|
| 604 | + foreach ( $_aFields as $_sFieldID => $_aField ) { |
|
| 605 | 605 | |
| 606 | 606 | $_vDefault = $this->_getDefautValue( $_aField ); |
| 607 | 607 | |
| 608 | - if ( isset( $_aField['section_id'] ) && $_aField['section_id'] != '_default' ) { |
|
| 609 | - $_aDefaultOptions[ $_aField['section_id'] ][ $_sFieldID ] = $_vDefault; |
|
| 608 | + if ( isset( $_aField[ 'section_id' ] ) && $_aField[ 'section_id' ] != '_default' ) { |
|
| 609 | + $_aDefaultOptions[ $_aField[ 'section_id' ] ][ $_sFieldID ] = $_vDefault; |
|
| 610 | 610 | } else { |
| 611 | 611 | $_aDefaultOptions[ $_sFieldID ] = $_vDefault; |
| 612 | 612 | } |
@@ -633,11 +633,11 @@ discard block |
||
| 633 | 633 | // If there are no sub-fields |
| 634 | 634 | if ( count( $_aSubFields ) == 0 ) { |
| 635 | 635 | return $this->oUtil->getElement( |
| 636 | - $aField, // subject |
|
| 637 | - 'value', // key |
|
| 636 | + $aField, // subject |
|
| 637 | + 'value', // key |
|
| 638 | 638 | $this->oUtil->getElement( // default value |
| 639 | - $aField, // subject |
|
| 640 | - 'default', // key |
|
| 639 | + $aField, // subject |
|
| 640 | + 'default', // key |
|
| 641 | 641 | null // default value |
| 642 | 642 | ) |
| 643 | 643 | ); |
@@ -646,13 +646,13 @@ discard block |
||
| 646 | 646 | // Otherwise, there are sub-fields |
| 647 | 647 | $_aDefault = array(); |
| 648 | 648 | array_unshift( $_aSubFields, $aField ); // insert the main field into the very first index. |
| 649 | - foreach( $_aSubFields as $_iIndex => $_aField ) { |
|
| 649 | + foreach ( $_aSubFields as $_iIndex => $_aField ) { |
|
| 650 | 650 | $_aDefault[ $_iIndex ] = $this->oUtil->getElement( |
| 651 | - $_aField, // subject |
|
| 652 | - 'value', // key |
|
| 651 | + $_aField, // subject |
|
| 652 | + 'value', // key |
|
| 653 | 653 | $this->oUtil->getElement( // default value |
| 654 | - $_aField, // subject |
|
| 655 | - 'default', // key |
|
| 654 | + $_aField, // subject |
|
| 655 | + 'default', // key |
|
| 656 | 656 | null // default value |
| 657 | 657 | ) |
| 658 | 658 | ); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @since 3.5.9 |
| 315 | 315 | * @return void |
| 316 | 316 | */ |
| 317 | - private function _setOptionsProperties( $aisOptionKey, $sClassName ) { |
|
| 317 | + private function _setOptionsProperties( $aisOptionKey, $sClassName ) { |
|
| 318 | 318 | |
| 319 | 319 | $_aArguments = is_array( $aisOptionKey ) |
| 320 | 320 | ? $aisOptionKey |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | * @since 2.1.0 Set the default value to the parameter and if the parameter value is empty, it applies the current $_GET['page'] value. |
| 511 | 511 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
| 512 | 512 | */ |
| 513 | - public function isPageAdded( $sPageSlug='' ) { |
|
| 513 | + public function isPageAdded( $sPageSlug='' ) { |
|
| 514 | 514 | |
| 515 | 515 | $sPageSlug = trim( $sPageSlug ); |
| 516 | 516 | $sPageSlug = $sPageSlug |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | */ |
| 550 | 550 | public function getCurrentTabSlug( $sCurrentPageSlug='' ) { |
| 551 | 551 | |
| 552 | - if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { |
|
| 552 | + if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { |
|
| 553 | 553 | return $_GET['tab']; |
| 554 | 554 | } |
| 555 | 555 | $sCurrentPageSlug = $sCurrentPageSlug |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | public function getDefaultInPageTab( $sPageSlug ) { |
| 582 | 582 | |
| 583 | - if ( ! $sPageSlug ) { |
|
| 583 | + if ( ! $sPageSlug ) { |
|
| 584 | 584 | return ''; |
| 585 | 585 | } |
| 586 | 586 | return $this->oUtil->getElement( |
@@ -79,6 +79,7 @@ |
||
| 79 | 79 | * @since 3.5.3 |
| 80 | 80 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Validation_Option`. |
| 81 | 81 | * @internal |
| 82 | + * @param boolean $bIsInputEmtpy |
|
| 82 | 83 | * @return void |
| 83 | 84 | * @remark Accessed from some of the parent/child classes. |
| 84 | 85 | */ |
@@ -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' ] ); |
@@ -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( |
@@ -92,6 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @since 3.5.4 |
| 94 | 94 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
| 95 | + * @param string $sFileName |
|
| 95 | 96 | * @return array |
| 96 | 97 | */ |
| 97 | 98 | private function _getExportHeaderArray( array $aArguments, $sFileName, $mData ) { |
@@ -132,6 +133,7 @@ discard block |
||
| 132 | 133 | * @since 3.5.3 |
| 133 | 134 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
| 134 | 135 | * @internal |
| 136 | + * @param string $mData |
|
| 135 | 137 | * @return string The export file name. |
| 136 | 138 | */ |
| 137 | 139 | private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 35 | 35 | |
| 36 | - if ( ! $this->_shouldProceed() ) { |
|
| 36 | + if ( !$this->_shouldProceed() ) { |
|
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | 39 | $this->_exportOptions( |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function _exportOptions( $mData, $sPageSlug, $sTabSlug ) { |
| 67 | 67 | |
| 68 | - $_oExport = new AdminPageFramework_ExportOptions( |
|
| 68 | + $_oExport = new AdminPageFramework_ExportOptions( |
|
| 69 | 69 | $_POST[ '__export' ], |
| 70 | 70 | $this->oFactory->oProp->sClassName |
| 71 | 71 | ); |
| 72 | - $_aArguments = array( |
|
| 72 | + $_aArguments = array( |
|
| 73 | 73 | 'class_name' => $this->oFactory->oProp->sClassName, |
| 74 | 74 | 'page_slug' => $sPageSlug, |
| 75 | 75 | 'tab_slug' => $sTabSlug, |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $sExportFileName, |
| 142 | 142 | $aArguments[ 'pressed_field_id' ], |
| 143 | 143 | $aArguments[ 'pressed_input_id' ], |
| 144 | - $mData, // 3.4.6+ |
|
| 144 | + $mData, // 3.4.6+ |
|
| 145 | 145 | $this->oFactory // 3.4.6+ |
| 146 | 146 | ); |
| 147 | 147 | } |
@@ -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, |
@@ -143,6 +143,7 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * Sets update admin notice. |
| 145 | 145 | * @since 3.5.3 |
| 146 | + * @param boolean $bEmpty |
|
| 146 | 147 | * @return void |
| 147 | 148 | */ |
| 148 | 149 | private function _setImportAdminNotice( $bEmpty ) { |
@@ -204,6 +205,8 @@ discard block |
||
| 204 | 205 | * @since 3.5.3 |
| 205 | 206 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Import`. |
| 206 | 207 | * @internal |
| 208 | + * @param string $sFormatType |
|
| 209 | + * @param string $sImportOptionKey |
|
| 207 | 210 | * @return string The filtered import data. |
| 208 | 211 | */ |
| 209 | 212 | private function _getFilteredImportData( array $aArguments, $mData, $aStoredOptions, $sFormatType, $sImportOptionKey ) { |
@@ -232,6 +235,7 @@ discard block |
||
| 232 | 235 | * @param string The filter prefix. |
| 233 | 236 | * @param mixed The subject filtering value. |
| 234 | 237 | * @param array An argument array holding submit information. Part of this will be passed to the filter callbacks but this itself does not mean is for the filter callbacks. |
| 238 | + * @param string $sPrefix |
|
| 235 | 239 | */ |
| 236 | 240 | protected function _getFilteredItemForPortByPrefix( $sPrefix, $mFilteringValue, array $aArguments ) { |
| 237 | 241 | return $this->addAndApplyFilters( |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @callback action try_validation_after_{class name} |
| 33 | 33 | */ |
| 34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 35 | - if ( ! $this->_shouldProceed() ) { |
|
| 35 | + if ( !$this->_shouldProceed() ) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | $this->_doImportOptions( |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | // Check the uploaded file MIME type. |
| 103 | 103 | $_aMIMEType = $this->_getImportMIMEType( $_aArguments ); |
| 104 | 104 | $_sType = $_oImport->getType(); |
| 105 | - if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
| 105 | + if ( !in_array( $_sType, $_aMIMEType ) ) { |
|
| 106 | 106 | $this->oFactory->setSettingNotice( sprintf( $this->oFactory->oMsg->get( 'uploaded_file_type_not_supported' ), $_sType ) ); |
| 107 | - return $aStoredOptions; // do not change the framework's options. |
|
| 107 | + return $aStoredOptions; // do not change the framework's options. |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Retrieve the importing data. |
@@ -254,18 +254,18 @@ discard block |
||
| 254 | 254 | protected function _getPortFilterHookNames( $sPrefix, array $aArguments ) { |
| 255 | 255 | |
| 256 | 256 | return array( |
| 257 | - $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_input_id' ], |
|
| 257 | + $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_input_id' ], |
|
| 258 | 258 | $aArguments[ 'section_id' ] |
| 259 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] .'_' . $aArguments[ 'pressed_field_id' ] |
|
| 260 | - : $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_field_id' ], |
|
| 259 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ].'_'.$aArguments[ 'pressed_field_id' ] |
|
| 260 | + : $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_field_id' ], |
|
| 261 | 261 | $aArguments[ 'section_id' ] |
| 262 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] |
|
| 262 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ] |
|
| 263 | 263 | : null, |
| 264 | 264 | $aArguments[ 'tab_slug' ] |
| 265 | - ? $sPrefix . $aArguments[ 'page_slug' ] . '_' . $aArguments[ 'tab_slug' ] |
|
| 265 | + ? $sPrefix.$aArguments[ 'page_slug' ].'_'.$aArguments[ 'tab_slug' ] |
|
| 266 | 266 | : null, |
| 267 | - $sPrefix . $aArguments[ 'page_slug' ], |
|
| 268 | - $sPrefix . $aArguments[ 'class_name' ] |
|
| 267 | + $sPrefix.$aArguments[ 'page_slug' ], |
|
| 268 | + $sPrefix.$aArguments[ 'class_name' ] |
|
| 269 | 269 | ); |
| 270 | 270 | |
| 271 | 271 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | // Check the uploaded file MIME type. |
| 103 | 103 | $_aMIMEType = $this->_getImportMIMEType( $_aArguments ); |
| 104 | 104 | $_sType = $_oImport->getType(); |
| 105 | - if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
| 105 | + if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
| 106 | 106 | $this->oFactory->setSettingNotice( sprintf( $this->oFactory->oMsg->get( 'uploaded_file_type_not_supported' ), $_sType ) ); |
| 107 | 107 | return $aStoredOptions; // do not change the framework's options. |
| 108 | 108 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @since 3.5.3 |
| 164 | 164 | * @return array An array holding processable MIME types. |
| 165 | 165 | */ |
| 166 | - private function _getImportMIMEType( array $aArguments ) { |
|
| 166 | + private function _getImportMIMEType( array $aArguments ) { |
|
| 167 | 167 | return $this->_getFilteredItemForPortByPrefix( |
| 168 | 168 | 'import_mime_types_', |
| 169 | 169 | array( 'text/plain', 'application/octet-stream' ), // .json file is dealt as a binary file. |
@@ -66,6 +66,7 @@ |
||
| 66 | 66 | * Sets the given URL's transient. |
| 67 | 67 | * @since unknown |
| 68 | 68 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
| 69 | + * @param string $sURL |
|
| 69 | 70 | */ |
| 70 | 71 | private function _setRedirectTransients( $sURL, $sPageSlug ) { |
| 71 | 72 | if ( empty( $sURL ) ) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $aSubmits, |
| 36 | 36 | 'redirect_url' |
| 37 | 37 | ); |
| 38 | - if ( ! $_sRedirectURL ) { |
|
| 38 | + if ( !$_sRedirectURL ) { |
|
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | if ( empty( $sURL ) ) { |
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | - $_sTransient = 'apf_rurl' . md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$sPageSlug}" ) ); |
|
| 75 | - return $this->setTransient( $_sTransient, $sURL , 60*2 ); |
|
| 74 | + $_sTransient = 'apf_rurl'.md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$sPageSlug}" ) ); |
|
| 75 | + return $this->setTransient( $_sTransient, $sURL, 60 * 2 ); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | \ No newline at end of file |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
| 69 | 69 | */ |
| 70 | 70 | private function _setRedirectTransients( $sURL, $sPageSlug ) { |
| 71 | - if ( empty( $sURL ) ) { |
|
| 71 | + if ( empty( $sURL ) ) { |
|
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | $_sTransient = 'apf_rurl' . md5( trim( "redirect_{$this->oFactory->oProp->sClassName}_{$sPageSlug}" ) ); |