1
0
Fork 0
cl-mod-rewrite/includes/include.mod_rewrite_contenttest.php

86 Zeilen
3,2 KiB
PHP

2019-11-04 15:57:28 +00:00
<?php
/**
* Testscript for Advanced Mod Rewrite Plugin.
*
* The goal of this testscript is to provide an easy way for a variance comparison
* of created SEO URLs against their resolved parts.
*
* This testscript fetches the full category and article structure of actual
* CONTENIDO installation, creates the SEO URLs for each existing category/article
* and resolves the generated URLs.
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: include.mod_rewrite_contenttest.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Murat Purc <murat@purc.de>
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
global $client, $cfg;
################################################################################
##### Initialization
if ((int) $client <= 0) {
2022-03-04 19:16:33 +00:00
// if there is no client selected, display noti
2019-11-04 15:57:28 +00:00
$oPage = new cPage;
2022-03-04 19:16:33 +00:00
$oNoti = new Contenido_Notification();
$oPage->setContent($oNoti->returnNotification("warning", i18n("No client set!")));
2019-11-04 15:57:28 +00:00
$oPage->render();
return;
}
################################################################################
##### Processing
$mrTestNoOptionSelected = false;
if (!mr_getRequest('idart') && !mr_getRequest('idcat') && !mr_getRequest('idcatart') && !mr_getRequest('idartlang')) {
$mrTestNoOptionSelected = true;
}
$oMrTestController = new ModRewrite_ContentTestController();
// view language variables
$oView = $oMrTestController->getView();
2019-12-28 16:11:03 +00:00
$oView->lng_form_info = i18n("Define options to genereate the URLs by using the form below and run the test.", "cl-mod-rewrite");
$oView->lng_form_label = i18n("Parameter to use", "cl-mod-rewrite");
$oView->lng_maxitems_lbl = i18n("Number of URLs to generate", "cl-mod-rewrite");
$oView->lng_run_test = i18n("Run test", "cl-mod-rewrite");
2019-11-04 15:57:28 +00:00
2019-12-28 16:11:03 +00:00
$oView->lng_result_item_tpl = i18n("{pref}<strong>{name}</strong><br>{pref}Builder in: {url_in}<br>{pref}Builder out: {url_out}<br>{pref}<span style='color:{color}'>Resolved URL: {url_res}</span><br>{pref}Resolver err: {err}<br>{pref}Resolved data: {data}", "cl-mod-rewrite");
2019-11-04 15:57:28 +00:00
2019-12-28 16:11:03 +00:00
$oView->lng_result_message_tpl = i18n("Duration of test run: {time} seconds.<br>Number of processed URLs: {num_urls}<br><span style='color:green'>Successful resolved: {num_success}</span><br><span style='color:red'>Errors during resolving: {num_fail}</span></strong>", "cl-mod-rewrite");
2019-11-04 15:57:28 +00:00
################################################################################
##### Action processing
if ($mrTestNoOptionSelected) {
$oMrTestController->indexAction();
} else {
$oMrTestController->testAction();
}
$oView = $oMrTestController->getView();
$oView->content .= mr_debugOutput(false);
################################################################################
##### Output
$oMrTestController->render(
2019-12-28 16:11:03 +00:00
$cfg['path']['contenido'] . $cfg['path']['plugins'] . 'cl-mod-rewrite/templates/contenttest.html'
2019-11-04 15:57:28 +00:00
);