/** * Check export mapping for format-specific errors * @param string $ps_exporter_code code identifying the exporter * @return array Array of errors. Array has size 0 if no errors occurred. */ public static function checkMapping($ps_exporter_code) { if (isset(ca_data_exporters::$s_mapping_check_cache[$ps_exporter_code]) && is_array(ca_data_exporters::$s_mapping_check_cache[$ps_exporter_code])) { return ca_data_exporters::$s_mapping_check_cache[$ps_exporter_code]; } else { $t_mapping = new ca_data_exporters(); if (!$t_mapping->load(array('exporter_code' => $ps_exporter_code))) { return array(_t("Invalid mapping code")); } // TODO: maybe auto-load those classes? switch ($t_mapping->getSetting('exporter_format')) { case 'XML': $o_export = new ExportXML(); break; case 'MARC': $o_export = new ExportMARC(); break; case 'CSV': $o_export = new ExportCSV(); break; case 'ExifTool': $o_export = new ExportExifTool(); break; default: return array(_t("Invalid exporter format")); } return ca_data_exporters::$s_mapping_check_cache[$ps_exporter_code] = $o_export->getMappingErrors($t_mapping); } }