本文整理汇总了PHP中ElementHelper::get_file_element_properties方法的典型用法代码示例。如果您正苦于以下问题:PHP ElementHelper::get_file_element_properties方法的具体用法?PHP ElementHelper::get_file_element_properties怎么用?PHP ElementHelper::get_file_element_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElementHelper
的用法示例。
在下文中一共展示了ElementHelper::get_file_element_properties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$modx->log(MODX_LOG_LEVEL_INFO, $log_prefix . 'No files.');
continue;
}
// Process the files for this element type
foreach ($file_list as $file_path) {
$file = FileHelper::get_file_meta($file_path);
$element = Element::get($modx, $type, $file['name']);
// If the file is not in the sync
if (!$element_sync->has_element($type, $file['name'])) {
// If the element doesn't exist
if (!$element) {
// Create the element
$element = Element::create($modx, $type, $file['name']);
// If the element is created successfully set it's properties and then add it to the sync
if ($element) {
$properties = $element_helper->get_file_element_properties($type_path, $file_path);
if ($element->set_properties($properties)) {
$element_sync->add_element($type, $file['name'], $file['mod_time']);
}
}
} else {
$modx->log(MODX_LOG_LEVEL_INFO, $log_prefix . 'An element with the name [' . $file['name'] . '] already exists. Unable to sync the file and element.');
}
} else {
// If the element doesn't exist
if (!$element) {
// Delete the file and remove it from the sync if successful
if (unlink($file_path)) {
$element_sync->remove_element($type, $file['name']);
}
} else {