diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php index 721ecb6ff7..f51b0946b4 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php @@ -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); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php index 85fd45158f..f0e8740b42 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php @@ -92,13 +92,11 @@ class PhraseaEngineQueryParser * @var */ 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; } diff --git a/lib/classes/caption/Field/Value.class.php b/lib/classes/caption/Field/Value.class.php index 842e8360b1..17cc24ce42 100644 --- a/lib/classes/caption/Field/Value.class.php +++ b/lib/classes/caption/Field/Value.class.php @@ -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("", "", "'"), 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 { diff --git a/lib/classes/media/Permalink/Adapter.class.php b/lib/classes/media/Permalink/Adapter.class.php index ca8e2b0c05..dd62d702a7 100644 --- a/lib/classes/media/Permalink/Adapter.class.php +++ b/lib/classes/media/Permalink/Adapter.class.php @@ -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) ); diff --git a/lib/classes/module/console/systemExport.class.php b/lib/classes/module/console/systemExport.class.php index 6602ec0b93..5ad8a18453 100644 --- a/lib/classes/module/console/systemExport.class.php +++ b/lib/classes/module/console/systemExport.class.php @@ -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 %s", $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(); } diff --git a/lib/classes/set/export.class.php b/lib/classes/set/export.class.php index b274840087..ccac183218 100644 --- a/lib/classes/set/export.class.php +++ b/lib/classes/set/export.class.php @@ -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);