@@ -55,7 +55,6 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Creates .htaccess file inside the root directory |
57 | 57 | * |
58 | - * @param string $htaccessFile Path of .htaccess file |
|
59 | 58 | * @return void |
60 | 59 | */ |
61 | 60 | public function createDefaultHtaccessFile(){ |
@@ -96,7 +95,6 @@ discard block |
||
96 | 95 | /** |
97 | 96 | * Creates AdditionalConfiguration.php file inside the typo3conf directory |
98 | 97 | * |
99 | - * @param string $configurationFile Path of AdditionalConfiguration.php file |
|
100 | 98 | * @return void |
101 | 99 | */ |
102 | 100 | public function createDefaultAdditionalConfiguration($extension = NULL){ |
@@ -140,7 +138,6 @@ discard block |
||
140 | 138 | /** |
141 | 139 | * Creates robots.txt file inside the root directory |
142 | 140 | * |
143 | - * @param string $robotsFile Path of robots.txt file |
|
144 | 141 | * @return void |
145 | 142 | */ |
146 | 143 | public function createDefaultRobots($extension = NULL){ |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | namespace DCNGmbH\MooxCore\Service; |
4 | -use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
5 | -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
|
6 | -use TYPO3\CMS\Core\Messaging\FlashMessage; |
|
4 | +use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
5 | +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
|
6 | +use TYPO3\CMS\Core\Messaging\FlashMessage; |
|
7 | 7 | use TYPO3\CMS\Core\Utility\VersionNumberUtility; |
8 | 8 | |
9 | 9 | class InstallService { |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Initializes the install service |
23 | 23 | */ |
24 | - public function __construct(){ |
|
25 | - if(VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7000000){ |
|
24 | + public function __construct() { |
|
25 | + if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version)>=7000000) { |
|
26 | 26 | $this->messageQueueByIdentifier = 'extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager'; |
27 | - }else{ |
|
27 | + }else { |
|
28 | 28 | $this->messageQueueByIdentifier = 'core.template.flashMessages'; |
29 | 29 | } |
30 | 30 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @param string $extension |
34 | 34 | */ |
35 | - public function generateApacheHtaccess($extension = NULL){ |
|
36 | - if($extension == $this->extKey){ |
|
37 | - if(substr($_SERVER['SERVER_SOFTWARE'], 0, 6) === 'Apache'){ |
|
35 | + public function generateApacheHtaccess($extension = NULL) { |
|
36 | + if ($extension==$this->extKey) { |
|
37 | + if (substr($_SERVER['SERVER_SOFTWARE'], 0, 6)==='Apache') { |
|
38 | 38 | $this->createDefaultHtaccessFile(); |
39 | - }else{ |
|
39 | + }else { |
|
40 | 40 | /** |
41 | 41 | * Add Flashmessage that the system it not running on an apache webserver and the url rewritings must be handled manually |
42 | 42 | */ |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @param string $htaccessFile Path of .htaccess file |
59 | 59 | * @return void |
60 | 60 | */ |
61 | - public function createDefaultHtaccessFile(){ |
|
61 | + public function createDefaultHtaccessFile() { |
|
62 | 62 | $htaccessFile = GeneralUtility::getFileAbsFileName(".htaccess"); |
63 | 63 | |
64 | - if(file_exists($htaccessFile)){ |
|
64 | + if (file_exists($htaccessFile)) { |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Add Flashmessage that there is already an .htaccess file and we are not going to override this. |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | * @param string $configurationFile Path of AdditionalConfiguration.php file |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function createDefaultAdditionalConfiguration($extension = NULL){ |
|
103 | - if($extension == $this->extKey){ |
|
102 | + public function createDefaultAdditionalConfiguration($extension = NULL) { |
|
103 | + if ($extension==$this->extKey) { |
|
104 | 104 | |
105 | 105 | $configurationFile = GeneralUtility::getFileAbsFileName("typo3conf/AdditionalConfiguration.php"); |
106 | 106 | |
107 | - if(file_exists($configurationFile)){ |
|
107 | + if (file_exists($configurationFile)) { |
|
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Add Flashmessage that there is already an AdditionalConfiguration.php file and we are not going to override this. |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | * @param string $robotsFile Path of robots.txt file |
144 | 144 | * @return void |
145 | 145 | */ |
146 | - public function createDefaultRobots($extension = NULL){ |
|
147 | - if($extension == $this->extKey){ |
|
146 | + public function createDefaultRobots($extension = NULL) { |
|
147 | + if ($extension==$this->extKey) { |
|
148 | 148 | |
149 | 149 | $robotsFile = GeneralUtility::getFileAbsFileName("robots.txt"); |
150 | 150 | |
151 | - if(file_exists($robotsFile)){ |
|
151 | + if (file_exists($robotsFile)) { |
|
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Add Flashmessage that there is already an robots.txt file and we are not going to override this. |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $robotsContent .= "Disallow: /*?id=* \n"; |
174 | 174 | $robotsContent .= "Disallow: /*&type=98 \n"; |
175 | 175 | $robotsContent .= " \n"; |
176 | - $robotsContent .= "Sitemap: http://" .$_SERVER['HTTP_HOST']. "/sitemap.xml"; |
|
176 | + $robotsContent .= "Sitemap: http://".$_SERVER['HTTP_HOST']."/sitemap.xml"; |
|
177 | 177 | GeneralUtility::writeFile($robotsFile, $robotsContent, TRUE); |
178 | 178 | |
179 | 179 | /** |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @param FlashMessage $flashMessage |
197 | 197 | */ |
198 | - public function addFlashMessage(FlashMessage $flashMessage){ |
|
199 | - if($flashMessage){ |
|
198 | + public function addFlashMessage(FlashMessage $flashMessage) { |
|
199 | + if ($flashMessage) { |
|
200 | 200 | /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ |
201 | 201 | $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); |
202 | 202 | /** @var $flashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function __construct(){ |
25 | 25 | if(VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7000000){ |
26 | 26 | $this->messageQueueByIdentifier = 'extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager'; |
27 | - }else{ |
|
27 | + } else{ |
|
28 | 28 | $this->messageQueueByIdentifier = 'core.template.flashMessages'; |
29 | 29 | } |
30 | 30 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | if($extension == $this->extKey){ |
37 | 37 | if(substr($_SERVER['SERVER_SOFTWARE'], 0, 6) === 'Apache'){ |
38 | 38 | $this->createDefaultHtaccessFile(); |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | /** |
41 | 41 | * Add Flashmessage that the system it not running on an apache webserver and the url rewritings must be handled manually |
42 | 42 | */ |
@@ -8,90 +8,90 @@ discard block |
||
8 | 8 | |
9 | 9 | class InstallService { |
10 | 10 | |
11 | - /** |
|
12 | - * @var string |
|
13 | - */ |
|
14 | - protected $extKey = 'moox_core'; |
|
11 | + /** |
|
12 | + * @var string |
|
13 | + */ |
|
14 | + protected $extKey = 'moox_core'; |
|
15 | 15 | |
16 | - /** |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - protected $messageQueueByIdentifier = ''; |
|
16 | + /** |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + protected $messageQueueByIdentifier = ''; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Initializes the install service |
|
23 | - */ |
|
24 | - public function __construct(){ |
|
25 | - if(VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7000000){ |
|
26 | - $this->messageQueueByIdentifier = 'extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager'; |
|
27 | - }else{ |
|
28 | - $this->messageQueueByIdentifier = 'core.template.flashMessages'; |
|
29 | - } |
|
30 | - } |
|
21 | + /** |
|
22 | + * Initializes the install service |
|
23 | + */ |
|
24 | + public function __construct(){ |
|
25 | + if(VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7000000){ |
|
26 | + $this->messageQueueByIdentifier = 'extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager'; |
|
27 | + }else{ |
|
28 | + $this->messageQueueByIdentifier = 'core.template.flashMessages'; |
|
29 | + } |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * @param string $extension |
|
34 | - */ |
|
35 | - public function generateApacheHtaccess($extension = NULL){ |
|
36 | - if($extension == $this->extKey){ |
|
37 | - if(substr($_SERVER['SERVER_SOFTWARE'], 0, 6) === 'Apache'){ |
|
38 | - $this->createDefaultHtaccessFile(); |
|
39 | - }else{ |
|
40 | - /** |
|
41 | - * Add Flashmessage that the system it not running on an apache webserver and the url rewritings must be handled manually |
|
42 | - */ |
|
43 | - $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
44 | - 'The Bootstrap Package uses RealUrl to generate SEO friendly URLs by default, please take care of the URLs rewriting settings for your environment yourself.' |
|
45 | - . 'You can also deactivate RealUrl by changing your TypoScript setup to "config.tx_realurl_enable = 0".', |
|
46 | - 'TYPO3 is not running on an Apache-Webserver', |
|
47 | - FlashMessage::WARNING, |
|
48 | - TRUE |
|
49 | - ); |
|
50 | - $this->addFlashMessage($flashMessage); |
|
51 | - return; |
|
52 | - } |
|
53 | - } |
|
54 | - } |
|
55 | - /** |
|
32 | + /** |
|
33 | + * @param string $extension |
|
34 | + */ |
|
35 | + public function generateApacheHtaccess($extension = NULL){ |
|
36 | + if($extension == $this->extKey){ |
|
37 | + if(substr($_SERVER['SERVER_SOFTWARE'], 0, 6) === 'Apache'){ |
|
38 | + $this->createDefaultHtaccessFile(); |
|
39 | + }else{ |
|
40 | + /** |
|
41 | + * Add Flashmessage that the system it not running on an apache webserver and the url rewritings must be handled manually |
|
42 | + */ |
|
43 | + $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
44 | + 'The Bootstrap Package uses RealUrl to generate SEO friendly URLs by default, please take care of the URLs rewriting settings for your environment yourself.' |
|
45 | + . 'You can also deactivate RealUrl by changing your TypoScript setup to "config.tx_realurl_enable = 0".', |
|
46 | + 'TYPO3 is not running on an Apache-Webserver', |
|
47 | + FlashMessage::WARNING, |
|
48 | + TRUE |
|
49 | + ); |
|
50 | + $this->addFlashMessage($flashMessage); |
|
51 | + return; |
|
52 | + } |
|
53 | + } |
|
54 | + } |
|
55 | + /** |
|
56 | 56 | * Creates .htaccess file inside the root directory |
57 | 57 | * |
58 | 58 | * @param string $htaccessFile Path of .htaccess file |
59 | 59 | * @return void |
60 | 60 | */ |
61 | - public function createDefaultHtaccessFile(){ |
|
62 | - $htaccessFile = GeneralUtility::getFileAbsFileName(".htaccess"); |
|
61 | + public function createDefaultHtaccessFile(){ |
|
62 | + $htaccessFile = GeneralUtility::getFileAbsFileName(".htaccess"); |
|
63 | 63 | |
64 | - if(file_exists($htaccessFile)){ |
|
64 | + if(file_exists($htaccessFile)){ |
|
65 | 65 | |
66 | - /** |
|
67 | - * Add Flashmessage that there is already an .htaccess file and we are not going to override this. |
|
68 | - */ |
|
69 | - $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
70 | - 'There is already an Apache .htaccess file in the root directory, please make sure that the url rewritings are set properly.' |
|
71 | - . 'An example configuration is located at: typo3conf/ext/moox_core/Configuration/Apache/.htaccess', |
|
72 | - 'Apache .htaccess file already exists', |
|
73 | - FlashMessage::NOTICE, |
|
74 | - TRUE |
|
75 | - ); |
|
76 | - $this->addFlashMessage($flashMessage); |
|
66 | + /** |
|
67 | + * Add Flashmessage that there is already an .htaccess file and we are not going to override this. |
|
68 | + */ |
|
69 | + $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
70 | + 'There is already an Apache .htaccess file in the root directory, please make sure that the url rewritings are set properly.' |
|
71 | + . 'An example configuration is located at: typo3conf/ext/moox_core/Configuration/Apache/.htaccess', |
|
72 | + 'Apache .htaccess file already exists', |
|
73 | + FlashMessage::NOTICE, |
|
74 | + TRUE |
|
75 | + ); |
|
76 | + $this->addFlashMessage($flashMessage); |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 | |
80 | - $htaccessContent = GeneralUtility::getUrl(ExtensionManagementUtility::extPath($this->extKey).'/Configuration/Apache/_.htaccess'); |
|
81 | - GeneralUtility::writeFile($htaccessFile, $htaccessContent, TRUE); |
|
80 | + $htaccessContent = GeneralUtility::getUrl(ExtensionManagementUtility::extPath($this->extKey).'/Configuration/Apache/_.htaccess'); |
|
81 | + GeneralUtility::writeFile($htaccessFile, $htaccessContent, TRUE); |
|
82 | 82 | |
83 | - /** |
|
84 | - * Add Flashmessage that the example htaccess file was placed in the root directory |
|
85 | - */ |
|
86 | - $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
87 | - 'For RealURL and optimization purposes an example .htaccess file was placed in your root directory.' |
|
88 | - . ' Please check if the RewriteBase correctly set for your environment. ', |
|
89 | - 'Apache example .htaccess was placed in the root directory.', |
|
90 | - FlashMessage::OK, |
|
91 | - TRUE |
|
92 | - ); |
|
93 | - $this->addFlashMessage($flashMessage); |
|
94 | - } |
|
83 | + /** |
|
84 | + * Add Flashmessage that the example htaccess file was placed in the root directory |
|
85 | + */ |
|
86 | + $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
87 | + 'For RealURL and optimization purposes an example .htaccess file was placed in your root directory.' |
|
88 | + . ' Please check if the RewriteBase correctly set for your environment. ', |
|
89 | + 'Apache example .htaccess was placed in the root directory.', |
|
90 | + FlashMessage::OK, |
|
91 | + TRUE |
|
92 | + ); |
|
93 | + $this->addFlashMessage($flashMessage); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Creates AdditionalConfiguration.php file inside the typo3conf directory |
@@ -143,39 +143,39 @@ discard block |
||
143 | 143 | * @param string $robotsFile Path of robots.txt file |
144 | 144 | * @return void |
145 | 145 | */ |
146 | - public function createDefaultRobots($extension = NULL){ |
|
146 | + public function createDefaultRobots($extension = NULL){ |
|
147 | 147 | if($extension == $this->extKey){ |
148 | 148 | |
149 | - $robotsFile = GeneralUtility::getFileAbsFileName("robots.txt"); |
|
149 | + $robotsFile = GeneralUtility::getFileAbsFileName("robots.txt"); |
|
150 | 150 | |
151 | - if(file_exists($robotsFile)){ |
|
151 | + if(file_exists($robotsFile)){ |
|
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Add Flashmessage that there is already an robots.txt file and we are not going to override this. |
155 | 155 | */ |
156 | 156 | $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
157 | - 'There is already an robots.txt file in the root directory.' |
|
158 | - . 'An example robots.txt is located at: typo3conf/ext/moox_core/Configuration/Robots/robots.txt', |
|
159 | - 'robots.txt file already exists', |
|
160 | - FlashMessage::NOTICE, |
|
161 | - TRUE |
|
157 | + 'There is already an robots.txt file in the root directory.' |
|
158 | + . 'An example robots.txt is located at: typo3conf/ext/moox_core/Configuration/Robots/robots.txt', |
|
159 | + 'robots.txt file already exists', |
|
160 | + FlashMessage::NOTICE, |
|
161 | + TRUE |
|
162 | 162 | ); |
163 | 163 | $this->addFlashMessage($flashMessage); |
164 | - return; |
|
165 | - } |
|
164 | + return; |
|
165 | + } |
|
166 | 166 | |
167 | - $robotsContent .= "User-Agent: * \n"; |
|
168 | - $robotsContent .= " \n"; |
|
169 | - $robotsContent .= "Allow: / \n"; |
|
170 | - $robotsContent .= "Disallow: /typo3/ \n"; |
|
171 | - $robotsContent .= " \n"; |
|
172 | - $robotsContent .= "Sitemap: http://" .$_SERVER['HTTP_HOST']. "/sitemap.xml"; |
|
173 | - GeneralUtility::writeFile($robotsFile, $robotsContent, TRUE); |
|
167 | + $robotsContent .= "User-Agent: * \n"; |
|
168 | + $robotsContent .= " \n"; |
|
169 | + $robotsContent .= "Allow: / \n"; |
|
170 | + $robotsContent .= "Disallow: /typo3/ \n"; |
|
171 | + $robotsContent .= " \n"; |
|
172 | + $robotsContent .= "Sitemap: http://" .$_SERVER['HTTP_HOST']. "/sitemap.xml"; |
|
173 | + GeneralUtility::writeFile($robotsFile, $robotsContent, TRUE); |
|
174 | 174 | |
175 | - /** |
|
176 | - * Add Flashmessage that the example AdditionalCOnfiguration.php file was placed in the typo3conf directory |
|
177 | - */ |
|
178 | - $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
175 | + /** |
|
176 | + * Add Flashmessage that the example AdditionalCOnfiguration.php file was placed in the typo3conf directory |
|
177 | + */ |
|
178 | + $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
179 | 179 | 'robots.txt file was placed in your root directory.', |
180 | 180 | 'robots.txt was placed in the root directory.', |
181 | 181 | FlashMessage::OK, |
@@ -184,21 +184,21 @@ discard block |
||
184 | 184 | $this->addFlashMessage($flashMessage); |
185 | 185 | |
186 | 186 | } |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
190 | - * Adds a Flash Message to the Flash Message Queue |
|
191 | - * |
|
192 | - * @param FlashMessage $flashMessage |
|
193 | - */ |
|
194 | - public function addFlashMessage(FlashMessage $flashMessage){ |
|
195 | - if($flashMessage){ |
|
196 | - /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ |
|
197 | - $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); |
|
198 | - /** @var $flashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ |
|
199 | - $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($this->messageQueueByIdentifier); |
|
200 | - $flashMessageQueue->enqueue($flashMessage); |
|
201 | - } |
|
202 | - } |
|
189 | + /** |
|
190 | + * Adds a Flash Message to the Flash Message Queue |
|
191 | + * |
|
192 | + * @param FlashMessage $flashMessage |
|
193 | + */ |
|
194 | + public function addFlashMessage(FlashMessage $flashMessage){ |
|
195 | + if($flashMessage){ |
|
196 | + /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ |
|
197 | + $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); |
|
198 | + /** @var $flashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ |
|
199 | + $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($this->messageQueueByIdentifier); |
|
200 | + $flashMessageQueue->enqueue($flashMessage); |
|
201 | + } |
|
202 | + } |
|
203 | 203 | |
204 | 204 | } |
@@ -155,6 +155,9 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | |
158 | + /** |
|
159 | + * @param string $compiled_name |
|
160 | + */ |
|
158 | 161 | private static function OutputFile( $compiled_name, $parser_options ){ |
159 | 162 | |
160 | 163 | //custom output file |
@@ -184,6 +187,9 @@ discard block |
||
184 | 187 | } |
185 | 188 | |
186 | 189 | |
190 | + /** |
|
191 | + * @param string $dir |
|
192 | + */ |
|
187 | 193 | public static function SetCacheDir( $dir ){ |
188 | 194 | Less_Cache::$cache_dir = $dir; |
189 | 195 | } |
@@ -276,6 +282,7 @@ discard block |
||
276 | 282 | /** |
277 | 283 | * Get the list of less files and generated css file from a list file |
278 | 284 | * |
285 | + * @param string $list_file |
|
279 | 286 | */ |
280 | 287 | static function ListFiles($list_file, &$list, &$css_file_name ){ |
281 | 288 |
@@ -198,10 +198,10 @@ |
||
198 | 198 | throw new Less_Exception_Parser('Less.php cache directory couldn\'t be created: '.Less_Cache::$cache_dir); |
199 | 199 | } |
200 | 200 | |
201 | - }elseif( !is_dir(Less_Cache::$cache_dir) ){ |
|
201 | + } elseif( !is_dir(Less_Cache::$cache_dir) ){ |
|
202 | 202 | throw new Less_Exception_Parser('Less.php cache directory doesn\'t exist: '.Less_Cache::$cache_dir); |
203 | 203 | |
204 | - }elseif( !is_writable(Less_Cache::$cache_dir) ){ |
|
204 | + } elseif( !is_writable(Less_Cache::$cache_dir) ){ |
|
205 | 205 | throw new Less_Exception_Parser('Less.php cache directory isn\'t writable: '.Less_Cache::$cache_dir); |
206 | 206 | |
207 | 207 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once( dirname(__FILE__).'/Version.php'); |
|
3 | +require_once(dirname(__FILE__).'/Version.php'); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Utility for handling the generation and caching of css files |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | * @subpackage cache |
10 | 10 | * |
11 | 11 | */ |
12 | -class Less_Cache{ |
|
12 | +class Less_Cache { |
|
13 | 13 | |
14 | 14 | // directory less.php can use for storing data |
15 | - public static $cache_dir = false; |
|
15 | + public static $cache_dir = false; |
|
16 | 16 | |
17 | 17 | // prefix for the storing data |
18 | - public static $prefix = 'lessphp_'; |
|
18 | + public static $prefix = 'lessphp_'; |
|
19 | 19 | |
20 | 20 | // prefix for the storing vars |
21 | 21 | public static $prefix_vars = 'lessphpvars_'; |
@@ -34,31 +34,31 @@ discard block |
||
34 | 34 | * @param array $modify_vars Array of variables |
35 | 35 | * @return string Name of the css file |
36 | 36 | */ |
37 | - public static function Get( $less_files, $parser_options = array(), $modify_vars = array() ){ |
|
37 | + public static function Get($less_files, $parser_options = array(), $modify_vars = array()) { |
|
38 | 38 | |
39 | 39 | |
40 | 40 | //check $cache_dir |
41 | - if( isset($parser_options['cache_dir']) ){ |
|
41 | + if (isset($parser_options['cache_dir'])) { |
|
42 | 42 | Less_Cache::$cache_dir = $parser_options['cache_dir']; |
43 | 43 | } |
44 | 44 | |
45 | - if( empty(Less_Cache::$cache_dir) ){ |
|
45 | + if (empty(Less_Cache::$cache_dir)) { |
|
46 | 46 | throw new Exception('cache_dir not set'); |
47 | 47 | } |
48 | 48 | |
49 | - if( isset($parser_options['prefix']) ){ |
|
49 | + if (isset($parser_options['prefix'])) { |
|
50 | 50 | Less_Cache::$prefix = $parser_options['prefix']; |
51 | 51 | } |
52 | 52 | |
53 | - if( empty(Less_Cache::$prefix) ){ |
|
53 | + if (empty(Less_Cache::$prefix)) { |
|
54 | 54 | throw new Exception('prefix not set'); |
55 | 55 | } |
56 | 56 | |
57 | - if( isset($parser_options['prefix_vars']) ){ |
|
57 | + if (isset($parser_options['prefix_vars'])) { |
|
58 | 58 | Less_Cache::$prefix_vars = $parser_options['prefix_vars']; |
59 | 59 | } |
60 | 60 | |
61 | - if( empty(Less_Cache::$prefix_vars) ){ |
|
61 | + if (empty(Less_Cache::$prefix_vars)) { |
|
62 | 62 | throw new Exception('prefix_vars not set'); |
63 | 63 | } |
64 | 64 | |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | |
68 | 68 | |
69 | 69 | //create a file for variables |
70 | - if( !empty($modify_vars) ){ |
|
70 | + if (!empty($modify_vars)) { |
|
71 | 71 | $lessvars = Less_Parser::serializeVars($modify_vars); |
72 | - $vars_file = Less_Cache::$cache_dir . Less_Cache::$prefix_vars . sha1($lessvars) . '.less'; |
|
72 | + $vars_file = Less_Cache::$cache_dir.Less_Cache::$prefix_vars.sha1($lessvars).'.less'; |
|
73 | 73 | |
74 | - if( !file_exists($vars_file) ){ |
|
74 | + if (!file_exists($vars_file)) { |
|
75 | 75 | file_put_contents($vars_file, $lessvars); |
76 | 76 | } |
77 | 77 | |
@@ -81,22 +81,22 @@ discard block |
||
81 | 81 | |
82 | 82 | // generate name for compiled css file |
83 | 83 | $hash = md5(json_encode($less_files)); |
84 | - $list_file = Less_Cache::$cache_dir . Less_Cache::$prefix . $hash . '.list'; |
|
84 | + $list_file = Less_Cache::$cache_dir.Less_Cache::$prefix.$hash.'.list'; |
|
85 | 85 | |
86 | 86 | |
87 | 87 | // check cached content |
88 | - if( !isset($parser_options['use_cache']) || $parser_options['use_cache'] === true ){ |
|
89 | - if( file_exists($list_file) ){ |
|
88 | + if (!isset($parser_options['use_cache']) || $parser_options['use_cache']===true) { |
|
89 | + if (file_exists($list_file)) { |
|
90 | 90 | |
91 | 91 | self::ListFiles($list_file, $list, $cached_name); |
92 | 92 | $compiled_name = self::CompiledName($list); |
93 | 93 | |
94 | 94 | // if $cached_name != $compiled_name, we know we need to recompile |
95 | - if( !$cached_name || $cached_name === $compiled_name ){ |
|
95 | + if (!$cached_name || $cached_name===$compiled_name) { |
|
96 | 96 | |
97 | - $output_file = self::OutputFile($compiled_name, $parser_options ); |
|
97 | + $output_file = self::OutputFile($compiled_name, $parser_options); |
|
98 | 98 | |
99 | - if( $output_file && file_exists($output_file) ){ |
|
99 | + if ($output_file && file_exists($output_file)) { |
|
100 | 100 | @touch($list_file); |
101 | 101 | return basename($output_file); // for backwards compatibility, we just return the name of the file |
102 | 102 | } |
@@ -104,24 +104,24 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - $compiled = self::Cache( $less_files, $parser_options ); |
|
108 | - if( !$compiled ){ |
|
107 | + $compiled = self::Cache($less_files, $parser_options); |
|
108 | + if (!$compiled) { |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | |
112 | - $compiled_name = self::CompiledName( $less_files ); |
|
113 | - $output_file = self::OutputFile($compiled_name, $parser_options ); |
|
112 | + $compiled_name = self::CompiledName($less_files); |
|
113 | + $output_file = self::OutputFile($compiled_name, $parser_options); |
|
114 | 114 | |
115 | 115 | |
116 | 116 | //save the file list |
117 | 117 | $list = $less_files; |
118 | 118 | $list[] = $compiled_name; |
119 | - $cache = implode("\n",$list); |
|
120 | - file_put_contents( $list_file, $cache ); |
|
119 | + $cache = implode("\n", $list); |
|
120 | + file_put_contents($list_file, $cache); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | //save the css |
124 | - file_put_contents( $output_file, $compiled ); |
|
124 | + file_put_contents($output_file, $compiled); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | //clean up |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | * @param array $modify_vars Array of variables |
139 | 139 | * @return string Name of the css file |
140 | 140 | */ |
141 | - public static function Regen( $less_files, $parser_options = array(), $modify_vars = array() ){ |
|
141 | + public static function Regen($less_files, $parser_options = array(), $modify_vars = array()) { |
|
142 | 142 | $parser_options['use_cache'] = false; |
143 | - return self::Get( $less_files, $parser_options, $modify_vars ); |
|
143 | + return self::Get($less_files, $parser_options, $modify_vars); |
|
144 | 144 | } |
145 | 145 | |
146 | - public static function Cache( &$less_files, $parser_options = array() ){ |
|
146 | + public static function Cache(&$less_files, $parser_options = array()) { |
|
147 | 147 | |
148 | 148 | |
149 | 149 | // get less.php if it exists |
150 | - $file = dirname(__FILE__) . '/Less.php'; |
|
151 | - if( file_exists($file) && !class_exists('Less_Parser') ){ |
|
150 | + $file = dirname(__FILE__).'/Less.php'; |
|
151 | + if (file_exists($file) && !class_exists('Less_Parser')) { |
|
152 | 152 | require_once($file); |
153 | 153 | } |
154 | 154 | |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | |
158 | 158 | |
159 | 159 | // combine files |
160 | - foreach($less_files as $file_path => $uri_or_less ){ |
|
160 | + foreach ($less_files as $file_path => $uri_or_less) { |
|
161 | 161 | |
162 | 162 | //treat as less markup if there are newline characters |
163 | - if( strpos($uri_or_less,"\n") !== false ){ |
|
164 | - $parser->Parse( $uri_or_less ); |
|
163 | + if (strpos($uri_or_less, "\n")!==false) { |
|
164 | + $parser->Parse($uri_or_less); |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | |
168 | - $parser->ParseFile( $file_path, $uri_or_less ); |
|
168 | + $parser->ParseFile($file_path, $uri_or_less); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | $compiled = $parser->getCss(); |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | |
180 | - private static function OutputFile( $compiled_name, $parser_options ){ |
|
180 | + private static function OutputFile($compiled_name, $parser_options) { |
|
181 | 181 | |
182 | 182 | //custom output file |
183 | - if( !empty($parser_options['output']) ){ |
|
183 | + if (!empty($parser_options['output'])) { |
|
184 | 184 | |
185 | 185 | //relative to cache directory? |
186 | - if( preg_match('#[\\\\/]#',$parser_options['output']) ){ |
|
186 | + if (preg_match('#[\\\\/]#', $parser_options['output'])) { |
|
187 | 187 | return $parser_options['output']; |
188 | 188 | } |
189 | 189 | |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | - private static function CompiledName( $files ){ |
|
197 | + private static function CompiledName($files) { |
|
198 | 198 | |
199 | 199 | //save the file list |
200 | 200 | $temp = array(Less_Version::cache_version); |
201 | - foreach($files as $file){ |
|
201 | + foreach ($files as $file) { |
|
202 | 202 | $temp[] = filemtime($file)."\t".filesize($file)."\t".$file; |
203 | 203 | } |
204 | 204 | |
@@ -206,24 +206,24 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | - public static function SetCacheDir( $dir ){ |
|
209 | + public static function SetCacheDir($dir) { |
|
210 | 210 | Less_Cache::$cache_dir = $dir; |
211 | 211 | } |
212 | 212 | |
213 | - public static function CheckCacheDir(){ |
|
213 | + public static function CheckCacheDir() { |
|
214 | 214 | |
215 | - Less_Cache::$cache_dir = str_replace('\\','/',Less_Cache::$cache_dir); |
|
216 | - Less_Cache::$cache_dir = rtrim(Less_Cache::$cache_dir,'/').'/'; |
|
215 | + Less_Cache::$cache_dir = str_replace('\\', '/', Less_Cache::$cache_dir); |
|
216 | + Less_Cache::$cache_dir = rtrim(Less_Cache::$cache_dir, '/').'/'; |
|
217 | 217 | |
218 | - if( !file_exists(Less_Cache::$cache_dir) ){ |
|
219 | - if( !mkdir(Less_Cache::$cache_dir) ){ |
|
218 | + if (!file_exists(Less_Cache::$cache_dir)) { |
|
219 | + if (!mkdir(Less_Cache::$cache_dir)) { |
|
220 | 220 | throw new Less_Exception_Parser('Less.php cache directory couldn\'t be created: '.Less_Cache::$cache_dir); |
221 | 221 | } |
222 | 222 | |
223 | - }elseif( !is_dir(Less_Cache::$cache_dir) ){ |
|
223 | + }elseif (!is_dir(Less_Cache::$cache_dir)) { |
|
224 | 224 | throw new Less_Exception_Parser('Less.php cache directory doesn\'t exist: '.Less_Cache::$cache_dir); |
225 | 225 | |
226 | - }elseif( !is_writable(Less_Cache::$cache_dir) ){ |
|
226 | + }elseif (!is_writable(Less_Cache::$cache_dir)) { |
|
227 | 227 | throw new Less_Exception_Parser('Less.php cache directory isn\'t writable: '.Less_Cache::$cache_dir); |
228 | 228 | |
229 | 229 | } |
@@ -235,53 +235,53 @@ discard block |
||
235 | 235 | * Delete unused less.php files |
236 | 236 | * |
237 | 237 | */ |
238 | - public static function CleanCache(){ |
|
238 | + public static function CleanCache() { |
|
239 | 239 | static $clean = false; |
240 | 240 | |
241 | - if( $clean ){ |
|
241 | + if ($clean) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | 245 | $files = scandir(Less_Cache::$cache_dir); |
246 | - if( $files ){ |
|
247 | - $check_time = time() - self::$gc_lifetime; |
|
248 | - foreach($files as $file){ |
|
246 | + if ($files) { |
|
247 | + $check_time = time()-self::$gc_lifetime; |
|
248 | + foreach ($files as $file) { |
|
249 | 249 | |
250 | 250 | // don't delete if the file wasn't created with less.php |
251 | - if( strpos($file,Less_Cache::$prefix) !== 0 ){ |
|
251 | + if (strpos($file, Less_Cache::$prefix)!==0) { |
|
252 | 252 | continue; |
253 | 253 | } |
254 | 254 | |
255 | - $full_path = Less_Cache::$cache_dir . $file; |
|
255 | + $full_path = Less_Cache::$cache_dir.$file; |
|
256 | 256 | |
257 | 257 | // make sure the file still exists |
258 | 258 | // css files may have already been deleted |
259 | - if( !file_exists($full_path) ){ |
|
259 | + if (!file_exists($full_path)) { |
|
260 | 260 | continue; |
261 | 261 | } |
262 | 262 | $mtime = filemtime($full_path); |
263 | 263 | |
264 | 264 | // don't delete if it's a relatively new file |
265 | - if( $mtime > $check_time ){ |
|
265 | + if ($mtime>$check_time) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | - $parts = explode('.',$file); |
|
269 | + $parts = explode('.', $file); |
|
270 | 270 | $type = array_pop($parts); |
271 | 271 | |
272 | 272 | |
273 | 273 | // delete css files based on the list files |
274 | - if( $type === 'css' ){ |
|
274 | + if ($type==='css') { |
|
275 | 275 | continue; |
276 | 276 | } |
277 | 277 | |
278 | 278 | |
279 | 279 | // delete the list file and associated css file |
280 | - if( $type === 'list' ){ |
|
280 | + if ($type==='list') { |
|
281 | 281 | self::ListFiles($full_path, $list, $css_file_name); |
282 | - if( $css_file_name ){ |
|
283 | - $css_file = Less_Cache::$cache_dir . $css_file_name; |
|
284 | - if( file_exists($css_file) ){ |
|
282 | + if ($css_file_name) { |
|
283 | + $css_file = Less_Cache::$cache_dir.$css_file_name; |
|
284 | + if (file_exists($css_file)) { |
|
285 | 285 | unlink($css_file); |
286 | 286 | } |
287 | 287 | } |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | * Get the list of less files and generated css file from a list file |
300 | 300 | * |
301 | 301 | */ |
302 | - static function ListFiles($list_file, &$list, &$css_file_name ){ |
|
302 | + static function ListFiles($list_file, &$list, &$css_file_name) { |
|
303 | 303 | |
304 | - $list = explode("\n",file_get_contents($list_file)); |
|
304 | + $list = explode("\n", file_get_contents($list_file)); |
|
305 | 305 | |
306 | 306 | //pop the cached name that should match $compiled_name |
307 | 307 | $css_file_name = array_pop($list); |
308 | 308 | |
309 | - if( !preg_match('/^' . Less_Cache::$prefix . '[a-f0-9]+\.css$/',$css_file_name) ){ |
|
309 | + if (!preg_match('/^'.Less_Cache::$prefix.'[a-f0-9]+\.css$/', $css_file_name)) { |
|
310 | 310 | $list[] = $css_file_name; |
311 | 311 | $css_file_name = false; |
312 | 312 | } |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | class ContentController extends AbstractContentController { |
40 | 40 | |
41 | - /** |
|
42 | - * @return void |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @return void |
|
43 | + */ |
|
44 | 44 | protected function initializeOverriddenSettings() { |
45 | 45 | $record = $this->getRecord(); |
46 | 46 | $useTypoScriptOptionFromForm = $this->provider->getForm($record)->getOption('useTypoScript'); |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | |
114 | 114 | } |
115 | 115 | |
116 | - /** |
|
117 | - * @return string |
|
118 | - */ |
|
116 | + /** |
|
117 | + * @return string |
|
118 | + */ |
|
119 | 119 | public function progressBarAction() { |
120 | 120 | |
121 | 121 | } |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | |
163 | 163 | } |
164 | 164 | |
165 | - /** |
|
166 | - * @return string |
|
167 | - */ |
|
165 | + /** |
|
166 | + * @return string |
|
167 | + */ |
|
168 | 168 | public function fourColumnAction() { |
169 | 169 | |
170 | 170 | } |
171 | 171 | |
172 | - /** |
|
173 | - * @return string |
|
174 | - */ |
|
175 | - public function imageGalleryAction() { |
|
172 | + /** |
|
173 | + * @return string |
|
174 | + */ |
|
175 | + public function imageGalleryAction() { |
|
176 | 176 | |
177 | - } |
|
177 | + } |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | \ No newline at end of file |
@@ -44,7 +44,7 @@ |
||
44 | 44 | protected function initializeOverriddenSettings() { |
45 | 45 | $record = $this->getRecord(); |
46 | 46 | $useTypoScriptOptionFromForm = $this->provider->getForm($record)->getOption('useTypoScript'); |
47 | - if (NULL !== $useTypoScriptOptionFromForm) { |
|
47 | + if (NULL!==$useTypoScriptOptionFromForm) { |
|
48 | 48 | $this->settings['useTypoScript'] = (boolean)$useTypoScriptOptionFromForm; |
49 | 49 | } |
50 | 50 | parent::initializeOverriddenSettings(); |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | $generalSettings = $this->configurationService->convertFlexFormContentToArray($row['pi_flexform'], $form); |
63 | 63 | $contentSettings = $this->configurationService->convertFlexFormContentToArray($row['content_options'], $form); |
64 | 64 | $this->settings = RecursiveArrayUtility::merge($this->settings, $generalSettings, FALSE, FALSE); |
65 | - if (FALSE === isset($this->settings['content'])) { |
|
65 | + if (FALSE===isset($this->settings['content'])) { |
|
66 | 66 | $this->settings['content'] = $contentSettings; |
67 | - } else { |
|
67 | + }else { |
|
68 | 68 | $this->settings['content'] = RecursiveArrayUtility::merge($this->settings['content'], $contentSettings); |
69 | 69 | } |
70 | 70 | parent::initializeViewVariables(); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $bindings = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( |
146 | 146 | 'uid_foreign', |
147 | 147 | 'sys_category_record_mm', |
148 | - "fieldname = 'categories' AND tablenames = 'pages' AND uid_local IN (" . $selected . ')', |
|
148 | + "fieldname = 'categories' AND tablenames = 'pages' AND uid_local IN (".$selected.')', |
|
149 | 149 | 'uid_foreign', |
150 | 150 | 'sorting ASC' |
151 | 151 | ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $bindings = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( |
158 | 158 | 'uid_foreign', |
159 | 159 | 'sys_category_record_mm', |
160 | - "fieldname = 'categories' AND tablenames = 'tt_content' AND uid_local IN (" . $selected . ')', |
|
160 | + "fieldname = 'categories' AND tablenames = 'tt_content' AND uid_local IN (".$selected.')', |
|
161 | 161 | 'uid_foreign', |
162 | 162 | 'sorting ASC' |
163 | 163 | ); |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | break; |
167 | 167 | case CoreContentProvider::MENU_RELATEDPAGES: |
168 | 168 | $whereKeywords = $this->getWhereQueryForKeywords($record); |
169 | - $selectedUids = TRUE === empty($record['pages']) ? $record['uid'] : $record['pages']; |
|
170 | - $where = $whereKeywords . ' AND uid NOT IN (' . $selectedUids . ')'; |
|
169 | + $selectedUids = TRUE===empty($record['pages']) ? $record['uid'] : $record['pages']; |
|
170 | + $where = $whereKeywords.' AND uid NOT IN ('.$selectedUids.')'; |
|
171 | 171 | $bindings = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( |
172 | 172 | 'uid', |
173 | 173 | 'pages', |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public function shortcutAction() { |
189 | 189 | $record = $this->getRecord(); |
190 | 190 | $contentUids = array_map(function($index) { |
191 | - if (0 !== strpos($index, 'tt_content_') && FALSE === MathUtility::canBeInterpretedAsInteger($index)) { |
|
191 | + if (0!==strpos($index, 'tt_content_') && FALSE===MathUtility::canBeInterpretedAsInteger($index)) { |
|
192 | 192 | return FALSE; |
193 | 193 | } |
194 | 194 | return str_replace('tt_content_', '', $index); |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | */ |
218 | 218 | protected function getWhereQueryForKeywords($record) { |
219 | 219 | $selectedUids = $record['pages']; |
220 | - if (TRUE == empty($selectedUids)) { |
|
220 | + if (TRUE==empty($selectedUids)) { |
|
221 | 221 | $selectedUids = $record['pid']; |
222 | 222 | } |
223 | 223 | $keywordsRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( |
224 | 224 | 'keywords', |
225 | 225 | 'pages', |
226 | - 'uid IN (' . $selectedUids . ')', |
|
226 | + 'uid IN ('.$selectedUids.')', |
|
227 | 227 | '', |
228 | 228 | 'sorting ASC' |
229 | 229 | ); |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | foreach ($keywordsArray as $word) { |
235 | 235 | $word = trim($word); |
236 | 236 | if ($word) { |
237 | - $keyWordsWhereArr[] = 'keywords LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($word, 'pages') . '%\''; |
|
237 | + $keyWordsWhereArr[] = 'keywords LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($word, 'pages').'%\''; |
|
238 | 238 | } |
239 | 239 | } |
240 | - $where = empty($keyWordsWhereArr) ? '' : '(' . implode(' OR ', $keyWordsWhereArr) . ')'; |
|
240 | + $where = empty($keyWordsWhereArr) ? '' : '('.implode(' OR ', $keyWordsWhereArr).')'; |
|
241 | 241 | return $where; |
242 | 242 | } |
243 | 243 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function execute(&$params, &$pagerenderer) { |
42 | 42 | |
43 | - if (TYPO3_MODE !== 'FE' || !is_array($params['cssFiles'])) { |
|
43 | + if (TYPO3_MODE!=='FE' || !is_array($params['cssFiles'])) { |
|
44 | 44 | return; |
45 | 45 | } |
46 | 46 | $files = array(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if ($compiledFile) { |
50 | 50 | $settings['file'] = $compiledFile; |
51 | 51 | $files[$compiledFile] = $settings; |
52 | - } else { |
|
52 | + }else { |
|
53 | 53 | $files[$file] = $settings; |
54 | 54 | } |
55 | 55 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | * WizardItems Hook Subscriber |
8 | 8 | */ |
9 | 9 | class WizardItemsHookSubscriber extends \FluidTYPO3\Fluidcontent\Hooks\WizardItemsHookSubscriber implements NewContentElementWizardHookInterface { |
10 | - /** |
|
11 | - * @param array $items |
|
12 | - * @param NewContentElementController $parentObject |
|
13 | - * @return void |
|
14 | - */ |
|
15 | - public function manipulateWizardItems(&$items, &$parentObject) { |
|
16 | - parent::manipulateWizardItems($items, $parentObject); |
|
17 | - } |
|
10 | + /** |
|
11 | + * @param array $items |
|
12 | + * @param NewContentElementController $parentObject |
|
13 | + * @return void |
|
14 | + */ |
|
15 | + public function manipulateWizardItems(&$items, &$parentObject) { |
|
16 | + parent::manipulateWizardItems($items, $parentObject); |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -109,8 +109,8 @@ |
||
109 | 109 | ); |
110 | 110 | |
111 | 111 | /** |
112 | - * @var ConfigurationService |
|
113 | - */ |
|
112 | + * @var ConfigurationService |
|
113 | + */ |
|
114 | 114 | protected $configurationService; |
115 | 115 | |
116 | 116 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return boolean |
144 | 144 | */ |
145 | 145 | public function trigger(array $row, $table, $field, $extensionKey = NULL) { |
146 | - return ($table === $this->tableName && ($field === $this->fieldName || NULL === $field)); |
|
146 | + return ($table===$this->tableName && ($field===$this->fieldName || NULL===$field)); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | * @return Form |
152 | 152 | */ |
153 | 153 | public function getForm(array $row) { |
154 | - if (self::CTYPE_MENU === $row[self::CTYPE_FIELDNAME]) { |
|
154 | + if (self::CTYPE_MENU===$row[self::CTYPE_FIELDNAME]) { |
|
155 | 155 | // addtional menu variables |
156 | 156 | $menuType = $row[self::MENUTYPE_FIELDNAME]; |
157 | 157 | $partialTemplateName = $this->menuTypeToSectionNameMap[$menuType]; |
158 | 158 | $this->templateVariables['menuPartialTemplateName'] = $partialTemplateName; |
159 | 159 | $this->templateVariables['pageUids'] = GeneralUtility::trimExplode(',', $row['pages']); |
160 | 160 | } |
161 | - if (self::CTYPE_TABLE == $row[self::CTYPE_FIELDNAME]) { |
|
161 | + if (self::CTYPE_TABLE==$row[self::CTYPE_FIELDNAME]) { |
|
162 | 162 | $this->templateVariables['tableHeadPositions'] = array( |
163 | 163 | self::THEAD_NONE => LocalizationUtility::translate('tableHead.none', 'moox_core'), |
164 | 164 | self::THEAD_TOP => LocalizationUtility::translate('tableHead.top', 'moox_core'), |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function getExtensionKey(array $row) { |
176 | 176 | $extensionKey = $this->extensionKey; |
177 | - if (FALSE === empty($row['content_variant'])) { |
|
177 | + if (FALSE===empty($row['content_variant'])) { |
|
178 | 178 | $extensionKey = $row['content_variant']; |
179 | 179 | } |
180 | 180 | return ExtensionNamingUtility::getExtensionKey($extensionKey); |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | $extensionKey = $this->getExtensionKey($row); |
197 | 197 | $variant = $this->getVariant($row); |
198 | 198 | $version = $this->getVersion($row); |
199 | - $registeredTypes = (array) $GLOBALS['TYPO3_CONF_VARS']['DCNGmbH.MooxCore']['types']; |
|
200 | - $templateName = TRUE === in_array($row['CType'], $registeredTypes) ? $row['CType'] : 'default'; |
|
199 | + $registeredTypes = (array)$GLOBALS['TYPO3_CONF_VARS']['DCNGmbH.MooxCore']['types']; |
|
200 | + $templateName = TRUE===in_array($row['CType'], $registeredTypes) ? $row['CType'] : 'default'; |
|
201 | 201 | $template = $this->configurationService->resolveTemplateFileForVariant($extensionKey, $templateName, $variant, $version); |
202 | 202 | return $template; |
203 | 203 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | protected function getVariant(array $row) { |
210 | 210 | $defaults = $this->configurationService->getDefaults(); |
211 | - if (self::MODE_RECORD !== $defaults['mode'] && TRUE === empty($row['content_variant'])) { |
|
211 | + if (self::MODE_RECORD!==$defaults['mode'] && TRUE===empty($row['content_variant'])) { |
|
212 | 212 | return $defaults['variant']; |
213 | 213 | } |
214 | 214 | return $row['content_variant']; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | protected function getVersion(array $row) { |
222 | 222 | $defaults = $this->configurationService->getDefaults(); |
223 | - if (self::MODE_RECORD !== $defaults['mode'] && TRUE === empty($row['content_version'])) { |
|
223 | + if (self::MODE_RECORD!==$defaults['mode'] && TRUE===empty($row['content_version'])) { |
|
224 | 224 | return $defaults['version']; |
225 | 225 | } |
226 | 226 | return $row['content_version']; |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function postProcessRecord($operation, $id, array &$row, DataHandler $reference, array $removals = array()) { |
246 | 246 | $defaults = $this->configurationService->getDefaults(); |
247 | - if (self::MODE_RECORD === $defaults['mode']) { |
|
248 | - if (TRUE === empty($row['content_variant'])) { |
|
247 | + if (self::MODE_RECORD===$defaults['mode']) { |
|
248 | + if (TRUE===empty($row['content_variant'])) { |
|
249 | 249 | $row['content_variant'] = $defaults['variant']; |
250 | 250 | } |
251 | - if (TRUE === empty($row['content_version'])) { |
|
251 | + if (TRUE===empty($row['content_version'])) { |
|
252 | 252 | $row['content_version'] = $defaults['version']; |
253 | 253 | } |
254 | 254 | } |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $paths = parent::getTemplatePaths($row); |
264 | 264 | |
265 | 265 | $variant = $this->getVariant($row); |
266 | - if (FALSE === empty($variant)) { |
|
266 | + if (FALSE===empty($variant)) { |
|
267 | 267 | $extensionKey = ExtensionNamingUtility::getExtensionKey($variant); |
268 | - if (FALSE === empty($extensionKey)) { |
|
268 | + if (FALSE===empty($extensionKey)) { |
|
269 | 269 | $overlayPaths = $this->configurationService->getViewConfigurationForExtensionName($extensionKey); |
270 | 270 | $paths = array_merge_recursive($paths, $overlayPaths); |
271 | 271 | } |
@@ -170,7 +170,7 @@ |
||
170 | 170 | |
171 | 171 | /** |
172 | 172 | * @param array $row |
173 | - * @return string|NULL |
|
173 | + * @return string |
|
174 | 174 | */ |
175 | 175 | public function getExtensionKey(array $row) { |
176 | 176 | $extensionKey = $this->extensionKey; |
@@ -134,17 +134,17 @@ |
||
134 | 134 | public function resolveTemplateFileForVariant($extensionKey, $contentType, $variant = NULL, $version = NULL) { |
135 | 135 | $paths = $this->getViewConfigurationForExtensionName(FALSE === empty($variant) ? $variant : $extensionKey); |
136 | 136 | $templatePaths = new TemplatePaths($paths); |
137 | - $controllerName = 'CoreContent'; |
|
137 | + $controllerName = 'CoreContent'; |
|
138 | 138 | $controllerAction = FALSE === empty($version) ? $contentType . '/' . $version : $contentType; |
139 | 139 | return $templatePaths->resolveTemplateFileForControllerAndActionAndFormat($controllerName, $controllerAction); |
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * @param string $extension |
|
144 | - * @param string $contentType |
|
145 | - * @param string $version |
|
146 | - * @return string |
|
147 | - */ |
|
143 | + * @param string $extension |
|
144 | + * @param string $contentType |
|
145 | + * @param string $version |
|
146 | + * @return string |
|
147 | + */ |
|
148 | 148 | public function getIconFromVersion($extension, $contentType, $version = NULL) { |
149 | 149 | $extensionKey = ExtensionNamingUtility::getExtensionKey($extension); |
150 | 150 | $templatePathAndFilename = $this->resolveTemplateFileForVariant($extensionKey, $contentType, $extension, $version); |
@@ -49,36 +49,36 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function initializeDefaults() { |
51 | 51 | $typoScript = $this->getAllTypoScript(); |
52 | - $this->defaults = (array) $typoScript['plugin']['tx_mooxcore']['settings']['defaults']; |
|
52 | + $this->defaults = (array)$typoScript['plugin']['tx_mooxcore']['settings']['defaults']; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @return void |
57 | 57 | */ |
58 | 58 | protected function initializeVariants() { |
59 | - $variants = (array) $this->getAllRegisteredVariants(); |
|
59 | + $variants = (array)$this->getAllRegisteredVariants(); |
|
60 | 60 | foreach ($variants as $contentType => $registeredVariantExtensions) { |
61 | - if (TRUE === empty($registeredVariantExtensions)) { |
|
61 | + if (TRUE===empty($registeredVariantExtensions)) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 | $this->variants[$contentType] = array(); |
65 | 65 | foreach ($registeredVariantExtensions as $extensionKeyOrArray) { |
66 | 66 | $icon = NULL; |
67 | 67 | $versions = array(); |
68 | - if (TRUE === is_array($extensionKeyOrArray) && 3 === count($extensionKeyOrArray)) { |
|
68 | + if (TRUE===is_array($extensionKeyOrArray) && 3===count($extensionKeyOrArray)) { |
|
69 | 69 | list ($extensionKey, $labelReference, $icon) = $extensionKeyOrArray; |
70 | - } elseif (TRUE === is_array($extensionKeyOrArray) && 2 === count($extensionKeyOrArray)) { |
|
70 | + } elseif (TRUE===is_array($extensionKeyOrArray) && 2===count($extensionKeyOrArray)) { |
|
71 | 71 | list ($extensionKey, $labelReference) = $extensionKeyOrArray; |
72 | - } else { |
|
72 | + }else { |
|
73 | 73 | $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKeyOrArray); |
74 | 74 | $labelReference = 'moox_core.variantLabel'; |
75 | 75 | } |
76 | - $controllerName = 'CoreContent/' . ucfirst($contentType); |
|
76 | + $controllerName = 'CoreContent/'.ucfirst($contentType); |
|
77 | 77 | $paths = $this->getViewConfigurationForExtensionName($extensionKey); |
78 | 78 | $templatePaths = new TemplatePaths($paths); |
79 | 79 | $files = $templatePaths->resolveAvailableTemplateFiles($controllerName); |
80 | 80 | foreach ($files as $file) { |
81 | - $versions[] = basename($file, '.' . TemplatePaths::DEFAULT_FORMAT); |
|
81 | + $versions[] = basename($file, '.'.TemplatePaths::DEFAULT_FORMAT); |
|
82 | 82 | } |
83 | 83 | $versions = array_unique($versions); |
84 | 84 | $this->versions[$contentType] = array($extensionKey => $versions); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return array |
99 | 99 | */ |
100 | 100 | public function getAllRegisteredVariants() { |
101 | - return (array) $GLOBALS['TYPO3_CONF_VARS']['DCNGmbH.MooxCore']['variants']; |
|
101 | + return (array)$GLOBALS['TYPO3_CONF_VARS']['DCNGmbH.MooxCore']['variants']; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @return array |
107 | 107 | */ |
108 | 108 | public function getVariantExtensionKeysForContentType($contentType) { |
109 | - if (TRUE === isset($this->variants[$contentType])) { |
|
109 | + if (TRUE===isset($this->variants[$contentType])) { |
|
110 | 110 | return $this->variants[$contentType]; |
111 | 111 | } |
112 | 112 | return array(); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return array |
119 | 119 | */ |
120 | 120 | public function getVariantVersions($contentType, $variant) { |
121 | - if (TRUE === isset($this->versions[$contentType][$variant])) { |
|
121 | + if (TRUE===isset($this->versions[$contentType][$variant])) { |
|
122 | 122 | return $this->versions[$contentType][$variant]; |
123 | 123 | } |
124 | 124 | return array(); |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | * @return string |
133 | 133 | */ |
134 | 134 | public function resolveTemplateFileForVariant($extensionKey, $contentType, $variant = NULL, $version = NULL) { |
135 | - $paths = $this->getViewConfigurationForExtensionName(FALSE === empty($variant) ? $variant : $extensionKey); |
|
135 | + $paths = $this->getViewConfigurationForExtensionName(FALSE===empty($variant) ? $variant : $extensionKey); |
|
136 | 136 | $templatePaths = new TemplatePaths($paths); |
137 | 137 | $controllerName = 'CoreContent'; |
138 | - $controllerAction = FALSE === empty($version) ? $contentType . '/' . $version : $contentType; |
|
138 | + $controllerAction = FALSE===empty($version) ? $contentType.'/'.$version : $contentType; |
|
139 | 139 | return $templatePaths->resolveTemplateFileForControllerAndActionAndFormat($controllerName, $controllerAction); |
140 | 140 | } |
141 | 141 | |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | $viewContext->setTemplatePaths($templatePaths); |
155 | 155 | $viewContext->setSectionName('Configuration'); |
156 | 156 | $form = FluxService::getFormFromTemplateFile($viewContext); |
157 | - if (FALSE === $form instanceof Form) { |
|
157 | + if (FALSE===$form instanceof Form) { |
|
158 | 158 | return ''; |
159 | - } else { |
|
159 | + }else { |
|
160 | 160 | return MiscellaneousUtility::getIconForTemplate($form); |
161 | 161 | } |
162 | 162 | } |
@@ -10,103 +10,103 @@ |
||
10 | 10 | */ |
11 | 11 | class UpdateService { |
12 | 12 | |
13 | - /** |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $sourceConfigurationLines = array( |
|
17 | - '$GLOBALS[\'TYPO3_CONF_VARS\'][\'FE\'][\'contentRenderingTemplates\'] = array(\'mooxcore/Configuration/TypoScript/\');', |
|
18 | - '$GLOBALS[\'TYPO3_CONF_VARS\'][\'FE\'][\'activateContentAdapter\'] = 0;' |
|
19 | - ); |
|
13 | + /** |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $sourceConfigurationLines = array( |
|
17 | + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'FE\'][\'contentRenderingTemplates\'] = array(\'mooxcore/Configuration/TypoScript/\');', |
|
18 | + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'FE\'][\'activateContentAdapter\'] = 0;' |
|
19 | + ); |
|
20 | 20 | |
21 | - /** |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - protected $targetConfigurationFile = 'typo3conf/AdditionalConfiguration.php'; |
|
21 | + /** |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + protected $targetConfigurationFile = 'typo3conf/AdditionalConfiguration.php'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Constructor |
|
28 | - */ |
|
29 | - public function __construct() { |
|
30 | - $this->targetConfigurationFile = GeneralUtility::getFileAbsFileName($this->targetConfigurationFile); |
|
31 | - } |
|
26 | + /** |
|
27 | + * Constructor |
|
28 | + */ |
|
29 | + public function __construct() { |
|
30 | + $this->targetConfigurationFile = GeneralUtility::getFileAbsFileName($this->targetConfigurationFile); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - protected function getCurrentConfigurationLines() { |
|
37 | - if (FALSE === file_exists($this->targetConfigurationFile)) { |
|
38 | - // We return not a completely empty array but an array containing the |
|
39 | - // expected opening PHP tag; to make sure it ends up in the output. |
|
40 | - return array('<?php'); |
|
41 | - } |
|
42 | - $lines = explode(PHP_EOL, trim(file_get_contents($this->targetConfigurationFile))); |
|
43 | - if (0 === count($lines) || '<?php' !== $lines[0]) { |
|
44 | - array_unshift($lines, '<?php'); |
|
45 | - } |
|
46 | - return $lines; |
|
47 | - } |
|
33 | + /** |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + protected function getCurrentConfigurationLines() { |
|
37 | + if (FALSE === file_exists($this->targetConfigurationFile)) { |
|
38 | + // We return not a completely empty array but an array containing the |
|
39 | + // expected opening PHP tag; to make sure it ends up in the output. |
|
40 | + return array('<?php'); |
|
41 | + } |
|
42 | + $lines = explode(PHP_EOL, trim(file_get_contents($this->targetConfigurationFile))); |
|
43 | + if (0 === count($lines) || '<?php' !== $lines[0]) { |
|
44 | + array_unshift($lines, '<?php'); |
|
45 | + } |
|
46 | + return $lines; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Returns TRUE if either of the expected configuration lines |
|
51 | - * do not currently exist. If both exist, returns FALSE |
|
52 | - * meaning "no need to run the script" |
|
53 | - * |
|
54 | - * NOTE: Is required by the extension manager, do not remove or make protected |
|
55 | - * @api |
|
56 | - * @return boolean |
|
57 | - */ |
|
58 | - public function access() { |
|
59 | - $currentConfiguration = $this->getCurrentConfigurationLines(); |
|
60 | - foreach ($this->sourceConfigurationLines as $expectedConfigurationLine) { |
|
61 | - if (FALSE === in_array($expectedConfigurationLine, $currentConfiguration)) { |
|
62 | - return TRUE; |
|
63 | - } |
|
64 | - } |
|
65 | - return FALSE; |
|
66 | - } |
|
49 | + /** |
|
50 | + * Returns TRUE if either of the expected configuration lines |
|
51 | + * do not currently exist. If both exist, returns FALSE |
|
52 | + * meaning "no need to run the script" |
|
53 | + * |
|
54 | + * NOTE: Is required by the extension manager, do not remove or make protected |
|
55 | + * @api |
|
56 | + * @return boolean |
|
57 | + */ |
|
58 | + public function access() { |
|
59 | + $currentConfiguration = $this->getCurrentConfigurationLines(); |
|
60 | + foreach ($this->sourceConfigurationLines as $expectedConfigurationLine) { |
|
61 | + if (FALSE === in_array($expectedConfigurationLine, $currentConfiguration)) { |
|
62 | + return TRUE; |
|
63 | + } |
|
64 | + } |
|
65 | + return FALSE; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * NOTE: Is required by the extension manager, do not remove or make protected |
|
70 | - * @api |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function main() { |
|
74 | - $this->installAdditionalConfiguration(); |
|
75 | - return 'Additional configuration lines added to AdditionalConfiguration.php'; |
|
76 | - } |
|
68 | + /** |
|
69 | + * NOTE: Is required by the extension manager, do not remove or make protected |
|
70 | + * @api |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function main() { |
|
74 | + $this->installAdditionalConfiguration(); |
|
75 | + return 'Additional configuration lines added to AdditionalConfiguration.php'; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Install expected lines missing from AdditionalConfiguration file |
|
80 | - * |
|
81 | - * @return void |
|
82 | - */ |
|
83 | - protected function installAdditionalConfiguration() { |
|
84 | - $currentConfigurationLines = $this->getCurrentConfigurationLines(); |
|
85 | - // remove trailing empty spaces and closing PHP tag to ensure predictable appending: |
|
86 | - for ($i = count($currentConfigurationLines) - 1; $i--; $i >= 0) { |
|
87 | - $line = trim($currentConfigurationLines[$i]); |
|
88 | - if (TRUE === empty($line) || '?>' === $line) { |
|
89 | - unset($currentConfigurationLines[$i]); |
|
90 | - } |
|
91 | - } |
|
92 | - // add expected lines if they are not found: |
|
93 | - foreach ($this->sourceConfigurationLines as $expectedConfigurationLine) { |
|
94 | - if (FALSE === in_array($expectedConfigurationLine, $currentConfigurationLines)) { |
|
95 | - $currentConfigurationLines[] = $expectedConfigurationLine; |
|
96 | - } |
|
97 | - } |
|
98 | - $this->writeAdditionalConfigurationFile($currentConfigurationLines); |
|
99 | - } |
|
78 | + /** |
|
79 | + * Install expected lines missing from AdditionalConfiguration file |
|
80 | + * |
|
81 | + * @return void |
|
82 | + */ |
|
83 | + protected function installAdditionalConfiguration() { |
|
84 | + $currentConfigurationLines = $this->getCurrentConfigurationLines(); |
|
85 | + // remove trailing empty spaces and closing PHP tag to ensure predictable appending: |
|
86 | + for ($i = count($currentConfigurationLines) - 1; $i--; $i >= 0) { |
|
87 | + $line = trim($currentConfigurationLines[$i]); |
|
88 | + if (TRUE === empty($line) || '?>' === $line) { |
|
89 | + unset($currentConfigurationLines[$i]); |
|
90 | + } |
|
91 | + } |
|
92 | + // add expected lines if they are not found: |
|
93 | + foreach ($this->sourceConfigurationLines as $expectedConfigurationLine) { |
|
94 | + if (FALSE === in_array($expectedConfigurationLine, $currentConfigurationLines)) { |
|
95 | + $currentConfigurationLines[] = $expectedConfigurationLine; |
|
96 | + } |
|
97 | + } |
|
98 | + $this->writeAdditionalConfigurationFile($currentConfigurationLines); |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Wrapping method to write array to file |
|
103 | - * |
|
104 | - * @param array $lines |
|
105 | - * @return void |
|
106 | - */ |
|
107 | - protected function writeAdditionalConfigurationFile(array $lines) { |
|
108 | - $content = implode(PHP_EOL, $lines) . PHP_EOL; |
|
109 | - file_put_contents($this->targetConfigurationFile, $content); |
|
110 | - } |
|
101 | + /** |
|
102 | + * Wrapping method to write array to file |
|
103 | + * |
|
104 | + * @param array $lines |
|
105 | + * @return void |
|
106 | + */ |
|
107 | + protected function writeAdditionalConfigurationFile(array $lines) { |
|
108 | + $content = implode(PHP_EOL, $lines) . PHP_EOL; |
|
109 | + file_put_contents($this->targetConfigurationFile, $content); |
|
110 | + } |
|
111 | 111 | |
112 | 112 | } |
113 | 113 | \ No newline at end of file |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @return array |
35 | 35 | */ |
36 | 36 | protected function getCurrentConfigurationLines() { |
37 | - if (FALSE === file_exists($this->targetConfigurationFile)) { |
|
37 | + if (FALSE===file_exists($this->targetConfigurationFile)) { |
|
38 | 38 | // We return not a completely empty array but an array containing the |
39 | 39 | // expected opening PHP tag; to make sure it ends up in the output. |
40 | 40 | return array('<?php'); |
41 | 41 | } |
42 | 42 | $lines = explode(PHP_EOL, trim(file_get_contents($this->targetConfigurationFile))); |
43 | - if (0 === count($lines) || '<?php' !== $lines[0]) { |
|
43 | + if (0===count($lines) || '<?php'!==$lines[0]) { |
|
44 | 44 | array_unshift($lines, '<?php'); |
45 | 45 | } |
46 | 46 | return $lines; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function access() { |
59 | 59 | $currentConfiguration = $this->getCurrentConfigurationLines(); |
60 | 60 | foreach ($this->sourceConfigurationLines as $expectedConfigurationLine) { |
61 | - if (FALSE === in_array($expectedConfigurationLine, $currentConfiguration)) { |
|
61 | + if (FALSE===in_array($expectedConfigurationLine, $currentConfiguration)) { |
|
62 | 62 | return TRUE; |
63 | 63 | } |
64 | 64 | } |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | protected function installAdditionalConfiguration() { |
84 | 84 | $currentConfigurationLines = $this->getCurrentConfigurationLines(); |
85 | 85 | // remove trailing empty spaces and closing PHP tag to ensure predictable appending: |
86 | - for ($i = count($currentConfigurationLines) - 1; $i--; $i >= 0) { |
|
86 | + for ($i = count($currentConfigurationLines)-1; $i--; $i>=0) { |
|
87 | 87 | $line = trim($currentConfigurationLines[$i]); |
88 | - if (TRUE === empty($line) || '?>' === $line) { |
|
88 | + if (TRUE===empty($line) || '?>'===$line) { |
|
89 | 89 | unset($currentConfigurationLines[$i]); |
90 | 90 | } |
91 | 91 | } |
92 | 92 | // add expected lines if they are not found: |
93 | 93 | foreach ($this->sourceConfigurationLines as $expectedConfigurationLine) { |
94 | - if (FALSE === in_array($expectedConfigurationLine, $currentConfigurationLines)) { |
|
94 | + if (FALSE===in_array($expectedConfigurationLine, $currentConfigurationLines)) { |
|
95 | 95 | $currentConfigurationLines[] = $expectedConfigurationLine; |
96 | 96 | } |
97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return void |
106 | 106 | */ |
107 | 107 | protected function writeAdditionalConfigurationFile(array $lines) { |
108 | - $content = implode(PHP_EOL, $lines) . PHP_EOL; |
|
108 | + $content = implode(PHP_EOL, $lines).PHP_EOL; |
|
109 | 109 | file_put_contents($this->targetConfigurationFile, $content); |
110 | 110 | } |
111 | 111 |