diff --git a/config.yaml.example b/config.yaml.example
index 57b15a5..5422619 100644
--- a/config.yaml.example
+++ b/config.yaml.example
@@ -1,6 +1,7 @@
domain: example.org
cookie_host: .example.org
admin_email: admin@example.org
+ic_email: info@4in1.ws
default_project: 'foreignone'
subdomains:
diff --git a/favicon/favicon.ico b/favicon/favicon.ico
deleted file mode 100644
index 54442e2..0000000
Binary files a/favicon/favicon.ico and /dev/null differ
diff --git a/favicon/favicon.png b/favicon/favicon.png
deleted file mode 100644
index 8e633f8..0000000
Binary files a/favicon/favicon.png and /dev/null differ
diff --git a/htdocs/scss/app/head.scss b/htdocs/scss/app/head.scss
index 622032d..e285211 100644
--- a/htdocs/scss/app/head.scss
+++ b/htdocs/scss/app/head.scss
@@ -87,6 +87,7 @@ a.head-item {
padding: 6px 10px;
margin: 0 0 0 5px;
vertical-align: middle;
+ text-transform: lowercase;
&.is-ic {
color: $link-color;
diff --git a/src/engine/lang/StringsBase.php b/src/engine/lang/StringsBase.php
index 0c2386c..d4e4ea3 100644
--- a/src/engine/lang/StringsBase.php
+++ b/src/engine/lang/StringsBase.php
@@ -36,11 +36,7 @@ class StringsBase implements ArrayAccess
* @return string|string[]
*/
public function offsetGet(mixed $offset): mixed {
- if (!isset($this->data[$offset])) {
- logError(__METHOD__.': '.$offset.' not found');
- return '{'.$offset.'}';
- }
- return $this->data[$offset];
+ return $this->data[$offset] ?? '{'.$offset.'}';
}
/**
diff --git a/src/engine/skin/BaseSkin.php b/src/engine/skin/BaseSkin.php
index 4532463..af07d7b 100644
--- a/src/engine/skin/BaseSkin.php
+++ b/src/engine/skin/BaseSkin.php
@@ -32,6 +32,7 @@ abstract class BaseSkin
$this->twig->addExtension(new SkinTwigExtension($this));
$this->strings = Strings::getInstance(); // why singleton here?
+ $this->strings->load('common');
}
abstract protected function getTwigLoader(): LoaderInterface;
diff --git a/src/engine/skin/FeaturedSkin.php b/src/engine/skin/FeaturedSkin.php
index 57e19fa..9ed4eab 100644
--- a/src/engine/skin/FeaturedSkin.php
+++ b/src/engine/skin/FeaturedSkin.php
@@ -3,6 +3,8 @@
namespace engine\skin;
use app\ThemesUtil;
+use engine\http\HtmlResponse;
+use engine\http\Response;
use engine\skin\TwigAddons\JsTagRuntime;
use engine\skin\TwigAddons\JsTwigExtension;
@@ -79,6 +81,19 @@ abstract class FeaturedSkin
}
}
+ public function renderPage(string $template, array $vars = []): Response {
+ $this->applyGlobals();
+
+ // render body first (in order for all svgPreload() calls to be executed)
+ $b = $this->renderBody($template, $vars);
+
+ // then everything else
+ $h = $this->renderHeader();
+ $f = $this->renderFooter();
+
+ return new HtmlResponse($h.$b.$f);
+ }
+
public function renderBreadCrumbs(array $items, ?string $style = null, bool $mt = false): string {
static $chevron = '';
$buf = implode(array_map(function (array $i) use ($chevron): string {
@@ -211,7 +226,7 @@ HTML;
}
$versions = jsonEncode($versions);
}
- $html .= 'StaticManager.init(\''.$config['commit_hash'].'\', '.jsonEncode($this->styleNames).', '.$versions.');';
+ $html .= 'StaticManager.init(\''.(isDev() ? 'dev' : $config['commit_hash']).'\', '.jsonEncode($this->styleNames).', '.$versions.');';
$html .= 'ThemeSwitcher.init();';
if (!empty($this->exportedStrings)) {
diff --git a/src/engine_functions.php b/src/engine_functions.php
index c1b7112..d203c31 100644
--- a/src/engine_functions.php
+++ b/src/engine_functions.php
@@ -79,3 +79,8 @@ function isAdmin(): bool {
app\Admin::check();
return app\Admin::getId() != 0;
}
+
+function getExecutionTime(): float {
+ $exec_time = microtime(true) - START_TIME;
+ return round($exec_time, 4);
+}
\ No newline at end of file
diff --git a/src/handlers/ic/BaseHandler.php b/src/handlers/ic/BaseHandler.php
index 80de7e6..e60d254 100644
--- a/src/handlers/ic/BaseHandler.php
+++ b/src/handlers/ic/BaseHandler.php
@@ -12,7 +12,7 @@ abstract class BaseHandler
public function __construct() {
$this->skin = new InvisibleCollegeSkin();
- // $this->skin->strings->load('ic');
+ $this->skin->strings->load('ic');
$this->skin->addStatic(
'css/common.css',
'js/common.js'
diff --git a/src/handlers/ic/MainHandler.php b/src/handlers/ic/MainHandler.php
index 8e48372..60aef19 100644
--- a/src/handlers/ic/MainHandler.php
+++ b/src/handlers/ic/MainHandler.php
@@ -4,7 +4,7 @@ namespace app\ic;
use engine\http\errors\NotFound;
use engine\http\HtmlResponse;
-use engine\http\PlainTextResponse;
+use engine\http\HTTPCode;
class MainHandler
extends BaseHandler
@@ -16,8 +16,16 @@ class MainHandler
public function GET_index() {
if (!isAdmin())
- return new HtmlResponse($this->skin->render('soon.twig'));
+ return new HtmlResponse($this->skin->render('soon.twig'), code: HTTPCode::NotFound);
- return new PlainTextResponse('hello world');
+ $this->skin->meta->title = lang('meta_index_title');
+ $this->skin->meta->description = lang('meta_index_description');
+ $this->skin->meta->url = 'https://'.$_SERVER['HTTP_HOST'].'/';
+ // $this->skin->meta->image = 'https://'.$config['domain'].'/img/4in1-preview.jpg';
+ $this->skin->meta->setSocial('og:type', 'website');
+
+ $this->skin->options->isIndex = true;
+
+ return $this->skin->renderPage('index.twig');
}
}
\ No newline at end of file
diff --git a/src/lib/foreignone/ForeignOneSkin.php b/src/lib/foreignone/ForeignOneSkin.php
index d83b1a4..e350a2c 100644
--- a/src/lib/foreignone/ForeignOneSkin.php
+++ b/src/lib/foreignone/ForeignOneSkin.php
@@ -71,6 +71,7 @@ class ForeignOneSkin
'static_html' => $this->getHeaderStaticTags(),
'svg_html' => $this->getSVGTags(),
'render_options' => $this->options->getOptions(),
+ 'ic_url' => 'https://ic'.(isDev() ? 'dev' : '').'.'.$config['domain'],
'app_config' => [
'domain' => $config['domain'],
'devMode' => isDev(),
@@ -89,18 +90,11 @@ class ForeignOneSkin
protected function renderFooter(): string {
global $config;
-
- $exec_time = microtime(true) - START_TIME;
- $exec_time = round($exec_time, 4);
-
$footer_vars = [
- 'exec_time' => $exec_time,
+ 'exec_time' => getExecutionTime(),
'render_options' => $this->options->getOptions(),
'admin_email' => $config['admin_email'],
- // 'lang_json' => json_encode($this->getLangKeys(), JSON_UNESCAPED_UNICODE),
- // 'static_config' => $this->getStaticConfig(),
'script_html' => $this->getFooterScriptTags(),
- 'this_page_url' => $_SERVER['REQUEST_URI'],
'theme' => ThemesUtil::getUserTheme(),
];
return $this->doRender('footer.twig', $footer_vars);
diff --git a/src/lib/ic/InvisibleCollegeSkin.php b/src/lib/ic/InvisibleCollegeSkin.php
index 65756e1..bc4dd77 100644
--- a/src/lib/ic/InvisibleCollegeSkin.php
+++ b/src/lib/ic/InvisibleCollegeSkin.php
@@ -2,8 +2,8 @@
namespace app\ic;
+use app\foreignone\ForeignOneSkinOptions;
use app\ThemesUtil;
-use engine\http\HtmlResponse;
use engine\http\Response;
use Twig\Loader\FilesystemLoader;
use Twig\Loader\LoaderInterface;
@@ -11,9 +11,23 @@ use Twig\Loader\LoaderInterface;
class InvisibleCollegeSkin
extends \engine\skin\FeaturedSkin
{
+ public InvisibleCollegeSkinOptions $options;
+ public string $title {
+ get {
+ $title = isset($this->title) && $this->title ? $this->title : lang('site_title');
+ if (!$this->options->isIndex)
+ $title = $title.' - '.lang('invisible_college');
+ return $title;
+ }
+
+ set(string $title) {
+ $this->title = $title;
+ }
+ }
+
public function __construct() {
parent::__construct();
-
+ $this->options = new InvisibleCollegeSkinOptions();
}
protected function getTwigLoader(): LoaderInterface {
@@ -27,42 +41,21 @@ class InvisibleCollegeSkin
return $config['skin_cache_'.(isDev() ? 'dev' : 'prod').'_dir'].'/ic';
}
- /*
- public function renderPage(string $template, array $vars = []): Response {
- $this->exportStrings(['4in1']);
- $this->applyGlobals();
-
- // render body first
- $b = $this->renderBody($template, $vars);
-
- // then everything else
- $h = $this->renderHeader();
- $f = $this->renderFooter();
-
- return new HtmlResponse($h.$b.$f);
- }
-
protected function renderHeader(): string {
global $config;
- $body_class = [];
- if ($this->options->fullWidth)
- $body_class[] = 'full-width';
- else if ($this->options->wide)
- $body_class[] = 'wide';
-
$vars = [
'title' => $this->title,
'meta_html' => $this->meta->getHtml(),
'static_html' => $this->getHeaderStaticTags(),
'svg_html' => $this->getSVGTags(),
'render_options' => $this->options->getOptions(),
+ 'home_url' => 'https://'.(isDev() ? 'dev.' : '').$config['domain'],
'app_config' => [
'domain' => $config['domain'],
- 'devMode' => $config['is_dev'],
+ 'devMode' => isDev(),
'cookieHost' => $config['cookie_host'],
],
- 'body_class' => $body_class,
'theme' => ThemesUtil::getUserTheme(),
];
@@ -75,21 +68,13 @@ class InvisibleCollegeSkin
protected function renderFooter(): string {
global $config;
-
- $exec_time = microtime(true) - START_TIME;
- $exec_time = round($exec_time, 4);
-
$footer_vars = [
- 'exec_time' => $exec_time,
+ 'exec_time' => getExecutionTime(),
'render_options' => $this->options->getOptions(),
- 'admin_email' => $config['admin_email'],
- // 'lang_json' => json_encode($this->getLangKeys(), JSON_UNESCAPED_UNICODE),
- // 'static_config' => $this->getStaticConfig(),
+ 'admin_email' => $config['ic_email'],
'script_html' => $this->getFooterScriptTags(),
- 'this_page_url' => $_SERVER['REQUEST_URI'],
'theme' => ThemesUtil::getUserTheme(),
];
return $this->doRender('footer.twig', $footer_vars);
}
- */
}
\ No newline at end of file
diff --git a/src/lib/ic/InvisibleCollegeSkinOptions.php b/src/lib/ic/InvisibleCollegeSkinOptions.php
new file mode 100644
index 0000000..2587be4
--- /dev/null
+++ b/src/lib/ic/InvisibleCollegeSkinOptions.php
@@ -0,0 +1,9 @@
+
-
-
-
+{% if not render_options.inside_admin_interface and not is_dev %}
+ {% include 'metrika.twig' %}
{% endif %}