// If file has been updated, update the element and sync if ($file['mod_time'] > $element_sync->get_element_mod_time($type, $file['name'])) { $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']); } } } } } // Process the elements for this element type foreach ($modx->getCollection($type) as $element_object) { $element = Element::insert($element_object); $name = $element->get_property('name'); $category_id = $element->get_property('category'); $file_path = $element_helper->build_element_file_path($type, $type_path, $name, $category_id); // Check if the element is blacklisted if (in_array($name, $element_blacklist)) { continue; } // Check if the element has a category and is whitelisted if ($category_id !== 0) { $category = Element::get($modx, 'modCategory', $category_id); if (!in_array($category->get_property('name'), $category_whitelist)) { continue; } } // If a file with this element name doesn't exist if (!file_exists($file_path)) { // If the element is not in the sync if (!$element_sync->has_element($type, $name)) {