PluginProbe
Import WP – CSV & XML Import Export for WordPress / trunk
Import WP – CSV & XML Import Export for WordPress vtrunk
2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 trunk 0.1.6 All 142 releases
jc-importer / class / Common / Addon / AddonBaseData.php

AddonBaseData.php in Import WP – CSV & XML Import Export for WordPress trunk, at class/Common/Addon/AddonBaseData.php

69 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImportWP\Common\Addon;
4
5 /**
6 * @deprecated 2.14.0
7 */
8 class AddonBaseData
9 {
10 /**
11 * @var callable
12 */
13 protected $_run_conditions;
14
15 protected $_data;
16
17 /**
18 * @var AddonBase
19 */
20 protected $_addon;
21
22 public function __construct($addon, $data)
23 {
24 $this->_data = $data;
25 $this->_addon = $addon;
26 }
27
28 public function addon()
29 {
30 return $this->_addon;
31 }
32
33 public function data($key = false)
34 {
35 if ($key) {
36 return isset($this->_data[$key]) ? $this->_data[$key] : false;
37 }
38
39 return $this->_data;
40 }
41
42 /**
43 * When should the addon run?
44 *
45 * @param callable $callback
46 */
47 public function enabled($callback)
48 {
49 $this->_run_conditions = $callback;
50 return $this;
51 }
52
53 /**
54 * Is field allowed to be output?
55 *
56 * @param \ImportWP\Common\Importer\Template\Template $template
57 * @param \ImportWP\Common\Model\ImporterModel $importer_model
58 * @return bool
59 */
60 public function _is_allowed($template, $importer_model)
61 {
62 if (!is_null($this->_run_conditions) && is_callable($this->_run_conditions) && !call_user_func_array($this->_run_conditions, [$template, $importer_model])) {
63 return false;
64 }
65
66 return true;
67 }
68 }
69