Commit 31210939 authored by Fabian Galinski's avatar Fabian Galinski

[BUGFIX] Some XLIFF files aren't found inside of the TYPO3 core extensions.

parent daceb9fc
......@@ -83,10 +83,14 @@ class ConfigurationService extends AbstractService {
$this->extConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['lfeditor']);
// regular expressions
$this->extConfig['searchRegex'] = '/^[a-z0-9_]*locallang[a-z0-9_-]*\.(php|xml|xlf)$/i';
if (!preg_match('/^\/.*\/.*$/', $this->extConfig['searchRegex'])) {
$this->extConfig['searchRegex'] = '/^([a-z0-9_]*locallang[a-z0-9_-]*\.(php|xml)|[^\.]*\.xlf)$/i';
}
if (!preg_match('/^\/.*\/.*$/', $this->extConfig['extIgnore'])) {
$this->extConfig['extIgnore'] = '/^csh_.*$/';
}
$this->extConfig['execBackup'] = TRUE;
$this->extConfig['viewSysExt'] = TRUE;
$this->extConfig['viewGlobalExt'] = TRUE;
......
<?php
namespace SGalinski\Lfeditor\Service;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class SGalinski\SgRoutes\Service\LicensingService
*/
class LicensingService {
/**
* Licensing Service Url
*/
const URL = 'https://www.sgalinski.de/?eID=sgLicensing';
/**
* Licensing Service Url
*/
const EXTENSION_KEY = 'lfeditor';
/** @var bool|NULL */
private static $isLicenseKeyValid;
/**
* @return boolean
*/
public static function checkKey(): bool {
if (static::$isLicenseKeyValid === NULL) {
static::$isLicenseKeyValid = FALSE;
$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::EXTENSION_KEY], [FALSE]);
if (isset($configuration['key']) && $key = trim($configuration['key'])) {
static::$isLicenseKeyValid = (bool) preg_match('/^([A-Z\d]{6}-?){4}$/', $key);
}
}
return static::$isLicenseKeyValid;
}
/**
* Licensing Service ping
*
* @param boolean $returnUrl
* @return string
*/
public static function ping($returnUrl = FALSE): string {
try {
$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::EXTENSION_KEY], [FALSE]);
$key = '';
if (isset($configuration['key'])) {
$key = trim($configuration['key']);
}
$params = [
'extension' => self::EXTENSION_KEY,
'host' => GeneralUtility::getIndpEnv('HTTP_HOST'),
'key' => $key
];
$params = http_build_query($params);
$pingUrl = self::URL;
$pingUrl .= $params !== '' ? (strpos($pingUrl, '?') === FALSE ? '?' : '&') . $params : '';
if ($returnUrl) {
return $pingUrl;
}
GeneralUtility::getUrl($pingUrl);
} catch (\Exception $exception) {
}
return '';
}
/**
* Generates a random password string based on the configured password policies.
*
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @return ResponseInterface
* @throws \InvalidArgumentException
*/
public function ajaxPing(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface {
/** @var BackendUserAuthentication $backendUser */
$backendUser = $GLOBALS['BE_USER'];
$moduleKey = 'tools_beuser/index.php/user-LfeditorLfeditor_pinged';
if ($backendUser && !$backendUser->getModuleData($moduleKey, 'ses')) {
$backendUser->pushModuleData($moduleKey, TRUE);
self::ping();
}
return $response;
}
}
<?php
return [
'lfeditor::ajaxPing' => [
'path' => '/lfeditor/ajaxPing',
'target' => SGalinski\Lfeditor\Service\LicensingService::class . '::ajaxPing',
]
];
......@@ -151,3 +151,9 @@ function saveOnKeyDown(eventParameter) {
}
document.onkeydown = saveOnKeyDown;
(function($) {
$(document).ready(function() {
$.get(TYPO3.settings.ajaxUrls['lfeditor::ajaxPing']);
});
})(TYPO3.jQuery);
......@@ -6,7 +6,10 @@ viewLanguages =
# cat=basic; type=string; label=Default language: If 'en' is not default language in TYPO3 BE, default language must be defined here (e.g. de).
defaultLanguage =
# cat=basic; type=string; label=Ignore extensions: Regular expression which limits the extension key list.
# cat=basic; type=string; label=This is the search pattern, which is in charge for finding all language files. Including legacy files.
searchRegex = /^([a-z0-9_]*locallang[a-z0-9_-]*\.(php|xml)|[^\.]*\.xlf)$/i
# cat=basic; type=string; label=Ignore extensions: Regular expression which limits the extension key list. An example for blacklist specific extensions, from the extension select box, would be the following pattern: /^(gridelements|lfeditor|CVS|.svn|.git|csh_)/
extIgnore = /^(CVS|.svn|.git|csh_)/
# cat=basic; type=boolean; label=Change XLF date: If set to TRUE, LFEditor will change the date in XLF files on each change.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment