@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $this->aAttributes + $this->_getAttributes() |
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
| 35 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
| 36 | 36 | $this->getElement( $_aAttributes, 'class', array() ), |
| 37 | 37 | $this->getElement( $this->aArguments, array( 'class', $this->sContext ), array() ) |
| 38 | 38 | ); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $_aParams = func_get_args() + array( null ); |
| 45 | 45 | $_oMsg = $_aParams[ 0 ]; |
| 46 | - $_sToggleAllButtonHTML = '"' . self::_getToggleAllButtonHTML( $_oMsg ) . '"'; |
|
| 46 | + $_sToggleAllButtonHTML = '"'.self::_getToggleAllButtonHTML( $_oMsg ).'"'; |
|
| 47 | 47 | |
| 48 | 48 | return <<<JAVASCRIPTS |
| 49 | 49 | ( function( $ ) { |
@@ -212,19 +212,19 @@ discard block |
||
| 212 | 212 | $_sLabelToggleAll = $oMsg->get( 'toggle_all' ); |
| 213 | 213 | $_sLabelToggleAllSections = $oMsg->get( 'toggle_all_collapsible_sections' ); |
| 214 | 214 | $_sDashIconSort = self::getAOrB( |
| 215 | - version_compare( $GLOBALS['wp_version'], '3.8', '<' ), // evaluate |
|
| 215 | + version_compare( $GLOBALS[ 'wp_version' ], '3.8', '<' ), // evaluate |
|
| 216 | 216 | '', // true |
| 217 | 217 | 'dashicons dashicons-sort' // false |
| 218 | 218 | ); |
| 219 | - $_sText = self::getAOrB( |
|
| 219 | + $_sText = self::getAOrB( |
|
| 220 | 220 | $_sDashIconSort, // evaluate |
| 221 | 221 | '', // true |
| 222 | 222 | $_sLabelToggleAll // false |
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | 225 | return "<div class='admin-page-framework-collapsible-toggle-all-button-container'>" |
| 226 | - . "<span class='admin-page-framework-collapsible-toggle-all-button button " . $_sDashIconSort . "'" |
|
| 227 | - . " title='" . esc_attr( $_sLabelToggleAllSections ) |
|
| 226 | + . "<span class='admin-page-framework-collapsible-toggle-all-button button ".$_sDashIconSort."'" |
|
| 227 | + . " title='".esc_attr( $_sLabelToggleAllSections ) |
|
| 228 | 228 | . "'>" |
| 229 | 229 | . $_sText |
| 230 | 230 | . "</span>" |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class AdminPageFramework_Form_View___CollapsibleSectionTitle extends AdminPageFramework_Form_View___SectionTitle { |
| 20 | 20 | |
| 21 | - public $aArguments = array( |
|
| 21 | + public $aArguments = array( |
|
| 22 | 22 | 'title' => null, |
| 23 | 23 | 'tag' => null, |
| 24 | 24 | 'section_index' => null, |
| 25 | 25 | 'collapsible' => array(), |
| 26 | 26 | 'container_type' => 'section', // section or sections |
| 27 | 27 | |
| 28 | - 'sectionset' => array(), // 3.7.0+ sectionset definition array |
|
| 28 | + 'sectionset' => array(), // 3.7.0+ sectionset definition array |
|
| 29 | 29 | |
| 30 | 30 | ); |
| 31 | - public $aFieldsets = array(); |
|
| 31 | + public $aFieldsets = array(); |
|
| 32 | 32 | public $aSavedData = array(); |
| 33 | 33 | public $aFieldErrors = array(); |
| 34 | 34 | public $aFieldTypeDefinitions = array(); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param array|boolean $aCollapsible The collapsible argument. |
| 64 | 64 | * @param string $sContainer The position context. Accepts either 'sections' or 'section'. If the set position in the argument array does not match this value, the method will return an empty string. |
| 65 | 65 | */ |
| 66 | - private function _getCollapsibleSectionTitleBlock( array $aCollapsible, $sContainer='sections', $iSectionIndex=null ) { |
|
| 66 | + private function _getCollapsibleSectionTitleBlock( array $aCollapsible, $sContainer = 'sections', $iSectionIndex = null ) { |
|
| 67 | 67 | |
| 68 | 68 | if ( $sContainer !== $aCollapsible[ 'container' ] ) { |
| 69 | 69 | return ''; |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | $_aSectionset = $this->aArguments[ 'sectionset' ]; |
| 82 | - $_sSectionTitleTagID = str_replace( '|', '_', $_aSectionset[ '_section_path' ] ) . '_' . $iSectionIndex; |
|
| 82 | + $_sSectionTitleTagID = str_replace( '|', '_', $_aSectionset[ '_section_path' ] ).'_'.$iSectionIndex; |
|
| 83 | 83 | |
| 84 | 84 | return $this->_getCollapsibleSectionsEnablerScript() |
| 85 | - . "<div " . $this->getAttributes( |
|
| 85 | + . "<div ".$this->getAttributes( |
|
| 86 | 86 | array( |
| 87 | 87 | 'id' => $_sSectionTitleTagID, |
| 88 | 88 | 'class' => $this->getClassAttribute( |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | 'collapsed', |
| 104 | 104 | '' |
| 105 | 105 | ), |
| 106 | - 'admin-page-framework-collapsible-type-' . $aCollapsible[ 'type' ] |
|
| 106 | + 'admin-page-framework-collapsible-type-'.$aCollapsible[ 'type' ] |
|
| 107 | 107 | ), |
| 108 | 108 | ) |
| 109 | 109 | + $this->getDataAttributeArray( $aCollapsible ) |
| 110 | - ) . ">" |
|
| 110 | + ).">" |
|
| 111 | 111 | . $_sSectionTitle |
| 112 | 112 | . "</div>"; |
| 113 | 113 | |
@@ -56,13 +56,13 @@ |
||
| 56 | 56 | public function getFieldsetOutput( $aFieldset ) { |
| 57 | 57 | |
| 58 | 58 | // Check if the field is visible |
| 59 | - if ( ! $this->isFieldsetVisible( $aFieldset ) ) { |
|
| 59 | + if ( !$this->isFieldsetVisible( $aFieldset ) ) { |
|
| 60 | 60 | return ''; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
| 64 | 64 | $aFieldset, |
| 65 | - $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
| 65 | + $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
| 66 | 66 | $this->aFieldErrors, |
| 67 | 67 | $this->aFieldTypeDefinitions, |
| 68 | 68 | $this->oMsg, |
@@ -556,7 +556,7 @@ |
||
| 556 | 556 | * @return string The generated section tab list as HTML. |
| 557 | 557 | */ |
| 558 | 558 | private function _getSectionTabList( $sSectionTabSlug, array $aSectionTabList ) { |
| 559 | - return $sSectionTabSlug |
|
| 559 | + return $sSectionTabSlug |
|
| 560 | 560 | ? "<ul class='admin-page-framework-section-tabs nav-tab-wrapper'>" |
| 561 | 561 | . implode( PHP_EOL, $aSectionTabList ) |
| 562 | 562 | . "</ul>" |
@@ -164,6 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | /** |
| 166 | 166 | * @since 3.7.0 |
| 167 | + * @param string $_sOutput |
|
| 167 | 168 | * @return string |
| 168 | 169 | */ |
| 169 | 170 | private function _getSpinnerOutput( $_sOutput ) { |
@@ -298,7 +299,7 @@ discard block |
||
| 298 | 299 | * @param array $_aOutputs Holds output elements - contents, section tab list, count of subsections. |
| 299 | 300 | * @param string $_sSectionsID The container id of sections. |
| 300 | 301 | * @param array $_aSection |
| 301 | - * @param array $_aFieldsInSections A field-sets array already divided by section tab. |
|
| 302 | + * @param array $aFieldsInSections A field-sets array already divided by section tab. |
|
| 302 | 303 | * @return array The updated sections table output array. |
| 303 | 304 | */ |
| 304 | 305 | private function _getSectionsetTable( $_aOutputs, $_sSectionsID, array $_aSection, array $aFieldsInSections ) { |
@@ -353,6 +354,7 @@ discard block |
||
| 353 | 354 | * Returns the output of sub-sections for repeatable and sortable sections. |
| 354 | 355 | * |
| 355 | 356 | * @since 3.7.0 |
| 357 | + * @param string $_sSectionsID |
|
| 356 | 358 | * @return array |
| 357 | 359 | */ |
| 358 | 360 | private function _getSubSections( $_aOutputs, $_sSectionsID, $_aSection, $_aSubSections ) { |
@@ -499,6 +501,7 @@ discard block |
||
| 499 | 501 | * @since 3.5.3 |
| 500 | 502 | * @since 3.6.0 Removed the `$sSectionID` parameter. Added the `$aSectionset` parameter. |
| 501 | 503 | * @since 3.7.0 Moved from `AdminPageFramework_FormPart_Table`. |
| 504 | + * @param string $sSectionsID |
|
| 502 | 505 | * @return string The formatted sections table HTML output. |
| 503 | 506 | */ |
| 504 | 507 | private function _getFormattedSectionsTablesOutput( array $aOutputs, $aSectionset, $sSectionsID, array $aCollapsible, $sSectionTabSlug ) { |
@@ -126,16 +126,16 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function get() { |
| 128 | 128 | |
| 129 | - $_oFormatSectionsetsByTab = new AdminPageFramework_Form_View___Format_SectionsetsByTab( |
|
| 129 | + $_oFormatSectionsetsByTab = new AdminPageFramework_Form_View___Format_SectionsetsByTab( |
|
| 130 | 130 | $this->aStructure[ 'sectionsets' ], |
| 131 | 131 | $this->aStructure[ 'fieldsets' ], |
| 132 | 132 | $this->aArguments[ 'nested_depth' ] |
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | - $_aOutput = array(); |
|
| 136 | - foreach( $_oFormatSectionsetsByTab->getTabs() as $_sSectionTabSlug ) { |
|
| 135 | + $_aOutput = array(); |
|
| 136 | + foreach ( $_oFormatSectionsetsByTab->getTabs() as $_sSectionTabSlug ) { |
|
| 137 | 137 | |
| 138 | - $_aOutput[] = $this->_getFormOutput( |
|
| 138 | + $_aOutput[ ] = $this->_getFormOutput( |
|
| 139 | 139 | $_oFormatSectionsetsByTab->getSectionsets( $_sSectionTabSlug ), |
| 140 | 140 | $_oFormatSectionsetsByTab->getFieldsets( $_sSectionTabSlug ), |
| 141 | 141 | $_sSectionTabSlug, |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | // Generate id for this output |
| 154 | 154 | $_sOutput = implode( PHP_EOL, $_aOutput ); |
| 155 | - $_sElementID = "admin-page-framework-sectionsets-" . uniqid(); |
|
| 155 | + $_sElementID = "admin-page-framework-sectionsets-".uniqid(); |
|
| 156 | 156 | return $this->_getSpinnerOutput( $_sOutput ) |
| 157 | 157 | . "<div id='{$_sElementID}' class='admin-page-framework-sctionsets admin-page-framework-form-js-on'>" |
| 158 | 158 | . $_sOutput |
@@ -187,17 +187,17 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | // A sectionset is a set of sections. |
| 189 | 189 | $_sSectionSet = $this->_getSectionsetsTables( |
| 190 | - $aSectionsets, // section-set definition (already divided by section tab) |
|
| 191 | - $aFieldsets, // field-set definitions (already divided by section tab) |
|
| 190 | + $aSectionsets, // section-set definition (already divided by section tab) |
|
| 191 | + $aFieldsets, // field-set definitions (already divided by section tab) |
|
| 192 | 192 | $aCallbacks |
| 193 | 193 | ); |
| 194 | 194 | return $_sSectionSet |
| 195 | - ? "<div " . $this->getAttributes( |
|
| 195 | + ? "<div ".$this->getAttributes( |
|
| 196 | 196 | array( |
| 197 | 197 | 'class' => 'admin-page-framework-sectionset', |
| 198 | - 'id' => "sectionset-{$sSectionTabSlug}_" . md5( serialize( $aSectionsets ) ), |
|
| 198 | + 'id' => "sectionset-{$sSectionTabSlug}_".md5( serialize( $aSectionsets ) ), |
|
| 199 | 199 | ) |
| 200 | - ) . ">" |
|
| 200 | + ).">" |
|
| 201 | 201 | . $_sSectionSet |
| 202 | 202 | . "</div>" |
| 203 | 203 | : ''; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * If there is no field overall to the section and its section tab, return an empty string. |
| 230 | 230 | * Otherwise, the section-sets container gets rendered and its CSS rules such as margins give unwanted results. |
| 231 | 231 | */ |
| 232 | - if ( ! count( $aFieldsets ) ) { |
|
| 232 | + if ( !count( $aFieldsets ) ) { |
|
| 233 | 233 | return ''; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -241,13 +241,13 @@ discard block |
||
| 241 | 241 | ); |
| 242 | 242 | $_sSectionTabSlug = $_aFirstSectionset[ 'section_tab_slug' ]; |
| 243 | 243 | $_sThisSectionID = $_aFirstSectionset[ 'section_id' ]; |
| 244 | - $_sSectionsID = 'sections-' . $_sThisSectionID; |
|
| 244 | + $_sSectionsID = 'sections-'.$_sThisSectionID; |
|
| 245 | 245 | $_aCollapsible = $this->_getCollapsibleArgumentForSections( |
| 246 | 246 | $_aFirstSectionset |
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | - foreach( $aSectionsets as $_aSectionset ) { |
|
| 250 | - $_aOutputs = $this->_getSectionsetTable( |
|
| 249 | + foreach ( $aSectionsets as $_aSectionset ) { |
|
| 250 | + $_aOutputs = $this->_getSectionsetTable( |
|
| 251 | 251 | $_aOutputs, |
| 252 | 252 | $_sSectionsID, |
| 253 | 253 | $_aSectionset, |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * Changed the visibility scope to private. Changed the 1st parameter from `$aSection`. |
| 276 | 276 | * @return array |
| 277 | 277 | */ |
| 278 | - private function _getCollapsibleArgumentForSections( array $aSectionset=array() ) { |
|
| 278 | + private function _getCollapsibleArgumentForSections( array $aSectionset = array() ) { |
|
| 279 | 279 | |
| 280 | 280 | $_oArgumentFormater = new AdminPageFramework_Form_Model___Format_CollapsibleSection( |
| 281 | 281 | $aSectionset[ 'collapsible' ], |
@@ -303,19 +303,19 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | private function _getSectionsetTable( $_aOutputs, $_sSectionsID, array $_aSection, array $aFieldsInSections ) { |
| 305 | 305 | |
| 306 | - if ( ! $this->isSectionsetVisible( $_aSection ) ) { |
|
| 306 | + if ( !$this->isSectionsetVisible( $_aSection ) ) { |
|
| 307 | 307 | return $_aOutputs; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | // If the 'save' argument is false, insert a flag that disables saving the section inputs. |
| 311 | - $_aOutputs[ 'section_contents' ][] = $this->_getUnsetFlagSectionInputTag( $_aSection ); |
|
| 311 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getUnsetFlagSectionInputTag( $_aSection ); |
|
| 312 | 312 | |
| 313 | 313 | // For repeatable sections - sub-sections are divided field definition arrays by sub-section index, |
| 314 | 314 | // not section definition arrays. |
| 315 | - $_aSubSections = $this->getIntegerKeyElements( |
|
| 315 | + $_aSubSections = $this->getIntegerKeyElements( |
|
| 316 | 316 | $this->getElementAsArray( |
| 317 | 317 | $aFieldsInSections, // subject array |
| 318 | - $_aSection[ '_section_path' ], // dimensional path |
|
| 318 | + $_aSection[ '_section_path' ], // dimensional path |
|
| 319 | 319 | array() // default |
| 320 | 320 | ) |
| 321 | 321 | ); |
@@ -358,28 +358,28 @@ discard block |
||
| 358 | 358 | private function _getSubSections( $_aOutputs, $_sSectionsID, $_aSection, $_aSubSections ) { |
| 359 | 359 | |
| 360 | 360 | // Add the repeatable sections enabler script. |
| 361 | - if ( ! empty( $_aSection[ 'repeatable' ] ) ) { |
|
| 362 | - $_aOutputs[ 'section_contents' ][] = AdminPageFramework_Form_View___Script_RepeatableSection::getEnabler( |
|
| 361 | + if ( !empty( $_aSection[ 'repeatable' ] ) ) { |
|
| 362 | + $_aOutputs[ 'section_contents' ][ ] = AdminPageFramework_Form_View___Script_RepeatableSection::getEnabler( |
|
| 363 | 363 | $_sSectionsID, |
| 364 | 364 | $_aOutputs[ 'count_subsections' ], |
| 365 | 365 | $_aSection[ 'repeatable' ], |
| 366 | 366 | $this->oMsg |
| 367 | 367 | ); |
| 368 | - $_aOutputs[ 'section_contents' ][] = $this->_getRepeatableSectionFlagTag( $_aSection ); |
|
| 368 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getRepeatableSectionFlagTag( $_aSection ); |
|
| 369 | 369 | } |
| 370 | 370 | // Add the sortable sections enabler script. 3.6.0+ |
| 371 | - if ( ! empty( $_aSection[ 'sortable' ] ) ) { |
|
| 372 | - $_aOutputs[ 'section_contents' ][] = AdminPageFramework_Form_View___Script_SortableSection::getEnabler( |
|
| 371 | + if ( !empty( $_aSection[ 'sortable' ] ) ) { |
|
| 372 | + $_aOutputs[ 'section_contents' ][ ] = AdminPageFramework_Form_View___Script_SortableSection::getEnabler( |
|
| 373 | 373 | $_sSectionsID, |
| 374 | 374 | $_aSection[ 'sortable' ], |
| 375 | 375 | $this->oMsg |
| 376 | 376 | ); |
| 377 | - $_aOutputs[ 'section_contents' ][] = $this->_getSortableSectionFlagTag( $_aSection ); |
|
| 377 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getSortableSectionFlagTag( $_aSection ); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // Get the section tables. |
| 381 | 381 | $_aSubSections = $this->numerizeElements( $_aSubSections ); // will include the main section as well. |
| 382 | - foreach( $_aSubSections as $_iIndex => $_aFields ) { |
|
| 382 | + foreach ( $_aSubSections as $_iIndex => $_aFields ) { |
|
| 383 | 383 | |
| 384 | 384 | $_oEachSectionArguments = new AdminPageFramework_Form_Model___Format_EachSection( |
| 385 | 385 | $_aSection, |
@@ -409,8 +409,8 @@ discard block |
||
| 409 | 409 | array( |
| 410 | 410 | 'class' => 'element-address', |
| 411 | 411 | 'type' => 'hidden', |
| 412 | - 'name' => '__repeatable_elements_' . $aSection[ '_structure_type' ] |
|
| 413 | - . '[' . $aSection[ 'section_id' ] . ']', |
|
| 412 | + 'name' => '__repeatable_elements_'.$aSection[ '_structure_type' ] |
|
| 413 | + . '['.$aSection[ 'section_id' ].']', |
|
| 414 | 414 | // @todo examine whether this value should include a section index. |
| 415 | 415 | 'value' => $aSection[ 'section_id' ], |
| 416 | 416 | ) |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | array( |
| 429 | 429 | 'class' => 'element-address', |
| 430 | 430 | 'type' => 'hidden', |
| 431 | - 'name' => '__sortable_elements_' . $aSection[ '_structure_type' ] |
|
| 432 | - . '[' . $aSection[ 'section_id' ] . ']', |
|
| 431 | + 'name' => '__sortable_elements_'.$aSection[ '_structure_type' ] |
|
| 432 | + . '['.$aSection[ 'section_id' ].']', |
|
| 433 | 433 | // @todo examine whether this value should include a section index. |
| 434 | 434 | 'value' => $aSection[ 'section_id' ], |
| 435 | 435 | ) |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | 'input', |
| 452 | 452 | array( |
| 453 | 453 | 'type' => 'hidden', |
| 454 | - 'name' => '__unset_' . $aSection[ '_structure_type' ] . '[' . $aSection[ 'section_id' ] . ']', |
|
| 455 | - 'value' => "__dummy_option_key|" . $aSection[ 'section_id' ], |
|
| 454 | + 'name' => '__unset_'.$aSection[ '_structure_type' ].'['.$aSection[ 'section_id' ].']', |
|
| 455 | + 'value' => "__dummy_option_key|".$aSection[ 'section_id' ], |
|
| 456 | 456 | 'class' => 'unset-element-names element-address', |
| 457 | 457 | ) |
| 458 | 458 | ); |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | private function _getSectionTableWithTabList( array $_aOutputs, array $aSectionset, $aFieldsetsPerSection ) { |
| 469 | 469 | |
| 470 | 470 | // Tab list |
| 471 | - $_aOutputs[ 'section_tab_list' ][] = $this->_getTabList( |
|
| 471 | + $_aOutputs[ 'section_tab_list' ][ ] = $this->_getTabList( |
|
| 472 | 472 | $aSectionset, |
| 473 | 473 | $aFieldsetsPerSection, |
| 474 | 474 | $this->aCallbacks[ 'fieldset_output' ] |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | // Section container |
| 478 | 478 | $_oSectionTable = new AdminPageFramework_Form_View___Section( |
| 479 | - $this->aArguments, // for nested sections |
|
| 479 | + $this->aArguments, // for nested sections |
|
| 480 | 480 | $aSectionset, |
| 481 | 481 | $this->aStructure, |
| 482 | 482 | $aFieldsetsPerSection, |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $this->aCallbacks, |
| 487 | 487 | $this->oMsg |
| 488 | 488 | ); |
| 489 | - $_aOutputs[ 'section_contents' ][] = $_oSectionTable->get(); |
|
| 489 | + $_aOutputs[ 'section_contents' ][ ] = $_oSectionTable->get(); |
|
| 490 | 490 | |
| 491 | 491 | return $_aOutputs; |
| 492 | 492 | |
@@ -514,9 +514,9 @@ discard block |
||
| 514 | 514 | 'section_index' => null, |
| 515 | 515 | 'collapsible' => $aCollapsible, |
| 516 | 516 | 'container_type' => 'sections', // section or sections |
| 517 | - 'sectionset' => $aSectionset, // 3.7.0+ for tooltip |
|
| 517 | + 'sectionset' => $aSectionset, // 3.7.0+ for tooltip |
|
| 518 | 518 | ), |
| 519 | - array(), // fieldsets |
|
| 519 | + array(), // fieldsets |
|
| 520 | 520 | $this->aSavedData, |
| 521 | 521 | $this->aFieldErrors, |
| 522 | 522 | $this->aStructure[ 'field_type_definitions' ], |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | $aOutputs[ 'count_subsections' ] |
| 534 | 534 | ); |
| 535 | 535 | return $_oCollapsibleSectionTitle->get() |
| 536 | - . "<div " . $_oSectionsTablesContainerAttributes->get() . ">" |
|
| 536 | + . "<div ".$_oSectionsTablesContainerAttributes->get().">" |
|
| 537 | 537 | . $this->_getSectionTabList( $sSectionTabSlug, $aOutputs[ 'section_tab_list' ] ) |
| 538 | 538 | . implode( PHP_EOL, $aOutputs[ 'section_contents' ] ) |
| 539 | 539 | . "</div>"; |
@@ -564,21 +564,21 @@ discard block |
||
| 564 | 564 | */ |
| 565 | 565 | private function _getTabList( array $aSection, array $aFields, $hfFieldCallback ) { |
| 566 | 566 | |
| 567 | - if ( ! $aSection[ 'section_tab_slug' ] ) { |
|
| 567 | + if ( !$aSection[ 'section_tab_slug' ] ) { |
|
| 568 | 568 | return ''; |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | $iSectionIndex = $aSection[ '_index' ]; |
| 572 | 572 | |
| 573 | - $_sSectionTagID = 'section-' . $aSection[ 'section_id' ] . '__' . $iSectionIndex; |
|
| 573 | + $_sSectionTagID = 'section-'.$aSection[ 'section_id' ].'__'.$iSectionIndex; |
|
| 574 | 574 | $_aTabAttributes = $aSection[ 'attributes' ][ 'tab' ] |
| 575 | 575 | + array( |
| 576 | 576 | 'class' => 'admin-page-framework-section-tab nav-tab', |
| 577 | 577 | 'id' => "section_tab-{$_sSectionTagID}", |
| 578 | 578 | 'style' => null |
| 579 | 579 | ); |
| 580 | - $_aTabAttributes[ 'class' ] = $this->getClassAttribute( $_aTabAttributes[ 'class' ], $aSection[ 'class' ][ 'tab' ] ); // 3.3.1+ |
|
| 581 | - $_aTabAttributes[ 'style' ] = $this->getStyleAttribute( $_aTabAttributes[ 'style' ], $aSection[ 'hidden' ] ? 'display:none' : null ); // 3.3.1+ |
|
| 580 | + $_aTabAttributes[ 'class' ] = $this->getClassAttribute( $_aTabAttributes[ 'class' ], $aSection[ 'class' ][ 'tab' ] ); // 3.3.1+ |
|
| 581 | + $_aTabAttributes[ 'style' ] = $this->getStyleAttribute( $_aTabAttributes[ 'style' ], $aSection[ 'hidden' ] ? 'display:none' : null ); // 3.3.1+ |
|
| 582 | 582 | |
| 583 | 583 | $_oSectionTitle = new AdminPageFramework_Form_View___SectionTitle( |
| 584 | 584 | array( |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | 'tag' => 'h4', |
| 587 | 587 | 'section_index' => $iSectionIndex, |
| 588 | 588 | |
| 589 | - 'sectionset' => $aSection, // 3.7.0+ for tooltip |
|
| 589 | + 'sectionset' => $aSection, // 3.7.0+ for tooltip |
|
| 590 | 590 | ), |
| 591 | 591 | $aFields, |
| 592 | 592 | $this->aSavedData, |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $this->aCallbacks // field output element callables. |
| 597 | 597 | ); |
| 598 | 598 | |
| 599 | - return "<li " . $this->getAttributes( $_aTabAttributes ) . ">" |
|
| 599 | + return "<li ".$this->getAttributes( $_aTabAttributes ).">" |
|
| 600 | 600 | . "<a href='#{$_sSectionTagID}'>" |
| 601 | 601 | . $_oSectionTitle->get() |
| 602 | 602 | ."</a>" |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | // Output |
| 38 | 38 | return |
| 39 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
| 40 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
| 41 | - . "</{$this->aOptions['input_container_tag']}>" |
|
| 42 | - . "<{$this->aOptions['label_container_tag']} " . $this->getAttributes( $this->aOptions['label_container_attributes'] ) . ">" |
|
| 39 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
| 40 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
| 41 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
| 42 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
| 43 | 43 | . $_sLabel |
| 44 | - . "</{$this->aOptions['label_container_tag']}>" |
|
| 44 | + . "</{$this->aOptions[ 'label_container_tag' ]}>" |
|
| 45 | 45 | ; |
| 46 | 46 | |
| 47 | 47 | } |
@@ -58,22 +58,22 @@ discard block |
||
| 58 | 58 | public function getAttributesByKey( /* $sKey */ ) { |
| 59 | 59 | |
| 60 | 60 | // Parameters |
| 61 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
| 62 | - $_sKey = $_aParams[ 0 ]; |
|
| 61 | + $_aParams = func_get_args() + array( 0 => '',); |
|
| 62 | + $_sKey = $_aParams[ 0 ]; |
|
| 63 | 63 | |
| 64 | 64 | // Result |
| 65 | 65 | return $this->getElementAsArray( $this->aAttributes, $_sKey, array() ) |
| 66 | 66 | + array( |
| 67 | 67 | 'type' => 'radio', |
| 68 | - 'checked' => isset( $this->aAttributes['value'] ) && $this->aAttributes['value'] == $_sKey |
|
| 68 | + 'checked' => isset( $this->aAttributes[ 'value' ] ) && $this->aAttributes[ 'value' ] == $_sKey |
|
| 69 | 69 | ? 'checked' |
| 70 | 70 | : null, |
| 71 | 71 | 'value' => $_sKey, |
| 72 | 72 | // 'id' => $this->aField['input_id'] . '_' . $_sKey, |
| 73 | - 'id' => $this->getAttribute( 'id' ) . '_' . $_sKey, |
|
| 73 | + 'id' => $this->getAttribute( 'id' ).'_'.$_sKey, |
|
| 74 | 74 | // 'data-default' => $this->aField['default'], // refered by the repeater script |
| 75 | 75 | // 'data-id' => $this->aField['input_id'], // refered by the JavaScript scripts such as the revealer script. |
| 76 | - 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
| 76 | + 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
| 77 | 77 | ) |
| 78 | 78 | + $this->aAttributes; |
| 79 | 79 | |
@@ -20,8 +20,6 @@ discard block |
||
| 20 | 20 | * Returns the output of the input element. |
| 21 | 21 | * |
| 22 | 22 | * @since 3.4.0 |
| 23 | - * @param string $sLabel The label text. |
|
| 24 | - * @param array $aAttributes (optional) The attribute array. If set, it will be merged with the attribute set in the constructor. |
|
| 25 | 23 | */ |
| 26 | 24 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
| 27 | 25 | |
@@ -51,8 +49,6 @@ discard block |
||
| 51 | 49 | * |
| 52 | 50 | * @return array The updated attribute array. |
| 53 | 51 | * @since 3.5.3 |
| 54 | - * @param string $sKey The array element key of the radio button. |
|
| 55 | - * It is assumed that there is an array that holds multiple radio buttons and each of them has an array key. |
|
| 56 | 52 | */ |
| 57 | 53 | public function getAttributesByKey( /* $sKey */ ) { |
| 58 | 54 | |
@@ -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. |
@@ -333,7 +333,8 @@ |
||
| 333 | 333 | $sTabSlug = $aEnqueueItem['sTabSlug']; |
| 334 | 334 | |
| 335 | 335 | // If the page slug is not specified and the currently loading page is one of the pages that is added by the framework, |
| 336 | - if ( ! $sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { // means script-global(among pages added by the framework) |
|
| 336 | + if ( ! $sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { |
|
| 337 | +// means script-global(among pages added by the framework) |
|
| 337 | 338 | return $this->_enqueueSRC( $aEnqueueItem ); |
| 338 | 339 | } |
| 339 | 340 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | // tab |
| 46 | 46 | if ( $_sPageSlug && $_sTabSlug ) { |
| 47 | - $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 47 | + $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 48 | 48 | $_oCaller, |
| 49 | 49 | "style_{$_sPageSlug}_{$_sTabSlug}", |
| 50 | 50 | $this->oProp->sStyle |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // page |
| 55 | 55 | if ( $_sPageSlug ) { |
| 56 | - $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 56 | + $this->oProp->sStyle = $this->addAndApplyFilters( |
|
| 57 | 57 | $_oCaller, |
| 58 | 58 | "style_{$_sPageSlug}", |
| 59 | 59 | $this->oProp->sStyle |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return string The tab slug if the tab has been added. |
| 88 | 88 | */ |
| 89 | 89 | private function _getCurrentTabSlugForFilter( $sPageSlug ) { |
| 90 | - $_sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
|
| 90 | + $_sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
|
| 91 | 91 | return isset( $this->oProp->aInPageTabs[ $sPageSlug ][ $_sTabSlug ] ) |
| 92 | 92 | ? $_sTabSlug |
| 93 | 93 | : ''; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // tab |
| 117 | 117 | if ( $_sPageSlug && $_sTabSlug ) { |
| 118 | - $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 118 | + $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 119 | 119 | $_oCaller, |
| 120 | 120 | "script_{$_sPageSlug}_{$_sTabSlug}", |
| 121 | 121 | $this->oProp->sScript |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // page |
| 126 | 126 | if ( $_sPageSlug ) { |
| 127 | - $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 127 | + $this->oProp->sScript = $this->addAndApplyFilters( |
|
| 128 | 128 | $_oCaller, |
| 129 | 129 | "script_{$_sPageSlug}", |
| 130 | 130 | $this->oProp->sScript |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | * @since 2.1.5 |
| 143 | 143 | * @internal |
| 144 | 144 | */ |
| 145 | - public function _enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 145 | + public function _enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 146 | 146 | |
| 147 | 147 | $_aHandleIDs = array(); |
| 148 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
| 149 | - $_aHandleIDs[] = $this->_enqueueStyle( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 148 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
| 149 | + $_aHandleIDs[ ] = $this->_enqueueStyle( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 150 | 150 | } |
| 151 | 151 | return $_aHandleIDs; |
| 152 | 152 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 173 | 173 | * @internal |
| 174 | 174 | */ |
| 175 | - public function _enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 175 | + public function _enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 176 | 176 | return $this->_enqueueResourceByType( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs, 'style' ); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | * |
| 182 | 182 | * @since 2.1.5 |
| 183 | 183 | */ |
| 184 | - public function _enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 184 | + public function _enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 185 | 185 | |
| 186 | 186 | $_aHandleIDs = array(); |
| 187 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
| 188 | - $_aHandleIDs[] = $this->_enqueueScript( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 187 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
| 188 | + $_aHandleIDs[ ] = $this->_enqueueScript( $_sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
|
| 189 | 189 | } |
| 190 | 190 | return $_aHandleIDs; |
| 191 | 191 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 213 | 213 | * @internal |
| 214 | 214 | */ |
| 215 | - public function _enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 215 | + public function _enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 216 | 216 | return $this->_enqueueResourceByType( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs, 'script' ); |
| 217 | 217 | } |
| 218 | 218 | /** |
@@ -225,20 +225,20 @@ discard block |
||
| 225 | 225 | * @param array $aCustomArgs A custom argument array. |
| 226 | 226 | * @param string $sType Accepts 'style' or 'script' |
| 227 | 227 | */ |
| 228 | - private function _enqueueResourceByType( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array(), $sType='style' ) { |
|
| 228 | + private function _enqueueResourceByType( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array(), $sType = 'style' ) { |
|
| 229 | 229 | |
| 230 | - $sSRC = trim( $sSRC ); |
|
| 230 | + $sSRC = trim( $sSRC ); |
|
| 231 | 231 | if ( empty( $sSRC ) ) { |
| 232 | 232 | return ''; |
| 233 | 233 | } |
| 234 | - $sSRC = $this->getResolvedSRC( $sSRC ); |
|
| 234 | + $sSRC = $this->getResolvedSRC( $sSRC ); |
|
| 235 | 235 | |
| 236 | 236 | // Get the property name for the type |
| 237 | 237 | $_sContainerPropertyName = $this->_getContainerPropertyNameByType( $sType ); |
| 238 | 238 | $_sEnqueuedIndexPropertyName = $this->_getEnqueuedIndexPropertyNameByType( $sType ); |
| 239 | 239 | |
| 240 | 240 | // setting the key based on the url prevents duplicate items |
| 241 | - $_sSRCHash = md5( $sSRC ); |
|
| 241 | + $_sSRCHash = md5( $sSRC ); |
|
| 242 | 242 | if ( isset( $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ] ) ) { |
| 243 | 243 | return ''; |
| 244 | 244 | } |
@@ -249,13 +249,13 @@ discard block |
||
| 249 | 249 | 'sTabSlug' => $sTabSlug, |
| 250 | 250 | 'sSRC' => $sSRC, |
| 251 | 251 | 'sType' => $sType, |
| 252 | - 'handle_id' => $sType . '_' . $this->oProp->sClassName . '_' . ( ++$this->oProp->{$_sEnqueuedIndexPropertyName} ), |
|
| 252 | + 'handle_id' => $sType.'_'.$this->oProp->sClassName.'_'.( ++$this->oProp->{$_sEnqueuedIndexPropertyName} ), |
|
| 253 | 253 | ) |
| 254 | 254 | + self::$_aStructure_EnqueuingResources |
| 255 | 255 | ; |
| 256 | 256 | |
| 257 | 257 | // Store the attributes in another container by url. |
| 258 | - $this->oProp->aResourceAttributes[ $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ]['handle_id'] ] = $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ]['attributes']; |
|
| 258 | + $this->oProp->aResourceAttributes[ $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ][ 'handle_id' ] ] = $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ][ 'attributes' ]; |
|
| 259 | 259 | |
| 260 | 260 | return $this->oProp->{$_sContainerPropertyName}[ $_sSRCHash ][ 'handle_id' ]; |
| 261 | 261 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @since 3.0.0 |
| 296 | 296 | * @internal |
| 297 | 297 | */ |
| 298 | - public function _forceToEnqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
| 298 | + public function _forceToEnqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
| 299 | 299 | return $this->_enqueueStyle( $sSRC, '', '', $aCustomArgs ); |
| 300 | 300 | } |
| 301 | 301 | /** |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @since 3.0.0 |
| 306 | 306 | * @internal |
| 307 | 307 | */ |
| 308 | - public function _forceToEnqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
| 308 | + public function _forceToEnqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
| 309 | 309 | return $this->_enqueueScript( $sSRC, '', '', $aCustomArgs ); |
| 310 | 310 | } |
| 311 | 311 | |
@@ -322,11 +322,11 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
| 324 | 324 | $sCurrentTabSlug = $this->oProp->getCurrentTabSlug( $sCurrentPageSlug ); |
| 325 | - $sPageSlug = $aEnqueueItem['sPageSlug']; |
|
| 326 | - $sTabSlug = $aEnqueueItem['sTabSlug']; |
|
| 325 | + $sPageSlug = $aEnqueueItem[ 'sPageSlug' ]; |
|
| 326 | + $sTabSlug = $aEnqueueItem[ 'sTabSlug' ]; |
|
| 327 | 327 | |
| 328 | 328 | // If the page slug is not specified and the currently loading page is one of the pages that is added by the framework, |
| 329 | - if ( ! $sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { // means script-global(among pages added by the framework) |
|
| 329 | + if ( !$sPageSlug && $this->oProp->isPageAdded( $sCurrentPageSlug ) ) { // means script-global(among pages added by the framework) |
|
| 330 | 330 | return $this->_enqueueSRC( $aEnqueueItem ); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | // If the tab slug is not specified and the page slug is specified, |
| 342 | 342 | // and if the current loading page slug and the specified one matches, |
| 343 | 343 | if ( |
| 344 | - ( $sPageSlug && ! $sTabSlug ) |
|
| 344 | + ( $sPageSlug && !$sTabSlug ) |
|
| 345 | 345 | && ( $sCurrentPageSlug == $sPageSlug ) |
| 346 | 346 | ) { |
| 347 | 347 | return $this->_enqueueSRC( $aEnqueueItem ); |
@@ -400,7 +400,7 @@ |
||
| 400 | 400 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
| 401 | 401 | * @return array removed menu item. |
| 402 | 402 | */ |
| 403 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
| 403 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
| 404 | 404 | |
| 405 | 405 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
| 406 | 406 | $nSubMenuPageIndex, |
@@ -26,6 +26,7 @@ discard block |
||
| 26 | 26 | * Sets up hooks |
| 27 | 27 | * |
| 28 | 28 | * @internal |
| 29 | + * @param AdminPageFramework_Router $oFactory |
|
| 29 | 30 | */ |
| 30 | 31 | public function __construct( $oFactory, $sActionHook='admin_menu' ) { |
| 31 | 32 | |
@@ -253,6 +254,7 @@ discard block |
||
| 253 | 254 | * @since 3.3.0 |
| 254 | 255 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
| 255 | 256 | * @since 3.7.4 Added the `$nOrder` parameter. |
| 257 | + * @param string $sMenuSlug |
|
| 256 | 258 | * @return string The page hook of the added page. |
| 257 | 259 | */ |
| 258 | 260 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) { |
@@ -354,6 +356,7 @@ discard block |
||
| 354 | 356 | /** |
| 355 | 357 | * Sets up hooks for the page. |
| 356 | 358 | * @since 3.7.4 |
| 359 | + * @param false|string $sPageHook |
|
| 357 | 360 | */ |
| 358 | 361 | private function _setPageHooks( $sPageHook, $sPageSlug ) { |
| 359 | 362 | |
@@ -405,7 +408,7 @@ discard block |
||
| 405 | 408 | /** |
| 406 | 409 | * @since 3.7.4 |
| 407 | 410 | * @return void |
| 408 | - * @param numeric $$nOrder A user set order (menu position, index). |
|
| 411 | + * @param numeric $nOrder A user set order (menu position, index). |
|
| 409 | 412 | * @param array $aSubMenuItem The sub menu item array set in the global `$submenu` array. |
| 410 | 413 | */ |
| 411 | 414 | private function _setSubMenuPageByIndex( $nOrder, $aSubMenuItem, $sMenuSlug ) { |
@@ -529,6 +532,7 @@ discard block |
||
| 529 | 532 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. |
| 530 | 533 | * @since 3.5.3 Added the `$bShowInMenu` parameter. |
| 531 | 534 | * @since 3.7.4 Added the `$nOrder` parameter. |
| 535 | + * @param string $sMenuSlug |
|
| 532 | 536 | * @return void |
| 533 | 537 | */ |
| 534 | 538 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @internal |
| 29 | 29 | */ |
| 30 | - public function __construct( $oFactory, $sActionHook='admin_menu' ) { |
|
| 30 | + public function __construct( $oFactory, $sActionHook = 'admin_menu' ) { |
|
| 31 | 31 | |
| 32 | 32 | $this->oFactory = $oFactory; |
| 33 | 33 | add_action( |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public function _replyToRegisterRootMenu() { |
| 75 | 75 | |
| 76 | 76 | // If the root menu label is not set but the slug is set, |
| 77 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 77 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | $this->_registerRootMenuPage(); |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $this->oFactory->oProp->aRootMenu[ '_page_hook' ] = add_menu_page( |
| 99 | - $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 100 | - $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 101 | - $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 102 | - $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 103 | - '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 104 | - $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 99 | + $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
| 100 | + $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
| 101 | + $this->oFactory->oProp->sCapability, // Capability - access right |
|
| 102 | + $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
| 103 | + '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
| 104 | + $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
| 105 | 105 | $this->getElement( |
| 106 | 106 | $this->oFactory->oProp->aRootMenu, |
| 107 | 107 | 'iPosition', |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // Let external scripts add sub-menu pages. |
| 125 | 125 | $_aPages = $this->addAndApplyFilter( |
| 126 | - $this->oFactory, // caller object |
|
| 127 | - "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 126 | + $this->oFactory, // caller object |
|
| 127 | + "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
| 128 | 128 | $this->oFactory->oProp->aPages // arguments |
| 129 | 129 | ); |
| 130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | // Format the `$aPages` property and register the pages. |
| 135 | 135 | $_iParsedIndex = 0; |
| 136 | 136 | $_aFormattedPages = array(); |
| 137 | - foreach( $_aPages as $_aSubMenuItem ) { |
|
| 137 | + foreach ( $_aPages as $_aSubMenuItem ) { |
|
| 138 | 138 | |
| 139 | 139 | // needs to be sanitized because there are hook filters applied to this array. |
| 140 | 140 | $_oFormatter = new AdminPageFramework_Format_SubMenuItem( |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | private function _getDefaultPageSlug( array $aPages ) { |
| 171 | 171 | |
| 172 | - foreach( $aPages as $_aPage ) { |
|
| 173 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 172 | + foreach ( $aPages as $_aPage ) { |
|
| 173 | + if ( !isset( $_aPage[ 'page_slug' ] ) ) { |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | return $_aPage[ 'page_slug' ]; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | private function _registerSubMenuItem( array $aArgs ) { |
| 194 | 194 | |
| 195 | - if ( ! current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 195 | + if ( !current_user_can( $aArgs[ 'capability' ] ) ) { |
|
| 196 | 196 | return ''; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) { |
| 258 | 258 | |
| 259 | - if ( ! $sPageSlug ) { |
|
| 259 | + if ( !$sPageSlug ) { |
|
| 260 | 260 | return ''; |
| 261 | 261 | } |
| 262 | 262 | $_sPageHook = $this->___addSubMenuPage( |
| 263 | - $sRootPageSlug, // the root (parent) page slug |
|
| 264 | - $sPageTitle, // page title |
|
| 265 | - $sMenuTitle, // menu title |
|
| 266 | - $sCapability, // capability |
|
| 263 | + $sRootPageSlug, // the root (parent) page slug |
|
| 264 | + $sPageTitle, // page title |
|
| 265 | + $sMenuTitle, // menu title |
|
| 266 | + $sCapability, // capability |
|
| 267 | 267 | $sPageSlug // menu slug |
| 268 | 268 | ); |
| 269 | 269 | |
@@ -291,14 +291,14 @@ discard block |
||
| 291 | 291 | $_aRemovedMenuItem = $this->_removePageSubmenuItem( $_nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ); |
| 292 | 292 | |
| 293 | 293 | // If the visibility option is `false`, remove the one just added from the sub-menu global array |
| 294 | - if ( ! $bShowInMenu && ! $this->_isCurrentPage( $sPageSlug ) ) { |
|
| 294 | + if ( !$bShowInMenu && !$this->_isCurrentPage( $sPageSlug ) ) { |
|
| 295 | 295 | return $_sPageHook; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // Set the order index in the element of the `submenu` global array. |
| 299 | 299 | $this->_setSubMenuPageByIndex( |
| 300 | - $nOrder, // user-set order |
|
| 301 | - $_aRemovedMenuItem, // will be reassign with a new index |
|
| 300 | + $nOrder, // user-set order |
|
| 301 | + $_aRemovedMenuItem, // will be reassign with a new index |
|
| 302 | 302 | $sMenuSlug |
| 303 | 303 | ); |
| 304 | 304 | |
@@ -319,21 +319,21 @@ discard block |
||
| 319 | 319 | * @uses add_submenu_page |
| 320 | 320 | */ |
| 321 | 321 | private function ___addSubMenuPage( |
| 322 | - $sRootPageSlug, // the root (parent) page slug |
|
| 323 | - $sPageTitle, // page title |
|
| 324 | - $sMenuTitle, // menu title |
|
| 325 | - $sCapability, // capability |
|
| 322 | + $sRootPageSlug, // the root (parent) page slug |
|
| 323 | + $sPageTitle, // page title |
|
| 324 | + $sMenuTitle, // menu title |
|
| 325 | + $sCapability, // capability |
|
| 326 | 326 | $sPageSlug // menu slug |
| 327 | 327 | ) { |
| 328 | 328 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
| 329 | 329 | return $sPageSlug; |
| 330 | 330 | } |
| 331 | 331 | return add_submenu_page( |
| 332 | - $sRootPageSlug, // the root (parent) page slug |
|
| 333 | - $sPageTitle, // page title |
|
| 334 | - $sMenuTitle, // menu title |
|
| 335 | - $sCapability, // capability |
|
| 336 | - $sPageSlug, // menu slug |
|
| 332 | + $sRootPageSlug, // the root (parent) page slug |
|
| 333 | + $sPageTitle, // page title |
|
| 334 | + $sMenuTitle, // menu title |
|
| 335 | + $sCapability, // capability |
|
| 336 | + $sPageSlug, // menu slug |
|
| 337 | 337 | array( $this->oFactory, '_replyToRenderPage' ) // callback 3.7.10+ |
| 338 | 338 | ); |
| 339 | 339 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | add_action( |
| 369 | 369 | 'current_screen', |
| 370 | - array( $this->oFactory, "load_pre_" . $sPageSlug ), |
|
| 370 | + array( $this->oFactory, "load_pre_".$sPageSlug ), |
|
| 371 | 371 | 20 |
| 372 | 372 | ); |
| 373 | 373 | /** |
@@ -382,15 +382,15 @@ discard block |
||
| 382 | 382 | * Set a low priority because the user may add in-page tabs in their callback method of this action hook. |
| 383 | 383 | * @since 3.6.3 |
| 384 | 384 | */ |
| 385 | - add_action( "load_" . $sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 385 | + add_action( "load_".$sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
| 386 | 386 | |
| 387 | 387 | // 3.6.3+ |
| 388 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 389 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 388 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
| 389 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
| 390 | 390 | |
| 391 | 391 | $this->oFactory->oProp->aPageHooks[ $sPageSlug ] = $this->getAOrB( |
| 392 | 392 | is_network_admin(), |
| 393 | - $sPageHook . '-network', |
|
| 393 | + $sPageHook.'-network', |
|
| 394 | 394 | $sPageHook |
| 395 | 395 | ); |
| 396 | 396 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $_nNewIndex = $this->getUnusedNumericIndex( |
| 409 | 409 | $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ), // subject array to parser |
| 410 | - $nOrder, // a desired menu position |
|
| 410 | + $nOrder, // a desired menu position |
|
| 411 | 411 | 5 // offset |
| 412 | 412 | ); |
| 413 | 413 | |
@@ -421,9 +421,9 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | private function _getSubMenuPageIndex( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) { |
| 423 | 423 | |
| 424 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 424 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
| 425 | 425 | |
| 426 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
| 426 | + if ( !isset( $_aSubMenu[ 3 ] ) ) { |
|
| 427 | 427 | continue; |
| 428 | 428 | } |
| 429 | 429 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
| 456 | 456 | * @return array removed menu item. |
| 457 | 457 | */ |
| 458 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
| 458 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
| 459 | 459 | |
| 460 | 460 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
| 461 | 461 | $nSubMenuPageIndex, |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | */ |
| 529 | 529 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
| 530 | 530 | |
| 531 | - if ( ! $bShowInMenu ) { |
|
| 531 | + if ( !$bShowInMenu ) { |
|
| 532 | 532 | return; |
| 533 | 533 | } |
| 534 | 534 | |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | 5 // offset |
| 544 | 544 | ); |
| 545 | 545 | $_aSubMenuItems[ $_nIndex ] = array( |
| 546 | - $sTitle, // 0 |
|
| 547 | - $sCapability, // 1 |
|
| 548 | - $sHref, // 2 |
|
| 546 | + $sTitle, // 0 |
|
| 547 | + $sCapability, // 1 |
|
| 548 | + $sHref, // 2 |
|
| 549 | 549 | ); |
| 550 | 550 | $GLOBALS[ 'submenu' ][ $sMenuSlug ] = $_aSubMenuItems; |
| 551 | 551 | |
@@ -562,17 +562,17 @@ discard block |
||
| 562 | 562 | */ |
| 563 | 563 | public function _replyToLoadPageForAjax() { |
| 564 | 564 | $_sCurrentPageSlug = $this->oFactory->oProp->getCurrentPageSlugIfAdded(); |
| 565 | - if ( ! $_sCurrentPageSlug ) { |
|
| 565 | + if ( !$_sCurrentPageSlug ) { |
|
| 566 | 566 | return; |
| 567 | 567 | } |
| 568 | - $_sCurrentTabSlug = $this->oFactory->oProp->getCurrentInPageTabSlugIfAdded( $_sCurrentPageSlug ); |
|
| 568 | + $_sCurrentTabSlug = $this->oFactory->oProp->getCurrentInPageTabSlugIfAdded( $_sCurrentPageSlug ); |
|
| 569 | 569 | if ( |
| 570 | - ! empty( $this->oFactory->oProp->aInPageTabs ) // it means at least one in-page tab is added |
|
| 571 | - && ! $_sCurrentTabSlug // the current tab could not be retrieved |
|
| 570 | + !empty( $this->oFactory->oProp->aInPageTabs ) // it means at least one in-page tab is added |
|
| 571 | + && !$_sCurrentTabSlug // the current tab could not be retrieved |
|
| 572 | 572 | ) { |
| 573 | 573 | return; |
| 574 | 574 | } |
| 575 | - call_user_func_array( array( $this->oFactory, "load_pre_" . $_sCurrentPageSlug ), array() ); |
|
| 575 | + call_user_func_array( array( $this->oFactory, "load_pre_".$_sCurrentPageSlug ), array() ); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | /** |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | public function _replyToRemoveRootMenuPage() { |
| 586 | 586 | |
| 587 | 587 | // After adding the sub menus, if the root menu is created, remove the page that is automatically created when registering the root menu. |
| 588 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 588 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
| 589 | 589 | return; |
| 590 | 590 | } |
| 591 | 591 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * Namespace slugs have backslashes but the registered slugs backslashes are all converted to forward-slashes. |
| 597 | 597 | * @since 3.5.16 |
| 598 | 598 | */ |
| 599 | - $_sMenuSlug = str_replace( |
|
| 599 | + $_sMenuSlug = str_replace( |
|
| 600 | 600 | '\\', |
| 601 | 601 | '/', |
| 602 | 602 | $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ] |