Exemplo n.º 1
0
 /**
  * Constructs the class and sets all of the properties.
  */
 public function __construct()
 {
     // Set the prefix.
     $this->setting_prefix = Config::getInstance()->getFrameworkConfig('setting_prefix');
     // Set the validation class.
     $this->validator = ValidatesSettingOptions::getInstance();
 }
 /**
  * Makes all of the Setting Objects Child Objects.
  */
 private function makeChildren($children, $parent)
 {
     // Will be set to false after the first valid item in the loop.
     $initial = true;
     foreach ($children as $id => $options) {
         // Validate the options. If invalid move on to the next item.
         $valid_options = ValidatesSettingOptions::getInstance()->validate($options);
         if ($valid_options == false) {
             continue;
         }
         // Get the type.
         $type = $valid_options['type'];
         // Make sure for tabs the parent's tab_style is set to independent
         if ($type == 'tab' && $parent->options['tab_style'] != 'independent') {
             // Ignore and move on to the next item.
             continue;
         }
         // If it is the first valid child, make sure everything else is this type.
         if ($initial) {
             // Set the page's direct children to the type.
             $parent->child_type = $type;
         }
         // Make sure that they didn't change the type.
         if ($type !== $parent->child_type) {
             // Move on to the next item if they type is not correct.
             continue;
         }
         // Calls the correct constructor.
         $this->callChildConstructor($id, $valid_options, $parent, $initial);
         // If this was the inital child element, set inital to false for future child elements.
         $initial = $initial ? false : $initial;
     }
 }
 /**
  * Constructs the class
  */
 private function __construct()
 {
     $this->validator = ValidatesSettingOptions::getInstance();
 }