-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHtmlHlavicka.php
93 lines (82 loc) · 3.14 KB
/
HtmlHlavicka.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
namespace universal;
class HtmlHlavicka extends Html {
protected $nadpis;
protected $popis;
protected $zobrazIkonu = false;
protected $beznyCss = true;
protected $beznyJs = true;
protected $mozneAdresareStylopisu = array('css','styles','styly');
protected $mozneAdresareJavascriptu = array('js','javascript');
protected $mozneUmisteniAdresaru;
protected $hlavicka = '';
public function __construct($znakovaSada = self::ZNAKOVA_SADA,$jazyk = self::JAZYK){
parent::__construct($znakovaSada,$jazyk);
$this->nastavMozneUmisteniAdresaru();
}
protected function nastavMozneUmisteniAdresaru(){
$this->mozneUmisteniAdresaru = array(
str_replace('\\','/',dirname(__FILE__).'/..')=>'../univerzal/'
,dirname($_SERVER['SCRIPT_FILENAME'])=>''
);
}
public function nastavNadpis($nadpis){
$this->nadpis = $nadpis;
}
public function nastavPopis($popis){
$this->popis = $popis;
}
public function nastavZobrazIkonu($zobrazIkonu){
$this->zobrazIkonu = (bool)$zobrazIkonu;
}
public function nastavBeznyCss($beznyCss){
$this->beznyCss = (bool)$beznyCss;
}
public function nastavBeznyJs($beznyJs){
$this->beznyJs = $beznyJs;
}
public function rozsirHlavicku($rozsireni){
$this->hlavicka .= "$rozsireni\n";
}
public function dejHlavicku(){
$this->hlavicka .= "\n <meta http-equiv='Content-Language' content='$this->jazyk'/>";
$this->hlavicka .= "\n <meta http-equiv='Content-Type' content='text/html; charset=$this->znakovaSada'/>";
if(isset($this->nadpis)){
$this->hlavicka .= "\n <title>$this->nadpis</title>";
}
if(isset($this->popis)){
$this->hlavicka .= "\n <meta name='description' content='$this->popis'/>";
}
if($this->beznyCss){
foreach($this->mozneUmisteniAdresaru as $souborovaCestaKAdresariStylopisu=>$htmlCestaKAdresariStylopisu){
foreach($this->mozneAdresareStylopisu as $moznyAdresarStylopisu){
$stylopisy = FolderTools::dejSouboryZAdresare($souborovaCestaKAdresariStylopisu."/$moznyAdresarStylopisu",'css');//vyhledame soubor se styly v univerzal
if($stylopisy){
foreach($stylopisy as $css){
$this->hlavicka .= "\n\t\t<link rel='stylesheet' type='text/css' href='$htmlCestaKAdresariStylopisu$moznyAdresarStylopisu/$css' media='all'/>";
}
}
}
}
}
if($this->beznyJs){
foreach($this->mozneUmisteniAdresaru as $souborovaCestaKAdresari=>$htmlCestaKAdresari){
foreach($this->mozneAdresareJavascriptu as $moznyAdresar){
$javascripty = FolderTools::dejSouboryZAdresare($souborovaCestaKAdresari."/$moznyAdresar",'js');//vyhledame soubor se styly v univerzal
if($javascripty){
foreach($javascripty as $js){
$this->hlavicka .= "\n\t\t<script type='text/javascript' src='$htmlCestaKAdresari$moznyAdresar/$js'></script>";
}
}
}
}
}
if($this->zobrazIkonu and file_exists(self::$materskyAdresar.'/grafika/favicon.ico')){
preg_match_all('|/[[:alnum:]]+$|',str_replace('\\','/',self::$materskyAdresar),$cesta);
$cesta = UtilitkyProPole::orezPole($cesta);
$this->hlavicka .= "\n\t\t<link rel='shortcut icon' href='$cesta/grafika/favicon.ico'/>";
}
$this->hlavicka = " <head>$this->hlavicka\n </head>\n";
return $this->hlavicka;
}
}