HumHub Documentation (unofficial)

Helpers
in package

This class contains a lot of html helpers for the views

Tags
since
0.5

Table of Contents

Constants

CLASS_CHECK_INVALID_CLASSNAME_PARAMETER  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_INVALID_VALUE_PARAMETER
CLASS_CHECK_INVALID_TYPE  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_INVALID_TYPE
CLASS_CHECK_INVALID_TYPE_PARAMETER  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_INVALID_TYPE_PARAMETER
CLASS_CHECK_NON_EXISTING_CLASS  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_NON_EXISTING_CLASS
CLASS_CHECK_TYPE_NOT_IN_LIST  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_TYPE_NOT_IN_LIST
CLASS_CHECK_VALUE_IS_EMPTY  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_VALUE_IS_EMPTY
CLASS_CHECK_VALUE_IS_INSTANCE  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_VALUE_IS_INSTANCE
CLASS_CHECK_VALUE_IS_NULL  = \humhub\helpers\DataTypeHelper::TYPE_CHECK_VALUE_IS_NULL

Methods

arrayCompVal()  : mixed
Compare two arrays values
checkClassType()  : mixed
classUsesTraits()  : array<string|int, mixed>|null
getBytesOfIniValue()  : int
Returns bytes of a PHP Ini Setting Value E.g. 10M will converted into 10485760
GetBytesOfPHPIniValue()  : int
Returns bytes of a PHP Ini Setting Value E.g. 10M will converted into 10485760
getFormattedTime()  : mixed
Get a readable time format from seconds
GetUniqeId()  : string
Returns a unique string
same()  : bool
Check for sameness of two strings using an algorithm with timing independent of the string values if the subject strings are of equal length.
SqlMode()  : mixed
Set sql_mode=TRADITIONAL for mysql server.
substru()  : string
Temp Function to use UTF8 SubStr
trimText()  : string
truncateText()  : string
Shorten a text string

Constants

CLASS_CHECK_INVALID_CLASSNAME_PARAMETER

public int CLASS_CHECK_INVALID_CLASSNAME_PARAMETER = \humhub\helpers\DataTypeHelper::TYPE_CHECK_INVALID_VALUE_PARAMETER
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

CLASS_CHECK_INVALID_TYPE

public int CLASS_CHECK_INVALID_TYPE = \humhub\helpers\DataTypeHelper::TYPE_CHECK_INVALID_TYPE
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

CLASS_CHECK_INVALID_TYPE_PARAMETER

public int CLASS_CHECK_INVALID_TYPE_PARAMETER = \humhub\helpers\DataTypeHelper::TYPE_CHECK_INVALID_TYPE_PARAMETER
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

CLASS_CHECK_NON_EXISTING_CLASS

public int CLASS_CHECK_NON_EXISTING_CLASS = \humhub\helpers\DataTypeHelper::TYPE_CHECK_NON_EXISTING_CLASS
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

CLASS_CHECK_TYPE_NOT_IN_LIST

public int CLASS_CHECK_TYPE_NOT_IN_LIST = \humhub\helpers\DataTypeHelper::TYPE_CHECK_TYPE_NOT_IN_LIST
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

CLASS_CHECK_VALUE_IS_EMPTY

public int CLASS_CHECK_VALUE_IS_EMPTY = \humhub\helpers\DataTypeHelper::TYPE_CHECK_VALUE_IS_EMPTY
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

CLASS_CHECK_VALUE_IS_INSTANCE

public int CLASS_CHECK_VALUE_IS_INSTANCE = \humhub\helpers\DataTypeHelper::TYPE_CHECK_VALUE_IS_INSTANCE
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

CLASS_CHECK_VALUE_IS_NULL

public int CLASS_CHECK_VALUE_IS_NULL = \humhub\helpers\DataTypeHelper::TYPE_CHECK_VALUE_IS_NULL
Tags
deprecated

since 1.16; Use constant in DataTypeHelper class instead

see
DataTypeHelper

