Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tcms
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
tcms
Commits
e1b53a4e
Commit
e1b53a4e
authored
Nov 14, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added HTML minifier and some comments.
parent
3bd59aff
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
index.php
index.php
+21
-12
templates/layout.tpl
templates/layout.tpl
+5
-0
No files found.
index.php
View file @
e1b53a4e
...
...
@@ -4,10 +4,12 @@
include_once
'pquery.config.php'
;
include_once
PQUERY_ROOT
.
'pquery.php'
;
// Config
__p
::
require_plugins
(
'template'
,
'sql'
,
'url'
,
'js'
,
'css'
);
__p
::
load_util
(
'minify_html'
,
'jshrink'
,
'CssParser'
);
__tpl
::
set_root
(
'templates'
);
// URL rewriting
__url
::
add_handlers
(
array
(
'css/(.*)'
=>
'css_handler'
,
'js/(.*)'
=>
'js_handler'
,
...
...
@@ -15,6 +17,7 @@ __url::add_handlers(array(
'(.*)'
=>
'content'
));
// Call content handler
header
(
'Vary: Accept-Encoding'
);
$handler
=
strstr
(
$_SERVER
[
'HTTP_ACCEPT_ENCODING'
],
'gzip'
)
!==
false
?
'ob_gzhandler'
:
''
;
...
...
@@ -23,11 +26,8 @@ ob_start($handler);
_url
(
$_SERVER
[
'QUERY_STRING'
])
->
handler
();
ob_end_flush
();
/**
*
*
* @param string $files One or more scripts separated by commas (',').
*/
// Cache handlers
function
js_handler
(
$files
)
{
$prepend_folder
=
create_function
(
'$x'
,
'return "js/$x";'
);
_js
(
array_map
(
$prepend_folder
,
explode
(
','
,
$files
)))
->
output
();
...
...
@@ -38,15 +38,13 @@ function css_handler($files) {
_css
(
array_map
(
$prepend_folder
,
explode
(
','
,
$files
)))
->
output
();
}
function
content
()
{
header
(
'Content-Type: text/html; charset=utf-8'
);
// HTML handlers
echo
'content'
;
function
content
()
{
html
(
'content'
);
}
function
layout
()
{
header
(
'Content-Type: text/html; charset=utf-8'
);
$menu
=
array
(
array
(
'Pagina\'s'
,
'pages'
),
array
(
'Nieuws'
,
'news'
),
...
...
@@ -63,7 +61,18 @@ function layout() {
$i
||
$item
->
set
(
'active'
,
'active'
);
}
echo
$layout
->
parse
();
html
(
$layout
->
parse
());
}
// HTML wrapper handler, minifies HTML and sets Content-Type header
function
html
(
$html
)
{
header
(
'Content-Type: text/html; charset=utf-8'
);
echo
Minify_HTML
::
minify
(
$html
,
array
(
'cssMinifier'
=>
'CssParser::minify'
,
'jsMinifier'
=>
'JShrink::minify'
));
}
?>
\ No newline at end of file
templates/layout.tpl
View file @
e1b53a4e
...
...
@@ -2,8 +2,13 @@
<html>
<head>
<title>
Tcms
</title>
<meta
charset=
"utf-8"
/>
<meta
name=
"robots"
content=
"index,nofollow"
/>
<base
href=
"http://localhost/tcms/"
/>
<link
href=
"css/main"
rel=
"stylesheet"
/>
<script
async
type=
"text/javascript"
src=
"js/jquery-1.7.min,menu,list"
></script>
<!--
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment