Clean up the code

This commit is contained in:
Nicolas Le Goff
2014-03-20 01:54:22 +01:00
committed by Jean-Yves Gaulier
parent 344aab4ef2
commit 424fea8c8e
6 changed files with 11 additions and 21 deletions

View File

@@ -124,7 +124,6 @@ class Tooltip implements ControllerProviderInterface
$search_engine = $app['phraseanet.SE'];
$search_engine->setOptions($search_engine_options);
} catch (\Exception $e) {
$search_engine = null;
}

View File

@@ -638,11 +638,9 @@ class PhraseaEngine implements SearchEngineInterface
$sxe = @simplexml_load_string($res['xml']);
foreach ($fields as $name => $field) {
$newValues = array();
if ($sxe && $sxe->description && $sxe->description->{$name}) {
$val = array();
foreach ($sxe->description->{$name} as $value) {
$newValues[(string) $value['meta_id']] = (string) $value;
}

View File

@@ -63,6 +63,10 @@ class caption_Field_Value implements cache_cacheableInterface
* @var string
*/
protected $qjs;
/**
* Tells whether the value is matched against a thesaurus value.
*/
protected $isThesaurusValue;
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));
$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->qjs = $qjs;
$this->qjs = $term . ($context ? '['.$context.']' : '');
$this->isThesaurusValue = true;
} else {
$this->isThesaurusValue = false;
@@ -417,8 +419,6 @@ class caption_Field_Value implements cache_cacheableInterface
}
/**
* qjs property
*
* @return boolean
*/
public function isThesaurusValue()

View File

@@ -306,13 +306,6 @@ class caption_record implements caption_interface, cache_cacheableInterface
$fields = array();
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"> &nbsp;</a>$7'
// , $highlight ? $field->highlight_thesaurus() : $field->get_serialized_values(false, false)
// );
$values = array();
foreach ($field->get_values() as $metaId => $v) {
$values[$metaId] = array(
@@ -333,7 +326,8 @@ class caption_record implements caption_interface, cache_cacheableInterface
if ($searchEngine instanceof SearchEngineInterface) {
$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) {
foreach ($fields as $key => $value) {
if (!isset($ret[$key])) {

View File

@@ -897,7 +897,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
foreach ($fields as $field) {
if (in_array($field->get_thumbtitle(), array('1', $this->app['locale.I18n']))) {
$fields_to_retrieve [] = $field->get_name();
}
}

Binary file not shown.