PHP Class Embera\Embera

Exibir arquivo Open project: mpratt/embera Class Usage Examples

Protected Properties

Property Type Description
$config Configuration Settings
$errors Fetched errors
$oembed Instance of \Embera\Oembed
$providers Instance of \Embera\Providers
$urlEmbedRegex The pattern used to extract urls from a text when the embed:// prefix option is enabled
$urlRegex The pattern used to extract urls from a text

Public Methods

Method Description
__construct ( array $config = [] ) : void Constructs the object and also instantiates the \Embera\Oembed Object and stores it into the $oembed properoty
addProvider ( string $host, string | object $class, array $params = [] ) : void Adds a new Provider into the service map
autoEmbed ( string $body = null ) : string Embeds known/available services into the given text.
getErrors ( ) : array Returns an array with all the errors
getLastError ( ) : string Gets the last error found
getUrlInfo ( string | array $body = null ) : array Finds all the information about a url (or a collection of urls)
hasErrors ( ) : boolean Checks if there were errors

Protected Methods

Method Description
clean ( array $services = [] ) : array Strips invalid providers from the list
getProviders ( null | string | array $body = '' ) : array Finds all the valid urls inside the given text, compares which are allowed and returns an array with the detected providers

Method Details

__construct() public method

Constructs the object and also instantiates the \Embera\Oembed Object and stores it into the $oembed properoty
public __construct ( array $config = [] ) : void
$config array
return void

addProvider() public method

Adds a new Provider into the service map
public addProvider ( string $host, string | object $class, array $params = [] ) : void
$host string The host for the map
$class string | object The class or object that should manage the provider
$params array Custom parameters that should be sent in the url for this Provider
return void

autoEmbed() public method

Embeds known/available services into the given text.
public autoEmbed ( string $body = null ) : string
$body string
return string

clean() protected method

Strips invalid providers from the list
protected clean ( array $services = [] ) : array
$services array
return array

getErrors() public method

Returns an array with all the errors
public getErrors ( ) : array
return array

getLastError() public method

Gets the last error found
public getLastError ( ) : string
return string

getProviders() protected method

Finds all the valid urls inside the given text, compares which are allowed and returns an array with the detected providers
protected getProviders ( null | string | array $body = '' ) : array
$body null | string | array An array or string with Urls
return array

getUrlInfo() public method

Finds all the information about a url (or a collection of urls)
public getUrlInfo ( string | array $body = null ) : array
$body string | array An array or string with urls
return array

hasErrors() public method

Checks if there were errors
public hasErrors ( ) : boolean
return boolean

Property Details

$config protected_oe property

Configuration Settings
protected $config

$errors protected_oe property

Fetched errors
protected $errors

$oembed protected_oe property

Instance of \Embera\Oembed
protected $oembed

$providers protected_oe property

Instance of \Embera\Providers
protected $providers

$urlEmbedRegex protected_oe property

The pattern used to extract urls from a text when the embed:// prefix option is enabled
protected $urlEmbedRegex

$urlRegex protected_oe property

The pattern used to extract urls from a text
protected $urlRegex