本文整理汇总了PHP中PerchUtil::get_dir_contents方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::get_dir_contents方法的具体用法?PHP PerchUtil::get_dir_contents怎么用?PHP PerchUtil::get_dir_contents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerchUtil
的用法示例。
在下文中一共展示了PerchUtil::get_dir_contents方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_lang_options
public static function get_lang_options()
{
$Lang = PerchLang::fetch();
$out = array();
// Addons folder
if (is_dir(PerchUtil::file_path(PERCH_PATH . '/addons/lang'))) {
$lang_dir = PerchUtil::file_path(PERCH_PATH . '/addons/lang');
$files = PerchUtil::get_dir_contents($lang_dir, false);
if (is_array($files)) {
foreach ($files as $file) {
$out[] = PerchUtil::strip_file_extension($file);
}
}
}
// Core folder
$lang_dir = PerchUtil::file_path(PERCH_CORE . '/lang');
if (is_dir($lang_dir)) {
$files = PerchUtil::get_dir_contents($lang_dir, false);
if (is_array($files)) {
foreach ($files as $file) {
$f = PerchUtil::strip_file_extension($file);
if (!in_array($f, $out)) {
$out[] = $f;
}
}
}
}
if (PerchUtil::count($out)) {
sort($out);
return $out;
}
return false;
}
示例2: _get_addons
private function _get_addons($files)
{
$items = PerchUtil::get_dir_contents(PERCH_PATH . '/addons');
if (PerchUtil::count($items)) {
$out = array();
foreach ($items as $item) {
if (strpos($item, 'apps') === false) {
$files[] = PERCH_PATH . '/addons/' . $item;
} else {
$apps = PerchUtil::get_dir_contents(PERCH_PATH . '/addons/apps');
if (PerchUtil::count($apps)) {
foreach ($apps as $app) {
if (!strpos($app, 'backup')) {
$files[] = PERCH_PATH . '/addons/apps/' . $app;
}
}
}
}
}
}
return $files;
}
示例3:
}
if ($result) {
$message = $HTML->success_message('Your post has been successfully updated. Return to %spost listing%s', '<a href="' . $API->app_path() . '">', '</a>');
} else {
$message = $HTML->failure_message('Sorry, that post could not be updated.');
}
$details = $Post->to_array();
// clear the caches
PerchBlog_Cache::expire_all();
// update category post counts;
$Posts->update_category_counts();
$Authors->update_post_counts();
$Sections->update_post_counts();
// Has the template changed? If so, need to redirect back to kick things off again.
if ($data['postTemplate'] != $template) {
#PerchUtil::redirect($API->app_path() .'/edit/?id='.$Post->id().'&edited=1');
}
}
if (isset($_GET['edited']) && !$message) {
$message = $HTML->success_message('Your post has been successfully updated. Return to %spost listing%s', '<a href="' . $API->app_path() . '">', '</a>');
}
// is it a draft?
if (is_object($Post) && $Post->postStatus() == 'Draft') {
$draft = true;
$message = $Lang->get('%sYou are editing a draft. %sPreview%s', '<p class="alert draft">', '<a href="' . $HTML->encode($Post->previewURL()) . '" class="action draft-preview">', '</a></p>');
} else {
$draft = false;
$url = false;
}
$post_templates = PerchUtil::get_dir_contents(PerchUtil::file_path(PERCH_TEMPLATE_PATH . '/blog/posts'), false);
示例4: foreach
?>
/core/assets/css/debug.css" type="text/css" /><?php
}
}
?>
</head>
<body class="sidebar-closed">
<div class="main">
<div class="body">
<div class="inner">
<h1>Software Update</h1>
<ul class="updates">
<?php
$files = PerchUtil::get_dir_contents('scripts', false);
$DB = PerchDB::fetch();
if (PerchUtil::count($files)) {
foreach ($files as $file) {
if (PerchUtil::file_extension($file) == 'php') {
include PerchUtil::file_path(PERCH_CORE . '/update/scripts/' . $file);
}
}
}
if (!$errors) {
echo '<li class="icon success">Successfully updated to version ' . $Perch->version . '.</li>';
$Settings->set($setting_key, 'done');
}
?>
</ul>
<?php
示例5: find_executable_files_in_resources
public static function find_executable_files_in_resources()
{
$files = PerchUtil::get_dir_contents(PERCH_RESFILEPATH, false);
if (PerchUtil::count($files)) {
$out = array();
$bad_ext = array('php', 'phtml', 'php3', 'php4', 'php5');
foreach ($files as $file) {
$ext = PerchUtil::file_extension($file);
if (in_array($ext, $bad_ext)) {
$out[] = $file;
}
}
if (PerchUtil::count($out)) {
return $out;
}
}
return false;
}
示例6: foreach
$apps = $ScheduledTasks->get_scheduled();
if (PerchUtil::count($apps)) {
foreach ($apps as $appID => $tasks) {
$task_list = array();
echo '<li>Scheduled tasks for ' . $appID . ': ';
foreach ($tasks as $task) {
//print_r($task);
$task_list[] = $task['taskKey'] . ' (' . $task['frequency'] / 60 . ' mins)';
}
echo implode(', ', $task_list);
echo '</li>';
}
}
?>
<?php
echo '<li>Editor plug-ins: ' . implode(', ', PerchUtil::get_dir_contents(PerchUtil::file_path(PERCH_PATH . '/addons/plugins/editors/', true))) . '</li>';
?>
<li>H1: <?php
echo PerchUtil::html(md5($_SERVER['SERVER_NAME']));
?>
</li>
<li>L1: <?php
echo PerchUtil::html(md5(PERCH_LICENSE_KEY));
?>
</li>
<?php
$settings = $Settings->get_as_array();
if (PerchUtil::count($settings)) {
foreach ($settings as $key => $val) {
echo '<li>' . PerchUtil::html($key . ': ' . $val) . '</li>';
示例7: old_get_files_with_prefix
public function old_get_files_with_prefix($prefix, $subpath = false)
{
$out = array();
$files = PerchUtil::get_dir_contents($this->get_file_path() . $subpath);
if (PerchUtil::count($files)) {
foreach ($files as $file) {
if (substr($file, 0, strlen($prefix)) == $prefix) {
$out[] = $file;
}
}
}
return $out;
}
示例8: _load_app_callbacks
private function _load_app_callbacks()
{
$path = PERCH_PATH . '/addons/apps';
$apps = PerchUtil::get_dir_contents(PerchUtil::file_path($path), true);
$out = array();
if (PerchUtil::count($apps)) {
foreach ($apps as $app) {
$file = PerchUtil::file_path($path . '/' . $app . '/scheduled_tasks.php');
if (file_exists($file)) {
include $file;
$out[] = $app;
}
}
}
if (PERCH_RUNWAY) {
include PERCH_CORE . '/runway/scheduled_tasks.php';
}
return $out;
}
示例9: posterous_process_images
public function posterous_process_images($post, $Template)
{
$html = $post['postDescHTML'];
// find posterous URLs
// <img alt="Img_8371" height="333" src="http://getfile0.posterous.com/getfile/files.posterous.com/temp-2012-02-04/ybzoAslvztsefCumHsmxEuFjiEutyFpnhGanxcfyunylvDaoAhgpAxChyrnp/IMG_8371.jpg.scaled500.jpg" width="500"/>
// <a href="http://getfile0.posterous.com/getfile/files.posterous.com/temp-2012-02-04/ybzoAslvztsefCumHsmxEuFjiEutyFpnhGanxcfyunylvDaoAhgpAxChyrnp/IMG_8371.jpg.scaled1000.jpg">
$s = '/<img[^>]*src="[^"]*posterous\\.com[^"]*"[^>]*>/';
$count = preg_match_all($s, $html, $matches);
$PerchImage = $this->api->get('Image');
$image_folder = $this->import_folder . '/image/';
$Perch = Perch::fetch();
$bucket = $Perch->get_resource_bucket($this->resource_bucket);
if ($count) {
foreach ($matches as $match) {
$Tag = new PerchXMLTag($match[0]);
// Find the file name
$parts = explode('/', $Tag->src());
$filename = array_pop($parts);
$linkpath = str_replace($filename, '', $Tag->src());
$fileparts = explode('.scaled', $filename);
$filename = array_shift($fileparts);
$linkpath .= $filename;
// Find the temp-YYYY-MM-DD part of the path to find the image folder
$s = '/\\/temp-([0-9]{4})-([0-9]{2})-[0-9]{2}\\//';
$count = preg_match($s, $Tag->src(), $path_matches);
if ($count) {
$folder = PerchUtil::file_path($image_folder . $path_matches[1] . '/' . $path_matches[2] . '/');
$files = PerchUtil::get_dir_contents($folder, false);
if (PerchUtil::count($files)) {
$l = strlen($filename);
$image_file = false;
foreach ($files as $file) {
PerchUtil::debug(substr($file, -$l));
if (substr($file, -$l) == $filename) {
$image_file = PerchUtil::file_path($folder . $file);
break;
}
}
if ($image_file) {
$new_image_file = PerchUtil::file_path($bucket['file_path'] . '/' . $file);
copy($image_file, $new_image_file);
$new_image = $PerchImage->resize_image($new_image_file, (int) $Tag->width(), (int) $Tag->height());
$img_html = '<img src="' . $new_image['web_path'] . '" width="' . $new_image['w'] . '" height="' . $new_image['h'] . '" alt="' . PerchUtil::html($Tag->alt()) . '" />';
if (defined('PERCH_XHTML_MARKUP') && PERCH_XHTML_MARKUP == false) {
$img_html = str_replace(' />', '>', $img_html);
}
$html = str_replace($match[0], $img_html, $html);
// find links to the bigger version
$s = '/<a[^>]*href="' . preg_quote($linkpath, '/') . '[^"]*"[^>]*>/';
$s = preg_replace('#getfile[0-9]{1,2}#', 'getfile[0-9]{1,2}', $s);
$count = preg_match_all($s, $html, $link_matches);
if ($count) {
$big_image = $PerchImage->resize_image($new_image_file, (int) $Tag->width() * 2, (int) $Tag->height() * 2);
$link_html = '<a href="' . $big_image['web_path'] . '">';
foreach ($link_matches as $link_match) {
$html = str_replace($link_match[0], $link_html, $html);
}
} else {
PerchUtil::debug('FAIL', 'error');
PerchUtil::debug($new_image);
PerchUtil::debug($s);
PerchUtil::debug($link_matches);
}
}
}
}
}
}
$post['postDescHTML'] = $html;
$post['postDescRaw'] = $html;
return $post;
}