Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Lib.Util.php File Reference

Go to the source code of this file.

Namespaces

 FDL
 

Functions

 newFreeVaultFile ($dbaccess)
 
 getGen ($dbaccess)
 
 toIso8601 ($fdate, $wtz=false)
 
 StringDateToJD ($sdate)
 
 FrenchDateToJD ($fdate)
 
 FrenchDateToUnixTs ($fdate, $utc=false)
 
 stringDateToLocaleDate ($fdate, $format= '')
 
 FrenchDateToLocaleDate ($fdate, $format= '')
 
 FrenchDateToIso ($fdate, $withT=true)
 
 iso8601DateToUnixTs ($isodate, $utc=false)
 
 stringDateToUnixTs ($isodate, $utc=false)
 
 isValidDate ($date)
 
 stringDateToIso ($date, $format=false, $withT=false)
 
 Iso8601ToJD ($isodate)
 
 cal2jd ($era, $y, $m, $d, $h, $mn, $s)
 
 jdWeekDay ($jd)
 
 jdWeekNumber ($jd)
 
 jd2cal ($jd, $dformat= '')
 
 addJsSlashes ($s)
 
 unaccent_ ($text)
 
 unaccent_iso8859_1 ($string)
 
 unaccent_utf8 ($string)
 
 unaccent ($s)
 
 sep_replace ($ak, $idx, $by="-", $sep="\n")
 
 xml_entity_encode ($s)
 
 xml_entity_encode_all ($s)
 
 cleanhtmljs ($html)
 

Function Documentation

addJsSlashes (   $s)

backslash quote and replace double-quote by html entity

Definition at line 499 of file Lib.Util.php.

cal2jd (   $era,
  $y,
  $m,
  $d,
  $h,
  $mn,
  $s 
)

Definition at line 326 of file Lib.Util.php.

cleanhtmljs (   $html)

Remove JS and other insecure elements from HTML.

Parameters
string$html
Returns
string

Definition at line 624 of file Lib.Util.php.

FrenchDateToIso (   $fdate,
  $withT = true 
)

convert French date DD/MM/YYYY to iso date must be > 01/01/1970 and < 2038

Parameters
string$fdateDD/MM/YYYY HH:MM
boolean$withTreturn YYYY-MM-DDTHH:MM:SS else YYYY-MM-DD HH:MM:SS
Returns
string YYYY-MM-DD HH:MM:SS

Definition at line 180 of file Lib.Util.php.

FrenchDateToJD (   $fdate)

convert French date to Julian day the seconds are ignored

Parameters
string$fdateDD/MM/YYYY HH:MM
Returns
float julian day (return false if incorrect date)

Definition at line 65 of file Lib.Util.php.

+ Here is the call graph for this function:

FrenchDateToLocaleDate (   $fdate,
  $format = '' 
)
Parameters
string$fdate
Returns
string

Definition at line 125 of file Lib.Util.php.

+ Here is the call graph for this function:

FrenchDateToUnixTs (   $fdate,
  $utc = false 
)

convert French date to unix timestamp date must be > 01/01/1970 and < 2038

Parameters
string$fdateDD/MM/YYYY HH:MM
Returns
float number of second since epoch (return -1 if incorrect date)

Definition at line 84 of file Lib.Util.php.

getGen (   $dbaccess)

for FDLGEN directory

Parameters
$dbaccess
Returns
string

Definition at line 27 of file Lib.Util.php.

iso8601DateToUnixTs (   $isodate,
  $utc = false 
)

convert iso date to unix timestamp date must be > 1970-01-01 and < 2038

Parameters
string$isodateYYYY-MM-DD HH:MM
Returns
float number of second since epoch (return -1 if incorrect date)

Definition at line 198 of file Lib.Util.php.

Iso8601ToJD (   $isodate)

convert iso8601 date to Julian day the seconds are ignored

Parameters
string$isodateYYYY-MM-DD HH:MM
Returns
float julian day (return false if incorrect date)

