Exemplo n.º 1
0
 /**
  * Reads the TypoScript file from the given path and filename.
  * If it doesn't exist, this function will just return an empty string.
  *
  * @param string $pathAndFilename Path and filename of the TypoScript file
  * @return string The content of the .fusion file, plus one chr(10) at the end
  */
 protected function readExternalTypoScriptFile($pathAndFilename)
 {
     return is_file($pathAndFilename) ? Files::getFileContents($pathAndFilename) . chr(10) : '';
 }
 /**
  * Returns a key by its name
  *
  * @param string $name
  * @return boolean
  * @throws SecurityException
  */
 public function getKey($name)
 {
     if (strlen($name) === 0) {
         throw new SecurityException('Required name argument was empty', 1334215378);
     }
     $keyPathAndFilename = $this->getKeyPathAndFilename($name);
     if (!file_exists($keyPathAndFilename)) {
         throw new SecurityException(sprintf('The key "%s" does not exist.', $keyPathAndFilename), 1305812921);
     }
     $key = Utility\Files::getFileContents($keyPathAndFilename);
     if ($key === false) {
         throw new SecurityException(sprintf('The key "%s" could not be read.', $keyPathAndFilename), 1334483163);
     }
     if (strlen($key) === 0) {
         throw new SecurityException(sprintf('The key "%s" is empty.', $keyPathAndFilename), 1334483165);
     }
     return $key;
 }