Manages the markup for a generic set of images Extend this with your nice and candy classes!

author etessore
version 1.0.2
package classes
subpackage image manager
todo remove using of FeatureWithAssets

 Methods

Adds an image to the current set

add_image(string | int $img) : \GalleryHelper

Parameters

$img

stringint

the image: if is an int it will be retrieved from the wp media, elsewhere it is an html tag

Returns

\GalleryHelper$this for chainability

Add some images to the current set

add_images(array $images) : \GalleryHelper

Parameters

$images

array

the list of images to be added

Returns

\GalleryHelper$this for chainability

Calculates the unique id for the current gallery

calculate_unique() : \GalleryHelper

Returns

\GalleryHelper$this for chainability

Search the media gallery for suitable images.

get_images() 

This is the order: Check if current post has attached images Check the default language if has attached images Check if frontpage has attached images Check if frontpage has attached images in default language Build a placeholder

Gets images from the first post marked as 'hotel' by HotelManager

get_images_from_closest_hotel() : \Ambigous
Static

Returns

\Ambigous >

Gets images from the first post marked as 'hotel' by HotelManager in default language

get_images_from_closest_hotel_in_default_language() : \Ambigous
Static

Returns

\Ambigous >

Gets images attached to the frontpage

get_images_from_frontpage() 
Static

Gets images attached to the frontpage in default language translation

get_images_from_homepage_in_default_language() : \Ambigous
Static

Returns

\Ambigous >

Get the images from the main language translation of the post

get_images_from_main_language(int $post_id) : \Ambigous
Static

Uses WPML to retrieve the post translation in default language and queries it for attached images.

uses \icl_object_id()

Parameters

$post_id

int

the post id you want to search for

Returns

\Ambigous >

Get the images attached to a post

get_images_from_post(array $args) : \Ambigous
Static

Parameters

$args

array

Returns

\Ambigous >

Retrieves the markup for the current gallery

get_markup() : \the

Returns

\themarkup for the current gallery

Check if the current gallery has one or more images

has_images() : boolean

Useful to check if jquery.cycle() is needed

Returns

booleantrue if there is at least two image

Checks if the current gallery has more no images

is_empty() : boolean

Returns

booleantrue if there is no image in the current set

Set the maximum number of images to show

limit_images_number(int $number) : \GalleryHelper

Parameters

$number

int

the number

Returns

\GalleryHelper$this for chainability

Replaces the markup in $this->tpl %tag%s with the one in the corresponding value of $this->static_markup[tag].

replace_markup() 

Set the static markup; ie: prev\next\loading divs

set_markup(string $key, string $markup) : \GalleryHelper

Parameters

$key

string

the string has to be substituted

$markup

string

html markup

Returns

\GalleryHelper$this for chainability

Set the html template for this gallery

set_template(string $tpl) : \GalleryHelper

Parameters

$tpl

string

the template

Returns

\GalleryHelper$this for chainability

Set the timthumb options If set_wp_media_dimension() is called it will prevale on this.

set_timthumb_options(array $options) 

Parameters

$options

array

Set the unique id for this gallery

set_uid(string $unid) : \GalleryHelper

Parameters

$unid

string

the unique

Returns

\GalleryHelper$this for chainability

Sets the dimension for this gallery.

set_wp_media_dimension(string $dimension) : \GalleryHelper

If set this option will prevale on timthumb

Parameters

$dimension

string

WordPress media dimension name

Returns

\GalleryHelper$this for chainability

Echoes the markup for the current gallery

the_markup() 

Checks if the $index image of the list is a wordpress media id or an image object

get_image_alt(int $index) 
returns the alt attribute for the $index image of the set

Parameters

$index

int

the index of the images list

Checks if the $index image of the list is a wordpress media id or an image object

get_image_caption(int $index) 
returns the caption for the $index image of the set

Parameters

$index

int

the index of the images list

Checks if the $index image of the list is a wordpress media id or an image object

get_image_description(int $index) 
returns the description for the $index image of the set

Parameters

$index

int

the index of the images list

Get the height for the n-th image of the list

get_image_height(int $index) 

Parameters

$index

int

the index of the images list

Checks if the $index image of the list is a wordpress media id or an image object

get_image_id(int $index) 
returns the id attribute for the $index image of the set

Parameters

$index

int

the index of the images list

Retrieves the path for the given image If it is an external image it returns the src attributes

get_image_path(int $index) : string

Parameters

$index

int

the index of the images list

Returns

stringpath to disc

Checks if the $index image of the list is a wordpress media id or an image object

get_image_src(int $index) 
returns the src attribute for the $index image of the set

Parameters

$index

int

the index of the images list

Retrieves the title for the image with given index

get_image_title(int $index) 
returns the title attribute for the $index image of the set

Parameters

$index

int

the index of the images list

Get the width for the n-th image of the list

get_image_width(int $index) 

Parameters

$index

int

the index of the images list

 Properties

 

the maximum number of images to show

$image_number : int
 

the list of images

$images : array
 

WordPress media size name

$media_dimension : string
 

Stores some static html

$static_markup : array
 

options for timthumb

$timthumb_opts : array
 

the html template

$tpl : String
 

the unique id for the current gallery it will be automatically created if not specified

$unid : string