WordPress.org

Plugin Directory


Ignore:
Timestamp:
12/08/12 15:07:33 (5 years ago)
Author:
gopiplus
Message:

6.0
Tested up to 3.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • woo-superb-slideshow-transition-gallery-with-random-effect/trunk/woo-superb-slideshow-transition-gallery-with-random-effect.php

    r581609 r635852  
    66Description: Don't just display images, showcase them in style using this gallery effect plugin. Randomly chosen Transitional effects in IE browsers.   
    77Author: Gopi.R 
    8 Version: 5.0 
     8Version: 6.0 
    99Author URI: http://www.gopiplus.com/work/2010/09/19/woo-superb-slideshow-transition-gallery-with-random-effect/ 
    1010Donate link: http://www.gopiplus.com/work/2010/09/19/woo-superb-slideshow-transition-gallery-with-random-effect/ 
     11License: GPLv2 or later 
     12License URI: http://www.gnu.org/licenses/gpl-2.0.html 
    1113*/ 
    1214 
     
    1416define("WP_woo_TABLE", $wpdb->prefix . "woo_transition"); 
    1517 
    16 function woo_show()  
    17 { 
     18function woo_show( $type = "widget" , $random = "YES" )  
     19{ 
     20    $arr = array(); 
     21    $arr["type"] = $type; 
     22    $arr["random"] = $random; 
     23    echo woo_shortcode($arr); 
     24} 
     25 
     26function woo_shortcode( $atts )  
     27{ 
     28    global $wpdb; 
     29    global $Woo_ScriptInserted; 
     30    $woo_xml = ""; 
    1831    $woo_package = ""; 
    19     global $wpdb; 
    20     $woo_random = get_option('woo_random'); 
    21     $woo_type = get_option('woo_type'); 
     32     
     33    // [woo-superb-slideshow type="widget" random="YES"] 
     34    if ( ! is_array( $atts ) ) 
     35    { 
     36        return ''; 
     37    } 
     38    $woo_type = $atts['type']; 
     39    $woo_random = $atts['random']; 
     40     
    2241    $sSql = "select woo_path,woo_link,woo_target,woo_title from ".WP_woo_TABLE." where 1=1"; 
    23     $sSql = $sSql . " and woo_type='".$woo_type."'"; 
    24     if($woo_random == "YES"){ $sSql = $sSql . " ORDER BY RAND()"; }else{ $sSql = $sSql . " ORDER BY woo_order"; } 
     42 
     43    if($woo_random <> "") 
     44    {  
     45        $sSql = $sSql . " and woo_type='".$woo_type."'";  
     46    } 
     47     
     48    if($woo_random == "YES") 
     49    {  
     50        $sSql = $sSql . " ORDER BY RAND()";  
     51    } 
     52    else 
     53    {  
     54        $sSql = $sSql . " ORDER BY woo_order";  
     55    } 
     56     
    2557    $data = $wpdb->get_results($sSql); 
    2658    if ( ! empty($data) )  
     
    3062            $woo_package = $woo_package .'["'.$data->woo_path.'", "'.$data->woo_link.'", "'.$data->woo_target.'", "'.$data->woo_title.'"],'; 
    3163        } 
    32     }    
    33     $woo_package = substr($woo_package,0,(strlen($woo_package)-1)); 
    34     ?> 
    35     <link rel='stylesheet' href='<?php echo get_option('siteurl') ?>/wp-content/plugins/woo-superb-slideshow-transition-gallery-with-random-effect/style.css' type='text/css' /> 
    36     <script type="text/javascript"> 
    37     var flashyshow=new woo_target({  
    38         wrapperid: "woo_id_<?php echo $woo_type; ?>",  
    39         wrapperclass: "woo_class_<?php echo $woo_type; ?>",  
    40         imagearray: [ 
    41             <?php echo $woo_package; ?> 
    42         ], 
    43         pause: <?php echo get_option('woo_pause'); ?>,  
    44         transduration: <?php echo get_option('woo_transduration'); ?>  
    45     }) 
    46     </script> 
    47     <?php 
    48 } 
    49  
    50  
    51 add_filter('the_content','woo_show_filter'); 
    52  
    53 function woo_show_filter($content){ 
    54     return  preg_replace_callback('/\[woo-superb-slideshow=(.*?)\]/sim','woo_show_filter_Callback',$content); 
    55 } 
    56  
    57 function woo_show_filter_Callback($matches)  
    58 { 
    59     global $wpdb; 
    60     $woo_xml = ""; 
    61     $woo_package = ""; 
    62      
    63     $var = $matches[1]; 
    64     list($woo_type, $woo_random) = split('[=.-]', $var); 
    65     if($woo_type==""){$woo_type = "widget";} 
    66     if($woo_random==""){$woo_random = "YES";} 
    67     $sSql = "select woo_path,woo_link,woo_target,woo_title from ".WP_woo_TABLE." where 1=1"; 
    68     $sSql = $sSql . " and woo_type='".$woo_type."'"; 
    69     if($woo_random == "YES"){ $sSql = $sSql . " ORDER BY RAND()"; }else{ $sSql = $sSql . " ORDER BY woo_order"; } 
    70     $data = $wpdb->get_results($sSql); 
    71     if ( ! empty($data) )  
    72     { 
    73         foreach ( $data as $data )  
     64         
     65        $woo_package = substr($woo_package,0,(strlen($woo_package)-1)); 
     66        $newwrapperid = $woo_type; 
     67        $woo_pluginurl = get_option('siteurl') . "/wp-content/plugins/woo-superb-slideshow-transition-gallery-with-random-effect/"; 
     68         
     69        if (!isset($Woo_ScriptInserted) || $Woo_ScriptInserted !== true) 
    7470        { 
    75             $woo_package = $woo_package .'["'.$data->woo_path.'", "'.$data->woo_link.'", "'.$data->woo_target.'", "'.$data->woo_title.'"],'; 
     71            $Woo_ScriptInserted = true; 
     72            $woo_xml = $woo_xml .'<link rel="stylesheet" href="'.$woo_pluginurl.'style.css" type="text/css" />'; 
    7673        } 
    77     } 
    78     $woo_package = substr($woo_package,0,(strlen($woo_package)-1)); 
    79     $newwrapperid = $woo_type; 
    80     $woo_pluginurl = get_option('siteurl') . "/wp-content/plugins/woo-superb-slideshow-transition-gallery-with-random-effect/"; 
    81     $woo_xml = $woo_xml .'<link rel="stylesheet" href="'.$woo_pluginurl.'style.css" type="text/css" />'; 
    82     //$woo_xml = $woo_xml .'<script type="text/javascript" src="'.$woo_pluginurl.'woo-superb-slideshow-transition-gallery-with-random-effect.js"><script>'; 
    83     $woo_xml = $woo_xml .'<script type="text/javascript">'; 
    84     $woo_xml = $woo_xml .'var flashyshow=new woo_target({ wrapperid: "'.$newwrapperid.'", wrapperclass: "woo_class_'.$newwrapperid.'", imagearray: ['.$woo_package.'],pause: '. get_option('woo_pause').',transduration: '. get_option('woo_transduration').' })'; 
    85     $woo_xml = $woo_xml .'</script>'; 
     74         
     75        $woo_xml = $woo_xml .'<script type="text/javascript">'; 
     76        $woo_xml = $woo_xml .'var flashyshow=new woo_target({ wrapperid: "'.$newwrapperid.'", wrapperclass: "woo_class_'.$newwrapperid.'", imagearray: ['.$woo_package.'],pause: '. get_option('woo_pause').',transduration: '. get_option('woo_transduration').' })'; 
     77        $woo_xml = $woo_xml .'</script>'; 
     78    } 
     79    else 
     80    { 
     81        $woo_xml = "Record not found: " . $woo_type; 
     82    } 
     83     
    8684    return $woo_xml; 
    8785} 
     
    194192function woo_control() 
    195193{ 
    196     echo '<p>Woo superb slideshow transition gallery with random effect.<br><br> To change the setting goto "Woo superb slideshow transition gallery with random effect" link under SETTING menu.'; 
    197     echo ' <a href="options-general.php?page=woo-superb-slideshow-transition-gallery-with-random-effect/woo-superb-slideshow-transition-gallery-with-random-effect.php">'; 
    198     echo 'click here</a></p>'; 
     194    echo 'Woo Superb Slideshow'; 
    199195} 
    200196 
     
    203199    if(function_exists('wp_register_sidebar_widget'))    
    204200    { 
    205         wp_register_sidebar_widget('Woo-superb-slideshow-transition', 'Woo superb slideshow transition gallery with random effect', 'woo_widget'); 
     201        wp_register_sidebar_widget('Woo-superb-slideshow-transition', 'Woo superb slideshow', 'woo_widget'); 
    206202    } 
    207203     
    208204    if(function_exists('wp_register_widget_control'))    
    209205    { 
    210         wp_register_widget_control('Woo-superb-slideshow-transition', array('Woo superb slideshow transition gallery with random effect', 'widgets'), 'woo_control'); 
     206        wp_register_widget_control('Woo-superb-slideshow-transition', array('Woo superb slideshow', 'widgets'), 'woo_control'); 
    211207    }  
    212208} 
     
    214210function woo_deactivation()  
    215211{ 
     212    // No action required. 
    216213} 
    217214 
    218215function woo_add_to_menu()  
    219216{ 
    220     add_options_page('Woo superb slideshow transition gallery with random effect', 'Woo superb slideshow transition gallery with random effect', 'manage_options', __FILE__, 'woo_admin_option' ); 
    221     add_options_page('Woo superb slideshow transition gallery with random effect', '', 'manage_options', "woo-superb-slideshow-transition-gallery-with-random-effect/image-management.php",'' ); 
     217    add_options_page('Woo superb slideshow', 'Woo superb slideshow', 'manage_options', __FILE__, 'woo_admin_option' ); 
     218    add_options_page('Woo superb slideshow', '', 'manage_options', "woo-superb-slideshow-transition-gallery-with-random-effect/image-management.php",'' ); 
    222219} 
    223220 
     
    235232} 
    236233 
     234add_shortcode( 'woo-superb-slideshow', 'woo_shortcode' ); 
    237235add_action('init', 'woo_add_javascript_files'); 
    238236add_action("plugins_loaded", "woo_widget_init"); 
Note: See TracChangeset for help on using the changeset viewer.