\PSV_Shortcode

The shortcode class. Loads and registers our plugin's shortcode.

Summary

Methods
Properties
Constants
get_instance()
__construct()
init()
output()
$atts
$split_view
$html
No constants found
prepare()
build()
get_view()
content()
post()
youtube()
image()
insert_content()
$instance
N/A
No private methods found
No private properties found
N/A

Properties

$atts

$atts : array

Holds the shortcode attributes

Type

array

$split_view

$split_view : array

Holds the options for each split view

Type

array

$html

$html : string

Holds HTML string for this shortcode

Type

string

$instance

$instance : object

Plugin instance.

Type

object

Methods

get_instance()

get_instance() : object

Access this plugin’s working instance

Returns

object —

instance of this class

__construct()

__construct()

Intentionally left blank.

init()

init(array $atts) : string

Initiate our class. Gets shortcode atts and if id exists it builds our object and split view. Ohterwise, it retunrs an error message saying that the id is required.

Parameters

array $atts

array of attributes for the shortcode.

Returns

string —

html for the split view or error message

output()

output() : string

Output the shortcode

Returns

string —

the shortcode's html

prepare()

prepare()

Gets the split view data and builds the view if data not empty

build()

build() : string

Builds the split view

Returns

string —

html for split view

get_view()

get_view(string $side) : string

Get each view. Left or Right side.

Parameters

string $side

left or right. determines which side to get.

Returns

string —

html for one side.

content()

content(array $view) : string

Get content depending on the type

Parameters

array $view

left or right view data ( type => content ).

Returns

string —

html for content

post()

post(string|int $id) : string

Returns the content for a post

Parameters

string|int $id

id of post to retreive.

Returns

string —

html for content. or empty string

youtube()

youtube(string $video) : string

Get a youtube video

Parameters

string $video

video id.

Returns

string —

html for video

image()

image(string $url) : string

Get an image

Parameters

string $url

url for image.

Returns

string —

div with image as background

insert_content()

insert_content( $content)

Parameters

$content