Manages images and markup for a photogallery where clicking on a little thumb opens the big image in fancybox

It takes care of loading jQuery Fancybox if registered

author etessore
version 1.0.1
package classes
subpackage image manager

 Methods

Initializes the photogallery

__construct() 

Adds an image to the current set

add_image(string | int $img) : \GalleryHelper
Inherited
inherited_from \GalleryHelper::add_image()

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
Inherited
inherited_from \GalleryHelper::add_images()

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
Inherited
inherited_from \GalleryHelper::calculate_unique()

Returns

\GalleryHelper$this for chainability

Search the media gallery for suitable images.

get_images() 
Inherited

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

inherited_from \GalleryHelper::get_images()

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

get_images_from_closest_hotel() : \Ambigous
InheritedStatic
inherited_from \GalleryHelper::get_images_from_closest_hotel()

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
InheritedStatic
inherited_from \GalleryHelper::get_images_from_closest_hotel_in_default_language()

Returns

\Ambigous >

Gets images attached to the frontpage

get_images_from_frontpage() 
InheritedStatic
inherited_from \GalleryHelper::get_images_from_frontpage()

Gets images attached to the frontpage in default language translation

get_images_from_homepage_in_default_language() : \Ambigous
InheritedStatic
inherited_from \GalleryHelper::get_images_from_homepage_in_default_language()

Returns

\Ambigous >

Get the images from the main language translation of the post

get_images_from_main_language(int $post_id) : \Ambigous
InheritedStatic

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

uses \icl_object_id()
inherited_from \GalleryHelper::get_images_from_main_language()

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
InheritedStatic
inherited_from \GalleryHelper::get_images_from_post()

Parameters

$args

array

Returns

\Ambigous >

(non-PHPdoc)

get_markup() : \the
see \GalleryHelper::get_markup()

Returns

\themarkup for the current gallery

Check if the current gallery has one or more images

has_images() : boolean
Inherited

Useful to check if jquery.cycle() is needed

inherited_from \GalleryHelper::has_images()

Returns

booleantrue if there is at least two image

Checks if the current gallery has more no images

is_empty() : boolean
Inherited
inherited_from \GalleryHelper::is_empty()

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
Inherited
inherited_from \GalleryHelper::limit_images_number()

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() 
Inherited
inherited_from \GalleryHelper::replace_markup()

Sets the number of images per row

set_images_per_row(int $images_per_row) : \PhotogalleryThumbWithFancybox

Parameters

$images_per_row

int

a number

Returns

\PhotogalleryThumbWithFancybox$this for chainability

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

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

Parameters

$key

string

the string has to be substituted

$markup

string

html markup

Returns

\GalleryHelper$this for chainability

Set the class for single image container

set_single_image_container_class(string $class) : \PhotogalleryThumbWithFancybox

Parameters

$class

string

the class

Returns

\PhotogalleryThumbWithFancybox$this for chainability

Sets the images sizes: array('w'=>xxx, 'h'=>yyy)

set_sizes(array $sizes) : \PhotogalleryThumbWithFancybox

Parameters

$sizes

array

Returns

\PhotogalleryThumbWithFancybox$this for chainability

Set the html template for this gallery

set_template(string $tpl) : \GalleryHelper
Inherited
inherited_from \GalleryHelper::set_template()

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) 
Inherited
inherited_from \GalleryHelper::set_timthumb_options()

Parameters

$options

array

Set the unique id for this gallery

set_uid(string $unid) : \GalleryHelper
Inherited
inherited_from \GalleryHelper::set_uid()

Parameters

$unid

string

the unique

Returns

\GalleryHelper$this for chainability

Sets the dimension for this gallery.

set_wp_media_dimension(string $dimension) : \GalleryHelper
Inherited

If set this option will prevale on timthumb

inherited_from \GalleryHelper::set_wp_media_dimension()

Parameters

$dimension

string

WordPress media dimension name

Returns

\GalleryHelper$this for chainability

Echoes the markup for the current gallery

the_markup() 
Inherited
inherited_from \GalleryHelper::the_markup()

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

get_image_alt(int $index) 
Inherited
returns the alt attribute for the $index image of the set
inherited_from \GalleryHelper::get_image_alt()

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) 
Inherited
returns the caption for the $index image of the set
inherited_from \GalleryHelper::get_image_caption()

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) 
Inherited
returns the description for the $index image of the set
inherited_from \GalleryHelper::get_image_description()

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) 
Inherited
inherited_from \GalleryHelper::get_image_height()

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) 
Inherited
returns the id attribute for the $index image of the set
inherited_from \GalleryHelper::get_image_id()

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
Inherited
inherited_from \GalleryHelper::get_image_path()

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) 
Inherited
returns the src attribute for the $index image of the set
inherited_from \GalleryHelper::get_image_src()

Parameters

$index

int

the index of the images list

Retrieves the title for the image with given index

get_image_title(int $index) 
Inherited
returns the title attribute for the $index image of the set
inherited_from \GalleryHelper::get_image_title()

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) 
Inherited
inherited_from \GalleryHelper::get_image_width()

Parameters

$index

int

the index of the images list

 Properties

 

the maximum number of images to show

$image_number : int
Inherited
inherited_from \GalleryHelper::$$image_number
 

the list of images

$images : array
Inherited
inherited_from \GalleryHelper::$$images
 

$images_per_row : int
 

WordPress media size name

$media_dimension : string
Inherited
inherited_from \GalleryHelper::$$media_dimension
 

$single_image_container_class : string
 

stores the sizes of the images

$sizes : array
 

Stores some static html

$static_markup : array
Inherited
inherited_from \GalleryHelper::$$static_markup
   

options for timthumb

$timthumb_opts : array
Inherited
inherited_from \GalleryHelper::$$timthumb_opts
 

the html template

$tpl : String
Inherited
inherited_from \GalleryHelper::$$tpl
 

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

$unid : string
Inherited
inherited_from \GalleryHelper::$$unid