array( 'value' => 'classic', 'label' => __( 'Classic' ) ), 'dots' => array( 'value' => 'dots', 'label' => __( 'Dots' ) ), /* 'fullscreen' => array( 'value' => 'fullscreen', 'label' => __( 'Fullscreen' ) ) */ ); if( !empty($alt_stylesheets) ) { foreach($alt_stylesheets as $alt_stylesheet) { $options['design'][$alt_stylesheet] = array( 'value' => $alt_stylesheet, 'label' => $alt_stylesheet ); } } $options['transition'] = array( 'fade' => array( 'value' => 'fade', 'label' => __( 'Fade' ) ), 'flash' => array( 'value' => 'flash', 'label' => __( 'Flash' ) ), 'slide' => array( 'value' => 'slide', 'label' => __( 'Slide' ) ), 'fadeslide' => array( 'value' => 'fadeslide', 'label' => __( 'Fade & Slide' ) ) ); $options['image'] = array( 'medium' => array( 'value' => 'medium', 'label' => __( 'Medium' ) ), 'large' => array( 'value' => 'large', 'label' => __( 'Large' ) ) ); return $options; } /** * Create the options page */ function galleria_galleria_options_do_page() { $defaults = galleria_galleria_default_options(); if ( ! isset( $_REQUEST['updated'] ) ) $_REQUEST['updated'] = false; ?>

/>

jQuery(document).ready(function($){ // Load theme Galleria.loadTheme('" . $design_url . "');\n\t"; // run galleria and add some options echo "$('.galleria-gallery').galleria({ autoplay: " . $autoplay . ", //height: " . $height . ", width: " . $width . ", transition: '" . $transition . "', data_config: function(img) { // will extract and return image captions and titles from the source: return { title: $(img).attr('title'), description: $(img).parents('.gallery-item').find('.gallery-caption').text() }; } }); }); \n"; } function galleria_galleria_css_head() { $galleria_galleria = get_option( 'galleria_galleria' ); $color = $galleria_galleria['color']; $wp_default_sizes = wp_embed_defaults(); $height = $galleria_galleria['height'] ? $galleria_galleria['height'] : $wp_default_sizes['height']; $width = $galleria_galleria['width'] ? $galleria_galleria['width'] : $wp_default_sizes['width']; ?> .galleria-gallery{ width: {$width}px; height: {$height}px;} .galleria-container{background-color:{$color}; } .galleria-galleria-active .galleria-gallery .gallery {display:none;} .galleria-galleria-active .galleria-gallery{background-color:{$color}; } "; } add_action('wp_head','galleria_galleria_css_head'); /** * Lets make new gallery shortcode */ function galleria_galleria_shortcode($attr) { global $add_galleria_scripts; $add_galleria_scripts = true; //change default gallery_shortcode to link to images of a specified size instead of originals add_action('wp_get_attachment_link', 'galleria_galleria_get_attachment_link', 2, 6); //force gallery to link to image files $attr['link'] = 'file'; $style = ''; if( isset( $attr['height'] ) && $height = intval( $attr['height'] ) ) { $style = "style='height:{$height}px;'"; } $content = "'; //remove our action to avoid changing this behavior for others remove_action('wp_get_attachment_link', 'galleria_galleria_get_attachment_link', 2, 6); return $content; } function galleria_galleria_get_attachment_link($content, $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) { $galleria_galleria = get_option( 'galleria_galleria' ); $id = intval($id); $_post = & get_post( $id ); if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_image_src($_post->ID, $galleria_galleria['image']) ) { return __('Missing Attachment'); } else { $url = $url[0]; } if ( $permalink ) $url = get_attachment_link($_post->ID); $post_title = esc_attr($_post->post_title); if ( $text ) { $link_text = esc_attr($text); } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) { $link_text = wp_get_attachment_image($id, $size, $icon); } else { $link_text = ''; } if( trim($link_text) == '' ) $link_text = $_post->post_title; return apply_filters( 'galleria_galleria_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text ); } function galleria_galleria_init() { // Remove original wp gallery shortcode remove_shortcode('gallery'); // Add our new shortcode with galleria markup add_shortcode('gallery', 'galleria_galleria_shortcode'); } add_action('init', 'galleria_galleria_init'); function galleria_galleria_plugin_action_links($links, $file) { static $this_plugin; if (!$this_plugin) { $this_plugin = plugin_basename(__FILE__); } if ($file == $this_plugin) { // The "page" query string value must be equal to the slug // of the Settings admin page we defined earlier $settings_link = 'Settings'; array_push($links, $settings_link); } return $links; } add_filter('plugin_action_links', 'galleria_galleria_plugin_action_links', 10, 2); ?>