Common
[ class tree: Common ] [ index: Common ] [ all elements ]

Class: Utils

Source Location: /common/Utils.php

Class Overview


Utility class containing static methods for various common tasks.


Methods



Class Details

[line 30]
Utility class containing static methods for various common tasks.



[ Top ]


Class Methods


method addslashes [line 139]

mixed addslashes( mixed $data, [boolean $magic_on = NULL])

Escapes special characters taking into account if magic_quotes_gpc is ON or not. Multidimensional arrays are accepted.



Tags:

static:  
access:  public


Parameters:

mixed   $data  
boolean   $magic_on   (optional) magic_quotes_gpc status. Detected if missing.

[ Top ]

method checkDbError [line 162]

void checkDbError( object Database $db, [string $msg = ''])

Wrapper for PEAR::isError, which throws an exception in case of failure



Tags:

static:  
access:  public


Parameters:

object Database   $db   object to test for error
string   $msg   optional error message condition

[ Top ]

method copyProperties [line 40]

mixed copyProperties( mixed $from_object, mixed $to_object)

Copies values from an objet to another. It uses reflection for reading the properties of each objects.



Tags:

static:  
access:  public


Parameters:

mixed   $from_object  
mixed   $to_object  

[ Top ]

method copyVars [line 68]

mixed copyVars( mixed $from_object, mixed $to_object)

Copies values from an objet to another. It only updates if destination var exists. Does not use reflection.



Tags:

static:  
access:  public


Parameters:

mixed   $from_object  
mixed   $to_object  

[ Top ]

method getDb [line 179]

PEAR::DB getDb( PEAR::DB &$db, string $dsn, [array $options = array()])

Affects and returns a PEAR::DB object.

Set connection if not already available.




Tags:

static:  
access:  public


Parameters:

PEAR::DB   &$db  
string   $dsn   DSN (Data Source Name)
array   $options   connection options

[ Top ]

method invertImage [line 239]

array invertImage( string $input, string $output, [boolean $color = false], [string $type = 'jpeg'])

Inverts and saves image.

For a color negative image, set the optional flag: invertImage($input, '', true);

For a black and withe negative image use like this: invertImage($input, '');

If you want to save the output instead of just showing it, set the output to the path where you want to save the inverted image: invertImage('path/to/original/image.jpg','path/to/save/inverted-image.jpg');

If you want to use png you have to set the color flag as true or false and define the imagetype in the function call: invertImage('path/to/image.png','',false,'png');




Tags:

access:  public
static:  


Parameters:

string   $input   the input image path
string   $output   the output image path
boolean   $color  
string   $type   jpeg or png

[ Top ]

method isInteger [line 360]

boolean isInteger( mixed $arg, [boolean $positive = false])

Tests if argument is an integer.



Tags:

access:  public
static:  


Parameters:

mixed   $arg   argument to be tested
boolean   $positive   if true, test if argument is positive as well (optional)

[ Top ]

method isRelativePath [line 332]

boolean isRelativePath( string $path)

Tells if given path is relative.



Tags:

return:  true if relative
access:  public
static:  


Parameters:

string   $path   path

[ Top ]

method makeDirectoryWithPerms [line 115]

void makeDirectoryWithPerms( string $directory, string $permsFrom)

Creates a directory recursively. The permissions of the newly created directories are the same as the permission of the given $permsFrom file or directory.



Tags:

static:  
access:  public


Parameters:

string   $directory   The directory to create (can create recursively)
string   $permsFrom   Permissions of the newly created directory are the same as this file or directory.

[ Top ]

method negativeRad2Deg [line 342]

double negativeRad2Deg( double $rad)

Converts radians angle to degrees even if value is < 0.



Tags:

access:  public
static:  


Parameters:

double   $rad  

[ Top ]

method parseArray [line 205]

array parseArray( string $string, [string $divider = ','])

Converts a character-separated string to an array.



Tags:

access:  public
static:  


Parameters:

string   $string  
string   $divider   string divider

[ Top ]

method pathToPlatform [line 100]

string pathToPlatform( string $path)

Converts a path with any delimitors to a path with delimitors used by the current platform.



Tags:

static:  
access:  public


Parameters:

string   $path  

[ Top ]

method pathToUnix [line 87]

string pathToUnix( string $path)

Converts a path to unix path delmitors.



Tags:

static:  
access:  public


Parameters:

string   $path  

[ Top ]

method switchColorToRgb [line 311]

array switchColorToRgb( mixed $color)

Converts passed color in RGB codes.



Tags:

return:  array of RGB codes
access:  public
static:  


Parameters:

mixed   $color  

[ Top ]

method switchHexColorToRgb [line 299]

array switchHexColorToRgb( string $color)

Converts #xxyyzz hexadecimal color codes into RGB.



Tags:

return:  array of RGB codes
access:  public
static:  


Parameters:

string   $color   hexadecimal color code

[ Top ]


Documentation generated on Fri, 21 Sep 2007 13:31:11 +0200 by phpDocumentor 1.3.0RC3