public static function validateString($field, $value, $error) { ProfileNdx_indexer_shared::sendToDbNdx(XenForo_Application::get('db'), 'preprocessedStatistic', array()); $data = $value->getNewData()['xf_option']['option_value']; if ($data == '') { return true; } $xfopt = explode(',', $data); $xfo = array(); foreach ($xfopt as $k => $v) { $xfo[$k] = trim($v); } $var = $xfo; unset($k); unset($v); unset($xfo); unset($xfopt); $valids = ProfileNdx_indexer_shared::getCustomUserFieldsArray(); $error = 'Failed when tried asserting the existance of these fields:'; $errors = array(); foreach ($var as $test) { if (!array_key_exists($test, $valids)) { $errors[] = ' <u><b>' . $test . '</b></u>,'; } } foreach ($errors as $e) { $error .= $e; } $error = rtrim($error, ","); if (count($errors) > 0) { throw new XenForo_Exception($error, true); } else { return true; } }