PHP Class Common\Core\Model

Inheritance: extends BaseModel
Show file Open project: forkcms/forkcms Class Usage Examples

Protected Properties

Property Type Description
$modules array Cached modules

Public Methods

Method Description
addNumber ( string $string ) : string Add a number to the string
generatePassword ( integer $length = 6, boolean $uppercaseAllowed = true, boolean $lowercaseAllowed = true ) : string Generate a totally random but readable/speakable password
generateThumbnails ( string $path, string $sourceFile ) Generate thumbnails based on the folders in the path Use - 128x128 as foldername to generate an image where the width will be 128px and the height will be 128px - 128x as foldername to generate an image where the width will be 128px, the height will be calculated based on the aspect ratio.
getModules ( ) : array Get the modules
getThumbnailFolders ( string $path, boolean $includeSource = false ) : array Get the thumbnail folders
getUTCDate ( string $format = null, integer $timestamp = null ) : string Get the UTC date in a specific format. Use this method when inserting dates in the database!
getUTCTimestamp ( SpoonFormDate $date, SpoonFormTime $time = null ) : integer Get the UTC timestamp for a date/time object combination.
startProcessingHooks ( ) Start processing the hooks
subscribeToEvent ( string $eventModule, string $eventName, string $module, mixed $callback ) Subscribe to an event, when the subscription already exists, the callback will be updated.
triggerEvent ( string $module, string $eventName, mixed $data = null ) Trigger an event
unsubscribeFromEvent ( string $eventModule, string $eventName, string $module ) Unsubscribe from an event

Method Details

addNumber() public static method

Add a number to the string
public static addNumber ( string $string ) : string
$string string The string where the number will be appended to.
return string

generatePassword() public static method

Generate a totally random but readable/speakable password
public static generatePassword ( integer $length = 6, boolean $uppercaseAllowed = true, boolean $lowercaseAllowed = true ) : string
$length integer The maximum length for the password to generate.
$uppercaseAllowed boolean Are uppercase letters allowed?
$lowercaseAllowed boolean Are lowercase letters allowed?
return string

generateThumbnails() public static method

- x128 as foldername to generate an image where the height will be 128px, the width will be calculated based on the aspect ratio.
public static generateThumbnails ( string $path, string $sourceFile )
$path string The path wherein the thumbnail-folders will be stored.
$sourceFile string The location of the source file.

getModules() public static method

Get the modules
public static getModules ( ) : array
return array

getThumbnailFolders() public static method

Get the thumbnail folders
public static getThumbnailFolders ( string $path, boolean $includeSource = false ) : array
$path string The path
$includeSource boolean Should the source-folder be included in the return-array.
return array

getUTCDate() public static method

Get the UTC date in a specific format. Use this method when inserting dates in the database!
public static getUTCDate ( string $format = null, integer $timestamp = null ) : string
$format string The format to return the timestamp in. Default is MySQL datetime format.
$timestamp integer The timestamp to use, if not provided the current time will be used.
return string

getUTCTimestamp() public static method

Get the UTC timestamp for a date/time object combination.
public static getUTCTimestamp ( SpoonFormDate $date, SpoonFormTime $time = null ) : integer
$date SpoonFormDate An instance of \SpoonFormDate.
$time SpoonFormTime An instance of \SpoonFormTime.
return integer

startProcessingHooks() public static method

Start processing the hooks
Deprecation: use the symfony event dispatcher instead
public static startProcessingHooks ( )

subscribeToEvent() public static method

Subscribe to an event, when the subscription already exists, the callback will be updated.
Deprecation: use the symfony event dispatcher instead
public static subscribeToEvent ( string $eventModule, string $eventName, string $module, mixed $callback )
$eventModule string The module that triggers the event.
$eventName string The name of the event.
$module string The module that subscribes to the event.
$callback mixed The callback that should be executed when the event is triggered.

triggerEvent() public static method

Trigger an event
Deprecation: use the symfony event dispatcher instead
public static triggerEvent ( string $module, string $eventName, mixed $data = null )
$module string The module that triggers the event.
$eventName string The name of the event.
$data mixed The data that should be send to subscribers.

unsubscribeFromEvent() public static method

Unsubscribe from an event
Deprecation: use the symfony event dispatcher instead
public static unsubscribeFromEvent ( string $eventModule, string $eventName, string $module )
$eventModule string The module that triggers the event.
$eventName string The name of the event.
$module string The module that subscribes to the event.

Property Details

$modules protected static property

Cached modules
protected static array $modules
return array