PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Settings.php

Settings.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.11.0, at vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php

170 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet;
4
5 use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
6 use PhpOffice\PhpSpreadsheet\Chart\Renderer\IRenderer;
7 use PhpOffice\PhpSpreadsheet\Collection\Memory;
8 use Psr\SimpleCache\CacheInterface;
9
10 class Settings
11 {
12 /**
13 * Class name of the chart renderer used for rendering charts
14 * eg: PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph.
15 *
16 * @var string
17 */
18 private static $chartRenderer;
19
20 /**
21 * Default options for libxml loader.
22 *
23 * @var int
24 */
25 private static $libXmlLoaderOptions = null;
26
27 /**
28 * Allow/disallow libxml_disable_entity_loader() call when not thread safe.
29 * Default behaviour is to do the check, but if you're running PHP versions
30 * 7.2 < 7.2.1
31 * 7.1 < 7.1.13
32 * 7.0 < 7.0.27
33 * 5.6 ANY
34 * then you may need to disable this check to prevent unwanted behaviour in other threads
35 * SECURITY WARNING: Changing this flag is not recommended.
36 *
37 * @var bool
38 */
39 private static $libXmlDisableEntityLoader = true;
40
41 /**
42 * The cache implementation to be used for cell collection.
43 *
44 * @var CacheInterface
45 */
46 private static $cache;
47
48 /**
49 * Set the locale code to use for formula translations and any special formatting.
50 *
51 * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
52 *
53 * @return bool Success or failure
54 */
55 public static function setLocale($locale)
56 {
57 return Calculation::getInstance()->setLocale($locale);
58 }
59
60 /**
61 * Identify to PhpSpreadsheet the external library to use for rendering charts.
62 *
63 * @param string $rendererClass Class name of the chart renderer
64 * eg: PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph
65 *
66 * @throws Exception
67 */
68 public static function setChartRenderer($rendererClass)
69 {
70 if (!is_a($rendererClass, IRenderer::class, true)) {
71 throw new Exception('Chart renderer must implement ' . IRenderer::class);
72 }
73
74 self::$chartRenderer = $rendererClass;
75 }
76
77 /**
78 * Return the Chart Rendering Library that PhpSpreadsheet is currently configured to use.
79 *
80 * @return null|string Class name of the chart renderer
81 * eg: PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph
82 */
83 public static function getChartRenderer()
84 {
85 return self::$chartRenderer;
86 }
87
88 /**
89 * Set default options for libxml loader.
90 *
91 * @param int $options Default options for libxml loader
92 */
93 public static function setLibXmlLoaderOptions($options)
94 {
95 if ($options === null && defined('LIBXML_DTDLOAD')) {
96 $options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
97 }
98 self::$libXmlLoaderOptions = $options;
99 }
100
101 /**
102 * Get default options for libxml loader.
103 * Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly.
104 *
105 * @return int Default options for libxml loader
106 */
107 public static function getLibXmlLoaderOptions()
108 {
109 if (self::$libXmlLoaderOptions === null && defined('LIBXML_DTDLOAD')) {
110 self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
111 } elseif (self::$libXmlLoaderOptions === null) {
112 self::$libXmlLoaderOptions = true;
113 }
114
115 return self::$libXmlLoaderOptions;
116 }
117
118 /**
119 * Enable/Disable the entity loader for libxml loader.
120 * Allow/disallow libxml_disable_entity_loader() call when not thread safe.
121 * Default behaviour is to do the check, but if you're running PHP versions
122 * 7.2 < 7.2.1
123 * 7.1 < 7.1.13
124 * 7.0 < 7.0.27
125 * 5.6 ANY
126 * then you may need to disable this check to prevent unwanted behaviour in other threads
127 * SECURITY WARNING: Changing this flag to false is not recommended.
128 *
129 * @param bool $state
130 */
131 public static function setLibXmlDisableEntityLoader($state)
132 {
133 self::$libXmlDisableEntityLoader = (bool) $state;
134 }
135
136 /**
137 * Return the state of the entity loader (disabled/enabled) for libxml loader.
138 *
139 * @return bool $state
140 */
141 public static function getLibXmlDisableEntityLoader()
142 {
143 return self::$libXmlDisableEntityLoader;
144 }
145
146 /**
147 * Sets the implementation of cache that should be used for cell collection.
148 *
149 * @param CacheInterface $cache
150 */
151 public static function setCache(CacheInterface $cache)
152 {
153 self::$cache = $cache;
154 }
155
156 /**
157 * Gets the implementation of cache that should be used for cell collection.
158 *
159 * @return CacheInterface
160 */
161 public static function getCache()
162 {
163 if (!self::$cache) {
164 self::$cache = new Memory();
165 }
166
167 return self::$cache;
168 }
169 }
170