本文整理汇总了PHP中FilesModel::next方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesModel::next方法的具体用法?PHP FilesModel::next怎么用?PHP FilesModel::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilesModel
的用法示例。
在下文中一共展示了FilesModel::next方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Return if there are no files
*
* @return string
*/
public function generate()
{
// Use the home directory of the current user as file source
if ($this->useHomeDir && FE_USER_LOGGED_IN) {
$this->import('FrontendUser', 'User');
if ($this->User->assignDir && $this->User->homeDir) {
$this->multiSRC = array($this->User->homeDir);
}
} else {
$this->multiSRC = deserialize($this->multiSRC);
}
// Return if there are no files
if (!is_array($this->multiSRC) || empty($this->multiSRC)) {
return '';
}
// Get the file entries from the database
$this->objFiles = \FilesModel::findMultipleByUuids($this->multiSRC);
if ($this->objFiles === null) {
if (!\Validator::isUuid($this->multiSRC[0])) {
return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
return '';
}
$file = \Input::get('file', true);
// Send the file to the browser and do not send a 404 header (see #4632)
if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\\.txt$/', basename($file))) {
while ($this->objFiles->next()) {
if ($file == $this->objFiles->path || dirname($file) == $this->objFiles->path) {
\Controller::sendFileToBrowser($file);
}
}
$this->objFiles->reset();
}
return parent::generate();
}
示例2: compile
/**
* Generate the module
*/
protected function compile()
{
$this->Template->size = '';
// Set the size
if ($this->playerSize != '') {
$size = deserialize($this->playerSize);
if (is_array($size)) {
$this->Template->size = ' width="' . $size[0] . 'px" height="' . $size[1] . 'px"';
}
}
$this->Template->poster = false;
// Optional poster
if ($this->posterSRC != '') {
if (($objFile = \FilesModel::findByPk($this->posterSRC)) !== null) {
$this->Template->poster = $objFile->path;
}
}
// Pre-sort the array by preference
if (in_array($this->objFiles->extension, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv'))) {
$this->Template->isVideo = true;
$arrFiles = array('mp4' => null, 'm4v' => null, 'mov' => null, 'wmv' => null, 'webm' => null, 'ogv' => null);
} else {
$this->Template->isVideo = false;
$arrFiles = array('m4a' => null, 'mp3' => null, 'wma' => null, 'mpeg' => null, 'wav' => null);
}
$this->objFiles->reset();
// Pass File objects to the template
while ($this->objFiles->next()) {
$objFile = new \File($this->objFiles->path);
$arrFiles[$objFile->extension] = $objFile;
}
$this->Template->files = array_values(array_filter($arrFiles));
$this->Template->autoplay = $this->autoplay;
}
示例3: generate
/**
* Return if there are no files
* @return string
*/
public function generate()
{
// Use the home directory of the current user as file source
if ($this->useHomeDir && FE_USER_LOGGED_IN) {
$this->import('FrontendUser', 'User');
if ($this->User->assignDir && is_dir(TL_ROOT . '/' . $this->User->homeDir)) {
$this->multiSRC = array($this->User->homeDir);
}
} else {
$this->multiSRC = deserialize($this->multiSRC);
}
// Return if there are no files
if (!is_array($this->multiSRC) || empty($this->multiSRC)) {
return '';
}
// Check for version 3 format
if (!is_numeric($this->multiSRC[0])) {
return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
// Get the file entries from the database
$this->objFiles = \FilesModel::findMultipleByIds($this->multiSRC);
if ($this->objFiles === null) {
return '';
}
$file = \Input::get('file', true);
// Send the file to the browser
if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\\.txt$/', basename($file))) {
while ($this->objFiles->next()) {
if ($file == $this->objFiles->path || dirname($file) == $this->objFiles->path) {
$this->sendFileToBrowser($file);
}
}
// Do not index or cache the page
global $objPage;
$objPage->noSearch = 1;
$objPage->cache = 0;
// Send a 404 header
header('HTTP/1.1 404 Not Found');
return '<p class="error">' . sprintf($GLOBALS['TL_LANG']['ERR']['download'], $file) . '</p>';
}
return parent::generate();
}
示例4: compile
/**
* Generate the module
*/
protected function compile()
{
global $objPage;
$this->Template->size = '';
// Set the size
if ($this->playerSize != '') {
$size = deserialize($this->playerSize);
if (is_array($size)) {
$this->Template->size = ' width="' . $size[0] . '" height="' . $size[1] . '"';
}
}
$this->Template->poster = false;
// Optional poster
if ($this->posterSRC != '') {
if (($objFile = \FilesModel::findByUuid($this->posterSRC)) !== null) {
$this->Template->poster = $objFile->path;
}
}
// Pre-sort the array by preference
if (in_array($this->objFiles->extension, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv'))) {
$this->Template->isVideo = true;
$arrFiles = array('mp4' => null, 'm4v' => null, 'mov' => null, 'wmv' => null, 'webm' => null, 'ogv' => null);
} else {
$this->Template->isVideo = false;
$arrFiles = array('m4a' => null, 'mp3' => null, 'wma' => null, 'mpeg' => null, 'wav' => null, 'ogg' => null);
}
$this->objFiles->reset();
// Convert the language to a locale (see #5678)
$strLanguage = str_replace('-', '_', $objPage->language);
// Pass File objects to the template
while ($this->objFiles->next()) {
$arrMeta = deserialize($this->objFiles->meta);
if (is_array($arrMeta) && isset($arrMeta[$strLanguage])) {
$strTitle = $arrMeta[$strLanguage]['title'];
} else {
$strTitle = $this->objFiles->name;
}
$objFile = new \File($this->objFiles->path, true);
$objFile->title = specialchars($strTitle);
$arrFiles[$objFile->extension] = $objFile;
}
$this->Template->files = array_values(array_filter($arrFiles));
$this->Template->autoplay = $this->autoplay;
}
示例5: getPlayerSRCList
protected function getPlayerSRCList($arrFiles)
{
global $objPage;
$arrFiles = array();
$this->objFiles->reset();
// Convert the language to a locale (see #5678)
$strLanguage = str_replace('-', '_', $objPage->language);
// Pass File objects to the template
while ($this->objFiles->next()) {
$arrMeta = deserialize($this->objFiles->meta);
if (is_array($arrMeta) && isset($arrMeta[$strLanguage])) {
$strTitle = $arrMeta[$strLanguage]['title'];
} else {
$strTitle = $this->objFiles->name;
}
$objFile = new \File($this->objFiles->path, true);
$objFile->title = specialchars($strTitle);
$arrFiles[$objFile->extension] = $objFile;
}
return $arrFiles;
}