public function tagsValidator($data, Row_WsServiceSet $template) { $file = $this->getReceivedFiles(); foreach ($file as $f) { if (is_file($f) === false) { throw new Logic_Exception("Temporary files does not exists!"); } if ($fp = fopen($f, 'r')) { $delimiter = intval($template->delimiter) == Logic_Ws_ServiceSet_ServiceSet::DELIMITER_SEMICOLN ? ';' : ','; $tags = fgetcsv($fp, filesize($f), $delimiter); unset($tags[0]); $validator = new Logic_Validate_TemplateCompare($tags, '/{([\\w\\s\\-ęóąśłżźńŚŁŻŹĆ])*}/'); $validator->isValid($template->message); } return $validator->getMessages(); } }
public function tagsValidator($data) { $file = $this->getReceivedFiles(); foreach ($file as $f) { if (is_file($f) === false) { throw new Logic_Exception("Temporary files does not exists!"); } if ($fp = fopen($f, 'r')) { $serviceSetModel = new WsServiceSet(); $template = $serviceSetModel->getSet($data['ws_service_set_id']); $delimiter = intval($data['delimeter']) == 1 ? ',' : ';'; $tags = fgetcsv($fp, filesize($f), $delimiter); $key = array_search($data['phone_heders'], $tags); if ($key != false) { if (key_exists($key, $tags)) { unset($tags[$key]); } } $validator = new Logic_Validate_TemplateCompare($tags, '/<([\\w\\s\\-ęóąśłżźńŚŁŻŹĆ])*>/'); $validator->isValid($template->message); } return $validator->getMessages(); } }