| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | /** |
| 4 | 4 | * E2pdf Post Helper |
| 5 | 5 | * |
| 6 | 6 | * @copyright Copyright 2017 https://e2pdf.com |
| 7 | - * @license GPL v2 | |
| 7 | + * @license GPLv3 | |
| 8 | 8 | * @version 1 |
| 9 | 9 | * @link https://e2pdf.com |
| 10 | 10 | * @since 0.00.01 |
| 11 | 11 | */ |
| @@ -21,9 +21,11 @@ | ||
| 21 | 21 | * On init |
| 22 | 22 | * Assign $_POST params to $post |
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | - $this->post = $_POST; | |
| 25 | + if (!empty($_POST)) { | |
| 26 | + $this->post = $_POST; | |
| 27 | + } | |
| 26 | 28 | } |
| 27 | 29 | |
| 28 | 30 | /** |
| 29 | 31 | * Get value from $_POST |
| @@ -39,9 +41,8 @@ | ||
| 39 | 41 | } else { |
| 40 | 42 | return array(); |
| 41 | 43 | } |
| 42 | 44 | } else { |
| 43 | - | |
| 44 | 45 | if (isset($this->post[$key])) { |
| 45 | 46 | return $this->post[$key]; |
| 46 | 47 | } else { |
| 47 | 48 | return null; |
| @@ -46,7 +47,17 @@ | ||
| 46 | 47 | } else { |
| 47 | 48 | return null; |
| 48 | 49 | } |
| 49 | 50 | } |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Set option by Key | |
| 55 | + * | |
| 56 | + * @param string $key - Key of option | |
| 57 | + * @param mixed $value - Value of option | |
| 58 | + */ | |
| 59 | + public function set($key, $value) { | |
| 60 | + $this->post[$key] = $value; | |
| 50 | 61 | } |
| 51 | 62 | |
| 52 | 63 | } |