Methods

arrayCompVal()

Compare two arrays values

public static arrayCompVal(array<string|int, mixed> $a, array<string|int, mixed> $b) : mixed
Parameters
$a : array<string|int, mixed>
  • First array to compare against..
$b : array<string|int, mixed>
  • Second array

convert Objects: Helpers::arrayCompVal((array)$obj1, (array)$obj2)

checkClassType()

public static checkClassType(mixed $className[, mixed $type = '' ]) : mixed
Parameters
$className : mixed
$type : mixed = ''
Tags
deprecated

since 1.16; use DataTypeHelper::checkClassType()

see
DataTypeHelper::matchClassType

classUsesTraits()

public static & classUsesTraits(mixed $class[, bool $autoload = true ]) : array<string|int, mixed>|null
Parameters
$class : mixed
$autoload : bool = true
Tags
deprecated

since 1.16; use DataTypeHelper::classUsesTraits()

see
DataTypeHelper::classUsesTraits
Return values
array<string|int, mixed>|null

getBytesOfIniValue()

Returns bytes of a PHP Ini Setting Value E.g. 10M will converted into 10485760

public static getBytesOfIniValue(string $valueString) : int

Source: http://php.net/manual/en/function.ini-get.php#96996

Parameters
$valueString : string
Tags
throws
InvalidArgumentValueException
Return values
int

bytes

GetBytesOfPHPIniValue()

Returns bytes of a PHP Ini Setting Value E.g. 10M will converted into 10485760

public static GetBytesOfPHPIniValue(string $val) : int

Source: http://php.net/manual/en/function.ini-get.php

Parameters
$val : string
Tags
deprecated

bug on PHP7 "A non well formed numeric value encountered"

see
Helpers::getBytesOfIniValue

instead

Return values
int

bytes

getFormattedTime()

Get a readable time format from seconds

public static getFormattedTime(string $sekunden) : mixed
Parameters
$sekunden : string
  • Seconds you will formatting

GetUniqeId()

Returns a unique string

public static GetUniqeId() : string
Return values
string

unique

same()

Check for sameness of two strings using an algorithm with timing independent of the string values if the subject strings are of equal length.

public static same(string $a, string $b) : bool

The function can be useful to prevent timing attacks. For example, if $a and $b are both hash values from the same algorithm, then the timing of this function does not reveal whether or not there is a match.

NOTE: timing is affected if $a and $b are different lengths or either is not a string. For the purpose of checking password hash this does not reveal information useful to an attacker.

Parameters
$a : string

First subject string to compare.

$b : string

Second subject string to compare.

Tags
see
http://blog.astrumfutura.com/2010/10/nanosecond-scale-remote-timing-attacks-on-php-applications-time-to-take-them-seriously/
see
http://codereview.stackexchange.com/questions/13512
see
https://github.com/ircmaxell/password_compat/blob/master/lib/password.php
Return values
bool

true if the strings are the same, false if they are different or if either is not a string.

SqlMode()

Set sql_mode=TRADITIONAL for mysql server.

public static SqlMode(mixed $event) : mixed

This static function is intended as closure for on afterOpen raised by yii\db\Connection and should be configured in dynamic.php like this: 'on afterOpen' => ['humhub\libs\Helpers', 'SqlMode'],

This is mainly required for grouped notifications.

Parameters
$event : mixed
Tags
since
1.2.1

substru()

Temp Function to use UTF8 SubStr

public static substru(string $str, int $from, int $len) : string
Parameters
$str : string
$from : int
$len : int
Tags
deprecated

since 1.11 Use mb_substr() instead.

Return values
string

trimText()

public static trimText(mixed $text, mixed $length) : string
Parameters
$text : mixed
$length : mixed
Return values
string

truncateText()

Shorten a text string

public static truncateText(string $text, int $length) : string
Parameters
$text : string
  • Text string you will shorten
$length : int
  • Count of characters to show
Return values
string

        
On this page

Search results