diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2019-08-16 15:23:42 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2019-08-16 15:23:42 +0200 |
commit | b5ebee8dea28e3a9c5160de1c56f7715153f3af4 (patch) | |
tree | b7729495fdfa58210612d8280058a7412c57e9ea /app/class/optlist.php | |
parent | 566b995bab45355d814ac5a8bfbf18e3a59c14ba (diff) | |
download | wcms-b5ebee8dea28e3a9c5160de1c56f7715153f3af4.tar.gz wcms-b5ebee8dea28e3a9c5160de1c56f7715153f3af4.zip |
Generate list code function working
Diffstat (limited to 'app/class/optlist.php')
-rw-r--r-- | app/class/optlist.php | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/app/class/optlist.php b/app/class/optlist.php new file mode 100644 index 0000000..cf68fa7 --- /dev/null +++ b/app/class/optlist.php @@ -0,0 +1,114 @@ +<?php + +class Optlist extends Opt +{ + private $description = 0; + private $thumbnail = 0; + private $date = 0; + private $author = 0; + private $style = 0; + + + /** + * New constructor dedicated to parse input string + * + * @param string|array $parsedstring parsed query string + */ + public function __construct($datas = []) + { + if(is_string($datas)) { + $datas = parse_str($this->options, $datas); + + } + $this->hydrate($datas); + } + + + /** + * Get the query as http string + * + * @return string The resulted query + */ + public function getquery() : string + { + $class = get_class_vars(get_class($this)); + $object = get_object_vars($this); + $class['artvarlist'] = $object['artvarlist']; + $class['taglist'] = $object['taglist']; + $class['authorlist'] = $object['authorlist']; + $query = array_diff_assoc_recursive($object, $class); + + return urldecode(http_build_query($query)); + } + + /** + * Get the code to insert directly + */ + public function getcode() : string + { + return '%LIST?' . $this->getquery() . '%'; + } + + + + // _______________________________________ G E T _____________________________________ + + + public function description() + { + return $this->description; + } + + public function thumbnail() + { + return $this->thumbnail; + } + + public function date() + { + return $this->date; + } + + public function author() + { + return $this->author; + } + + public function style() + { + return $this->style; + } + + + + // _______________________________________ S E T _____________________________________ + + public function setdescription($description) + { + $this->description = intval($description); + } + + public function setthumbnail($thumbnail) + { + $this->thumbnail = intval($thumbnail); + } + + public function setdate($date) + { + $this->date = intval($date); + } + + public function setauthor($author) + { + $this->author = intval($author); + } + + public function setstyle($style) + { + $this->style = intval($style); + } +} + + + +?>
\ No newline at end of file |