Back to PhocacartPath class

Method getPath

public static
getPath
(mixed $manager = '')

Method getPath - Source code

public static function getPath($manager = '')
{
    $group = PhocacartUtilsSettings::getManagerGroup($manager);
    $app = Factory::getApplication();
    $paramsC = PhocacartUtils::getComponentParameters();
    // Folder where to stored files for download
    $productImagePath = $paramsC->get('product_image_path', 'images/phocacartproducts');
    $categoryImagePath = $paramsC->get('category_image_path', 'images/phocacartcategories');
    $downloadFolder = $paramsC->get('download_folder', 'phocacartdownload');
    $downloadFolderPublic = $paramsC->get('public_download_folder', 'phocacartdownloadpublic');
    $attachmentFolder = $paramsC->get('attachment_folder', 'phocacartattachment');
    $uploadFolder = $paramsC->get('upload_folder', 'phocacartupload');
    // frontend upload
    // Absolute path which can be outside public_html - if this will be set, download folder will be ignored
    $absolutePath = $paramsC->get('absolute_path', '');
    $absolutePathUpload = $paramsC->get('absolute_path_upload', '');
    // Path of preview and play
    //$downloadFolderPap 			= JPath::clean($downloadFolderPap);
    //$path['orig_abs_pap'] 		= JPATH_ROOT .  '/' . $downloadFolderPap;
    //$path['orig_abs_pap_ds'] 	= $path['orig_abs_pap'] . '/' ;
    $path['media_abs_front_ds'] = JPATH_ROOT . '/media/com_phocacart/images/';
    if ($group['f'] == 8) {
        $attachmentFolder = Path::clean($attachmentFolder);
        $path['orig_abs'] = JPATH_ROOT . '/' . $attachmentFolder;
        $path['orig_abs_ds'] = JPATH_ROOT . '/' . $attachmentFolder . '/';
        $attachmentFolderRel = Path::clean($attachmentFolder);
        $path['orig_rel'] = '../' . $attachmentFolderRel;
        $path['orig_rel_ds'] = '../' . $attachmentFolderRel . '/';
        $path['orig_rel_path'] = Juri::root() . $attachmentFolderRel;
        $path['orig_rel_path_ds'] = Juri::root() . $attachmentFolderRel . '/';
    } else {
        if ($group['f'] == 6) {
            $downloadFolderPublic = Path::clean($downloadFolderPublic);
            $path['orig_abs'] = JPATH_ROOT . '/' . $downloadFolderPublic;
            $path['orig_abs_ds'] = JPATH_ROOT . '/' . $downloadFolderPublic . '/';
            $downloadFolderPublicRel = Path::clean($downloadFolderPublic);
            $path['orig_rel'] = '../' . $downloadFolderPublicRel;
            $path['orig_rel_ds'] = '../' . $downloadFolderPublicRel . '/';
            $path['orig_rel_path'] = Juri::root() . $downloadFolderPublicRel;
            $path['orig_rel_path_ds'] = Juri::root() . $downloadFolderPublicRel . '/';
        } else {
            if ($group['f'] == 4) {
                // Images Categories
                $path['orig_abs'] = JPATH_ROOT . '/' . $categoryImagePath;
                $path['orig_abs_ds'] = $path['orig_abs'] . '/';
                $path['orig_rel'] = $categoryImagePath;
                $path['orig_rel_ds'] = $path['orig_rel'] . '/';
            } else {
                if ($group['f'] == 5) {
                    // Images Products
                    $path['orig_abs'] = JPATH_ROOT . '/' . $productImagePath;
                    $path['orig_abs_ds'] = $path['orig_abs'] . '/';
                    $path['orig_rel'] = $productImagePath;
                    $path['orig_rel_ds'] = $path['orig_rel'] . '/';
                } else {
                    if ($group['f'] == 7) {
                        // Standard Path - Upload
                        if ($absolutePathUpload != '') {
                            $uploadFolder = Path::clean($absolutePathUpload);
                            $path['orig_abs'] = $uploadFolder;
                            $path['orig_abs_ds'] = Path::clean($path['orig_abs'] . '/');
                            $path['orig_rel'] = '';
                            $path['orig_rel_ds'] = '';
                        } else {
                            $uploadFolder = Path::clean($uploadFolder);
                            $path['orig_abs'] = JPATH_ROOT . '/' . $uploadFolder;
                            $path['orig_abs_ds'] = JPATH_ROOT . '/' . $uploadFolder . '/';
                            $uploadFolderRel = Path::clean($uploadFolder);
                            $path['orig_rel_ds'] = '../' . $uploadFolderRel;
                            $path['orig_rel_ds'] = '../' . $uploadFolderRel . '/';
                            $path['orig_rel_path'] = Juri::root() . $uploadFolderRel;
                            $path['orig_rel_path_ds'] = Juri::root() . $uploadFolderRel . '/';
                        }
                    } else {
                        if ($group['f'] == 3) {
                            // Standard Path - Download
                            if ($absolutePath != '') {
                                $downloadFolder = Path::clean($absolutePath);
                                $path['orig_abs'] = $downloadFolder;
                                $path['orig_abs_ds'] = Path::clean($path['orig_abs'] . '/');
                                $path['orig_rel'] = '';
                                $path['orig_rel_ds'] = '';
                            } else {
                                $downloadFolder = Path::clean($downloadFolder);
                                $path['orig_abs'] = JPATH_ROOT . '/' . $downloadFolder;
                                $path['orig_abs_ds'] = JPATH_ROOT . '/' . $downloadFolder . '/';
                                $downloadFolderRel = Path::clean($downloadFolder);
                                $path['orig_rel_ds'] = '../' . $downloadFolderRel;
                                $path['orig_rel_ds'] = '../' . $downloadFolderRel . '/';
                                $path['orig_rel_path'] = Juri::root() . $downloadFolderRel;
                                $path['orig_rel_path_ds'] = Juri::root() . $downloadFolderRel . '/';
                            }
                        } else {
                            $path['orig_abs'] = JPATH_ROOT . '/tmp';
                            $path['orig_abs_ds'] = JPATH_ROOT . '/tmp/';
                            $path['orig_rel'] = '';
                            $path['orig_rel_ds'] = '';
                        }
                    }
                }
            }
        }
    }
    return $path;
}