Skip to content

Commit ecbf901

Browse files
authored
Merge pull request #12 from mawint/unserializeInHelper
Solves the notice in Magento 2 system log for Settings helper.
2 parents d266326 + 78ece33 commit ecbf901

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

Helper/Settings.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22
/**
33
* This module makes it possible to upload different filetypes inside the WYSIWYG-editor. Extra filetypes are Word (doc, docm, docx), Excel (csv, xml, xls, xlsx), PDF (pdf), Compressed Folder (zip, tar)
4-
* Copyright (C) 2016
5-
*
4+
* Copyright (C) 2016
5+
*
66
* This file included in Experius/WysiwygDownloads is licensed under OSL 3.0
7-
*
7+
*
88
* http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
99
* Please see LICENSE.txt for the full text of the OSL 3.0 license
1010
*/
11-
11+
1212
namespace Experius\WysiwygDownloads\Helper;
1313

1414
use Magento\Framework\App\Helper\Context;
@@ -20,19 +20,19 @@ class Settings extends \Magento\Framework\App\Helper\AbstractHelper
2020
{
2121

2222
const CONFIG_PATH_FILETYPES = 'wysiwyg/filetypes';
23-
23+
2424
public $configPathModule = 'cms';
25-
25+
2626
protected $_storeManager;
27-
27+
2828
/**
2929
* Currently selected store ID if applicable
3030
*
3131
* @var int
3232
*/
3333
protected $_storeId;
34-
35-
34+
35+
3636
public function __construct(
3737
Context $context,
3838
\Magento\Store\Model\StoreManagerInterface $storeManager
@@ -41,7 +41,7 @@ public function __construct(
4141
$this->_storeManager = $storeManager;
4242
parent::__construct($context);
4343
}
44-
44+
4545
/**
4646
* Set a specified store ID value
4747
*
@@ -55,7 +55,7 @@ public function getStoreId()
5555
}
5656
return $this->_storeId;
5757
}
58-
58+
5959
/**
6060
* Set a specified store ID value
6161
*
@@ -67,7 +67,7 @@ public function setStoreId($store)
6767
$this->_storeId = $store;
6868
return $this;
6969
}
70-
70+
7171
public function getConfigValue($path)
7272
{
7373
if (substr_count($path, '/') < 2){
@@ -79,18 +79,18 @@ public function getConfigValue($path)
7979
$this->getStoreId()
8080
);
8181
}
82-
82+
8383
public function getExtraFiletypes()
8484
{
85-
$filetypes = array();
86-
$settings = unserialize($this->getConfigValue(self::CONFIG_PATH_FILETYPES));
87-
if ($settings) {
88-
foreach($settings as $setting){
89-
$filetypes[] = $setting['extension'];
90-
}
91-
}
92-
$defaultFiletypes = array('doc','docm','docx','csv','xml','xls','xlsx','pdf','zip','tar');
93-
return array_merge($filetypes,$defaultFiletypes);
85+
$filetypes = array();
86+
$settings = json_decode($this->getConfigValue(self::CONFIG_PATH_FILETYPES));
87+
if ($settings) {
88+
foreach($settings as $setting){
89+
$filetypes[] = $setting->extension;
90+
}
91+
}
92+
$defaultFiletypes = array('doc','docm','docx','csv','xml','xls','xlsx','pdf','zip','tar');
93+
return array_merge($filetypes,$defaultFiletypes);
9494
}
95-
96-
}
95+
96+
}

0 commit comments

Comments
 (0)