WordPress.org

Plugin Directory

Changeset 368920


Ignore:
Timestamp:
04/05/11 03:59:12 (3 years ago)
Author:
gluten
Message:

Added ability to add custom galleria themes.

Location:
galleria-galleria/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • galleria-galleria/trunk/galleria-galleria.php

    r368919 r368920  
    44Plugin URI: https://github.com/samargulies/galleria-galleria/ 
    55Description: Transform standard WordPress galleries into galleria slideshows. 
    6 Version: 0.1.1 
     6Version: 0.2 
    77Author: Sam Margulies 
    88Author URI:  
    9 License: GPL 
     9License: GPLv2 
    1010 
    1111. 
     
    2828define ( 'GALLERIA_GALLERIA_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename(__FILE__) ) ); 
    2929define ( 'GALLERIA_GALLERIA_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename(__FILE__) ) ); 
     30define ( 'GALLERIA_GALLERIA_USER_THEME_DIR',  '/galleria-themes/' ); 
    3031 
    3132/** 
     
    4243} 
    4344add_action( 'admin_init', 'galleria_galleria_options_init' ); 
     45 
    4446/** 
    4547 * Load up the menu page 
     
    115117function galleria_galleria_default_options() { 
    116118 
     119    //Stylesheets Reader 
     120    $alt_stylesheets = array(); 
     121    $alt_stylesheets_path = get_stylesheet_directory() . GALLERIA_GALLERIA_USER_THEME_DIR; 
     122    if ( is_dir($alt_stylesheets_path) ) { 
     123        if ($alt_stylesheet_dir = opendir($alt_stylesheets_path) ) {  
     124            while ( ($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false ) { 
     125                if( stristr($alt_stylesheet_file, ".js") !== false) { 
     126                    $alt_stylesheets[] = $alt_stylesheet_file; 
     127                } 
     128            }     
     129        } 
     130    } 
     131     
    117132    $options['design'] = array( 
    118133        'classic' => array( 
     
    131146    */ 
    132147    ); 
     148     
     149    if( !empty($alt_stylesheets) ) { 
     150        foreach($alt_stylesheets as $alt_stylesheet) { 
     151            $options['design'][$alt_stylesheet] = array( 
     152                'value' =>  $alt_stylesheet, 
     153                'label' => $alt_stylesheet 
     154            ); 
     155        } 
     156    } 
    133157     
    134158    $options['transition'] = array( 
     
    380404     
    381405    $design = $galleria_galleria['design']; 
    382         if ($design == 'classic' || $design == '') { 
    383                 $design = GALLERIA_GALLERIA_PLUGIN_URL . '/galleria-themes/classic/galleria.classic.min.js';} 
    384             elseif ($design == 'dots') { 
    385                 $design = GALLERIA_GALLERIA_PLUGIN_URL . '/galleria-themes/dots/galleria.dots.min.js';} 
    386             elseif ($design == 'fullscreen') { 
    387                 $design = GALLERIA_GALLERIA_PLUGIN_URL . '/galleria-themes/fullscreen/galleria.fullscreen.js';} 
     406        if( $design == 'classic' || $design == '' ) { 
     407                $design = GALLERIA_GALLERIA_PLUGIN_URL . '/galleria-themes/classic/galleria.classic.min.js'; 
     408        } else if( $design == 'dots' ) { 
     409            $design_url = GALLERIA_GALLERIA_PLUGIN_URL . '/galleria-themes/dots/galleria.dots.min.js'; 
     410        } else if( $design == 'fullscreen' ) { 
     411            $design_url = GALLERIA_GALLERIA_PLUGIN_URL . '/galleria-themes/fullscreen/galleria.fullscreen.js'; 
     412        } else if( stristr($design, '.js') !== false ) { 
     413            $design_url = get_stylesheet_directory_uri() . GALLERIA_GALLERIA_USER_THEME_DIR . $design; 
     414        } 
    388415    $autoplay = $galleria_galleria['autoplay']; 
    389416    if ($autoplay == 1) {  
     
    400427    jQuery(document).ready(function($){ 
    401428  // Load theme 
    402   Galleria.loadTheme('" . $design . "');\n\t"; 
     429  Galleria.loadTheme('" . $design_url . "');\n\t"; 
    403430 
    404431  // run galleria and add some options 
     
    428455    $width = $galleria_galleria['width'] ? $galleria_galleria['width'] : $wp_default_sizes['width']; 
    429456     
    430     echo '<script type="text/javascript">document.getElementsByTagName("html")[0].className+=" js"</script>'; 
    431     echo "<style type='text/css'>.galleria-gallery{ width: {$width}px; height: {$height}px;}.galleria-container{background-color:{$color}; } .js .galleria-gallery .gallery {display:none;}  .js .galleria-gallery{background-color:{$color}; } </style>"; 
     457    ?> 
     458    <script type="text/javascript"> 
     459    document.documentElement.className += ' galleria-galleria-active'; 
     460    </script> 
     461    <?php 
     462    echo "<style type='text/css'> 
     463    .galleria-gallery{ width: {$width}px; height: {$height}px;} 
     464    .galleria-container{background-color:{$color}; } 
     465    .galleria-galleria-active .galleria-gallery .gallery {display:none;}  
     466    .galleria-galleria-active .galleria-gallery{background-color:{$color}; } 
     467    </style>"; 
    432468} 
    433469add_action('wp_head','galleria_galleria_css_head'); 
  • galleria-galleria/trunk/readme.txt

    r368028 r368920  
    55Requires at least: 3.0 
    66Tested up to: 3.1 
    7 Stable tag: 0.1.1 
     7Stable tag: 0.2 
    88 
    99Transform standard WordPress galleries into galleria slideshows.  
     
    1212 
    1313Galleria Galleria is a fork of [Photo Galleria](http://wordpress.org/extend/plugins/photo-galleria/) that is designed to minimize resources and selectively load javascript. This plugin will only load javascript on pages that actually have a gallery. Galleria Galleria also keeps standard gallery styling if javascript is not enabled.  Beyond that, this plugin is built using the [Galleria javascript library](http://galleria.aino.se/) that allows for advanced theming and customization.  
     14 
     15Links: [github](https://github.com/samargulies/galleria-galleria/) 
    1416 
    1517== Installation == 
     
    2628 
    2729= How is this plugin different from other Wordpress gallery plugins? = 
    28 Galleria Galleria is designed to only selectively load javascript to reduce the load time of your site. It also works seamlessly with galleries you have already created for your site in Wordpress. 
     30Galleria Galleria is designed to only selectively load javascript to reduce the load time of your site. It also works seamlessly with galleries you have already created for your site in Wordpress.  
     31= How can I customize my galleries using this plugin? = 
     32Galleria Galleria gives you a choice of two build-in themes, transitions and background color. Beyond that, it also supports custom built Galleria themes and [paid themes](http://galleria.aino.se/themes/) (see [other notes](http://wordpress.org/extend/plugins/galleria-galleria/other_notes/) for more information. 
    2933 
    3034== Other Notes == 
     35 
     36= Gallery Shortcode = 
    3137This plugin uses the standard [gallery] shortcode to create slideshows. It also adds support for a per gallery height attribute in the format [gallery height=500] to create a gallery with a height of 500px. 
    3238 
     39= Custom Galleria Themes = 
     40The [Galleria javascript library](http://galleria.aino.se/) uses themes to style your galleries. If you would like to customize the build-in themes or use a [paid theme](http://galleria.aino.se/themes/) add a `galleria-themes` directory inside your Wordpress theme directory (make sure to place your galleria theme javascript file directly within the `galleria-themes` directory.) When you visit the Galleria Galleria settings page your javascript file will appear in the design dropdown menu. 
     41 
    3342== Changelog == 
     43 
     44= Version 0.2 = 
     45* Added ability to add custom galleria themes. To enable a custom galleria theme, add a `galleria-themes` directory inside your Wordpress theme directory (make sure to place your galleria theme javascript file directly within the `galleria-themes` directory.) When you visit the Galleria Galleria settings page your javascript file will appear in the design dropdown menu. 
    3446 
    3547= Version 0.1.1 = 
Note: See TracChangeset for help on using the changeset viewer.