Definition at line 316 of file Lib.Util.php.

+ Here is the call graph for this function:

isValidDate (   $date)

verify if a date seems valid

Parameters
string$dateiso, french english date
Returns
bool true if it ia a valid date

Definition at line 228 of file Lib.Util.php.

+ Here is the call graph for this function:

jd2cal (   $jd,
  $dformat = '' 
)

return date in string format

Parameters
float$jdjulian date
string$dformatthe format (default iso8601)
Returns
string the formatted date

Definition at line 407 of file Lib.Util.php.

jdWeekDay (   $jd)

return the day of the week (1 id Monday, 7 is Sunday)

Parameters
float$jdjulian date
Returns
int

Definition at line 380 of file Lib.Util.php.

jdWeekNumber (   $jd)

return the number of the week in year

Parameters
float$jdjulian date
Returns
int between 1 and 53

Definition at line 392 of file Lib.Util.php.

newFreeVaultFile (   $dbaccess)

Definition at line 17 of file Lib.Util.php.

sep_replace (   $ak,
  $idx,
  $by = "-",
  $sep = "\n" 
)

replace a string separate by $sep

Definition at line 576 of file Lib.Util.php.

stringDateToIso (   $date,
  $format = false,
  $withT = false 
)

convert string date to iso

Note
if the $date input is not recognised like a date the function return the original $date argument
Parameters
string$dateDD/MM/YYYY HH:MM or YYYY-MM-DD HH:MM or YYYY-MM-DDTHH:MM
bool|stringoptionnal input $format to indicate locale : french default is "%d/%m/%Y %H:%M". If not set use locale configuration of server
bool$withTto add a T between day and hour: YYYY-MM-DDTHH:MM
Returns
string YYYY-MM-DD HH:MM

Definition at line 246 of file Lib.Util.php.

+ Here is the call graph for this function:

StringDateToJD (   $sdate)

Definition at line 53 of file Lib.Util.php.

+ Here is the call graph for this function:

stringDateToLocaleDate (   $fdate,
  $format = '' 
)

Definition at line 98 of file Lib.Util.php.

+ Here is the call graph for this function:

stringDateToUnixTs (   $isodate,
  $utc = false 
)

convert date to unix timestamp date must be > 1970-01-01 and < 2038

Parameters
string$isodateYYYY-MM-DD HH:MM
Returns
float number of second since epoch (return -1 if incorrect date)

Definition at line 217 of file Lib.Util.php.

+ Here is the call graph for this function:

toIso8601 (   $fdate,
  $wtz = false 
)

convert French date to iso8601

Parameters
string$fdateDD/MM/YYYY HH:MM:SS (CET)
string$wtzwith timezone add time zone in the end if true
Returns
string date YYYY-MM-DD HH:MM:SS
Deprecated:
use stringDateToIso() instead

Definition at line 38 of file Lib.Util.php.

+ Here is the call graph for this function:

unaccent (   $s)

Definition at line 569 of file Lib.Util.php.

+ Here is the call graph for this function:

unaccent_ (   $text)

Remove Character Accents Replaces accented characters in a string with their unaccented versions, for instance, converts "ÉéÜüÄäÖ" into "EeUuAaO". The function will handle any accented character for which there exists an HTML entity in PHP's translation table (i.e. pretty much any and all characters). Credits go to jennings at trad dot uji dot es for the original version of this incredibly useful little function. I used this function to good effect in OpenSEF.

Definition at line 513 of file Lib.Util.php.

unaccent_iso8859_1 (   $string)

Definition at line 535 of file Lib.Util.php.

unaccent_utf8 (   $string)

Definition at line 564 of file Lib.Util.php.

xml_entity_encode (   $s)

change & < and > character to respetiv entity

Parameters
string$sstring to encode
Returns
string encoded string

Definition at line 596 of file Lib.Util.php.

xml_entity_encode_all (   $s)

Definition at line 608 of file Lib.Util.php.

+ Here is the call graph for this function:

← centre documentaire © anakeen