From acc42674db6482ee6d432c4a9c174ed7dfcea063 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 24 May 2018 19:03:42 +0200 Subject: W 2.2 --- class/class.w.media.php | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 class/class.w.media.php (limited to 'class/class.w.media.php') diff --git a/class/class.w.media.php b/class/class.w.media.php new file mode 100644 index 0000000..e5056c9 --- /dev/null +++ b/class/class.w.media.php @@ -0,0 +1,122 @@ +hydrate($donnees); + } + + public function hydrate(array $donnees) + { + foreach ($donnees as $key => $value) { + $method = 'set' . $key; + + if (method_exists($this, $method)) { + $this->$method($value); + } + } + } + + + +// _________________________________________________ G E T ____________________________________________________ + + public function id() + { + return $this->id; + } + + public function path() + { + return $this->path; + } + + public function extension() + { + return $this->extension; + } + + public function type() + { + return $this->type; + } + + public function size() + { + return $this->size; + } + + public function width() + { + return $this->width; + } + + public function height() + { + return $this->height; + } + +// ___________________________________________________ S E T __________________________________________________ + + public function setid($id) + { + if (strlen($id) < 40 and is_string($id)) { + $this->id = strip_tags(strtolower($id)); + } + } + + public function setpath($path) + { + if (strlen($path) < 40 and is_string($path)) { + $this->path = strip_tags(strtolower($path)); + } + } + + public function setextension($extension) + { + if (strlen($extension) < 7 and is_string($extension)) { + $this->extension = strip_tags(strtolower($extension)); + } + } + + public function setsize($size) + { + if (40 and is_int($size)) { + $this->size = strip_tags(strtolower($size)); + } + } + + public function setwidth($width) + { + if (is_int($width)) { + $this->width = strip_tags(strtolower($width)); + } + } + + public function setheight($height) + { + if (is_int($height)) { + $this->height = strip_tags(strtolower($height)); + } + } + + + + + +} + +?> \ No newline at end of file -- cgit v1.2.3