Forráskód Böngészése

Change PAge page for http headers

Visman 4 éve
szülő
commit
14743c0f45
1 módosított fájl, 19 hozzáadás és 14 törlés
  1. 19 14
      app/Models/Page.php

+ 19 - 14
app/Models/Page.php

@@ -15,6 +15,12 @@ abstract class Page extends Model
      */
      */
     protected $pageHeaders = [];
     protected $pageHeaders = [];
 
 
+    /**
+     * Http заголовки
+     * @var array
+     */
+    protected $httpHeaders = [];
+
     /**
     /**
      * Конструктор
      * Конструктор
      *
      *
@@ -38,7 +44,7 @@ abstract class Page extends Model
 
 
         $this->fIndex       = 'index'; # string      Указатель на активный пункт навигации
         $this->fIndex       = 'index'; # string      Указатель на активный пункт навигации
         $this->httpStatus   = 200;     # int         HTTP статус ответа для данной страницы
         $this->httpStatus   = 200;     # int         HTTP статус ответа для данной страницы
-        $this->httpHeaders  = [];      # array       HTTP заголовки отличные от статуса
+#       $this->httpHeaders  = [];      # array       HTTP заголовки отличные от статуса
 #       $this->nameTpl      = null;    # null|string Имя шаблона
 #       $this->nameTpl      = null;    # null|string Имя шаблона
 #       $this->titles       = [];      # array       Массив титула страницы | setTitles()
 #       $this->titles       = [];      # array       Массив титула страницы | setTitles()
         $this->fIswev       = [];      # array       Массив info, success, warning, error, validation информации
         $this->fIswev       = [];      # array       Массив info, success, warning, error, validation информации
@@ -61,6 +67,15 @@ abstract class Page extends Model
             'type' => 'text/css',
             'type' => 'text/css',
             'href' => $this->c->PUBLIC_URL . '/style/' . $this->user->style . '/style.css',
             'href' => $this->c->PUBLIC_URL . '/style/' . $this->user->style . '/style.css',
         ]);
         ]);
+
+        $now = \gmdate('D, d M Y H:i:s') . ' GMT';
+
+        $this->header('Cache-Control', 'no-cache, no-store, must-revalidate')
+//            ->header('Cache-Control', 'private, no-cache')
+            ->header('Content-type', 'text/html; charset=utf-8')
+            ->header('Date', $now)
+            ->header('Last-Modified', $now)
+            ->header('Expires', $now);
     }
     }
 
 
     /**
     /**
@@ -344,9 +359,7 @@ abstract class Page extends Model
         } else {
         } else {
             $key .= ':';
             $key .= ':';
         }
         }
-        $attr   = $this->getAttr('httpHeaders', []);
-        $attr[] = ["{$key} {$value}", $replace];
-        $this->setAttr('httpHeaders', $attr);
+        $this->httpHeaders[] = ["{$key} {$value}", $replace];
 
 
         return $this;
         return $this;
     }
     }
@@ -359,17 +372,9 @@ abstract class Page extends Model
      */
      */
     protected function gethttpHeaders(): array
     protected function gethttpHeaders(): array
     {
     {
-        $now = \gmdate('D, d M Y H:i:s') . ' GMT';
-
-        $this->httpStatus()
-            ->header('Cache-Control', 'no-cache, no-store, must-revalidate')
-//            ->header('Cache-Control', 'private, no-cache')
-            ->header('Content-type', 'text/html; charset=utf-8')
-            ->header('Date', $now)
-            ->header('Last-Modified', $now)
-            ->header('Expires', $now);
+        $this->httpStatus();
 
 
-        return $this->getAttr('httpHeaders', []);
+        return $this->httpHeaders;
     }
     }
 
 
     /**
     /**