Class humhub\libs\Helpers

Inheritancehumhub\libs\Helpers
Available since version0.5

This class contains a lot of html helpers for the views

Public Methods

Hide inherited methods

MethodDescriptionDefined By
CheckClassType() Checks if the class has this class as one of its parents humhub\libs\Helpers
GetBytesOfPHPIniValue() Returns bytes of a PHP Ini Setting Value E.g. 10M will converted into 10485760 humhub\libs\Helpers
GetUniqeId() Returns a unique string humhub\libs\Helpers
SqlMode() Set sql_mode=TRADITIONAL for mysql server. humhub\libs\Helpers
arrayCompVal() humhub\libs\Helpers
getBytesOfIniValue() Returns bytes of a PHP Ini Setting Value E.g. 10M will converted into 10485760 humhub\libs\Helpers
getFormattedTime() Get a readable time format from seconds humhub\libs\Helpers
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. humhub\libs\Helpers
substru() Temp Function to use UTF8 SubStr humhub\libs\Helpers
trimText() humhub\libs\Helpers
truncateText() Shorten a text string humhub\libs\Helpers

Method Details

CheckClassType() public static method

Checks if the class has this class as one of its parents

public static boolean CheckClassType ( $className, $type '' )
$className string
$type string
GetBytesOfPHPIniValue() public static method
Deprecated bug on PHP7 "A non well formed numeric value encountered"

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

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

See also humhub\libs\Helpers::getBytesOfIniValue() instead.

public static integer GetBytesOfPHPIniValue ( $val )
$val String
return integer

Bytes

GetUniqeId() public static method

Returns a unique string

public static string GetUniqeId ( )
return string

Unique

SqlMode() public static method (available since version 1.2.1)

Set sql_mode=TRADITIONAL for mysql server.

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.

public static void SqlMode ( $event )
$event
arrayCompVal() public static method

public static void arrayCompVal ( $a, $b )
$a
$b
getBytesOfIniValue() public static method

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

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

public static integer getBytesOfIniValue ( $valueString )
$valueString string
return integer

Bytes

throws \humhub\libs\InvalidParamException
getFormattedTime() public static method

Get a readable time format from seconds

public static void getFormattedTime ( $sekunden )
$sekunden string
  • Seconds you will formatting
same() public static method

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

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.

See also:

public static boolean same ( $a, $b )
$a string

First subject string to compare.

$b string

Second subject string to compare.

return boolean

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

substru() public static method

Temp Function to use UTF8 SubStr

public static \humhub\libs\type substru ( $str, $from, $len )
$str \humhub\libs\type
$from \humhub\libs\type
$len \humhub\libs\type
trimText() public static method

public static void trimText ( $text, $length )
$text
$length
truncateText() public static method

Shorten a text string

public static string truncateText ( $text, $length )
$text string
  • Text string you will shorten
$length integer
  • Count of characters to show