From 0dba82000ea137c7e39dd71db873415b9f1969b8 Mon Sep 17 00:00:00 2001 From: ProklUng Date: Sun, 30 May 2021 09:19:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A7=D0=B8=D1=81=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local/classes/Facades/FilesystemFacade.php | 22 ---- local/classes/Seo/Canonical.php | 111 --------------------- local/classes/Seo/SchemaOrg.php | 22 ---- local/classes/Util/Canonical.php | 92 ----------------- local/configs/services/facades.yaml | 2 - 5 files changed, 249 deletions(-) delete mode 100644 local/classes/Facades/FilesystemFacade.php delete mode 100644 local/classes/Seo/Canonical.php delete mode 100644 local/classes/Seo/SchemaOrg.php delete mode 100644 local/classes/Util/Canonical.php diff --git a/local/classes/Facades/FilesystemFacade.php b/local/classes/Facades/FilesystemFacade.php deleted file mode 100644 index 8334ddc..0000000 --- a/local/classes/Facades/FilesystemFacade.php +++ /dev/null @@ -1,22 +0,0 @@ -__parent->__template->SetViewTarget(self::TARGET_ID); ?> - - __parent->__template->EndViewTarget(); - } - } - - /** - * Канонические ссылки для статических страниц. Берутся из - * свойства папки canonical. - * - * @param string $canonicalUrl URL (для списковых страниц). - * - * @return void - */ - public static function staticPage(string $canonicalUrl = ''): void - { - if (!$canonicalUrl) { - $canonicalUrl = $GLOBALS['APPLICATION']->GetDirProperty(self::PAGE_PROPERTY_CANONICAL_NAME); - } - - if (!$canonicalUrl) { - $canonicalUrl = $GLOBALS['APPLICATION']->GetPageProperty(self::PAGE_PROPERTY_CANONICAL_NAME); - } - - if ($canonicalUrl) { - $sResultLine = sprintf('', self::getFullUrl($canonicalUrl)); - $GLOBALS['APPLICATION']->AddViewContent(self::TARGET_ID, $sResultLine); - } - } - - /** - * Насильно выставить каноническую ссылку. - * - * @param string $canonicalUrl Каноническая ссылка. - * - * @return void - */ - public static function forceCanonical(string $canonicalUrl = '') : void - { - if (!$canonicalUrl) { - return; - } - - $sResultLine = sprintf('', $canonicalUrl); - $GLOBALS['APPLICATION']->AddViewContent(self::TARGET_ID, $sResultLine); - } - - /** - * Вывод канонической ссылки в header. - * - * @return void - */ - public static function show(): void - { - $GLOBALS['APPLICATION']->ShowViewContent(self::TARGET_ID); - } - - /** - * Проверка - HTTP или HTTPS. - * - * @return boolean - */ - private static function isSecureConnection(): bool - { - return - (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') - || $_SERVER['SERVER_PORT'] == 443; - } - - /** - * Получить полный (включая https, домен) путь к канонической странице. - * - * @param string $url Укороченный URL (без домена). - * - * @return string - */ - private static function getFullUrl(string $url = ''): string - { - $canonicalLink = $url ?: $_SERVER['REQUEST_URI']; - $schema = self::isSecureConnection() ? 'https://' : 'http://'; - - return $schema . $_SERVER['HTTP_HOST'] . $canonicalLink; - } -} diff --git a/local/classes/Seo/SchemaOrg.php b/local/classes/Seo/SchemaOrg.php deleted file mode 100644 index 8969d88..0000000 --- a/local/classes/Seo/SchemaOrg.php +++ /dev/null @@ -1,22 +0,0 @@ -__parent->__template->SetViewTarget(self::TARGET_ID); ?> - - __parent->__template->EndViewTarget(); - } - - /** - * Канонические ссылки для статических страниц. Берутся из - * свойства папки canonical. - * - * @param string $canonicalUrl URL (для списковых страниц). - * - * @return void - */ - public static function staticPage(string $canonicalUrl = ''): void - { - if (!$canonicalUrl) { - $canonicalUrl = $GLOBALS['APPLICATION']->GetDirProperty(self::PAGE_PROPERTY_CANONICAL_NAME); - } - - if ($canonicalUrl) { - $sResultLine = sprintf('', self::getFullUrl($canonicalUrl)); - $GLOBALS['APPLICATION']->AddViewContent(self::TARGET_ID, $sResultLine); - } - } - - /** - * Вывод канонической ссылки в header. - * - * @return void - */ - public static function show(): void - { - $GLOBALS['APPLICATION']->ShowViewContent(self::TARGET_ID); - } - - /** - * Проверка - HTTP или HTTPS. - * - * @return boolean - */ - private static function isSecureConnection(): bool - { - return - (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') - || $_SERVER['SERVER_PORT'] == 443; - } - - /** - * Получить полный (включая https, домен) путь к канонической странице. - * - * @param string $url Укороченный URL (без домена). - * - * @return string - */ - private static function getFullUrl(string $url = ''): string - { - $canonicalLink = $url ?: $_SERVER['REQUEST_URI']; - $typeHttp = self::isSecureConnection() ? 'https://' : 'http://'; - - return $typeHttp . $_SERVER['HTTP_HOST'] . $canonicalLink; - } -} diff --git a/local/configs/services/facades.yaml b/local/configs/services/facades.yaml index 1734cb2..3717b41 100644 --- a/local/configs/services/facades.yaml +++ b/local/configs/services/facades.yaml @@ -8,5 +8,3 @@ services: autowire: true autoconfigure: true public: true - - Local\Facades\FilesystemFacade: ~