OPiQuotations  v.03.00.00 — April 5, 2019
Classes | Functions | Variables
OPiQuotations Namespace Reference

Classes

class  Db
 
class  OPiQuotation
 Class quotation (text, author…) or maxim (text, nation…). More...
 
class  OPiQuotations
 Class to get OPiQuotation and informations from the databse. More...
 
class  Selection
 Class selection. More...
 

Functions

 error_handler ($errno, $errstr, $errfile, $errline, $errcontext)
 Error handler function. More...
 
 hide_password ($s)
 If $s contains an element '[password] => ...' then hides the password value. More...
 
 to_log ($message)
 Append $message in LOG_FILE. More...
 
 html_text_cut ($html_text, $max_length, $hellip='…', $reduce=true)
 If length of $html_text <= $max_length characters then return $html_text, else return $html_text cutted added of $hellip to not be longer than $max_length characters. More...
 
 text_cut ($text, $max_length, $hellip='…', $reduce=true)
 If length of $text <= $max_length characters then return $text, else return $text cutted added of $hellip to be length of $max_length characters. More...
 

Variables

return true
 
const LOG_FILE = 'logs/log.txt'
 Filename of errors log file. More...
 
return TRUE
 

Function Documentation

◆ error_handler()

OPiQuotations\error_handler (   $errno,
  $errstr,
  $errfile,
  $errline,
  $errcontext 
)

Error handler function.

Get all errors specified by error_reporting() and write message with to_log() function.

If error is an E_USER_ERROR then exit, else continue.

This handler must be activated by set_error_handler('\OPiQuotations\error_handler').

See http://www.php.net/manual/en/function.set-error-handler.php

Parameters
int$errno
string$errstr
string$errfile
int$errline
array$errcontext

Definition at line 49 of file log.inc.

References to_log().

◆ hide_password()

OPiQuotations\hide_password (   $s)

If $s contains an element '[password] => ...' then hides the password value.

Parameters
string$s

Definition at line 81 of file log.inc.

Referenced by to_log().

◆ html_text_cut()

OPiQuotations\html_text_cut (   $html_text,
  $max_length,
  $hellip = '…',
  $reduce = true 
)

If length of $html_text <= $max_length characters then return $html_text, else return $html_text cutted added of $hellip to not be longer than $max_length characters.

If a cutting is required and $reduce then reduce contiguous whitespaces.

If the cutting cut a HTML entity then remove it.

Parameters
string$html_text
int$max_length(must be >= length of $hellip)
string$hellip,;(must not containt the & character)
bool$reduce
Returns
string

Definition at line 109 of file OPiQuotations.inc.

References $i, $max_length, and text_cut().

◆ text_cut()

OPiQuotations\text_cut (   $text,
  $max_length,
  $hellip = '…',
  $reduce = true 
)

If length of $text <= $max_length characters then return $text, else return $text cutted added of $hellip to be length of $max_length characters.

If a cutting is required and $reduce then reduce contiguous whitespaces.

Parameters
string$text
int$max_length(must be >= length of $hellip)
string$hellip,;
bool$reduce
Returns
string

Definition at line 147 of file OPiQuotations.inc.

References $max_length, and $text.

Referenced by html_text_cut(), and OPiQuotations\OPiQuotation\to_text_twitter().

◆ to_log()

OPiQuotations\to_log (   $message)

Append $message in LOG_FILE.

If the specified mail in '.private/log_email.inc' is not empty then send also the message to this mail.

If $message is not a string then a warning is added to the message and $message is converted to a string.

Parameters
mixed$message

Definition at line 104 of file log.inc.

References hide_password().

Referenced by OPiQuotations\Db\__construct(), error_handler(), OPiQuotations\Db\list_to_assoc(), OPiQuotations\Db\nb(), OPiQuotations\Db\query_insert(), OPiQuotations\Db\query_quotations(), and OPiQuotations\Db\query_quotations_nb().

Variable Documentation

◆ LOG_FILE

const OPiQuotations\LOG_FILE = 'logs/log.txt'

Filename of errors log file.

Definition at line 24 of file log.inc.

◆ true

return OPiQuotations::true

Definition at line 555 of file Db.inc.

◆ TRUE

return OPiQuotations::TRUE

Definition at line 1116 of file OPiQuotation.inc.