rename plugins to modules
This commit is contained in:
0
local/modules/.gitkeep
Normal file
0
local/modules/.gitkeep
Normal file
17
local/modules/Test/Config/config.xml
Normal file
17
local/modules/Test/Config/config.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<testLoops>
|
||||
<testLoop name="equal" class="Test\TestLoop\Equal"/>
|
||||
</testLoops>
|
||||
|
||||
<loops>
|
||||
<loop name="foo" class="Test\Loop\Foo"/>
|
||||
<loop name="doobitch" class="Test\Loop\Doobitch"/>
|
||||
</loops>
|
||||
|
||||
</config>
|
||||
|
||||
48
local/modules/Test/Loop/Doobitch.php
Normal file
48
local/modules/Test/Loop/Doobitch.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: manu
|
||||
* Date: 15/03/13
|
||||
* Time: 09:23
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
|
||||
namespace Test\Loop;
|
||||
|
||||
use Thelia\Tpex\Element\Loop\BaseLoop;
|
||||
use Thelia\Tpex\Tools;
|
||||
use Thelia\Model\ProductQuery;
|
||||
|
||||
class Doobitch extends BaseLoop {
|
||||
|
||||
public function defineArgs()
|
||||
{
|
||||
return array(
|
||||
"param1",
|
||||
"param2" => array("default" => "foo")
|
||||
);
|
||||
}
|
||||
|
||||
public function exec($text)
|
||||
{
|
||||
|
||||
$res = "";
|
||||
if($this->param1 == 2 || $this->param1 == 3) {
|
||||
for($i = 0; $i < 4; $i++) {
|
||||
$tmp = str_replace("#ALFRED", "foo".$i, $text);
|
||||
if($i%2){
|
||||
$tmp = str_replace("#CHAPO", "bar".$i, $tmp);
|
||||
} else {
|
||||
$tmp = str_replace("#CHAPO", "", $tmp);
|
||||
}
|
||||
|
||||
|
||||
$res .= $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
echo $this->param2;
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
33
local/modules/Test/Loop/Foo.php
Normal file
33
local/modules/Test/Loop/Foo.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: manu
|
||||
* Date: 14/03/13
|
||||
* Time: 15:16
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
|
||||
namespace Test\Loop;
|
||||
|
||||
use Thelia\Tpex\Element\Loop\BaseLoop;
|
||||
|
||||
class Foo extends BaseLoop {
|
||||
|
||||
public function defineArgs()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function exec($text)
|
||||
{
|
||||
$res = "";
|
||||
for($i = 0; $i < 4; $i++) {
|
||||
$tmp = str_replace("#TOTO", "toto".$i, $text);
|
||||
$tmp = str_replace("#TUTU", "tutu".$i, $tmp);
|
||||
|
||||
$res .= $tmp;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
14
local/modules/Test/TestLoop/Equal.php
Normal file
14
local/modules/Test/TestLoop/Equal.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Test\TestLoop;
|
||||
|
||||
use Thelia\Tpex\Element\TestLoop\BaseTestLoop;
|
||||
|
||||
class Equal extends BaseTestLoop
|
||||
{
|
||||
|
||||
public function exec($variable, $value)
|
||||
{
|
||||
return $variable == $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user