Permalink
Browse files

Refactored code.

  • Loading branch information...
michaeluno committed Jan 11, 2017
1 parent 8c606a8 commit e822bb71f370fc53c58e53b349fa60c10cf0be1f
Showing with 15 additions and 11 deletions.
  1. +15 −11 development/factory/_common/_abstract/AdminPageFramework_Factory_Router.php
@@ -140,10 +140,7 @@
public function __construct( $oProp ) {
// Set sub-class names.
- foreach( $this->_aSubClassPrefixes as $_sObjectVariableName => $_sPrefix ) {
- $this->aSubClassNames[ $_sObjectVariableName ] = $_sPrefix . $this->_sStructureType;
- }
- $this->aSubClassNames = $this->aSubClassNames + $this->_aSubClassNames;
+ $this->aSubClassNames = $this->___getSubClassNames();
// Let them overload so that these sub-class objects will not be instantiated until they are required.
unset(
@@ -159,21 +156,28 @@ public function __construct( $oProp ) {
// Required sub-class objects
$this->oProp = $oProp;
-
+
if ( $this->oProp->bIsAdmin && ! $this->oProp->bIsAdminAjax ) {
- if ( did_action( 'current_screen' ) ) {
- $this->_replyToLoadComponents();
- } else {
- add_action( 'current_screen', array( $this, '_replyToLoadComponents' ) );
- }
+ $this->oUtil->registerAction( 'current_screen', array( $this, '_replyToLoadComponents' ) );
}
// Call the user constructor.
$this->start(); // defined in the controller class.
$this->oUtil->addAndDoAction( $this, 'start_' . $this->oProp->sClassName, $this );
}
-
+ /**
+ * Retrieves sub-class names for sub-objects.
+ * @since 3.8.14
+ * @return array
+ */
+ private function ___getSubClassNames() {
+ foreach( $this->_aSubClassPrefixes as $_sObjectVariableName => $_sPrefix ) {
+ $this->aSubClassNames[ $_sObjectVariableName ] = $_sPrefix . $this->_sStructureType;
+ }
+ return $this->aSubClassNames + $this->_aSubClassNames;
+ }
+
/**
* Determines whether the class component classes should be instantiated or not.
*

0 comments on commit e822bb7

Please sign in to comment.