phpDocumentor GalleryCore
Classes
[ class tree: GalleryCore ] [ index: GalleryCore ] [ all elements ]

Class: GalleryUtilities

Source Location: /modules/core/classes/GalleryUtilities.class

Class GalleryUtilities

Class Overview

A collection of useful utilities that have no obvious home.

All of these utilities should be accessed in a static sense, ie. GalleryUtilities::getFileExtension($filename);

Try not to jam too many methods into this class. Only put methods here if they are of obvious value to the class layer and there's no other home for them.

Located in /modules/core/classes/GalleryUtilities.class [line 49]



		
		
		
		

Methods

[ Top ]
Method Summary
array   arrayKeysRecursive()   Get all array keys, looking even in arrays contained within the array.
array   array_merge_replace()   Merges two arrays and replace existing entries, like the PHP function array_merge_recursive.
void   castToFloat()   Cast to float taking into account that older PHP versions will not treat "." as a decimal separator if the current locale uses "," - when we stop supporting these older versions we can ditch this method and just cast to (float). (Note that newer PHP versions may accept only "." even if locale uses ",").
string   convertPathToUrl()   Convert a filesystem path inside the Gallery directory to an absolute URL.
array   createAlbumTree()   Turn a set of albums into a depth tree suitable for display in a hierarchical format.
array   entitySubstr()   An entity-safe equivalent to substr (http://php.net/substr).
void   fixCookieVars()   Fix the superglobal $_COOKIE to conform with RFC 2965
array   getAllRequestVariables()   Return all request variables with the Gallery variable prefix.
string   getCookieVar()   Return a sanitized version of the given variable from the _COOKIE superglobal.
array   getFile()   Return data about file attached to request.
array   getFileBase()   Return the file's basename.
array   getFileExtension()   Return the file's extension.
array   getFileNameComponents()   Get the type of the file from its filename.
array   getFormVariables()   Return all request variables that match the prefix.
void   getHttpDate()   Deprecated. Use Gallery::getHttpDate instead.
boolean   getPhpIniBool()   Get a php.ini value and return its boolean value.
array   getPseudoFileName()   Return approximate filename of given GalleryEntity, or 'unknown' if we can't figure it out.
string   getRemoteHostAddress()   Return the address of the remote host.
mixed   getRequestVariables()   Return the specified request variables. Accept any number of keys and return that number of values, in order.
mixed   getRequestVariablesNoPrefix()   Return the specified request variables (omit Gallery variable prefix). Should be used only when interacting with an external API where prefix can't be used. Accept any number of keys and return that number of values, in order.
string   getServerVar()   Return a sanitized version of the given variable from the _SERVER superglobal.
array   getUrlVariablesFiltered()   Return all request variables from the URL except the listed keys.
array   guaranteeDirExists()   Make sure that the given directory exists (creating it and parent directories if necessary).
void   hasRequestVariable()   Check to see if the given key is in the request.
same   htmlEntityDecode()   Equivalent to html_entity_decode() for PHP < 4.3.0 which doesn't have it.
string   htmlSafe()   Strip out all potentially dangerous content within HTML.
string   identifySearchEngine()   Return id of the search engine currently crawling the site by analyzing the current request.
boolean   isA()   Figure out if the object specified is an instance of or an instance of a sub class of the class specified
boolean   isCompatibleWithApi()   Verify that the API provided is compatible with the API that we require.
boolean   isCorrectPassword()   Verify given password is correct.
void   isEmbedded()   Deprecated. Use Gallery::isEmbedded instead.
boolean   isExactlyA()   Figure out if the object specified is an instance of the class specified, excluding subclasses
boolean   isPathInList()   Return true if the path exists and is in the given path list. Make sure to pass paths in the system charset to this method.
bool   isSafeHttpHeader()   Checks whether the given HTTP header is safe.
boolean   isTrustedProxy()   Is this address a trusted proxy? Right now we consider any RFC1918 host trustworthy.
boolean   isValidEmailString()   Validate string is valid format for an email address.
string   makeMarkers()   Return a string of ? markers.
string   markup()   Apply markup to given text.
string   md5Salt()   Create a hashed password using md5 plus salt.
string   prefixFormVariable()   Return prefixed form variable name.
void   putRequestVariable()   Push the given key => value pair back into the request.
array(file   readIndividualManifest()   Read one manifest file.
array   readManifest()   Get contents of MANIFEST files.
void   removeFormVariables()   Remove all request variables that match the prefix.
void   removeRequestVariable()   Remove a request variable.
string   roundToString()   Round a float and convert to a string. Replace , with . in case current locale uses comma as fraction separator.
void   sanitizeInputValues()   Perform necessary pre-processing on the value part of the incoming array (which may be an
array(width,   scaleDimensionsToFit()   Scale the given width/height to a new target size, maintaining aspect ratio.
void   setResponseHeader()   Set HTTP response header.
array(width,   shrinkDimensionsToFit()   Scale the given width/height to a new target size, maintaining aspect ratio, but only if the dimensions are already larger than the target (in other words, don't increase the dimensions).
string   strToLower()   ASCII version of PHP's strtolower(). PHP's strtolower doesn't work in all locales as expected, eg. in Turkish, we get non-ASCII characters for an ASCII input string.
string   strToUpper()   ASCII version of PHP's strtoupper().
string   unicodeEntitiesToUtf8()   Unescape embedded UTF-8 entities in the given string.
string   unicodeValueToUtf8Value()   Convert a numerical unicode value to a multibyte UTF-8 string. Adapted from code found here: http://us2.php.net/utf8_encode
void   unsanitizeInputValues()   Undo preprocessing from sanitizeInputValues (useful when we put values back in the request).
string   utf8Substring()   mb_substr() for UTF-8, with PHP fallback. Truncates incomplete HTML entity at end of result.
string   utf8ToUnicodeEntities()   Takes a string of UTF-8 encoded characters and converts it to a string of unicode entities.
void   _createDepthTree()   Recursively walk a parent/child map and build the depth tree.
string   _getRequestVariable()   Return a specified request variable from the GET or POST vars.
array   &_getResponseHeaders()   Array of response headers which have already been set.
the   _internalGetRequestVariable()   Take a path in the form of ('foo', 'bar', 'baz') and a source array and get the value from it like this: return $source['foo']['bar']['baz'];
void   _internalPutRequestVariable()   Take a path in the form of ('foo', 'bar', 'baz') and a destination array and put the value into it like this: $destination['foo']['bar']['baz'] = $value;
void   _internalRemoveRequestVariable()   Take a path in the form of ('foo', 'bar', 'baz') and a source array and remove the value from it like this: unset($source['foo']['bar']['baz']);
void   _registerCookieAttr()   Register a cookie variable safely.

[ Top ]
Methods
arrayKeysRecursive  [line 1351]

  array arrayKeysRecursive( array $array  )

Get all array keys, looking even in arrays contained within the array.

Parameters:
array   $array: 

API Tags:
Return:  of keys


[ Top ]
array_merge_replace  [line 207]

  array array_merge_replace( array $array, array $newValues  )

Merges two arrays and replace existing entries, like the PHP function array_merge_recursive.

The main difference is that existing keys will be replaced with new values, not combined in a new sub array.

Usage: $newArray = array_merge_replace( $array, $newValues );

Parameters:
array   $array:  first array with 'replaceable' values
array   $newValues:  array which will be merged into first one

API Tags:
Return:  resulting array

Information Tags:
Todo:  Verify that both arguments are arrays.
Author:  Tobias Tom <t.tom@succont.de>

[ Top ]
castToFloat  [line 525]

  void castToFloat( $value  )

Cast to float taking into account that older PHP versions will not treat "." as a decimal separator if the current locale uses "," - when we stop supporting these older versions we can ditch this method and just cast to (float). (Note that newer PHP versions may accept only "." even if locale uses ",").

Parameters:
   $value: 


[ Top ]
convertPathToUrl  [line 443]

  string convertPathToUrl( string $path, [array $options = array()]  )

Convert a filesystem path inside the Gallery directory to an absolute URL.

ie. /path/to/gallery/themes/classic/styles/style.css => http://example.com/gallery/themes/classic/styles/style.css

Parameters:
string   $path:  path to a file in the Gallery directory tree
array   $options:  (optional) options to pass to UrlGenerator

API Tags:
Return:  a URL


[ Top ]
createAlbumTree  [line 1083]

  array createAlbumTree( array $albums  )

Turn a set of albums into a depth tree suitable for display in a hierarchical format.

Parameters:
array   $albums:  the GalleryAlbumItem instances

API Tags:
Return:  an associative array of tree data. Each node has a 'depth' element, and a 'data' element that contains all the members of the current album item.


[ Top ]
entitySubstr  [line 570]

  array entitySubstr( string $string, int $start, [int $length = null], [boolean $countEntitiesAsOne = true]  )

An entity-safe equivalent to substr (http://php.net/substr).

Parameters:
string   $string:  the input string
int   $start:  the 0 based start index (negative values mean subtract from the end)
int   $length:  the desired length. If negative negative then that many characters will be omitted from the end of string (after the start position has been calculated when a start is negative)
boolean   $countEntitiesAsOne:  true if the final length be a count of entities, instead of characters. (default: true)

API Tags:
Return:  int the number of entities in the string string the output string


[ Top ]
fixCookieVars  [line 1486]

  void fixCookieVars( [boolean $force = false], [boolean $unset = false]  )

Fix the superglobal $_COOKIE to conform with RFC 2965

We don't use $_COOKIE[$cookiename] because it doesn't conform to RFC 2965 (the cookie standard), ie. in $_COOKIE, we don't get the cookie with the most specific path for a given cookie name, we get the cookie with the least specific cookie path. This function does it exactly the other way around, to a) fix our cookie/login problems and to b) conform with the RFC. The PHP bug was already fixed in spring 2005, but we will have to deal with broken PHP versions for a long time.

Parameters:
boolean   $force:  force the reevaluation of the HTTP header string Cookie
boolean   $unset:  unset static variable for testability

API Tags:
See:  http://bugs.php.net/bug.php?id=32802 Fixes also another PHP cookie bug. PHP doesn't expect the cookie header to have quoted-strings, but they are perfectly legal according to RFC 2965. The third bug fixed here is an MS Internet Explorer (IE) bug. When using default cookie domains (no leading dot, don't set the domain in set-cookie), IE is supposed to return only cookies that have the exact request-host as their domain. Example: Cookies stored in the browser with cookie domains: .example.com, .www.example.com, example.com, www.example.com The request-host is www.example.com. Thus, IE should return all those cookies but the example.com cookie, because it's a default domain cookie and it doesn't match exactly the request-host. But IE returns the example.com cookie too. As MS decided that it returns the cookie with the best domain-match first (unspecified in RFC 2965), this wouldn't be a problem if PHP didn't select the last cookie in the HTTP_COOKIE header. But with fixCookieVars(), this case is also fixed. This function reevaluates the HTTP Cookie header and populates $_COOKIE with the correct cookies. We fix only non-array and non '[', ']' containing cookies for simplicity. To fix our login problem, we'd have to fix only the GALLERYSID cookie anyway.


[ Top ]
getAllRequestVariables  [line 271]

  array getAllRequestVariables( )

Return all request variables with the Gallery variable prefix.


API Tags:
Return:  request variable name => value


[ Top ]
getCookieVar  [line 1430]

  string getCookieVar( string $key  )

Return a sanitized version of the given variable from the _COOKIE superglobal.

Parameters:
string   $key:  the key in the _COOKIE superglobal

API Tags:
Return:  the value


[ Top ]
getFile  [line 108]

  array getFile( string $key, [boolean $prefix = true]  )

Return data about file attached to request.

Parameters:
string   $key: 
boolean   $prefix:  (optional) false to omit Gallery variable prefix (not recommended)

API Tags:
Return:  file data


[ Top ]
getFileBase  [line 97]

  array getFileBase( string $filename  )

Return the file's basename.

eg. "foo.jpg" yields "foo"

Parameters:
string   $filename: 

API Tags:
Return:  the file base


[ Top ]
getFileExtension  [line 85]

  array getFileExtension( string $filename  )

Return the file's extension.

eg. "foo.jpg" yields "jpg"

Parameters:
string   $filename: 

API Tags:
Return:  the file extension


[ Top ]
getFileNameComponents  [line 59]

  array getFileNameComponents( string $filename  )

Get the type of the file from its filename.

eg. "foo.jpg" yields 'foo', 'jpg' "foo.bar.jpeg" yields 'foo.bar', 'jpeg'

Parameters:
string   $filename: 

API Tags:
Return:  the file basename, the file extension


[ Top ]
getFormVariables  [line 137]

  array getFormVariables( string $key, [boolean $prefix = true]  )

Return all request variables that match the prefix.

Parameters:
string   $key: 
boolean   $prefix:  (optional) false to omit Gallery variable prefix (not recommended)

API Tags:
Return:  key value pairs


[ Top ]
getHttpDate  [line 1199]

  void getHttpDate( [ $time = '']  )

Deprecated. Use Gallery::getHttpDate instead.

Parameters:
   $time: 

API Tags:
Deprecated:  
See:  Gallery::getHttpDate


[ Top ]
getPhpIniBool  [line 1367]

  boolean getPhpIniBool( string $ini_string  )

Get a php.ini value and return its boolean value.

Parameters:
string   $ini_string:  name of the php.ini value to be retrieved

API Tags:
Return:  value


[ Top ]
getPseudoFileName  [line 1152]

  array getPseudoFileName( GalleryEntity $entity  )

Return approximate filename of given GalleryEntity, or 'unknown' if we can't figure it out.

Parameters:
GalleryEntity   $entity: 

API Tags:
Return:  GalleryStatus a status code string pseudoFileName a filename


[ Top ]
getRemoteHostAddress  [line 1017]

  string getRemoteHostAddress( )

Return the address of the remote host.


API Tags:
Return:  the remote host address (or null)


[ Top ]
getRequestVariables  [line 251]

  mixed getRequestVariables( one 0  )

Return the specified request variables. Accept any number of keys and return that number of values, in order.

Parameters:
one   0:  or more string parameters

API Tags:
Return:  a single string value or many values


[ Top ]
getRequestVariablesNoPrefix  [line 299]

  mixed getRequestVariablesNoPrefix( one 0  )

Return the specified request variables (omit Gallery variable prefix). Should be used only when interacting with an external API where prefix can't be used. Accept any number of keys and return that number of values, in order.

Parameters:
one   0:  or more string parameters

API Tags:
Return:  a single string value or many values


[ Top ]
getServerVar  [line 1415]

  string getServerVar( string $key  )

Return a sanitized version of the given variable from the _SERVER superglobal.

Parameters:
string   $key:  the key in the _SERVER superglobal

API Tags:
Return:  the value


[ Top ]
getUrlVariablesFiltered  [line 177]

  array getUrlVariablesFiltered( [array $skip = array()], [boolean $prefix = false]  )

Return all request variables from the URL except the listed keys.

Parameters:
array   $skip:  (optional) keys to skip
boolean   $prefix:  (optional) if true, remove form variable prefix from keys in result

API Tags:
Return:  unsanitized key value pairs


[ Top ]
guaranteeDirExists  [line 1040]

  array guaranteeDirExists( string $dir  )

Make sure that the given directory exists (creating it and parent directories if necessary).

Parameters:
string   $dir: 

API Tags:
Return:  boolean true if dir exists or was created successfully array of directories that were created


[ Top ]
hasRequestVariable  [line 358]

  void hasRequestVariable( string $key, [boolean $prefix = true]  )

Check to see if the given key is in the request.

Parameters:
string   $key: 
boolean   $prefix:  (optional) false to omit Gallery variable prefix (not recommended)


[ Top ]
htmlEntityDecode  [line 842]

  same htmlEntityDecode( string $string  )

Equivalent to html_entity_decode() for PHP < 4.3.0 which doesn't have it.

Parameters:
string   $string:  with html entities

API Tags:
Return:  string without them
Deprecated:  

Information Tags:
Todo:  Remove at the next major version bump of core API

[ Top ]
htmlSafe  [line 863]

  string htmlSafe( string $html, [boolean $decode = false]  )

Strip out all potentially dangerous content within HTML.

Parameters:
string   $html:  HTML
boolean   $decode:  (optional) true to decode entities, process, then recode

API Tags:
Return:  safe HTML


[ Top ]
identifySearchEngine  [line 1386]

  string identifySearchEngine( )

Return id of the search engine currently crawling the site by analyzing the current request.


API Tags:
Return:  the crawler id, or null if it's a regular user


[ Top ]
isA  [line 541]

  boolean isA( object $instance, string $className  )

Figure out if the object specified is an instance of or an instance of a sub class of the class specified

Parameters:
object   $instance:  any kind of object
string   $className: 


[ Top ]
isCompatibleWithApi  [line 1325]

  boolean isCompatibleWithApi( array $required, array $provided  )

Verify that the API provided is compatible with the API that we require.

We're only compatible if the major numbers are the same, and the required minor number is less than or equal to the provided minor number.

Parameters:
array   $required:  (major, minor)
array   $provided:  (major, minor)

API Tags:
Return:  true if compatible


[ Top ]
isCorrectPassword  [line 1311]

  boolean isCorrectPassword( string $guess, string $hashedPassword  )

Verify given password is correct.

Parameters:
string   $guess:  password guess
string   $hashedPassword:  hashed password

API Tags:
Return:  true if correct


[ Top ]
isEmbedded  [line 1448]

  void isEmbedded( )

Deprecated. Use Gallery::isEmbedded instead.


API Tags:
Deprecated:  
See:  Gallery::isEmbedded


[ Top ]
isExactlyA  [line 553]

  boolean isExactlyA( object $instance, string $className  )

Figure out if the object specified is an instance of the class specified, excluding subclasses

Parameters:
object   $instance:  any kind of object
string   $className: 


[ Top ]
isPathInList  [line 976]

  boolean isPathInList( string $path, string $list  )

Return true if the path exists and is in the given path list. Make sure to pass paths in the system charset to this method.

Parameters:
string   $path: 
string   $list:  the list of legal paths


[ Top ]
isSafeHttpHeader  [line 1655]

  bool isSafeHttpHeader( string $header  )

Checks whether the given HTTP header is safe.

PHP versions before PHP 4.4.2 / PHP 5.1.2 allowed for HTTP header injection (HTTP RS). This function ensures that servers running older PHP versions are protected as well.

Parameters:
string   $header: 

API Tags:
Return:  true if the given header is safe


[ Top ]
isTrustedProxy  [line 1007]

  boolean isTrustedProxy( string $addr  )

Is this address a trusted proxy? Right now we consider any RFC1918 host trustworthy.

Parameters:
string   $addr:  an address in dotted quad form


[ Top ]
isValidEmailString  [line 1282]

  boolean isValidEmailString( string $email  )

Validate string is valid format for an email address.

Parameters:
string   $email:  email address


[ Top ]
makeMarkers  [line 417]

  string makeMarkers( int $count, [ $markerFragment = '?']  )

Return a string of ? markers.

Parameters:
int   $count:  the number of markers to return
   $markerFragment: 


[ Top ]
markup  [line 852]

  string markup( string $text, [string $markupType = null]  )

Apply markup to given text.

Parameters:
string   $text: 
string   $markupType:  (optional) markup type, defaults from core markup parameter

API Tags:
Return:  resulting text


[ Top ]
md5Salt  [line 1292]

  string md5Salt( string $password, [string $salt = '']  )

Create a hashed password using md5 plus salt.

Parameters:
string   $password:  plaintext password
string   $salt:  (optional) salt or hash containing salt (randomly generated if omitted)

API Tags:
Return:  hashed password


[ Top ]
prefixFormVariable  [line 408]

  string prefixFormVariable( string $key  )

Return prefixed form variable name.

Parameters:
string   $key:  form variable name

API Tags:
Return:  prefixed form variable name


[ Top ]
putRequestVariable  [line 320]

  void putRequestVariable( string $key, string $value, [boolean $prefix = true]  )

Push the given key => value pair back into the request.

Parameters:
string   $key: 
string   $value: 
boolean   $prefix:  (optional) false to omit Gallery variable prefix (not recommended)


[ Top ]
readIndividualManifest  [line 1242]

  array(file readIndividualManifest( string $filePath, &$manifest  )

Read one manifest file.

Parameters:
string   $filePath:  the path to the MANIFEST file
   &$manifest: 

API Tags:
Return:  => array('checksum'=>..,'size'=>..,'viewable'=>..), ...)


[ Top ]
readManifest  [line 1208]

  array readManifest( )

Get contents of MANIFEST files.


API Tags:
Return:  (file => array('checksum'=>..,'size'=>..,'viewable'=>..), ..)


[ Top ]
removeFormVariables  [line 235]

  void removeFormVariables( string $key, [boolean $prefix = true]  )

Remove all request variables that match the prefix.

Parameters:
string   $key: 
boolean   $prefix:  (optional) false to omit Gallery variable prefix (not recommended)


[ Top ]
removeRequestVariable  [line 371]

  void removeRequestVariable( string $key, [boolean $prefix = true]  )

Remove a request variable.

Parameters:
string   $key: 
boolean   $prefix:  (optional) false to omit Gallery variable prefix (not recommended)


[ Top ]
roundToString  [line 515]

  string roundToString( float $floatValue, [int $precision = 0]  )

Round a float and convert to a string. Replace , with . in case current locale uses comma as fraction separator.

Parameters:
float   $floatValue:  value to round
int   $precision:  defaults to zero

API Tags:
Return:  rounded value


[ Top ]
sanitizeInputValues  [line 717]

  void sanitizeInputValues( &$value, [boolean $adaptForMagicQuotes = true], mixed $value  )

Perform necessary pre-processing on the value part of the incoming array (which may be an

associative array or a simple list of values). We do the following:

  1. Convert UTF-8 values to Unicode entities
  2. Sanitize any input values to remove dangerous values

Parameters:
mixed   $value:  one value or many values
boolean   $adaptForMagicQuotes:  (optional) false to skip undoing the damage caused by magic_quotes
   &$value: 


[ Top ]
scaleDimensionsToFit  [line 493]

  array(width, scaleDimensionsToFit( int $width, int $height, int $targetWidth, [int $targetHeight = null]  )

Scale the given width/height to a new target size, maintaining aspect ratio.

Parameters:
int   $width: 
int   $height: 
int   $targetWidth:  target width
int   $targetHeight:  (optional) target height, defaults to same as width

API Tags:
Return:  height)


[ Top ]
setResponseHeader  [line 926]

  void setResponseHeader( string $header, [boolean $replace = true]  )

Set HTTP response header.

Parameters:
string   $header:  HTTP response header
boolean   $replace:  (optional) avoid setting HTTP response header if it would replace an existing header. This differs from the PHP header() $replace param which adds a header if it would otherwise replace and existing header.


[ Top ]
shrinkDimensionsToFit  [line 474]

  array(width, shrinkDimensionsToFit( int $width, int $height, int $targetWidth, [int $targetHeight = null]  )

Scale the given width/height to a new target size, maintaining aspect ratio, but only if the dimensions are already larger than the target (in other words, don't increase the dimensions).

Parameters:
int   $width: 
int   $height: 
int   $targetWidth:  target width
int   $targetHeight:  (optional) target height, defaults to same as width

API Tags:
Return:  height)


[ Top ]
strToLower  [line 1633]

  string strToLower( string $string  )

ASCII version of PHP's strtolower(). PHP's strtolower doesn't work in all locales as expected, eg. in Turkish, we get non-ASCII characters for an ASCII input string.

Parameters:
string   $string: 

API Tags:
Return:  lowercase version of the string


[ Top ]
strToUpper  [line 1642]

  string strToUpper( string $string  )

ASCII version of PHP's strtoupper().

Parameters:
string   $string: 

API Tags:
Return:  uppercase version of the string


[ Top ]
unicodeEntitiesToUtf8  [line 779]

  string unicodeEntitiesToUtf8( string $string  )

Unescape embedded UTF-8 entities in the given string.

Parameters:
string   $string:  the input string with UTF-8 entities

API Tags:
Return:  the UTF-8 string


[ Top ]
unicodeValueToUtf8Value  [line 804]

  string unicodeValueToUtf8Value( int $num  )

Convert a numerical unicode value to a multibyte UTF-8 string. Adapted from code found here: http://us2.php.net/utf8_encode

Parameters:
int   $num:  the unicode value

API Tags:
Return:  the UTF-8 string


[ Top ]
unsanitizeInputValues  [line 755]

  void unsanitizeInputValues( &$value, [boolean $adaptForMagicQuotes = true], mixed $value  )

Undo preprocessing from sanitizeInputValues (useful when we put values back in the request).

Parameters:
mixed   $value:  one value or many values
boolean   $adaptForMagicQuotes:  (optional) false to skip redoing the damage caused by magic_quotes
   &$value: 


[ Top ]
utf8Substring  [line 793]

  string utf8Substring( string $string, int $start, int $length  )

mb_substr() for UTF-8, with PHP fallback. Truncates incomplete HTML entity at end of result.

Parameters:
string   $string:  the input string containing raw UTF-8
int   $start: 
int   $length: 

API Tags:
Return:  a multibyte safe substring of input value
Deprecated:  Please use GalleryCoreApi::utf8Substring instead


[ Top ]
utf8ToUnicodeEntities  [line 634]

  string utf8ToUnicodeEntities( string $source  )

Takes a string of UTF-8 encoded characters and converts it to a string of unicode entities.

Each unicode entity has the form &#nnnnn; n={0..9} and can be displayed by UTF-8 supporting browsers.

This function was posted in a comment here: http://www.php.net/manual/en/function.utf8-decode.php by "ronen at greyzone dot com".

Parameters:
string   $source:  encoded using UTF-8

API Tags:
Return:  of unicode entities


[ Top ]
_createDepthTree  [line 1133]

  void _createDepthTree( &$map, int $id, [int $depth = 0], array $map  )

Recursively walk a parent/child map and build the depth tree.

Parameters:
array   $map:  parent/child map
int   $id:  child id
int   $depth:  (optional) current depth
   &$map: 

API Tags:
Access:  private


[ Top ]
_getRequestVariable  [line 886]

  string _getRequestVariable( string $key  )

Return a specified request variable from the GET or POST vars.

Parameters:
string   $key:  a single key

API Tags:
Return:  a single value
Access:  private


[ Top ]
_getResponseHeaders  [line 964]

  array &_getResponseHeaders( )

Array of response headers which have already been set.


API Tags:
Return:  key => value pairs of headers
Access:  private


[ Top ]
_internalGetRequestVariable  [line 905]

  the _internalGetRequestVariable( array $keyPath, array $array  )

Take a path in the form of ('foo', 'bar', 'baz') and a source array and get the value from it like this: return $source['foo']['bar']['baz'];

Parameters:
array   $keyPath:  the key path
array   $array:  the source

API Tags:
Return:  value or null if it does not exist
Access:  private


[ Top ]
_internalPutRequestVariable  [line 343]

  void _internalPutRequestVariable( array $keyPath, mixed $value, &$array, array $array  )

Take a path in the form of ('foo', 'bar', 'baz') and a destination array and put the value into it like this: $destination['foo']['bar']['baz'] = $value;

Parameters:
array   $keyPath:  the key path
mixed   $value: 
array   $array:  the destination
   &$array: 

API Tags:
Access:  private


[ Top ]
_internalRemoveRequestVariable  [line 389]

  void _internalRemoveRequestVariable( array $keyPath, &$array, array $array  )

Take a path in the form of ('foo', 'bar', 'baz') and a source array and remove the value from it like this: unset($source['foo']['bar']['baz']);

Parameters:
array   $keyPath:  the key path
array   $array:  the source
   &$array: 

API Tags:
Access:  private


[ Top ]
_registerCookieAttr  [line 1579]

  void _registerCookieAttr( string $attr, &$fixedCookies, array $fixedCookies  )

Register a cookie variable safely.

Creates an entry in $_COOKIE for $attr, which is a name=value pair. We try to mimic the PHP source code here: make the entry binary safe, don't register non-NAME attributes (eg. cookie version, ...)

The one thing we don't do here is treat array cookies correctly because it would but too involving. But we gracefully just don't replace these array cookies in $_COOKIE, so if they are used somewhere, they will be left intact by fixCookieVars().

Parameters:
string   $attr:  the cookie var attr, NAME [=VALUE]
array   $fixedCookies:  (string already registered cookie name, ...)
   &$fixedCookies: 

API Tags:
Access:  private


[ Top ]

Documentation generated on Fri, 08 Oct 2010 05:07:01 -0700 by phpDocumentor 1.3.0RC6