From c8766ec967255af09c88f2b212c0c870ea7954b5 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 30 Jun 2010 15:24:38 -0300 Subject: Adding IsisConnector::filterBrackets() --- classes/IsisConnector.php | 26 +++++++++++++++++++++----- schemas/fbe.yaml | 8 +++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php index db5ac9d..eeedeb7 100644 --- a/classes/IsisConnector.php +++ b/classes/IsisConnector.php @@ -282,12 +282,26 @@ class IsisConnector { */ public function explodeBrackets($subject) { preg_match_all('/<[^<>]*>/', $subject, $values); + return $this->filterBrackets($values[0]); + } - // Why this doesn't work? - //$values = preg_replace(array('//'), '', $values); - - foreach ($values[0] as $key => $value) { - $values[$key] = preg_replace(array('//'), '', $value); + /** + * Filter out brackets from strings. + * + * @param $values + * String (or array filled with strings) to be filtered. + * + * @result + * Filtered string or array. + */ + public function filterBrackets($values) { + if (is_array($values)) { + foreach ($values as $key => $value) { + $values[$key] = $this->filterBrackets($value); + } + } + else { + $values = preg_replace(array('//'), '', $values); } return $values; @@ -298,6 +312,7 @@ class IsisConnector { * * @param $value * String to be compared. + * * @return * True if string has brackets, false otherwise. */ @@ -316,6 +331,7 @@ class IsisConnector { * * @param $value * String with values. + * * @return * Array with values. */ diff --git a/schemas/fbe.yaml b/schemas/fbe.yaml index 1c74e40..c05bd01 100644 --- a/schemas/fbe.yaml +++ b/schemas/fbe.yaml @@ -93,10 +93,7 @@ fields: name: Sinopse/Enredo repeat: Yes map: - # TODO: use relation instead of value type / repeat - #type: Plot - type: values - field: plot + type: Plot 26: name: Assuntos/Voc. Controlado repeat: Yes @@ -141,7 +138,7 @@ fields: f: diálogos g: adaptado por h: autoria do texto de locução / redator - i: baseada # baseada (Inspirada) em, na, no, / romance; obra, peça + i: baseada # baseada (Inspirada) em, na, no, / romance; obra, peça # TODO: not a performer field j: diálogos adicionais k: supervisão de roteiro l: enquadração (nomenclatura de época) @@ -437,6 +434,7 @@ fields: i: conjuntos/bandas j: componentes map: + # TODO: type: Music type: Performers 83: name: Canção -- cgit v1.2.3