PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.32.23
E2Pdf – Export Pdf Tool for WordPress v1.32.23
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 1.08.06 All 72 releases
e2pdf / classes / model / e2pdf-rpc.php

e2pdf-rpc.php in E2Pdf – Export Pdf Tool for WordPress 1.32.23, at classes/model/e2pdf-rpc.php

59 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * File: /model/e2pdf-rpc.php
5 *
6 * @package E2Pdf
7 * @license GPLv3
8 * @link https://e2pdf.com
9 */
10 if (!defined('ABSPATH')) {
11 die('Access denied.');
12 }
13
14 class Model_E2pdf_Rpc extends Model_E2pdf_Model {
15
16 protected $options = array(
17 'get' => array(),
18 );
19
20 public function __construct($url) {
21 parent::__construct();
22 $request_url = explode('/e2pdf-rpc/', $url);
23 if (isset($request_url[1])) {
24 list( $version, $method, $action ) = array_pad(explode('/', wp_parse_url($request_url[1], PHP_URL_PATH)), 3, '');
25 $this->set('version', $version);
26 $this->set('method', $method);
27 $this->set('action', $action);
28 $this->set('get', wp_parse_args(wp_parse_url($request_url[1], PHP_URL_QUERY)));
29 }
30 }
31
32 public function get($key) {
33 if (isset($this->options[$key])) {
34 $value = $this->options[$key];
35 if ($key == 'version' && !in_array($value, array('v1'), true)) {
36 $value = 'v1';
37 }
38 } else {
39 switch ($key) {
40 case 'version':
41 $value = 'v1';
42 break;
43 default:
44 $value = '';
45 break;
46 }
47 }
48 return $value;
49 }
50
51 public function get_arg($key) {
52 return isset($this->options['get'][$key]) ? sanitize_text_field(wp_unslash($this->options['get'][$key])) : '';
53 }
54
55 public function set($key, $value) {
56 $this->options[$key] = $value;
57 }
58 }
59