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 / helper / e2pdf-server.php

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

97 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * E2Pdf Server Helper
5 * @copyright Copyright 2017 https://e2pdf.com
6 * @license GPLv3
7 * @version 1
8 * @link https://e2pdf.com
9 * @since 1.26.19
10 */
11 if (!defined('ABSPATH')) {
12 die('Access denied.');
13 }
14
15 class Helper_E2pdf_Server {
16
17 public function get($key = false) {
18 if ($key) {
19 return isset($_SERVER[$key]) ? wp_strip_all_tags(wp_unslash($_SERVER[$key])) : '';
20 }
21 return '';
22 }
23
24 public function isMobile() {
25 $userAgent = $this->get('HTTP_USER_AGENT');
26 if (stripos($userAgent, 'Mobile') !== false || stripos($userAgent, 'Android') !== false) {
27 return true;
28 }
29 return false;
30 }
31
32 public function isIOS() {
33 $userAgent = $this->get('HTTP_USER_AGENT');
34 if (stripos($userAgent, 'iPhone') !== false || stripos($userAgent, 'iPad') !== false || stripos($userAgent, 'iPod') !== false) {
35 return true;
36 }
37 return false;
38 }
39
40 public function isSafari() {
41 $userAgent = $this->get('HTTP_USER_AGENT');
42 if (stripos($userAgent, 'AppleWebKit') !== false && stripos($userAgent, 'Safari') !== false && stripos($userAgent, 'CriOS') === false) {
43 return true;
44 }
45 return false;
46 }
47
48 public function isChrome() {
49 $userAgent = $this->get('HTTP_USER_AGENT');
50 if (stripos($userAgent, 'CriOS') !== false || stripos($userAgent, 'Chrome') !== false) {
51 return true;
52 }
53 return false;
54 }
55
56 public function isOpera() {
57 $userAgent = $this->get('HTTP_USER_AGENT');
58 if (stripos($userAgent, 'OPR') !== false || stripos($userAgent, 'OPT') !== false) {
59 return true;
60 }
61 return false;
62 }
63
64 public function isFirefox() {
65 $userAgent = $this->get('HTTP_USER_AGENT');
66 if (stripos($userAgent, 'FxiOS') !== false || stripos($userAgent, 'Firefox') !== false) {
67 return true;
68 }
69 return false;
70 }
71
72 public function isLoaderSupported() {
73 if ($this->isIOS() && $this->isFirefox()) {
74 return false;
75 } elseif ($this->isMobile() && $this->isOpera()) {
76 return false;
77 }
78 return true;
79 }
80
81 public function isPrintingSupported() {
82 if ($this->isMobile() || $this->isIOS()) {
83 return false;
84 }
85 return true;
86 }
87
88 public function isViewerSupported() {
89 if ($this->isMobile() && $this->isChrome()) {
90 return false;
91 } elseif ($this->isIOS() && $this->isChrome()) {
92 return false;
93 }
94 return true;
95 }
96 }
97