本文整理汇总了PHP中files函数的典型用法代码示例。如果您正苦于以下问题:PHP files函数的具体用法?PHP files怎么用?PHP files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了files函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* @abstract Displays and processes the edit news form
* @param integer $id
* @access public
*/
public function edit($id = false)
{
if (!files()->setUploadDirectory()) {
sml()->say("The file upload directory does not appear to be writable. Please create the folder and set proper permissions.");
}
$form = new Form('news', $id);
if (!$id) {
$form->setCurrentValue('timestamp', date("Y-m-d H:i:s"));
}
// if form has been submitted
if ($form->isSubmitted()) {
$file = files()->upload('pdf_filename');
if (is_array($file) && !empty($file[0])) {
$form->setCurrentValue('pdf_filename', $file[0]['file_name']);
}
if ($form->save($id)) {
sml()->say('News entry has successfully been updated.');
router()->redirect('view');
}
}
// make sure the template has access to all current values
$data['form'] = $form;
template()->addCss('admin/datepicker.css');
template()->addJs('admin/datepicker.js');
template()->addJs('edit.js');
template()->display($data);
}
开发者ID:viveleroi,项目名称:AspenMSM,代码行数:32,代码来源:News_Admin.php
示例2: files
function files($dir)
{
$files = array();
$dir = rtrim($dir, DIRECTORY_SEPARATOR);
if (is_dir($dir)) {
$handle = opendir($dir);
while (false !== ($file = readdir($handle))) {
if ($file == '.' or $file == '..') {
continue;
}
$file = $dir . DIRECTORY_SEPARATOR . $file;
if (is_dir($file)) {
$files = array_merge($files, files($file));
} else {
if (preg_match('/\\.php$/', $file)) {
$files[] = $file;
}
}
}
closedir($handle);
} elseif (is_file($dir)) {
return array($dir);
}
return $files;
}
开发者ID:yeaha,项目名称:lysine,代码行数:25,代码来源:build_class_files.php
示例3: files
function files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS', 'php'), $include = array('flv', 'mp4', 'swf', '3gp', 'mp3', 'rbs', 'wmv'))
{
// Initialize variables
$arr = array();
// Is the path a folder?
if (!is_dir($path)) {
?>
<script language="javascript" type="text/javascript">alert('Path is not a folder <?php
echo $path;
?>
'); </script>
<?php
return false;
}
// read the source directory
$handle = opendir($path);
while (($file = readdir($handle)) !== false) {
$dir = $path . DS . $file;
$isDir = is_dir($dir);
if ($file != '.' && $file != '..' && !in_array($file, $exclude)) {
if ($isDir) {
if ($recurse) {
if (is_integer($recurse)) {
$recurse--;
}
$arr2 = files($dir, $filter, $recurse, $fullpath);
$arr = array_merge($arr, $arr2);
}
} else {
if (preg_match("/{$filter}/", $file)) {
$path_parts = pathinfo($path . DS . $file);
if (in_array($path_parts['extension'], $include)) {
if ($fullpath) {
$arr[] = $path . DS . $file;
} else {
$arr[] = $file;
}
}
}
}
}
}
//closedir($handle);
//asort($arr);
return $arr;
开发者ID:enjoy2000,项目名称:smcd,代码行数:47,代码来源:playlist.php
示例4: files
function files($dir, &$files = array())
{
$handle = opendir($dir);
while ($file = readdir($handle)) {
if ($file == '.' or $file == '..') {
continue;
}
$path = $dir . '/' . $file;
if (is_dir($path)) {
files($path, $files);
} else {
$files[] = $path;
}
}
closedir($handle);
return $files;
}
开发者ID:sunny,项目名称:m3uh,代码行数:17,代码来源:m3uh.php
示例5: renewData
function renewData($type, $classes, $list, $table)
{
if (is_array($classes)) {
foreach ($classes as $value) {
$files = files($type, $value);
foreach ($files as $item) {
$size = getimagesize($item);
if (!$size) {
$size[0] = 0;
$size[1] = 0;
}
$data = array('img_url' => $item, 'img_date' => date('Y-m-d H:i:s', filectime($item)), 'img_caption' => get_basename($item), 'img_class' => $value, 'img_type' => $type, 'img_size' => filesize($item), 'img_width' => $size[0], 'img_height' => $size[1]);
$index = array_search($item, $list);
if ($index !== false) {
array_splice($list, $index, 1);
} else {
$table->add($data);
}
}
}
}
}
开发者ID:zhouweilin,项目名称:liveapp,代码行数:22,代码来源:function.php
示例6: saveSection_imagetext
/**
* @abstract Saves single image and text area content to the database
* @param array $section
* @param integer $page_id
* @return array
* @access public
*/
private function saveSection_imagetext($section, $page_id)
{
$section['show_title'] = isset($section['show_title']) ? $section['show_title'] : false;
// upload the image and create an image
$filename = '';
$thm_name = '';
$uploads = files()->upload('image_' . $section['next_id']);
if (is_array($uploads) && isset($uploads[0]) && !empty($uploads[0])) {
foreach ($uploads as $upload) {
$filename = $upload['file_name'];
$thm_name = str_replace($upload['file_extension'], '_thm' . $upload['file_extension'], $upload['file_name']);
$thm_path = str_replace($upload['file_extension'], '_thm' . $upload['file_extension'], $upload['server_file_path']);
if (!empty($upload['server_file_path'])) {
// resize original if needed
if (app()->config('text_image_maxwidth') || app()->config('text_image_maxheight')) {
$img_resize = Thumbnail::create($upload['server_file_path']);
$img_resize->adaptiveResize(app()->config('text_image_maxwidth'), app()->config('text_image_maxheight'));
$img_resize->save($upload['server_file_path']);
}
// create the smaller thumbnail
$thm_create = Thumbnail::create($upload['server_file_path']);
if (app()->config('text_image_crop_center')) {
$thm_create->adaptiveResize();
}
$thm_create->adaptiveResize(app()->config('text_image_thm_maxwidth'), app()->config('text_image_thm_maxheight'));
$thm_create->save($thm_path);
}
}
} else {
$filename = $section['image_filename'];
$thm_name = $section['image_thumbname'];
}
// save the data back
$ins_id = model()->open('section_imagetext_editor')->insert(array('page_id' => $page_id, 'title' => $section['title'], 'content' => $section['content'], 'show_title' => $section['show_title'], 'image_filename' => $filename, 'image_thumbname' => $thm_name, 'image_alt' => $section['image_alt'], 'template' => $section['template']));
$sections[] = array('placement_group' => $section['placement_group'], 'type' => 'imagetext_editor', 'called_in_template' => $section['called_in_template'], 'id' => $ins_id);
return $sections;
}
开发者ID:viveleroi,项目名称:AspenMSM,代码行数:44,代码来源:Pageslib.php
示例7: make
public static function make($db, $what)
{
if (is_string($what)) {
$file = APPLICATION_PATH . DS . 'models' . DS . 'Bigdata' . DS . 'views' . DS . $db->db . DS . ucfirst(I::lower($db->table)) . DS . I::camelize($what) . '.php';
if (files()->exists($file)) {
require_once $file;
$class = '\\Thin\\' . ucfirst(I::lower($db->db)) . ucfirst(I::lower($db->table)) . 'View';
return $class::make($db);
} else {
return $db;
}
} elseif (A::is($what)) {
$nameview = 'view_' . $db->db . '_' . $db->table . '_' . sha1(serialize($what));
$ageDb = $db->getage();
$viewDb = Db::instance($db->db, $nameview);
$ageView = $db->getage();
$exists = strlen($db->cache()->get('dbRedis.views.' . $nameview)) ? true : false;
if ($ageView < $ageDb || !$exists) {
$viewDb->getCollection()->remove();
foreach ($what as $wh) {
$op = 'AND';
if (count($wh) == 4) {
$op = $wh[3];
unset($wh[3]);
}
$db = $db->where($wh);
}
$res = $db->exec();
foreach ($res as $row) {
$viewDb->saveView($row);
}
$db->cache()->set('dbRedis.views.' . $nameview, 1);
}
return $viewDb;
}
}
开发者ID:schpill,项目名称:standalone,代码行数:36,代码来源:View.php
示例8: htmlToPng
function htmlToPng($html, $name = null, $orientation = null, $count = 0)
{
$name = is_null($name) ? 'doc.pdf' : Inflector::urlize($name) . '.pdf';
$orientation = is_null($orientation) ? 'portrait' : $orientation;
$file = TMP_PUBLIC_PATH . DS . sha1(serialize(func_get_args())) . '.html';
files()->put($file, $html);
$pdf = str_replace('.html', '.pdf', $file);
// $keep = lib('keep')->instance();
$url = URLSITE . 'tmp/' . Arrays::last(explode('/', $file));
$this->urlToPng($url);
}
开发者ID:schpill,项目名称:standalone,代码行数:11,代码来源:utils.php
示例9: files
/**
* Find list of files inside folder
*/
public function files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
{
// Initialize variables
$arr = array();
// Is the path a folder?
if (!is_dir($path)) {
return array();
}
// read the source directory
$handle = opendir($path);
while (($file = readdir($handle)) !== false) {
$dir = $path . DIRECTORY_SEPARATOR . $file;
$isDir = is_dir($dir);
if ($file != '.' && $file != '..' && !in_array($file, $exclude)) {
if ($isDir) {
if ($recurse) {
if (is_integer($recurse)) {
$recurse--;
}
$arr2 = files($dir, $filter, $recurse, $fullpath);
$arr = array_merge($arr, $arr2);
}
} else {
if (preg_match("/{$filter}/", $file)) {
if ($fullpath) {
$arr[] = $path . '/' . $file;
} else {
$arr[] = $file;
}
}
}
}
}
closedir($handle);
asort($arr);
return $arr;
}
开发者ID:amal-nibaya,项目名称:PB-BEERSHOP,代码行数:40,代码来源:Image.php
示例10: files
function files($mass_dir)
{
if ($dh = opendir($mass_dir)) {
$files = array();
$inner_files = array();
while ($file = readdir($dh)) {
if ($file != "." && $file != ".." && $file[0] != '.') {
if (is_dir($mass_dir . "/" . $file)) {
$inner_files = files("{$mass_dir}/{$file}");
if (is_array($inner_files)) {
$files = array_merge($files, $inner_files);
}
} else {
array_push($files, "{$mass_dir}/{$file}");
}
}
}
closedir($dh);
return $files;
}
}
开发者ID:xijbx,项目名称:teamps-shell,代码行数:21,代码来源:teamps.php
示例11: files
function files($dir, $display = 'block')
{
$formats = explode(',', EDITABLE_FORMATS);
$data = '<ul class="files" style="display:' . $display . '">';
$files = array_slice(scandir($dir), 2);
asort($files);
foreach ($files as $key => $file) {
if ($dir . DIRECTORY_SEPARATOR . $file == __FILE__ || SHOW_HIDDEN_FILES === false && substr($file, 0, 1) === '.') {
continue;
}
$writable = is_writable($dir . DIRECTORY_SEPARATOR . $file) ? 'writable' : 'non-writable';
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$data .= '<li class="dir ' . $writable . '"><a href="javascript:void(0);" onclick="return expandDir(this);" data-dir="' . str_replace(__DIR__ . '/', '', $dir . DIRECTORY_SEPARATOR . $file) . '">' . $file . '</a>' . files($dir . DIRECTORY_SEPARATOR . $file, 'none') . '</li>';
} else {
$is_editable = strpos($file, '.') === false || in_array(substr($file, strrpos($file, '.') + 1), $formats);
$data .= '<li class="file ' . $writable . ' ' . ($is_editable ? 'editable' : null) . '">';
if ($is_editable === true) {
$data .= '<a href="javascript:void(0);" onclick="return openFile(this);" data-file="' . str_replace(__DIR__ . '/', '', $dir . DIRECTORY_SEPARATOR . $file) . '">';
}
$data .= $file;
if ($is_editable) {
$data .= '</a>';
}
if ($writable === 'writable') {
$data .= ' <a href="javascript:void(0);" class="text-red visible-on-hover" onclick="return deleteFile(this);">[Delete]</a>';
}
$data .= '</li>';
}
}
$data .= '</ul>';
return $data;
}
开发者ID:hamidsamak,项目名称:pheditor,代码行数:32,代码来源:pheditor.php
示例12: center
//.........这里部分代码省略.........
if (_ADMIN) {
switch ($action) {
case 'administration':
administration();
return;
break;
case 'snews_settings':
settings();
return;
break;
case 'snews_categories':
admin_categories();
return;
break;
case 'admin_category':
form_categories();
return;
break;
case 'admin_subcategory':
form_categories('sub');
return;
break;
case 'groupings':
admin_groupings();
return;
break;
case 'admin_groupings':
form_groupings();
return;
break;
case 'snews_articles':
admin_articles('article_view');
return;
break;
case 'extra_contents':
admin_articles('extra_view');
return;
break;
case 'snews_pages':
admin_articles('page_view');
return;
break;
case 'admin_article':
form_articles('');
return;
break;
case 'article_new':
form_articles('article_new');
return;
break;
case 'extra_new':
form_articles('extra_new');
return;
break;
case 'page_new':
form_articles('page_new');
return;
break;
case 'editcomment':
edit_comment();
return;
break;
case 'snews_files':
files();
return;
break;
case 'process':
processing();
return;
break;
case 'logout':
session_destroy();
echo '<meta http-equiv="refresh" content="2; url=' . _SITE . '">';
echo '<h2>' . l('log_out') . '</h2>';
return;
break;
}
}
switch ($action) {
case 'archive':
archive();
break;
case 'sitemap':
sitemap();
break;
case 'contact':
contact();
break;
case 'login':
login();
break;
case '404':
echo l('error_404');
break;
default:
articles();
break;
}
}
}
开发者ID:retrofox,项目名称:PCC,代码行数:101,代码来源:snews.php
示例13: ajax_deleteImage
/**
* Enter description here...
*
* @param unknown_type $id
*/
public function ajax_deleteImage($id)
{
$image = model()->open('contact_images', $id);
$base = APPLICATION_PATH . DS . 'files' . DS . 'contacts' . DS . $image['contact_id'];
files()->delete($base . DS . $image['filename_orig']);
files()->delete($base . DS . $image['filename_thumb']);
files()->delete($base);
$model->delete('contact_images', $id);
print 1;
}
开发者ID:viveleroi,项目名称:AspenMSM,代码行数:15,代码来源:Contacts_Admin.php
示例14: pdfFile
function pdfFile($html, $name = null, $orientation = null, $count = 0)
{
$name = is_null($name) ? 'doc.pdf' : Inflector::urlize($name) . '.pdf';
$orientation = is_null($orientation) ? 'portrait' : $orientation;
$file = TMP_PUBLIC_PATH . DS . sha1(serialize(func_get_args())) . '.html';
files()->put($file, $html);
$pdf = str_replace('.html', '.pdf', $file);
// $keep = lib('keep')->instance();
$url = 'http://www.zelift.com/tmp/' . Arrays::last(explode('/', $file));
$cnt = dwn('http://apphuge.uk/pdf.php?url=' . urlencode($url) . '&orientation=' . $orientation);
// if (!strlen($cnt) && $count < 5) {
// return pdfFile($html, $name, $orientation, $count++);
// }
// if (!strlen($cnt) && $count >= 5) {
// exception('pdf', 'Le pdf est erroné et ne peut être créé.');
// }
files()->delete($file);
return $cnt;
}
开发者ID:schpill,项目名称:standalone,代码行数:19,代码来源:functions.php
示例15: upload_image
/**
* Upload image and auto create thumbnail.
*
* @param $field
* @param $path
* @param null $width
* @param null $height
* @return string
*
* @require "intervention/images:~2"
*/
function upload_image($field, $path, $width = null, $height = null)
{
$file = input()->file($field);
$filename = get_random_filename($file);
if (!is_null($width) && !is_null($height)) {
$thumbnailPath = $path . '/thumbnail/';
if (!files()->isDirectory($thumbnailPath)) {
files()->makeDirectory($thumbnailPath);
}
$filenPath = public_path($thumbnailPath . $filename);
Image::make($file->getRealPath())->resize($width, $height)->save($filenPath);
}
$file->move($path, $filename);
return $filename;
}
开发者ID:gravitano,项目名称:helpers,代码行数:26,代码来源:helpers.php
示例16: files
function files($path, $recursive = false)
{
$it = new DirectoryIterator($path);
$files = array();
while ($it->valid()) {
if (is_file($it->getPathname()) && !$it->isDot() && $it->getFilename() != '.git') {
$files[] = $recursive ? $it->getPathname() : $it->getFilename();
} elseif (is_dir($it->getPathname()) && !$it->isDot() && $it->getFilename() != '.git' && $recursive) {
$files = array_merge($files, files($it->getPathname(), $recursive));
}
$it->next();
}
return $files;
}
开发者ID:andresmaeso,项目名称:neno,代码行数:14,代码来源:pack.php
示例17: writeTest
function writeTest()
{
$out = "<?php\ndefine('RUNNING_TESTS', true);\nrequire __DIR__ . '/cakephp2.0-tests.php';\n\n";
$out .= "class Cakephp20HookTest extends PHPUnit_Framework_TestCase {\n\n\tfunction testTestCase() {\n";
foreach (files() as $file) {
$data = testCase($file);
if (!$data) {
continue;
}
$out .= "\n\t\t\$result = testCase('{$file}');\n";
if (!$data['testFile']) {
$out .= "\t\t\$this->assertFalse(\$result['testFile']);\n";
continue;
}
$out .= "\t\t\$this->assertEquals('{$data['category']}', \$result['category']);\n";
$out .= "\t\t\$this->assertEquals('{$data['case']}', \$result['case']);\n";
$out .= "\t\t\$this->assertEquals('{$data['testFile']}', \$result['testFile']);\n";
}
$out .= "\t}\n}";
file_put_contents('cakephp2.0-tests.test.php', $out);
echo $out;
}
开发者ID:seungrye,项目名称:git-hooks,代码行数:22,代码来源:cakephp2.0-tests.php
示例18: sectionTemplates
/**
* @abstract Scans the theme directory for available tempaltes
* @return array
* @access public
*/
public function sectionTemplates($rel_path = false, $recursive = true)
{
$path = APPLICATION_PATH . '/themes/' . app()->settings->getConfig('active_theme');
$path .= $rel_path ? '/' . $rel_path : '';
$files = files()->dirList($path);
$page_templates = array();
foreach ($files as $file) {
$dir = $path . '/' . $file;
// if the file found is a directory, look inside it
if (is_dir($dir)) {
if ($recursive) {
$subfiles = files()->dirList($dir);
foreach ($subfiles as $subfile) {
$fileinfo = $this->parseTemplateFile($dir, $subfile);
if ($fileinfo) {
array_push($page_templates, $fileinfo);
}
}
}
} else {
$fileinfo = $this->parseTemplateFile($path, $file);
if ($fileinfo) {
array_push($page_templates, $fileinfo);
}
}
}
// sort the values
$volume = array();
foreach ($page_templates as $key => $row) {
$volume[$key] = $row['NAME'];
}
array_multisort($volume, $page_templates);
return $page_templates;
}
开发者ID:viveleroi,项目名称:AspenMSM,代码行数:39,代码来源:Display.php
示例19: uses
/**
* Uses is a pretty wrapper around include and require. Gives everything a more namespace vibe.
*
* The first component of the uses, is one of the following path specifiers:
*
* - app Application path
* - application Application path
* - sys The system path
* - system The system path
* - vendor The vendor path
* - model The path to the app's models
* - channel The path to the app's data channels
* - control Path to either the system controls or the app controls
* (Will try the system controls first, then the app controls)
*
* For example, to load the Controller class which is in /sys/app/controller.php you would
* do the following:
*
* <code>
* uses('system.app.controller');
* </code>
*
* Can support wildcards:
*
* <code>
* uses('system.data.validators.*');
* </code>
*
* @param string $namespace
*/
function uses($namespace)
{
$altpath=null;
$parts=explode('.',$namespace);
$type=array_shift($parts);
$path='';
switch($type)
{
case 'app':
case 'application':
$path=PATH_APP;
break;
case 'sys':
case 'system':
$path=PATH_SYS;
break;
case 'vendor':
$path=PATH_VENDOR;
break;
case 'model':
$path=PATH_APP.'model/';
break;
case 'channel':
$path=PATH_APP.'channel/';
break;
case 'control':
$path=PATH_SYS.'control/';
$altpath=PATH_APP.'control/';
break;
case 'screen':
$path=PATH_APP.'screen/';
$altpath=PATH_SYS.'app/screen/';
break;
case 'helper':
$path=PATH_APP.'helper/';
$altpath=PATH_SYS.'app/helper/';
break;
}
if ($parts[count($parts)-1]=="*")
{
array_pop($parts);
$namespace=implode('/',$parts);
$files=array();
$files=files($path.$namespace);
foreach($files as $file)
require_once($file);
}
else
{
$namespace=implode('/',$parts);
if ($altpath)
if (!file_exists($path.$namespace.EXT))
$path=$altpath;
require_once($path.$namespace.EXT);
}
}
开发者ID:nikels,项目名称:HeavyMetal,代码行数:94,代码来源:sys.php
示例20: elseif
} elseif ($img) {
img($img);
} elseif ($gf) {
grab($gf);
} elseif ($dir) {
files($dir);
} else {
switch ($act) {
case "phpinfo":
phpinfo();
break;
case "sql":
sql();
break;
case "files":
files($dir);
break;
case "email":
email();
break;
case "cmd":
cmd();
break;
case "upload":
upload();
break;
case "tools":
tools();
break;
case "sqllogin":
sqllogin();
开发者ID:ASDAFF,项目名称:Shells-Database,代码行数:31,代码来源:g00nshell.php
注:本文中的files函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论