Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Dwoo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Common
Dwoo
Commits
257cdab5
Commit
257cdab5
authored
Aug 05, 2008
by
Seldaek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Fixed compiler bug that created a parse error when you had comments in an extended template
git-svn-id:
svn://dwoo.org/dwoo/trunk@144
0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent
39f1bcf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
41 deletions
+49
-41
CHANGELOG
CHANGELOG
+6
-0
Compiler.php
lib/Dwoo/Compiler.php
+43
-41
No files found.
CHANGELOG
View file @
257cdab5
[
2008
-
0
-]
0.9.4
/
1.0.0
?
*
Fixed
compiler
bug
that
created
a
parse
error
when
you
had
comments
in
an
extended
template
[
2008
-
08
-
03
]
0.9.3
[
2008
-
08
-
03
]
0.9.3
+
Adapters
:
Added
the
ZendFramework
interface
for
Dwoo
(
see
/
Dwoo
/
Adapters
/
ZendFramework
/
README
)
+
Plugins
:
Added
the
{
a
}
block
plugin
to
generate
<
a
>
tags
+
Plugins
:
Added
the
{
a
}
block
plugin
to
generate
<
a
>
tags
+
Syntax
:
Added
the
";"
token
that
allows
to
group
multiple
instructions
in
one
+
Syntax
:
Added
the
";"
token
that
allows
to
group
multiple
instructions
in
one
single
template
tag
,
example
:
{
if
$
foo
;
"> $foo"
;$
bar
;/}
is
equal
to
:
single
template
tag
,
example
:
{
if
$
foo
;
"> $foo"
;$
bar
;/}
is
equal
to
:
...
...
lib/Dwoo/Compiler.php
View file @
257cdab5
...
@@ -562,47 +562,6 @@ class Dwoo_Compiler implements Dwoo_ICompiler
...
@@ -562,47 +562,6 @@ class Dwoo_Compiler implements Dwoo_ICompiler
$this
->
templateSource
=&
$tpl
;
$this
->
templateSource
=&
$tpl
;
$this
->
pointer
=&
$ptr
;
$this
->
pointer
=&
$ptr
;
if
(
$this
->
debug
)
echo
'PROCESSING PREPROCESSORS<br>'
;
// runs preprocessors
foreach
(
$this
->
processors
[
'pre'
]
as
$preProc
)
{
if
(
is_array
(
$preProc
)
&&
isset
(
$preProc
[
'autoload'
]))
{
$preProc
=
$this
->
loadProcessor
(
$preProc
[
'class'
],
$preProc
[
'name'
]);
}
if
(
is_array
(
$preProc
)
&&
$preProc
[
0
]
instanceof
Dwoo_Processor
)
{
$tpl
=
call_user_func
(
$preProc
,
$tpl
);
}
else
{
$tpl
=
call_user_func
(
$preProc
,
$this
,
$tpl
);
}
}
unset
(
$preProc
);
if
(
$this
->
debug
)
echo
'<pre>'
.
print_r
(
htmlentities
(
$tpl
),
true
)
.
'</pre><hr />'
;
// strips comments
if
(
strstr
(
$tpl
,
$this
->
ld
.
'*'
)
!==
false
)
{
$tpl
=
preg_replace
(
'/'
.
$this
->
ldr
.
'\*.*?\*'
.
$this
->
rdr
.
'/s'
,
''
,
$tpl
);
}
// strips php tags if required by the security policy
if
(
$this
->
securityPolicy
!==
null
)
{
$search
=
array
(
'{<\?php.*?\?>}'
);
if
(
ini_get
(
'short_open_tags'
))
{
$search
=
array
(
'{<\?.*?\?>}'
,
'{<%.*?%>}'
);
}
switch
(
$this
->
securityPolicy
->
getPhpHandling
())
{
case
Dwoo_Security_Policy
::
PHP_ALLOW
:
break
;
case
Dwoo_Security_Policy
::
PHP_ENCODE
:
$tpl
=
preg_replace_callback
(
$search
,
array
(
$this
,
'phpTagEncodingHelper'
),
$tpl
);
break
;
case
Dwoo_Security_Policy
::
PHP_REMOVE
:
$tpl
=
preg_replace
(
$search
,
''
,
$tpl
);
}
}
while
(
true
)
{
while
(
true
)
{
// if pointer is at the beginning, reset everything, that allows a plugin to externally reset the compiler if everything must be reparsed
// if pointer is at the beginning, reset everything, that allows a plugin to externally reset the compiler if everything must be reparsed
if
(
$ptr
===
0
)
{
if
(
$ptr
===
0
)
{
...
@@ -616,7 +575,50 @@ class Dwoo_Compiler implements Dwoo_ICompiler
...
@@ -616,7 +575,50 @@ class Dwoo_Compiler implements Dwoo_ICompiler
// add top level block
// add top level block
$compiled
=
$this
->
addBlock
(
'topLevelBlock'
,
array
(),
0
);
$compiled
=
$this
->
addBlock
(
'topLevelBlock'
,
array
(),
0
);
$this
->
stack
[
0
][
'buffer'
]
=
''
;
$this
->
stack
[
0
][
'buffer'
]
=
''
;
if
(
$this
->
debug
)
echo
'COMPILER INIT<br />'
;
if
(
$this
->
debug
)
echo
'COMPILER INIT<br />'
;
if
(
$this
->
debug
)
echo
'PROCESSING PREPROCESSORS ('
.
count
(
$this
->
processors
[
'pre'
])
.
')<br>'
;
// runs preprocessors
foreach
(
$this
->
processors
[
'pre'
]
as
$preProc
)
{
if
(
is_array
(
$preProc
)
&&
isset
(
$preProc
[
'autoload'
]))
{
$preProc
=
$this
->
loadProcessor
(
$preProc
[
'class'
],
$preProc
[
'name'
]);
}
if
(
is_array
(
$preProc
)
&&
$preProc
[
0
]
instanceof
Dwoo_Processor
)
{
$tpl
=
call_user_func
(
$preProc
,
$tpl
);
}
else
{
$tpl
=
call_user_func
(
$preProc
,
$this
,
$tpl
);
}
}
unset
(
$preProc
);
// show template source if debug
if
(
$this
->
debug
)
echo
'<pre>'
.
print_r
(
htmlentities
(
$tpl
),
true
)
.
'</pre><hr />'
;
// strips comments
if
(
strstr
(
$tpl
,
$this
->
ld
.
'*'
)
!==
false
)
{
$tpl
=
preg_replace
(
'/'
.
$this
->
ldr
.
'\*.*?\*'
.
$this
->
rdr
.
'/s'
,
''
,
$tpl
);
}
// strips php tags if required by the security policy
if
(
$this
->
securityPolicy
!==
null
)
{
$search
=
array
(
'{<\?php.*?\?>}'
);
if
(
ini_get
(
'short_open_tags'
))
{
$search
=
array
(
'{<\?.*?\?>}'
,
'{<%.*?%>}'
);
}
switch
(
$this
->
securityPolicy
->
getPhpHandling
())
{
case
Dwoo_Security_Policy
::
PHP_ALLOW
:
break
;
case
Dwoo_Security_Policy
::
PHP_ENCODE
:
$tpl
=
preg_replace_callback
(
$search
,
array
(
$this
,
'phpTagEncodingHelper'
),
$tpl
);
break
;
case
Dwoo_Security_Policy
::
PHP_REMOVE
:
$tpl
=
preg_replace
(
$search
,
''
,
$tpl
);
}
}
}
}
$pos
=
strpos
(
$tpl
,
$this
->
ld
,
$ptr
);
$pos
=
strpos
(
$tpl
,
$this
->
ld
,
$ptr
);
...
...
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