Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit 0ce24fb9 erstellt von Jan Wennrich's avatar Jan Wennrich
Dateien durchsuchen

style: fix PSR-12 code style violations

Übergeordneter 36a6f00e
No related branches found
No related tags found
3 Merge Requests!14feat: consider overwriting control sub-files,!12Feat quiqqer tooling,!10Add QUIQQER Tooling
Pipeline #10380 fehlgeschlagen mit Phase
in 1 Minute und 13 Sekunden
Dieser Commit ist Teil des Merge Request !10. Hier erstellte Kommentare werden im Kontext dieses Merge Request erstellt.
werden angezeigt mit 72 Ergänzungen und 52 Löschungen
...@@ -55,18 +55,18 @@ class Smarty3 implements QUI\Interfaces\Template\EngineInterface ...@@ -55,18 +55,18 @@ class Smarty3 implements QUI\Interfaces\Template\EngineInterface
public function __construct($admin = false) public function __construct($admin = false)
{ {
// Templates // Templates
QUI\Utils\System\File::mkdir(VAR_DIR.'cache/templates'); QUI\Utils\System\File::mkdir(VAR_DIR . 'cache/templates');
QUI\Utils\System\File::mkdir(VAR_DIR.'cache/compile'); QUI\Utils\System\File::mkdir(VAR_DIR . 'cache/compile');
QUI\Utils\System\File::mkdir(VAR_DIR.'cache/cache'); QUI\Utils\System\File::mkdir(VAR_DIR . 'cache/cache');
if (!\class_exists('\Smarty_Autoloader')) { if (!\class_exists('\Smarty_Autoloader')) {
require OPT_DIR.'smarty/smarty/libs/bootstrap.php'; require OPT_DIR . 'smarty/smarty/libs/bootstrap.php';
} }
$Smarty = new \Smarty(); $Smarty = new \Smarty();
$Smarty->setTemplateDir(VAR_DIR.'cache/templates'); $Smarty->setTemplateDir(VAR_DIR . 'cache/templates');
$Smarty->setCompileDir(VAR_DIR.'cache/compile'); $Smarty->setCompileDir(VAR_DIR . 'cache/compile');
$Smarty->setCacheDir(VAR_DIR.'cache/cache'); $Smarty->setCacheDir(VAR_DIR . 'cache/cache');
$Smarty->compile_check = false; $Smarty->compile_check = false;
...@@ -79,10 +79,10 @@ public function __construct($admin = false) ...@@ -79,10 +79,10 @@ public function __construct($admin = false)
$plugin_dir = $Smarty->getPluginsDir(); $plugin_dir = $Smarty->getPluginsDir();
if ($admin == true) { if ($admin == true) {
$plugin_dir[] = $DIR.'/plugins_qui/'; $plugin_dir[] = $DIR . '/plugins_qui/';
$plugin_dir[] = $DIR.'/plugins_qui_admin/'; $plugin_dir[] = $DIR . '/plugins_qui_admin/';
} else { } else {
$plugin_dir[] = $DIR.'/plugins_qui/'; $plugin_dir[] = $DIR . '/plugins_qui/';
} }
$Smarty->setPluginsDir($plugin_dir); $Smarty->setPluginsDir($plugin_dir);
...@@ -195,7 +195,7 @@ public function fetch($resource_name) ...@@ -195,7 +195,7 @@ public function fetch($resource_name)
} }
$cacheName = \md5( $cacheName = \md5(
$resource_name.'_'.$projectName $resource_name . '_' . $projectName
); );
if (isset(self::$fileCache[$cacheName])) { if (isset(self::$fileCache[$cacheName])) {
...@@ -203,7 +203,7 @@ public function fetch($resource_name) ...@@ -203,7 +203,7 @@ public function fetch($resource_name)
} elseif (\strpos($resource_name, OPT_DIR) !== false) { } elseif (\strpos($resource_name, OPT_DIR) !== false) {
$usr_resource_name = \str_replace( $usr_resource_name = \str_replace(
OPT_DIR, OPT_DIR,
USR_DIR.$projectName.'/lib/', USR_DIR . $projectName . '/lib/',
$resource_name $resource_name
); );
...@@ -213,13 +213,13 @@ public function fetch($resource_name) ...@@ -213,13 +213,13 @@ public function fetch($resource_name)
if (!$this->TemplateParent) { if (!$this->TemplateParent) {
$tpl_resource_name = \str_replace( $tpl_resource_name = \str_replace(
OPT_DIR, OPT_DIR,
OPT_DIR.$template.'/', OPT_DIR . $template . '/',
$resource_name $resource_name
); );
// inheritance // inheritance
} else { } else {
$parentPath = OPT_DIR.$this->TemplateParent->getName().'/'; $parentPath = OPT_DIR . $this->TemplateParent->getName() . '/';
$templatePath = OPT_DIR.$this->TemplatePackage->getName().'/'; $templatePath = OPT_DIR . $this->TemplatePackage->getName() . '/';
if (\strpos($resource_name, $parentPath) === false) { if (\strpos($resource_name, $parentPath) === false) {
// default template // default template
...@@ -272,13 +272,13 @@ public function fetch($resource_name) ...@@ -272,13 +272,13 @@ public function fetch($resource_name)
} elseif (\strpos($resource_name, LIB_DIR) !== false) { } elseif (\strpos($resource_name, LIB_DIR) !== false) {
$usr_resource_name = \str_replace( $usr_resource_name = \str_replace(
LIB_DIR, LIB_DIR,
USR_DIR.$projectName.'/lib/', USR_DIR . $projectName . '/lib/',
$resource_name $resource_name
); );
$tpl_resource_name = \str_replace( $tpl_resource_name = \str_replace(
LIB_DIR, LIB_DIR,
OPT_DIR.$template.'/', OPT_DIR . $template . '/',
$resource_name $resource_name
); );
...@@ -305,7 +305,7 @@ public function fetch($resource_name) ...@@ -305,7 +305,7 @@ public function fetch($resource_name)
$resource_name = $tpl_resource_name; $resource_name = $tpl_resource_name;
} }
QUI\System\Log::addDebug('Engine Template -> '.$resource_name); QUI\System\Log::addDebug('Engine Template -> ' . $resource_name);
try { try {
$this->Smarty->assign([ $this->Smarty->assign([
......
...@@ -32,22 +32,23 @@ public static function fetch($params, $Smarty) ...@@ -32,22 +32,23 @@ public static function fetch($params, $Smarty)
$file = $params['template']; $file = $params['template'];
$Project = QUI::getRewrite()->getProject(); $Project = QUI::getRewrite()->getProject();
if (!empty($params['Template']) if (
!empty($params['Template'])
&& $params['Template'] instanceof QUI\Template && $params['Template'] instanceof QUI\Template
&& \method_exists($params['Template'], 'getTemplatePath') && \method_exists($params['Template'], 'getTemplatePath')
) { ) {
$templatePath = $params['Template']->getTemplatePath(); $templatePath = $params['Template']->getTemplatePath();
} else { } else {
$templatePath = OPT_DIR.$Project->getAttribute('template').'/'; $templatePath = OPT_DIR . $Project->getAttribute('template') . '/';
} }
if (!\file_exists($templatePath)) { if (!\file_exists($templatePath)) {
QUI\System\Log::addError('Template path "'.$templatePath.'" not found.'); QUI\System\Log::addError('Template path "' . $templatePath . '" not found.');
return ''; return '';
} }
$file = $templatePath.$file; $file = $templatePath . $file;
if (!\file_exists($file)) { if (!\file_exists($file)) {
try { try {
...@@ -55,7 +56,7 @@ public static function fetch($params, $Smarty) ...@@ -55,7 +56,7 @@ public static function fetch($params, $Smarty)
$file = \str_replace(OPT_DIR, '', $file); $file = \str_replace(OPT_DIR, '', $file);
$file = \explode(DIRECTORY_SEPARATOR, $file); $file = \explode(DIRECTORY_SEPARATOR, $file);
$package = $file[0].DIRECTORY_SEPARATOR.$file[1]; $package = $file[0] . DIRECTORY_SEPARATOR . $file[1];
$Package = QUI::getPackage($package); $Package = QUI::getPackage($package);
unset($file[0]); unset($file[0]);
...@@ -69,19 +70,19 @@ public static function fetch($params, $Smarty) ...@@ -69,19 +70,19 @@ public static function fetch($params, $Smarty)
return ''; return '';
} }
$file = OPT_DIR. $file = OPT_DIR .
$TemplateParent->getName(). $TemplateParent->getName() .
DIRECTORY_SEPARATOR. DIRECTORY_SEPARATOR .
\implode(DIRECTORY_SEPARATOR, $file); \implode(DIRECTORY_SEPARATOR, $file);
if (!file_exists($file)) { if (!file_exists($file)) {
QUI\System\Log::addError('Template file "'.$file.'" not found.'); QUI\System\Log::addError('Template file "' . $file . '" not found.');
return ''; return '';
} }
} }
} catch (\Exception $Exception) { } catch (\Exception $Exception) {
QUI\System\Log::addError('Template file "'.$file.'" not found.'); QUI\System\Log::addError('Template file "' . $file . '" not found.');
QUI\System\Log::addError($Exception->getMessage()); QUI\System\Log::addError($Exception->getMessage());
return ''; return '';
......
<?php <?php
/** /**
* Smarty plugin * Smarty plugin
* *
...@@ -43,15 +44,15 @@ function smarty_block_cache($params, $content, $Smarty) ...@@ -43,15 +44,15 @@ function smarty_block_cache($params, $content, $Smarty)
return ''; return '';
} }
$cache_dir = VAR_DIR.'cache/templates/'; $cache_dir = VAR_DIR . 'cache/templates/';
// Falls es das Verzeichnis nicht gibt dann erstellen // Falls es das Verzeichnis nicht gibt dann erstellen
if (!\is_dir($cache_dir)) { if (!\is_dir($cache_dir)) {
\QUI\Utils\System\File::mkdir($cache_dir); \QUI\Utils\System\File::mkdir($cache_dir);
} }
$cache_file = $cache_dir.$params['name'].'_'.$Project->getAttribute('name') $cache_file = $cache_dir . $params['name'] . '_' . $Project->getAttribute('name')
.'_'.$Project->getAttribute('lang'); . '_' . $Project->getAttribute('lang');
if (\file_exists($cache_file)) { if (\file_exists($cache_file)) {
$_output = \file_get_contents($cache_file); $_output = \file_get_contents($cache_file);
......
<?php <?php
/** /**
* Smarty {array} function plugin * Smarty {array} function plugin
* *
......
<?php <?php
/** /**
* Smarty {array_sort var=$array assign= sort_flags=} function plugin * Smarty {array_sort var=$array assign= sort_flags=} function plugin
* *
......
<?php <?php
/** /**
* Smarty {array_unset var=$array key=1 assign=} function plugin * Smarty {array_unset var=$array key=1 assign=} function plugin
* *
......
<?php <?php
/** /**
* Smarty Plugin * Smarty Plugin
* *
......
<?php <?php
/** /**
* Smarty Plugin * Smarty Plugin
* *
...@@ -30,27 +31,27 @@ function smarty_function_birthday($params, $Smarty) ...@@ -30,27 +31,27 @@ function smarty_function_birthday($params, $Smarty)
$str = '<select '; $str = '<select ';
if (isset($params['name'])) { if (isset($params['name'])) {
$str .= ' name="'.$params['name'].'"'; $str .= ' name="' . $params['name'] . '"';
} }
if (isset($params['style'])) { if (isset($params['style'])) {
$str .= ' style="'.$params['style'].'"'; $str .= ' style="' . $params['style'] . '"';
} }
$str .= '>'; $str .= '>';
switch ($params['type']) { switch ($params['type']) {
case 'day': case 'day':
$str .= '<option value="">'.$Locale->get('quiqqer/quiqqer', 'day').'</option>'; $str .= '<option value="">' . $Locale->get('quiqqer/quiqqer', 'day') . '</option>';
for ($i = 1; $i < 32; $i++) { for ($i = 1; $i < 32; $i++) {
$str .= '<option value="'.\sprintf("%02d", $i).'" '; $str .= '<option value="' . \sprintf("%02d", $i) . '" ';
if (isset($params['value']) && $params['value'] == $i) { if (isset($params['value']) && $params['value'] == $i) {
$str .= ' selected="selected"'; $str .= ' selected="selected"';
} }
$str .= '>'.\sprintf("%02d", $i).'</option>'; $str .= '>' . \sprintf("%02d", $i) . '</option>';
} }
break; break;
...@@ -72,27 +73,27 @@ function smarty_function_birthday($params, $Smarty) ...@@ -72,27 +73,27 @@ function smarty_function_birthday($params, $Smarty)
]; ];
foreach ($monthList as $value => $month) { foreach ($monthList as $value => $month) {
$str .= '<option value="'.$value.'"'; $str .= '<option value="' . $value . '"';
if (isset($params['value']) && $params['value'] == $value) { if (isset($params['value']) && $params['value'] == $value) {
$str .= ' selected="selected"'; $str .= ' selected="selected"';
} }
$str .= '>'.$month.'</option>'; $str .= '>' . $month . '</option>';
} }
break; break;
case 'year': case 'year':
$str .= '<option value="">'.$Locale->get('quiqqer/quiqqer', 'year').'</option>'; $str .= '<option value="">' . $Locale->get('quiqqer/quiqqer', 'year') . '</option>';
for ($i = 1920, $len = \date('Y') - 1; $len >= $i; $len--) { for ($i = 1920, $len = \date('Y') - 1; $len >= $i; $len--) {
$str .= '<option value="'.$len.'"'; $str .= '<option value="' . $len . '"';
if (isset($params['value']) && $params['value'] == $len) { if (isset($params['value']) && $params['value'] == $len) {
$str .= ' selected="selected"'; $str .= ' selected="selected"';
} }
$str .= '>'.$len.'</option>'; $str .= '>' . $len . '</option>';
} }
break; break;
} }
......
...@@ -34,7 +34,7 @@ function smarty_function_control(array $params, $Smarty): string ...@@ -34,7 +34,7 @@ function smarty_function_control(array $params, $Smarty): string
try { try {
if (!\class_exists($control)) { if (!\class_exists($control)) {
throw new QUI\Exception('Control not found: '.$control); throw new QUI\Exception('Control not found: ' . $control);
} }
/* @var $Control \QUI\Control */ /* @var $Control \QUI\Control */
......
<?php <?php
/** /**
* Smarty plugin * Smarty plugin
* *
...@@ -26,15 +27,15 @@ function smarty_function_include_css($params, &$smarty) ...@@ -26,15 +27,15 @@ function smarty_function_include_css($params, &$smarty)
} }
if (\file_exists($params['cache'])) { if (\file_exists($params['cache'])) {
return '<link rel="StyleSheet" type="text/css" href="'.$params['urlcache'].'" media="screen" />'; return '<link rel="StyleSheet" type="text/css" href="' . $params['urlcache'] . '" media="screen" />';
} }
$css = ''; $css = '';
$i = 0; $i = 0;
while ($params['file'.$i]) { while ($params['file' . $i]) {
if (\file_exists($params['file'.$i])) { if (\file_exists($params['file' . $i])) {
$c = \file_get_contents($params['file'.$i]); $c = \file_get_contents($params['file' . $i]);
$css .= \str_replace(["\r\n", "\n", "\r"], ' ', $c); $css .= \str_replace(["\r\n", "\n", "\r"], ' ', $c);
} }
...@@ -43,5 +44,5 @@ function smarty_function_include_css($params, &$smarty) ...@@ -43,5 +44,5 @@ function smarty_function_include_css($params, &$smarty)
\file_put_contents($params['cache'], $css); \file_put_contents($params['cache'], $css);
return '<link rel="StyleSheet" type="text/css" href="'.$params['urlcache'].'" media="screen" />'; return '<link rel="StyleSheet" type="text/css" href="' . $params['urlcache'] . '" media="screen" />';
} }
<?php <?php
/** /**
* Smarty Plugin * Smarty Plugin
* *
......
<?php <?php
/** /**
* Smarty Plugin * Smarty Plugin
* *
......
...@@ -30,8 +30,10 @@ function smarty_function_locale($params, $Smarty) ...@@ -30,8 +30,10 @@ function smarty_function_locale($params, $Smarty)
$Locale = \QUI::getLocale(); $Locale = \QUI::getLocale();
if (!empty($Smarty->tpl_vars['QUIQQER_LOCALE']) if (
&& !empty($Smarty->tpl_vars['QUIQQER_LOCALE']->value)) { !empty($Smarty->tpl_vars['QUIQQER_LOCALE'])
&& !empty($Smarty->tpl_vars['QUIQQER_LOCALE']->value)
) {
$Locale = $Smarty->tpl_vars['QUIQQER_LOCALE']->value; $Locale = $Smarty->tpl_vars['QUIQQER_LOCALE']->value;
} }
......
...@@ -28,7 +28,7 @@ function smarty_function_object($params, $Smarty) ...@@ -28,7 +28,7 @@ function smarty_function_object($params, $Smarty)
unset($params['assign']); unset($params['assign']);
if (!\count($params)) { if (!\count($params)) {
$Object = new $class; $Object = new $class();
} else { } else {
try { try {
$Reflection = new \ReflectionClass($class); $Reflection = new \ReflectionClass($class);
......
<?php <?php
/** /**
* Smarty Plugin * Smarty Plugin
* *
...@@ -30,7 +31,8 @@ function smarty_function_sentence($params, $smarty) ...@@ -30,7 +31,8 @@ function smarty_function_sentence($params, $smarty)
$text = $params['text']; $text = $params['text'];
if (\strpos($text, '.') === false if (
\strpos($text, '.') === false
&& \strpos($text, '!') === false && \strpos($text, '!') === false
&& \strpos($text, '?') === false && \strpos($text, '?') === false
) { ) {
......
<?php <?php
/** /**
* Smarty plugin * Smarty plugin
* *
......
<?php <?php
/** /**
* Smarty plugin * Smarty plugin
* *
......
<?php <?php
/** /**
* Smarty plugin * Smarty plugin
* *
......
<?php <?php
/** /**
* Smarty Plugin * Smarty Plugin
* *
......
<?php <?php
/** /**
* Smarty Plugin * Smarty Plugin
* *
...@@ -27,7 +28,8 @@ function smarty_function_url($params, $Smarty) ...@@ -27,7 +28,8 @@ function smarty_function_url($params, $Smarty)
$url = ''; $url = '';
$Site = false; $Site = false;
if (isset($params['url']) if (
isset($params['url'])
&& !empty($params['url']) && !empty($params['url'])
&& QUI\Projects\Site\Utils::isSiteLink($params['url']) && QUI\Projects\Site\Utils::isSiteLink($params['url'])
) { ) {
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren