Use root namespace

This commit is contained in:
Dennis Eichhorn 2018-05-30 13:39:00 +02:00
parent da455933dd
commit a72f336040
7 changed files with 30 additions and 24 deletions

View File

@ -38,7 +38,7 @@ class Navigation
*/ */
public static function install(string $path = null, DatabasePool $dbPool = null) : void public static function install(string $path = null, DatabasePool $dbPool = null) : void
{ {
$navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true); $navData = \json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);
$class = '\\Modules\\Navigation\\Admin\\Installer'; $class = '\\Modules\\Navigation\\Admin\\Installer';
/** @var $class \Modules\Navigation\Admin\Installer */ /** @var $class \Modules\Navigation\Admin\Installer */

View File

@ -297,8 +297,8 @@ final class Controller extends ModuleAbstract implements WebInterface
private static function normalizeDbPath(string $path) : string private static function normalizeDbPath(string $path) : string
{ {
return str_replace('\\', '/', return \str_replace('\\', '/',
str_replace(realpath(__DIR__ . '/../../'), '', \str_replace(realpath(__DIR__ . '/../../'), '',
rtrim($path, '/') rtrim($path, '/')
) )
); );

View File

@ -269,7 +269,7 @@ class Media
*/ */
public function setPath(string $path) public function setPath(string $path)
{ {
$this->path = str_replace('\\', '/', $path); $this->path = \str_replace('\\', '/', $path);
} }
/** /**

View File

@ -26,7 +26,7 @@ class MediaMapper extends DataMapperAbstract
/** /**
* Columns. * Columns.
* *
* @var array * @var array<string, array<string, string>>
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $columns = [ protected static $columns = [

View File

@ -48,7 +48,7 @@ class UploadFile
/** /**
* Allowed mime types. * Allowed mime types.
* *
* @var array * @var string[]
* @since 1.0.0 * @since 1.0.0
*/ */
private $allowedTypes = []; private $allowedTypes = [];
@ -135,14 +135,14 @@ class UploadFile
$this->fileName = $f['name']; $this->fileName = $f['name'];
} }
$split = explode('.', $f['name']); $split = \explode('.', $f['name']);
$result[$key]['name'] = $split[0]; $result[$key]['name'] = $split[0];
$extension = count($split) > 1 ? $split[count($split) - 1] : ''; $extension = count($split) > 1 ? $split[count($split) - 1] : '';
$result[$key]['extension'] = $extension; $result[$key]['extension'] = $extension;
// ! and empty same?! // ! and empty same?!
$result[$key]['filename'] = $this->fileName; $result[$key]['filename'] = $this->fileName;
if (!$this->fileName || empty($this->fileName) || file_exists($path . '/' . $this->fileName)) { if (!$this->fileName || empty($this->fileName) || \file_exists($path . '/' . $this->fileName)) {
$rnd = ''; $rnd = '';
$limit = 0; $limit = 0;
@ -183,7 +183,7 @@ class UploadFile
return $result; return $result;
} }
if ($this->interlaced && in_array($extension, ['png', 'jpg', 'jpeg', 'gif'])) { if ($this->interlaced && \in_array($extension, ['png', 'jpg', 'jpeg', 'gif'])) {
$this->interlace($extension, $dest); $this->interlace($extension, $dest);
} }
@ -276,7 +276,7 @@ class UploadFile
} }
/** /**
* @param int $maxSize * @param int $maxSize Max allowed file size
* *
* @return void * @return void
* *
@ -288,7 +288,7 @@ class UploadFile
} }
/** /**
* @return array * @return string[]
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -298,7 +298,7 @@ class UploadFile
} }
/** /**
* @param array $allowedTypes * @param string[] $allowedTypes Allowed file types
* *
* @return void * @return void
* *
@ -310,7 +310,7 @@ class UploadFile
} }
/** /**
* @param array $allowedTypes * @param string[] $allowedTypes Allowed file types
* *
* @return void * @return void
* *
@ -332,7 +332,9 @@ class UploadFile
} }
/** /**
* @param string $outputDir * Define output directory of the upload
*
* @param string $outputDir Output directory of the uploaded file
* *
* @return void * @return void
* *
@ -354,7 +356,9 @@ class UploadFile
} }
/** /**
* @param string $fileName * Set the file name of the uploaded file
*
* @param string $fileName File name of the uploaded file
* *
* @return void * @return void
* *
@ -366,7 +370,9 @@ class UploadFile
} }
/** /**
* @param bool $preserveFileName * Define if the uploaded file name should be the same file name as the original file
*
* @param bool $preserveFileName Keep file name of the original file
* *
* @return void * @return void
* *

View File

@ -81,8 +81,8 @@ echo $this->getData('nav')->render();
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><i class="fa fa-<?= $this->printHtml($icon); ?>"></i></a> <td><a href="<?= $url; ?>"><i class="fa fa-<?= $this->printHtml($icon); ?>"></i></a>
<td><a href="<?= $url; ?>"><?= substr($value, strlen($media->getPath())); ?></a> <td><a href="<?= $url; ?>"><?= substr($value, strlen($media->getPath())); ?></a>
<td><a href="<?= $url; ?>"><?= !is_dir($value) ? File::extension($value) : 'collection'; ?></a> <td><a href="<?= $url; ?>"><?= !\is_dir($value) ? File::extension($value) : 'collection'; ?></a>
<td><a href="<?= $url; ?>"><?= !is_dir($value) ? File::size($value) : ''; ?></a> <td><a href="<?= $url; ?>"><?= !\is_dir($value) ? File::size($value) : ''; ?></a>
<td><a href="<?= $url; ?>"><?= File::owner($value); ?></a> <td><a href="<?= $url; ?>"><?= File::owner($value); ?></a>
<td><a href="<?= $url; ?>"><?= File::created($value)->format('Y-m-d'); ?></a> <td><a href="<?= $url; ?>"><?= File::created($value)->format('Y-m-d'); ?></a>
<?php endforeach; endif; ?> <?php endforeach; endif; ?>
@ -103,7 +103,7 @@ echo $this->getData('nav')->render();
<?php else : ?> <?php else : ?>
<button class="floatRight">Edit</button> <button class="floatRight">Edit</button>
<?php if (!file_exists($media->isAbsolute() ? $path : __DIR__ . '/../../../../' . $path)) : ?> <?php if (!\file_exists($media->isAbsolute() ? $path : __DIR__ . '/../../../../' . $path)) : ?>
<div class="centerText"><i class="fa fa-question fa-5x"></i></div> <div class="centerText"><i class="fa fa-question fa-5x"></i></div>
<?php else : ?> <?php else : ?>
<pre> <pre>

View File

@ -36,7 +36,7 @@ class MediaView extends View
{ {
if (is_file($media->getPath() . $sub) if (is_file($media->getPath() . $sub)
&& StringUtils::startsWith( && StringUtils::startsWith(
str_replace('\\', '/', realpath($media->getPath() . $sub)), \str_replace('\\', '/', realpath($media->getPath() . $sub)),
$media->getPath() $media->getPath()
) )
) { ) {
@ -50,7 +50,7 @@ class MediaView extends View
{ {
if (is_dir($media->getPath() . $sub) if (is_dir($media->getPath() . $sub)
&& StringUtils::startsWith( && StringUtils::startsWith(
str_replace('\\', '/', realpath($media->getPath() . $sub)), \str_replace('\\', '/', realpath($media->getPath() . $sub)),
$media->getPath() $media->getPath()
) )
) { ) {
@ -65,14 +65,14 @@ class MediaView extends View
return ($media->getExtension() === 'collection' return ($media->getExtension() === 'collection'
&& !is_file($media->getPath() . $sub)) && !is_file($media->getPath() . $sub))
|| (is_dir($media->getPath()) || (is_dir($media->getPath())
&& ($sub === null || is_dir($media->getPath() . $sub)) && ($sub === null || \is_dir($media->getPath() . $sub))
); );
} }
protected function lineContentFunction(string $path) : array protected function lineContentFunction(string $path) : array
{ {
$output = file_get_contents($path); $output = \file_get_contents($path);
$output = str_replace(["\r\n", "\r"], "\n", $output); $output = \str_replace(["\r\n", "\r"], "\n", $output);
return explode("\n", $output); return explode("\n", $output);
} }