'', 'alt' => '' ); function __construct() { parent::__construct(DB_MEDIAS); } public function getDefaultFields() { return $this->dbFields; } // Return an array with the database for a page, FALSE otherwise public function getMediaDB($key) { if ($this->exists($key)) { return $this->db[$key]; } return false; } // Return TRUE if the page exists, FALSE otherwise public function exists($key) { return isset($this->db[$key]); } // Get all the medias public function content() { $content = array(); foreach ($this->db as $field => $value) { $content[$field] = new Media($field); } return $content; } public function add($args, $filename) { $row = array(); foreach ($this->dbFields as $field => $value) { $row[$field] = $args[$field]; } $row['filename'] = $filename; $key = Text::cleanUrl($row['name']); // Insert in database $this->db[$key] = $row; // Save database $this->save(); } public function edit($key, $args, $filename) { $row = array(); foreach ($this->dbFields as $field => $value) { $row[$field] = $args[$field]; } if ($filename && $filename != "") { $row['filename'] = $filename; } // Insert in database $this->db[$key] = $row; // Save database $this->save(); } }