本文整理汇总了PHP中Is_File函数的典型用法代码示例。如果您正苦于以下问题:PHP Is_File函数的具体用法?PHP Is_File怎么用?PHP Is_File使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Is_File函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetList
function GetList()
{
$arFiles = array();
$vf = new CFileCheckerLog();
if ($handle = @opendir($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules")) {
while (($file = readdir($handle)) !== false) {
if ($file == "." || $file == "..") {
continue;
}
if (!Is_File($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/" . $file)) {
continue;
}
if (SubStr($file, 0, StrLen("serverfilelog-")) != "serverfilelog-") {
continue;
}
if (SubStr($file, -4) != ".dat") {
continue;
}
if (SubStr($file, -8) === "_tmp.dat") {
continue;
}
$ts = SubStr($file, StrLen("serverfilelog-"));
$ts = SubStr($ts, 0, -4);
if (IntVal($ts) <= 0) {
continue;
}
$vf->__GetDescriptionList($ts);
if ($vf->GetDescriptionTs() > 0) {
$arFiles[] = array("TIMESTAMP_X" => $vf->GetDescriptionTs(), "REGION" => $vf->GetDescriptionRegion(), "EXTENTIONS" => $vf->GetDescriptionCollectedExtensions(), "LOG" => "", "FILE" => $file);
}
}
closedir($handle);
}
return $arFiles;
}
示例2: Load_TextDomain
function Load_TextDomain()
{
$this->text_domain = get_class($this);
$lang_file = DirName(__FILE__) . '/donate_' . get_locale() . '.mo';
if (Is_File($lang_file)) {
load_textdomain($this->text_domain, $lang_file);
}
}
示例3: get_files
function get_files($directory)
{
$arr_file = (array) Glob($directory . '{,.}*', GLOB_BRACE);
$sort_order = array();
foreach ($arr_file as $index => $file) {
$path = RealPath($file);
if (!Is_File($path)) {
unset($arr_file[$index]);
} else {
$arr_file[$index] = $path;
$sort_order[$index] = StrToLower($file);
}
}
Array_Multisort($sort_order, $arr_file);
return $arr_file;
}
示例4: addOptionBox
static function addOptionBox($title, $include_file, $column = 'main', $state = 'opened')
{
# Check the input
if (!Is_File($include_file)) {
return False;
}
if (empty($title)) {
$title = ' ';
}
# Column (can be 'side' or 'main')
if ($column != '' && $column != Null && $column != 'main') {
$column = 'side';
} else {
$column = 'main';
}
# State (can be 'opened' or 'closed')
if ($state != '' && $state != Null && $state != 'opened') {
$state = 'closed';
} else {
$state = 'opened';
}
# Add a new box
self::$arr_option_box[$column][] = (object) array('title' => $title, 'file' => $include_file, 'state' => $state);
}
示例5: getTree
function getTree($source, $recursive = 0, $mask = '')
{
$res = array();
$orig_mask = $mask;
if (!$mask) {
$mask = '*';
}
$mask = preg_quote($mask);
$mask = str_replace('\\*', '.*?', $mask);
$mask = '^' . $mask . '$';
if (!Is_Dir($source)) {
return 0;
// incorrect source path
}
if ($dir = @opendir($source)) {
while (($file = readdir($dir)) !== false) {
if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..' && $recursive) {
$res2 = $this->getTree($source . "/" . $file, $recursive, $orig_mask);
foreach ($res2 as $k => $v) {
$res[$k] = $v;
}
} elseif (Is_File($source . "/" . $file) && preg_match('/' . $mask . '/', $file)) {
$res[$source . "/" . $file] = array('FILENAME' => $file, 'SIZE' => filesize($source . "/" . $file), 'MTIME' => filemtime($source . "/" . $file));
}
}
closedir($dir);
}
return $res;
}
示例6: getFilesTree
function getFilesTree($destination, $sort = 'name')
{
if (substr($destination, -1) == '/' || substr($destination, -1) == '\\') {
$destination = substr($destination, 0, strlen($destination) - 1);
}
$res = array();
if (!Is_Dir($destination)) {
return $res;
}
if ($dir = @opendir($destination)) {
while (($file = readdir($dir)) !== false) {
if (Is_Dir($destination . "/" . $file) && $file != '.' && $file != '..') {
$tmp = getFilesTree($destination . "/" . $file);
if (is_array($tmp)) {
foreach ($tmp as $elem) {
$res[] = $elem;
}
}
} elseif (Is_File($destination . "/" . $file)) {
$res[] = $destination . "/" . $file;
}
}
closedir($dir);
}
if ($sort == 'name') {
sort($res, SORT_STRING);
}
return $res;
}
示例7: DirName
<?php
/*
Plugin Name: Fancy Gallery
Description: Will bring your galleries as valid XHTML blocks on screen and associate linked images with Fancybox.
Plugin URI: http://dennishoppe.de/wordpress-plugins/fancy-gallery
Version: 1.3.8
Author: Dennis Hoppe
Author URI: http://DennisHoppe.de
*/
// Please think about a donation
if (Is_File(DirName(__FILE__) . '/donate.php')) {
include DirName(__FILE__) . '/donate.php';
}
if (!Class_Exists('wp_plugin_fancy_gallery')) {
class wp_plugin_fancy_gallery
{
var $base_url;
var $text_domain;
function __construct()
{
// Read base
$this->base_url = get_bloginfo('wpurl') . '/' . Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH)));
// Get ready to translate
$this->Load_TextDomain();
// Set Hooks
if (Is_Admin()) {
Add_Action('admin_menu', array($this, 'add_options_page'));
Add_Action('admin_head', array($this, 'print_admin_header'));
} else {
Add_Action('wp_head', array($this, 'print_header'));
示例8: copyTree
function copyTree($source, $destination, $over=0) {
$res=1;
if (!Is_Dir($source)) {
return 0; // incorrect source path
}
if (!Is_Dir($destination)) {
if (!mkdir($destination, 0777)) {
return 0; // cannot create destination path
}
}
if ($dir = @opendir($source)) {
while (($file = readdir($dir)) !== false) {
if (Is_Dir($source."/".$file) && ($file!='.') && ($file!='..')) {
$res=copyTree($source."/".$file, $destination."/".$file, $over);
} elseif (Is_File($source."/".$file) && (!file_exists($destination."/".$file) || $over)) {
$res=copy($source."/".$file, $destination."/".$file);
}
}
closedir($dir);
}
return $res;
}
示例9: Print_Gallery_Meta_Box
function Print_Gallery_Meta_Box($post, $box)
{
$include_file = $this->arr_meta_box[$box['args']]['include_file'];
if (Is_File($include_file)) {
include $include_file;
}
}
示例10: usual
//.........这里部分代码省略.........
$rec['PATH']=urlencode(($folder.$file)).'/';
$rec['REAL_PATH']=$dir.$file;
$rec['ID']=md5($rec['REAL_PATH']);
$dirs[]=$rec;
}
}
closeDir($d);
}
//$dirs=mysort_array($dirs, "TITLE");
usort($dirs, 'sort_files');
//print_r($dirs);
if (count($dirs)>0) $out['DIRS']=$dirs;
@$d=openDir($act_dir);
if ($d) {
$cover=$this->getCover($act_dir);
if ($cover) {
$out['COVER']=$cover;
$out['COVER_PATH']=urlencode(str_replace('\\\\', '\\', $act_dir).$cover);
}
$files=array();
while ($file=readDir($d)) {
if (($file==".") || ($file=="..") || ($file=="Descript.ion")) {
continue;
}
if (Is_File($act_dir.$file)) {
$rec=array();
$rec['TITLE']=$file;
if (IsSet($descriptions[$file])) {
$rec['DESCR']=$descriptions[$file];
}
if (strlen($rec['TITLE'])>50) {
$rec['TITLE_SHORT']=substr($rec['TITLE'], 0, 50)."...";
} else {
$rec['TITLE_SHORT']=$rec['TITLE'];
}
$rec['TITLE']=win2utf($rec['TITLE']);
$rec['TITLE_SHORT']=win2utf($rec['TITLE_SHORT']);
$rec['REAL_PATH']=($folder.$file);
$rec['PATH']=urlencode($folder.$file);
$rec['FULL_PATH']=urlencode(str_replace('\\\\', '\\', $act_dir).$file);
$size=filesize($act_dir.$file);
$total_size+=$size;
if ($size>1024) {
if ($size>1024*1024) {
$size=(((int)(($size/1024/1024)*10))/10)." Mb";
} else {
$size=(int)($size/1024)." Kb";
}
} else {
$size.=" b";
}
$rec['SIZE']=$size;
$rec['ID']=md5($rec['PATH']);
$files[]=$rec;
}
}
closeDir($d);
示例11: removeTree
/**
* removeTree
*
* remove directory tree
*
* @access public
*/
function removeTree($destination)
{
$res = 1;
if (!Is_Dir($destination)) {
return 0;
// cannot create destination path
}
if ($dir = @opendir($destination)) {
while (($file = readdir($dir)) !== false) {
if (Is_Dir($destination . "/" . $file) && $file != '.' && $file != '..') {
$res = $this->removeTree($destination . "/" . $file);
} elseif (Is_File($destination . "/" . $file)) {
$res = unlink($destination . "/" . $file);
}
}
closedir($dir);
$res = rmdir($destination);
}
return $res;
}
示例12: files
function files($parameters="") {
global $REQUEST_URI;
global $out;
global $mode;
$dir=str_replace('\\\'', "'", $_SERVER['REQUEST_URI']);
$dir=preg_replace("/^\/.*?\//", "./", $dir);
$dir=preg_replace("/\?.*?$/", "", $dir);
$dir=urldecode($dir);
//echo utf2win($dir);
//exit;
$paths=split("/", $dir);
$old="";
$history=array();
foreach($paths as $v) {
if ($v=="") continue;
if ($v==".") continue;
$rec=array();
$rec['TITLE']=$v;
$rec['PATH']=$old."$v/";
$old.="$v/";
$history[]=$rec;
}
$out['HISTORY']=$history;
$out['CURRENT_DIR_TITLE']=($dir);
$out['CURRENT_DIR']=urlencode($dir);
$act_dir=INIT_DIR."$dir";
if (@$mode=="descr") {
global $file;
global $new_descr;
global $REMOTE_ADDR;
global $can_edit;
if (strpos($can_edit, $REMOTE_ADDR)>0) setDescription($act_dir, $file, $new_descr);
$mode="";
header("Location:?\n\n");
exit;
}
$descriptions=getDescriptions($act_dir);
$d=openDir($act_dir);
$dirs=array();
while ($file=readDir($d)) {
if (($file==".") || ($file=="..")) {
continue;
}
if (Is_Dir($act_dir.$file)) {
$rec=array();
$rec['TITLE']=$file;
$rec['TITLE_SHORT']=$rec['TITLE'];
if (strlen($rec['TITLE_SHORT'])>30) {
$rec['TITLE_SHORT']=substr($rec['TITLE_SHORT'], 0, 30).'...';
}
if (IsSet($descriptions[$file])) {
$rec['DESCR']=$descriptions[$file];
}
$rec['PATH']=urlencode("$file").'/';
$rec['REAL_PATH']=$dir.$file;
$dirs[]=$rec;
}
}
closeDir($d);
$dirs=mysort_array($dirs, "TITLE");
if (count($dirs)>0) $out['DIRS']=$dirs;
$d=openDir($act_dir);
$files=array();
while ($file=readDir($d)) {
if (($file==".") || ($file=="..") || ($file=="Descript.ion")) {
continue;
}
if (Is_File($act_dir.$file)) {
$rec=array();
$rec['TITLE']=$file;
if (IsSet($descriptions[$file])) {
$rec['DESCR']=$descriptions[$file];
}
if (strlen($rec['TITLE'])>30) {
$rec['TITLE_SHORT']=substr($rec['TITLE'], 0, 30)."...";
} else {
$rec['TITLE_SHORT']=$rec['TITLE'];
}
$rec['PATH']="$file";
$size=filesize($act_dir.$file);
$total_size+=$size;
if ($size>1024) {
if ($size>1024*1024) {
$size=(((int)(($size/1024/1024)*10))/10)." Mb";
} else {
$size=(int)($size/1024)." Kb";
}
} else {
$size.=" b";
}
//.........这里部分代码省略.........
示例13: Render_Gallery
public function Render_Gallery($template_file)
{
# Uses template filter
$template_file = Apply_Filters('fancy_gallery_template', $template_file);
# If there is no valid template file we bail out
if (!Is_File($template_file)) {
$template_file = $this->Get_Default_Template();
}
# Load template
Ob_Start();
include $template_file;
$code = Ob_Get_Clean();
# Strip Whitespaces
$code = PReg_Replace('/\\s+/', ' ', $code);
$code = Str_Replace('> <', '><', $code);
$code = Trim($code);
# Return
return $code;
}
示例14: IO_Files
function IO_Files($Path, &$Result = array())
{
/******************************************************************************/
$__args_types = array('string', 'array');
#-------------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/******************************************************************************/
$Files = IO_Scan($Path);
if (Is_Error($Files)) {
return ERROR | @Trigger_Error('[IO_Files]: не удалось получить содержимое папки');
}
#-------------------------------------------------------------------------------
foreach ($Files as $File) {
#-------------------------------------------------------------------------------
$File = SPrintF('%s/%s', $Path, $File);
#-------------------------------------------------------------------------------
if (Is_Dir($File)) {
#-------------------------------------------------------------------------------
if (Is_Error(IO_Files($File, $Result))) {
return ERROR | @Trigger_Error('[IO_Files]: не удалось осуществить рекурсивный вызов');
}
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
if (Is_File($File)) {
$Result[] = $File;
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
return $Result;
#-------------------------------------------------------------------------------
}
示例15: getFile
/**
* Lit le fichier passé en paramètre et retourne son contenu
*
* @param string $file le chemin d'accès complet au fichier (inclu le nom du fichier)
* @access private
* @return string $date le contenu du fichier
* @exception bool false
* @since 1.0
*/
function getFile($file)
{
if (!Is_File($file)) {
return false;
}
$fp = @fopen($file, 'r');
$data = @fread($fp, filesize($file));
@fclose($fp);
return $data;
}