My favorites
|
Sign in
kohana-mptt
Kohana Code Repository
Project Home
Downloads
Wiki
Issues
Source
Checkout
|
Browse
|
Changes
|
‹r55
r105
Source path:
svn
/
trunk
/
test
/
Head.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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
class Head_Core extends ArrayObject{
protected $tabs;
// Head singleton
private static $instance;
/**
* Head instance of Head.
*/
public static function instance()
{
// Create the instance if it does not exist
empty(self::$instance) and new Head;
return self::$instance;
}
public function __construct()
{
$this['title'] =new Head_Title;
$this['base'] =new Head_Base;
$this['javascript'] =new Head_Javascript;
//$this['meta'] =new Head_Partial;
$this['css'] =new Head_Css;
$this['link'] =new Head_Link;
$this->setFlags(ArrayObject::ARRAY_AS_PROPS );
// Singleton instance
self::$instance = $this;
}
public function __tostring()
{
return (string) $this->render();
}
public function render()
{
$html='';
foreach($this as $field)
{
$html.=$field->render();
}
return $html;
}
}
class Head_Partial extends Head_Core{
public function __construct()
{
$this->setFlags(ArrayObject::ARRAY_AS_PROPS);
}
}
class Head_Title extends Head_Partial{
public function __construct($title='')
{
$this['title']=$title;
}
public function set($title)
{
$this['title']=$title;
}
public function render()
{
if($this['title']!='')
{
return (string) '<title>'.$this['title'].'</title>'."\n\r";
}
return '';
}
}
class Head_Base extends Head_Partial{
public function __construct($base='')
{
$this['base_href']=$base;
}
public function set($base_href)
{
$this['base_href']=$base_href;
}
public function render()
{
if($this['base_href']!='')
{
return (string) '<base href="'.$this['base_href'].'" />'."\n\r";
}
return '';
}
}
class Head_Javascript extends Head_Partial{
public function __construct()
{
$this->setFlags(ArrayObject::ARRAY_AS_PROPS);
$this['files']=new Head_Javascript_File;
$this['scripts']=new Head_Js_Script;
}
public function append_file($file)
{
$this['files'][]=$file;
return $this;
}
public function append_script($script)
{
$this['scripts'][]=$script;
return $this;
}
}
class Head_Javascript_File extends Head_Partial{
public function render()
{
$html='';
foreach($this as $field)
{
$html.=html::script($field);
}
return $html;
}
}
class Head_Js_Script extends Head_Partial
{
public function render()
{
$html='';
foreach($this as $script)
{
$html.='<script type="text/javascript">'.$script.'</script>'."\r\n";
}
return $html;
}
}
class Head_Css extends Head_Partial{
public function __construct()
{
$this->setFlags(ArrayObject::ARRAY_AS_PROPS);
$this['files']=new Head_Css_File;
$this['styles']=new Head_Css_Style;
}
public function append_file($file,$type='screen')
{
$this['files'][]=array($file,$type);
return $this;
}
public function append_style($script)
{
$this['styles'][]=$script;
return $this;
}
}
class Head_Css_File extends Head_Partial{
public function render()
{
$html='';
foreach($this as $field)
{
$html.=html::stylesheet($field[0],$field[1]);
}
return $html;
}
}
class Head_Css_Style extends Head_Partial
{
public function render()
{
$html='';
foreach($this as $script)
{
$html.='<style type="text/css">'.$script.'</style>'."\r\n";
}
return $html;
}
}
class Head_Link extends Head_Partial
{
public function append_link($link,$rel='alternate',$type='application/rss+xml')
{
$this[]=array($link,$rel,$type);
}
public function render()
{
$html='';
foreach($this as $link)
{
$html.=html::link($link[0],$link[1],$link[2]);
}
return $html;
}
}
Show details
Hide details
Change log
r56
by maartenvanvliet on Mar 14, 2008
Diff
[No log message]
Go to:
/trunk/Head.php
...rmation/libraries/Event_Form.php
...ormation/libraries/Formation.php
...on/libraries/Model_Formation.php
...raries/elements/Element_Csrf.php
...on/libraries/rules/Rule_Csrf.php
...ion/views/formation_template.php
/trunk/test
/trunk/test/Head.php
/trunk/test/head_.php
Project members,
sign in
to write a code review
Older revisions
r55
by maartenvanvliet on Mar 14, 2008
Diff
[No log message]
All revisions of this file
File info
Size: 3541 bytes, 205 lines
View raw file
Hosted by