本文整理汇总了PHP中osC_DirectoryListing::setRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_DirectoryListing::setRecursive方法的具体用法?PHP osC_DirectoryListing::setRecursive怎么用?PHP osC_DirectoryListing::setRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osC_DirectoryListing
的用法示例。
在下文中一共展示了osC_DirectoryListing::setRecursive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
function import($file, $type)
{
global $osC_Database, $osC_Currencies;
if (file_exists('../includes/languages/' . $file . '.xml')) {
$osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
$source = $osC_XML->toArray();
$language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => $source['language']['data']['parent_language_code'], 'parent_id' => 0);
if (!$osC_Currencies->exists($language['currency'])) {
$language['currency'] = DEFAULT_CURRENCY;
}
if (!empty($language['parent_language_code'])) {
$Qlanguage = $osC_Database->query('select languages_id from :table_languages where code = :code');
$Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
$Qlanguage->bindValue(':code', $language['parent_language_code']);
$Qlanguage->execute();
if ($Qlanguage->numberOfRows() === 1) {
$language['parent_id'] = $Qlanguage->valueInt('languages_id');
}
}
$definitions = array();
if (isset($source['language']['definitions']['definition'])) {
$definitions = $source['language']['definitions']['definition'];
if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
$definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
}
}
$tables = array();
if (isset($source['language']['tables']['table'])) {
$tables = $source['language']['tables']['table'];
}
unset($source);
$error = false;
$add_category_and_product_placeholders = true;
$osC_Database->startTransaction();
$Qcheck = $osC_Database->query('select languages_id from :table_languages where code = :code');
$Qcheck->bindTable(':table_languages', TABLE_LANGUAGES);
$Qcheck->bindValue(':code', $language['code']);
$Qcheck->execute();
if ($Qcheck->numberOfRows() === 1) {
$add_category_and_product_placeholders = false;
$language_id = $Qcheck->valueInt('languages_id');
$Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
$Qlanguage->bindInt(':languages_id', $language_id);
} else {
$Qlanguage = $osC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
}
$Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
$Qlanguage->bindValue(':name', $language['name']);
$Qlanguage->bindValue(':code', $language['code']);
$Qlanguage->bindValue(':locale', $language['locale']);
$Qlanguage->bindValue(':charset', $language['charset']);
$Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
$Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
$Qlanguage->bindValue(':time_format', $language['time_format']);
$Qlanguage->bindValue(':text_direction', $language['text_direction']);
$Qlanguage->bindInt(':currencies_id', $osC_Currencies->getID($language['currency']));
$Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
$Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
$Qlanguage->bindInt(':parent_id', $language['parent_id']);
$Qlanguage->setLogging($_SESSION['module'], $Qcheck->numberOfRows() === 1 ? $language_id : null);
$Qlanguage->execute();
if ($osC_Database->isError()) {
$error = true;
} else {
if ($Qcheck->numberOfRows() !== 1) {
$language_id = $osC_Database->nextID();
}
$default_language_id = osC_Language_Admin::getData(osC_Language_Admin::getID(DEFAULT_LANGUAGE), 'languages_id');
if ($type == 'replace') {
$Qdel = $osC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
$Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qdel->bindInt(':languages_id', $language_id);
$Qdel->execute();
if ($osC_Database->isError()) {
$error = true;
}
}
}
if ($error === false) {
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/' . $file);
$osC_DirectoryListing->setRecursive(true);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setAddDirectoryToFilename(true);
$osC_DirectoryListing->setCheckExtension('xml');
foreach ($osC_DirectoryListing->getFiles() as $files) {
$definitions = array_merge($definitions, osC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
}
foreach ($definitions as $def) {
$insert = false;
$update = false;
if ($type == 'replace') {
$insert = true;
} else {
$Qcheck = $osC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
$Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qcheck->bindValue(':definition_key', $def['key']);
$Qcheck->bindInt(':languages_id', $language_id);
$Qcheck->bindValue(':content_group', $def['group']);
$Qcheck->execute();
if ($Qcheck->numberOfRows() > 0) {
//.........这里部分代码省略.........
示例2: array
$d_boxes->setExcludeEntries('.svn');
foreach ($d_boxes->getFiles(false) as $box) {
if ($box['is_directory'] === true) {
$entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
} else {
$page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
$entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
}
if ($_GET['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) {
$entry['group'] = '-- ' . $_GET['filter'] . ' --';
}
$pages_array[] = $entry;
}
if ($_GET['filter'] != DEFAULT_TEMPLATE) {
$d_boxes = new osC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content');
$d_boxes->setRecursive(true);
$d_boxes->setAddDirectoryToFilename(true);
$d_boxes->setCheckExtension('php');
$d_boxes->setExcludeEntries('.svn');
foreach ($d_boxes->getFiles(false) as $box) {
if ($box['is_directory'] === true) {
$entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
} else {
$page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
$entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
}
$check_entry = $entry;
$check_entry['group'] = '-- ' . $_GET['filter'] . ' --';
if (!in_array($check_entry, $pages_array)) {
$entry['group'] = '-- ' . DEFAULT_TEMPLATE . ' --';
$pages_array[] = $entry;
示例3: foreach
$sql_file = $dir_fs_www_root . '/tomatocart_sample_data.sql';
$osC_Database->importSQL($sql_file, $db['DB_DATABASE'], $db['DB_TABLE_PREFIX']);
}
if ($osC_Database->isError() === false) {
//english
foreach ($osC_Language->extractDefinitions('fa_IR.xml') as $def) {
$Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
$Qdef->bindTable(':table_languages_definitions', $db['DB_TABLE_PREFIX'] . 'languages_definitions');
$Qdef->bindInt(':languages_id', 1);
$Qdef->bindValue(':content_group', $def['group']);
$Qdef->bindValue(':definition_key', $def['key']);
$Qdef->bindValue(':definition_value', $def['value']);
$Qdef->execute();
}
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/fa_IR');
$osC_DirectoryListing->setRecursive(true);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setAddDirectoryToFilename(true);
$osC_DirectoryListing->setCheckExtension('xml');
foreach ($osC_DirectoryListing->getFiles() as $files) {
foreach ($osC_Language->extractDefinitions('fa_IR/' . $files['name']) as $def) {
$Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
$Qdef->bindTable(':table_languages_definitions', $db['DB_TABLE_PREFIX'] . 'languages_definitions');
$Qdef->bindInt(':languages_id', 1);
$Qdef->bindValue(':content_group', $def['group']);
$Qdef->bindValue(':definition_key', $def['key']);
$Qdef->bindValue(':definition_value', $def['value']);
$Qdef->execute();
}
}
}
示例4: getPages
function getPages()
{
global $toC_Json, $osC_Database, $osC_Language;
$Qtemplate = $osC_Database->query('select code from :table_templates where id = :id');
$Qtemplate->bindTable(':table_templates', TABLE_TEMPLATES);
$Qtemplate->bindValue(':id', $_REQUEST['filter']);
$Qtemplate->execute();
$filter_id = $_REQUEST['filter'];
$_REQUEST['filter'] = $Qtemplate->Value('code');
$pages_array = array(array('id' => $filter_id . '/*', 'text' => '*'));
$d_boxes = new osC_DirectoryListing('../templates/' . $_REQUEST['filter'] . '/content');
$d_boxes->setRecursive(true);
$d_boxes->setAddDirectoryToFilename(true);
$d_boxes->setCheckExtension('php');
$d_boxes->setExcludeEntries('.svn');
foreach ($d_boxes->getFiles(false) as $box) {
if ($box['is_directory'] === true) {
$entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
} else {
$page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
$entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
}
if ($_REQUEST['filter'] != DEFAULT_TEMPLATE && $d_boxes->getSize() > 0) {
$entry['group'] = '-- ' . $_REQUEST['filter'] . ' --';
}
$pages_array[] = $entry;
}
if ($_REQUEST['filter'] != DEFAULT_TEMPLATE) {
$d_boxes = new osC_DirectoryListing('../templates/' . DEFAULT_TEMPLATE . '/content');
$d_boxes->setRecursive(true);
$d_boxes->setAddDirectoryToFilename(true);
$d_boxes->setCheckExtension('php');
$d_boxes->setExcludeEntries('.svn');
foreach ($d_boxes->getFiles(false) as $box) {
if ($box['is_directory'] === true) {
$entry = array('id' => $filter_id . '/' . $box['name'] . '/*', 'text' => $box['name'] . '/*');
} else {
$page_filename = substr($box['name'], 0, strrpos($box['name'], '.'));
$entry = array('id' => $filter_id . '/' . $page_filename, 'text' => $page_filename);
}
$check_entry = $entry;
$check_entry['group'] = '-- ' . $_REQUEST['filter'] . ' --';
if (!in_array($check_entry, $pages_array)) {
$entry['group'] = '-- ' . DEFAULT_TEMPLATE . ' --';
$pages_array[] = $entry;
}
}
}
$response = array(EXT_JSON_READER_ROOT => $pages_array);
echo $toC_Json->encode($response);
}
示例5: import
public static function import($file, $type)
{
global $osC_Database;
if (file_exists('../includes/languages/' . $file . '.xml')) {
$osC_XML = new osC_XML(file_get_contents('../includes/languages/' . $file . '.xml'));
$source = $osC_XML->toArray();
$language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => isset($source['language']['data']['parent_language_code']) ? $source['language']['data']['parent_language_code'] : '', 'parent_id' => 0);
if (osC_Currencies_Admin::exists($language['currency']) === false) {
$language['currency'] = DEFAULT_CURRENCY;
}
if (!empty($language['parent_language_code']) && self::exists($language['parent_language_code'])) {
$language['parent_id'] = self::get($language['parent_language_code'], 'languages_id');
}
$definitions = array();
if (isset($source['language']['definitions']['definition'])) {
$definitions = $source['language']['definitions']['definition'];
if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
$definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
}
}
unset($source);
$error = false;
$add_category_and_product_placeholders = true;
$osC_Database->startTransaction();
$language_id = self::get($language['code'], 'languages_id');
if ($language_id !== false) {
$add_category_and_product_placeholders = false;
$Qlanguage = $osC_Database->query('update :table_languages set name = :name, code = :code, locale = :locale, charset = :charset, date_format_short = :date_format_short, date_format_long = :date_format_long, time_format = :time_format, text_direction = :text_direction, currencies_id = :currencies_id, numeric_separator_decimal = :numeric_separator_decimal, numeric_separator_thousands = :numeric_separator_thousands, parent_id = :parent_id where languages_id = :languages_id');
$Qlanguage->bindInt(':languages_id', $language_id);
} else {
$Qlanguage = $osC_Database->query('insert into :table_languages (name, code, locale, charset, date_format_short, date_format_long, time_format, text_direction, currencies_id, numeric_separator_decimal, numeric_separator_thousands, parent_id) values (:name, :code, :locale, :charset, :date_format_short, :date_format_long, :time_format, :text_direction, :currencies_id, :numeric_separator_decimal, :numeric_separator_thousands, :parent_id)');
}
$Qlanguage->bindTable(':table_languages', TABLE_LANGUAGES);
$Qlanguage->bindValue(':name', $language['name']);
$Qlanguage->bindValue(':code', $language['code']);
$Qlanguage->bindValue(':locale', $language['locale']);
$Qlanguage->bindValue(':charset', $language['charset']);
$Qlanguage->bindValue(':date_format_short', $language['date_format_short']);
$Qlanguage->bindValue(':date_format_long', $language['date_format_long']);
$Qlanguage->bindValue(':time_format', $language['time_format']);
$Qlanguage->bindValue(':text_direction', $language['text_direction']);
$Qlanguage->bindInt(':currencies_id', osC_Currencies_Admin::get($language['currency'], 'currencies_id'));
$Qlanguage->bindValue(':numeric_separator_decimal', $language['numeric_separator_decimal']);
$Qlanguage->bindValue(':numeric_separator_thousands', $language['numeric_separator_thousands']);
$Qlanguage->bindInt(':parent_id', $language['parent_id']);
$Qlanguage->setLogging($_SESSION['module'], $language_id !== false ? $language_id : null);
$Qlanguage->execute();
if ($osC_Database->isError()) {
$error = true;
} else {
if ($language_id === false) {
$language_id = $osC_Database->nextID();
}
$default_language_id = osC_Languages_Admin::get(DEFAULT_LANGUAGE, 'languages_id');
if ($type == 'replace') {
$Qdel = $osC_Database->query('delete from :table_languages_definitions where languages_id = :languages_id');
$Qdel->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qdel->bindInt(':languages_id', $language_id);
$Qdel->execute();
if ($osC_Database->isError()) {
$error = true;
}
}
}
if ($error === false) {
$osC_DirectoryListing = new osC_DirectoryListing('../includes/languages/' . $file);
$osC_DirectoryListing->setRecursive(true);
$osC_DirectoryListing->setIncludeDirectories(false);
$osC_DirectoryListing->setAddDirectoryToFilename(true);
$osC_DirectoryListing->setCheckExtension('xml');
foreach ($osC_DirectoryListing->getFiles() as $files) {
$definitions = array_merge($definitions, osC_Language_Admin::extractDefinitions($file . '/' . $files['name']));
}
foreach ($definitions as $def) {
$insert = false;
$update = false;
if ($type == 'replace') {
$insert = true;
} else {
$Qcheck = $osC_Database->query('select definition_key, content_group from :table_languages_definitions where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
$Qcheck->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
$Qcheck->bindValue(':definition_key', $def['key']);
$Qcheck->bindInt(':languages_id', $language_id);
$Qcheck->bindValue(':content_group', $def['group']);
$Qcheck->execute();
if ($Qcheck->numberOfRows() > 0) {
if ($type == 'update') {
$update = true;
}
} elseif ($type == 'add') {
$insert = true;
}
}
if ($insert === true || $update === true) {
if ($insert === true) {
$Qdef = $osC_Database->query('insert into :table_languages_definitions (languages_id, content_group, definition_key, definition_value) values (:languages_id, :content_group, :definition_key, :definition_value)');
} else {
$Qdef = $osC_Database->query('update :table_languages_definitions set content_group = :content_group, definition_key = :definition_key, definition_value = :definition_value where definition_key = :definition_key and languages_id = :languages_id and content_group = :content_group');
$Qdef->bindValue(':definition_key', $def['key']);
$Qdef->bindValue(':content_group', $def['group']);
//.........这里部分代码省略.........
示例6: array
while ($Qtc->next()) {
$tax_class_array[] = array('id' => $Qtc->valueInt('tax_class_id'), 'text' => $Qtc->value('tax_class_title'));
}
$Qwc = $osC_Database->query('select weight_class_id, weight_class_title from :table_weight_class where language_id = :language_id order by weight_class_title');
$Qwc->bindTable(':table_weight_class', TABLE_WEIGHT_CLASS);
$Qwc->bindInt(':language_id', $osC_Language->getID());
$Qwc->execute();
$weight_class_array = array();
while ($Qwc->next()) {
$weight_class_array[] = array('id' => $Qwc->valueInt('weight_class_id'), 'text' => $Qwc->value('weight_class_title'));
}
require 'includes/classes/directory_listing.php';
$osC_Dir_Images = new osC_DirectoryListing('../images');
$osC_Dir_Images->setExcludeEntries('CVS');
$osC_Dir_Images->setIncludeFiles(false);
$osC_Dir_Images->setRecursive(true);
$osC_Dir_Images->setAddDirectoryToFilename(true);
$files = $osC_Dir_Images->getFiles();
$image_directories = array(array('id' => '', 'text' => 'images/'));
foreach ($files as $file) {
$image_directories[] = array('id' => $file['name'], 'text' => 'images/' . $file['name']);
}
?>
<script type="text/javascript" src="external/FCKeditor/2.0b1/fckeditor.js"></script>
<style type="text/css">@import url('external/jscalendar/calendar-win2k-1.css');</style>
<script type="text/javascript" src="external/jscalendar/calendar.js"></script>
<script type="text/javascript" src="external/jscalendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="external/jscalendar/calendar-setup.js"></script>
<style type="text/css">