本文整理汇总了PHP中isFile函数的典型用法代码示例。如果您正苦于以下问题:PHP isFile函数的具体用法?PHP isFile怎么用?PHP isFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSongListing
function getSongListing()
{
$trackNo = 0;
$contents = getDirContents('/public/media/music');
$musicPath = "/public/media/music";
$songListing = array();
foreach (getDirContents($musicPath) as $contents) {
$urlStart = strlen($musicPath) + 1;
$rawurl = rawurlencode($contents);
if (isFile($rawurl)) {
// Artist
$path = substr($contents, $urlStart);
$artist = substr($path, 0, strpos($path, "/"));
// Album
$path = substr($path, strpos($path, "/") + 1, strlen($path));
$album = substr($path, 0, strpos($path, "/"));
// Title
$path = substr($path, strpos($path, "/") + 1, strlen($path));
$title = substr($path, 0, strpos($path, ".mp3"));
//echo "Artist: " . $artist . "<br>";
//echo "Album: " . $album . "<br>";
//echo "Title: " . $title . "<br>";
// Url
$url = str_replace("%2F", "/", $rawurl);
//echo "<a href=\"..$url\">$url</a>" . "<br><br>";
$song = array("trackNo" => $trackNo, "artist" => $artist, "album" => $album, "title" => $title, "url" => $url);
$trackNo++;
//add song to song listing
array_push($songListing, $song);
}
}
return $songListing;
}
示例2: testFilesystem
public function testFilesystem()
{
isFileEq(__FILE__, __FILE__);
is(openFile(__FILE__), openFile(__FILE__));
isFile(__FILE__);
isDir(__DIR__);
isNotFile(__DIR__);
isNotFile(__FILE__ . '.qwerty');
isNotDir(__FILE__);
isNotDir(__DIR__ . '/qwerty');
}
示例3: nm_get_languages
function nm_get_languages()
{
$languages = array();
$files = getFiles(NMLANGPATH);
foreach ($files as $file) {
if (isFile($file, NMLANGPATH, 'php')) {
$lang = basename($file, '.php');
$languages[$lang] = NMLANGPATH . $file;
}
}
ksort($languages);
return $languages;
}
示例4: generateSitemapWithoutPing
public static function generateSitemapWithoutPing()
{
global $SITEURL;
$filenames = getFiles(GSDATAPAGESPATH);
if (count($filenames)) {
foreach ($filenames as $file) {
if (isFile($file, GSDATAPAGESPATH, 'xml')) {
$data = getXML(GSDATAPAGESPATH . $file);
if ($data->url != '404' && $data->private != 'Y') {
$pagesArray[] = array('url' => (string) $data->url, 'parent' => (string) $data->parent, 'date' => (string) $data->pubDate, 'menuStatus' => (string) $data->menuStatus);
}
}
}
}
$pagesSorted = subval_sort($pagesArray, 'menuStatus');
$languages = return_i18n_available_languages();
$deflang = return_i18n_default_language();
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
$xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
if (count($pagesSorted)) {
foreach ($pagesSorted as $page) {
// set <loc>
if (count($languages) > 1) {
$pos = strrpos($page['url'], '_');
if ($pos !== false) {
$pageLoc = find_i18n_url(substr($page['url'], 0, $pos), $page['parent'], substr($page['url'], $pos + 1));
} else {
$pageLoc = find_i18n_url($page['url'], $page['parent'], $deflang);
}
} else {
$pageLoc = find_i18n_url($page['url'], $page['parent']);
}
// set <lastmod>
$pageLastMod = makeIso8601TimeStamp(date("Y-m-d H:i:s", strtotime($page['date'])));
// set <changefreq>
$pageChangeFreq = 'weekly';
// set <priority>
$pagePriority = $page['menuStatus'] == 'Y' ? '1.0' : '0.5';
//add to sitemap
$url_item = $xml->addChild('url');
$url_item->addChild('loc', htmlspecialchars($pageLoc));
$url_item->addChild('lastmod', $pageLastMod);
$url_item->addChild('changefreq', $pageChangeFreq);
$url_item->addChild('priority', $pagePriority);
}
}
//create xml file
$file = GSROOTPATH . 'sitemap.xml';
XMLsave($xml, $file);
}
示例5: bm_get_cache_data
function bm_get_cache_data()
{
$books = array();
$files = getFiles(BMBOOKPATH);
# collect all book data
foreach ($files as $file) {
if (isFile($file, BMBOOKPATH, 'xml')) {
$data = getXML(BMBOOKPATH . $file);
$time = strtotime($data->date);
while (array_key_exists($time, $books)) {
$time++;
}
$books[$time]['slug'] = basename($file, '.xml');
$books[$time]['title'] = strval($data->title);
$books[$time]['date'] = strval($data->date);
$books[$time]['tags'] = strval($data->tags);
$books[$time]['private'] = strval($data->private);
}
}
krsort($books);
return $books;
}
示例6: nm_get_cache_data
function nm_get_cache_data()
{
$posts = array();
$files = getFiles(NMPOSTPATH);
# collect all post data
foreach ($files as $file) {
if (isFile($file, NMPOSTPATH, 'xml')) {
$data = getXML(NMPOSTPATH . $file);
$time = strtotime($data->date);
while (array_key_exists($time, $posts)) {
$time++;
}
$posts[$time]['slug'] = basename($file, '.xml');
$posts[$time]['title'] = strval($data->title);
$posts[$time]['date'] = strval($data->date);
$posts[$time]['tags'] = strval($data->tags);
$posts[$time]['private'] = strval($data->private);
$posts[$time]['image'] = strval($data->image);
$posts[$time]['author'] = strval($data->author);
}
}
krsort($posts);
return $posts;
}
示例7: generate_sitemap
/**
* Creates Sitemap
*
* Creates sitemap.xml in the site's root.
* Pending: read the content path (xml's)
*/
function generate_sitemap()
{
// Variable settings
global $SITEURL;
$path = GSDATAPAGESPATH;
$count = "0";
$filenames = getFiles($path);
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if (isFile($file, $path, 'xml')) {
$data = getXML($path . $file);
if ($data->url != '404') {
$status = $data->menuStatus;
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['parent'] = $data->parent;
$pagesArray[$count]['date'] = $data->pubDate;
$pagesArray[$count]['private'] = $data->private;
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$count++;
}
}
}
}
$pagesSorted = subval_sort($pagesArray, 'menuStatus');
if (count($pagesSorted) != 0) {
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
$xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
foreach ($pagesSorted as $page) {
if ($page['private'] != 'Y') {
// set <loc>
$pageLoc = find_url($page['url'], $page['parent']);
// set <lastmod>
$tmpDate = date("Y-m-d H:i:s", strtotime($page['date']));
$pageLastMod = makeIso8601TimeStamp($tmpDate);
// set <changefreq>
$pageChangeFreq = 'weekly';
// set <priority>
if ($page['menuStatus'] == 'Y') {
$pagePriority = '1.0';
} else {
$pagePriority = '0.5';
}
//add to sitemap
$url_item = $xml->addChild('url');
$url_item->addChild('loc', $pageLoc);
$url_item->addChild('lastmod', $pageLastMod);
$url_item->addChild('changefreq', $pageChangeFreq);
$url_item->addChild('priority', $pagePriority);
exec_action('sitemap-additem');
}
}
//create xml file
$file = GSROOTPATH . 'sitemap.xml';
exec_action('save-sitemap');
XMLsave($xml, $file);
}
if (!defined('GSDONOTPING')) {
if (file_exists(GSROOTPATH . 'sitemap.xml')) {
if (200 === ($status = pingGoogleSitemaps($SITEURL . 'sitemap.xml'))) {
#sitemap successfully created & pinged
return true;
} else {
error_log(i18n_r('SITEMAP_ERRORPING'));
return i18n_r('SITEMAP_ERRORPING');
}
} else {
error_log(i18n_r('SITEMAP_ERROR'));
return i18n_r('SITEMAP_ERROR');
}
} else {
#sitemap successfully created - did not ping
return true;
}
}
示例8: valid_xml
echo '<tr><td>/data/other/' . $file . '</td><td>' . valid_xml($path . $file) . '</td></tr>';
}
}
$path = GSDATAOTHERPATH . 'logs/';
$data = getFiles($path);
sort($data);
foreach ($data as $file) {
if (isFile($file, $path, '.log')) {
echo '<tr><td>/data/other/logs/' . $file . '</td><td>' . valid_xml($path . $file) . '</td></tr>';
}
}
$path = GSUSERSPATH;
$data = getFiles($path);
sort($data);
foreach ($data as $file) {
if (isFile($file, $path)) {
echo '<tr><td>/backups/users/' . $file . '</td><td>' . valid_xml($path . $file) . '</td></tr>';
}
}
?>
</table>
<h3><?php
i18n('DIR_PERMISSIONS');
?>
</h3>
<table class="highlight healthcheck">
<?php
$me = check_perms(GSDATAOTHERPATH . 'plugins.xml');
?>
<tr><td><?php
示例9: isset
$template = isset($_GET['template']) ? var_out($_GET['template']) : '';
$parent = isset($_GET['parent']) ? var_out($_GET['parent']) : '';
$menu = isset($_GET['menu']) ? var_out($_GET['menu']) : '';
$private = isset($_GET['private']) ? var_out($_GET['private']) : '';
$menuStatus = isset($_GET['menuStatus']) ? var_out($_GET['menuStatus']) : '';
$menuOrder = isset($_GET['menuOrder']) ? var_out($_GET['menuOrder']) : '';
$buttonname = i18n_r('BTN_SAVEPAGE');
}
// MAKE SELECT BOX OF AVAILABLE TEMPLATES
if ($template == '') {
$template = 'template.php';
}
$themes_path = GSTHEMESPATH . $TEMPLATE;
$themes_handle = opendir($themes_path) or die("Unable to open " . GSTHEMESPATH);
while ($file = readdir($themes_handle)) {
if (isFile($file, $themes_path, 'php')) {
if ($file != 'functions.php' && substr(strtolower($file), -8) != '.inc.php' && substr($file, 0, 1) !== '.') {
$templates[] = $file;
}
}
}
sort($templates);
foreach ($templates as $file) {
if ($template == $file) {
$sel = "selected";
} else {
$sel = "";
}
if ($file == 'template.php') {
$templatename = i18n_r('DEFAULT_TEMPLATE');
} else {
示例10: findSFV
/**
* SFV Check hack
*
* @param $dirName
* @return
*/
function findSFV($dirName)
{
$sfv = false;
$d = dir($dirName);
while (false !== ($entry = $d->read())) {
if ($entry != '.' && $entry != '..' && !empty($entry)) {
if (isFile($dirName . '/' . $entry) && strtolower(substr($entry, -4, 4)) == '.sfv') {
$sfv['dir'] = $dirName;
$sfv['sfv'] = $dirName . '/' . $entry;
}
}
}
$d->close();
return $sfv;
}
示例11: validateFile
function validateFile($the_file)
{
$msg = "<img src=\"images/red.gif\" align=\"absmiddle\" title=\"Path is not Valid\"><br><font color=\"#ff0000\">Path is not Valid</font>";
if (isFile($the_file)) {
$msg = "<img src=\"images/green.gif\" align=\"absmiddle\" title=\"Valid\">";
}
return $msg;
}
示例12: getFiles
*****************************************************/
// Setup inclusions
$load['plugin'] = true;
// Relative
$relative = '../';
// Include common.php
include 'inc/common.php';
// check validity of request
if ($_REQUEST['s'] === $SESSIONHASH) {
// Variable settings
$path = $relative . 'data/pages/';
$count = "0";
$filenames = getFiles($path);
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if (isFile($file, $path, 'xml')) {
$data = getXML($path . $file);
$status = $data->menuStatus;
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['parent'] = $data->parent;
$pagesArray[$count]['date'] = $data->pubDate;
$pagesArray[$count]['private'] = $data->private;
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$count++;
}
}
}
$pagesSorted = subval_sort($pagesArray, 'menuStatus');
if (count($pagesSorted) != 0) {
$xml = @new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
$xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', 'http://www.w3.org/2001/XMLSchema-instance');
示例13: getFilesList
function getFilesList()
{
$files = array();
$files_dir = getDirList();
foreach ($files_dir as $key => $value) {
if (isFile($value)) {
$files[$key] = $value;
}
}
return $files;
}
示例14: ReadFolder
/**
* 获取文件列表
*
* @param string $dir 欲读取的目录路径
* @param boolean $mode 0:读取全部;1:仅读取文件;2:仅读取目录
* @return array
*/
function ReadFolder($dir, $mode = 0)
{
//如果打开目录句柄失败,则输出空数组
if (!($handle = @opendir($dir))) {
return array();
}
//定义文件列表数组
$files = array();
//遍历目录句柄中的条目
while (false !== ($file = @readdir($handle))) {
//跳过本目录以及上级目录
if ('.' === $file || '..' === $file) {
continue;
}
//是否仅读取目录
if ($mode === 2) {
if (isDir($dir . '/' . $file)) {
$files[] = $file;
}
//是否仅读取文件
} elseif ($mode === 1) {
if (isFile($dir . '/' . $file)) {
$files[] = $file;
}
//读取全部
} else {
$files[] = $file;
}
}
//关闭打开的目录句柄
@closedir($handle);
//输出文件列表数组
return $files;
}
示例15: validateTransmissionCli
/**
* Validates existence + exec + valid version of transmissioncli and returns the status image
*
* @param $the_file
* @return string
*/
function validateTransmissionCli($the_file)
{
global $cfg;
if (!isFile($the_file)) {
return validationMsg(false, 'Path is not valid');
}
if (!is_executable($the_file)) {
return validationMsg(false, 'File exists but is not executable');
}
$transmissionHelp = strtolower(shell_exec("HOME=" . tfb_shellencode($cfg["path"]) . "; export HOME; " . $the_file . ' --help'));
return strpos($transmissionHelp, 'transmission') === false || strpos($transmissionHelp, 'tfcli') === false && strpos($transmissionHelp, 'torrentflux') === false ? validationMsg(false, 'Executable is not TorrentFlux-bundled transmissioncli') : validationMsg(true);
}