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
860ce2d9
Commit
860ce2d9
authored
May 06, 2008
by
Seldaek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
svn://dwoo.org/dwoo/trunk@44
0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent
548e0f1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
6 deletions
+39
-6
CHANGELOG
CHANGELOG
+9
-5
Compiler.php
lib/Dwoo/Compiler.php
+6
-1
CompilerTests.php
tests/CompilerTests.php
+24
-0
No files found.
CHANGELOG
View file @
860ce2d9
...
@@ -28,9 +28,8 @@
...
@@ -28,9 +28,8 @@
of its compile() method
of its compile() method
+ API: Added a bunch of utility functions to Dwoo_Compiler, allowing compiled
+ API: Added a bunch of utility functions to Dwoo_Compiler, allowing compiled
plugins to access more of the compiler internals
plugins to access more of the compiler internals
* Fixed a potential concurrency issue (thanks to Rasmus Schultz for the patch)
* Moved all files to Dwoo/Class.php excepted for the core Dwoo.php file
* Moved all files to Dwoo/Class.php excepted for the core Dwoo.php file
* Fixed a classpath rebuilding bug that occured on some UNIX platforms due to
glob() returning false sometimes for empty folders
* Various performance improvements, including the removal of a lot of isset()
* Various performance improvements, including the removal of a lot of isset()
calls. Doing {$foo} if foo is undefined will now display a PHP warning, but
calls. Doing {$foo} if foo is undefined will now display a PHP warning, but
doing {foreach $foo}..{/foreach} will not however, that way you don't have
doing {foreach $foo}..{/foreach} will not however, that way you don't have
...
@@ -42,13 +41,18 @@
...
@@ -42,13 +41,18 @@
* {include} now uses the current resource if none is provided instead of using
* {include} now uses the current resource if none is provided instead of using
file as it did before
file as it did before
* Dwoo uses include path instead of absolute includes
* Dwoo uses include path instead of absolute includes
* Fixed a regression in the handling of custom class plugins
* Fixed a bug in Dwoo_Security_Policy->getAllowedDirectories(), no security
issue though
* Changed all line endings to Unix (line feed only) and all spaces left have
* Changed all line endings to Unix (line feed only) and all spaces left have
been converted to tabs (tabspace 4)
been converted to tabs (tabspace 4)
* TestFest happened early for Dwoo, lots of new tests and more code covered
* TestFest happened early for Dwoo, lots of new tests and more code covered
* Fixed a regression in the handling of custom class plugins
* Fixed various bugs in the Adapter class and related smarty compatibility
features
* Fixed a classpath rebuilding bug that occured on some UNIX platforms due to
glob() returning false sometimes for empty folders
* Fixed a bug in Dwoo_Security_Policy->getAllowedDirectories(), no security
issue though
* Fixed a bug in Dwoo::setScope affecting {loop} and {with}
* Fixed a bug in Dwoo::setScope affecting {loop} and {with}
* Fixed a parsing bug when doing {"string"|modifier:$var}
[2008-04-09] 0.3.4
[2008-04-09] 0.3.4
! BC Break: DWOO_PATH constant changed to DWOO_DIRECTORY
! BC Break: DWOO_PATH constant changed to DWOO_DIRECTORY
...
...
lib/Dwoo/Compiler.php
View file @
860ce2d9
...
@@ -1330,6 +1330,8 @@ class Dwoo_Compiler implements Dwoo_ICompiler
...
@@ -1330,6 +1330,8 @@ class Dwoo_Compiler implements Dwoo_ICompiler
}
}
if
(
$curBlock
!==
'modifier'
&&
substr
(
$in
,
$strend
+
1
,
1
)
===
'|'
)
if
(
$curBlock
!==
'modifier'
&&
substr
(
$in
,
$strend
+
1
,
1
)
===
'|'
)
{
{
if
(
$strend
!==
false
)
$realend
=
$strend
-
$from
+
1
;
$strend
=
strpos
(
$in
,
' '
,
$strend
+
1
);
$strend
=
strpos
(
$in
,
' '
,
$strend
+
1
);
if
(
$strend
===
false
)
if
(
$strend
===
false
)
$strend
=
strlen
(
$in
)
-
1
;
$strend
=
strlen
(
$in
)
-
1
;
...
@@ -1339,7 +1341,10 @@ class Dwoo_Compiler implements Dwoo_ICompiler
...
@@ -1339,7 +1341,10 @@ class Dwoo_Compiler implements Dwoo_ICompiler
if
(
$pointer
!==
null
)
if
(
$pointer
!==
null
)
$pointer
+=
strlen
(
$srcOutput
);
$pointer
+=
strlen
(
$srcOutput
);
$output
=
$this
->
replaceStringVars
(
$srcOutput
,
$first
);
if
(
isset
(
$realend
))
$output
=
$this
->
replaceStringVars
(
substr
(
$srcOutput
,
0
,
$realend
),
$first
)
.
substr
(
$srcOutput
,
$realend
);
else
$output
=
$this
->
replaceStringVars
(
$srcOutput
,
$first
);
// handle modifiers
// handle modifiers
if
(
$curBlock
!==
'modifier'
&&
preg_match
(
'#(.+?)((?:\|(?:@?[a-z0-9_]+(?::[^\s]*)*))+)#i'
,
$output
,
$match
))
if
(
$curBlock
!==
'modifier'
&&
preg_match
(
'#(.+?)((?:\|(?:@?[a-z0-9_]+(?::[^\s]*)*))+)#i'
,
$output
,
$match
))
...
...
tests/CompilerTests.php
View file @
860ce2d9
...
@@ -38,6 +38,30 @@ class CompilerTests extends PHPUnit_Framework_TestCase
...
@@ -38,6 +38,30 @@ class CompilerTests extends PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'B-A-R'
,
$this
->
dwoo
->
get
(
$tpl
,
array
(
'foo'
=>
'bar'
),
$this
->
compiler
));
$this
->
assertEquals
(
'B-A-R'
,
$this
->
dwoo
->
get
(
$tpl
,
array
(
'foo'
=>
'bar'
),
$this
->
compiler
));
}
}
public
function
testModifierArgsVars
()
{
$tpl
=
new
Dwoo_Template_String
(
'{$foo|spacify:$bar|upper}'
);
$tpl
->
forceCompilation
();
$this
->
assertEquals
(
'B-A-R'
,
$this
->
dwoo
->
get
(
$tpl
,
array
(
'foo'
=>
'bar'
,
'bar'
=>
'-'
),
$this
->
compiler
));
}
public
function
testModifierOnString
()
{
$tpl
=
new
Dwoo_Template_String
(
'{"bar"|spacify:"-"|upper}'
);
$tpl
->
forceCompilation
();
$this
->
assertEquals
(
'B-A-R'
,
$this
->
dwoo
->
get
(
$tpl
,
array
(),
$this
->
compiler
));
}
public
function
testModifierOnStringWithVar
()
{
$tpl
=
new
Dwoo_Template_String
(
'{"bar"|spacify:$bar|upper}'
);
$tpl
->
forceCompilation
();
$this
->
assertEquals
(
'B-A-R'
,
$this
->
dwoo
->
get
(
$tpl
,
array
(
'bar'
=>
'-'
),
$this
->
compiler
));
}
public
function
testModifierWithModifier
()
public
function
testModifierWithModifier
()
{
{
$tpl
=
new
Dwoo_Template_String
(
'{$foo.0}{assign $foo|reverse foo}{$foo.0}{assign $foo|@reverse foo}{$foo.0}'
);
$tpl
=
new
Dwoo_Template_String
(
'{$foo.0}{assign $foo|reverse foo}{$foo.0}{assign $foo|@reverse foo}{$foo.0}'
);
...
...
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