[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/inc/ -> lib.utils.php (sommaire)

This file contains several utility classes. These classes have only static methods.

Poids: 566 lignes (16 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 3 classes

date:: (10 méthodes):
  stamp()
  round()
  day()
  month()
  year()
  unix()
  explode()
  clean()
  EOT()
  isEOT()

www:: (6 méthodes):
  getRequestUri()
  getRelativeUrl()
  getCurrentFullUrl()
  getCurrentHostUrl()
  getManagedWebsiteUrl()
  getDocumentRoot()

Misc:: (15 méthodes):
  getRandomString()
  latin1_utf8()
  isGhostCat()
  strlenCompare()
  isFileSafe()
  prettySize()
  isImage()
  getFileExtension()
  removeFileExtension()
  getParentDir()
  cleanDirname()
  if_utf8()
  showDebugInfo()
  magicStrip()
  handleMagicQuotes()


Classe: date  - X-Ref

Date and time utilities.

A timestamp has the format YYYYMMDDHHMMSS. This is a "MYSQL" timestamp.
stamp($day=0, $month=0, $year=0, $time='')   X-Ref
Create a timestamp with an offset with respect to time or today.

param: int Day offset (0)
param: int Month offset (0)
param: int Year offset (0)
param: int Time (now)
return: int Timestamp

round($time, $f='m')   X-Ref
Round a timestamp to the day, month or year.

For example:
20031202123212 => 20030101000000, 20031201000000, 20031203000000

param: int Timestamp
param: string Level of rouding 'd', ('m') or 'y'            
return: int Timestamp

day($offset=0)   X-Ref
Get a timestamp rounded to the current day.

param: int Day offset (0)
return: int Timestamp

month($offset=0)   X-Ref
Get a timestamp rounded to the current month.

param: int Month offset (0)
return: int Timestamp

year($offset=0)   X-Ref
Get a timestamp rounded to the current year.

param: int Year offset (0)
return: int Timestamp

unix($string=false)   X-Ref
Convert a timestamp to unix time.
If the timestamp is invalid, return current time.
If no timestamp given, return current time. Always use this
method instead of time() to be able to set some time shift
if needed (Server US time, but "application" time at GMT)

param: int mysql timestamp or (false)
return: int unix time    

explode($string)   X-Ref
Convert a string with the format
yyyymmddhhmmss or yyyy-mm-dd hh:mm:ss
into a list that can be passed to mktime

param: string Timestamp or date
return: mixed Array, false if not a good timestamp format.

clean($inputdate)   X-Ref
Check the validity of a date, if not valid try to force it
to be valid. The date can be given as an array
from year to seconds, or as a single string. If a array
is given, an array is sent back else a MySQL timestamp.
The single string format must be able to be parsed by
the date::explode() method.

param: string Date time or array(h,m,s,M,D,Y)
return: string MySQL timestamp or array

EOT()   X-Ref
Return a date far in the future considered as
the End Of Time for the application.

return: string '99991231235959'

isEOT($date)   X-Ref
Returns true if the string is the end of time

param: string String date
return: bool True if at end of time

Classe: www  - X-Ref

Utilities for domains, urls.

getRequestUri()   X-Ref
Get the current resource url.


getRelativeUrl()   X-Ref
Get the relative url of the website as
automatically as possible.
This is used in the installer.

return: string Relative URL without trailing slash

getCurrentFullUrl()   X-Ref
get the current full url for redirection (with / at the end)

return: string Full URL with trailing /

getCurrentHostUrl()   X-Ref
get the current host url no / at the end

return: string Host URL without trailing /

getManagedWebsiteUrl()   X-Ref
Get current managed website base url.

The url will be a full url or an empty string depending of the
context.

getDocumentRoot()   X-Ref
Get the document root of a website.
If the configuration array of the website is not given,
it will find the information in the global configuration.

return: string Document root.

Classe: Misc  - X-Ref

getRandomString($len=35)   X-Ref
Produces a random string.

param: int Length of the random string to be generated.
return: string Random string

latin1_utf8($str)   X-Ref
Convert a string from latin1 to utf8

param: string Latin 1 string
return: string utf-8 string

isGhostCat($path)   X-Ref
Inform if the category is an hidden category or not.

param: string Category path
return: bool Success

strlenCompare($a, $b)   X-Ref
Pas de description

isFileSafe($file_name, $file_data ='')   X-Ref
Give is a file is safe or not

param: string file name
param: string Path to the data ('')
return: bool Success

prettySize($size)   X-Ref
Pas de description

isImage($file_name)   X-Ref
Pas de description

getFileExtension($file_name)   X-Ref
Pas de description

removeFileExtension($file_name)   X-Ref
Pas de description

getParentDir($current_dir)   X-Ref
Pas de description

cleanDirname($dir)   X-Ref
Pas de description

if_utf8($string)   X-Ref
Pas de description

showDebugInfo()   X-Ref
Pas de description

magicStrip(&$k, $key)   X-Ref
Pas de description

handleMagicQuotes(&$value)   X-Ref
Pas de description



Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics