Strings

API Documentation

\GSPPanel\Strings

Contains common string utilities

Methods

ByteSize(integer $size) : string

Converts bytes into KB, MB, GB and returns the value

Parameters
NameTypeDescription
$sizeinteger
Returns
TypeDescription
string
CheckBlacklist(string $type, string $value) : boolean

Checks the blacklist for the specified item

Parameters
NameTypeDescription
$typestring

The blacklist type to search for

$valuestring

The value to search for in the blacklist

Returns
TypeDescription
booleantrue|false If there was a match found
EndsWith( $FullStr,  $EndStr) : void

Checks if the end of a string contains certain text

Parameters
NameTypeDescription
$FullStr
$EndStr
Details
Access
private  
GameReplaceVars(array $params) : array

Replaces GSP-Panel variables with the correct game variables

$params requires the following;

  • ugid: The users gameserver id
  • content: The content that needs variables replaced

Returns the following:

  • error
    • -1: No usergame specified
    • 0: Success
  • content: The new content with replaced variables
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
ReplaceVars(array $params) : array

Replaces GSP-Panel variables with the correct user profile or setting variables

$params requires the following;

  • uid: The users id
  • content: The content that needs variables replaced

Returns the following:

  • error
    • -1: No user id specified
    • -2: No user found matching the specified user id
    • 0: Success
  • content: The new content with replaced variables
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
array
array2ini(array $array) : string

Converts an array to an ini

Parameters
NameTypeDescription
$arrayarray
Returns
TypeDescription
string
createRandomPassword() : string

Returns a random password

Returns
TypeDescription
string
filter_xml( $matches) : void

Parameters
NameTypeDescription
$matches
parse_ini_string(string $str, boolean $ProcessSections = false) : array

Converts an ini to an array

Parameters
NameTypeDescription
$strstring

The ini contents

$ProcessSectionsboolean

Seperate the array into sections

Returns
TypeDescription
array
search_array(string $needle, array $array, string $item) : string

Allows multi-dimensional array search using the specified key

Parameters
NameTypeDescription
$needlestring

The value to search for

$arrayarray

The array to search in

$itemstring

The key to look for needle in

Returns
TypeDescription
stringReturns -1 if nothing was found or returns the key
str_replace_last( $search,  $replace,  $subject) : void

Replaces the last string and returns the new contents

Parameters
NameTypeDescription
$search
$replace
$subject
Details
Access
private  
version_compare2( $version1,  $version2) : void

Compare two versions

Parameters
NameTypeDescription
$version1
$version2
Details
Access
private  
xml2array( $xml) : void

Converts an XML string to an array

Parameters
NameTypeDescription
$xml
xml_to_array( $xml,  $main_heading = '') : void

Converts an XML string to an array

Parameters
NameTypeDescription
$xml
$main_heading
Documentation was generated by phpDocumentor 2.9.0.