PHP Class Artesaos\SEOTools\OpenGraph

Inheritance: implements Artesaos\SEOTools\Contracts\OpenGraph
Datei anzeigen Open project: artesaos/seotools

Protected Properties

Property Type Description
$articleProperties array Array of Article Properties.
$audioProperties array Array of Audio Properties.
$bookProperties array Array of Book Properties.
$config array Config.
$images array Array of Image Properties.
$musicAlbumProperties array Array of Music Album Properties.
$musicPlaylistProperties array Array of Music Playlist Properties.
$musicRadioStationProperties array Array of Music Radio Properties.
$musicSongProperties array Array of Music Song Properties.
$og_prefix string OpenGraph Prefix.
$profileProperties array Array of Profile Properties.
$properties array Array of Properties.
$videoEpisodeProperties array Array of Video Episode Properties.
$videoMovieProperties array Array of Video Movie Properties.
$videoOtherProperties array Array of Video Other Properties.
$videoProperties array Array of Video Properties.
$videoTVShowProperties array Array of Video TV Show Properties.

Public Methods

Method Description
__construct ( array $config = [] ) : void Create a new OpenGraph instance.
addAudio ( string $source = null, array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Add audio properties.
addImage ( mixed $source = null, array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Add image to properties.
addImages ( array $urls ) : Artesaos\SEOTools\Contracts\OpenGraph Add images to properties.
addProperty ( string $key, string | array $value ) : Artesaos\SEOTools\Contracts\OpenGraph Add or update property.
addVideo ( string $source = null, array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Add video properties.
generate ( boolean $minify = false ) : string Generates open graph tags.
removeProperty ( string $key ) : Artesaos\SEOTools\Contracts\OpenGraph Remove property.
setArticle ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set article properties.
setBook ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set book properties.
setDescription ( string $description = null ) : Artesaos\SEOTools\Contracts\OpenGraph Define description property.
setMusicAlbum ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set music album properties.
setMusicPlaylist ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set music playlist properties.
setMusicRadioStation ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set music radio station properties.
setMusicSong ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set music song properties.
setProfile ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set profile properties.
setSiteName ( string $name ) : Artesaos\SEOTools\Contracts\OpenGraph Define site_name property.
setTitle ( string $title = null ) : Artesaos\SEOTools\Contracts\OpenGraph Define title property.
setType ( string $type = null ) : Artesaos\SEOTools\Contracts\OpenGraph Define type property.
setUrl ( string $url ) : Artesaos\SEOTools\Contracts\OpenGraph Define url property.
setVideoEpisode ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set video episode properties.
setVideoMovie ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set video movie properties.
setVideoOther ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set video episode properties.
setVideoTVShow ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph Set video episode properties.

Protected Methods

Method Description
cleanProperties ( array $attributes = [], array $validKeys = [] ) : array Clean invalid properties.
eachProperties ( array $properties, null | string $prefix = null, boolean $ogPrefix = true ) : string Make list of open graph tags.
makeTag ( string $key = null, string $value = null, boolean $ogPrefix = false ) : string Make a og tag.
setProperties ( string $type = null, string $key = null, array $attributes = [], array $validKeys = [] ) : void Set properties.
setupDefaults ( ) : void Add or update property.

Method Details

__construct() public method

Create a new OpenGraph instance.
public __construct ( array $config = [] ) : void
$config array config
return void

addAudio() public method

Add audio properties.
public addAudio ( string $source = null, array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$source string url for audio source
$attributes array opengraph audio attributes
return Artesaos\SEOTools\Contracts\OpenGraph

addImage() public method

Add image to properties.
public addImage ( mixed $source = null, array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$source mixed URL of image source
$attributes array Object type attributes
return Artesaos\SEOTools\Contracts\OpenGraph

addImages() public method

Add images to properties.
public addImages ( array $urls ) : Artesaos\SEOTools\Contracts\OpenGraph
$urls array array of image urls
return Artesaos\SEOTools\Contracts\OpenGraph

addProperty() public method

Add or update property.
public addProperty ( string $key, string | array $value ) : Artesaos\SEOTools\Contracts\OpenGraph
$key string key of property
$value string | array value of property
return Artesaos\SEOTools\Contracts\OpenGraph

addVideo() public method

Add video properties.
public addVideo ( string $source = null, array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$source string url of video source
$attributes array opengraph video attributes
return Artesaos\SEOTools\Contracts\OpenGraph

cleanProperties() protected method

Clean invalid properties.
protected cleanProperties ( array $attributes = [], array $validKeys = [] ) : array
$attributes array attributes input
$validKeys array keys that are allowed
return array

eachProperties() protected method

Make list of open graph tags.
protected eachProperties ( array $properties, null | string $prefix = null, boolean $ogPrefix = true ) : string
$properties array array of properties
$prefix null | string prefix of property
$ogPrefix boolean opengraph prefix
return string

generate() public method

Generates open graph tags.
public generate ( boolean $minify = false ) : string
$minify boolean
return string

makeTag() protected method

Make a og tag.
protected makeTag ( string $key = null, string $value = null, boolean $ogPrefix = false ) : string
$key string meta property key
$value string meta property value
$ogPrefix boolean opengraph prefix
return string

removeProperty() public method

Remove property.
public removeProperty ( string $key ) : Artesaos\SEOTools\Contracts\OpenGraph
$key string key
return Artesaos\SEOTools\Contracts\OpenGraph

setArticle() public method

Set article properties.
public setArticle ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph article attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setBook() public method

Set book properties.
public setBook ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph book attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setDescription() public method

Define description property.
public setDescription ( string $description = null ) : Artesaos\SEOTools\Contracts\OpenGraph
$description string set the opengraph description
return Artesaos\SEOTools\Contracts\OpenGraph

setMusicAlbum() public method

Set music album properties.
public setMusicAlbum ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph music.album attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setMusicPlaylist() public method

Set music playlist properties.
public setMusicPlaylist ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph music.playlist attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setMusicRadioStation() public method

Set music radio station properties.
public setMusicRadioStation ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph music.radio_station attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setMusicSong() public method

Set music song properties.
public setMusicSong ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph music.song attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setProfile() public method

Set profile properties.
public setProfile ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph profile attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setProperties() protected method

Set properties.
protected setProperties ( string $type = null, string $key = null, array $attributes = [], array $validKeys = [] ) : void
$type string type of og:type
$key string variable key
$attributes array inputted opengraph attributes
$validKeys array valid opengraph attributes
return void

setSiteName() public method

Define site_name property.
public setSiteName ( string $name ) : Artesaos\SEOTools\Contracts\OpenGraph
$name string set the site_name
return Artesaos\SEOTools\Contracts\OpenGraph

setTitle() public method

Define title property.
public setTitle ( string $title = null ) : Artesaos\SEOTools\Contracts\OpenGraph
$title string set the opengraph title
return Artesaos\SEOTools\Contracts\OpenGraph

setType() public method

Define type property.
public setType ( string $type = null ) : Artesaos\SEOTools\Contracts\OpenGraph
$type string set the opengraph type
return Artesaos\SEOTools\Contracts\OpenGraph

setUrl() public method

Define url property.
public setUrl ( string $url ) : Artesaos\SEOTools\Contracts\OpenGraph
$url string set the opengraph url
return Artesaos\SEOTools\Contracts\OpenGraph

setVideoEpisode() public method

Set video episode properties.
public setVideoEpisode ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph video.episode attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setVideoMovie() public method

Set video movie properties.
public setVideoMovie ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph video.movie attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setVideoOther() public method

Set video episode properties.
public setVideoOther ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph video.other attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setVideoTVShow() public method

Set video episode properties.
public setVideoTVShow ( array $attributes = [] ) : Artesaos\SEOTools\Contracts\OpenGraph
$attributes array opengraph video.tv_show attributes
return Artesaos\SEOTools\Contracts\OpenGraph

setupDefaults() protected method

Add or update property.
protected setupDefaults ( ) : void
return void

Property Details

$articleProperties protected_oe property

Array of Article Properties.
protected array $articleProperties
return array

$audioProperties protected_oe property

Array of Audio Properties.
protected array $audioProperties
return array

$bookProperties protected_oe property

Array of Book Properties.
protected array $bookProperties
return array

$config protected_oe property

Config.
protected array $config
return array

$images protected_oe property

Array of Image Properties.
protected array $images
return array

$musicAlbumProperties protected_oe property

Array of Music Album Properties.
protected array $musicAlbumProperties
return array

$musicPlaylistProperties protected_oe property

Array of Music Playlist Properties.
protected array $musicPlaylistProperties
return array

$musicRadioStationProperties protected_oe property

Array of Music Radio Properties.
protected array $musicRadioStationProperties
return array

$musicSongProperties protected_oe property

Array of Music Song Properties.
protected array $musicSongProperties
return array

$og_prefix protected_oe property

OpenGraph Prefix.
protected string $og_prefix
return string

$profileProperties protected_oe property

Array of Profile Properties.
protected array $profileProperties
return array

$properties protected_oe property

Array of Properties.
protected array $properties
return array

$videoEpisodeProperties protected_oe property

Array of Video Episode Properties.
protected array $videoEpisodeProperties
return array

$videoMovieProperties protected_oe property

Array of Video Movie Properties.
protected array $videoMovieProperties
return array

$videoOtherProperties protected_oe property

Array of Video Other Properties.
protected array $videoOtherProperties
return array

$videoProperties protected_oe property

Array of Video Properties.
protected array $videoProperties
return array

$videoTVShowProperties protected_oe property

Array of Video TV Show Properties.
protected array $videoTVShowProperties
return array