Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
seo.php
1<?php
3
4use \Bitrix\Landing\Manager;
5
6class Seo
7{
12 private static $storedKeys = [
13 'title' => null,
14 'description' => null,
15 'keywords' => null
16 ];
17
22 private static $changedKeys = [
23 'title' => null,
24 'description' => null,
25 'keywords' => null
26 ];
27
32 public static function beforeLandingView()
33 {
34 $application = Manager::getApplication();
35
36 foreach (self::$storedKeys as $key => $val)
37 {
38 $currentVal = $application->getProperty($key);
39 if (is_string($currentVal))
40 {
41 self::$storedKeys[$key] = htmlspecialcharsback($currentVal);
42 }
43 }
44 }
45
50 public static function afterLandingView()
51 {
52 $application = Manager::getApplication();
53
54 foreach (self::$storedKeys as $key => $val)
55 {
56 $newVal = $application->getProperty($key);
57 if (is_string($newVal) && $newVal != $val)
58 {
59 self::$changedKeys[$key] = htmlspecialcharsback($newVal);
60 }
61 }
62 }
63
70 public static function processValue($key, $value)
71 {
72 if (
73 is_string($key) &&
74 isset(self::$changedKeys[$key])
75 )
76 {
77 return trim(self::$changedKeys[$key]);
78 }
79
80 return trim($value);
81 }
82
89 public static function changeValue($key, $value)
90 {
91 if (
92 is_string($key) &&
93 is_string($value) &&
94 array_key_exists($key, self::$changedKeys)
95 )
96 {
97 self::$changedKeys[$key] = $value;
98 }
99 }
100}
static processValue($key, $value)
Definition seo.php:70
static changeValue($key, $value)
Definition seo.php:89
static beforeLandingView()
Definition seo.php:32
static afterLandingView()
Definition seo.php:50
static getApplication()
Definition manager.php:71