Head.php

Gesponsorde koppelingen

PHP script bestanden

  1. Head.php

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
class Solow_View_Helper_Head
{
    protected $view;
    protected $contentLanguage = "en-US";
    protected $quirks=false;

    public function __toString()
    {

        return $this->renderHead();
    }


    public function Head()
    {

        return $this;
    }


    public function renderHead()
    {

        if($this->view->doctype()->isXhtml())
        {

            $head = $this->view->doctype().PHP_EOL;
            $head .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->contentLanguage.'" lang="'.$this->contentLanguage.'">'.PHP_EOL;
        }

        else
        {
            if($this->quirks)
            {

                $head = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'.PHP_EOL;
            }

            else
            {
                $head = ((bool)count($this->view->doctype())) ? $this->view->doctype().PHP_EOL."<html>".PHP_EOL : '<html>'.PHP_EOL;
            }
        }

        $head .= "<head>".PHP_EOL;

        if($this->contentLanguage != NULL)
        {

            $this->view->headMeta()->appendHttpEquiv('content-language', $this->contentLanguage);
        }

        $head .= ((bool)(count($this->view->headLink()))) ? $this->view->headLink().PHP_EOL : '';
        $head .= ((bool)(count($this->view->HeadMeta()))) ? $this->view->HeadMeta().PHP_EOL : '';
        $head .= ((bool)(count($this->view->HeadScript()))) ? $this->view->HeadScript().PHP_EOL : '';
        $head .= ((bool)(count($this->view->HeadStyle()))) ? $this->view->HeadStyle().PHP_EOL : '';
        $head .= ((bool)(count($this->view->HeadTitle()))) ? $this->view->HeadTitle().PHP_EOL : '';
        $head .= "</head>".PHP_EOL;
        return $head;
    }


    public function addCss($styleSheet)
    {

        $this->view->headLink()->appendStylesheet($styleSheet).PHP_EOL;
        return $this;
    }


    public function meta($name, $content)
    {

        $this->view->headMeta()->appendName($name, $content);
        return $this;
    }


    public function metaHE($name, $content)
    {

        $this->view->headMeta()->appendHttpEquiv($name, $content);
        return $this;
    }


    public function addJs($javascript)
    {

        $this->view->headScript()->appendFile($javascript).PHP_EOL;
        return $this;
    }


    public function setKeywords($keyWords)
    {

        $this->view->headMeta()->appendName('keywords', $keywords);
        return $this;
    }


    public function setDescription($description)
    {

        $this->view->headMeta()->appendName('description', $description);
        return $this;
    }


    public function disableCache()
    {

        $this->view->headMeta()->appendHttpEquiv('cache', 'NO-CACHE');
        $this->view->headMeta()->appendHttpEquiv('pragma', 'NO-CACHE');
        return $this;
    }


    public function disablePragma()
    {

        $this->view->headMeta()->appendHttpEquiv('cache', 'NO-CACHE');
        $this->view->headMeta()->appendHttpEquiv('pragma', 'NO-CACHE');
        return $this;
    }


    public function setFavicon($path)
    {

        $this->view->headLink()->headLink(array('rel' => 'favicon', 'href' => $this->favIcon));
        return $this;
    }


    public function setContentType($type="text/html; charset=UTF-8")
    {

        $this->view->headMeta()->appendHttpEquiv('content-type', $type);
        return $this;
    }


    public function setContentLanguage($lang = "en")
    {

        $this->contentLanguage = $lang;
        return $this;
    }


    public function setView(Zend_View_Interface $view)
    {

        $this->view = $view;
        return $this;
    }


    public function appendTitle($title)
    {

        $this->view->headTitle($title);
        return $this;
    }


    public function titleSeperator($seperator)
    {

        $this->view->headTitle()->setSeparator($seperator);
        return $this;
    }


    public function setTitle($title)
    {

        $this->view->headTitle($title, 'SET');
        return $this;
    }


    public function setDoctype($docType)
    {

        $doctypeHelper = new Zend_View_Helper_Doctype();
        $doctypeHelper->doctype($docType);
        return $this;
    }


    public function triggerQuirksMode()
    {

        $doctypeHelper = new Zend_View_Helper_Doctype();
        $doctypeHelper->doctype('HTML4_LOOSE');
        $this->quirks = true;
        return $this;
    }
}

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.