optimize for php8
Dieser Commit ist enthalten in:
Ursprung
e9d44453fb
Commit
606b832ce8
3 geänderte Dateien mit 27 neuen und 49 gelöschten Zeilen
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren