format('U') + $dto->getOffset(); $text = date_i18n($format,$timestamp); return $text; } function amru_new_DateTime_nonfatal ($datetimestring='', $tzobj) { // date time create with exception trap to avoid fatal errors try { $dt = new DateTime($datetimestring); $dt->setTimezone($tzobj); } catch(Exception $e) { echo '
'.__('Fatal error caught','amr-users').' '. sprintf(__('Unable to create DateTime object from %s ','amr-users'),$datetimestring).'
'; return (false); } return ($dt); } function amru_newDateTime($text='') { // create new datetime object with the global timezone // because wordpress insists that the php default must stay as UTC global $tzobj; if (empty($tzobj)) $tzobj = amr_getset_timezone (); $d = amru_new_DateTime_nonfatal($text,$tzobj); // traps exceptions return ($d); } function amru_get_func_name ($fld, $format) { global $amr_users_field_types; if (empty($amr_users_field_types)) // to get the type of field $amr_users_field_types = ausers_get_option('amr-users-field-types'); if (empty($amr_users_field_types[$fld])) return false; // no defined fieldtype else $type = $amr_users_field_types[$fld]; $func = 'ausers_format_'.$type.'_'.$format; return $func; } function amr_is_assoc($array) { return (bool)count(array_filter(array_keys($array), 'is_string')); } function amr_debug() { if (WP_DEBUG and is_user_logged_in()) { return true; } else return false; } function amr_debug_no_such_list () { // called when the list searched for is not found in db option. global $aopt, $amain; if (empty($aopt)) { echo '