Skip to content
Snippets Groups Projects
Commit 6b8d3b18 authored by efalcy's avatar efalcy
Browse files

dev #17782 : fix first part of RT comments

parent b1722d30
3 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1120Master,!1079Dev #17782 merge print fusion
......@@ -35,6 +35,7 @@
class Class_ModeleFusionLoader extends Storm_Model_Loader {
use Trait_Translator;
public function get($name) {
return $this->findFirstBy(['nom' => $name]);
}
......@@ -79,7 +80,6 @@ class Class_ModeleFusionLoader extends Storm_Model_Loader {
class Class_ModeleFusion extends Storm_Model_Abstract {
use Trait_Translator;
protected $_table_name = 'modele_fusion',
$_loader_class = 'Class_ModeleFusionLoader',
$_table_primary = 'id',
......@@ -99,9 +99,9 @@ class Class_ModeleFusion extends Storm_Model_Abstract {
public function getDecodedContent($content) {
$decoded = preg_replace_callback('/\{[^\}]+\}/',
create_function('$matches',
'return html_entity_decode($matches[0],ENT_QUOTES);'),
$content);
function($matches) {
return html_entity_decode($matches[0],ENT_QUOTES);},
$content);
return $decoded;
}
......@@ -130,13 +130,7 @@ class Class_ModeleFusion extends Storm_Model_Abstract {
foreach ($matches as $match) {
$tag = array_shift($match);
try {
$tag_value = $this->getTagValueForString($match);
} catch (Storm_Model_Exception $e) {
continue;
}
$tag_value = $this->getTagValueForString($match);
$content = str_replace($tag, $tag_value, $content);
}
......@@ -147,15 +141,8 @@ class Class_ModeleFusion extends Storm_Model_Abstract {
public function getTagValueForInstance($match,$instance) {
if (strpos($match,'.') === false)
return $instance->callGetterByAttributeName($match);
else {
return $this->getTagValueForCollectionInstance($match,$instance);
$match = explode('.',$match);
array_shift($match);
}
if (!$instance->callGetterByAttributeName($match))
return '';
$matches = substr($match,0,strpos($match,'.'));
return $this->getTagValueForInstance(substr($match,strpos($match,'.')+1),$instance->callGetterByAttributeName($matches));
return $this->getTagValueForCollectionInstance($match,$instance);
}
......@@ -232,13 +219,10 @@ class Class_ModeleFusion extends Storm_Model_Abstract {
$tag = array_shift($match);
try {
$tag= str_replace('{','',$tag);
$tag= str_replace('}','',$tag);
$tag_value = $this->getTagValueForInstance($tag,$item);
} catch (Storm_Model_Exception $e) {
continue;
}
$tag= str_replace('{','',$tag);
$tag= str_replace('}','',$tag);
$tag_value = $this->getTagValueForInstance($tag,$item);
$decode = str_replace('{'.$tag.'}',
$tag_value,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment