Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cApiPathresolveCacheHelper
  • cArray
  • cArticleCollector
  • cDirHandler
  • cFileHandler
  • cHTMLInputSelectElement
  • cIterator
  • cString
  • cStringMultiByteWrapper
  • cZipArchive
  • UI_Config_Table
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class cArray

Array helper class.

Package: Core\Util
Copyright: four for business AG <www.4fb.de>
License: http://www.contenido.org/license/LIZENZ.txt
Author: Murat Purc <murat@purc.de>
Located at classes/class.array.php
Methods summary
public static array
# trim( array $arr, string $charlist = NULL )

Strip whitespaces (or other characters) from the beginning and end of each item in array. Similar to trim() function.

Strip whitespaces (or other characters) from the beginning and end of each item in array. Similar to trim() function.

Parameters

$arr
array
$arr Array of strings that will be trimmed.
$charlist
string
$charlist [optional] Optionally the stripped characters can also be specified using the charlist parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters.

Returns

array
Array of trimmed strings.
public static mixed
# searchRecursive( array $arr, mixed $search, boolean $partial = false, boolean $strict = false )

Search for given value in given array and return key of its first occurance.

Search for given value in given array and return key of its first occurance.

If value wasn't found at all false will be returned. If given array contains subarrays, these will be searched too. If value is found in subarray the returned key is that of the subarray.

Usually the values are tested for equality with the given $search. If the flag $partial is not false values are tested to contain $search. Otherwise, if $strict equals true values are tested for identity with $search. Otherwise (which is the default) values are tested for equality.

Be careful when searching by equality in arrays containing values that are no strings! The same is true for searching by equality for values that are no strings. PHPs behaviour is quite weird concerning comparision of different data types. E.g. '0' equals '0.0', 'foo' equals 0, 'foo' equals 0.0, NULL equals '' and false equals '0'! When dealing with nonstrings consider to use the strict mode!

Another caveat is when searching for an empty string when using the partial mode. This would lead to an error and is considered a bug!

Parameters

$arr
array
$arr array to search
$search
mixed
$search value to search for
$partial
boolean
$partial [optional] if values are tested to contain $search
$strict
boolean
$strict [optional] if values are tested for identity

Returns

mixed
key of the array containing the searched value or false

Todo

There should be only one flag for $partial and $strict in order to avoid ambiguities (imagine $partial=true & $strict=true).
public static array
# sortWithLocale( array $arr, string $locale )

Sorts an array by changing the locale temporary to passed value.

Sorts an array by changing the locale temporary to passed value.

Parameters

$arr
array
$arr The array to sort
$locale
string
$locale The locale to change before sorting

Returns

array
Sorted array
public static array
# csort( )

Very cool algorithm for sorting multi-dimensional arrays.

Very cool algorithm for sorting multi-dimensional arrays.

Found at http://us2.php.net/manual/en/function.array-multisort.php

Syntax:

$new_array = cArray::csort($array [, 'col1' [, SORT_FLAG [,
SORT_FLAG]]]...);

Explanation:

  • $array is the array you want to sort
  • 'col1' is the name of the column you want to sort
  • SORT_FLAGS are: SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC,

SORT_STRING

You can repeat the 'col', FLAG, FLAG as often as you want. The highest prioritiy is given to the first - so the array is sorted by the last given column first, then the one before ...

Example:

$array = cArray::csort($array, 'town', 'age', SORT_DESC, 'name');

Returns

array
public static boolean
# initializeKey( array & $aArray, string $sKey, mixed $mDefault = '' )

Ensures that the passed array has the key, sets it by using the value.

Ensures that the passed array has the key, sets it by using the value.

Parameters

$aArray
array
$aArray
$sKey
string
$sKey
$mDefault
mixed
$mDefault [optional]

Returns

boolean
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0