@@ -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 ) { |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Admin Page Framework |
|
| 4 | - * |
|
| 5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
| 6 | - * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
| 7 | - * |
|
| 8 | - */ |
|
| 3 | + * Admin Page Framework |
|
| 4 | + * |
|
| 5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
| 6 | + * Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Provides methods to handle importing options. |
@@ -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}" ) ); |
@@ -60,6 +60,7 @@ |
||
| 60 | 60 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
| 61 | 61 | * @remark `$aInputs` has only the page elements that called the validation callback. |
| 62 | 62 | * In other words, it does not hold other pages' option keys. |
| 63 | + * @param string $sKeyToReset |
|
| 63 | 64 | * @return array The modified input array. |
| 64 | 65 | */ |
| 65 | 66 | private function _resetOptions( $sKeyToReset, array $aInputs, array $aSubmitInformation ) { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'reset_key' |
| 42 | 42 | ); |
| 43 | 43 | $_sKeyToReset = trim( $_sKeyToReset ); |
| 44 | - if ( ! $_sKeyToReset ) { |
|
| 44 | + if ( !$_sKeyToReset ) { |
|
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | $_oException = new Exception( 'aReturn' ); |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | $this->_doResetActions( $sKeyToReset, $aInputs, $aSubmitInformation ); |
| 69 | 69 | |
| 70 | 70 | // As of 3.1.0, an empty value is accepted for the option key. |
| 71 | - if ( ! $this->oFactory->oProp->sOptionKey ) { |
|
| 71 | + if ( !$this->oFactory->oProp->sOptionKey ) { |
|
| 72 | 72 | return array(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // The key to delete is not specified, 1 is sent from the form input. |
| 76 | - if ( in_array( $sKeyToReset, array( '1', ), true ) ) { |
|
| 76 | + if ( in_array( $sKeyToReset, array( '1',), true ) ) { |
|
| 77 | 77 | delete_option( $this->oFactory->oProp->sOptionKey ); |
| 78 | 78 | return array(); |
| 79 | 79 | } |
@@ -28,6 +28,7 @@ |
||
| 28 | 28 | /** |
| 29 | 29 | * Sets up properties. |
| 30 | 30 | * @since 3.6.3 |
| 31 | + * @param AdminPageFramework_View_Page $oFactory |
|
| 31 | 32 | */ |
| 32 | 33 | public function __construct( $oFactory, $sPageSlug, $sTabSlug ) { |
| 33 | 34 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // Do actions before rendering the page. In this order, global -> page -> in-page tab |
| 49 | 49 | $this->addAndDoActions( |
| 50 | - $this->oFactory, // the caller object |
|
| 50 | + $this->oFactory, // the caller object |
|
| 51 | 51 | $this->getFilterArrayByPrefix( 'do_before_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
| 52 | 52 | $this->oFactory // the argument 1 |
| 53 | 53 | ); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | </div><!-- #post-body --> |
| 73 | 73 | </div><!-- #poststuff --> |
| 74 | 74 | |
| 75 | - <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
| 75 | + <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
| 76 | 76 | </div><!-- .admin-page-framework-container --> |
| 77 | 77 | |
| 78 | 78 | <?php |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | <?php |
| 84 | 84 | // Do actions after rendering the page. |
| 85 | 85 | $this->addAndDoActions( |
| 86 | - $this->oFactory, // the caller object |
|
| 86 | + $this->oFactory, // the caller object |
|
| 87 | 87 | $this->getFilterArrayByPrefix( 'do_after_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
| 88 | 88 | $this->oFactory // the argument 1 |
| 89 | 89 | ); |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | private function _getNumberOfColumns() { |
| 102 | 102 | |
| 103 | - if ( ! $this->doesMetaBoxExist( 'side' ) ) { |
|
| 103 | + if ( !$this->doesMetaBoxExist( 'side' ) ) { |
|
| 104 | 104 | return 1; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $_iColumns = $this->getNumberOfScreenColumns(); |
| 108 | 108 | return $_iColumns |
| 109 | 109 | ? $_iColumns |
| 110 | - : 1; // default - this is because generic pages do not have meta boxes. |
|
| 110 | + : 1; // default - this is because generic pages do not have meta boxes. |
|
| 111 | 111 | } |
| 112 | 112 | // @deprecated |
| 113 | 113 | // Make sure if no side meta box exists, set it 1. |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | private function _getContentTop() { |
| 127 | 127 | |
| 128 | 128 | // Screen icon, page heading tabs(page title), and in-page tabs. |
| 129 | - $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
| 129 | + $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
| 130 | 130 | $this->oFactory, |
| 131 | 131 | $this->sPageSlug, |
| 132 | 132 | $this->sTabSlug |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $this->oFactory, |
| 143 | 143 | $this->sPageSlug |
| 144 | 144 | ); |
| 145 | - $_sContentTop .= $_oInPageTabs->get(); |
|
| 145 | + $_sContentTop .= $_oInPageTabs->get(); |
|
| 146 | 146 | |
| 147 | 147 | // Apply filters in this order, in-page tab -> page -> global. |
| 148 | 148 | return $this->addAndApplyFilters( |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | private function _getFormOutput( $sPageSlug ) { |
| 216 | 216 | |
| 217 | - if ( ! $this->oFactory->oProp->bEnableForm ) { |
|
| 217 | + if ( !$this->oFactory->oProp->bEnableForm ) { |
|
| 218 | 218 | return ''; |
| 219 | 219 | } |
| 220 | 220 | return $this->oFactory->oForm->get(); |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | * @internal |
| 245 | 245 | * @return void |
| 246 | 246 | */ |
| 247 | - private function _printFormOpeningTag( $fEnableForm=true ) { |
|
| 247 | + private function _printFormOpeningTag( $fEnableForm = true ) { |
|
| 248 | 248 | |
| 249 | - if ( ! $fEnableForm ) { |
|
| 249 | + if ( !$fEnableForm ) { |
|
| 250 | 250 | return; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | 'action' => wp_unslash( remove_query_arg( 'settings-updated', $this->oFactory->oProp->sTargetFormPage ) ), |
| 260 | 260 | ) |
| 261 | 261 | ) |
| 262 | - . " >" . PHP_EOL; |
|
| 262 | + . " >".PHP_EOL; |
|
| 263 | 263 | |
| 264 | 264 | // [3.5.11+] Insert a mark that indicates the framework form has started. |
| 265 | 265 | // This will be checked in the validation method with the `is_admin_page_framework` input value which gets inserted at the end of the form |
| 266 | 266 | // in order to determine all the fields are sent for the PHP max_input_vars limitation set in the server configuration. |
| 267 | - echo "<input type='hidden' name='admin_page_framework_start' value='1' />" . PHP_EOL; |
|
| 267 | + echo "<input type='hidden' name='admin_page_framework_start' value='1' />".PHP_EOL; |
|
| 268 | 268 | |
| 269 | 269 | // Embed the '_wp_http_referer' hidden field that is checked in the submit data processing method. |
| 270 | 270 | settings_fields( $this->oFactory->oProp->sOptionKey ); |
@@ -280,19 +280,19 @@ discard block |
||
| 280 | 280 | * @internal |
| 281 | 281 | * @return void |
| 282 | 282 | */ |
| 283 | - private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm=true ) { |
|
| 283 | + private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm = true ) { |
|
| 284 | 284 | |
| 285 | - if ( ! $fEnableForm ) { |
|
| 285 | + if ( !$fEnableForm ) { |
|
| 286 | 286 | return; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - $_sNonceTransientKey = 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ); |
|
| 290 | - $_sNonce = $this->getTransient( $_sNonceTransientKey, '_admin_page_framework_form_nonce_' . uniqid() ); |
|
| 291 | - $this->setTransient( $_sNonceTransientKey, $_sNonce, 60*60 ); // 60 minutes |
|
| 292 | - echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />" . PHP_EOL |
|
| 293 | - . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />" . PHP_EOL |
|
| 294 | - . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />" . PHP_EOL |
|
| 295 | - . "</form><!-- End Form -->" . PHP_EOL; |
|
| 289 | + $_sNonceTransientKey = 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ); |
|
| 290 | + $_sNonce = $this->getTransient( $_sNonceTransientKey, '_admin_page_framework_form_nonce_'.uniqid() ); |
|
| 291 | + $this->setTransient( $_sNonceTransientKey, $_sNonce, 60 * 60 ); // 60 minutes |
|
| 292 | + echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />".PHP_EOL |
|
| 293 | + . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />".PHP_EOL |
|
| 294 | + . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />".PHP_EOL |
|
| 295 | + . "</form><!-- End Form -->".PHP_EOL; |
|
| 296 | 296 | |
| 297 | 297 | } |
| 298 | 298 | |
@@ -244,7 +244,7 @@ |
||
| 244 | 244 | * @internal |
| 245 | 245 | * @return void |
| 246 | 246 | */ |
| 247 | - private function _printFormOpeningTag( $fEnableForm=true ) { |
|
| 247 | + private function _printFormOpeningTag( $fEnableForm=true ) { |
|
| 248 | 248 | |
| 249 | 249 | if ( ! $fEnableForm ) { |
| 250 | 250 | return; |
@@ -60,6 +60,7 @@ discard block |
||
| 60 | 60 | * @since 3.3.1 Moved from `AdminPageFramework_Page`. |
| 61 | 61 | * @since 3.5.3 Deprecated the `$aOutput` parameter. |
| 62 | 62 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. Changed the name from `_getPageHeadingTabs()`. |
| 63 | + * @param string $sTag |
|
| 63 | 64 | * @return string the output of page heading tabs. |
| 64 | 65 | */ |
| 65 | 66 | private function _getOutput( $aPage, $sTag ) { |
@@ -100,6 +101,7 @@ discard block |
||
| 100 | 101 | * @internal |
| 101 | 102 | * @since 3.5.3 |
| 102 | 103 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 104 | + * @param string $sTag |
|
| 103 | 105 | * @return string the HTML page heading tab navigation bar output. |
| 104 | 106 | */ |
| 105 | 107 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
| 46 | 46 | |
| 47 | 47 | // If the page title is disabled, return an empty string. |
| 48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
| 48 | + if ( !$_aPage[ 'show_page_title' ] ) { |
|
| 49 | 49 | return ""; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | private function _getOutput( $aPage, $sTag ) { |
| 66 | 66 | |
| 67 | - $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
| 67 | + $sTag = $this->_getPageHeadingTabTag( $sTag, $aPage ); |
|
| 68 | 68 | |
| 69 | 69 | // If the page heading tab visibility is disabled, or only one page is registered, return the title. |
| 70 | - if ( ! $aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
| 70 | + if ( !$aPage[ 'show_page_heading_tabs' ] || count( $this->oFactory->oProp->aPages ) == 1 ) { |
|
| 71 | 71 | return "<{$sTag}>" |
| 72 | 72 | . $aPage[ 'title' ] |
| 73 | 73 | . "</{$sTag}>"; |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | private function _getPageHeadingtabNavigationBar( array $aPages, $sTag, $sCurrentPageSlug ) { |
| 106 | 106 | |
| 107 | 107 | $_oTabBar = new AdminPageFramework_TabNavigationBar( |
| 108 | - $aPages, // tab items |
|
| 108 | + $aPages, // tab items |
|
| 109 | 109 | $sCurrentPageSlug, // active tab slug |
| 110 | - $sTag, // container tag |
|
| 110 | + $sTag, // container tag |
|
| 111 | 111 | array( // container attributes |
| 112 | 112 | // 'class' => '...', |
| 113 | 113 | ), |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | * @since 3.5.10 |
| 131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 132 | 132 | */ |
| 133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
| 134 | - switch( $aSubPage['type'] ) { |
|
| 133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments = array() ) { |
|
| 134 | + switch ( $aSubPage[ 'type' ] ) { |
|
| 135 | 135 | case 'link': |
| 136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |
| 137 | 137 | default: |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | private function _getFormattedPageHeadingtabNavigationBarPageItem( array $aSubPage, $aStructure ) { |
| 150 | 150 | |
| 151 | - if ( ! isset( $aSubPage[ 'page_slug' ] ) ) { |
|
| 151 | + if ( !isset( $aSubPage[ 'page_slug' ] ) ) { |
|
| 152 | 152 | return array(); |
| 153 | 153 | } |
| 154 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 154 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 155 | 155 | return array(); |
| 156 | 156 | } |
| 157 | 157 | return array( |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | private function _getFormattedPageHeadingtabNavigationBarLinkItem( array $aSubPage, $aStructure ) { |
| 184 | 184 | |
| 185 | - if ( ! isset( $aSubPage[ 'href' ] ) ) { |
|
| 185 | + if ( !isset( $aSubPage[ 'href' ] ) ) { |
|
| 186 | 186 | return array(); |
| 187 | 187 | } |
| 188 | - if ( ! $aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 188 | + if ( !$aSubPage[ 'show_page_heading_tab' ] ) { |
|
| 189 | 189 | return array(); |
| 190 | 190 | } |
| 191 | 191 | $aSubPage = array( |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | + array( 'class' => null ) |
| 198 | 198 | + $aStructure; |
| 199 | 199 | |
| 200 | - $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ] . ' link' ); |
|
| 200 | + $aSubPage[ 'class' ] = trim( $aSubPage[ 'class' ].' link' ); |
|
| 201 | 201 | return $aSubPage; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $_aPage = $this->oFactory->oProp->aPages[ $this->sPageSlug ]; |
| 46 | 46 | |
| 47 | 47 | // If the page title is disabled, return an empty string. |
| 48 | - if ( ! $_aPage[ 'show_page_title' ] ) { |
|
| 48 | + if ( ! $_aPage[ 'show_page_title' ] ) { |
|
| 49 | 49 | return ""; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @since 3.5.10 |
| 131 | 131 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 132 | 132 | */ |
| 133 | - public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
| 133 | + public function _replyToFormatNavigationTabItem_PageHeadingTab( $aSubPage, $aStructure, $aPages, $aArguments=array() ) { |
|
| 134 | 134 | switch( $aSubPage['type'] ) { |
| 135 | 135 | case 'link': |
| 136 | 136 | return $this->_getFormattedPageHeadingtabNavigationBarLinkItem( $aSubPage, $aStructure ); |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | } |
| 49 | 49 | /** |
| 50 | 50 | * @since 3.6.3 |
| 51 | - * @return boolean |
|
| 51 | + * @return boolean|null |
|
| 52 | 52 | */ |
| 53 | 53 | private function _isScreenIconVisible() { |
| 54 | 54 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function get() { |
| 42 | 42 | |
| 43 | - if ( ! $this->_isScreenIconVisible() ) { |
|
| 43 | + if ( !$this->_isScreenIconVisible() ) { |
|
| 44 | 44 | return ''; |
| 45 | 45 | } |
| 46 | 46 | return $this->_getScreenIcon( $this->sPageSlug ); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | private function _isScreenIconVisible() { |
| 54 | 54 | |
| 55 | - $_bShowPageTitle = $this->getElement( |
|
| 55 | + $_bShowPageTitle = $this->getElement( |
|
| 56 | 56 | $this->oFactory->oProp->aPages, |
| 57 | 57 | array( $this->sPageSlug, 'show_page_title' ) |
| 58 | 58 | ); |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | array( $sPageSlug, 'href_icon_32x32' ), |
| 131 | 131 | '' |
| 132 | 132 | ); |
| 133 | - if ( ! $_sScreenIconPath ) { |
|
| 133 | + if ( !$_sScreenIconPath ) { |
|
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $_aAttributes = array( |
| 138 | 138 | 'style' => $this->generateInlineCSS( |
| 139 | 139 | array( |
| 140 | - 'background-image' => "url('" . esc_url( $_sScreenIconPath ) . "')" |
|
| 140 | + 'background-image' => "url('".esc_url( $_sScreenIconPath )."')" |
|
| 141 | 141 | ) |
| 142 | 142 | ) |
| 143 | 143 | ); |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | array( $sPageSlug, 'screen_icon_id' ), |
| 162 | 162 | '' |
| 163 | 163 | ); |
| 164 | - if ( ! $_sScreenIconID ) { |
|
| 164 | + if ( !$_sScreenIconID ) { |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $_aAttributes = array( |
| 169 | - 'id' => "icon-" . $_sScreenIconID, |
|
| 169 | + 'id' => "icon-".$_sScreenIconID, |
|
| 170 | 170 | ); |
| 171 | 171 | |
| 172 | 172 | // Go to the catch clause. |
@@ -189,16 +189,16 @@ discard block |
||
| 189 | 189 | 'class' => $this->getClassAttribute( |
| 190 | 190 | $this->getAOrB( |
| 191 | 191 | empty( $_sIconIDAttribute ) && $_oScreen->post_type, |
| 192 | - sanitize_html_class( 'icon32-posts-' . $_oScreen->post_type ), |
|
| 192 | + sanitize_html_class( 'icon32-posts-'.$_oScreen->post_type ), |
|
| 193 | 193 | '' |
| 194 | 194 | ), |
| 195 | 195 | $this->getAOrB( |
| 196 | 196 | empty( $_sIconIDAttribute ) || $_sIconIDAttribute == $this->oFactory->oProp->sClassName, |
| 197 | - 'generic', // the default value |
|
| 197 | + 'generic', // the default value |
|
| 198 | 198 | '' |
| 199 | 199 | ) |
| 200 | 200 | ), |
| 201 | - 'id' => "icon-" . $_sIconIDAttribute, |
|
| 201 | + 'id' => "icon-".$_sIconIDAttribute, |
|
| 202 | 202 | ); |
| 203 | 203 | return $this->_getScreenIconByAttributes( $_aAttributes ); |
| 204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | private function _getScreenIDAttribute( $oScreen ) { |
| 214 | 214 | |
| 215 | - if ( ! empty( $oScreen->parent_base ) ) { |
|
| 215 | + if ( !empty( $oScreen->parent_base ) ) { |
|
| 216 | 216 | return $oScreen->parent_base; |
| 217 | 217 | } |
| 218 | 218 | if ( 'page' === $oScreen->post_type ) { |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | private function _getScreenIconByAttributes( array $aAttributes ) { |
| 234 | 234 | |
| 235 | 235 | $aAttributes[ 'class' ] = $this->getClassAttribute( |
| 236 | - 'icon32', // required for a screen icon container element. |
|
| 236 | + 'icon32', // required for a screen icon container element. |
|
| 237 | 237 | $this->getElement( $aAttributes, 'class' ) |
| 238 | 238 | ); |
| 239 | - return "<div " . $this->getAttributes( $aAttributes ) . ">" |
|
| 239 | + return "<div ".$this->getAttributes( $aAttributes ).">" |
|
| 240 | 240 | . "<br />" |
| 241 | 241 | . "</div>"; |
| 242 | 242 | |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | * @since 3.6.3 Moved from `AdminPageFramework_Page_View`. |
| 182 | 182 | * @return string |
| 183 | 183 | */ |
| 184 | - private function _getDefaultScreenIcon() { |
|
| 184 | + private function _getDefaultScreenIcon() { |
|
| 185 | 185 | |
| 186 | 186 | $_oScreen = get_current_screen(); |
| 187 | 187 | $_sIconIDAttribute = $this->_getScreenIDAttribute( $_oScreen ); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @since 2.0.0 |
| 35 | 35 | * @see http://codex.wordpress.org/Roles_and_Capabilities |
| 36 | 36 | * @see http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains |
| 37 | - * @param array|integer|string $aisOptionKey (optional) specifies the option key name to store in the options table. If this is not set, the instantiated class name will be used as default. |
|
| 37 | + * @param array|integer|string $isOptionKey (optional) specifies the option key name to store in the options table. If this is not set, the instantiated class name will be used as default. |
|
| 38 | 38 | * [3.5.9+] If an integer is given, a transient will be used. If an array of option key arguments is given, the argument values will be set to the framework properties. |
| 39 | 39 | * - type - either `options_table` or `transient`. |
| 40 | 40 | * - key - the option key or the transient key |
@@ -56,9 +56,9 @@ discard block |
||
| 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 | - if ( ! $this->_isInstantiatable() ) { |
|
| 61 | + if ( !$this->_isInstantiatable() ) { |
|
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | $isOptionKey, |
| 67 | 67 | $sCallerPath |
| 68 | 68 | ? trim( $sCallerPath ) |
| 69 | - : $sCallerPath = ( is_admin() && ( isset( $GLOBALS['pagenow'] ) && in_array( $GLOBALS['pagenow'], array( 'plugins.php', ) ) || isset( $_GET['page'] ) ) |
|
| 69 | + : $sCallerPath = ( is_admin() && ( isset( $GLOBALS[ 'pagenow' ] ) && in_array( $GLOBALS[ 'pagenow' ], array( 'plugins.php',) ) || isset( $_GET[ 'page' ] ) ) |
|
| 70 | 70 | ? AdminPageFramework_Utility::getCallerScriptPath( __FILE__ ) |
| 71 | 71 | : null |
| 72 | - ), // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
| 72 | + ), // this is important to attempt to find the caller script path here when separating the library into multiple files. |
|
| 73 | 73 | $sCapability, |
| 74 | 74 | $sTextDomain |
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | - $this->oUtil->addAndDoAction( $this, 'start_' . $this->oProp->sClassName, $this ); |
|
| 77 | + $this->oUtil->addAndDoAction( $this, 'start_'.$this->oProp->sClassName, $this ); |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -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; |