本文整理汇总了PHP中getDir函数的典型用法代码示例。如果您正苦于以下问题:PHP getDir函数的具体用法?PHP getDir怎么用?PHP getDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sayfaisle
public function sayfaisle($gelen)
{
$dummy = '';
while ($item = explode('[[ekle((', $gelen, 2)) {
if (count($item) < 2) {
$dummy .= $item[0];
break;
}
$dummy .= $item[0];
$item = explode('))]]', $item[1], 2);
$dummy .= file_get_contents(getDir('index.php') . "yonetim/sablon/" . $item[0]);
$gelen = $item[1];
}
$gelen = $dummy;
while ($item = explode('[[', $gelen, 2)) {
if (count($item) < 2) {
echo $item[0];
break;
}
echo $item[0];
$item = explode(']]', $item[1], 2);
$gelen = $item[1];
$this->calistir($item[0]);
}
}
示例2: listFile
function listFile(&$result, $path)
{
if (!getDir($link, $path)) {
return false;
}
while (($entry = readdir($link)) !== false) {
if ($entry == "." || $entry == "..") {
continue;
}
if (is_dir($path . '/' . $entry)) {
// recherche des fichiers dans le sous-dossier suivant
listFile($result, $path . '/' . $entry);
} else {
if (is_file($path . '/' . $entry)) {
if (preg_match('/.*\\.avi$/', $entry)) {
$result[] = array($path . '/', $entry);
}
}
continue;
}
}
if (empty($result)) {
return false;
}
return true;
}
示例3: listen
public function listen(Dispatcher $events)
{
$events->listen(RegisterLocales::class, function (RegisterLocales $event) {
function getDir($dir)
{
$dirArray[] = NULL;
if (false != ($handle = opendir($dir))) {
$i = 0;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && !strpos($file, ".")) {
$dirArray[$i] = $file;
$i++;
}
}
closedir($handle);
}
return $dirArray;
}
$extensions_enabled = app('Flarum\\Core\\Settings\\SettingsRepository')->get('extensions_enabled');
$localePath = __DIR__ . '/../locale/';
$arr = json_decode($extensions_enabled, true);
if ($key = array_search('i18n', $arr)) {
unset($arr[$key]);
}
foreach (getDir($localePath) as $v) {
$coreYml = $localePath . $v . '/core.yml';
$array = Yaml::parse(file_get_contents(__DIR__ . '/languagecodes.yml'));
if (file_exists($coreYml)) {
preg_match('/\\/locale\\/(.*?)\\//i', $coreYml, $languagecodes);
$languagecodes = $languagecodes[1];
$languagename = $array[$languagecodes];
$event->manager->addLocale($languagecodes, $languagename);
$event->manager->addJsFile($languagecodes, $localePath . $languagecodes . '/core.js');
$event->manager->addConfig($languagecodes, $localePath . $languagecodes . '/core.php');
$event->addTranslations($languagecodes, $localePath . $languagecodes . '/core.yml');
foreach ($arr as $extensions) {
$localeYml = $localePath . $languagecodes . '/' . $extensions . '.yml';
$enYml = getcwd() . '/extensions/' . $extensions . '/locale/en.yml';
if (file_exists($localeYml)) {
$event->addTranslations($languagecodes, $localeYml);
} else {
if (file_exists($enYml)) {
$event->addTranslations($languagecodes, $enYml);
}
}
}
}
}
});
}
示例4: getDir
function getDir($dir)
{
$fileArr = array();
$dp = opendir($dir);
while (($file = readdir($dp)) != false) {
if ($file != "." and $file != ".." and $file != "") {
if (is_dir($dir . "/" . $file)) {
$fileArr = array_merge($fileArr, getDir($dir . "/" . $file));
$fileArr[] = $dir . "/" . $file;
}
}
}
closedir($dp);
return $fileArr;
}
示例5: set
public function set()
{
if ($_SESSION["wadmin"] && in_array(1, $this->group_json)) {
$result = R("Api/Api/getsetting");
$this->assign("info", $result);
$themedir = getDir("./Application/Tpl/App");
for ($i = 0; $i < count($themedir); $i++) {
$theme[$i] = simplexml_load_file("./Application/Tpl/App" . $themedir[$i] . "/config.xml");
if (isset($theme[$i])) {
$theme[$i]->dir = $themedir[$i];
}
}
$this->assign("theme", $theme);
$this->assign("settheme", $result["theme"]);
$payresult = R("Api/Api/getalipay");
$this->assign("alipay", $payresult);
$buyday = 0;
if (file_exists('./Public/Conf/buyday.php')) {
require './Public/Conf/buyday.php';
}
$this->assign("buyday", $buyday);
$result = M("Admin")->select();
$group_des = array();
$group_des[1] = '商城设置';
$group_des[2] = '商品分类';
$group_des[3] = '商品管理';
$group_des[4] = '订单管理';
$group_des[5] = '用户管理';
$group_des[6] = '微信管理';
$group_des[7] = '提现管理';
foreach ($result as $key => $info) {
if (file_exists("./Public/Conf/group_" . $info["username"] . ".php")) {
require "./Public/Conf/group_" . $info["username"] . ".php";
$group_json = json_decode($group_json);
} else {
$group_json = array(1, 2, 3, 4, 5, 6, 7);
}
$group = '';
foreach ($group_json as $json_info) {
$group .= $group_des[$json_info] . '|';
}
$result[$key]['group'] = $group;
}
$this->assign("result", $result);
$this->display();
}
}
示例6: getAllFile
function getAllFile($dir = '')
{
def($dir, './');
$output = array();
foreach (getDir("dir: {$dir}, is_file:1, full:1") as $key => $val) {
if (preg_match("/(addon|file|sfile|image)\$/i", $val)) {
continue;
}
if (is_dir($val)) {
$output = array_merge($output, getAllFile($val));
} else {
if (preg_match("/\\.(js|css|php|html|mini)\$/i", basename($val))) {
$output[] = $val;
}
}
}
return $output;
}
示例7: set
public function set()
{
if ($_SESSION["wadmin"]) {
$result = R("Api/Api/getsetting");
$this->assign("info", $result);
$themedir = getDir("./Application/Tpl/App");
for ($i = 0; $i < count($themedir); $i++) {
$theme[$i] = simplexml_load_file("./Application/Tpl/App" . $themedir[$i] . "/config.xml");
if (isset($theme[$i])) {
$theme[$i]->dir = $themedir[$i];
}
}
$this->assign("theme", $theme);
$this->assign("settheme", $result["theme"]);
$payresult = R("Api/Api/getalipay");
$this->assign("alipay", $payresult);
$this->display();
}
}
示例8: getDir
function getDir($path, $filter, $recursive, &$result, $ignore)
{
foreach (glob($path . '/*', GLOB_ONLYDIR) as $dir) {
if ($dir == '.' | $dir == '..' | ignored($dir, $ignore)) {
continue;
}
foreach (glob($dir . '/' . $filter) as $file) {
if (ignored($file, $ignore)) {
continue;
}
$f[] = slash(str_replace($_SERVER['DOCUMENT_ROOT'], '/', $file), false);
}
if (count($f) > 0) {
$result[] = array('DIR' => slash(str_replace($_SERVER['DOCUMENT_ROOT'], '/', $dir)), 'FILES' => $f);
}
if ($recursive) {
if (getDir($dir, $filter, $recursive, $result, $ignore) === false) {
return false;
}
}
}
return true;
}
示例9: makeWeatherSidebar
function makeWeatherSidebar()
{
global $forecast_api;
global $weather_lat;
global $weather_long;
$forecastExcludes = '?exclude=flags';
// Take a look at https://developer.forecast.io/docs/v2 to configure your weather information.
$currentForecast = json_decode(file_get_contents('https://api.forecast.io/forecast/' . $forecast_api . '/' . $weather_lat . ',' . $weather_long . $forecastExcludes));
$currentSummary = $currentForecast->currently->summary;
$currentSummaryIcon = $currentForecast->currently->icon;
$currentTemp = round($currentForecast->currently->temperature);
$currentWindSpeed = round($currentForecast->currently->windSpeed);
if ($currentWindSpeed > 0) {
$currentWindBearing = $currentForecast->currently->windBearing;
}
$minutelySummary = $currentForecast->minutely->summary;
$hourlySummary = $currentForecast->hourly->summary;
$sunriseTime = $currentForecast->daily->data[0]->sunriseTime;
$sunsetTime = $currentForecast->daily->data[0]->sunsetTime;
if ($sunriseTime > time()) {
$rises = 'Rises';
} else {
$rises = 'Rose';
}
if ($sunsetTime > time()) {
$sets = 'Sets';
} else {
$sets = 'Set';
}
// If there are alerts, make the alerts variables
if (isset($currentForecast->alerts)) {
$alertTitle = $currentForecast->alerts[0]->title;
$alertExpires = $currentForecast->alerts[0]->expires;
$alertDescription = $currentForecast->alerts[0]->description;
$alertUri = $currentForecast->alerts[0]->uri;
}
// Make the array for weather icons
$weatherIcons = ['clear-day' => 'B', 'clear-night' => 'C', 'rain' => 'R', 'snow' => 'W', 'sleet' => 'X', 'wind' => 'F', 'fog' => 'L', 'cloudy' => 'N', 'partly-cloudy-day' => 'H', 'partly-cloudy-night' => 'I'];
$weatherIcon = $weatherIcons[$currentSummaryIcon];
// If there is a severe weather warning, display it
//if (isset($currentForecast->alerts)) {
// echo '<div class="alert alert-warning alert-dismissable">';
// echo '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>';
// echo '<strong><a href="'.$alertUri.'" class="alert-link">'.$alertTitle.'</a></strong>';
// echo '</div>';
//}
echo '<ul class="list-inline" style="margin-bottom:-20px">';
echo '<li><h1 data-icon="' . $weatherIcon . '" style="font-size:500%;margin:0px -10px 20px -5px"></h1></li>';
echo '<li><ul class="list-unstyled">';
echo '<li><h1 class="exoregular" style="margin:0px">' . $currentTemp . '°</h1></li>';
echo '<li><h4 class="exoregular" style="margin:0px;padding-right:10px;width:80px">' . $currentSummary . '</h4></li>';
echo '</ul></li>';
echo '</ul>';
if ($currentWindSpeed > 0) {
$direction = getDir($currentWindBearing);
echo '<h4 class="exoextralight" style="margin-top:0px">Wind: ' . $currentWindSpeed . ' mph from the ' . $direction . '</h4>';
} else {
echo '<h4 class="exoextralight" style="margin-top:0px">Wind: Calm</h4>';
}
echo '<h4 class="exoregular">Next Hour</h4>';
echo '<h5 class="exoextralight" style="margin-top:10px">' . $minutelySummary . '</h5>';
echo '<h4 class="exoregular">Next 24 Hours</h4>';
echo '<h5 class="exoextralight" style="margin-top:10px">' . $hourlySummary . '</h5>';
echo '<h4 class="exoregular">The Sun</h4>';
echo '<h5 class="exoextralight" style="margin-top:10px">' . $rises . ' at ' . date('g:i A', $sunriseTime) . '</h5>';
echo '<h5 class="exoextralight" style="margin-top:10px">' . $sets . ' at ' . date('g:i A', $sunsetTime) . '</h5>';
echo '<p class="text-right no-link-color" style="margin-bottom:-10px"><small><a href="http://forecast.io/#/f/' . $weather_lat . ',' . $weather_long . '">Forecast.io</a></small></p> ';
}
示例10: htmlentities
$mp3file->getid3($filename);
echo "<tr>";
// album tag
echo "<p><td><b>{$mp3file->album}</b></td>\n";
// title tag
echo "<td><a href=" . $rootMP3URL . "/" . htmlentities(str_replace(" ", "%20", $filename)) . ">" . str_replace("_", " ", $mp3file->title) . "</a></td>\n";
// composer tag
echo "<p><td><b>{$mp3file->artist}</b></td>\n";
echo "<td><i>" . date("r", $filedate) . "</i></td>\n";
echo "<td><i>" . filesize($filename) . " (bytes)</i></td>\n";
echo "<p><td>{$mp3file->mime_type}</td>\n";
print "</tr>\n";
$maxFeed--;
}
print "</table>\n";
$dirArray = getDir(".", $sftypes);
// Get a list of the current directory
while (list($filename, $filedate) = each($dirArray) and $maxFeed > 0) {
echo "<p> </p>\n";
}
echo "<p> </p>\n";
echo "<p> </p>\n";
// Functions and Classes
function stripJunk($text)
{
// Strip non-text characters
for ($c = 0; $c < strlen($text); $c++) {
if (ord($text[$c]) >= 32 and ord($text[$c]) <= 122) {
$outText .= $text[$c];
}
}
示例11: basename
// create a photoset?
print 'Create a photoset [y/N] ';
if ('y' == substr(trim(fgets(STDIN)), 0, 1)) {
$setName = basename($dir);
print "Photos will be added to a new photoset named '{$setName}'.\n\n";
} else {
$setName = null;
print "No photoset will be created.\n\n";
}
return $setName;
}
$api = getApi();
// the idea of this regular expression is that the camera file name
// starts with 3 or 4 characters, followed by 4 or 5 digits. if i've
// renamed it it would have a space, underscore or hyphen (that we'll
// ignore) and then any number of characters before ending with a period
// and then 3 character file extension.
$pattern = '/\\S{3,4}\\d{4,5}[ _-]?(.*)\\.\\S{3}/';
// the idea of this one is a two digit number, _ or - and then
// the name.jpg
#$pattern = '/\d{1,2}[ _-]?(.*)\.\S{3}/';
$dir = getDir();
// ... let the user know what we've figured out
$user = new Phlickr_AuthedUser($api);
$userName = $user->getName();
print "Uploading all the photos in '{$dir}' to {$userName}'s stream\n\n";
$batcher = new CommandlineBatchUploader($dir, $pattern, getSetName($dir));
$uploader = new Phlickr_Uploader($api);
$uploader->setTags(getTags());
$uploader->uploadBatch($batcher, new Phlickr_TextUi_UploaderListener());
exit(0);
示例12: htmlspecialchars
require_once 'Library/Parsedown/Parsedown.php';
/* ------------------------------------- 以下 为正式代码 --------------------------------------- */
if (isLogin()) {
// 已登陆
// 接收参数
$class = htmlspecialchars($_GET['class']);
$file = htmlspecialchars($_GET['file']);
/* 获取目录数据 */
if ($class) {
$menus = getFile(__API__ . '/' . $class);
if ($menus) {
asort($menus);
}
$menus = $menus ?: $menus;
} else {
$directory = getDir(__API__);
$menus = array();
if ($directory) {
asort($directory);
foreach ($directory as $k => $v) {
$file = getFile(__API__ . '/' . $v);
$menus[$k]['num'] = count($file);
$menus[$k]['name'] = $v;
}
} else {
$menus = $directory;
}
}
/* 读取解析文档内容 */
if ($file) {
$file_name = __API__ . '/' . $class . '/' . $file;
示例13: Link
<?php
require_once 'core/intit.php';
$link = new Link();
$db = DBContent::connect();
$allContent = $db->get('content');
?>
<!DOCTYPE html>
<html dir="<?php
getDir();
?>
">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta charset="UTF-8">
<title><?php
__('multilingual php library');
?>
</title>
<link href="assets/css/bootstrap.css" type="text/css" rel="stylesheet">
<link href="assets/css/bootstrap.min.css" type="text/css" rel="stylesheet">
<link href="assets/css/heroic-features.css" type="text/css" rel="stylesheet">
<link href="assets/css/sweet-alert.css" type="text/css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
示例14: compile
function compile(url){\$.get('/index.php?r='+url, function (r){
\$('#main').append('<p>compile <a href="/web/'+url+'.html">web/'+url+'.html</a>,success</p>')
})}
for (index in data){
compile(data[index])
}
</script>
</body>
</html>
EOF;
}
if ($router == VIEW_LIST) {
$files = getDir(PATH_VIEWS, 'html');
$data = [];
foreach ($files as $f) {
$data[] = substr($f, 0, strpos($f, ".html"));
}
$data = json_encode($data);
echo html($data);
} else {
$file = PATH_VIEWS . $router . ".html";
if (is_file($file)) {
extract(loadConfig($file));
ob_start();
include $file;
$content = template(ob_get_contents());
ob_end_clean();
$content = preg_replace("/---[\\d\\D]*?---/", '', $content, 1);
示例15: delete
function delete($setup)
{
//Get the image ID
$id = htmlentities($setup['imageId']);
//Check the file extension to make sure that it's valid
checkExtension($id);
//Get the directory to get the images from
$dir = getDir($setup);
//Make sure that it is actually a directory
checkImageDirectoryExists($dir);
//Check to make sure that the image actually exists
if (imageExists($dir . '/' . $id)) {
//Delete the file
unlink($dir . '/' . $id);
echo json_encode(['success' => true, 'message' => 'Image successfully deleted.']);
exit;
} else {
echo json_encode(['success' => false, 'message' => 'That image could not be found.']);
exit;
}
}