PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.1.5
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.1.5
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / classes / config.php
wp-all-export / classes Last commit date
CdataStrategy.php 8 years ago CdataStrategyAlways.php 8 years ago CdataStrategyFactory.php 8 years ago CdataStrategyIllegalCharacters.php 8 years ago CdataStrategyIllegalCharactersHtmlEntities.php 8 years ago CdataStrategyNever.php 8 years ago XMLWriter.php 8 years ago chunk.php 8 years ago config.php 8 years ago download.php 8 years ago handler.php 8 years ago helper.php 8 years ago input.php 8 years ago installer.php 8 years ago session.php 8 years ago wpallimport.php 8 years ago zip.php 8 years ago
config.php
91 lines
1 <?php
2 /**
3 * Class to load config files
4 *
5 * @author Pavel Kulbakin <p.kulbakin@gmail.com>
6 */
7 class PMXE_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 PMXE_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 PMXE_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
44 $sandbox = create_function('', "require '$filePath'; if(array_keys(get_defined_vars()) != array('config')) return array(); return \$config;");
45 $config = $sandbox();
46 $this->loaded[] = $filePath;
47 $this->config = array_merge($this->config, $config);
48 }
49 }
50 return $this;
51 }
52 /**
53 * Return value of setting with specified name
54 * @param string $field Setting name
55 * @param string[optional] $section Section name to look setting in
56 * @return mixed
57 */
58 public function get($field, $section = NULL) {
59 return ! is_null($section) ? $this->config[$section]->get($field) : $this->config[$field];
60 }
61
62 /**
63 * Magic method for checking whether some config option are set
64 * @param string $field
65 * @return bool
66 */
67 public function __isset($field) {
68 return isset($this->config[$field]);
69 }
70 /**
71 * Magic method to implement object-like access to config parameters
72 * @param string $field
73 * @return mixed
74 */
75 public function __get($field) {
76 return $this->config[$field];
77 }
78
79 /**
80 * Return all config options as array
81 * @return array
82 */
83 public function toArray($section = NULL) {
84 return ! is_null($section) ? $this->config[$section]->toArray() : $this->config;
85 }
86
87 public function getIterator() {
88 return new ArrayIterator($this->config);
89 }
90
91 }