PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.5
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.5
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 3.6.65 All 196 releases
fluentform / app / Services / Spout / Reader / ODS / Helper / SettingsHelper.php

SettingsHelper.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.5, at app/Services/Spout/Reader/ODS/Helper/SettingsHelper.php

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