本文整理汇总了PHP中osC_DirectoryListing::getFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_DirectoryListing::getFiles方法的具体用法?PHP osC_DirectoryListing::getFiles怎么用?PHP osC_DirectoryListing::getFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osC_DirectoryListing
的用法示例。
在下文中一共展示了osC_DirectoryListing::getFiles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listServices
function listServices()
{
global $toC_Json, $osC_Language;
$osC_DirectoryListing = new osC_DirectoryListing('includes/modules/services');
$osC_DirectoryListing->setIncludeDirectories(false);
$files = $osC_DirectoryListing->getFiles();
$installed = explode(';', MODULE_SERVICES_INSTALLED);
$modules = array();
foreach ($files as $file) {
include 'includes/modules/services/' . $file['name'];
$class = substr($file['name'], 0, strrpos($file['name'], '.'));
$module = 'osC_Services_' . $class . '_Admin';
$module = new $module();
$action = array();
if (in_array($class, $installed) && !osc_empty($module->keys())) {
$action[] = array('class' => 'icon-edit-record', 'qtip' => $osC_Language->get('icon_edit'));
} else {
$action[] = array('class' => 'icon-edit-gray-record', 'qtip' => $osC_Language->get('icon_edit'));
}
if (!in_array($class, $installed)) {
$action[] = array('class' => 'icon-install-record', 'qtip' => $osC_Language->get('icon_install'));
} else {
if ($module->uninstallable == false) {
$action[] = array('class' => 'icon-uninstall-gray-record', 'qtip' => $osC_Language->get('icon_uninstall'));
} else {
$action[] = array('class' => 'icon-uninstall-record', 'qtip' => $osC_Language->get('icon_uninstall'));
}
}
$modules[] = array('code' => $class, 'title' => $module->title, 'action' => $action);
}
$response[EXT_JSON_READER_ROOT] = $modules;
echo $toC_Json->encode($response);
}
示例2: getGadgets
function getGadgets()
{
global $toC_Json, $osC_Language;
$record = array();
$osC_DirectoryListing = new osC_DirectoryListing('includes/modules/gadgets');
if ($osC_DirectoryListing->getSize()) {
foreach ($osC_DirectoryListing->getFiles() as $file) {
$gadget = substr($file['name'], 0, strrpos($file['name'], '.'));
$class_path = 'includes/modules/gadgets/' . $gadget . '.php';
if (!empty($gadget) && file_exists($class_path)) {
include $class_path;
$osC_Language->loadIniFile('modules/gadgets/' . $gadget . '.php');
if (class_exists('toC_Gadget_' . $gadget)) {
$module_class = 'toC_Gadget_' . $gadget;
$module = new $module_class();
$records[] = array('code' => $module->getCode(), 'type' => $module->getType(), 'icon' => $module->getIcon(), 'title' => $module->getTitle(), 'file' => $module->getFile(), 'description' => $module->getDescription());
}
}
}
$response = array('success' => true, 'records' => $records);
} else {
$response = array('success' => false);
}
echo $toC_Json->encode($response);
}
示例3: listTemplatesModules
function listTemplatesModules()
{
global $toC_Json, $osC_Language;
$osC_Language->load('modules-' . $_REQUEST['set']);
$osC_DirectoryListing = new osC_DirectoryListing('../includes/modules/' . $_REQUEST['set']);
$osC_DirectoryListing->setIncludeDirectories(false);
$files = $osC_DirectoryListing->getFiles();
$modules = array();
foreach ($files as $file) {
include '../includes/modules/' . $_REQUEST['set'] . '/' . $file['name'];
$code = substr($file['name'], 0, strrpos($file['name'], '.'));
$class = 'osC_' . ucfirst($_REQUEST['set']) . '_' . $code;
if (class_exists($class)) {
if (call_user_func(array($class, 'isInstalled'), $code, $_GET['set']) === false) {
$osC_Language->injectDefinitions('modules/' . $_GET['set'] . '/' . $code . '.xml');
}
$module = new $class();
$action = array();
if ($module->isInstalled() && $module->isActive()) {
if ($module->hasKeys()) {
$action[] = array('class' => 'icon-edit-record', 'qtip' => $osC_Language->get('icon_edit'));
} else {
$action[] = array('class' => 'icon-edit-gray-record', 'qtip' => $osC_Language->get('icon_edit'));
}
$action[] = array('class' => 'icon-uninstall-record', 'qtip' => $osC_Language->get('icon_uninstall'));
} else {
$action[] = array('class' => 'icon-edit-gray-record', 'qtip' => $osC_Language->get('icon_edit'));
$action[] = array('class' => 'icon-install-record', 'qtip' => $osC_Language->get('icon_install'));
}
$modules[] = array('code' => $code, 'title' => $module->getTitle(), 'author' => $module->getAuthorName(), 'url' => $module->getAuthorAddress(), 'action' => $action);
}
}
$response[EXT_JSON_READER_ROOT] = $modules;
echo $toC_Json->encode($response);
}
示例4: listGeoipModules
function listGeoipModules()
{
global $toC_Json, $osC_Language;
$osC_DirectoryListing = new osC_DirectoryListing('includes/modules/geoip');
$osC_DirectoryListing->setIncludeDirectories(false);
$files = $osC_DirectoryListing->getFiles();
$modules = array();
foreach ($files as $file) {
include 'includes/modules/geoip/' . $file['name'];
$class = substr($file['name'], 0, strrpos($file['name'], '.'));
if (class_exists('osC_GeoIP_' . $class)) {
$osC_Language->loadIniFile('modules/geoip/' . $class . '.php');
$module = 'osC_GeoIP_' . $class;
$module = new $module();
$action = array();
if ($module->isInstalled()) {
$action[] = array('class' => 'icon-uninstall-record', 'qtip' => $osC_Language->get('icon_uninstall'));
} else {
$action[] = array('class' => 'icon-install-record', 'qtip' => $osC_Language->get('icon_install'));
}
$modules[] = array('code' => $class, 'title' => $module->getTitle(), 'description' => $module->getDescription(), 'author' => $module->getAuthorName(), 'action' => $action);
}
}
$response[EXT_JSON_READER_ROOT] = $modules;
echo $toC_Json->encode($response);
}
示例5: getAccesses
function getAccesses()
{
global $toC_Json, $osC_Language;
$osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access');
$osC_DirectoryListing->setIncludeDirectories(false);
$access_modules_array = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$module = substr($file['name'], 0, strrpos($file['name'], '.'));
if (!class_exists('osC_Access_' . ucfirst($module))) {
$osC_Language->loadIniFile('modules/access/' . $file['name']);
include $osC_DirectoryListing->getDirectory() . '/' . $file['name'];
}
$module = 'osC_Access_' . ucfirst($module);
$module = new $module();
$title = osC_Access::getGroupTitle($module->getGroup());
$access_modules_array[$title][] = array('id' => $module->getModule(), 'text' => $module->getTitle(), 'leaf' => true);
}
ksort($access_modules_array);
$access_options = array();
$count = 1;
foreach ($access_modules_array as $group => $modules) {
$access_option['id'] = $count;
$access_option['text'] = $group;
$mod_arrs = array();
foreach ($modules as $module) {
$mod_arrs[] = $module;
}
$access_option['children'] = $mod_arrs;
$access_options[] = $access_option;
$count++;
}
echo $toC_Json->encode($access_options);
}
示例6: listCache
function listCache()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_WORK);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('cache');
$response = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$last_modified = filemtime(DIR_FS_WORK . '/' . $file['name']);
if (strpos($file['name'], '-') !== false) {
$code = substr($file['name'], 0, strpos($file['name'], '-'));
} else {
$code = substr($file['name'], 0, strpos($file['name'], '.'));
}
if (isset($cached_files[$code])) {
$cached_files[$code]['total']++;
if ($last_modified > $cached_files[$code]['last_modified']) {
$cached_files[$code]['last_modified'] = $last_modified;
}
} else {
$cached_files[$code] = array('total' => 1, 'last_modified' => $last_modified);
}
$response[] = array('code' => $code, 'total' => $cached_files[$code]['total'], 'last_modified' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($cached_files[$code]['last_modified']), true));
}
$response = array(EXT_JSON_READER_ROOT => $response);
echo $toC_Json->encode($response);
}
示例7: listDirectory
function listDirectory()
{
global $osC_Language, $toC_Json, $osC_MessageStack;
$directory = OSC_ADMIN_FILE_MANAGER_ROOT_PATH;
if (isset($_REQUEST['directory']) && !empty($_REQUEST['directory'])) {
$directory .= '/' . urldecode($_REQUEST['directory']);
} elseif (isset($_REQUEST['goto']) && !empty($_REQUEST['goto'])) {
$directory .= '/' . urldecode($_REQUEST['goto']);
}
$osC_DirectoryListing = new osC_DirectoryListing($directory);
$osC_DirectoryListing->setStats(true);
$records = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$file_owner = function_exists('posix_getpwuid') ? posix_getpwuid($file['user_id']) : '-?-';
$group_owner = function_exists('posix_getgrgid') ? posix_getgrgid($file['group_id']) : '-?-';
if ($file['is_directory'] === true) {
$entry_icon = osc_icon('folder_red.png');
$action = array(array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-empty-record', 'qtip' => ''), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
} else {
$entry_icon = osc_icon('file.png');
$action = array(array('class' => 'icon-edit-record', 'qtip' => $osC_Language->get('icon_edit')), array('class' => 'icon-download-record', 'qtip' => $osC_Language->get('icon_download')), array('class' => 'icon-delete-record', 'qtip' => $osC_Language->get('icon_trash')));
}
$records[] = array('icon' => $entry_icon, 'file_name' => $file['name'], 'is_directory' => $file['is_directory'], 'size' => number_format($file['size']), 'permission' => osc_get_file_permissions($file['permissions']), 'file_owner' => $file_owner, 'group_owner' => $group_owner, 'writeable' => osc_icon(is_writable($osC_DirectoryListing->getDirectory() . '/' . $file['name']) ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif'), 'last_modified_date' => osC_DateTime::getShort(osC_DateTime::fromUnixTimestamp($file['last_modified']), true), 'action' => $action);
}
$response = array(EXT_JSON_READER_ROOT => $records);
echo $toC_Json->encode($response);
}
示例8: listTemplates
function listTemplates()
{
global $toC_Json, $osC_Language;
$osC_DirectoryListing = new osC_DirectoryListing('../templates');
$osC_DirectoryListing->setIncludeDirectories(true);
$osC_DirectoryListing->setIncludeFiles(false);
$osC_DirectoryListing->setExcludeEntries('system');
$files = $osC_DirectoryListing->getFiles(true);
foreach ($files as $file) {
include '../templates/' . $file['name'] . '/template.php';
$code = $file['name'];
$class = 'osC_Template_' . $code;
if (class_exists($class)) {
$module = new $class();
$module_title = $module->getTitle();
$action = array();
if ($module->isInstalled()) {
if ($module->getCode() == DEFAULT_TEMPLATE) {
$module_title .= ' (' . $osC_Language->get('default_entry') . ')';
$action[] = array('class' => 'icon-default-record', 'qtip' => $osC_Language->get('field_set_as_default'));
} else {
$action[] = array('class' => 'icon-default-gray-record', 'qtip' => $osC_Language->get('field_set_as_default'));
}
$action[] = array('class' => 'icon-uninstall-record', 'qtip' => $osC_Language->get('icon_uninstall'));
} else {
$action[] = array('class' => 'icon-empty-record', 'qtip' => $osC_Language->get('field_set_as_default'));
$action[] = array('class' => 'icon-install-record', 'qtip' => $osC_Language->get('icon_install'));
}
$modules[] = array('code' => $module->getCode(), 'title' => $module_title, 'author' => $module->getAuthorName(), 'url' => $module->getAuthorAddress(), 'action' => $action);
}
}
$response = array(EXT_JSON_READER_ROOT => $modules);
echo $toC_Json->encode($response);
}
示例9: listShippingModules
function listShippingModules()
{
global $toC_Json, $osC_Language;
$osC_DirectoryListing = new osC_DirectoryListing('includes/modules/shipping');
$osC_DirectoryListing->setIncludeDirectories(false);
$files = $osC_DirectoryListing->getFiles();
$modules = array();
foreach ($files as $file) {
include 'includes/modules/shipping/' . $file['name'];
$class = substr($file['name'], 0, strrpos($file['name'], '.'));
if (class_exists('osC_Shipping_' . $class)) {
$osC_Language->injectDefinitions('modules/shipping/' . $class . '.xml');
$module = 'osC_Shipping_' . $class;
$module = new $module();
$action = array();
if ($module->isInstalled()) {
$action[] = array('class' => 'icon-edit-record', 'qtip' => $osC_Language->get('icon_edit'));
$action[] = array('class' => 'icon-uninstall-record', 'qtip' => $osC_Language->get('icon_uninstall'));
} else {
$action[] = array('class' => 'icon-edit-gray-record', 'qtip' => $osC_Language->get('icon_edit'));
$action[] = array('class' => 'icon-install-record', 'qtip' => $osC_Language->get('icon_install'));
}
$modules[] = array('code' => $module->getCode(), 'title' => $module->getTitle(), 'sort_order' => $module->getSortOrder(), 'action' => $action);
}
}
$response[EXT_JSON_READER_ROOT] = $modules;
echo $toC_Json->encode($response);
}
示例10: array
function _getSocialBookmarks()
{
$osC_DirectoryListing = new osC_DirectoryListing(TOC_SOCIAL_BOOKMARKS_MODULES);
$social_bookmarks = array();
foreach ($osC_DirectoryListing->getFiles() as $social_bookmark) {
$social_bookmark_class = substr($social_bookmark['name'], 0, strrpos($social_bookmark['name'], '.'));
if (!class_exists($social_bookmark_class)) {
include TOC_SOCIAL_BOOKMARKS_MODULES . '/' . $social_bookmark_class . '.php';
}
$social_bookmarks[] = new $social_bookmark_class();
}
return $social_bookmarks;
}
示例11: listBackup
function listBackup()
{
global $toC_Json;
$osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_BACKUP);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setExcludeEntries('.htaccess');
$response = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$response[] = array('file' => $file['name'], 'date' => osC_DateTime::getDate(osC_DateTime::fromUnixTimestamp(filemtime(DIR_FS_BACKUP . $file['name'])), true), 'size' => number_format(filesize(DIR_FS_BACKUP . $file['name'])));
}
$response = array(EXT_JSON_READER_ROOT => $response);
echo $toC_Json->encode($response);
}
示例12: getOriginalLogo
function getOriginalLogo()
{
$osC_DirectoryListing = new osC_DirectoryListing('../' . DIR_WS_IMAGES);
$osC_DirectoryListing->setIncludeDirectories(false);
$files = $osC_DirectoryListing->getFiles();
foreach ($files as $file) {
$filename = explode(".", $file['name']);
if ($filename[0] == 'logo_originals') {
return '../' . DIR_WS_IMAGES . 'logo_originals.' . $filename[1];
}
}
return false;
}
示例13: getLocalImages
public static function getLocalImages()
{
$osC_DirectoryListing = new osC_DirectoryListing('../images/products/_upload', true);
$osC_DirectoryListing->setCheckExtension('gif');
$osC_DirectoryListing->setCheckExtension('jpg');
$osC_DirectoryListing->setCheckExtension('png');
$osC_DirectoryListing->setIncludeDirectories(false);
$result = array('entries' => array());
foreach ($osC_DirectoryListing->getFiles() as $file) {
$result['entries'][] = $file['name'];
}
$result['rpcStatus'] = RPC_STATUS_SUCCESS;
echo json_encode($result);
}
示例14: foreach
function osC_LanguageInstall()
{
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages');
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setCheckExtension('xml');
foreach ($osC_DirectoryListing->getFiles() as $file) {
$osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file['name']));
$lang = $osC_XML->toArray();
$this->_languages[$lang['language']['data']['code']] = array('name' => $lang['language']['data']['title'], 'code' => $lang['language']['data']['code'], 'charset' => $lang['language']['data']['character_set']);
}
unset($lang);
$language = isset($_GET['language']) && !empty($_GET['language']) ? $_GET['language'] : '';
$this->set($language);
$this->loadIniFile();
$this->loadIniFile(basename($_SERVER['SCRIPT_FILENAME']));
}
示例15: getModules
function getModules()
{
global $toC_Json, $osC_Language;
$osC_DirectoryListing = new osC_DirectoryListing('includes/modules/newsletters');
$osC_DirectoryListing->setIncludeDirectories(false);
$records = array();
foreach ($osC_DirectoryListing->getFiles() as $file) {
$module = substr($file['name'], 0, strrpos($file['name'], '.'));
$osC_Language->loadIniFile('modules/newsletters/' . $file['name']);
include 'includes/modules/newsletters/' . $file['name'];
$newsletter_module_class = 'osC_Newsletter_' . $module;
$osC_NewsletterModule = new $newsletter_module_class();
$records[] = array('id' => $module, 'text' => $osC_NewsletterModule->getTitle());
}
$response = array(EXT_JSON_READER_ROOT => $records);
echo $toC_Json->encode($response);
}