mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-28 21:18:46 +02:00
N°8796 - Add PHP code style validation in iTop and extensions - format whole code base
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -37,7 +38,7 @@ use utils;
|
||||
*/
|
||||
class UnauthenticatedWebPage extends NiceWebPage
|
||||
{
|
||||
const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/unauthenticatedwebpage/layout';
|
||||
public const DEFAULT_PAGE_TEMPLATE_REL_PATH = 'pages/backoffice/unauthenticatedwebpage/layout';
|
||||
private $sContent;
|
||||
private $sPanelTitle;
|
||||
private $sPanelIcon;
|
||||
@@ -77,17 +78,17 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
$this->SetContentType('text/html');
|
||||
|
||||
// - bootstrap
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap/js/bootstrap.min.js');
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap/js/bootstrap.min.js');
|
||||
|
||||
// Note: Since 2.6.0 moment was moved from portal to iTop core
|
||||
$this->LinkScriptFromAppRoot('node_modules/moment/min/moment-with-locales.min.js');
|
||||
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js');
|
||||
$this->LinkScriptFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js');
|
||||
|
||||
// CSS files
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap/css/bootstrap.min.css');
|
||||
$this->add_saas(UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH . 'css/bootstrap-theme-combodo.scss');
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css');
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap/css/bootstrap.min.css');
|
||||
$this->add_saas(UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH.'css/bootstrap-theme-combodo.scss');
|
||||
$this->LinkStylesheetFromURI(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL.'lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css');
|
||||
|
||||
// Default theme
|
||||
$this->add_saas('css/unauthenticated.scss');
|
||||
@@ -102,24 +103,22 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
*/
|
||||
private function Init(): void
|
||||
{
|
||||
$this->sPortalBaseFolderRelPath = 'env-' . utils::GetCurrentEnvironment() . '/itop-portal-base/portal/';
|
||||
$this->sPortalSourcesFolderRelPath = $this->sPortalBaseFolderRelPath . 'src/';
|
||||
$this->sPortalPublicFolderRelPath = $this->sPortalBaseFolderRelPath . 'public/';
|
||||
$this->sPortalBaseFolderRelPath = 'env-'.utils::GetCurrentEnvironment().'/itop-portal-base/portal/';
|
||||
$this->sPortalSourcesFolderRelPath = $this->sPortalBaseFolderRelPath.'src/';
|
||||
$this->sPortalPublicFolderRelPath = $this->sPortalBaseFolderRelPath.'public/';
|
||||
|
||||
$this->sPortalBaseFolderAbsPath = APPROOT . $this->sPortalBaseFolderRelPath;
|
||||
$this->sPortalSourcesFolderAbsPath = APPROOT . $this->sPortalSourcesFolderRelPath;
|
||||
$this->sPortalPublicFolderAbsPath = APPROOT . $this->sPortalPublicFolderRelPath;
|
||||
$this->sPortalBaseFolderAbsPath = APPROOT.$this->sPortalBaseFolderRelPath;
|
||||
$this->sPortalSourcesFolderAbsPath = APPROOT.$this->sPortalSourcesFolderRelPath;
|
||||
$this->sPortalPublicFolderAbsPath = APPROOT.$this->sPortalPublicFolderRelPath;
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$this->sPortalPublicFolderAbsUrl = utils::GetAbsoluteUrlModulesRoot().'/itop-portal-base/portal/public/';
|
||||
|
||||
// Constants to be used in the UnauthenticatedWebPage
|
||||
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL'))
|
||||
{
|
||||
if (!defined('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL')) {
|
||||
define('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL', $this->sPortalPublicFolderAbsUrl);
|
||||
}
|
||||
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH'))
|
||||
{
|
||||
if (!defined('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH')) {
|
||||
define('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH', $this->sPortalPublicFolderRelPath);
|
||||
}
|
||||
}
|
||||
@@ -131,7 +130,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
{
|
||||
$this->sContent .= $sHtml;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -179,7 +178,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
'sDeferredContent' => utils::FilterXSS($this->s_deferred_content),
|
||||
'sContent' => $this->sContent,
|
||||
'sPanelIcon' => $this->sPanelIcon,
|
||||
'sPanelTitle' => $this->sPanelTitle
|
||||
'sPanelTitle' => $this->sPanelTitle,
|
||||
];
|
||||
|
||||
$aData['aBlockParams'] = $this->GetBlockParams();
|
||||
@@ -196,7 +195,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
$aData['aPage']['sFaviconUrl'] = $this->GetFaviconAbsoluteUrl();
|
||||
|
||||
$oTwigEnv = TwigHelper::GetTwigEnvironment(BlockRenderer::TWIG_BASE_PATH, BlockRenderer::TWIG_ADDITIONAL_PATHS);
|
||||
|
||||
|
||||
// Render final TWIG into global HTML
|
||||
$sHtml = TwigHelper::RenderTemplate($oTwigEnv, $aData, $this->GetTemplateRelPath());
|
||||
$oKpi->ComputeAndReport(get_class($this).' output');
|
||||
@@ -204,7 +203,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sHtml) / 1024).' Kb)');
|
||||
ExecutionKPI::ReportStats();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays a success message.
|
||||
*
|
||||
@@ -271,7 +270,6 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
@@ -282,8 +280,7 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
// Default theme
|
||||
$this->add_saas('css/unauthenticated.scss');
|
||||
// Custom theme to allow admin to override the default one.
|
||||
if(!empty($this->sCustomThemeUrl))
|
||||
{
|
||||
if (!empty($this->sCustomThemeUrl)) {
|
||||
$this->LinkStylesheetFromURI($this->sCustomThemeUrl);
|
||||
}
|
||||
}
|
||||
@@ -296,4 +293,4 @@ class UnauthenticatedWebPage extends NiceWebPage
|
||||
{
|
||||
return Branding::GetLoginFavIconAbsoluteUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user