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
770f1f70
Commit
770f1f70
authored
Oct 08, 2008
by
Seldaek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes here and there
git-svn-id:
svn://dwoo.org/dwoo/trunk@195
0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent
b9d663a3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
46 deletions
+25
-46
CHANGELOG
CHANGELOG
+2
-0
Dwoo.compiled.php
lib/Dwoo.compiled.php
+0
-0
Dwoo.php
lib/Dwoo.php
+3
-0
File.php
lib/Dwoo/Template/File.php
+9
-45
String.php
lib/Dwoo/Template/String.php
+11
-1
No files found.
CHANGELOG
View file @
770f1f70
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
IPluginProxy
interface
,
that
's it
IPluginProxy
interface
,
that
's it
+ Compiler: the modifier syntax (|foo) can now be applied on functions and on
+ Compiler: the modifier syntax (|foo) can now be applied on functions and on
complex variables i.e. {$obj->getStuff()|upper} or {lower('
foo
')|upper}
complex variables i.e. {$obj->getStuff()|upper} or {lower('
foo
')|upper}
* ZendFramework: major overhaul thanks to Denis Arh, templates files should
probably be moved in the scripts subfolder after this update though
* Plugins: improved the dump plugin, it now displays object'
s
properties
* Plugins: improved the dump plugin, it now displays object'
s
properties
and
optionally
public
methods
(
if
the
new
show_methods
arg
is
set
to
true
)
and
optionally
public
methods
(
if
the
new
show_methods
arg
is
set
to
true
)
-
thanks
to
Stephan
Wentz
for
the
patch
-
thanks
to
Stephan
Wentz
for
the
patch
...
...
lib/Dwoo.compiled.php
View file @
770f1f70
This diff is collapsed.
Click to expand it.
lib/Dwoo.php
View file @
770f1f70
...
@@ -1406,6 +1406,9 @@ class Dwoo
...
@@ -1406,6 +1406,9 @@ class Dwoo
$tree
=&
$this
->
scopeTree
;
$tree
=&
$this
->
scopeTree
;
$data
=&
$this
->
data
;
$data
=&
$this
->
data
;
if
(
!
is_string
(
$scope
))
{
return
$this
->
triggerError
(
'Assignments must be done into strings, ('
.
gettype
(
$scope
)
.
') '
.
var_export
(
$scope
,
true
)
.
' given'
,
E_USER_ERROR
);
}
if
(
strstr
(
$scope
,
'.'
)
===
false
&&
strstr
(
$scope
,
'->'
)
===
false
)
{
if
(
strstr
(
$scope
,
'.'
)
===
false
&&
strstr
(
$scope
,
'->'
)
===
false
)
{
$this
->
scope
[
$scope
]
=
$value
;
$this
->
scope
[
$scope
]
=
$value
;
}
else
{
}
else
{
...
...
lib/Dwoo/Template/File.php
View file @
770f1f70
...
@@ -103,54 +103,18 @@ class Dwoo_Template_File extends Dwoo_Template_String
...
@@ -103,54 +103,18 @@ class Dwoo_Template_File extends Dwoo_Template_String
{
{
return
$this
->
includePath
;
return
$this
->
includePath
;
}
}
/**
/**
*
returns the compiled template file name
*
Checks if compiled file is valid (exists and it's the modification is greater or
*
*
equal to the modification time of the template file)
*
@param Dwoo $dwoo the dwoo instance that requests it
*
* @param
Dwoo_ICompiler $compiler the compiler that must be used
* @param
string file
* @return
string
* @return
boolean True cache file existance and it's modification time
*/
*/
public
function
getCompiledTemplate
(
Dwoo
$dwoo
,
Dwoo_ICompiler
$compiler
=
null
)
protected
function
isValidCompiledFile
(
$file
)
{
{
return
parent
::
isValidCompiledFile
(
$file
)
&&
(
int
)
$this
->
getUid
()
<=
filemtime
(
$file
);
$compiledFile
=
$this
->
getCompiledFilename
(
$dwoo
);
if
(
$this
->
compilationEnforced
!==
true
&&
isset
(
self
::
$cache
[
'compiled'
][
$this
->
compileId
])
===
true
)
{
// already checked, return compiled file
}
elseif
(
$this
->
compilationEnforced
!==
true
&&
file_exists
(
$compiledFile
)
===
true
&&
(
int
)
$this
->
getUid
()
<=
filemtime
(
$compiledFile
))
{
// template is compiled and has not been modified since the compilation
self
::
$cache
[
'compiled'
][
$this
->
compileId
]
=
true
;
}
else
{
// compiles the template
$this
->
compilationEnforced
=
false
;
if
(
$compiler
===
null
)
{
$compiler
=
$dwoo
->
getDefaultCompilerFactory
(
$this
->
getResourceName
());
if
(
$compiler
===
null
||
$compiler
===
array
(
'Dwoo_Compiler'
,
'compilerFactory'
))
{
if
(
class_exists
(
'Dwoo_Compiler'
,
false
)
===
false
)
{
include
DWOO_DIRECTORY
.
'Dwoo/Compiler.php'
;
}
$compiler
=
Dwoo_Compiler
::
compilerFactory
();
}
else
{
$compiler
=
call_user_func
(
$compiler
);
}
}
$this
->
compiler
=
$compiler
;
$compiler
->
setCustomPlugins
(
$dwoo
->
getCustomPlugins
());
$compiler
->
setSecurityPolicy
(
$dwoo
->
getSecurityPolicy
());
$this
->
makeDirectory
(
dirname
(
$compiledFile
));
file_put_contents
(
$compiledFile
,
$compiler
->
compile
(
$dwoo
,
$this
));
if
(
$this
->
chmod
!==
null
)
{
chmod
(
$compiledFile
,
$this
->
chmod
);
}
self
::
$cache
[
'compiled'
][
$this
->
compileId
]
=
true
;
}
return
$compiledFile
;
}
}
/**
/**
...
...
lib/Dwoo/Template/String.php
View file @
770f1f70
...
@@ -346,7 +346,7 @@ class Dwoo_Template_String implements Dwoo_ITemplate
...
@@ -346,7 +346,7 @@ class Dwoo_Template_String implements Dwoo_ITemplate
if
(
$this
->
compilationEnforced
!==
true
&&
isset
(
self
::
$cache
[
'compiled'
][
$this
->
compileId
])
===
true
)
{
if
(
$this
->
compilationEnforced
!==
true
&&
isset
(
self
::
$cache
[
'compiled'
][
$this
->
compileId
])
===
true
)
{
// already checked, return compiled file
// already checked, return compiled file
}
elseif
(
$this
->
compilationEnforced
!==
true
&&
file_exists
(
$compiledFile
)
===
true
)
{
}
elseif
(
$this
->
compilationEnforced
!==
true
&&
$this
->
isValidCompiledFile
(
$compiledFile
)
)
{
// template is compiled
// template is compiled
self
::
$cache
[
'compiled'
][
$this
->
compileId
]
=
true
;
self
::
$cache
[
'compiled'
][
$this
->
compileId
]
=
true
;
}
else
{
}
else
{
...
@@ -381,6 +381,16 @@ class Dwoo_Template_String implements Dwoo_ITemplate
...
@@ -381,6 +381,16 @@ class Dwoo_Template_String implements Dwoo_ITemplate
return
$compiledFile
;
return
$compiledFile
;
}
}
/**
* Checks if compiled file is valid (it exists)
*
* @param string file
* @return boolean True cache file existance
*/
protected
function
isValidCompiledFile
(
$file
)
{
return
file_exists
(
$file
);
}
/**
/**
* returns a new template string object with the resource id being the template source code
* returns a new template string object with the resource id being the template source code
...
...
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