= 11 && ($number%100) <= 13){ $ordinal = $number. 'th'; } else { $ordinal = $number. $ends[$number % 10]; } return $ordinal; } function add_csrf_token($data){ $CI =& get_instance(); return array_merge($data, array('csrf' => array( 'name' => $CI->security->get_csrf_token_name(), 'hash' => $CI->security->get_csrf_hash()) ) ); } function hash_password($password_string) { $options = array( 'cost' => 12, ); return password_hash($password_string, PASSWORD_BCRYPT, $options); } /** * Given a file, i.e. /css/base.css, replaces it with a string containing the * file's mtime, i.e. /css/base.1221534296.css. * * @param string $file The file to be loaded. Must be an absolute path (i.e. * starts with slash). * @return string */ function auto_version($file) { $file = str_replace('http://', '', $file); $file = str_replace('https://', '', $file); $file = str_replace($_SERVER['SERVER_NAME'], '', $file); $full_file = $_SERVER['DOCUMENT_ROOT'] . $file; if (strpos($file, '/') !== 0 || !file_exists($full_file)) { $full_file = substr($_SERVER['SCRIPT_FILENAME'], 0, -strlen($_SERVER['SCRIPT_NAME'])); $full_file .= $file; if (!file_exists($full_file)) { return $file."?v=".strtotime('now'); } } $mtime = filemtime($full_file); $new_file = $file."?v=".$mtime; return $new_file; } ?>