mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
[SearchEngine] Integrate unicode service provider
This commit is contained in:
@@ -67,10 +67,9 @@ class Subdefs implements ControllerProviderInterface
|
||||
} elseif (count($add_subdef) === 3) {
|
||||
|
||||
$subdefs = $databox->get_subdef_structure();
|
||||
$UnicodeProcessor = new \unicode();
|
||||
|
||||
$group = $add_subdef['group'];
|
||||
$name = $UnicodeProcessor->remove_nonazAZ09($add_subdef['name'], false);
|
||||
$name = $app['unicode']->remove_nonazAZ09($add_subdef['name'], false);
|
||||
$class = $add_subdef['class'];
|
||||
|
||||
$subdefs->add_subdef($group, $name, $class);
|
||||
|
@@ -92,13 +92,11 @@ class PhraseaEngineQueryParser
|
||||
* @var <type>
|
||||
*/
|
||||
public $lng;
|
||||
protected $unicode;
|
||||
|
||||
public function __construct(Application $app, $lng = "???")
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->lng = $lng;
|
||||
$this->unicode = new \unicode();
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -1845,7 +1843,7 @@ class PhraseaEngineQueryParser
|
||||
$this->phq = $this->mb_ltrim(mb_substr($this->phq, 1, 99999, 'UTF-8'), 'UTF-8');
|
||||
$this->phq = "";
|
||||
}
|
||||
$context = $this->unicode->remove_indexer_chars($context);
|
||||
$context = $this->app['unicode']->remove_indexer_chars($context);
|
||||
|
||||
return(array("CLASS" => "TOK_CONTEXT", "VALUE" => $context));
|
||||
break;
|
||||
@@ -1871,10 +1869,10 @@ class PhraseaEngineQueryParser
|
||||
$t = "";
|
||||
$c_utf8 = "";
|
||||
for ($i = 0; $i < $l; $i++) {
|
||||
if (!$this->unicode->has_indexer_bad_char(($c_utf8 = mb_substr($this->phq, $i, 1, 'UTF-8')))) {
|
||||
if (!$this->app['unicode']->has_indexer_bad_char(($c_utf8 = mb_substr($this->phq, $i, 1, 'UTF-8')))) {
|
||||
// $c = mb_strtolower($c);
|
||||
// $t .= isset($this->noaccent[$c]) ? $this->noaccent[$c] : $c;
|
||||
$t .= $this->unicode->remove_diacritics(mb_strtolower($c_utf8));
|
||||
$t .= $this->app['unicode']->remove_diacritics(mb_strtolower($c_utf8));
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
@@ -352,8 +352,6 @@ class caption_Field_Value implements cache_cacheableInterface
|
||||
return $value;
|
||||
}
|
||||
|
||||
$unicode = new unicode();
|
||||
|
||||
$DOM_branchs = $XPATH_thesaurus->query($tbranch);
|
||||
|
||||
$fvalue = $value;
|
||||
@@ -361,8 +359,8 @@ class caption_Field_Value implements cache_cacheableInterface
|
||||
$cleanvalue = str_replace(array("<em>", "</em>", "'"), array("", "", "'"), $fvalue);
|
||||
|
||||
list($term_noacc, $context_noacc) = $this->splitTermAndContext($cleanvalue);
|
||||
$term_noacc = $unicode->remove_indexer_chars($term_noacc);
|
||||
$context_noacc = $unicode->remove_indexer_chars($context_noacc);
|
||||
$term_noacc = $this->app['unicode']->remove_indexer_chars($term_noacc);
|
||||
$context_noacc = $this->app['unicode']->remove_indexer_chars($context_noacc);
|
||||
if ($context_noacc) {
|
||||
$q = "//sy[@w='" . $term_noacc . "' and @k='" . $context_noacc . "']";
|
||||
} else {
|
||||
|
@@ -225,13 +225,11 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
|
||||
*/
|
||||
public function set_label($label)
|
||||
{
|
||||
$unicode_processor = new unicode();
|
||||
|
||||
$label = trim($label);
|
||||
while (strpos($label, ' ') !== false)
|
||||
$label = str_replace(' ', ' ', $label);
|
||||
|
||||
$this->label = $unicode_processor->remove_nonazAZ09(
|
||||
$this->label = $this->app['unicode']->remove_nonazAZ09(
|
||||
str_replace(' ', '-', $label)
|
||||
);
|
||||
|
||||
|
@@ -125,8 +125,6 @@ class module_console_systemExport extends Command
|
||||
|
||||
$total = $errors = 0;
|
||||
|
||||
$unicode = new \unicode();
|
||||
|
||||
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
|
||||
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_viewname()));
|
||||
|
||||
@@ -155,7 +153,7 @@ class module_console_systemExport extends Command
|
||||
}
|
||||
|
||||
$local_export = $export_directory
|
||||
. '/' . $unicode->remove_nonazAZ09($databox->get_viewname(), true, true)
|
||||
. '/' . $this->container['unicode']->remove_nonazAZ09($databox->get_viewname(), true, true)
|
||||
. '/';
|
||||
|
||||
$this->getService('filesystem')->mkdir($local_export);
|
||||
@@ -195,7 +193,7 @@ class module_console_systemExport extends Command
|
||||
}
|
||||
|
||||
if ($sanitize) {
|
||||
$filename = $unicode->remove_nonazAZ09($record->get_original_name(), true, true, true);
|
||||
$filename = $this->container['unicode']->remove_nonazAZ09($record->get_original_name(), true, true, true);
|
||||
} else {
|
||||
$filename = $record->get_original_name();
|
||||
}
|
||||
|
@@ -713,8 +713,6 @@ class set_export extends set_abstract
|
||||
|
||||
random::updateToken($app, $token, serialize($list));
|
||||
|
||||
$unicode = new \unicode();
|
||||
|
||||
$toRemove = array();
|
||||
|
||||
foreach ($files as $record) {
|
||||
@@ -727,7 +725,7 @@ class set_export extends set_abstract
|
||||
. $obj["ajout"]
|
||||
. '.' . $obj["exportExt"];
|
||||
|
||||
$name = $unicode->remove_diacritics($name);
|
||||
$name = $app['unicode']->remove_diacritics($name);
|
||||
|
||||
$zip->addFile($path, $name);
|
||||
|
||||
|
Reference in New Issue
Block a user