Ejemplo n.º 1
0
 /**
  * Reads the file
  *
  * @param $path
  *
  * @return mixed|null
  */
 public static function ReadFile($path)
 {
     /**
      * Get the correct path
      */
     $corrected_path = Path::Get($path);
     /**
      * Does this exist?
      */
     if (file_exists($corrected_path)) {
         /**
          * Return the encoded json
          */
         return json_decode(JsonReader::OpenFile($corrected_path), true);
     }
     /**
      * This does not exist!
      */
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Creates directories
  *
  * @param $path
  *
  * @return null|string
  */
 public static function CreateDirectories($path)
 {
     /**
      * Lets get a correct string
      */
     $corrected_path = Path::Get($path);
     /**
      * Lets get all the dirs
      */
     $directories = explode('/', $corrected_path);
     /**
      * POP
      */
     array_pop($directories);
     /**
      * Empty string
      */
     $string = null;
     /**
      * Then, lets loop
      */
     foreach ($directories as $key => $value) {
         /**
          * Lets add to our string
          */
         $string = $string . $value . "/";
         /**
          * Does this not exist?
          */
         if (file_exists($string) == false) {
             /**
              * If not, make this directory
              */
             mkdir($string);
         }
     }
     /**
      * Return the string of the created directories
      */
     return $string;
 }