/** * Determines if a string matches a known format. Meant for established intended purpose of a value. * 1. url * 2. image * 3. number * 4. text * 5. money * 6. decimal * 7. email * @returns unknown if could not establish types */ public function type($value) { if (CSV2POST::is_image_url($value)) { return 'image'; } // so its not an image url, is it any type of url? either for using as link or PHP functionality if (CSV2POST::is_url($value)) { return 'url'; } // check if decimal before checking if a plain number or money if (CSV2POST::is_decimalnumber($value)) { return 'decimal'; } // is money value if (CSV2POST::is_string_money($value)) { return 'money'; } // is not money, is it even a number? if (is_numeric($value)) { return 'numeric'; } // is email address if (CSV2POST::is_valid_emailaddress($value)) { return 'email'; } // it must be text but we will do the check anyway if (is_string($value)) { return 'text'; } return 'unknown'; # should never happen }