PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.32.49
E2Pdf – Export Pdf Tool for WordPress v1.32.49
1.32.51 1.32.49 1.32.48 1.32.43 1.32.40 1.32.34 1.32.32 1.32.31 1.32.26 1.32.22 1.32.23 1.32.18 1.32.17 1.32.15 trunk 1.00.00 1.00.13 1.01.01 1.02.02 1.03.07 1.04.07 1.05.03 1.06.02 1.07.11 1.08.00 All 73 releases
← All changes | classes/helper/e2pdf-get.php +19 -42 1.00.131.32.49 View file →
@@ -1,14 +1,12 @@
1 1 <?php
2 2
3 3 /**
4 - * E2pdf Get Helper
5 - *
6 - * @copyright Copyright 2017 https://e2pdf.com
7 - * @license GPL v2
8 - * @version 1
9 - * @link https://e2pdf.com
10 - * @since 0.00.01
4 + * File: /helper/e2pdf-get.php
5 + *
6 + * @package E2Pdf
7 + * @license GPLv3
8 + * @link https://e2pdf.com
11 9 */
12 10 if (!defined('ABSPATH')) {
13 11 die('Access denied.');
14 12 }
@@ -14,53 +12,32 @@
14 12 }
15 13
16 14 class Helper_E2pdf_Get {
17 15
18 - private $get = array();
19 - private $page = null;
16 + private $get = [];
17 + private $page;
20 18
21 - /**
22 - * On init
23 - * Assign $_GET params to $get
24 - *
25 - * @param string $url - Current url
26 - */
19 + // construct
27 20 public function __construct($url) {
28 - $this->get = wp_parse_args($url);
29 - $this->page = reset($this->get);
30 - array_shift($this->get);
21 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended
22 + $args = array_merge(wp_parse_args($url), $_GET);
23 + if (isset($args['page'])) {
24 + $this->page = $args['page'];
25 + unset($args['page']);
26 + }
27 + $this->get = $args;
31 28 }
32 29
33 - /**
34 - * Get value from $_GET
35 - *
36 - * @param string $key - Array key
37 - *
38 - * @return mixed - Return value by get key
39 - */
30 + // get
40 31 public function get($key = false) {
41 -
42 32 if (!$key) {
43 - if (!empty($this->get)) {
44 - return $this->get;
45 - } else {
46 - return array();
47 - }
33 + return !empty($this->get) ? $this->get : [];
48 34 } else {
49 - if (isset($this->get[$key])) {
50 - return $this->get[$key];
51 - } else {
52 - return null;
53 - }
35 + return isset($this->get[$key]) ? $this->get[$key] : null;
54 36 }
55 37 }
56 38
57 - /**
58 - * Get current page
59 - *
60 - * @return string - Current page
61 - */
39 + // get page
62 40 public function get_page() {
63 41 return $this->page;
64 42 }
65 -
66 43 }