PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.15
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.15
6.2.15 6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 All 197 releases
fluentform / vendor / openspout / openspout / src / Reader / ODS / Helper / SettingsHelper.php

SettingsHelper.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.15, at vendor/openspout/openspout/src/Reader/ODS/Helper/SettingsHelper.php

62 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace OpenSpout\Reader\ODS\Helper;
4
5 use OpenSpout\Reader\Exception\XMLProcessingException;
6 use OpenSpout\Reader\ODS\Creator\InternalEntityFactory;
7
8 /**
9 * This class provides helper functions to extract data from the "settings.xml" file.
10 */
11 class SettingsHelper
12 {
13 public const SETTINGS_XML_FILE_PATH = 'settings.xml';
14
15 /** Definition of XML nodes name and attribute used to parse settings data */
16 public const XML_NODE_CONFIG_ITEM = 'config:config-item';
17 public const XML_ATTRIBUTE_CONFIG_NAME = 'config:name';
18 public const XML_ATTRIBUTE_VALUE_ACTIVE_TABLE = 'ActiveTable';
19
20 /** @var InternalEntityFactory Factory to create entities */
21 private $entityFactory;
22
23 /**
24 * @param InternalEntityFactory $entityFactory Factory to create entities
25 */
26 public function __construct($entityFactory)
27 {
28 $this->entityFactory = $entityFactory;
29 }
30
31 /**
32 * @param string $filePath Path of the file to be read
33 *
34 * @return null|string Name of the sheet that was defined as active or NULL if none found
35 */
36 public function getActiveSheetName($filePath)
37 {
38 $xmlReader = $this->entityFactory->createXMLReader();
39 if (false === $xmlReader->openFileInZip($filePath, self::SETTINGS_XML_FILE_PATH)) {
40 return null;
41 }
42
43 $activeSheetName = null;
44
45 try {
46 while ($xmlReader->readUntilNodeFound(self::XML_NODE_CONFIG_ITEM)) {
47 if (self::XML_ATTRIBUTE_VALUE_ACTIVE_TABLE === $xmlReader->getAttribute(self::XML_ATTRIBUTE_CONFIG_NAME)) {
48 $activeSheetName = $xmlReader->readString();
49
50 break;
51 }
52 }
53 } catch (XMLProcessingException $exception) {
54 // do nothing
55 }
56
57 $xmlReader->close();
58
59 return $activeSheetName;
60 }
61 }
62