Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dakur committed Dec 28, 2024
1 parent f79616f commit dbd5fc1
Show file tree
Hide file tree
Showing 355 changed files with 4,165 additions and 6,935 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,18 @@ jobs:
-i "config/*" \
-i "CoordinatesResolver/*" \
-i "DataContainers/*" \
-i "Filters/*" \
-i "frontend/*" \
-x "frontend/src/*" \
-i "hb-events/*" \
-x "hb-events/src/*" \
-i "images/*" \
-i "log/*" \
-i "Rewrites/*" \
-i "scripts/*" \
-i "template-parts/*" \
-i "UI/*" \
-x "UI/AboutStructure/assets/src/*" \
-x "UI/Contacts/assets/src/*" \
-x "UI/Event/assets/src/*" \
-x "UI/Rentals/assets/src/*" \
-i "vendor/*" \
-i "ApplicationUrlTemplate.php" \
-i "webfonts/*" \
-i "Assets.php" \
-i "archive-novinky.php" \
-i "bootstrap.php" \
Expand Down
28 changes: 0 additions & 28 deletions ApplicationUrlTemplate.php

This file was deleted.

2 changes: 1 addition & 1 deletion Assets.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme;

Expand Down
2 changes: 1 addition & 1 deletion Configuration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme;

Expand Down
40 changes: 3 additions & 37 deletions Container.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme;

Expand All @@ -8,7 +8,6 @@
use HnutiBrontosaurus\BisClient\BisClient;
use HnutiBrontosaurus\BisClient\BisClientFactory;
use HnutiBrontosaurus\Theme\CoordinatesResolver\CoordinatesResolver;
use HnutiBrontosaurus\Theme\UI\Base\BaseFactory;
use Latte\Engine;
use function is_dir;
use function mkdir;
Expand All @@ -23,25 +22,9 @@ public function __construct(
) {}


private ?ApplicationUrlTemplate $applicationUrlTemplate = null;
public function getApplicationUrlTemplate(): ApplicationUrlTemplate
public function getConfiguration(): Configuration
{
if ($this->applicationUrlTemplate !== null) {
return $this->applicationUrlTemplate;
}

return $this->applicationUrlTemplate = ApplicationUrlTemplate::from($this->configuration->get('bis:applicationUrlTemplate'));
}


private ?BaseFactory $baseFactory = null;
public function getBaseFactory(): BaseFactory
{
if ($this->baseFactory !== null) {
return $this->baseFactory;
}

return $this->baseFactory = new BaseFactory($this->getEnableTracking());
return $this->configuration;
}


Expand Down Expand Up @@ -97,23 +80,6 @@ public function getEnableTracking(): bool
}


private ?Engine $latte = null;
public function getLatte(): Engine
{
if ($this->latte !== null) {
return $this->latte;
}

$cachePath = __DIR__ . '/temp/cache/latte';
self::createDirectoryIfNeeded($cachePath);

$latte = new Engine();
$latte->setTempDirectory($cachePath);

return $this->latte = $latte;
}


