@@ -14,30 +14,30 @@ |
||
| 14 | 14 | class CheckBoxRenderer extends ColumnRendererAbstract |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Configure the "Check Box" Grid Renderer. |
|
| 19 | - */ |
|
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - $configuration = array( |
|
| 23 | - 'width' => '5px', |
|
| 24 | - 'sortable' => false, |
|
| 25 | - 'canBeHidden' => false, |
|
| 26 | - 'html' => '<input type="checkbox" class="checkbox-row-top"/>', |
|
| 27 | - ); |
|
| 28 | - parent::__construct($configuration); |
|
| 29 | - } |
|
| 17 | + /** |
|
| 18 | + * Configure the "Check Box" Grid Renderer. |
|
| 19 | + */ |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + $configuration = array( |
|
| 23 | + 'width' => '5px', |
|
| 24 | + 'sortable' => false, |
|
| 25 | + 'canBeHidden' => false, |
|
| 26 | + 'html' => '<input type="checkbox" class="checkbox-row-top"/>', |
|
| 27 | + ); |
|
| 28 | + parent::__construct($configuration); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Render the "Check Box" in the Grid. |
|
| 33 | - * |
|
| 34 | - * @return string |
|
| 35 | - */ |
|
| 36 | - public function render() |
|
| 37 | - { |
|
| 38 | - return sprintf('<input type="checkbox" class="checkbox-row" data-index="%s" data-uid="%s"/>', |
|
| 39 | - $this->getRowIndex(), |
|
| 40 | - $this->getObject()->getUid() |
|
| 41 | - ); |
|
| 42 | - } |
|
| 31 | + /** |
|
| 32 | + * Render the "Check Box" in the Grid. |
|
| 33 | + * |
|
| 34 | + * @return string |
|
| 35 | + */ |
|
| 36 | + public function render() |
|
| 37 | + { |
|
| 38 | + return sprintf('<input type="checkbox" class="checkbox-row" data-index="%s" data-uid="%s"/>', |
|
| 39 | + $this->getRowIndex(), |
|
| 40 | + $this->getObject()->getUid() |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -16,42 +16,42 @@ |
||
| 16 | 16 | class ButtonGroupRenderer extends ColumnRendererAbstract |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Configure the "Button Group" Grid Renderer. |
|
| 21 | - */ |
|
| 22 | - public function __construct() |
|
| 23 | - { |
|
| 24 | - $configuration = array( |
|
| 25 | - 'sortable' => false, |
|
| 26 | - 'canBeHidden' => false, |
|
| 27 | - 'width' => '100px', |
|
| 28 | - ); |
|
| 29 | - parent::__construct($configuration); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Render the "Button Group" in the Grid, e.g. edit, delete, etc.. |
|
| 34 | - * |
|
| 35 | - * @return string |
|
| 36 | - */ |
|
| 37 | - public function render() |
|
| 38 | - { |
|
| 39 | - $components = $this->getModuleLoader()->getGridButtonsComponents(); |
|
| 40 | - |
|
| 41 | - $buttons = []; |
|
| 42 | - foreach ($components as $component) { |
|
| 43 | - |
|
| 44 | - /** @var $view */ |
|
| 45 | - $view = GeneralUtility::makeInstance($component); |
|
| 46 | - $buttons[] = $view->render($this->getObject()); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - $output = sprintf( |
|
| 50 | - '<div class="btn-toolbar pull-right" role="toolbar" aria-label=""><div class="btn-group" role="group" aria-label="">%s</div></div>', |
|
| 51 | - implode("\n", $buttons) |
|
| 52 | - ); |
|
| 53 | - |
|
| 54 | - return $output; |
|
| 55 | - } |
|
| 19 | + /** |
|
| 20 | + * Configure the "Button Group" Grid Renderer. |
|
| 21 | + */ |
|
| 22 | + public function __construct() |
|
| 23 | + { |
|
| 24 | + $configuration = array( |
|
| 25 | + 'sortable' => false, |
|
| 26 | + 'canBeHidden' => false, |
|
| 27 | + 'width' => '100px', |
|
| 28 | + ); |
|
| 29 | + parent::__construct($configuration); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Render the "Button Group" in the Grid, e.g. edit, delete, etc.. |
|
| 34 | + * |
|
| 35 | + * @return string |
|
| 36 | + */ |
|
| 37 | + public function render() |
|
| 38 | + { |
|
| 39 | + $components = $this->getModuleLoader()->getGridButtonsComponents(); |
|
| 40 | + |
|
| 41 | + $buttons = []; |
|
| 42 | + foreach ($components as $component) { |
|
| 43 | + |
|
| 44 | + /** @var $view */ |
|
| 45 | + $view = GeneralUtility::makeInstance($component); |
|
| 46 | + $buttons[] = $view->render($this->getObject()); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + $output = sprintf( |
|
| 50 | + '<div class="btn-toolbar pull-right" role="toolbar" aria-label=""><div class="btn-group" role="group" aria-label="">%s</div></div>', |
|
| 51 | + implode("\n", $buttons) |
|
| 52 | + ); |
|
| 53 | + |
|
| 54 | + return $output; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | } |
@@ -14,25 +14,25 @@ |
||
| 14 | 14 | class ConfigurablePart |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - const __default = ''; |
|
| 18 | - const EXCLUDED_FIELDS = 'excluded_fields'; |
|
| 19 | - const MENU_VISIBLE_ITEMS = 'menuVisibleItems'; |
|
| 20 | - const MENU_VISIBLE_ITEMS_DEFAULT = 'menuVisibleItemsDefault'; |
|
| 17 | + const __default = ''; |
|
| 18 | + const EXCLUDED_FIELDS = 'excluded_fields'; |
|
| 19 | + const MENU_VISIBLE_ITEMS = 'menuVisibleItems'; |
|
| 20 | + const MENU_VISIBLE_ITEMS_DEFAULT = 'menuVisibleItemsDefault'; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Get the valid values for this enum. |
|
| 24 | - * |
|
| 25 | - * @param boolean $include_default |
|
| 26 | - * @return array |
|
| 27 | - */ |
|
| 28 | - static public function getParts($include_default = false) |
|
| 29 | - { |
|
| 22 | + /** |
|
| 23 | + * Get the valid values for this enum. |
|
| 24 | + * |
|
| 25 | + * @param boolean $include_default |
|
| 26 | + * @return array |
|
| 27 | + */ |
|
| 28 | + static public function getParts($include_default = false) |
|
| 29 | + { |
|
| 30 | 30 | |
| 31 | - return array( |
|
| 32 | - 'EXCLUDED_FIELDS' => self::EXCLUDED_FIELDS, |
|
| 33 | - 'MENU_VISIBLE_ITEMS' => self::MENU_VISIBLE_ITEMS, |
|
| 34 | - 'MENU_VISIBLE_ITEMS_DEFAULT' => self::MENU_VISIBLE_ITEMS_DEFAULT, |
|
| 35 | - ); |
|
| 36 | - } |
|
| 31 | + return array( |
|
| 32 | + 'EXCLUDED_FIELDS' => self::EXCLUDED_FIELDS, |
|
| 33 | + 'MENU_VISIBLE_ITEMS' => self::MENU_VISIBLE_ITEMS, |
|
| 34 | + 'MENU_VISIBLE_ITEMS_DEFAULT' => self::MENU_VISIBLE_ITEMS_DEFAULT, |
|
| 35 | + ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | \ No newline at end of file |
@@ -15,27 +15,27 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class ConstraintContainer |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * @var ConstraintInterface |
|
| 20 | - */ |
|
| 21 | - protected $constraint; |
|
| 18 | + /** |
|
| 19 | + * @var ConstraintInterface |
|
| 20 | + */ |
|
| 21 | + protected $constraint; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @return ConstraintInterface |
|
| 25 | - */ |
|
| 26 | - public function getConstraint() |
|
| 27 | - { |
|
| 28 | - return $this->constraint; |
|
| 29 | - } |
|
| 23 | + /** |
|
| 24 | + * @return ConstraintInterface |
|
| 25 | + */ |
|
| 26 | + public function getConstraint() |
|
| 27 | + { |
|
| 28 | + return $this->constraint; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @param ConstraintInterface $constraint |
|
| 33 | - * @return $this |
|
| 34 | - */ |
|
| 35 | - public function setConstraint($constraint) |
|
| 36 | - { |
|
| 37 | - $this->constraint = $constraint; |
|
| 38 | - return $this; |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * @param ConstraintInterface $constraint |
|
| 33 | + * @return $this |
|
| 34 | + */ |
|
| 35 | + public function setConstraint($constraint) |
|
| 36 | + { |
|
| 37 | + $this->constraint = $constraint; |
|
| 38 | + return $this; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | } |
@@ -179,8 +179,8 @@ |
||
| 179 | 179 | $generalSettings = $this->getSettings(); |
| 180 | 180 | |
| 181 | 181 | $preferences = []; |
| 182 | - if (isset($generalSettings[$dataType . '.'])) { |
|
| 183 | - $settings = $generalSettings[$dataType . '.']; |
|
| 182 | + if (isset($generalSettings[$dataType.'.'])) { |
|
| 183 | + $settings = $generalSettings[$dataType.'.']; |
|
| 184 | 184 | |
| 185 | 185 | $configurableParts = ConfigurablePart::getParts(); |
| 186 | 186 | foreach ($settings as $key => $value) { |
@@ -18,220 +18,220 @@ |
||
| 18 | 18 | class ModulePreferences implements SingletonInterface |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var array |
|
| 23 | - */ |
|
| 24 | - protected $preferences; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - protected $tableName = 'tx_vidi_preference'; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @param string $key |
|
| 33 | - * @param string $dataType |
|
| 34 | - * @return mixed |
|
| 35 | - */ |
|
| 36 | - public function get($key, $dataType = '') |
|
| 37 | - { |
|
| 38 | - |
|
| 39 | - if (empty($dataType)) { |
|
| 40 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - if (!$this->isLoaded($dataType)) { |
|
| 44 | - $this->load($dataType); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - $value = empty($this->preferences[$dataType][$key]) ? null : $this->preferences[$dataType][$key]; |
|
| 48 | - return $value; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Tell whether the module is loaded. |
|
| 53 | - * |
|
| 54 | - * @param string $dataType |
|
| 55 | - * @return bool |
|
| 56 | - */ |
|
| 57 | - public function isLoaded($dataType) |
|
| 58 | - { |
|
| 59 | - return !empty($this->preferences[$dataType]); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @param string $dataType |
|
| 64 | - * @return array |
|
| 65 | - */ |
|
| 66 | - public function getAll($dataType = '') |
|
| 67 | - { |
|
| 68 | - |
|
| 69 | - if (empty($dataType)) { |
|
| 70 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 71 | - } |
|
| 72 | - $this->load($dataType); |
|
| 73 | - return $this->preferences[$dataType]; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Get the md5 signature of the preferences. |
|
| 78 | - * |
|
| 79 | - * @param string $dataType |
|
| 80 | - * @return bool |
|
| 81 | - */ |
|
| 82 | - public function getSignature($dataType = '') |
|
| 83 | - { |
|
| 84 | - $preferences = $this->getAll($dataType); |
|
| 85 | - return md5(serialize($preferences)); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Load preferences. |
|
| 90 | - * |
|
| 91 | - * @param string $dataType |
|
| 92 | - * @return void |
|
| 93 | - */ |
|
| 94 | - public function load($dataType) |
|
| 95 | - { |
|
| 96 | - |
|
| 97 | - // Fetch preferences from different sources and overlay them |
|
| 98 | - $databasePreferences = $this->fetchPreferencesFromDatabase($dataType); |
|
| 99 | - $generalPreferences = $this->fetchGlobalPreferencesFromTypoScript(); |
|
| 100 | - $specificPreferences = $this->fetchExtraPreferencesFromTypoScript($dataType); |
|
| 101 | - |
|
| 102 | - $preferences = array_merge($generalPreferences, $specificPreferences, $databasePreferences); |
|
| 103 | - $this->preferences[$dataType] = $preferences; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Save preferences |
|
| 108 | - * |
|
| 109 | - * @param array $preferences |
|
| 110 | - * @return void |
|
| 111 | - */ |
|
| 112 | - public function save($preferences) |
|
| 113 | - { |
|
| 114 | - $configurableParts = ConfigurablePart::getParts(); |
|
| 115 | - |
|
| 116 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 117 | - $this->getDataService()->delete( |
|
| 118 | - $this->tableName, |
|
| 119 | - [ |
|
| 120 | - 'data_type' => $dataType |
|
| 121 | - ] |
|
| 122 | - ); |
|
| 123 | - |
|
| 124 | - $sanitizedPreferences = []; |
|
| 125 | - foreach ($preferences as $key => $value) { |
|
| 126 | - if (in_array($key, $configurableParts)) { |
|
| 127 | - $sanitizedPreferences[$key] = $value; |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $this->getDataService()->insert( |
|
| 132 | - $this->tableName, |
|
| 133 | - [ |
|
| 134 | - 'data_type' => $dataType, |
|
| 135 | - 'preferences' => serialize($sanitizedPreferences), |
|
| 136 | - ] |
|
| 137 | - ); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * @param $dataType |
|
| 142 | - * @return array |
|
| 143 | - */ |
|
| 144 | - public function fetchPreferencesFromDatabase($dataType) |
|
| 145 | - { |
|
| 146 | - $preferences = []; |
|
| 147 | - $record = $this->getDataService()->getRecord( |
|
| 148 | - $this->tableName, |
|
| 149 | - [ |
|
| 150 | - 'data_type' => $dataType |
|
| 151 | - ] |
|
| 152 | - ); |
|
| 153 | - |
|
| 154 | - if (!empty($record)) { |
|
| 155 | - $preferences = unserialize($record['preferences']); |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - return $preferences; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Returns the module settings. |
|
| 163 | - * |
|
| 164 | - * @return array |
|
| 165 | - */ |
|
| 166 | - protected function fetchGlobalPreferencesFromTypoScript() |
|
| 167 | - { |
|
| 168 | - $settings = $this->getSettings(); |
|
| 169 | - |
|
| 170 | - $configurableParts = ConfigurablePart::getParts(); |
|
| 171 | - $preferences = []; |
|
| 172 | - foreach ($settings as $key => $value) { |
|
| 173 | - if (in_array($key, $configurableParts)) { |
|
| 174 | - $preferences[$key] = $value; |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - return $preferences; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Returns the module settings. |
|
| 183 | - * |
|
| 184 | - * @param string $dataType |
|
| 185 | - * @return array |
|
| 186 | - */ |
|
| 187 | - protected function fetchExtraPreferencesFromTypoScript($dataType) |
|
| 188 | - { |
|
| 189 | - $generalSettings = $this->getSettings(); |
|
| 190 | - |
|
| 191 | - $preferences = []; |
|
| 192 | - if (isset($generalSettings[$dataType . '.'])) { |
|
| 193 | - $settings = $generalSettings[$dataType . '.']; |
|
| 194 | - |
|
| 195 | - $configurableParts = ConfigurablePart::getParts(); |
|
| 196 | - foreach ($settings as $key => $value) { |
|
| 197 | - if (in_array($key, $configurableParts)) { |
|
| 198 | - $preferences[$key] = $value; |
|
| 199 | - } |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - return $preferences; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Returns the module settings. |
|
| 208 | - * |
|
| 209 | - * @return array |
|
| 210 | - */ |
|
| 211 | - protected function getSettings() |
|
| 212 | - { |
|
| 213 | - /** @var BackendConfigurationManager $backendConfigurationManager */ |
|
| 214 | - $backendConfigurationManager = GeneralUtility::makeInstance(BackendConfigurationManager::class); |
|
| 215 | - $configuration = $backendConfigurationManager->getTypoScriptSetup(); |
|
| 216 | - return $configuration['module.']['tx_vidi.']['settings.']; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * @return object|DataService |
|
| 221 | - */ |
|
| 222 | - protected function getDataService(): DataService |
|
| 223 | - { |
|
| 224 | - return GeneralUtility::makeInstance(DataService::class); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * Get the Vidi Module Loader. |
|
| 229 | - * |
|
| 230 | - * @return ModuleLoader|object |
|
| 231 | - */ |
|
| 232 | - protected function getModuleLoader() |
|
| 233 | - { |
|
| 234 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 235 | - } |
|
| 21 | + /** |
|
| 22 | + * @var array |
|
| 23 | + */ |
|
| 24 | + protected $preferences; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + protected $tableName = 'tx_vidi_preference'; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @param string $key |
|
| 33 | + * @param string $dataType |
|
| 34 | + * @return mixed |
|
| 35 | + */ |
|
| 36 | + public function get($key, $dataType = '') |
|
| 37 | + { |
|
| 38 | + |
|
| 39 | + if (empty($dataType)) { |
|
| 40 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + if (!$this->isLoaded($dataType)) { |
|
| 44 | + $this->load($dataType); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + $value = empty($this->preferences[$dataType][$key]) ? null : $this->preferences[$dataType][$key]; |
|
| 48 | + return $value; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * Tell whether the module is loaded. |
|
| 53 | + * |
|
| 54 | + * @param string $dataType |
|
| 55 | + * @return bool |
|
| 56 | + */ |
|
| 57 | + public function isLoaded($dataType) |
|
| 58 | + { |
|
| 59 | + return !empty($this->preferences[$dataType]); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @param string $dataType |
|
| 64 | + * @return array |
|
| 65 | + */ |
|
| 66 | + public function getAll($dataType = '') |
|
| 67 | + { |
|
| 68 | + |
|
| 69 | + if (empty($dataType)) { |
|
| 70 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 71 | + } |
|
| 72 | + $this->load($dataType); |
|
| 73 | + return $this->preferences[$dataType]; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Get the md5 signature of the preferences. |
|
| 78 | + * |
|
| 79 | + * @param string $dataType |
|
| 80 | + * @return bool |
|
| 81 | + */ |
|
| 82 | + public function getSignature($dataType = '') |
|
| 83 | + { |
|
| 84 | + $preferences = $this->getAll($dataType); |
|
| 85 | + return md5(serialize($preferences)); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Load preferences. |
|
| 90 | + * |
|
| 91 | + * @param string $dataType |
|
| 92 | + * @return void |
|
| 93 | + */ |
|
| 94 | + public function load($dataType) |
|
| 95 | + { |
|
| 96 | + |
|
| 97 | + // Fetch preferences from different sources and overlay them |
|
| 98 | + $databasePreferences = $this->fetchPreferencesFromDatabase($dataType); |
|
| 99 | + $generalPreferences = $this->fetchGlobalPreferencesFromTypoScript(); |
|
| 100 | + $specificPreferences = $this->fetchExtraPreferencesFromTypoScript($dataType); |
|
| 101 | + |
|
| 102 | + $preferences = array_merge($generalPreferences, $specificPreferences, $databasePreferences); |
|
| 103 | + $this->preferences[$dataType] = $preferences; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Save preferences |
|
| 108 | + * |
|
| 109 | + * @param array $preferences |
|
| 110 | + * @return void |
|
| 111 | + */ |
|
| 112 | + public function save($preferences) |
|
| 113 | + { |
|
| 114 | + $configurableParts = ConfigurablePart::getParts(); |
|
| 115 | + |
|
| 116 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 117 | + $this->getDataService()->delete( |
|
| 118 | + $this->tableName, |
|
| 119 | + [ |
|
| 120 | + 'data_type' => $dataType |
|
| 121 | + ] |
|
| 122 | + ); |
|
| 123 | + |
|
| 124 | + $sanitizedPreferences = []; |
|
| 125 | + foreach ($preferences as $key => $value) { |
|
| 126 | + if (in_array($key, $configurableParts)) { |
|
| 127 | + $sanitizedPreferences[$key] = $value; |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $this->getDataService()->insert( |
|
| 132 | + $this->tableName, |
|
| 133 | + [ |
|
| 134 | + 'data_type' => $dataType, |
|
| 135 | + 'preferences' => serialize($sanitizedPreferences), |
|
| 136 | + ] |
|
| 137 | + ); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @param $dataType |
|
| 142 | + * @return array |
|
| 143 | + */ |
|
| 144 | + public function fetchPreferencesFromDatabase($dataType) |
|
| 145 | + { |
|
| 146 | + $preferences = []; |
|
| 147 | + $record = $this->getDataService()->getRecord( |
|
| 148 | + $this->tableName, |
|
| 149 | + [ |
|
| 150 | + 'data_type' => $dataType |
|
| 151 | + ] |
|
| 152 | + ); |
|
| 153 | + |
|
| 154 | + if (!empty($record)) { |
|
| 155 | + $preferences = unserialize($record['preferences']); |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + return $preferences; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Returns the module settings. |
|
| 163 | + * |
|
| 164 | + * @return array |
|
| 165 | + */ |
|
| 166 | + protected function fetchGlobalPreferencesFromTypoScript() |
|
| 167 | + { |
|
| 168 | + $settings = $this->getSettings(); |
|
| 169 | + |
|
| 170 | + $configurableParts = ConfigurablePart::getParts(); |
|
| 171 | + $preferences = []; |
|
| 172 | + foreach ($settings as $key => $value) { |
|
| 173 | + if (in_array($key, $configurableParts)) { |
|
| 174 | + $preferences[$key] = $value; |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + return $preferences; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Returns the module settings. |
|
| 183 | + * |
|
| 184 | + * @param string $dataType |
|
| 185 | + * @return array |
|
| 186 | + */ |
|
| 187 | + protected function fetchExtraPreferencesFromTypoScript($dataType) |
|
| 188 | + { |
|
| 189 | + $generalSettings = $this->getSettings(); |
|
| 190 | + |
|
| 191 | + $preferences = []; |
|
| 192 | + if (isset($generalSettings[$dataType . '.'])) { |
|
| 193 | + $settings = $generalSettings[$dataType . '.']; |
|
| 194 | + |
|
| 195 | + $configurableParts = ConfigurablePart::getParts(); |
|
| 196 | + foreach ($settings as $key => $value) { |
|
| 197 | + if (in_array($key, $configurableParts)) { |
|
| 198 | + $preferences[$key] = $value; |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + return $preferences; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Returns the module settings. |
|
| 208 | + * |
|
| 209 | + * @return array |
|
| 210 | + */ |
|
| 211 | + protected function getSettings() |
|
| 212 | + { |
|
| 213 | + /** @var BackendConfigurationManager $backendConfigurationManager */ |
|
| 214 | + $backendConfigurationManager = GeneralUtility::makeInstance(BackendConfigurationManager::class); |
|
| 215 | + $configuration = $backendConfigurationManager->getTypoScriptSetup(); |
|
| 216 | + return $configuration['module.']['tx_vidi.']['settings.']; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * @return object|DataService |
|
| 221 | + */ |
|
| 222 | + protected function getDataService(): DataService |
|
| 223 | + { |
|
| 224 | + return GeneralUtility::makeInstance(DataService::class); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * Get the Vidi Module Loader. |
|
| 229 | + * |
|
| 230 | + * @return ModuleLoader|object |
|
| 231 | + */ |
|
| 232 | + protected function getModuleLoader() |
|
| 233 | + { |
|
| 234 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | 237 | } |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | |
| 30 | 30 | $dataType = $this->getModuleLoader()->getDataType(); |
| 31 | 31 | |
| 32 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_' . $key; |
|
| 32 | + $key = $dataType.'_'.$this->getBackendUserIdentifier().'_'.$key; |
|
| 33 | 33 | $this->getCacheInstance()->set($key, $value, [], 0); |
| 34 | 34 | |
| 35 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_signature'; |
|
| 35 | + $key = $dataType.'_'.$this->getBackendUserIdentifier().'_signature'; |
|
| 36 | 36 | $this->getCacheInstance()->set($key, $preferenceSignature, [], 0); |
| 37 | 37 | |
| 38 | 38 | return 'OK'; |
@@ -20,69 +20,69 @@ |
||
| 20 | 20 | class UserPreferencesController extends ActionController |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @param string $key |
|
| 25 | - * @param string $value |
|
| 26 | - * @param string $preferenceSignature |
|
| 27 | - * @return string |
|
| 28 | - */ |
|
| 29 | - public function saveAction($key, $value, $preferenceSignature) |
|
| 30 | - { |
|
| 23 | + /** |
|
| 24 | + * @param string $key |
|
| 25 | + * @param string $value |
|
| 26 | + * @param string $preferenceSignature |
|
| 27 | + * @return string |
|
| 28 | + */ |
|
| 29 | + public function saveAction($key, $value, $preferenceSignature) |
|
| 30 | + { |
|
| 31 | 31 | |
| 32 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 32 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 33 | 33 | |
| 34 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_' . $key; |
|
| 35 | - $this->getCacheInstance()->set($key, $value, [], 0); |
|
| 34 | + $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_' . $key; |
|
| 35 | + $this->getCacheInstance()->set($key, $value, [], 0); |
|
| 36 | 36 | |
| 37 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_signature'; |
|
| 38 | - $this->getCacheInstance()->set($key, $preferenceSignature, [], 0); |
|
| 37 | + $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_signature'; |
|
| 38 | + $this->getCacheInstance()->set($key, $preferenceSignature, [], 0); |
|
| 39 | 39 | |
| 40 | - return 'OK'; |
|
| 41 | - } |
|
| 40 | + return 'OK'; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @return int |
|
| 45 | - */ |
|
| 46 | - protected function getBackendUserIdentifier() |
|
| 47 | - { |
|
| 48 | - return $this->getBackendUser()->user['uid']; |
|
| 49 | - } |
|
| 43 | + /** |
|
| 44 | + * @return int |
|
| 45 | + */ |
|
| 46 | + protected function getBackendUserIdentifier() |
|
| 47 | + { |
|
| 48 | + return $this->getBackendUser()->user['uid']; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Returns an instance of the current Backend User. |
|
| 53 | - * |
|
| 54 | - * @return BackendUserAuthentication |
|
| 55 | - */ |
|
| 56 | - protected function getBackendUser() |
|
| 57 | - { |
|
| 58 | - return $GLOBALS['BE_USER']; |
|
| 59 | - } |
|
| 51 | + /** |
|
| 52 | + * Returns an instance of the current Backend User. |
|
| 53 | + * |
|
| 54 | + * @return BackendUserAuthentication |
|
| 55 | + */ |
|
| 56 | + protected function getBackendUser() |
|
| 57 | + { |
|
| 58 | + return $GLOBALS['BE_USER']; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Get the Vidi Module Loader. |
|
| 63 | - * |
|
| 64 | - * @return ModuleLoader |
|
| 65 | - */ |
|
| 66 | - protected function getModuleLoader() |
|
| 67 | - { |
|
| 68 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 69 | - } |
|
| 61 | + /** |
|
| 62 | + * Get the Vidi Module Loader. |
|
| 63 | + * |
|
| 64 | + * @return ModuleLoader |
|
| 65 | + */ |
|
| 66 | + protected function getModuleLoader() |
|
| 67 | + { |
|
| 68 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @return AbstractFrontend |
|
| 73 | - */ |
|
| 74 | - protected function getCacheInstance() |
|
| 75 | - { |
|
| 76 | - return $this->getCacheManager()->getCache('vidi'); |
|
| 77 | - } |
|
| 71 | + /** |
|
| 72 | + * @return AbstractFrontend |
|
| 73 | + */ |
|
| 74 | + protected function getCacheInstance() |
|
| 75 | + { |
|
| 76 | + return $this->getCacheManager()->getCache('vidi'); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Return the Cache Manager |
|
| 81 | - * |
|
| 82 | - * @return CacheManager |
|
| 83 | - */ |
|
| 84 | - protected function getCacheManager() |
|
| 85 | - { |
|
| 86 | - return GeneralUtility::makeInstance(CacheManager::class); |
|
| 87 | - } |
|
| 79 | + /** |
|
| 80 | + * Return the Cache Manager |
|
| 81 | + * |
|
| 82 | + * @return CacheManager |
|
| 83 | + */ |
|
| 84 | + protected function getCacheManager() |
|
| 85 | + { |
|
| 86 | + return GeneralUtility::makeInstance(CacheManager::class); |
|
| 87 | + } |
|
| 88 | 88 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | if (is_string($configuration)) { |
| 63 | 63 | $configuration = $legacyParameterConfiguration; |
| 64 | - GeneralUtility::deprecationLog('ColumnRendererAbstract: first parameter must now be an array. Please edit me in ' . get_class($this)); |
|
| 64 | + GeneralUtility::deprecationLog('ColumnRendererAbstract: first parameter must now be an array. Please edit me in '.get_class($this)); |
|
| 65 | 65 | } |
| 66 | 66 | $this->configuration = $configuration; |
| 67 | 67 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @see http://www.php.net/manual/function.htmlentities.php |
| 175 | 175 | * @api |
| 176 | 176 | */ |
| 177 | - protected function secure($value , $keepQuotes = false, $encoding = 'UTF-8') |
|
| 177 | + protected function secure($value, $keepQuotes = false, $encoding = 'UTF-8') |
|
| 178 | 178 | { |
| 179 | 179 | $flags = $keepQuotes ? ENT_NOQUOTES : ENT_COMPAT; |
| 180 | 180 | return htmlspecialchars($value, $flags, $encoding); |
@@ -19,191 +19,191 @@ |
||
| 19 | 19 | abstract class ColumnRendererAbstract implements ColumnRendererInterface |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * The content object. |
|
| 24 | - * |
|
| 25 | - * @var Content |
|
| 26 | - */ |
|
| 27 | - protected $object; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 32 | - protected $fieldName; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var int |
|
| 36 | - */ |
|
| 37 | - protected $rowIndex; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var array |
|
| 41 | - */ |
|
| 42 | - protected $fieldConfiguration = []; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @var array |
|
| 46 | - */ |
|
| 47 | - protected $gridRendererConfiguration = []; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @var array |
|
| 51 | - */ |
|
| 52 | - protected $configuration = []; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Constructor of a Generic component in Vidi. |
|
| 56 | - * |
|
| 57 | - * @param array $configuration |
|
| 58 | - * @param array $legacyParameterConfiguration |
|
| 59 | - */ |
|
| 60 | - public function __construct($configuration = [], $legacyParameterConfiguration = array()) |
|
| 61 | - { |
|
| 62 | - if (is_string($configuration)) { |
|
| 63 | - $configuration = $legacyParameterConfiguration; |
|
| 64 | - GeneralUtility::deprecationLog('ColumnRendererAbstract: first parameter must now be an array. Please edit me in ' . get_class($this)); |
|
| 65 | - } |
|
| 66 | - $this->configuration = $configuration; |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @return array |
|
| 71 | - */ |
|
| 72 | - public function getConfiguration() |
|
| 73 | - { |
|
| 74 | - return $this->configuration; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @return Content |
|
| 79 | - */ |
|
| 80 | - public function getObject() |
|
| 81 | - { |
|
| 82 | - return $this->object; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * @param Content $object |
|
| 87 | - * @return $this |
|
| 88 | - */ |
|
| 89 | - public function setObject($object) |
|
| 90 | - { |
|
| 91 | - $this->object = $object; |
|
| 92 | - return $this; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 98 | - public function getFieldName() |
|
| 99 | - { |
|
| 100 | - return $this->fieldName; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @param string $fieldName |
|
| 105 | - * @return $this |
|
| 106 | - */ |
|
| 107 | - public function setFieldName($fieldName) |
|
| 108 | - { |
|
| 109 | - $this->fieldName = $fieldName; |
|
| 110 | - return $this; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * @return int |
|
| 115 | - */ |
|
| 116 | - public function getRowIndex() |
|
| 117 | - { |
|
| 118 | - return $this->rowIndex; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * @param int $rowIndex |
|
| 123 | - * @return $this |
|
| 124 | - */ |
|
| 125 | - public function setRowIndex($rowIndex) |
|
| 126 | - { |
|
| 127 | - $this->rowIndex = $rowIndex; |
|
| 128 | - return $this; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * @return array |
|
| 133 | - */ |
|
| 134 | - public function getFieldConfiguration() |
|
| 135 | - { |
|
| 136 | - return $this->fieldConfiguration; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * @param array $fieldConfiguration |
|
| 141 | - * @return $this |
|
| 142 | - */ |
|
| 143 | - public function setFieldConfiguration($fieldConfiguration) |
|
| 144 | - { |
|
| 145 | - $this->fieldConfiguration = $fieldConfiguration; |
|
| 146 | - return $this; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * @return array |
|
| 151 | - */ |
|
| 152 | - public function getGridRendererConfiguration() |
|
| 153 | - { |
|
| 154 | - return $this->gridRendererConfiguration; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * @param array $gridRendererConfiguration |
|
| 159 | - * @return $this |
|
| 160 | - */ |
|
| 161 | - public function setGridRendererConfiguration($gridRendererConfiguration) |
|
| 162 | - { |
|
| 163 | - $this->gridRendererConfiguration = $gridRendererConfiguration; |
|
| 164 | - return $this; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * Escapes special characters with their escaped counterparts as needed using PHPs htmlentities() function. |
|
| 169 | - * |
|
| 170 | - * @param string $value string to format |
|
| 171 | - * @param bool $keepQuotes if TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag) |
|
| 172 | - * @param string $encoding |
|
| 173 | - * @return string |
|
| 174 | - * @see http://www.php.net/manual/function.htmlentities.php |
|
| 175 | - * @api |
|
| 176 | - */ |
|
| 177 | - protected function secure($value , $keepQuotes = false, $encoding = 'UTF-8') |
|
| 178 | - { |
|
| 179 | - $flags = $keepQuotes ? ENT_NOQUOTES : ENT_COMPAT; |
|
| 180 | - return htmlspecialchars($value, $flags, $encoding); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * Get the Vidi Module Loader. |
|
| 185 | - * |
|
| 186 | - * @return object|ModuleLoader |
|
| 187 | - */ |
|
| 188 | - protected function getModuleLoader() |
|
| 189 | - { |
|
| 190 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * @return object|IconFactory |
|
| 195 | - */ |
|
| 196 | - protected function getIconFactory() |
|
| 197 | - { |
|
| 198 | - return GeneralUtility::makeInstance(IconFactory::class); |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - /** |
|
| 202 | - * @return object|LanguageService |
|
| 203 | - */ |
|
| 204 | - protected function getLanguageService() |
|
| 205 | - { |
|
| 206 | - return GeneralUtility::makeInstance(LanguageService::class); |
|
| 207 | - } |
|
| 22 | + /** |
|
| 23 | + * The content object. |
|
| 24 | + * |
|
| 25 | + * @var Content |
|
| 26 | + */ |
|
| 27 | + protected $object; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | + protected $fieldName; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var int |
|
| 36 | + */ |
|
| 37 | + protected $rowIndex; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var array |
|
| 41 | + */ |
|
| 42 | + protected $fieldConfiguration = []; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @var array |
|
| 46 | + */ |
|
| 47 | + protected $gridRendererConfiguration = []; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @var array |
|
| 51 | + */ |
|
| 52 | + protected $configuration = []; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Constructor of a Generic component in Vidi. |
|
| 56 | + * |
|
| 57 | + * @param array $configuration |
|
| 58 | + * @param array $legacyParameterConfiguration |
|
| 59 | + */ |
|
| 60 | + public function __construct($configuration = [], $legacyParameterConfiguration = array()) |
|
| 61 | + { |
|
| 62 | + if (is_string($configuration)) { |
|
| 63 | + $configuration = $legacyParameterConfiguration; |
|
| 64 | + GeneralUtility::deprecationLog('ColumnRendererAbstract: first parameter must now be an array. Please edit me in ' . get_class($this)); |
|
| 65 | + } |
|
| 66 | + $this->configuration = $configuration; |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @return array |
|
| 71 | + */ |
|
| 72 | + public function getConfiguration() |
|
| 73 | + { |
|
| 74 | + return $this->configuration; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @return Content |
|
| 79 | + */ |
|
| 80 | + public function getObject() |
|
| 81 | + { |
|
| 82 | + return $this->object; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * @param Content $object |
|
| 87 | + * @return $this |
|
| 88 | + */ |
|
| 89 | + public function setObject($object) |
|
| 90 | + { |
|
| 91 | + $this->object = $object; |
|
| 92 | + return $this; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | + public function getFieldName() |
|
| 99 | + { |
|
| 100 | + return $this->fieldName; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @param string $fieldName |
|
| 105 | + * @return $this |
|
| 106 | + */ |
|
| 107 | + public function setFieldName($fieldName) |
|
| 108 | + { |
|
| 109 | + $this->fieldName = $fieldName; |
|
| 110 | + return $this; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * @return int |
|
| 115 | + */ |
|
| 116 | + public function getRowIndex() |
|
| 117 | + { |
|
| 118 | + return $this->rowIndex; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * @param int $rowIndex |
|
| 123 | + * @return $this |
|
| 124 | + */ |
|
| 125 | + public function setRowIndex($rowIndex) |
|
| 126 | + { |
|
| 127 | + $this->rowIndex = $rowIndex; |
|
| 128 | + return $this; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * @return array |
|
| 133 | + */ |
|
| 134 | + public function getFieldConfiguration() |
|
| 135 | + { |
|
| 136 | + return $this->fieldConfiguration; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @param array $fieldConfiguration |
|
| 141 | + * @return $this |
|
| 142 | + */ |
|
| 143 | + public function setFieldConfiguration($fieldConfiguration) |
|
| 144 | + { |
|
| 145 | + $this->fieldConfiguration = $fieldConfiguration; |
|
| 146 | + return $this; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @return array |
|
| 151 | + */ |
|
| 152 | + public function getGridRendererConfiguration() |
|
| 153 | + { |
|
| 154 | + return $this->gridRendererConfiguration; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * @param array $gridRendererConfiguration |
|
| 159 | + * @return $this |
|
| 160 | + */ |
|
| 161 | + public function setGridRendererConfiguration($gridRendererConfiguration) |
|
| 162 | + { |
|
| 163 | + $this->gridRendererConfiguration = $gridRendererConfiguration; |
|
| 164 | + return $this; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * Escapes special characters with their escaped counterparts as needed using PHPs htmlentities() function. |
|
| 169 | + * |
|
| 170 | + * @param string $value string to format |
|
| 171 | + * @param bool $keepQuotes if TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag) |
|
| 172 | + * @param string $encoding |
|
| 173 | + * @return string |
|
| 174 | + * @see http://www.php.net/manual/function.htmlentities.php |
|
| 175 | + * @api |
|
| 176 | + */ |
|
| 177 | + protected function secure($value , $keepQuotes = false, $encoding = 'UTF-8') |
|
| 178 | + { |
|
| 179 | + $flags = $keepQuotes ? ENT_NOQUOTES : ENT_COMPAT; |
|
| 180 | + return htmlspecialchars($value, $flags, $encoding); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * Get the Vidi Module Loader. |
|
| 185 | + * |
|
| 186 | + * @return object|ModuleLoader |
|
| 187 | + */ |
|
| 188 | + protected function getModuleLoader() |
|
| 189 | + { |
|
| 190 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * @return object|IconFactory |
|
| 195 | + */ |
|
| 196 | + protected function getIconFactory() |
|
| 197 | + { |
|
| 198 | + return GeneralUtility::makeInstance(IconFactory::class); |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * @return object|LanguageService |
|
| 203 | + */ |
|
| 204 | + protected function getLanguageService() |
|
| 205 | + { |
|
| 206 | + return GeneralUtility::makeInstance(LanguageService::class); |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | 209 | } |
@@ -18,68 +18,68 @@ |
||
| 18 | 18 | class ConfigurationUtility implements SingletonInterface |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - protected $extensionKey = 'vidi'; |
|
| 21 | + /** |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + protected $extensionKey = 'vidi'; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var array |
|
| 28 | - */ |
|
| 29 | - protected $configuration = []; |
|
| 26 | + /** |
|
| 27 | + * @var array |
|
| 28 | + */ |
|
| 29 | + protected $configuration = []; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Returns a class instance. |
|
| 33 | - * |
|
| 34 | - * @return ConfigurationUtility|object |
|
| 35 | - * @throws \InvalidArgumentException |
|
| 36 | - */ |
|
| 37 | - static public function getInstance() |
|
| 38 | - { |
|
| 39 | - return GeneralUtility::makeInstance(self::class); |
|
| 40 | - } |
|
| 31 | + /** |
|
| 32 | + * Returns a class instance. |
|
| 33 | + * |
|
| 34 | + * @return ConfigurationUtility|object |
|
| 35 | + * @throws \InvalidArgumentException |
|
| 36 | + */ |
|
| 37 | + static public function getInstance() |
|
| 38 | + { |
|
| 39 | + return GeneralUtility::makeInstance(self::class); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Constructor |
|
| 44 | - */ |
|
| 45 | - public function __construct() |
|
| 46 | - { |
|
| 47 | - $configuration = $configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get($this->extensionKey); |
|
| 42 | + /** |
|
| 43 | + * Constructor |
|
| 44 | + */ |
|
| 45 | + public function __construct() |
|
| 46 | + { |
|
| 47 | + $configuration = $configuration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get($this->extensionKey); |
|
| 48 | 48 | |
| 49 | - // Fill up configuration array with relevant values. |
|
| 50 | - foreach ($configuration as $key => $value) { |
|
| 51 | - $this->configuration[$key] = $value; |
|
| 52 | - } |
|
| 53 | - } |
|
| 49 | + // Fill up configuration array with relevant values. |
|
| 50 | + foreach ($configuration as $key => $value) { |
|
| 51 | + $this->configuration[$key] = $value; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Returns a setting key. |
|
| 57 | - * |
|
| 58 | - * @param string $key |
|
| 59 | - * @return array |
|
| 60 | - */ |
|
| 61 | - public function get($key) |
|
| 62 | - { |
|
| 63 | - return isset($this->configuration[$key]) ? $this->configuration[$key] : null; |
|
| 64 | - } |
|
| 55 | + /** |
|
| 56 | + * Returns a setting key. |
|
| 57 | + * |
|
| 58 | + * @param string $key |
|
| 59 | + * @return array |
|
| 60 | + */ |
|
| 61 | + public function get($key) |
|
| 62 | + { |
|
| 63 | + return isset($this->configuration[$key]) ? $this->configuration[$key] : null; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Set a setting key. |
|
| 68 | - * |
|
| 69 | - * @param string $key |
|
| 70 | - * @param mixed $value |
|
| 71 | - * @return void |
|
| 72 | - */ |
|
| 73 | - public function set($key, $value) |
|
| 74 | - { |
|
| 75 | - $this->configuration[$key] = $value; |
|
| 76 | - } |
|
| 66 | + /** |
|
| 67 | + * Set a setting key. |
|
| 68 | + * |
|
| 69 | + * @param string $key |
|
| 70 | + * @param mixed $value |
|
| 71 | + * @return void |
|
| 72 | + */ |
|
| 73 | + public function set($key, $value) |
|
| 74 | + { |
|
| 75 | + $this->configuration[$key] = $value; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @return array |
|
| 80 | - */ |
|
| 81 | - public function getConfiguration() |
|
| 82 | - { |
|
| 83 | - return $this->configuration; |
|
| 84 | - } |
|
| 78 | + /** |
|
| 79 | + * @return array |
|
| 80 | + */ |
|
| 81 | + public function getConfiguration() |
|
| 82 | + { |
|
| 83 | + return $this->configuration; |
|
| 84 | + } |
|
| 85 | 85 | } |
@@ -19,30 +19,30 @@ |
||
| 19 | 19 | class BackViewHelper extends AbstractViewHelper |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Returns the "back" buttons to be placed in the doc header. |
|
| 24 | - * |
|
| 25 | - * @return string |
|
| 26 | - */ |
|
| 27 | - public function render() |
|
| 28 | - { |
|
| 22 | + /** |
|
| 23 | + * Returns the "back" buttons to be placed in the doc header. |
|
| 24 | + * |
|
| 25 | + * @return string |
|
| 26 | + */ |
|
| 27 | + public function render() |
|
| 28 | + { |
|
| 29 | 29 | |
| 30 | - $result = ''; |
|
| 31 | - if (GeneralUtility::_GET('returnUrl')) { |
|
| 32 | - $result = sprintf('<a href="%s" class="btn btn-default btn-sm btn-return-top">%s</a>', |
|
| 33 | - GeneralUtility::_GP('returnUrl'), |
|
| 34 | - $this->getIconFactory()->getIcon('actions-close', Icon::SIZE_SMALL) |
|
| 35 | - ); |
|
| 36 | - } |
|
| 30 | + $result = ''; |
|
| 31 | + if (GeneralUtility::_GET('returnUrl')) { |
|
| 32 | + $result = sprintf('<a href="%s" class="btn btn-default btn-sm btn-return-top">%s</a>', |
|
| 33 | + GeneralUtility::_GP('returnUrl'), |
|
| 34 | + $this->getIconFactory()->getIcon('actions-close', Icon::SIZE_SMALL) |
|
| 35 | + ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - return $result; |
|
| 39 | - } |
|
| 38 | + return $result; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @return IconFactory|object |
|
| 43 | - */ |
|
| 44 | - protected function getIconFactory() |
|
| 45 | - { |
|
| 46 | - return GeneralUtility::makeInstance(IconFactory::class); |
|
| 47 | - } |
|
| 41 | + /** |
|
| 42 | + * @return IconFactory|object |
|
| 43 | + */ |
|
| 44 | + protected function getIconFactory() |
|
| 45 | + { |
|
| 46 | + return GeneralUtility::makeInstance(IconFactory::class); |
|
| 47 | + } |
|
| 48 | 48 | } |