PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / trunk
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets vtrunk
3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / classes / config.php
wp-all-import / classes Last commit date
XmlStreamReader 3 weeks ago partner-discount-sdk 3 weeks ago api.php 3 weeks ago arraytoxml.php 3 weeks ago chunk.php 3 weeks ago config.php 2 years ago download.php 3 weeks ago error.php 3 weeks ago handler.php 3 weeks ago helper.php 3 weeks ago input.php 3 weeks ago nested.php 3 weeks ago rapidaddon.php 3 weeks ago render.php 3 weeks ago session.php 9 months ago upload.php 3 weeks ago zip.php 10 years ago
config.php
90 lines
1 <?php
2 /**
3 * Class to load config files
4 *
5 * @author Maksym Tsypliakov <maksym.tsypliakov@gmail.com>
6 */
7 class PMXI_Config implements IteratorAggregate {
8 /**
9 * Config variables stored
10 * @var array
11 */
12 protected $config = array();
13 /**
14 * List of loaded files in order to avoid loading same file several times
15 * @var array
16 */
17 protected $loaded = array();
18
19 /**
20 * Static method to create config instance from file on disc
21 * @param string $filePath
22 * @param string[optional] $section
23 * @return PMXI_Config
24 */
25 public static function createFromFile($filePath, $section = NULL) {
26 $config = new self();
27 return $config->loadFromFile($filePath, $section);
28 }
29
30 /**
31 * Load config file
32 * @param string $filePath
33 * @param string[optional] $section
34 * @return PMXI_Config
35 */
36 public function loadFromFile($filePath, $section = NULL) {
37 if ( ! is_null($section)) {
38 $this->config[$section] = self::createFromFile($filePath);
39 } else {
40 $filePath = realpath($filePath);
41 if ($filePath and ! in_array($filePath, $this->loaded)) {
42 require $filePath;
43 $config = (!isset($config)) ? array() : $config;
44 $this->loaded[] = $filePath;
45 $this->config = array_merge($this->config, $config);
46 }
47 }
48 return $this;
49 }
50 /**
51 * Return value of setting with specified name
52 * @param string $field Setting name
53 * @param string[optional] $section Section name to look setting in
54 * @return mixed
55 */
56 public function get($field, $section = NULL) {
57 return ! is_null($section) ? $this->config[$section]->get($field) : $this->config[$field];
58 }
59
60 /**
61 * Magic method for checking whether some config option are set
62 * @param string $field
63 * @return bool
64 */
65 public function __isset($field) {
66 return isset($this->config[$field]);
67 }
68 /**
69 * Magic method to implement object-like access to config parameters
70 * @param string $field
71 * @return mixed
72 */
73 public function __get($field) {
74 return $this->config[$field];
75 }
76
77 /**
78 * Return all config options as array
79 * @return array
80 */
81 public function toArray($section = NULL) {
82 return ! is_null($section) ? $this->config[$section]->toArray() : $this->config;
83 }
84
85 #[\ReturnTypeWillChange]
86 public function getIterator() {
87 return new ArrayIterator($this->config);
88 }
89
90 }