本文整理汇总了PHP中N2Filesystem::files方法的典型用法代码示例。如果您正苦于以下问题:PHP N2Filesystem::files方法的具体用法?PHP N2Filesystem::files怎么用?PHP N2Filesystem::files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2Filesystem
的用法示例。
在下文中一共展示了N2Filesystem::files方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchElement
function fetchElement()
{
$this->setfolder();
$files = N2Filesystem::files($this->_folder);
if (N2XmlHelper::getAttribute($this->_xml, 'required') == '') {
$this->_xml->addChild('option', n2_('No image'))->addAttribute('value', -1);
}
for ($i = 0; $i < count($files); $i++) {
$ext = pathinfo($files[$i], PATHINFO_EXTENSION);
if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'svg' || $ext == 'gif') {
$this->_xml->addChild('option', htmlspecialchars(ucfirst($files[$i])))->addAttribute('value', N2Filesystem::toLinux(N2Filesystem::pathToRelativePath($this->_folder . $files[$i])));
}
}
$html = N2Html::openTag("div", array('class' => 'n2-imagelist', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style')));
$html .= parent::fetchElement();
$html .= N2Html::closeTag('div');
return $html;
}
示例2: actionExportAll
public function actionExportAll()
{
N2Loader::import('libraries.export', 'smartslider');
$slidersModel = new N2SmartsliderSlidersModel();
$sliders = $slidersModel->getAll();
foreach ($sliders as $slider) {
$export = new N2SmartSliderExport($slider['id']);
$export->create(true);
}
$folder = N2Platform::getPublicDir();
$folder .= '/export/';
$zip = new N2ZipFile();
foreach (N2Filesystem::files($folder) as $file) {
$zip->addFile(file_get_contents($folder . $file), $file);
}
ob_end_clean();
header('Content-disposition: attachment; filename=sliders_unzip_to_import.zip');
header('Content-type: application/zip');
echo $zip->file();
n2_exit(true);
}