缺省目录

如果 setFile 没有指定，会去 setDir 目录看有没有特定文件，有则加载

@param string $sPath
@static
@access public
@return void
9106
public static function setDir($sPath) {
		if (static::$_sDir) {
			throw new TangoException('dir define duplicate');
		}
		$sPath = rtrim(trim($sPath), '/');
		if (!is_dir($sPath)) {
			return FALSE;
		}
		static::$_sDir = $sPath . '/';
		return TRUE;
	}
761990
public function addToCdr(File $file): void
    {
        $file->ofs = $this->ofs;
        $this->ofs = $this->ofs->add($file->getTotalLength());
        $this->files[] = $file->getCdrFile();
    }
912342
public function setPasswordHash($passwordHash)
    {
        if ($passwordHash === null) {
            $this->hashedPassword = null;
            return;
        }

        // check that the password hash is valid (sanity check)
        UsersManager::checkPasswordHash($passwordHash, Piwik::translate('Login_ExceptionPasswordMD5HashExpected'));

        $this->hashedPassword = $passwordHash;
    }
1216156
public function setCookie($sName, $sValue, $iExpireDate, $sPath)
    {
        setcookie($sName, $sValue, $iExpireDate, $sPath);
    }
106358
private function setFileAction()
    {
        array_push($this->actions, 'file');

        $this->addForm = array_diff($this->addForm, ['files']);
        $this->editForm = array_diff($this->addForm, ['files']);

        $this->setModelDefaults('files', []);
        $this->setColumnFormat('files', 'files');

        return $this;
    }
434798
public function setFileHead(): void
    {
        // check local service file
        $this->fileHead = $this->prepareFilePath('head', false);
        if (!file_exists($this->fileHead)) {
            // look up for default file
            $this->fileHead = $this->prepareDefaultFilePath('head');
        }
    }
1260379
public function setMode($mode)
    {
        $fs = FileSystem::getFileSystem();

        $fs->chmod($this->getPath(), $mode);
    }
374723
protected function prepareDirectory(string $path, $mode = 0755): void
    {
        $filesystem = $this->getContainer()['files'];

        if (! $filesystem->isDirectory($path)) {
            $filesystem->makeDirectory($path, $mode, true);
        }
    }
661656
protected function setFileHelp($hash)
    {
        $this->data_file = gplcart_path_absolute(gplcart_string_decode($hash));

        if (!is_file($this->data_file)) {
            $this->outputHttpStatus(404);
        }
    }
705120
public function setSrcfile($file)
    {
        if (is_string($file)) {
            $file = new PhingFile($file);
        }
        $this->_sourceFile = $file;
    }
1125153
public function setFile(PhingFile $src)
    {
        $fs = new FileSet();
        $fs->setFile($src);
        $this->addFileSet($fs);
    }
897168
public function setSrcfile($file)
    {
        if (is_string($file)) {
            $this->inFile = new PhingFile($file);
        } else {
            $this->inFile = $file;
        }
    }
1153782
protected function makeDirectory(string $path): void
    {
        if (!$this->filesystem->isDirectory(dirname($path))) {
            $this->filesystem->makeDirectory(dirname($path), 0777, true, true);
        }
    }
104161
protected function _set_files(){
    // Shortcuts for files and dir
    if ( isset($this->cfg['params']['f']) ){
      $this->cfg['params']['files'] = $this->cfg['params']['f'];
      unset($this->cfg['params']['f']);
    }
    if ( isset($this->cfg['params']['d']) ){
      $this->cfg['params']['dir'] = $this->cfg['params']['d'];
      unset($this->cfg['params']['d']);
    }
    // File
    if ( !empty($this->cfg['ext']) && is_file($this->fpath.$this->cfg['url']) ){
      $res = $this->get_file();
    }
    // Preconfigured
    else if ( isset($this->cfg['params']['id']) ){
      $res = $this->get_preconfig();
    }
    // List of files
    else if ( isset($this->cfg['params']['files']) && is_dir($this->fpath.$this->cfg['url']) ){
      $res = $this->get_files();
    }
    // Directory content
    // Vue component
    else if ( isset($this->cfg['params']['dir']) && is_dir($this->fpath.$this->cfg['url']) ){
      $res = $this->get_dir();
    }
    else if ( $this->cfg['is_component'] && is_dir($this->fpath.$this->cfg['url']) ){
      //cpStart:
      $res = [];
      $this->cfg['num'] = 0;
      foreach ( $this->cfg['components'] as $i => $cp ){
        if ( !isset($res[$cp]) ){
          $res[$cp] = $this->get_dir($this->cfg['url'].$cp);
          if ( $res[$cp] ){
            $dir = false;
            foreach ( $res[$cp] as $type => $files ){
              if ( !$dir && count($files) ){
                $dir = $this->fpath.\dirname($files[0]);
              }
              $this->cfg['num'] += \count($files);
            }
            /*
            if ( $dir && is_file($dir.'/bbn.json') ){
              $json = json_decode(file_get_contents($dir.'/bbn.json'));
              if ( isset($json->components) ){
                foreach ( $json->components as $tmp ){
                  if ( !isset($res[$tmp]) && !\in_array($tmp, $this->cfg['components'], true) ){
                    $this->cfg['components'][] = $tmp;
                    goto cpStart;
                    break;
                  }
                }
              }
            }
            */
          }
        }
      }
    }
    // Last but not least, libraries!
    else if ( isset($this->cfg['params']['lib']) ){
      $res = $this->get_libs();
      // Adding dirs to config
      if ( !empty($this->cfg['params']['dirs']) ){
        $dirs = explode(',', $this->cfg['params']['dirs']);
        foreach ( $dirs as $d ){
          if ( $r = $this->get_dir($d) ){
            $this->add($res, $r);
          }
        }
      }
    }
    $this->cfg['content'] = $res ?? [];
    return $this;
  }
521615
public function setFiles($files, $checkLastModified = true)
    {
        $this->_groupKey = null;
        if ($checkLastModified) {
            $this->_lastModified = self::getLastModified($files);
        }
        // normalize paths like in /min/f=<paths>
        foreach ($files as $k => $file) {
            if (0 === strpos($file, '//')) {
                $file = substr($file, 2);
            } elseif (0 === strpos($file, '/') || 1 === strpos($file, ':\\')) {
                $file = substr($file, strlen(self::app()->env->getDocRoot()) + 1);
            }
            $file = strtr($file, '\\', '/');
            $files[$k] = $file;
        }
        $this->_filePaths = $files;
    }
978361
public function save($sPath, $sFilename)
    {
        if (!is_writable($sPath)) {
            $this->setError('Cannot write to ' . $sPath);
            return false;
        }

        $this->oDomPdf->render();
        $bResult = (bool) file_put_contents(
            rtrim($sPath, '/') . '/' . $sFilename,
            $this->oDomPdf->output()
        );

        $this->reset();

        return $bResult;
    }
862586
protected function setThemeDirectory()
    {
        $pos = strrpos($this->dirPath, DIRECTORY_SEPARATOR);

        $this->directory = substr($this->dirPath, $pos + 1);
    }