Back to PhocaDownloadFile class

Method getMimeTypeString

public static
getMimeTypeString
(mixed $params)

Method getMimeTypeString - Source code

public static function getMimeTypeString($params)
{
    $regex_one = '/({\\s*)(.*?)(})/si';
    $regex_all = '/{\\s*.*?}/si';
    $matches = array();
    $count_matches = preg_match_all($regex_all, $params, $matches, PREG_OFFSET_CAPTURE | PREG_PATTERN_ORDER);
    $extString = '';
    $mimeString = '';
    for ($i = 0; $i < $count_matches; $i++) {
        $phocaDownload = $matches[0][$i][0];
        preg_match($regex_one, $phocaDownload, $phocaDownloadParts);
        $values_replace = array("/^'/", "/'\$/", "/^'/", "/'\$/", "/<br \\/>/");
        $values = explode("=", $phocaDownloadParts[2], 2);
        foreach ($values_replace as $key2 => $values2) {
            $values = preg_replace($values2, '', $values);
        }
        // Create strings
        $extString .= $values[0];
        $mimeString .= $values[1];
        $j = $i + 1;
        if ($j < $count_matches) {
            $extString .= ',';
            $mimeString .= ',';
        }
    }
    $string = array();
    $string['mime'] = $mimeString;
    $string['ext'] = $extString;
    return $string;
}