本文整理汇总了PHP中FileHelper::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHelper::getFile方法的具体用法?PHP FileHelper::getFile怎么用?PHP FileHelper::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelper
的用法示例。
在下文中一共展示了FileHelper::getFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Build
/**
* Populates Source View Model
* @return Source_Vm
*/
public function Build()
{
$fname = FileHelper::getFilename();
$data = FileHelper::getFile(Config::$SongDirectory . $fname);
$viewModel = new Source_Vm();
$viewModel->PageTitle = 'Song Source for "' . $fname . '" ChordPro (CPM)/UkeGeeks File Format';
$viewModel->Body = htmlspecialchars($data);
return $viewModel;
}
示例2: getSettings
/**
* Does not validate values, but does ensure only valid JSON was provided.
* @method getSettings
* @return string
*/
private function getSettings()
{
$settings = FileHelper::getFile(Config::$AppDirectory . 'settings.json');
if ($settings === null) {
return '{}';
}
if (!function_exists('json_decode')) {
return $settings;
}
$json = preg_replace("#(/\\*([^*]|[\r\n]|(\\*+([^*/]|[\r\n])))*\\*+/)|([\\s\t]//.*)|(^//.*)#", '', $settings);
if (json_decode($json)) {
return $settings;
}
return '{"invalidJson": "There is a problem with your settings: invalid JSON. Please check for typos."}';
}
示例3: buildFileList
/**
* Emits list of links to all songs in the directory.
* @method buildFileList
* @return (song array)
*/
private function buildFileList($files)
{
$list = new SongListPlus_Pvm();
foreach ($files as $fname) {
$s = preg_replace(Config::FileNamePattern, '$1', $fname);
$content = FileHelper::getFile(Config::$SongDirectory . $fname);
$parsed = SongHelper::parseSong($content);
$song = new SongLinkPlus_Pvm();
$song->Uri = Ugs::MakeUri(Actions::Song, $s);
$song->HasInfo = strlen($parsed->title) + strlen($parsed->artist) > 0;
$song->Title = $this->fixLeadingArticle(strlen($parsed->title) > 0 ? $parsed->title : $this->filenameToTitle($s));
$song->Subtitle = $parsed->subtitle;
$song->Album = $parsed->album;
$song->Artist = $parsed->artist;
$list->SongList[] = $song;
}
return $list->Sort();
}