src/GenSynth.php
private function replace_keywords($instr)
    {
        $keywords = $replacements = [];

        $keywords[] = '<TIME>';
        $keywords[] = '{TIME}';
        $replacements[] = $replacements[] = number_format($time = $this->get_time(), 3);

        $keywords[] = '<LANGUAGE>';
        $keywords[] = '{LANGUAGE}';
        $replacements[] = $replacements[] = $this->language_data['LANG_NAME'];

        $keywords[] = '<VERSION>';
        $keywords[] = '{VERSION}';
        $replacements[] = $replacements[] = self::VERSION;

        $keywords[] = '<SPEED>';
        $keywords[] = '{SPEED}';
        if ($time <= 0) {
            $speed = 'N/A';
        }
        else {
            $speed = strlen($this->source) / $time;
            if ($speed >= 1024) {
                $speed = sprintf("%.2f KB/s", $speed / 1024.0);
            }
            else {
                $speed = sprintf("%.0f B/s", $speed);
            }
        }
        $replacements[] = $replacements[] = $speed;

        return str_replace($keywords, $replacements, $instr);
    }
private function replace_keywords($instr)
    {
        $keywords = $replacements = [];

        $keywords[] = '<TIME>';
        $keywords[] = '{TIME}';
        $replacements[] = $replacements[] = number_format($time = $this->get_time(), 3);

        $keywords[] = '<LANGUAGE>';
        $keywords[] = '{LANGUAGE}';
        $replacements[] = $replacements[] = $this->language_data['LANG_NAME'];

        $keywords[] = '<VERSION>';
        $keywords[] = '{VERSION}';
        $replacements[] = $replacements[] = self::VERSION;

        $keywords[] = '<SPEED>';
        $keywords[] = '{SPEED}';
        if ($time <= 0) {
            $speed = 'N/A';
        }
        else {
            $speed = strlen($this->source) / $time;
            if ($speed >= 1024) {
                $speed = sprintf("%.2f KB/s", $speed / 1024.0);
            }
            else {
                $speed = sprintf("%.0f B/s", $speed);
            }
        }
        $replacements[] = $replacements[] = $speed;

        return str_replace($keywords, $replacements, $instr);
    }
private function replace_keywords ( $ instr ) { $ keywords = $ replacements = [ ] ; $ keywords [ ] = '<TIME>' ; $ keywords [ ] = '{TIME}' ; $ replacements [ ] = $ replacements [ ] = number_format ( $ time = $ this -> get_time ( ) , 3 ) ; $ keywords [ ] = '<LANGUAGE>' ; $ keywords [ ] = '{LANGUAGE}' ; $ replacements [ ] = $ replacements [ ] = $ this -> language_data [ 'LANG_NAME' ] ; $ keywords [ ] = '<VERSION>' ; $ keywords [ ] = '{VERSION}' ; $ replacements [ ] = $ replacements [ ] = self :: VERSION ; $ keywords [ ] = '<SPEED>' ; $ keywords [ ] = '{SPEED}' ; if ( $ time <= 0 ) { $ speed = 'N/A' ; } else { $ speed = strlen ( $ this -> source ) / $ time ; if ( $ speed >= 1024 ) { $ speed = sprintf ( "%.2f KB/s" , $ speed / 1024.0 ) ; } else { $ speed = sprintf ( "%.0f B/s" , $ speed ) ; } } $ replacements [ ] = $ replacements [ ] = $ speed ; return str_replace ( $ keywords , $ replacements , $ instr ) ; }
Replaces certain keywords in the header and footer with
certain configuration values

@param  string $instr The header or footer content to do replacement on

@return string The header or footer with replaced keywords
@since  1.0.2
Replaces certain keywords in the header and footer with certain configuration values