Manages the integration of the special offers snippet

author etessore
version 1.0.4
package classes

 Methods

Initializes the snippet

__construct(string $hid) 

Parameters

$hid

string

the hotel hid

Adds a new parameter or update if exists

add_param(string $key, int | string $value) : \SpecialOffersSnippet

Parameters

$key

string

$value

intstring

Returns

\SpecialOffersSnippet$this for chainability

Builds the url for the remote iframe

calculate_url(array $params) 
Static

Parameters

$params

array

additional query params for the iframe

Removes a param

del_param(string $key) : \SpecialOffersSnippet

Parameters

$key

string

the param to be deleted

Returns

\SpecialOffersSnippet$this for chainability

Disables the offers to cycle

disable_cycle() : \SpecialOffersSnippet

Returns

\SpecialOffersSnippet$this for chainability

Enables the offers to cycle

enable_cycle() : \SpecialOffersSnippet

Returns

\SpecialOffersSnippet$this for chainability

Uses Fancybox instead of the default popup system

enable_fancybox() : \SpecialOffersSnippet

Returns

\SpecialOffersSnippet$this for chainability

Retrieves the src of the iframe

get_iframe_src() : string

Returns

stringthe url

Retrieves the markup for the offers

get_markup() 

Retrives the $key param for this snippet

get_param(string $key) 

Parameters

$key

string

name of the parameter

Adds 3 controls: nex pause\play and prev.

show_controls(string $markup) : \SpecialOffersSnippet

Parameters

$markup

string

Returns

\SpecialOffersSnippet$this for chainability

Prints the iframe src

the_iframe_src() 

Prints the markup for the offers

the_markup() 

Retrieves the script tag for com.js

get_com_js() : string

Checks if is the first implementation, otherwhise it will return an empty string

Returns

stringhtml script tag to com.js

Calculates the divdest for the current iframe integration First time it will be self::default_divdest For the other an "_<number>" will be appended If the parameter divdest is customized it will return that one

get_divdest() 

Gets the pop.js for the 'ugly pop-up' feature

get_pop_js() : string

Returns

string

Retrieves the script for initialize the snippet system

get_promo_js() : string

Returns

stringhtml script tag

Retrieves the url from array $url_arr If defined use http_build_url, else custom code

build_url(array $url_arr) 
Static
see \http://php.net/manual/en/function.parse-url.php

Parameters

$url_arr

array

the array of attributes

 Properties

 

the index of snippet occurency

$index : int
 

stores the list of parameter to be passed on GET

$params : array
 

the template to be substituted

$templates : \SubstitutionTemplate
 

stores the url of the snippet

$url : string

 Constants

 

baseurl

baseurl 
 

com_js

com_js 
 

default_divdest

default_divdest 
 

pop_js

pop_js