Get an absolute path to a lock file for a specified file path.

@param string $file The absolute path to get the lock filename for.
@param array $options An array of options for the process.
@return string The absolute path for the lock file
184553
protected function lockFileName($file, array $options = array()) {
        $lockDir = $this->getOption('lock_dir', $options, $this->getCachePath() . 'locks' . DIRECTORY_SEPARATOR);
        return $lockDir . preg_replace('/\W/', '_', $file) . $this->getOption(xPDO::OPT_LOCKFILE_EXTENSION, $options, '.lock');
    }
743358
public static function public_path(?string $file = null)
  {
    $file = (substr($file, 0, 1) == DIRECTORY_SEPARATOR ? substr($file, 1) : $file);
    return config('app.dir') . 'storage' . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . $file;
  }
413319
public function decode($file, array $options = [])
    {
        $image  = new Image($file);
        $binary = $image->getBinaryString();

        return $this->decodeMessage($binary, $options);
    }
217807
public function getFilePath($file): string
    {
        if (null === ($fileObj = $this->container->get('huh.utils.file')->getFileFromUuid($file))) {
            return '';
        }

        return $fileObj->path;
    }
134359
public function getKeyPair($file = false)
    {
        $pk = $this->_generatePK();

        openssl_pkey_export($pk, $privKey, null, $this->certConfigure);
        $pubKey = openssl_pkey_get_details($pk);

        $keys = new KeyPair();
        $keys->setPrivateKey($privKey)->setPublicKey($pubKey['key']);

        if ($file) {
            file_put_contents($this->fileName . static::PRIV_KEY_FILENAME , $keys->getPrivateKey());
            file_put_contents($this->fileName . static::PUB_KEY_FILENAME , $keys->getPublicKey());
        }

        return $keys;
    }
1133284
protected function getFileRecord($file)
    {
        $result = null;
        $segment = implode('/', [DIRNAME_GEOLOCATION, $this->geolocator->getGeolocatorHandle(), $file]);
        $fileLocator = $this->app->make(FileLocator::class);
        /* @var FileLocator $fileLocator */
        $package = $this->geolocator->getGeolocatorPackage();
        if ($package !== null) {
            $fileLocator->addPackageLocation($package->getPackageHandle());
        }

        return $fileLocator->getRecord($segment);
    }
678640
private function css($file, $path = 'css', array $options = [])
    {
        $attr = array_key_exists('attr', $options) ? $options['attr'] : [];
        $attr = array_merge(['rel' => 'stylesheet'], $attr);
        $location = $this->location("{$path}/{$file}", $options);
        return sprintf(
            '<link href="%s" %s>',
            $location,
            $this->attributesStr($attr)
        );
    }
191142
protected function checkOneFile($file)
  {
    $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
    $_aclConfig = $this->_config->getAccessControlConfig();
    $directory = str_replace('\\','/', $resourceTypeInfo->getDirectory());
    $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($file->getFilename());

    if ($this->_config->forceAscii()) {
      $fileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($fileName);
    }
    $pathName = str_replace('\\','/', pathinfo($file->getPathname(), PATHINFO_DIRNAME) );
    $pathName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($pathName);

    // acl
    $aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(), str_ireplace($directory,'',$pathName));
    $isAuthorized = (($aclMask & CKFINDER_CONNECTOR_ACL_FILE_VIEW) == CKFINDER_CONNECTOR_ACL_FILE_VIEW);
    if ( !$isAuthorized ){
      return false;
    }

    // if it is a folder fileName represents the dir
    if ( $file->isDir() && ( !CKFinder_Connector_Utils_FileSystem::checkFolderPath($fileName) || $resourceTypeInfo->checkIsHiddenPath($fileName) ) ){
      return false;
    }
    // folder name
    if ( !CKFinder_Connector_Utils_FileSystem::checkFolderPath($pathName) ){
      return false;
    }

    // is hidden
    if ( $resourceTypeInfo->checkIsHiddenPath($pathName) || $resourceTypeInfo->checkIsHiddenFile($fileName) ){
      return false;
    }

    // extension
    if ( !$resourceTypeInfo->checkExtension($fileName) || !CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) ){
      return false;
    }

    return true;
  }
216472
public static function checkFileName($file)
    {
        return strpos($file, '/') === false && strpos($file, '\\') === false && strpos($file, '..') === false;
    }
1010430
protected function getFilePath(string $file, ?string $extension = null, ?string $suffix = null): string
	{
		if(strpos($file, '::') === false)
		{
			// No namespace so we'll just use the default path

			$path = $this->path;
		}
		else
		{
			// The file is namespaced so we'll use the namespace path

			[$namespace, $file] = explode('::', $file, 2);

			if(!isset($this->namespaces[$namespace]))
			{
				throw new RuntimeException(vsprintf('The [ %s ] namespace does not exist.', [$namespace]));
			}

			$path = $this->namespaces[$namespace];
		}

		// Append suffix to path if needed

		if($suffix !== null)
		{
			$path .= DIRECTORY_SEPARATOR . $suffix;
		}

		// Return full path to file

		return $path . DIRECTORY_SEPARATOR . str_replace('.', DIRECTORY_SEPARATOR, $file) . ($extension ?? $this->extension);
	}
612577
public function putFile($path, $file, $options = [])
    {
        return $this->putFileAs($path, $file, $file->hashName(), $options);
    }
749004
public static function get_sideloaded_file_loc( $file ) {
		$upload = wp_upload_dir();
		$dir = $upload['path'];
		$filename = $file;
		$file = parse_url($file);
		$path_parts = pathinfo($file['path']);
		$basename = md5($filename);
		$ext = 'jpg';
		if ( isset($path_parts['extension']) ) {
			$ext = $path_parts['extension'];
		}
		return $dir.'/'.$basename.'.'.$ext;
	}
1118265
public function attachFile($file, $options=[]) {
		$attachment = \Swift_Attachment::fromPath($file);
		if(isset($options['filename']))
			$attachment->setFilename($options['filename']);
		if(isset($options['mime']))
			$attachment->setContentType($options['mime']);
		return $this->attach($attachment);
	}
903227
protected function loadFile(string $file, array $options): ?Config
    {
        if (is_dir($file)) {
            return (bool)($options['recursive'] ?? false) ? $this->load($file, $options) : null;
        }

        return $this->getFileLoader()->load($file, $options);
    }
545395
protected function loadFile(string $file, array $options)
    {
        return parse_ini_file(
            $file,
            $options['process_sections'] ?? true,
            $options['mode'] ?? INI_SCANNER_NORMAL
        );
    }
567288
public function locateFile($file)
    {
        $components = $this->parseResource($file);
        if ($components['path']) {
            $path = dirname($components['path']) . '/public/';

            return $path . $components['file'];
        } else {
            return $components['file'];
        }
    }
533137
public function getDiffFile($file)
    {
        $args = [
            '-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision,
            '--', $this->repository->getWikiDir().$file,
        ];

        $diff = Diff::parse($this->repository->run('diff-tree', $args));
        $diff->setRepository($this->repository);

        return $diff;
    }