public function getSentryDsn(): ?string
{
return $this->configuration->has('sentry:dsn') && ($dsn = $this->configuration->get('sentry:dsn')) !== ''
Expand Down
2 changes: 1 addition & 1 deletion CoordinatesResolver/Coordinates.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\CoordinatesResolver;

Expand Down
2 changes: 1 addition & 1 deletion CoordinatesResolver/CoordinatesResolver.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\CoordinatesResolver;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\Courses;
namespace HnutiBrontosaurus\Theme\DataContainers;

use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use HnutiBrontosaurus\BisClient\Event\Response\Event;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use HnutiBrontosaurus\BisClient\Response\ContactPerson;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use HnutiBrontosaurus\BisClient\Event\Response\Event;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use Brick\DateTime\LocalDate;
use Brick\DateTime\TimeZone;
Expand All @@ -10,8 +10,6 @@
use HnutiBrontosaurus\BisClient\Event\Program;
use HnutiBrontosaurus\BisClient\Event\Response\Event;
use HnutiBrontosaurus\BisClient\Event\Response\Tag;
use HnutiBrontosaurus\Theme\UI\Event\EventController;
use HnutiBrontosaurus\Theme\UI\Utils;
use function array_map;
use function get_site_url;
use function implode;
Expand Down Expand Up @@ -56,10 +54,10 @@ public function __construct(Event $event, string $dateFormatHuman, string $dateF
$this->id = $event->getId();
$this->link = sprintf('%s/%s/%d/', // todo: use rather WP routing somehow
rtrim(get_site_url(), '/'),
EventController::PAGE_SLUG,
'akce',
$event->getId(),
);
$this->title = Utils::handleNonBreakingSpaces($event->getName());
$this->title = hb_handleNonBreakingSpaces($event->getName());

$coverPhotoPath = $event->getCoverPhotoPath();
$this->hasCoverPhoto = $coverPhotoPath !== null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use HnutiBrontosaurus\BisClient\Event\Response\Diet;
use HnutiBrontosaurus\BisClient\Event\Response\Event;
use HnutiBrontosaurus\BisClient\Event\Response\Food;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\UI\Utils;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down Expand Up @@ -70,17 +69,17 @@ public static function fromDTO(Event $event): self
$hasPresentation = $text !== null || \count($photos) > 0;

return new self(
Utils::handleNonBreakingSpaces($event->getPropagation()->getInvitationTextIntroduction()),
Utils::handleNonBreakingSpaces($event->getPropagation()->getInvitationTextPracticalInformation()),
hb_handleNonBreakingSpaces($event->getPropagation()->getInvitationTextIntroduction()),
hb_handleNonBreakingSpaces($event->getPropagation()->getInvitationTextPracticalInformation()),

$accommodation !== null,
$accommodation !== null ? Utils::handleNonBreakingSpaces($accommodation) : null,
$accommodation !== null ? hb_handleNonBreakingSpaces($accommodation) : null,

\count($food) > 0,
\array_map(static fn(Diet $food): string => $foodLabels[$food->toScalar()], $food),

$workDescription !== null,
$workDescription !== null ? Utils::handleNonBreakingSpaces($workDescription) : null,
$workDescription !== null ? hb_handleNonBreakingSpaces($workDescription) : null,
$workDays !== null,
$workDays,
$workHoursPerDay !== null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use HnutiBrontosaurus\BisClient\Event\Response\Image;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\UI\Utils;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down Expand Up @@ -35,7 +34,7 @@ public static function fromDTO(?string $text, array $photos): self
{
return new self(
$text !== null,
$text !== null ? Utils::handleNonBreakingSpaces($text) : null,
$text !== null ? hb_handleNonBreakingSpaces($text) : null,
\count($photos) > 0,
\array_map(fn(Image $photo): string => $photo->getMedium(), $photos),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Events;
namespace HnutiBrontosaurus\Theme\DataContainers\Events;

use HnutiBrontosaurus\BisClient\Response\Location;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\UI\Utils;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand All @@ -27,7 +26,7 @@ public static function fromDTO(Location $place): self
{
$coordinates = $place->getCoordinates();
return new self(
Utils::handleNonBreakingSpaces($place->getName()),
hb_handleNonBreakingSpaces($place->getName()),
$coordinates !== null,
$coordinates !== null
? $coordinates->getLatitude() . ' ' . $coordinates->getLongitude() // e.g. 49.132456 16.123456
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\ForChildren;
namespace HnutiBrontosaurus\Theme\DataContainers;


use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers;
namespace HnutiBrontosaurus\Theme\DataContainers;

use HnutiBrontosaurus\BisClient\Event\Response\Event;
use HnutiBrontosaurus\Theme\UI\DataContainers\Events\EventCollectionDC;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\DataContainers\Events\EventCollectionDC;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
11 changes: 5 additions & 6 deletions DataContainers/NewsPost.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\DataContainers;

use DateTimeImmutable;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\UI\Utils;
use HnutiBrontosaurus\Theme\PropertyHandler;
use function get_the_post_thumbnail_url;


Expand Down Expand Up @@ -41,11 +40,11 @@ public static function from(\WP_Post $post): self

return new self(
$post->ID,
Utils::handleNonBreakingSpaces($post->post_title),
hb_handleNonBreakingSpaces($post->post_title),
$post->post_name,
DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $post->post_date),
Utils::handleNonBreakingSpaces($post->post_excerpt),
Utils::handleNonBreakingSpaces($post->post_content),
hb_handleNonBreakingSpaces($post->post_excerpt),
hb_handleNonBreakingSpaces($post->post_content),
$thumbnail !== null,
$thumbnail,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\BaseUnitsAndClubsList;
namespace HnutiBrontosaurus\Theme\DataContainers;

use HnutiBrontosaurus\BisClient\AdministrationUnit\Response\AdministrationUnit;
use HnutiBrontosaurus\Theme\UI\PropertyHandler;
use HnutiBrontosaurus\Theme\PropertyHandler;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
<?php

namespace HnutiBrontosaurus\Theme\UI\DataContainers\Structure;
namespace HnutiBrontosaurus\Theme\DataContainers\Structure;

use HnutiBrontosaurus\BisClient\AdministrationUnit\Response\AdministrationUnit as AdministrationUnitFromClient;
use HnutiBrontosaurus\Theme\CoordinatesResolver\Coordinates;
Expand Down
Loading

0 comments on commit dbd5fc1

Please sign in to comment.