'featured-gallery', 'description' => _a('Photo gallery showcase'));
$control_ops = array('width' => 500);
$this->WP_Widget('atom-featured-gallery', _a('Featured Gallery'), $widget_ops, $control_ops);
// include in jQuery(document).ready()
atom_add('jquery_init', array(&$this, 'js'));
atom_add('feature_galleries', array(&$this, 'flush_cache'));
//add_action('save_post', array(&$this, 'flush_cache'));
//add_action('deleted_post', array(&$this, 'flush_cache'));
}
function flush_cache(){
wp_cache_delete('widget_featured_gallery', 'widget');
}
function js(){
// we need to process all instances because this function gets to run only once
$widget_settings = atom_get_options($this->option_name);
foreach((array)$widget_settings as $instance => $options):
// identify instance
$id = "{$this->id_base}-{$instance}";
$block_id = "instance-{$id}";
if(is_active_widget(false, $id, $this->id_base)): ?>
$("# .featured-gallery .cycle").cycle({
fx: '',
speed: ,
pause: true,
prev: '# .featured-gallery a.prev',
next: '# .featured-gallery a.next',
easing: '',
timeout:
});
$('# .featured-gallery li').hover(function(){
$('.caption', this).stop().animate({bottom:'0px',opacity:1},{queue:false,duration:200,easing:'easeOutExpo'});
}, function() {
$('.caption', this).stop().animate({bottom:'-70px',opacity:0},{queue:false,duration:300,easing:'easeInExpo'});
});
post_excerpt));
if(empty($alt)) $alt = trim(strip_tags($attachment->post_title));
$attr = array(
'src' => $src,
'class' => "photo",
'alt' => $alt,
);
// show titles only if captions are disabled
if(!$captions) $attr['title'] = trim(strip_tags($attachment->post_title));
$attr = apply_filters('wp_get_attachment_image_attributes', $attr, $attachment);
$attr = array_map('esc_attr', $attr);
$html = rtrim(" $value) $html .= " {$name}=\"{$value}\"";
$html .= ' />';
$caption = empty($attachment->post_content) ? $attachment->post_excerpt : $attachment->post_content;
if($link == 'post' && ($parent = get_post_field('post_parent', $id))) $link = get_permalink($parent);
elseif($link == 'image' && is_array($src = wp_get_attachment_image_src($id, 'full'))) $link = $src[0];
else $link = '';
if($link) $html = ''.$html.'';
if($captions && !empty($caption))
$html .= '
'.atom_filter_content($caption, array( 'limit' => 50, 'allowed_tags' => array('a', 'abbr', 'acronym', 'b', 'cite', 'code', 'del', 'dfn', 'em', 'i', 'ins', 'q', 'strong', 'sub', 'sup'), 'more' => '[...]', )).'
get_field_id('timeframe').'" name="'.$this->get_field_name('timeframe').'" type="text" value="'.(isset($instance['timeframe']) ? intval($instance['timeframe']) : null).'" size="3" />'; ?>
get_field_id('delay').'" name="'.$this->get_field_name('delay').'" type="text" value="'.(isset($instance['delay']) ? intval($instance['delay']) : null).'" size="3" />'; ?>