XoopsModules25x /
oledrion
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | namespace XoopsModules\Oledrion; |
||
| 4 | |||
| 5 | /* |
||
| 6 | You may not change or alter any portion of this comment or credits |
||
| 7 | of supporting developers from this source code or any supporting source code |
||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, |
||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * oledrion |
||
| 17 | * |
||
| 18 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 19 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
| 20 | * @author Hervé Thouzard (http://www.herve-thouzard.com/) |
||
| 21 | */ |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Internal class whose purpose is to pass parameters to the Shelf class |
||
| 25 | */ |
||
| 26 | |||
| 27 | use XoopsModules\Oledrion; |
||
| 28 | |||
| 29 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Utilisé comme paramètre dans la façcade Shelf |
||
| 33 | */ |
||
| 34 | class ShelfParameters |
||
| 35 | { |
||
| 36 | /** |
||
| 37 | * Le conteneur de paramètres |
||
| 38 | * |
||
| 39 | * @var array |
||
| 40 | */ |
||
| 41 | private $parameters = []; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * ShelfParameters constructor. |
||
| 45 | */ |
||
| 46 | public function __construct() |
||
| 47 | { |
||
| 48 | $this->resetDefaultValues(); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Réinitialisation des valeurs |
||
| 53 | * |
||
| 54 | * @return ShelfParameters |
||
| 55 | */ |
||
| 56 | public function resetDefaultValues() |
||
| 57 | { |
||
| 58 | $this->parameters['start'] = 0; |
||
| 59 | $this->parameters['limit'] = 0; |
||
| 60 | $this->parameters['category'] = 0; |
||
| 61 | $this->parameters['sort'] = 'product_submitted DESC, product_title'; |
||
| 62 | $this->parameters['order'] = 'ASC'; |
||
| 63 | $this->parameters['excluded'] = 0; |
||
| 64 | $this->parameters['withXoopsUser'] = false; |
||
| 65 | $this->parameters['withRelatedProducts'] = false; |
||
| 66 | $this->parameters['withQuantity'] = false; |
||
| 67 | $this->parameters['thisMonthOnly'] = false; |
||
| 68 | $this->parameters['productsType'] = ''; |
||
| 69 | |||
| 70 | return $this; |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Retourne le tableau des paramètres |
||
| 75 | * |
||
| 76 | * @return array |
||
| 77 | */ |
||
| 78 | public function getParameters() |
||
| 79 | { |
||
| 80 | return $this->parameters; |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Positione la valeur de début |
||
| 85 | * |
||
| 86 | * @param int $value |
||
| 87 | * @return ShelfParameters |
||
| 88 | */ |
||
| 89 | public function setStart($value) |
||
| 90 | { |
||
| 91 | $this->parameters['start'] = (int)$value; |
||
| 92 | |||
| 93 | return $this; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Fixe le nombre maximum d'enregistrements à retourner |
||
| 98 | * |
||
| 99 | * @param int $value |
||
| 100 | * @return ShelfParameters |
||
| 101 | */ |
||
| 102 | public function setLimit($value) |
||
| 103 | { |
||
| 104 | $this->parameters['limit'] = (int)$value; |
||
| 105 | |||
| 106 | return $this; |
||
| 107 | } |
||
| 108 | |||
| 109 | /** |
||
| 110 | * Fixe la catégorie à utiliser |
||
| 111 | * |
||
| 112 | * @param int $value |
||
| 113 | * @return ShelfParameters |
||
| 114 | */ |
||
| 115 | public function setCategory($value) |
||
| 116 | { |
||
| 117 | $this->parameters['category'] = $value; |
||
| 118 | |||
| 119 | return $this; |
||
| 120 | } |
||
| 121 | |||
| 122 | /** |
||
| 123 | * Fixe la zone qui sert de tri |
||
| 124 | * |
||
| 125 | * @param string $value |
||
| 126 | * @return ShelfParameters |
||
| 127 | */ |
||
| 128 | public function setSort($value) |
||
| 129 | { |
||
| 130 | $this->parameters['sort'] = $value; |
||
| 131 | |||
| 132 | return $this; |
||
| 133 | } |
||
| 134 | |||
| 135 | /** |
||
| 136 | * Fixe l'ordre de tri |
||
| 137 | * |
||
| 138 | * @param string $value |
||
| 139 | * @return \XoopsModules\Oledrion\ShelfParameters |
||
| 140 | */ |
||
| 141 | public function setOrder($value) |
||
| 142 | { |
||
| 143 | $this->parameters['order'] = $value; |
||
| 144 | |||
| 145 | return $this; |
||
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * Set the list of products to exclude |
||
| 150 | * |
||
| 151 | * @param mixed $value |
||
| 152 | * @return string |
||
| 153 | */ |
||
| 154 | public function setExcluded($value) |
||
| 155 | { |
||
| 156 | $this->parameters['excluded'] = $value; |
||
| 157 | |||
| 158 | return $this; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
| 162 | * Indique s'il faut retourner les utilisateurs Xoops |
||
| 163 | * |
||
| 164 | * @param bool $value |
||
| 165 | * @return ShelfParameters |
||
| 166 | */ |
||
| 167 | public function setWithXoopsUser($value) |
||
| 168 | { |
||
| 169 | $this->parameters['withXoopsUser'] = $value; |
||
| 170 | |||
| 171 | return $this; |
||
| 172 | } |
||
| 173 | |||
| 174 | /** |
||
| 175 | * Indique s'il faut retourner les produits relatifs |
||
| 176 | * |
||
| 177 | * @param bool $value |
||
| 178 | * @return ShelfParameters |
||
| 179 | */ |
||
| 180 | public function setWithRelatedProducts($value) |
||
| 181 | { |
||
| 182 | $this->parameters['withRelatedProducts'] = $value; |
||
| 183 | |||
| 184 | return $this; |
||
| 185 | } |
||
| 186 | |||
| 187 | /** |
||
| 188 | * Indique s'il faut retourner les quantités |
||
| 189 | * |
||
| 190 | * @param bool $value |
||
| 191 | * @return ShelfParameters |
||
| 192 | */ |
||
| 193 | public function setWithQuantity($value) |
||
| 194 | { |
||
| 195 | $this->parameters['withQuantity'] = $value; |
||
| 196 | |||
| 197 | return $this; |
||
| 198 | } |
||
| 199 | |||
| 200 | /** |
||
| 201 | * Fixe le type de produits à retourner |
||
| 202 | * |
||
| 203 | * @param string $value |
||
| 204 | * @return ShelfParameters |
||
| 205 | */ |
||
| 206 | public function setProductsType($value) |
||
| 207 | { |
||
| 208 | $this->parameters['productsType'] = $value; |
||
| 209 | |||
| 210 | return $this; |
||
| 211 | } |
||
| 212 | |||
| 213 | /** |
||
| 214 | * Indique s'il faut retourner seulement les mois |
||
| 215 | * |
||
| 216 | * @param bool $value |
||
| 217 | * @return ShelfParameters |
||
| 218 | */ |
||
| 219 | public function setThisMonthOnly($value) |
||
| 220 | { |
||
| 221 | $this->parameters['thisMonthOnly'] = $value; |
||
| 222 | |||
| 223 | return $this; |
||
| 224 | } |
||
| 225 | } |
||
| 226 |