optimize for php8
Dieser Commit ist enthalten in:
Ursprung
e9d44453fb
Commit
606b832ce8
3 geänderte Dateien mit 27 neuen und 49 gelöschten Zeilen
|
@ -77,17 +77,9 @@ class ModRewrite_ContentExpertController extends ModRewrite_ControllerAbstract {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($type == 'restrictive') {
|
||||
$source = $this->_htaccessRestrictive;
|
||||
} else {
|
||||
$source = $this->_htaccessSimple;
|
||||
}
|
||||
$source = $type == 'restrictive' ? $this->_htaccessRestrictive : $this->_htaccessSimple;
|
||||
|
||||
if ($copy == 'contenido') {
|
||||
$dest = $aInfo['contenido_full_path'] . '.htaccess';
|
||||
} else {
|
||||
$dest = $aInfo['client_full_path'] . '.htaccess';
|
||||
}
|
||||
$dest = $copy == 'contenido' ? $aInfo['contenido_full_path'] . '.htaccess' : $aInfo['client_full_path'] . '.htaccess';
|
||||
|
||||
if (!$result = @copy($source, $dest)) {
|
||||
$this->_oView->content_before = $this->_notifyBox('info', 'Die .htaccess konnte nicht von ' . $source . ' nach ' . $dest . ' kopiert werden!');
|
||||
|
@ -108,16 +100,12 @@ class ModRewrite_ContentExpertController extends ModRewrite_ControllerAbstract {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($type == 'restrictive') {
|
||||
$source = $this->_htaccessRestrictive;
|
||||
} else {
|
||||
$source = $this->_htaccessSimple;
|
||||
}
|
||||
$source = $type == 'restrictive' ? $this->_htaccessRestrictive : $this->_htaccessSimple;
|
||||
|
||||
$this->_oView->content = file_get_contents($source);
|
||||
|
||||
header('Content-Type: text/plain');
|
||||
header('Etag: ' . md5(mt_rand()));
|
||||
header('Etag: ' . md5(random_int(0, mt_getrandmax())));
|
||||
header('Content-Disposition: attachment; filename="' . $type . '.htaccess"');
|
||||
$this->render('{CONTENT}');
|
||||
}
|
||||
|
|
|
@ -60,33 +60,25 @@ class ModRewrite_ContentTestController extends ModRewrite_ControllerAbstract {
|
|||
$this->_oView->content = '';
|
||||
|
||||
// Array for testcases
|
||||
$aTests = array();
|
||||
$aTests = [];
|
||||
|
||||
// Instance of mr test
|
||||
$oMRTest = new ModRewriteTest($this->_iMaxItems);
|
||||
$modRewriteTest = new ModRewriteTest($this->_iMaxItems);
|
||||
|
||||
$startTime = getmicrotime();
|
||||
|
||||
// Fetch complete CONTENIDO page structure
|
||||
$aStruct = $oMRTest->fetchFullStructure();
|
||||
$aStruct = $modRewriteTest->fetchFullStructure();
|
||||
ModRewriteDebugger::add($aStruct, 'ModRewrite_ContentTestController::testAction() $aStruct');
|
||||
|
||||
// Loop through the structure and compose testcases
|
||||
foreach ($aStruct as $idcat => $aCat) {
|
||||
foreach ($aStruct as $aCat) {
|
||||
// category
|
||||
$aTests[] = array(
|
||||
'url' => $oMRTest->composeURL($aCat, 'c'),
|
||||
'level' => $aCat['level'],
|
||||
'name' => $aCat['name']
|
||||
);
|
||||
$aTests[] = ['url' => $modRewriteTest->composeURL($aCat, 'c'), 'level' => $aCat['level'], 'name' => $aCat['name']];
|
||||
|
||||
foreach ($aCat['articles'] as $idart => $aArt) {
|
||||
foreach ($aCat['articles'] as $aArt) {
|
||||
// articles
|
||||
$aTests[] = array(
|
||||
'url' => $oMRTest->composeURL($aArt, 'a'),
|
||||
'level' => $aCat['level'],
|
||||
'name' => $aCat['name'] . ' :: ' . $aArt['title']
|
||||
);
|
||||
$aTests[] = ['url' => $modRewriteTest->composeURL($aArt, 'a'), 'level' => $aCat['level'], 'name' => $aCat['name'] . ' :: ' . $aArt['title']];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +88,7 @@ class ModRewrite_ContentTestController extends ModRewrite_ControllerAbstract {
|
|||
$oMRUrlStack = ModRewriteUrlStack::getInstance();
|
||||
|
||||
// first loop to add urls to mr url stack
|
||||
foreach ($aTests as $p => $v) {
|
||||
foreach ($aTests as $v) {
|
||||
$oMRUrlStack->add($v['url']);
|
||||
}
|
||||
|
||||
|
@ -104,15 +96,15 @@ class ModRewrite_ContentTestController extends ModRewrite_ControllerAbstract {
|
|||
$failCounter = 0;
|
||||
|
||||
// second loop to do the rest
|
||||
foreach ($aTests as $p => $v) {
|
||||
$url = mr_buildNewUrl($v['url']);
|
||||
$arr = $oMRTest->resolveUrl($url);
|
||||
foreach ($aTests as $aTest) {
|
||||
$url = mr_buildNewUrl($aTest['url']);
|
||||
$arr = $modRewriteTest->resolveUrl($url);
|
||||
$error = '';
|
||||
$resUrl = $oMRTest->getResolvedUrl();
|
||||
$resUrl = $modRewriteTest->getResolvedUrl();
|
||||
$color = 'green';
|
||||
|
||||
if ($url !== $resUrl) {
|
||||
if ($oMRTest->getRoutingFoundState()) {
|
||||
if ($modRewriteTest->getRoutingFoundState()) {
|
||||
$successCounter++;
|
||||
$resUrl = 'route to -> ' . $resUrl;
|
||||
} else {
|
||||
|
@ -144,18 +136,18 @@ class ModRewrite_ContentTestController extends ModRewrite_ControllerAbstract {
|
|||
}
|
||||
}
|
||||
|
||||
$pref = str_repeat(' ', $v['level']);
|
||||
$pref = str_repeat(' ', $aTest['level']);
|
||||
|
||||
// render resolve information for current item
|
||||
$itemTpl = $this->_oView->lng_result_item_tpl;
|
||||
$itemTpl = str_replace('{pref}', $pref, $itemTpl);
|
||||
$itemTpl = str_replace('{name}', $v['name'], $itemTpl);
|
||||
$itemTpl = str_replace('{url_in}', $v['url'], $itemTpl);
|
||||
$itemTpl = str_replace('{name}', $aTest['name'], $itemTpl);
|
||||
$itemTpl = str_replace('{url_in}', $aTest['url'], $itemTpl);
|
||||
$itemTpl = str_replace('{url_out}', $url, $itemTpl);
|
||||
$itemTpl = str_replace('{color}', $color, $itemTpl);
|
||||
$itemTpl = str_replace('{url_res}', $resUrl, $itemTpl);
|
||||
$itemTpl = str_replace('{err}', $error, $itemTpl);
|
||||
$itemTpl = str_replace('{data}', $oMRTest->getReadableResolvedData($arr), $itemTpl);
|
||||
$itemTpl = str_replace('{data}', $modRewriteTest->getReadableResolvedData($arr), $itemTpl);
|
||||
|
||||
$this->_oView->content .= "\n" . $itemTpl . "\n";
|
||||
}
|
||||
|
|
|
@ -72,13 +72,13 @@ abstract class ModRewrite_ControllerAbstract {
|
|||
* Template file or template string to render
|
||||
* @var string
|
||||
*/
|
||||
protected $_template = null;
|
||||
protected $_template;
|
||||
|
||||
/**
|
||||
* Additional properties list
|
||||
* @var array
|
||||
*/
|
||||
protected $_properties = array();
|
||||
protected $_properties = [];
|
||||
|
||||
/**
|
||||
* Debug flag
|
||||
|
@ -138,20 +138,18 @@ abstract class ModRewrite_ControllerAbstract {
|
|||
/**
|
||||
* Property setter.
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setProperty($key, $value) {
|
||||
public function setProperty($key, mixed $value) {
|
||||
$this->_properties[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Property getter.
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProperty($key, $default = null) {
|
||||
return (isset($this->_properties[$key])) ? $this->_properties[$key] : $default;
|
||||
public function getProperty($key, mixed $default = null) {
|
||||
return $this->_properties[$key] ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,7 +200,7 @@ abstract class ModRewrite_ControllerAbstract {
|
|||
* @param mixed $default The default value
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _getParam($key, $default = null) {
|
||||
protected function _getParam($key, mixed $default = null) {
|
||||
if (isset($_GET[$key])) {
|
||||
return $_GET[$key];
|
||||
} elseif (isset($_POST[$key])) {
|
||||
|
|
Laden …
In neuem Issue referenzieren