@@ -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>" |
@@ -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 | |
@@ -281,11 +281,9 @@ |
||
| 281 | 281 | |
| 282 | 282 | if ( is_network_admin() ) { |
| 283 | 283 | $_sNeedle = '#/wp-admin/network/?(.*?)$#i'; |
| 284 | - } |
|
| 285 | - else if ( is_user_admin() ) { |
|
| 284 | + } else if ( is_user_admin() ) { |
|
| 286 | 285 | $_sNeedle = '#/wp-admin/user/?(.*?)$#i'; |
| 287 | - } |
|
| 288 | - else { |
|
| 286 | + } else { |
|
| 289 | 287 | $_sNeedle = '#/wp-admin/?(.*?)$#i'; |
| 290 | 288 | } |
| 291 | 289 | preg_match( $_sNeedle, $_SERVER[ 'PHP_SELF' ], $_aMatches ); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | 'getPostTypeByTypeNow', |
| 57 | 57 | 'getPostTypeByScreenObject', |
| 58 | 58 | 'getPostTypeByREQUEST', |
| 59 | - 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
| 59 | + 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
| 60 | 60 | ); |
| 61 | 61 | foreach ( $_aMethodsToTry as $_sMethodName ) { |
| 62 | 62 | $_sPostType = call_user_func( array( __CLASS__, $_sMethodName ) ); |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | * @param array|string The post type slug(s) to check. If this is empty, the method just checks the current page is a taxonomy page. |
| 121 | 121 | * @return boolean |
| 122 | 122 | */ |
| 123 | - static public function isCustomTaxonomyPage( $asPostTypes=array() ) { |
|
| 123 | + static public function isCustomTaxonomyPage( $asPostTypes = array() ) { |
|
| 124 | 124 | |
| 125 | - if ( ! in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', 'term.php' ) ) ) { |
|
| 125 | + if ( !in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', 'term.php' ) ) ) { |
|
| 126 | 126 | return false; |
| 127 | 127 | } |
| 128 | 128 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | * Otherwise, it will check if the page belongs to the given post type(s). |
| 138 | 138 | * @return boolean |
| 139 | 139 | */ |
| 140 | - static public function isPostDefinitionPage( $asPostTypes=array() ) { |
|
| 140 | + static public function isPostDefinitionPage( $asPostTypes = array() ) { |
|
| 141 | 141 | |
| 142 | 142 | // If it's not the post definition page, |
| 143 | - if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
| 143 | + if ( !in_array( self::getPageNow(), array( 'post.php', 'post-new.php',) ) ) { |
|
| 144 | 144 | return false; |
| 145 | 145 | } |
| 146 | 146 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -173,14 +173,14 @@ discard block |
||
| 173 | 173 | * |
| 174 | 174 | * @since 3.0.0 |
| 175 | 175 | */ |
| 176 | - static public function isPostListingPage( $asPostTypes=array() ) { |
|
| 176 | + static public function isPostListingPage( $asPostTypes = array() ) { |
|
| 177 | 177 | |
| 178 | 178 | if ( 'edit.php' != self::getPageNow() ) { |
| 179 | 179 | return false; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
| 183 | - if ( ! isset( $_GET[ 'post_type' ] ) ) { |
|
| 183 | + if ( !isset( $_GET[ 'post_type' ] ) ) { |
|
| 184 | 184 | return in_array( 'post', $_aPostTypes, true ); |
| 185 | 185 | } |
| 186 | 186 | return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | 0 => '_getPageNow_FrontEnd', |
| 218 | 218 | 1 => '_getPageNow_BackEnd', |
| 219 | 219 | ); |
| 220 | - $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
| 220 | + $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
| 221 | 221 | self::$_sPageNow = self::$_sMethodName(); |
| 222 | 222 | return self::$_sPageNow; |
| 223 | 223 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | if ( isset( $GLBOALS[ 'page_hook' ] ) ) { |
| 314 | 314 | return is_network_admin() |
| 315 | - ? $GLBOALS[ 'page_hook' ] . '-network' |
|
| 315 | + ? $GLBOALS[ 'page_hook' ].'-network' |
|
| 316 | 316 | : $GLBOALS[ 'page_hook' ]; |
| 317 | 317 | } |
| 318 | 318 | |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * @since 3.7.0 |
| 327 | 327 | * @return boolean |
| 328 | 328 | */ |
| 329 | - static public function doesMetaBoxExist( $sContext='' ) { |
|
| 329 | + static public function doesMetaBoxExist( $sContext = '' ) { |
|
| 330 | 330 | |
| 331 | 331 | $_aDimensions = array( 'wp_meta_boxes', $GLOBALS[ 'page_hook' ] ); |
| 332 | 332 | if ( $sContext ) { |
| 333 | - $_aDimensions[] = $sContext; |
|
| 333 | + $_aDimensions[ ] = $sContext; |
|
| 334 | 334 | } |
| 335 | 335 | $_aSideMetaBoxes = self::getElementAsArray( |
| 336 | 336 | $GLOBALS, |
@@ -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, |
@@ -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' ] |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | class AdminPageFramework_Model__FormSubmission__Validator__ContactForm extends AdminPageFramework_Model__FormSubmission__Validator_Base { |
| 19 | 19 | |
| 20 | - public $sActionHookPrefix = 'try_validation_after_'; // 3.7.6 Changed it from `try_validation_before_` |
|
| 20 | + public $sActionHookPrefix = 'try_validation_after_'; // 3.7.6 Changed it from `try_validation_before_` |
|
| 21 | 21 | public $iHookPriority = 10; |
| 22 | 22 | public $iCallbackParameters = 5; |
| 23 | 23 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 35 | 35 | |
| 36 | 36 | // Check whether sending an email has been confirmed by the user or not. |
| 37 | - if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
| 37 | + if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | $this->getElement( $aSubmitInformation, 'section_id' ) |
| 46 | 46 | ); |
| 47 | 47 | $this->oFactory->oProp->_bDisableSavingOptions = true; |
| 48 | - $this->deleteTransient( 'apf_tfd' . md5( 'temporary_form_data_' . $this->oFactory->oProp->sClassName . get_current_user_id() ) ); |
|
| 48 | + $this->deleteTransient( 'apf_tfd'.md5( 'temporary_form_data_'.$this->oFactory->oProp->sClassName.get_current_user_id() ) ); |
|
| 49 | 49 | |
| 50 | 50 | // Schedule to remove the confirmation url query key. |
| 51 | 51 | add_action( "setting_update_url_{$this->oFactory->oProp->sClassName}", array( $this, '_replyToRemoveConfirmationQueryKey' ) ); |
| 52 | 52 | |
| 53 | 53 | // Go to the catch clause. |
| 54 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
| 54 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
| 55 | 55 | $_oException->aReturn = $aInputs; |
| 56 | 56 | throw $_oException; |
| 57 | 57 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | private function _sendEmailInBackground( $aInputs, $sPressedInputNameFlat, $sSubmitSectionID ) { |
| 88 | 88 | |
| 89 | - $_sTranskentKey = 'apf_em_' . md5( $sPressedInputNameFlat . get_current_user_id() ); |
|
| 89 | + $_sTranskentKey = 'apf_em_'.md5( $sPressedInputNameFlat.get_current_user_id() ); |
|
| 90 | 90 | $_aEmailOptions = $this->getTransient( $_sTranskentKey ); |
| 91 | 91 | $this->deleteTransient( $_sTranskentKey ); |
| 92 | 92 | |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | 'name' => '', |
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | - $_sTransientKey = 'apf_emd_' . md5( $sPressedInputNameFlat . get_current_user_id() ); |
|
| 104 | + $_sTransientKey = 'apf_emd_'.md5( $sPressedInputNameFlat.get_current_user_id() ); |
|
| 105 | 105 | $_aFormEmailData = array( |
| 106 | 106 | 'email_options' => $_aEmailOptions, |
| 107 | 107 | 'input' => $aInputs, |
| 108 | 108 | 'section_id' => $sSubmitSectionID, |
| 109 | 109 | ); |
| 110 | - $_bIsSet = $this->setTransient( $_sTransientKey, $_aFormEmailData, 100 ); |
|
| 110 | + $_bIsSet = $this->setTransient( $_sTransientKey, $_aFormEmailData, 100 ); |
|
| 111 | 111 | |
| 112 | 112 | // Send the email in the background. |
| 113 | 113 | wp_remote_get( |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | 127 | // @remark Not possible to tell whether it is sent or not at the moment because it is performed in the background. |
| 128 | - $_bSent = $_bIsSet; |
|
| 128 | + $_bSent = $_bIsSet; |
|
| 129 | 129 | $this->oFactory->setSettingNotice( |
| 130 | 130 | $this->oFactory->oMsg->get( |
| 131 | 131 | $this->getAOrB( |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @return string |
| 148 | 148 | */ |
| 149 | 149 | public function _replyToRemoveConfirmationQueryKey( $sSettingUpdateURL ) { |
| 150 | - return remove_query_arg( array( 'confirmation', ), $sSettingUpdateURL ); |
|
| 150 | + return remove_query_arg( array( 'confirmation',), $sSettingUpdateURL ); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | protected function _getFormattedSubMenuLinkArray( array $aSubMenuLink ) { |
| 93 | 93 | |
| 94 | 94 | // If the set URL is not valid, return. |
| 95 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 95 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
| 96 | 96 | return array(); |
| 97 | 97 | } |
| 98 | 98 | |