@@ -16,18 +16,18 @@ |
||
16 | 16 | */ |
17 | 17 | class ReportToViewHelper extends AbstractViewHelper |
18 | 18 | { |
19 | - /** |
|
20 | - * Returns the people who will receive a report. |
|
21 | - * |
|
22 | - * @throws \Exception |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function render() |
|
26 | - { |
|
27 | - $reportTo = 'null (Missing value in $GLOBALS[TYPO3_CONF_VARS][MAIL][defaultMailFromAddress])'; |
|
28 | - if (!empty($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'])) { |
|
29 | - $reportTo = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']; |
|
30 | - } |
|
31 | - return $reportTo; |
|
32 | - } |
|
19 | + /** |
|
20 | + * Returns the people who will receive a report. |
|
21 | + * |
|
22 | + * @throws \Exception |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function render() |
|
26 | + { |
|
27 | + $reportTo = 'null (Missing value in $GLOBALS[TYPO3_CONF_VARS][MAIL][defaultMailFromAddress])'; |
|
28 | + if (!empty($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'])) { |
|
29 | + $reportTo = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']; |
|
30 | + } |
|
31 | + return $reportTo; |
|
32 | + } |
|
33 | 33 | } |
@@ -20,50 +20,50 @@ |
||
20 | 20 | */ |
21 | 21 | class StorageViewHelper extends AbstractViewHelper |
22 | 22 | { |
23 | - /** |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function initializeArguments() |
|
27 | - { |
|
28 | - $this->registerArgument('objects', 'array', '', false, []); |
|
29 | - } |
|
23 | + /** |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function initializeArguments() |
|
27 | + { |
|
28 | + $this->registerArgument('objects', 'array', '', false, []); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Render a file upload field |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function render() |
|
37 | - { |
|
38 | - $objects = $this->arguments['objects']; |
|
31 | + /** |
|
32 | + * Render a file upload field |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function render() |
|
37 | + { |
|
38 | + $objects = $this->arguments['objects']; |
|
39 | 39 | |
40 | - // Check if a storages is selected |
|
41 | - $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
40 | + // Check if a storages is selected |
|
41 | + $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
42 | 42 | |
43 | - $template = '<select name="%s[target]">%s</select>'; |
|
44 | - $options = []; |
|
45 | - foreach ($objects as $storage) { |
|
46 | - /** @var ResourceStorage $storage */ |
|
47 | - $options[] = sprintf( |
|
48 | - '<option value="%s" %s>%s %s</option>', |
|
49 | - $storage->getUid(), |
|
50 | - is_object($currentStorage) && $currentStorage->getUid() == $storage->getUid() ? 'selected="selected"' : '', |
|
51 | - $storage->getName(), |
|
52 | - !$storage->isOnline() ? '(offline)' : '' |
|
53 | - ); |
|
54 | - } |
|
55 | - return sprintf( |
|
56 | - $template, |
|
57 | - VidiModule::getParameterPrefix(), |
|
58 | - implode("\n", $options) |
|
59 | - ); |
|
60 | - } |
|
43 | + $template = '<select name="%s[target]">%s</select>'; |
|
44 | + $options = []; |
|
45 | + foreach ($objects as $storage) { |
|
46 | + /** @var ResourceStorage $storage */ |
|
47 | + $options[] = sprintf( |
|
48 | + '<option value="%s" %s>%s %s</option>', |
|
49 | + $storage->getUid(), |
|
50 | + is_object($currentStorage) && $currentStorage->getUid() == $storage->getUid() ? 'selected="selected"' : '', |
|
51 | + $storage->getName(), |
|
52 | + !$storage->isOnline() ? '(offline)' : '' |
|
53 | + ); |
|
54 | + } |
|
55 | + return sprintf( |
|
56 | + $template, |
|
57 | + VidiModule::getParameterPrefix(), |
|
58 | + implode("\n", $options) |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return MediaModule|object |
|
64 | - */ |
|
65 | - protected function getMediaModule() |
|
66 | - { |
|
67 | - return GeneralUtility::makeInstance(MediaModule::class); |
|
68 | - } |
|
62 | + /** |
|
63 | + * @return MediaModule|object |
|
64 | + */ |
|
65 | + protected function getMediaModule() |
|
66 | + { |
|
67 | + return GeneralUtility::makeInstance(MediaModule::class); |
|
68 | + } |
|
69 | 69 | } |
@@ -21,122 +21,122 @@ |
||
21 | 21 | */ |
22 | 22 | class FooterViewHelper extends AbstractViewHelper |
23 | 23 | { |
24 | - /** |
|
25 | - * Render a form footer. |
|
26 | - * Example: |
|
27 | - * Created on 30-12-12 by John Updated on 22-05-12 by Jane |
|
28 | - * |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - public function render() |
|
32 | - { |
|
33 | - /** @var File $file */ |
|
34 | - $file = $this->templateVariableContainer->get('file'); |
|
35 | - $template = '<span>%s %s %s</span> <span style="padding-left: 50px">%s %s %s</span>'; |
|
36 | - |
|
37 | - $format = sprintf( |
|
38 | - '%s @ %s', |
|
39 | - $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], |
|
40 | - $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] |
|
41 | - ); |
|
42 | - |
|
43 | - $arguments = array( |
|
44 | - 'date' => null, |
|
45 | - 'format' => $format, |
|
46 | - 'base' => null |
|
47 | - ); |
|
48 | - |
|
49 | - $result = sprintf( |
|
50 | - $template, |
|
51 | - LocalizationUtility::translate('created_on', 'media'), |
|
52 | - $file->getProperty('crdate') ? $this->formatDate($arguments, $file->getProperty('crdate')) : '', |
|
53 | - $this->getUserName($file->getProperty('cruser_id')), |
|
54 | - LocalizationUtility::translate('updated_on', 'media'), |
|
55 | - $file->getProperty('tstamp') ? $this->formatDate($arguments, '@' . $file->getProperty('tstamp')) : '', |
|
56 | - $this->getUserName($file->getProperty('upuser_id')) |
|
57 | - ); |
|
58 | - |
|
59 | - return $result; |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * Get the User name to be displayed |
|
65 | - * |
|
66 | - * @param int $userIdentifier |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - public function getUserName($userIdentifier) |
|
70 | - { |
|
71 | - $username = ''; |
|
72 | - |
|
73 | - if ($userIdentifier > 0) { |
|
74 | - $record = $this->getDataService() |
|
75 | - ->getRecord( |
|
76 | - 'be_users', |
|
77 | - [ |
|
78 | - 'uid' => $userIdentifier |
|
79 | - ] |
|
80 | - ); |
|
81 | - $username = sprintf( |
|
82 | - '%s %s', |
|
83 | - LocalizationUtility::translate('by', 'media'), |
|
84 | - empty($record['realName']) ? $record['username'] : $record['realName'] |
|
85 | - ); |
|
86 | - } |
|
87 | - |
|
88 | - return $username; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @return object|DataService |
|
93 | - */ |
|
94 | - protected function getDataService(): DataService |
|
95 | - { |
|
96 | - return GeneralUtility::makeInstance(DataService::class); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @param array $arguments |
|
101 | - * @param int|string $date |
|
102 | - * @return string |
|
103 | - * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception |
|
104 | - */ |
|
105 | - public function formatDate(array $arguments, $date) |
|
106 | - { |
|
107 | - $format = $arguments['format']; |
|
108 | - $base = $date; |
|
109 | - if (is_string($base)) { |
|
110 | - $base = trim($base); |
|
111 | - } |
|
112 | - |
|
113 | - if ($format === '') { |
|
114 | - $format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] ?: 'Y-m-d'; |
|
115 | - } |
|
116 | - |
|
117 | - if (is_string($date)) { |
|
118 | - $date = trim($date); |
|
119 | - } |
|
120 | - |
|
121 | - if ($date === '') { |
|
122 | - $date = 'now'; |
|
123 | - } |
|
124 | - |
|
125 | - if (!$date instanceof \DateTimeInterface) { |
|
126 | - try { |
|
127 | - $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '') . $base); |
|
128 | - $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '') . $date, $base); |
|
129 | - $date = new \DateTime('@' . $dateTimestamp); |
|
130 | - $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); |
|
131 | - } catch (\Exception $exception) { |
|
132 | - throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by \DateTime constructor: ' . $exception->getMessage(), 1241722579); |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - if (strpos($format, '%') !== false) { |
|
137 | - return strftime($format, $date->format('U')); |
|
138 | - } else { |
|
139 | - return $date->format($format); |
|
140 | - } |
|
141 | - } |
|
24 | + /** |
|
25 | + * Render a form footer. |
|
26 | + * Example: |
|
27 | + * Created on 30-12-12 by John Updated on 22-05-12 by Jane |
|
28 | + * |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + public function render() |
|
32 | + { |
|
33 | + /** @var File $file */ |
|
34 | + $file = $this->templateVariableContainer->get('file'); |
|
35 | + $template = '<span>%s %s %s</span> <span style="padding-left: 50px">%s %s %s</span>'; |
|
36 | + |
|
37 | + $format = sprintf( |
|
38 | + '%s @ %s', |
|
39 | + $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], |
|
40 | + $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] |
|
41 | + ); |
|
42 | + |
|
43 | + $arguments = array( |
|
44 | + 'date' => null, |
|
45 | + 'format' => $format, |
|
46 | + 'base' => null |
|
47 | + ); |
|
48 | + |
|
49 | + $result = sprintf( |
|
50 | + $template, |
|
51 | + LocalizationUtility::translate('created_on', 'media'), |
|
52 | + $file->getProperty('crdate') ? $this->formatDate($arguments, $file->getProperty('crdate')) : '', |
|
53 | + $this->getUserName($file->getProperty('cruser_id')), |
|
54 | + LocalizationUtility::translate('updated_on', 'media'), |
|
55 | + $file->getProperty('tstamp') ? $this->formatDate($arguments, '@' . $file->getProperty('tstamp')) : '', |
|
56 | + $this->getUserName($file->getProperty('upuser_id')) |
|
57 | + ); |
|
58 | + |
|
59 | + return $result; |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * Get the User name to be displayed |
|
65 | + * |
|
66 | + * @param int $userIdentifier |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + public function getUserName($userIdentifier) |
|
70 | + { |
|
71 | + $username = ''; |
|
72 | + |
|
73 | + if ($userIdentifier > 0) { |
|
74 | + $record = $this->getDataService() |
|
75 | + ->getRecord( |
|
76 | + 'be_users', |
|
77 | + [ |
|
78 | + 'uid' => $userIdentifier |
|
79 | + ] |
|
80 | + ); |
|
81 | + $username = sprintf( |
|
82 | + '%s %s', |
|
83 | + LocalizationUtility::translate('by', 'media'), |
|
84 | + empty($record['realName']) ? $record['username'] : $record['realName'] |
|
85 | + ); |
|
86 | + } |
|
87 | + |
|
88 | + return $username; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @return object|DataService |
|
93 | + */ |
|
94 | + protected function getDataService(): DataService |
|
95 | + { |
|
96 | + return GeneralUtility::makeInstance(DataService::class); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @param array $arguments |
|
101 | + * @param int|string $date |
|
102 | + * @return string |
|
103 | + * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception |
|
104 | + */ |
|
105 | + public function formatDate(array $arguments, $date) |
|
106 | + { |
|
107 | + $format = $arguments['format']; |
|
108 | + $base = $date; |
|
109 | + if (is_string($base)) { |
|
110 | + $base = trim($base); |
|
111 | + } |
|
112 | + |
|
113 | + if ($format === '') { |
|
114 | + $format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] ?: 'Y-m-d'; |
|
115 | + } |
|
116 | + |
|
117 | + if (is_string($date)) { |
|
118 | + $date = trim($date); |
|
119 | + } |
|
120 | + |
|
121 | + if ($date === '') { |
|
122 | + $date = 'now'; |
|
123 | + } |
|
124 | + |
|
125 | + if (!$date instanceof \DateTimeInterface) { |
|
126 | + try { |
|
127 | + $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '') . $base); |
|
128 | + $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '') . $date, $base); |
|
129 | + $date = new \DateTime('@' . $dateTimestamp); |
|
130 | + $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); |
|
131 | + } catch (\Exception $exception) { |
|
132 | + throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by \DateTime constructor: ' . $exception->getMessage(), 1241722579); |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + if (strpos($format, '%') !== false) { |
|
137 | + return strftime($format, $date->format('U')); |
|
138 | + } else { |
|
139 | + return $date->format($format); |
|
140 | + } |
|
141 | + } |
|
142 | 142 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $file->getProperty('crdate') ? $this->formatDate($arguments, $file->getProperty('crdate')) : '', |
53 | 53 | $this->getUserName($file->getProperty('cruser_id')), |
54 | 54 | LocalizationUtility::translate('updated_on', 'media'), |
55 | - $file->getProperty('tstamp') ? $this->formatDate($arguments, '@' . $file->getProperty('tstamp')) : '', |
|
55 | + $file->getProperty('tstamp') ? $this->formatDate($arguments, '@'.$file->getProperty('tstamp')) : '', |
|
56 | 56 | $this->getUserName($file->getProperty('upuser_id')) |
57 | 57 | ); |
58 | 58 | |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | |
125 | 125 | if (!$date instanceof \DateTimeInterface) { |
126 | 126 | try { |
127 | - $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '') . $base); |
|
128 | - $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '') . $date, $base); |
|
129 | - $date = new \DateTime('@' . $dateTimestamp); |
|
127 | + $base = $base instanceof \DateTimeInterface ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '').$base); |
|
128 | + $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '').$date, $base); |
|
129 | + $date = new \DateTime('@'.$dateTimestamp); |
|
130 | 130 | $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); |
131 | 131 | } catch (\Exception $exception) { |
132 | - throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by \DateTime constructor: ' . $exception->getMessage(), 1241722579); |
|
132 | + throw new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('"'.$date.'" could not be parsed by \DateTime constructor: '.$exception->getMessage(), 1241722579); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 |
@@ -21,55 +21,55 @@ |
||
21 | 21 | */ |
22 | 22 | class MetadataViewHelper extends AbstractViewHelper |
23 | 23 | { |
24 | - /** |
|
25 | - * Returns metadata according to a template. |
|
26 | - * |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function render() |
|
30 | - { |
|
31 | - $file = $this->arguments['file']; |
|
32 | - $template = $this->arguments['template']; |
|
33 | - $metadataProperties = $this->arguments['metadataProperties']; |
|
34 | - $configuration = $this->arguments['configuration']; |
|
35 | - if (empty($template)) { |
|
36 | - $template = $this->getDefaultTemplate($file); |
|
37 | - } |
|
38 | - $result = $template; |
|
39 | - foreach ($metadataProperties as $metadataProperty) { |
|
40 | - $value = $file->getProperty($metadataProperty); |
|
41 | - if ($metadataProperty === 'size') { |
|
42 | - $sizeUnit = empty($configuration['sizeUnit']) ? 1000 : $configuration['sizeUnit']; |
|
43 | - $value = round($file->getSize() / $sizeUnit); |
|
44 | - } |
|
45 | - $result = str_replace('%' . $metadataProperty, $value, $result); |
|
46 | - } |
|
47 | - return $result; |
|
48 | - } |
|
24 | + /** |
|
25 | + * Returns metadata according to a template. |
|
26 | + * |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function render() |
|
30 | + { |
|
31 | + $file = $this->arguments['file']; |
|
32 | + $template = $this->arguments['template']; |
|
33 | + $metadataProperties = $this->arguments['metadataProperties']; |
|
34 | + $configuration = $this->arguments['configuration']; |
|
35 | + if (empty($template)) { |
|
36 | + $template = $this->getDefaultTemplate($file); |
|
37 | + } |
|
38 | + $result = $template; |
|
39 | + foreach ($metadataProperties as $metadataProperty) { |
|
40 | + $value = $file->getProperty($metadataProperty); |
|
41 | + if ($metadataProperty === 'size') { |
|
42 | + $sizeUnit = empty($configuration['sizeUnit']) ? 1000 : $configuration['sizeUnit']; |
|
43 | + $value = round($file->getSize() / $sizeUnit); |
|
44 | + } |
|
45 | + $result = str_replace('%' . $metadataProperty, $value, $result); |
|
46 | + } |
|
47 | + return $result; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Returns a default template. |
|
52 | - * |
|
53 | - * @param File $file |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - protected function getDefaultTemplate(File $file) |
|
57 | - { |
|
58 | - $template = '%size KB'; |
|
50 | + /** |
|
51 | + * Returns a default template. |
|
52 | + * |
|
53 | + * @param File $file |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + protected function getDefaultTemplate(File $file) |
|
57 | + { |
|
58 | + $template = '%size KB'; |
|
59 | 59 | |
60 | - if ($file->getType() == File::FILETYPE_IMAGE) { |
|
61 | - $template = '%width x %height - ' . $template; |
|
62 | - } |
|
60 | + if ($file->getType() == File::FILETYPE_IMAGE) { |
|
61 | + $template = '%width x %height - ' . $template; |
|
62 | + } |
|
63 | 63 | |
64 | - return $template; |
|
65 | - } |
|
64 | + return $template; |
|
65 | + } |
|
66 | 66 | |
67 | - public function initializeArguments(): void |
|
68 | - { |
|
69 | - parent::initializeArguments(); |
|
70 | - $this->registerArgument('file', File::class, '', true); |
|
71 | - $this->registerArgument('template', 'string', '', false, ''); |
|
72 | - $this->registerArgument('metadataProperties', 'array', '', false, ['size', 'width', 'height']); |
|
73 | - $this->registerArgument('configuration', 'array', '', false, []); |
|
74 | - } |
|
67 | + public function initializeArguments(): void |
|
68 | + { |
|
69 | + parent::initializeArguments(); |
|
70 | + $this->registerArgument('file', File::class, '', true); |
|
71 | + $this->registerArgument('template', 'string', '', false, ''); |
|
72 | + $this->registerArgument('metadataProperties', 'array', '', false, ['size', 'width', 'height']); |
|
73 | + $this->registerArgument('configuration', 'array', '', false, []); |
|
74 | + } |
|
75 | 75 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $sizeUnit = empty($configuration['sizeUnit']) ? 1000 : $configuration['sizeUnit']; |
43 | 43 | $value = round($file->getSize() / $sizeUnit); |
44 | 44 | } |
45 | - $result = str_replace('%' . $metadataProperty, $value, $result); |
|
45 | + $result = str_replace('%'.$metadataProperty, $value, $result); |
|
46 | 46 | } |
47 | 47 | return $result; |
48 | 48 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $template = '%size KB'; |
59 | 59 | |
60 | 60 | if ($file->getType() == File::FILETYPE_IMAGE) { |
61 | - $template = '%width x %height - ' . $template; |
|
61 | + $template = '%width x %height - '.$template; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $template; |
@@ -17,31 +17,31 @@ |
||
17 | 17 | */ |
18 | 18 | class ImageDimensionViewHelper extends AbstractViewHelper |
19 | 19 | { |
20 | - /** |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function initializeArguments() |
|
24 | - { |
|
25 | - $this->registerArgument('preset', 'string', '', true); |
|
26 | - $this->registerArgument('dimension', 'string', '', false, 'width'); |
|
27 | - } |
|
20 | + /** |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function initializeArguments() |
|
24 | + { |
|
25 | + $this->registerArgument('preset', 'string', '', true); |
|
26 | + $this->registerArgument('dimension', 'string', '', false, 'width'); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Returns preset values related to an image dimension |
|
31 | - * |
|
32 | - * @return int |
|
33 | - */ |
|
34 | - public function render() |
|
35 | - { |
|
36 | - $preset = $this->arguments['preset']; |
|
37 | - $dimension = $this->arguments['dimension']; |
|
29 | + /** |
|
30 | + * Returns preset values related to an image dimension |
|
31 | + * |
|
32 | + * @return int |
|
33 | + */ |
|
34 | + public function render() |
|
35 | + { |
|
36 | + $preset = $this->arguments['preset']; |
|
37 | + $dimension = $this->arguments['dimension']; |
|
38 | 38 | |
39 | - $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
40 | - if ($dimension === 'width') { |
|
41 | - $result = $imageDimension->getWidth(); |
|
42 | - } else { |
|
43 | - $result = $imageDimension->getHeight(); |
|
44 | - } |
|
45 | - return $result; |
|
46 | - } |
|
39 | + $imageDimension = ImagePresetUtility::getInstance()->preset($preset); |
|
40 | + if ($dimension === 'width') { |
|
41 | + $result = $imageDimension->getWidth(); |
|
42 | + } else { |
|
43 | + $result = $imageDimension->getHeight(); |
|
44 | + } |
|
45 | + return $result; |
|
46 | + } |
|
47 | 47 | } |
@@ -17,13 +17,13 @@ |
||
17 | 17 | */ |
18 | 18 | class ModuleSignatureViewHelper extends AbstractViewHelper |
19 | 19 | { |
20 | - /** |
|
21 | - * Returns the BE module signature. |
|
22 | - * |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function render() |
|
26 | - { |
|
27 | - return VidiModule::getSignature(); |
|
28 | - } |
|
20 | + /** |
|
21 | + * Returns the BE module signature. |
|
22 | + * |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function render() |
|
26 | + { |
|
27 | + return VidiModule::getSignature(); |
|
28 | + } |
|
29 | 29 | } |
@@ -19,36 +19,36 @@ |
||
19 | 19 | */ |
20 | 20 | class ExistsViewHelper extends AbstractViewHelper |
21 | 21 | { |
22 | - /** |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function initializeArguments() |
|
26 | - { |
|
27 | - $this->registerArgument('file', 'mixed', '', true); |
|
28 | - } |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function initializeArguments() |
|
26 | + { |
|
27 | + $this->registerArgument('file', 'mixed', '', true); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Returns a property value of a file given by the context. |
|
32 | - * |
|
33 | - * @return bool |
|
34 | - */ |
|
35 | - public function render() |
|
36 | - { |
|
37 | - /** @var File|Content|int $file $file */ |
|
38 | - $file = $this->arguments['file']; |
|
30 | + /** |
|
31 | + * Returns a property value of a file given by the context. |
|
32 | + * |
|
33 | + * @return bool |
|
34 | + */ |
|
35 | + public function render() |
|
36 | + { |
|
37 | + /** @var File|Content|int $file $file */ |
|
38 | + $file = $this->arguments['file']; |
|
39 | 39 | |
40 | - if (!$file instanceof File) { |
|
41 | - $file = $this->getFileConverter()->convert($file); |
|
42 | - } |
|
40 | + if (!$file instanceof File) { |
|
41 | + $file = $this->getFileConverter()->convert($file); |
|
42 | + } |
|
43 | 43 | |
44 | - return $file->exists(); |
|
45 | - } |
|
44 | + return $file->exists(); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return ContentToFileConverter|object |
|
49 | - */ |
|
50 | - protected function getFileConverter() |
|
51 | - { |
|
52 | - return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
53 | - } |
|
47 | + /** |
|
48 | + * @return ContentToFileConverter|object |
|
49 | + */ |
|
50 | + protected function getFileConverter() |
|
51 | + { |
|
52 | + return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
53 | + } |
|
54 | 54 | } |
@@ -19,37 +19,37 @@ |
||
19 | 19 | */ |
20 | 20 | class UriViewHelper extends AbstractViewHelper |
21 | 21 | { |
22 | - /** |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function initializeArguments() |
|
26 | - { |
|
27 | - $this->registerArgument('file', 'mixed', '', true); |
|
28 | - $this->registerArgument('relative', 'bool', '', false, false); |
|
29 | - } |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function initializeArguments() |
|
26 | + { |
|
27 | + $this->registerArgument('file', 'mixed', '', true); |
|
28 | + $this->registerArgument('relative', 'bool', '', false, false); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Returns a property value of a file given by the context. |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function render() |
|
37 | - { |
|
38 | - /** @var File|Content|int $file $file */ |
|
39 | - $file = $this->arguments['file']; |
|
40 | - $relative = $this->arguments['relative']; |
|
31 | + /** |
|
32 | + * Returns a property value of a file given by the context. |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function render() |
|
37 | + { |
|
38 | + /** @var File|Content|int $file $file */ |
|
39 | + $file = $this->arguments['file']; |
|
40 | + $relative = $this->arguments['relative']; |
|
41 | 41 | |
42 | - if (!$file instanceof File) { |
|
43 | - $file = $this->getFileConverter()->convert($file); |
|
44 | - } |
|
45 | - return $file->getPublicUrl($relative); |
|
46 | - } |
|
42 | + if (!$file instanceof File) { |
|
43 | + $file = $this->getFileConverter()->convert($file); |
|
44 | + } |
|
45 | + return $file->getPublicUrl($relative); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return ContentToFileConverter|object |
|
50 | - */ |
|
51 | - protected function getFileConverter() |
|
52 | - { |
|
53 | - return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return ContentToFileConverter|object |
|
50 | + */ |
|
51 | + protected function getFileConverter() |
|
52 | + { |
|
53 | + return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
54 | + } |
|
55 | 55 | } |
@@ -17,25 +17,25 @@ |
||
17 | 17 | */ |
18 | 18 | class PropertyViewHelper extends AbstractViewHelper |
19 | 19 | { |
20 | - /** |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function initializeArguments() |
|
24 | - { |
|
25 | - $this->registerArgument('name', 'string', '', true); |
|
26 | - } |
|
20 | + /** |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function initializeArguments() |
|
24 | + { |
|
25 | + $this->registerArgument('name', 'string', '', true); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Returns a property value of a file given by the context. |
|
30 | - * |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - public function render() |
|
34 | - { |
|
35 | - $name = $this->arguments['name']; |
|
28 | + /** |
|
29 | + * Returns a property value of a file given by the context. |
|
30 | + * |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + public function render() |
|
34 | + { |
|
35 | + $name = $this->arguments['name']; |
|
36 | 36 | |
37 | - /** @var File $file */ |
|
38 | - $file = $this->templateVariableContainer->get('file'); |
|
39 | - return $file->getProperty($name); |
|
40 | - } |
|
37 | + /** @var File $file */ |
|
38 | + $file = $this->templateVariableContainer->get('file'); |
|
39 | + return $file->getProperty($name); |
|
40 | + } |
|
41 | 41 | } |