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
6075f215
Commit
6075f215
authored
Oct 22, 2008
by
seldaek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup of some \r\n's
git-svn-id:
svn://dwoo.org/dwoo/trunk@206
0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent
7996536c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
186 additions
and
182 deletions
+186
-182
t.php
lib/Dwoo/Adapters/Agavi/dwoo_plugins/t.php
+37
-36
url.php
lib/Dwoo/Adapters/Agavi/dwoo_plugins/url.php
+59
-58
IPluginProxy.php
lib/Dwoo/IPluginProxy.php
+70
-69
dwooAutoload.php
lib/dwooAutoload.php
+14
-13
loaderTest.php
tests/resources/plugins/loaderTest.php
+6
-6
No files found.
lib/Dwoo/Adapters/Agavi/dwoo_plugins/t.php
View file @
6075f215
<?php
/**
* <strong>Agavi specific plugin</strong>
*
* uses AgaviTranslationManager to localize a string
*
* <pre>
* * string : the string to localize
* </pre>
*
* Examples:
* <code>
* {t "Hello"}
* {t $header}
* </code>
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link http://dwoo.org/
* @version 1.0.0
* @date 2008-09-08
* @package Dwoo
*/
function
Dwoo_Plugin_t_compile
(
Dwoo_Compiler
$compiler
,
$string
)
{
return
'$this->data[\'tm\']->_('
.
$string
.
')'
;
<?php
/**
* <strong>Agavi specific plugin</strong>
*
* uses AgaviTranslationManager to localize a string
*
* <pre>
* * string : the string to localize
* </pre>
*
* Examples:
* <code>
* {t "Hello"}
* {t $header}
* </code>
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link http://dwoo.org/
* @version 1.0.0
* @date 2008-09-08
* @package Dwoo
*/
function
Dwoo_Plugin_t_compile
(
Dwoo_Compiler
$compiler
,
$string
)
{
return
'$this->data[\'tm\']->_('
.
$string
.
')'
;
}
\ No newline at end of file
lib/Dwoo/Adapters/Agavi/dwoo_plugins/url.php
View file @
6075f215
<?php
/**
* <strong>Agavi specific plugin</strong>
*
* uses AgaviRouting to create an url
*
* <pre>
* * route : the route name, optional (by default the current url is returned)
* * params : an array with variables to build the route, optional
* * options : an array of options to pass to the routing object, optional
* * rest : for convenience, you can just pass named parameters that will be used as
* the params array, but you must not provide the params array in this case
* </pre>
*
* Examples:
* <code>
* {a url("route.name" array(param="Value", param2=$otherVal))}Here is a link{/a}
* <form action="{url}"> {* without any parameter it just returns the current url *}
* </code>
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link http://dwoo.org/
* @version 1.0.0
* @date 2008-09-08
* @package Dwoo
*/
function
Dwoo_Plugin_url_compile
(
Dwoo_Compiler
$compiler
,
$route
=
null
,
$params
=
null
,
$options
=
null
,
array
$rest
=
array
())
{
if
(
$params
==
'null'
)
{
if
(
count
(
$rest
))
{
$params
=
array
();
foreach
(
$rest
as
$k
=>
$v
)
{
if
(
is_numeric
(
$k
))
{
$params
[]
=
$k
.
'=>'
.
$v
;
}
else
{
$params
[]
=
'"'
.
$k
.
'"=>'
.
$v
;
}
}
$params
=
'array('
.
implode
(
', '
,
$params
)
.
')'
;
}
else
{
$params
=
'array()'
;
}
}
if
(
$options
==
'null'
)
{
$options
=
'array()'
;
}
return
'$this->data[\'ro\']->gen('
.
$route
.
', '
.
$params
.
', '
.
$options
.
')'
;
<?php
/**
* <strong>Agavi specific plugin</strong>
*
* uses AgaviRouting to create an url
*
* <pre>
* * route : the route name, optional (by default the current url is returned)
* * params : an array with variables to build the route, optional
* * options : an array of options to pass to the routing object, optional
* * rest : for convenience, you can just pass named parameters that will be used as
* the params array, but you must not provide the params array in this case
* </pre>
*
* Examples:
* <code>
* {a url("route.name" array(param="Value", param2=$otherVal))}Here is a link{/a}
* <form action="{url}"> {* without any parameter it just returns the current url *}
* </code>
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link http://dwoo.org/
* @version 1.0.0
* @date 2008-09-08
* @package Dwoo
*/
function
Dwoo_Plugin_url_compile
(
Dwoo_Compiler
$compiler
,
$route
=
null
,
$params
=
null
,
$options
=
null
,
array
$rest
=
array
())
{
if
(
$params
==
'null'
)
{
if
(
count
(
$rest
))
{
$params
=
array
();
foreach
(
$rest
as
$k
=>
$v
)
{
if
(
is_numeric
(
$k
))
{
$params
[]
=
$k
.
'=>'
.
$v
;
}
else
{
$params
[]
=
'"'
.
$k
.
'"=>'
.
$v
;
}
}
$params
=
'array('
.
implode
(
', '
,
$params
)
.
')'
;
}
else
{
$params
=
'array()'
;
}
}
if
(
$options
==
'null'
)
{
$options
=
'array()'
;
}
return
'$this->data[\'ro\']->gen('
.
$route
.
', '
.
$params
.
', '
.
$options
.
')'
;
}
\ No newline at end of file
lib/Dwoo/IPluginProxy.php
View file @
6075f215
<?php
/**
* interface that represents a dwoo plugin proxy
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
*
* @author Denis Arh <denis@arh.cc>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Denis Arh, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link http://dwoo.org/
* @version 0.9.1
* @date 2008-05-30
* @package Dwoo
*/
interface
Dwoo_IPluginProxy
{
/**
* returns true or false to say whether the given plugin is handled by this proxy or not
*
* @param string $name the plugin name
* @return bool true if the plugin is known and usable, otherwise false
*/
public
function
handles
(
$name
);
/**
* returns the code (as a string) to call the plugin
* (this will be executed at runtime inside the Dwoo class)
*
* @param string $name the plugin name
* @param array $params a parameter array, array key "*" is the rest array
* @return string
*/
public
function
getCode
(
$name
,
$params
);
/**
* returns a callback to the plugin, this is used with the reflection API to
* find out about the plugin's parameter names etc.
*
* should you need a rest array without the possibility to edit the
* plugin's code, you can provide a callback to some
* other function with the correct parameter signature, i.e. :
* <code>
* return array($this, "callbackHelper");
* // and callbackHelper would be as such:
* public function callbackHelper(array $rest=array()){}
* </code>
*
* @param string $name the plugin name
* @return callback
*/
public
function
getCallback
(
$name
);
/**
* returns some code that will check if the plugin is loaded and if not load it
* this is optional, if your plugins are autoloaded or whatever, just return an
* empty string
*
* @param string $name the plugin name
* @return string
*/
public
function
getLoader
(
$name
);
<?php
/**
* interface that represents a dwoo plugin proxy
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
*
* This file is released under the LGPL
* "GNU Lesser General Public License"
* More information can be found here:
* {@link http://www.gnu.org/copyleft/lesser.html}
*
* @author Denis Arh <denis@arh.cc>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Denis Arh, Jordi Boggiano
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link http://dwoo.org/
* @version 0.9.1
* @date 2008-05-30
* @package Dwoo
*/
interface
Dwoo_IPluginProxy
{
/**
* returns true or false to say whether the given plugin is handled by this proxy or not
*
* @param string $name the plugin name
* @return bool true if the plugin is known and usable, otherwise false
*/
public
function
handles
(
$name
);
/**
* returns the code (as a string) to call the plugin
* (this will be executed at runtime inside the Dwoo class)
*
* @param string $name the plugin name
* @param array $params a parameter array, array key "*" is the rest array
* @return string
*/
public
function
getCode
(
$name
,
$params
);
/**
* returns a callback to the plugin, this is used with the reflection API to
* find out about the plugin's parameter names etc.
*
* should you need a rest array without the possibility to edit the
* plugin's code, you can provide a callback to some
* other function with the correct parameter signature, i.e. :
* <code>
* return array($this, "callbackHelper");
* // and callbackHelper would be as such:
* public function callbackHelper(array $rest=array()){}
* </code>
*
* @param string $name the plugin name
* @return callback
*/
public
function
getCallback
(
$name
);
/**
* returns some code that will check if the plugin is loaded and if not load it
* this is optional, if your plugins are autoloaded or whatever, just return an
* empty string
*
* @param string $name the plugin name
* @return string
*/
public
function
getLoader
(
$name
);
}
\ No newline at end of file
lib/dwooAutoload.php
View file @
6075f215
<?php
function
dwooAutoload
(
$class
)
{
if
(
substr
(
$class
,
0
,
5
)
===
'Dwoo_'
)
{
include
strtr
(
$class
,
'_'
,
DIRECTORY_SEPARATOR
)
.
'.php'
;
}
}
spl_autoload_register
(
'dwooAutoload'
);
set_include_path
(
str_replace
(
PATH_SEPARATOR
.
dirname
(
__FILE__
),
''
,
get_include_path
())
.
PATH_SEPARATOR
.
dirname
(
__FILE__
));
<?php
function
dwooAutoload
(
$class
)
{
if
(
substr
(
$class
,
0
,
5
)
===
'Dwoo_'
)
{
include
strtr
(
$class
,
'_'
,
DIRECTORY_SEPARATOR
)
.
'.php'
;
}
}
spl_autoload_register
(
'dwooAutoload'
);
set_include_path
(
str_replace
(
PATH_SEPARATOR
.
dirname
(
__FILE__
),
''
,
get_include_path
())
.
PATH_SEPARATOR
.
dirname
(
__FILE__
));
include
'Dwoo.php'
;
\ No newline at end of file
tests/resources/plugins/loaderTest.php
View file @
6075f215
<?php
function
Dwoo_Plugin_loaderTest
(
Dwoo
$dwoo
)
{
return
'Moo'
;
}
<?php
function
Dwoo_Plugin_loaderTest
(
Dwoo
$dwoo
)
{
return
'Moo'
;
}
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