PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.01.01
E2Pdf – Export Pdf Tool for WordPress v1.01.01
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-extension.php

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

220 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * E2pdf Extension Model
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
11 */
12 if (!defined('ABSPATH')) {
13 die('Access denied.');
14 }
15
16 class Model_E2pdf_Extension extends Model_E2pdf_Model {
17
18 private $extension;
19
20 function __construct() {
21 parent::__construct();
22 }
23
24 public function load($name) {
25 $class = 'Extension_E2pdf_' . ucfirst($name);
26 if (class_exists($class)) {
27 $extension = new $class();
28 if ($extension->active()) {
29 $this->extension = $extension;
30 return true;
31 }
32 }
33 return false;
34 }
35
36 public function loaded($extension) {
37 if ($this->extension() && method_exists($this->extension(), 'info')) {
38 $info = $this->extension()->info();
39 if (isset($info[$extension])) {
40 return true;
41 }
42 }
43 return false;
44 }
45
46 public function extension() {
47 return $this->extension;
48 }
49
50 public function set($attr, $value) {
51 if (method_exists($this->extension(), 'set')) {
52 return $this->extension()->set($attr, $value);
53 }
54 return false;
55 }
56
57 public function get($attr) {
58 if (method_exists($this->extension(), 'get')) {
59 return $this->extension()->get($attr);
60 }
61 return false;
62 }
63
64 public function verify() {
65 if (method_exists($this->extension(), 'verify')) {
66 return $this->extension()->verify();
67 }
68 return false;
69 }
70
71 public function import() {
72 if (method_exists($this->extension(), 'import')) {
73 return $this->extension()->import();
74 }
75 return false;
76 }
77
78 public function export() {
79 if (method_exists($this->extension(), 'export')) {
80 return $this->extension()->export();
81 }
82 return false;
83 }
84
85 public function backup() {
86 if (method_exists($this->extension(), 'backup')) {
87 return $this->extension()->backup();
88 }
89 return false;
90 }
91
92 public function get_item($item_id = false) {
93 if (method_exists($this->extension(), 'get_item')) {
94 return $this->extension()->get_item($item_id);
95 }
96 return false;
97 }
98
99 public function get_items() {
100 if (method_exists($this->extension(), 'get_items')) {
101 return $this->extension()->get_items();
102 }
103 return false;
104 }
105
106 public function get_styles() {
107 if (method_exists($this->extension(), 'get_styles')) {
108 return $this->extension()->get_styles();
109 }
110 return false;
111 }
112
113 public function render($value, $type = false, $field = array()) {
114 if (method_exists($this->extension(), 'render')) {
115 return $this->extension()->render($value, $type, $field);
116 }
117 return false;
118 }
119
120 public function get_datasets($item = false, $name = false) {
121 if (method_exists($this->extension(), 'get_datasets')) {
122 return $this->extension()->get_datasets($item, $name);
123 }
124 return false;
125 }
126
127 public function get_dataset($dataset_id = false) {
128 if (method_exists($this->extension(), 'get_dataset')) {
129 return $this->extension()->get_dataset($dataset_id);
130 }
131 return false;
132 }
133
134 public function get_extensions_list() {
135 $list = array();
136 $extentions_path = $this->helper->get('plugin_dir') . 'classes/extension/*';
137 foreach (array_filter(glob($extentions_path), 'is_file') as $file) {
138 $info = pathinfo($file);
139 $file_name = basename($file, '.' . $info['extension']);
140 $file_name = substr($file_name, 6);
141
142 if ($this->load($file_name)) {
143 $list = array_merge($list, $this->extension->info());
144 }
145 }
146
147 return $list;
148 }
149
150 public function delete_item($template_id = false, $dataset_id = false) {
151 if (method_exists($this->extension(), 'delete_item')) {
152 return $this->extension()->delete_item($template_id, $dataset_id);
153 }
154 return false;
155 }
156
157 public function delete_items($template_id = false) {
158 if (method_exists($this->extension(), 'delete_items')) {
159 return $this->extension()->delete_items($template_id);
160 }
161 return false;
162 }
163
164 /**
165 * Visual Mapper for Mapping field
166 *
167 * @return bool|string - Prepared form or false
168 */
169 public function visual_mapper() {
170 if (method_exists($this->extension(), 'visual_mapper')) {
171 return $this->extension()->visual_mapper();
172 }
173 return false;
174 }
175
176 /**
177 * Convert Field name to Value
178 * @since 0.01.34
179 *
180 * @param string $name - Field name
181 *
182 * @return bool|string - Converted value or false
183 */
184 public function auto_map($name = false) {
185 if (method_exists($this->extension(), 'auto_map') && $name) {
186 return $this->extension()->auto_map($name);
187 }
188 return false;
189 }
190
191 public function auto() {
192 if (method_exists($this->extension(), 'auto')) {
193 return $this->extension()->auto();
194 }
195 return false;
196 }
197
198 public function load_actions() {
199 if (method_exists($this->extension(), 'load_actions')) {
200 return $this->extension()->load_actions();
201 }
202 return false;
203 }
204
205 public function load_filters() {
206 if (method_exists($this->extension(), 'load_filters')) {
207 return $this->extension()->load_filters();
208 }
209 return false;
210 }
211
212 public function load_shortcodes() {
213 if (method_exists($this->extension(), 'load_shortcodes')) {
214 return $this->extension()->load_shortcodes();
215 }
216 return false;
217 }
218
219 }
220