mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Clean up the code
This commit is contained in:

committed by
Jean-Yves Gaulier

parent
344aab4ef2
commit
424fea8c8e
@@ -124,7 +124,6 @@ class Tooltip implements ControllerProviderInterface
|
|||||||
|
|
||||||
$search_engine = $app['phraseanet.SE'];
|
$search_engine = $app['phraseanet.SE'];
|
||||||
$search_engine->setOptions($search_engine_options);
|
$search_engine->setOptions($search_engine_options);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$search_engine = null;
|
$search_engine = null;
|
||||||
}
|
}
|
||||||
|
@@ -638,13 +638,11 @@ class PhraseaEngine implements SearchEngineInterface
|
|||||||
|
|
||||||
$sxe = @simplexml_load_string($res['xml']);
|
$sxe = @simplexml_load_string($res['xml']);
|
||||||
|
|
||||||
|
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
$newValues = array();
|
$newValues = array();
|
||||||
if ($sxe && $sxe->description && $sxe->description->{$name}) {
|
if ($sxe && $sxe->description && $sxe->description->{$name}) {
|
||||||
$val = array();
|
|
||||||
foreach ($sxe->description->{$name} as $value) {
|
foreach ($sxe->description->{$name} as $value) {
|
||||||
$newValues[(string)$value['meta_id']] = (string) $value;
|
$newValues[(string) $value['meta_id']] = (string) $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret[$name] = $newValues;
|
$ret[$name] = $newValues;
|
||||||
|
@@ -63,6 +63,10 @@ class caption_Field_Value implements cache_cacheableInterface
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $qjs;
|
protected $qjs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells whether the value is matched against a thesaurus value.
|
||||||
|
*/
|
||||||
protected $isThesaurusValue;
|
protected $isThesaurusValue;
|
||||||
|
|
||||||
protected static $localCache = array();
|
protected static $localCache = array();
|
||||||
@@ -400,13 +404,11 @@ class caption_Field_Value implements cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bestnode)
|
if($bestnode) {
|
||||||
{
|
|
||||||
list($term, $context) = $this->splitTermAndContext(str_replace(array("[[em]]", "[[/em]]"), array("", ""), $value));
|
list($term, $context) = $this->splitTermAndContext(str_replace(array("[[em]]", "[[/em]]"), array("", ""), $value));
|
||||||
$qjs = $term . ($context ? '['.$context.']' : '');
|
// a value has been found in thesaurus, update value & set the query to bounce to the value
|
||||||
|
|
||||||
$this->value = $bestnode->getAttribute('v');
|
$this->value = $bestnode->getAttribute('v');
|
||||||
$this->qjs = $qjs;
|
$this->qjs = $term . ($context ? '['.$context.']' : '');
|
||||||
$this->isThesaurusValue = true;
|
$this->isThesaurusValue = true;
|
||||||
} else {
|
} else {
|
||||||
$this->isThesaurusValue = false;
|
$this->isThesaurusValue = false;
|
||||||
@@ -417,8 +419,6 @@ class caption_Field_Value implements cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qjs property
|
|
||||||
*
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isThesaurusValue()
|
public function isThesaurusValue()
|
||||||
|
@@ -306,13 +306,6 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
$fields = array();
|
$fields = array();
|
||||||
|
|
||||||
foreach ($this->get_fields($grep_fields, $includeBusiness) as $meta_struct_id => $field) {
|
foreach ($this->get_fields($grep_fields, $includeBusiness) as $meta_struct_id => $field) {
|
||||||
|
|
||||||
// $value = preg_replace(
|
|
||||||
// "(([^']{1})((https?|file):((/{2,4})|(\\{2,4}))[\w:#%/;$()~_?/\-=\\\.&]*)([^']{1}))"
|
|
||||||
// , '$1 $2 <a title="' . _('Open the URL in a new window') . '" class="ui-icon ui-icon-extlink" href="$2" style="display:inline;padding:2px 5px;margin:0 4px 0 2px;" target="_blank"> </a>$7'
|
|
||||||
// , $highlight ? $field->highlight_thesaurus() : $field->get_serialized_values(false, false)
|
|
||||||
// );
|
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
foreach ($field->get_values() as $metaId => $v) {
|
foreach ($field->get_values() as $metaId => $v) {
|
||||||
$values[$metaId] = array(
|
$values[$metaId] = array(
|
||||||
@@ -333,7 +326,8 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
if ($searchEngine instanceof SearchEngineInterface) {
|
if ($searchEngine instanceof SearchEngineInterface) {
|
||||||
$ret = $searchEngine->excerpt($highlight, $fields, $this->record);
|
$ret = $searchEngine->excerpt($highlight, $fields, $this->record);
|
||||||
|
|
||||||
// sets highlighted value from search engine
|
// sets highlighted value from search engine, highlighted values will now
|
||||||
|
// be surrounded by [[em]][[/em]] tags
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
if (!isset($ret[$key])) {
|
if (!isset($ret[$key])) {
|
||||||
|
@@ -897,7 +897,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
if (in_array($field->get_thumbtitle(), array('1', $this->app['locale.I18n']))) {
|
if (in_array($field->get_thumbtitle(), array('1', $this->app['locale.I18n']))) {
|
||||||
|
|
||||||
$fields_to_retrieve [] = $field->get_name();
|
$fields_to_retrieve [] = $field->get_name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -906,7 +905,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
$retrieved_fields = $this->get_caption()->get_highlight_fields($highlight, $fields_to_retrieve, $searchEngine);
|
$retrieved_fields = $this->get_caption()->get_highlight_fields($highlight, $fields_to_retrieve, $searchEngine);
|
||||||
$titles = array();
|
$titles = array();
|
||||||
foreach ($retrieved_fields as $value) {
|
foreach ($retrieved_fields as $value) {
|
||||||
foreach($value['values'] as $v) {
|
foreach ($value['values'] as $v) {
|
||||||
$titles[] = $v['value'];
|
$titles[] = $v['value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user