/**
  * Our construct can take in parameters
  *
  * @param bool|true $auto
  *
  * @param array|null $array
  *
  * @param null $callback
  */
 public function __construct($auto = true, array $array = null, $callback = null)
 {
     /**
      * If auto is enabled, automatically create the table on conception of this class.
      */
     if ($auto) {
         /**
          * Read the default database diagram
          */
         $this->database_diagram = JsonReader::ReadFile(PathFinder::RealPath("Json/default_database.json"));
         /**
          * If we have an array.
          */
         if ($array != null) {
             /**
              * No, an stdClass won't work, go away.
              */
             if (!is_array($array)) {
                 return null;
             }
             /**
              * Create a new merged array
              */
             $merged = array_merge($this->database_diagram, $array);
             /**
              * Create a new database class
              */
             $class = new DatabaseCreator();
             /**
              * Call the function
              */
             $class->ComputeArray($merged);
             /**
              * Return
              */
             return;
         }
         /**
          * Create a new database class
          */
         $class = new DatabaseCreator();
         /**
          * Call the function
          */
         $class->ComputeArray($this->database_diagram);
         /**
          * Do we have a callback?
          */
         if ($callback != null) {
             /**
              * If so blast that shit out
              */
             call_user_func($callback);
         }
     }
     /**
      * If not, return nothing and do nothing.
      */
 }
 /**
  * Finds the default settings.
  *
  * @return mixed|null
  */
 public function FindSettings()
 {
     if (FileMethods::FileExists(PathFinder::RealPath("Json/default_settings.json"))) {
         $result = JsonReader::ReadFile(PathFinder::RealPath("Json/default_settings.json"));
         return $result;
     }
     return null;
 }
Example #3
0
 /**
  * Gets the templates file
  *
  * @param $template_name
  *
  * @return null
  */
 private function GetTemplate($template_name)
 {
     if (FileMethods::FileExists(PathFinder::RealPath('Json/default_mailing_templates.json'))) {
         $templates = JsonReader::ReadFile(PathFinder::RealPath('Json/default_mailing_templates.json'));
         if (isset($templates[$template_name])) {
             return $templates[$template_name];
         }
     }
     return null;
 }
 /**
  * Find groups
  *
  * @return mixed|null
  */
 private function FindGroups()
 {
     if (FileMethods::FileExists(PathFinder::RealPath("Json/default_groups.json"))) {
         return JsonReader::ReadFile(PathFinder::RealPath("Json/default_groups.json"));
     }
     return null;
 }