ast
1 month ago
XmlImportConfig.php
1 month ago
XmlImportCsvParse.php
1 month ago
XmlImportException.php
1 month ago
XmlImportParser.php
1 month ago
XmlImportReaderInterface.php
1 month ago
XmlImportSQLParse.php
1 month ago
XmlImportStringReader.php
1 month ago
XmlImportTemplate.php
1 month ago
XmlImportTemplateCodeGenerator.php
1 month ago
XmlImportTemplateParser.php
1 month ago
XmlImportTemplateScanner.php
4 days ago
XmlImportToken.php
1 month ago
XmlImportXLSParse.php
1 month ago
wpaipclzip.lib.php
1 month ago
XmlImportConfig.php
89 lines
| 1 | <?php |
| 2 | // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals |
| 3 | /** |
| 4 | * @author Olexandr Zanichkovsky <olexandr.zanichkovsky@zophiatech.com> |
| 5 | * @author Pavel Kulbakin <p.kulbakin@gmail.com> |
| 6 | * @package General |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * This class is used for different XmlImport settings |
| 11 | */ |
| 12 | if (!class_exists('XmlImportConfig')) |
| 13 | { |
| 14 | final class XmlImportConfig |
| 15 | { |
| 16 | /** |
| 17 | * Singleton instance |
| 18 | * @var XmlImportConfig |
| 19 | */ |
| 20 | private static $instance = null; |
| 21 | /** |
| 22 | * Path to cache directory |
| 23 | * @var string |
| 24 | */ |
| 25 | private $cache_dir; |
| 26 | /** |
| 27 | * String to use when concatenating result of xpath corresponding to multiple elements |
| 28 | * @var string |
| 29 | */ |
| 30 | private $multi_glue; |
| 31 | |
| 32 | /** |
| 33 | * Initial settings |
| 34 | */ |
| 35 | private function init() |
| 36 | { |
| 37 | $this->setCacheDirectory(dirname(__FILE__) . '/cache'); |
| 38 | $this->setMultiGlue( apply_filters('wp_all_import_multi_glue', ', ') ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Gets instance of a singleton class |
| 43 | * @return XmlImportConfig |
| 44 | */ |
| 45 | public static function getInstance() |
| 46 | { |
| 47 | //if (is_null(self::$instance)) { |
| 48 | self::$instance = new self; |
| 49 | self::$instance->init(); |
| 50 | //} |
| 51 | return self::$instance; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Returns path to cache directory |
| 56 | * @return string |
| 57 | */ |
| 58 | public function getCacheDirectory() |
| 59 | { |
| 60 | return $this->cache_dir; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Sets path to cache directory |
| 65 | * @param string $cacheDirectoryPath |
| 66 | */ |
| 67 | public function setCacheDirectory($cacheDirectoryPath) |
| 68 | { |
| 69 | $this->cache_dir = $cacheDirectoryPath; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Returns string glue to use when concatenating multiple elements |
| 74 | * @return string |
| 75 | */ |
| 76 | public function getMultiGlue() |
| 77 | { |
| 78 | return $this->multi_glue; |
| 79 | } |
| 80 | /** |
| 81 | * Sets string glue to use when concatenating multiple element |
| 82 | * @param unknown_type $glue |
| 83 | */ |
| 84 | public function setMultiGlue($glue) |
| 85 | { |
| 86 | $this->multi_glue = $glue; |
| 87 | } |
| 88 | } |
| 89 | } |