Back to PhocaDownloadRoute class

Method getDownloadRoute

public static
getDownloadRoute
(mixed $id, mixed $catid, mixed $token, mixed $directDownload = 1)

Method getDownloadRoute - Source code

public static function getDownloadRoute($id, $catid, $token, $directDownload = 1)
{
    $needles = array('download' => '', 'categories' => '', 'category' => (int) $catid, 'file' => (int) $id);
    if ($directDownload == 1) {
        $link = 'index.php?option=com_phocadownload&view=download&id=' . $token . '&download=1&' . Session::getFormToken() . '=1';
    } else {
        $link = 'index.php?option=com_phocadownload&view=download&id=' . $token;
    }
    if ($item = self::_findItem($needles)) {
        if (isset($item->id)) {
            $link .= '&Itemid=' . $item->id;
        }
    }
    return $link;
}