public static function addRequiredResources($sourceDirectory, $relativeSourceFiles, $prefix, core_kernel_classes_Resource $item, $lang)
    {

        $returnValue = array();

        $directory = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);
        
        foreach ($relativeSourceFiles as $relPath) {

            if(! tao_helpers_File::securityCheck($relPath, true)) {
                throw new common_exception_Error('Invalid resource file path');
            }
                
            $relPath = preg_replace('/^\.\//', '', $relPath);
            $source = $sourceDirectory . $relPath;

            $fh = fopen($source, 'r');
            if (! is_resource($fh)) {
                throw new common_exception_Error('The resource "' . $source . '" cannot be copied.');
            }

            $path = tao_helpers_File::concat(array(
                $prefix ? $prefix : '',
                $relPath
            ));

            // cannot write as PCI do not get cleaned up
            if ($directory->getFile($path)->put($fh)) {
                $returnValue[] = $relPath;
            }
            fclose($fh);
        }

        return $returnValue;
    }
public static function addRequiredResources($sourceDirectory, $relativeSourceFiles, $prefix, core_kernel_classes_Resource $item, $lang)
    {

        $returnValue = array();

        $directory = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);
        
        foreach ($relativeSourceFiles as $relPath) {

            if(! tao_helpers_File::securityCheck($relPath, true)) {
                throw new common_exception_Error('Invalid resource file path');
            }
                
            $relPath = preg_replace('/^\.\//', '', $relPath);
            $source = $sourceDirectory . $relPath;

            $fh = fopen($source, 'r');
            if (! is_resource($fh)) {
                throw new common_exception_Error('The resource "' . $source . '" cannot be copied.');
            }

            $path = tao_helpers_File::concat(array(
                $prefix ? $prefix : '',
                $relPath
            ));

            // cannot write as PCI do not get cleaned up
            if ($directory->getFile($path)->put($fh)) {
                $returnValue[] = $relPath;
            }
            fclose($fh);
        }

        return $returnValue;
    }
public static function addRequiredResources ( $ sourceDirectory , $ relativeSourceFiles , $ prefix , core_kernel_classes_Resource $ item , $ lang ) { $ returnValue = array ( ) ; $ directory = taoItems_models_classes_ItemsService :: singleton ( ) -> getItemDirectory ( $ item , $ lang ) ; foreach ( $ relativeSourceFiles as $ relPath ) { if ( ! tao_helpers_File :: securityCheck ( $ relPath , true ) ) { throw new common_exception_Error ( 'Invalid resource file path' ) ; } $ relPath = preg_replace ( '/^\.\//' , '' , $ relPath ) ; $ source = $ sourceDirectory . $ relPath ; $ fh = fopen ( $ source , 'r' ) ; if ( ! is_resource ( $ fh ) ) { throw new common_exception_Error ( 'The resource "' . $ source . '" cannot be copied.' ) ; } $ path = tao_helpers_File :: concat ( array ( $ prefix ? $ prefix : '' , $ relPath ) ) ; // cannot write as PCI do not get cleaned up if ( $ directory -> getFile ( $ path ) -> put ( $ fh ) ) { $ returnValue [ ] = $ relPath ; } fclose ( $ fh ) ; } return $ returnValue ; }
Add a list of required resources files to an RDF item and keeps the relative path structure
For instances, required css, js etc.

@param string $sourceDirectory
@param array $relativeSourceFiles
@param core_kernel_classes_Resource $item
@param string $lang
@return array
@throws common_exception_Error
Add a list of required resources files to an RDF item and keeps the relative path structure For instances required css js etc .