src/GenSynth.php
private function handle_keyword_replace($match)
    {
        $k = $this->_kw_replace_group;
        $keyword = $match[0];
        $keyword_match = $match[1];

        $before = '';
        $after = '';

        if ($this->keyword_links) {
            // Keyword links have been ebabled

            if (isset($this->language_data['URLS'][$k]) &&
                $this->language_data['URLS'][$k] != ''
            ) {
                // There is a base group for this keyword

                // Old system: strtolower
                //$keyword = ( $this->language_data['CASE_SENSITIVE'][$group] ) ? $keyword : strtolower($keyword);
                // New system: get keyword from language file to get correct case
                if (!$this->language_data['CASE_SENSITIVE'][$k] &&
                    strpos($this->language_data['URLS'][$k], '{FNAME}') !== false
                ) {
                    foreach ($this->language_data['KEYWORDS'][$k] as $word) {
                        if (strcasecmp($word, $keyword_match) == 0) {
                            break;
                        }
                    }
                }
                else {
                    $word = $keyword_match;
                }

                $before = '<|UR1|"' .
                          str_replace(
                              [
                                  '{FNAME}',
                                  '{FNAMEL}',
                                  '{FNAMEU}',
                                  '.'],
                              [
                                  str_replace('+', '%20', urlencode($this->hsc($word))),
                                  str_replace('+', '%20', urlencode($this->hsc(strtolower($word)))),
                                  str_replace('+', '%20', urlencode($this->hsc(strtoupper($word)))),
                                  '<DOT>'],
                              $this->language_data['URLS'][$k]
                          ) . '">';
                $after = '</a>';
            }
        }

        return $before . '<|/' . $k . '/>' . $this->change_case($keyword) . '|>' . $after;
    }
private function handle_keyword_replace($match)
    {
        $k = $this->_kw_replace_group;
        $keyword = $match[0];
        $keyword_match = $match[1];

        $before = '';
        $after = '';

        if ($this->keyword_links) {
            // Keyword links have been ebabled

            if (isset($this->language_data['URLS'][$k]) &&
                $this->language_data['URLS'][$k] != ''
            ) {
                // There is a base group for this keyword

                // Old system: strtolower
                //$keyword = ( $this->language_data['CASE_SENSITIVE'][$group] ) ? $keyword : strtolower($keyword);
                // New system: get keyword from language file to get correct case
                if (!$this->language_data['CASE_SENSITIVE'][$k] &&
                    strpos($this->language_data['URLS'][$k], '{FNAME}') !== false
                ) {
                    foreach ($this->language_data['KEYWORDS'][$k] as $word) {
                        if (strcasecmp($word, $keyword_match) == 0) {
                            break;
                        }
                    }
                }
                else {
                    $word = $keyword_match;
                }

                $before = '<|UR1|"' .
                          str_replace(
                              [
                                  '{FNAME}',
                                  '{FNAMEL}',
                                  '{FNAMEU}',
                                  '.'],
                              [
                                  str_replace('+', '%20', urlencode($this->hsc($word))),
                                  str_replace('+', '%20', urlencode($this->hsc(strtolower($word)))),
                                  str_replace('+', '%20', urlencode($this->hsc(strtoupper($word)))),
                                  '<DOT>'],
                              $this->language_data['URLS'][$k]
                          ) . '">';
                $after = '</a>';
            }
        }

        return $before . '<|/' . $k . '/>' . $this->change_case($keyword) . '|>' . $after;
    }
private function handle_keyword_replace ( $ match ) { $ k = $ this -> _kw_replace_group ; $ keyword = $ match [ 0 ] ; $ keyword_match = $ match [ 1 ] ; $ before = '' ; $ after = '' ; if ( $ this -> keyword_links ) { // Keyword links have been ebabled
 if ( isset ( $ this -> language_data [ 'URLS' ] [ $ k ] ) && $ this -> language_data [ 'URLS' ] [ $ k ] != '' ) { // There is a base group for this keyword
 // Old system: strtolower
 //$keyword = ( $this->language_data['CASE_SENSITIVE'][$group] ) ? $keyword : strtolower($keyword);
 // New system: get keyword from language file to get correct case
 if ( ! $ this -> language_data [ 'CASE_SENSITIVE' ] [ $ k ] && strpos ( $ this -> language_data [ 'URLS' ] [ $ k ] , '{FNAME}' ) !== false ) { foreach ( $ this -> language_data [ 'KEYWORDS' ] [ $ k ] as $ word ) { if ( strcasecmp ( $ word , $ keyword_match ) == 0 ) { break ; } } } else { $ word = $ keyword_match ; } $ before = '<|UR1|"' . str_replace ( [ '{FNAME}' , '{FNAMEL}' , '{FNAMEU}' , '.' ] , [ str_replace ( '+' , '%20' , urlencode ( $ this -> hsc ( $ word ) ) ) , str_replace ( '+' , '%20' , urlencode ( $ this -> hsc ( strtolower ( $ word ) ) ) ) , str_replace ( '+' , '%20' , urlencode ( $ this -> hsc ( strtoupper ( $ word ) ) ) ) , '<DOT>' ] , $ this -> language_data [ 'URLS' ] [ $ k ] ) . '">' ; $ after = '</a>' ; } } return $ before . '<|/' . $ k . '/>' . $ this -> change_case ( $ keyword ) . '|>' . $ after ; }
Handles replacements of keywords to include markup and links if requested

@param  string The keyword to add the Markup to

@return The HTML for the match found

@todo   Get rid of ender in keyword links
Handles replacements of keywords to include markup and links if requested