';
return true;
}
return false;
}
/**
* Update photo number count
*
* @ Since 1.2.2
*/
function updateCount(){
$this->options[$this->src.'_photo_number'] = min( $this->options[$this->src.'_photo_number'], count( $this->results['photos']) );
}
/**
* Get Parent CSS
*
* @ Since 1.2.2
*/
function get_parent_css(){
$opts = $this->options;
$return = 'width:100%;max-width:'.$opts['widget_max_width'].'%;padding:0px;';
if( 'center' == $opts['widget_alignment'] ){ // Optional: Set text alignment (left/right) or center
$return .= 'margin:0px auto;text-align:center;';
}
elseif( 'right' == $opts['widget_alignment'] || 'left' == $opts['widget_alignment'] ){ // Optional: Set text alignment (left/right) or center
$return .= 'float:' . $opts['widget_alignment'] . ';text-align:' . $opts['widget_alignment'] . ';';
}
else{
$return .= 'margin:0px auto;text-align:center;';
}
return $return;
}
/**
* Add Image Function
*
* @ Since 1.2.2
* @ Updated 1.2.4
** Possible change: place original image as 'alt' and load image as needed
*/
function add_image($i,$css="",$pin = false){
$light = $this->get_option( 'general_lightbox' );
$title = $this->photos[$i]['image_title'];
if( $pin ){ $this->out .= ''; }
$onContextMenu = ($this->options['general_disable_right_click']?'onContextMenu="return false;"':'');
$this->out .= '

out .= 'title='."'". $title ."'".' alt='."'". $title ."' "; // Careful about caps with ""
$this->out .= 'border="0" hspace="0" vspace="0" style="'.$css.'" '.$onContextMenu.' />'; // Override the max-width set by theme
if( $pin ){
$this->out .= '
';
$this->out .= '';
$this->out .= '
';
}
}
/**
* Credit Link Function
*
* @ Since 1.2.2
*/
function add_credit_link(){
if( !$this->options['widget_disable_credit_link'] ){
$by_link = '';
$this->out .= $by_link;
}
}
/**
* User Link Function
*
* @ Since 1.2.2
*/
function add_user_link(){
$userlink = $this->results['user_link'];
if($userlink){
if($this->options['widget_alignment'] == 'center'){ // Optional: Set text alignment (left/right) or center
$this->out .= 'out .= 'style="width:100%;margin:0px auto;">'.$userlink.'
';
}
else{
$this->out .= 'out .= 'style="float:'.$this->options['widget_alignment'].';max-width:'.$this->options['widget_max_width'].'%;">
'.$userlink.'';
$this->out .= ''; // Only breakline if floating
}
}
}
/**
* Setup Lightbox Call
*
* @ Since 1.2.3
* @ Updated 1.2.4
*/
function add_lightbox_call(){
if( "fancybox" == $this->options[$this->src.'_image_link_option'] ){
$this->out .= '';
}
}
/**
* Get Lightbox Call
*
* @ Since 1.2.3
* @ Updated 1.2.4
*/
function get_lightbox_call(){
$this->set_lightbox_rel();
$lightbox = $this->get_option('general_lightbox');
$lightbox_style = $this->get_option('general_lightbox_params');
$lightbox_style = str_replace( array("{","}"), "", $lightbox_style);
$setRel = 'jQuery( "#'.$this->wid.'-AlpinePhotoTiles_container a.AlpinePhotoTiles-lightbox" ).attr( "rel", "'.$this->rel.'" );';
if( 'fancybox' == $lightbox ){
$default = 'titleShow: false, overlayOpacity: .8, overlayColor: "#000", titleShow: true, titlePosition: "inside"';
$lightbox_style = ($lightbox_style? $default.','.$lightbox_style : $default );
return $setRel.'if(jQuery().fancybox){jQuery( "a[rel^=\''.$this->rel.'\']" ).fancybox( { '.$lightbox_style.' } );}';
}elseif( 'prettyphoto' == $lightbox ){
//theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook
$default = 'theme:"facebook",social_tools:false, show_title:true';
$lightbox_style = ($lightbox_style? $default.','.$lightbox_style : $default );
return $setRel.'if(jQuery().prettyPhoto){jQuery( "a[rel^=\''.$this->rel.'\']" ).prettyPhoto({ '.$lightbox_style.' });}';
}elseif( 'colorbox' == $lightbox ){
$default = 'maxHeight:"85%"';
$lightbox_style = ($lightbox_style? $default.','.$lightbox_style : $default );
return $setRel.'if(jQuery().colorbox){jQuery( "a[rel^=\''.$this->rel.'\']" ).colorbox( {'.$lightbox_style.'} );}';
}elseif( 'alpine-fancybox' == $lightbox ){
$default = 'titleShow: false, overlayOpacity: .8, overlayColor: "#000", titleShow: true, titlePosition: "inside"';
$lightbox_style = ($lightbox_style? $default.','.$lightbox_style : $default );
return $setRel.'if(jQuery().fancyboxForAlpine){jQuery( "a[rel^=\''.$this->rel.'\']" ).fancyboxForAlpine( { '.$lightbox_style.' } );}';
}
return "";
}
/**
* Set Lightbox "rel"
*
* @ Since 1.2.3
*/
function set_lightbox_rel(){
$lightbox = $this->get_option('general_lightbox');
$custom = $this->get_option('hidden_lightbox_custom_rel');
if( $custom && !empty($this->options['custom_lightbox_rel']) ){
$this->rel = $this->options['custom_lightbox_rel'];
$this->rel = str_replace('{rtsq}',']',$this->rel); // Decode right and left square brackets
$this->rel = str_replace('{ltsq}','[',$this->rel);
}elseif( 'fancybox' == $lightbox ){
$this->rel = 'alpine-fancybox-'.$this->wid;
}elseif( 'prettyphoto' == $lightbox ){
$this->rel = 'alpine-prettyphoto['.$this->wid.']';
}elseif( 'colorbox' == $lightbox ){
$this->rel = 'alpine-colorbox['.$this->wid.']';
}else{
$this->rel = 'alpine-fancybox-safemode-'.$this->wid;
}
}
/**
* Function for shuffleing photo feed
*
* @ Since 1.2.4
*/
function randomizeDisplay(){
if( $this->options['photo_feed_shuffle'] && function_exists('shuffle') ){ // Shuffle the results
@shuffle( $this->photos );
}
}
/**
* Function for printing vertical style
*
* @ Since 0.0.1
* @ Updated 1.2.2
*/
function display_vertical(){
$this->out = ""; // Clear any output;
$this->updateCount(); // Check number of images found
$this->randomizeDisplay();
$opts = $this->options;
$this->shadow = ($opts['style_shadow']?'AlpinePhotoTiles-img-shadow':'AlpinePhotoTiles-img-noshadow');
$this->border = ($opts['style_border']?'AlpinePhotoTiles-img-border':'AlpinePhotoTiles-img-noborder');
$this->curves = ($opts['style_curve_corners']?'AlpinePhotoTiles-img-corners':'AlpinePhotoTiles-img-nocorners');
$this->highlight = ($opts['style_highlight']?'AlpinePhotoTiles-img-highlight':'AlpinePhotoTiles-img-nohighlight');
$this->out .= '';
// Align photos
$css = $this->get_parent_css();
$this->out .= '
';
for($i = 0;$i<$opts[$this->src.'_photo_number'];$i++){
$has_link = $this->get_link($i); // Add link
$css = "margin:1px 0 5px 0;padding:0;max-width:100%;";
$pin = $this->get_option( 'pinterest_pin_it_button' );
$this->add_image($i,$css,$pin); // Add image
if( $has_link ){ $this->out .= ''; } // Close link
}
$this->add_credit_link();
$this->out .= '
'; // Close vertical-parent
$this->add_user_link();
$this->out .= '
'; // Close container
$this->out .= '';
$highlight = $this->get_option("general_highlight_color");
$highlight = ($highlight?$highlight:'#64a2d8');
$this->add_lightbox_call();
if( $opts['style_shadow'] || $opts['style_border'] || $opts['style_highlight'] ){
$this->out .= '';
}
}
/**
* Function for printing cascade style
*
* @ Since 0.0.1
* @ Updated 1.2.2
*/
function display_cascade(){
$this->out = ""; // Clear any output;
$this->updateCount(); // Check number of images found
$this->randomizeDisplay();
$opts = $this->options;
$this->shadow = ($opts['style_shadow']?'AlpinePhotoTiles-img-shadow':'AlpinePhotoTiles-img-noshadow');
$this->border = ($opts['style_border']?'AlpinePhotoTiles-img-border':'AlpinePhotoTiles-img-noborder');
$this->curves = ($opts['style_curve_corners']?'AlpinePhotoTiles-img-corners':'AlpinePhotoTiles-img-nocorners');
$this->highlight = ($opts['style_highlight']?'AlpinePhotoTiles-img-highlight':'AlpinePhotoTiles-img-nohighlight');
$this->out .= '';
// Align photos
$css = $this->get_parent_css();
$this->out .= '
';
for($col = 0; $col<$opts['style_column_number'];$col++){
$this->out .= '
';
$this->out .= '
';
for($i = $col;$i<$opts[$this->src.'_photo_number'];$i+=$opts['style_column_number']){
$has_link = $this->get_link($i); // Add link
$css = "margin:1px 0 5px 0;padding:0;max-width:100%;";
$pin = $this->get_option( 'pinterest_pin_it_button' );
$this->add_image($i,$css,$pin); // Add image
if( $has_link ){ $this->out .= ''; } // Close link
}
$this->out .= '
';
}
$this->out .= '
';
$this->add_credit_link();
$this->out .= '
'; // Close cascade-parent
$this->out .= '
';
$this->add_user_link();
// Close container
$this->out .= '
';
$this->out .= '';
$highlight = $this->get_option("general_highlight_color");
$highlight = ($highlight?$highlight:'#64a2d8');
$this->add_lightbox_call();
if( $opts['style_shadow'] || $opts['style_border'] || $opts['style_highlight'] ){
$this->out .= '';
}
}
/**
* Function for printing and initializing JS styles
*
* @ Since 0.0.1
* @ Updated 1.2.2
*/
function display_hidden(){
$this->out = ""; // Clear any output;
$this->updateCount(); // Check number of images found
$this->randomizeDisplay();
$opts = $this->options;
$this->shadow = ($opts['style_shadow']?'AlpinePhotoTiles-img-shadow':'AlpinePhotoTiles-img-noshadow');
$this->border = ($opts['style_border']?'AlpinePhotoTiles-img-border':'AlpinePhotoTiles-img-noborder');
$this->curves = ($opts['style_curve_corners']?'AlpinePhotoTiles-img-corners':'AlpinePhotoTiles-img-nocorners');
$this->highlight = ($opts['style_highlight']?'AlpinePhotoTiles-img-highlight':'AlpinePhotoTiles-img-nohighlight');
$this->out .= '';
// Align photos
$css = $this->get_parent_css();
$this->out .= '
';
$this->out .= '
';
for($i = 0;$i<$opts[$this->src.'_photo_number'];$i++){
$has_link = $this->get_link($i); // Add link
$this->add_image($i); // Add image
// Load original image size
if( "gallery" == $opts['style_option'] && !empty( $this->photos[$i]['image_original'] ) ){
$this->out .= '

';
}
if( $has_link ){ $this->out .= ''; } // Close link
}
$this->out .= '
';
$this->add_credit_link();
$this->out .= '
'; // Close parent
$this->add_user_link();
$this->out .= '
'; // Close container
$disable = $this->get_option("general_loader");
$highlight = $this->get_option("general_highlight_color");
$highlight = ($highlight?$highlight:'#64a2d8');
$this->out .= '';
}
}
?>