private function loadDictionaries()
    {
        if (null !== $this->words) {
            // Dictionaries already loaded
            return;
        }

        $this->words = array();

        $dictionaryFiles = glob($this->dictionaryDir . '/*');

        foreach ($dictionaryFiles as $dictionaryFile) {
            $fileName = substr($dictionaryFile, strlen($this->dictionaryDir) + 1);

            preg_match('/^(.+)\./', $fileName, $parts);
            $lang = $parts[1];

            $words = include $dictionaryFile;

            foreach ($words as $word) {
                if (!isset($this->words[$word])) {
                    $this->words[$word] = array();
                }

                if (!in_array($lang, $this->words[$word])) {
                    $this->words[$word][] = $lang;
                }
            }
        }
    }
private function loadDictionaries()
    {
        if (null !== $this->words) {
            // Dictionaries already loaded
            return;
        }

        $this->words = array();

        $dictionaryFiles = glob($this->dictionaryDir . '/*');

        foreach ($dictionaryFiles as $dictionaryFile) {
            $fileName = substr($dictionaryFile, strlen($this->dictionaryDir) + 1);

            preg_match('/^(.+)\./', $fileName, $parts);
            $lang = $parts[1];

            $words = include $dictionaryFile;

            foreach ($words as $word) {
                if (!isset($this->words[$word])) {
                    $this->words[$word] = array();
                }

                if (!in_array($lang, $this->words[$word])) {
                    $this->words[$word][] = $lang;
                }
            }
        }
    }
private function loadDictionaries ( ) { if ( null !== $ this -> words ) { // Dictionaries already loaded return ; } $ this -> words = array ( ) ; $ dictionaryFiles = glob ( $ this -> dictionaryDir . '/*' ) ; foreach ( $ dictionaryFiles as $ dictionaryFile ) { $ fileName = substr ( $ dictionaryFile , strlen ( $ this -> dictionaryDir ) + 1 ) ; preg_match ( '/^(.+)\./' , $ fileName , $ parts ) ; $ lang = $ parts [ 1 ] ; $ words = include $ dictionaryFile ; foreach ( $ words as $ word ) { if ( ! isset ( $ this -> words [ $ word ] ) ) { $ this -> words [ $ word ] = array ( ) ; } if ( ! in_array ( $ lang , $ this -> words [ $ word ] ) ) { $ this -> words [ $ word ] [ ] = $ lang ; } } } }
Load dictionaries from directory
Load dictionaries from directory