CommonFunctions::_parse_log_file PHP Method

_parse_log_file() private static method

private static _parse_log_file ( $string )
    private static function _parse_log_file($string)
    {
        if (defined('PSI_LOG') && is_string(PSI_LOG) && strlen(PSI_LOG) > 0 && (substr(PSI_LOG, 0, 1) == "-" || substr(PSI_LOG, 0, 1) == "+")) {
            $log_file = substr(PSI_LOG, 1);
            if (file_exists($log_file)) {
                $contents = @file_get_contents($log_file);
                if ($contents && preg_match("/^\\-\\-\\-[^-\r\n]+\\-\\-\\- " . preg_quote($string, '/') . "\r?\n/m", $contents, $matches, PREG_OFFSET_CAPTURE)) {
                    $findIndex = $matches[0][1];
                    if (preg_match("/\r?\n/m", $contents, $matches, PREG_OFFSET_CAPTURE, $findIndex)) {
                        $startIndex = $matches[0][1] + 1;
                        if (preg_match("/^\\-\\-\\-[^-\r\n]+\\-\\-\\- /m", $contents, $matches, PREG_OFFSET_CAPTURE, $startIndex)) {
                            $stopIndex = $matches[0][1];
                            return substr($contents, $startIndex, $stopIndex - $startIndex);
                        } else {
                            return substr($contents, $startIndex);
                        }
                    }
                }
            }
        }
        return false;
    }