Example #1
0
 protected function RegisterFeature($classname)
 {
     // If there isnt a feature in the data with this classname
     if (!isset($this->features[$classname])) {
         // Then create it
         $this->features[$classname] = new $classname();
     }
     // Important! Make sure the garbage collector does't get it.
     $this->registered_features[] =& $this->features[$classname];
     // Set the enabled state of the feature
     if (OnePanelConfig::FeatureIsEnabled($classname)) {
         $this->features[$classname]->Enable();
         // Enable the feature
         $this->enabled_features[] = $classname;
     } else {
         $this->features[$classname]->Disable();
         // Disable the feature
     }
 }
 protected function RegisterFeatures()
 {
     // Get the name of the default from the config
     $config_default = OnePanelConfig::GetDefaultHomePageLayout();
     if (!isset($this->features['HomePageLayoutFeature'])) {
         if (!is_object($config_default)) {
             return false;
         }
         $config_default_name = $config_default->GetName();
         $feature = new HomePageLayoutFeature();
         $this->features['HomePageLayoutFeature'] =& $feature;
         $feature->SetAvailableLayouts(OnePanelConfig::GetHomePageLayouts());
         $feature->SetDefaultLayout($config_default_name);
     } else {
         $this->features['HomePageLayoutFeature']->SetAvailableLayouts(OnePanelConfig::GetHomePageLayouts());
         // Check for file path changes in the default config layout rectify if we need to.
         $our_default = $this->features['HomePageLayoutFeature']->GetDefaultLayout();
         $config_layouts = OnePanelConfig::GetHomePageLayouts();
         $config_equiv = $config_layouts[$our_default->GetName()];
         if (!is_object($config_equiv)) {
             return false;
         }
         if ($config_equiv->GetLocation() != $our_default->GetLocation()) {
             $this->features['HomePageLayoutFeature']->SetDefaultLayout($config_default->GetName());
         }
     }
     if (OnePanelConfig::FeatureIsEnabled('HomePageLayoutFeature')) {
         $this->features['HomePageLayoutFeature']->Enable();
         // Enable the feature
         $this->enabled_features[] = 'HomePageLayoutFeature';
     } else {
         $this->features['HomePageLayoutFeature']->Disable();
         // Disable the feature
     }
 }