Plugin Directory

Changeset 415746


Ignore:
Timestamp:
07/27/2011 02:56:11 AM (15 years ago)
Author:
jeff_
Message:

fix the «always loading» bug, suppress PHP notices messages, don't use deprecated functions any more, admin page bugs, uses px per default for image and button sizes, use now WP integrated jQuery-UI files + add support of post thumbnails

Location:
frontpage-slideshow/trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • frontpage-slideshow/trunk/frontpage-slideshow.php

    r280410 r415746  
    44Plugin URI: http://wordpress.org/extend/plugins/frontpage-slideshow/
    55Description: Frontpage Slideshow provides a slide show like you can see on <a href="http://linux.com">linux.com</a> or <a href="http://modulaweb.fr/">modulaweb.fr</a> front page. <a href="options-general.php?page=frontpage-slideshow">Configuration Page</a>
    6 Version: 0.9.9.3.4
     6Version: 0.9.9.3.5
    77Author: Jean-François VIAL
    88Author URI: http://www.modulaweb.fr/
     
    1010*/
    1111/*  Copyright 2009 Jean-François VIAL  (email : [email protected])
    12  
     12
    1313    This program is free software; you can redistribute it and/or modify
    1414    it under the terms of the GNU General Public License as published by
     
    2525    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2626*/
    27 define ('FRONTPAGE_SLIDESHOW_VERSION', '0.9.9.3.4');
     27define ('FRONTPAGE_SLIDESHOW_VERSION', '0.9.9.3.5');
    2828$fs_already_displayed = false; // the slideshow dont have been displayed yet
    2929
     
    3131$template = 'default';
    3232$options = frontpageSlideshow_get_options();
    33 if (is_file (dirname(__FILE__).'/templates/'.$options['values']['fs_template'].'/template.php'))
    34     $template = $options['values']['fs_template'];
     33if (isset($options['values']['fs_template'])) {
     34    if (is_file (dirname(__FILE__).'/templates/'.$options['values']['fs_template'].'/template.php'))
     35        $template = $options['values']['fs_template'];
     36}
    3537include (dirname(__FILE__).'/templates/'.$template.'/template.php');
    3638
     
    6466            if ($image == '') { // if no image : use the first image on the post
    6567                $image = $fspost->post_content;
    66                 if (preg_match('/<img[^>]*src="([^"]*)"/i',$image,$matches)) {
     68                if (has_post_thumbnail($fspost->ID)) {
     69                    $image = wp_get_attachment_image_src(get_post_thumbnail_id($fspost->ID),'large');
     70                    $image = $image[0];
     71                } elseif (preg_match('/<img[^>]*src="([^"]*)"/i',$image,$matches)) {
    6772                    $image = $matches[1];
    6873                } else {
    69                     (is_ssl()) ? $url = str_replace('http://','https://',get_bloginfo('url')) : $url = str_replace('https://','http://',get_bloginfo('url')); 
     74                    (is_ssl()) ? $url = str_replace('http://','https://',get_bloginfo('url')) : $url = str_replace('https://','http://',get_bloginfo('url'));
    7075                    $image = $url.'/wp-content/plugins/frontpage-slideshow/images/one_transparent_pixel.gif';
    7176                }
     
    7883            // put infos into an array
    7984
    80             $fsentries[] = array('title' => $title.'&nbsp;', 'image' => $image, 'comment' => $comment.'&nbsp;', 'button-comment' => $buttoncomment.'&nbsp;', 'link' => $link);
     85            $fsentries[] = array('title' => $title.'&nbsp;', 'image' => $image, 'comment' => $comment.'&nbsp;', 'button-comment' => $buttoncomment.'&nbsp;', 'link' => $link, 'post_id' => $fspost->ID);
    8186        }
    8287        // construct the slider
    8388        $fscontent = '';
    8489        $fslast = count($fsentries) -1;
    85         if (count($fsentries)) 
     90        if (count($fsentries))
    8691            $fscontent = frontpageSlideshow_TPL($fsentries);
    8792        $header = frontpageSlideshow_header(true,$options);
    8893        return "\n<!-- Frontpage Slideshow begin -->\n{$fscontent}\n{$header}\n<!-- Frontpage Slideshow end -->\n{$content}";
    89        
     94
    9095    } else {
    9196        return $content;
     
    95100function frontpageSlideshow_init() {
    96101    // loads the needed frameworks to load as a safe way
    97     // now using jQuery framework instead of Prototype+Scriptaculous
    98102    wp_register_script('jquery-ui-effects',WP_PLUGIN_URL .'/frontpage-slideshow/js/jquery-ui-effects.js', array('jquery-ui-core'));
    99103    wp_enqueue_script('jquery-ui-effects');
    100104}
    101 function frontpageSlideshow_admin_init() {
     105function frontpageSlideshow_admin_enqueue_scripts() {
    102106    // loads the needed frameworks to load as a safe way into admin page
    103     // now using jQuery framework instead of Prototype+Scriptaculous
    104     wp_register_script('jquery-ui-interactions',WP_PLUGIN_URL .'/frontpage-slideshow/js/jquery-ui-interactions.js', array('jquery-ui-core'));
    105     wp_enqueue_script('jquery-ui-interactions');
     107    wp_enqueue_script('jquery-ui-draggable');
     108    wp_enqueue_script('jquery-ui-droppable');
     109    wp_enqueue_script('jquery-ui-selectable');
     110    wp_enqueue_script('jquery-ui-sortable');
    106111}
    107112
     
    171176}
    172177
    173 function frontpageSlideshow_dedicated_shortcode ($attributes, $content=null) {
     178function frontpageSlideshow_dedicated_shortcode ($attributes=array(), $content=null) {
    174179    global $fs_already_displayed;
    175180
     
    184189
    185190    $options['values'] = shortcode_atts($options['values'], $attributes);
    186     $options['values']['fs_cats'] = explode(',',$attributes['fs_cats']);
     191    if (is_array($attributes)) {
     192        if (array_key_exists('fs_cats',$attributes))
     193            $options['values']['fs_cats'] = explode(',',$attributes['fs_cats']);
     194    }
    187195    $force_display_if_shortcode = true;
    188196    $force_display_if_shortcode = true;
     
    253261                    'fs_main_width'             => '732px',
    254262                    'fs_main_height'            => '260px',
    255                     'fs_slide_width'            => '80%',
    256                     'fs_buttons_width'          => '20%',
     263                    'fs_slide_width'            => '585px',
     264                    'fs_buttons_width'          => '147px',
    257265                    'fs_placeholder_height'         => '195px',
    258266                    'fs_button_normal_color'        => '#000',
     
    393401
    394402function frontpageSlideshow_admin_menu() {
    395     add_options_page('Frontpage Slideshow', 'Frontpage Slideshow', 8, 'frontpage-slideshow', 'frontpageSlideshow_admin_options');
     403    add_options_page('Frontpage Slideshow', 'Frontpage Slideshow', 'edit_posts', 'frontpage-slideshow', 'frontpageSlideshow_admin_options');
    396404}
    397405function frontpageSlideshow_validate_options() {
     
    403411            $value_ok = false;
    404412            switch ($options['types'][$key]) {
    405                 case 'array of cats': 
     413                case 'array of cats':
    406414                    if (!is_array($val)) {
    407415                        $bad_values[] = $options['names'][$key];
     
    424432                    }
    425433                    break;
    426                 case 'integer': 
     434                case 'integer':
    427435                    if (!preg_match('/^[1-9][0-9]*$/',trim($val))) {
    428436                        $bad_values[] = $options['names'][$key];
     
    431439                    }
    432440                    break;
    433                 case 'bool': 
     441                case 'bool':
    434442                    if (is_bool($val) || $val ==  1 || $val == 0) {
    435443                        $value_ok = true;
     
    572580    $dont_add=array('fs_is_activated','fs_shortcode','fs_insert');
    573581    foreach ($opt['values'] as $k=>$v) {
    574         if (!in_array($k,$dont_add) && $def['values'][$k] != $v && $k != 'fs_cats') 
     582        if (!in_array($k,$dont_add) && $def['values'][$k] != $v && $k != 'fs_cats')
    575583            $argz .= " {$k}={$v}";
    576584        elseif ($k == 'fs_cats') {
     
    585593    $options = frontpageSlideshow_get_options();
    586594    $message = '';
    587     if($_POST['fs_submit']) {
     595    if(isset($_POST['fs_submit'])) {
    588596        $test = frontpageSlideshow_validate_options();
    589597        $options = $test['options'];
     
    595603        }
    596604        unset($test);
    597     } else if ($_POST['fs_preview']) {
     605    } else if (isset($_POST['fs_preview'])) {
    598606        $test = frontpageSlideshow_validate_options();
    599607        $options = $test['options'];
     
    604612        }
    605613        unset($test);
    606     } else if ($_POST['fs_reset_preview']) {
     614    } else if (isset($_POST['fs_reset_preview'])) {
    607615        $options = frontpageSlideshow_get_options();
    608616        $message = '<p>'.__('The preview have been updated with actual values.', 'frontpage-slideshow').'</p>';
    609617        $message .= '<p>'.__('Note that the preview has been reseted to the ACTUAL values, not with default ones.', 'frontpage-slideshow').'</p>';
    610     } else if ($_POST['fs_reset']) {
     618    } else if (isset($_POST['fs_reset'])) {
    611619        $options = frontpageSlideshow_get_options(true);
    612620        delete_option('frontpage-slideshow');
    613621        update_option('frontpage-slideshow', array('values'=>$options['values']));
    614622        $message = '<p>'.__('The plugins runs now with default values.', 'frontpage-slideshow').'</p>';
    615     } else if ($_POST['fs_disable']) {
     623    } else if (isset($_POST['fs_disable'])) {
    616624        $options['values']['fs_is_activated'] = 0;
    617625        update_option('frontpage-slideshow', array('values'=>$options['values']));
    618626        $message = '<p>'.__('The plugins has been disabled.', 'frontpage-slideshow').'</p>';
    619     } else if ($_POST['fs_enable']) {
     627    } else if (isset($_POST['fs_enable'])) {
    620628        $options['values']['fs_is_activated'] = 1;
    621629        update_option('frontpage-slideshow', array('values'=>$options['values']));
     
    702710                    <h3><span><?php _e('Preview')?></span></h3>
    703711                    <div class="inside" style="padding: 5px;">
    704                         <?php 
     712                        <?php
    705713                            frontpageSlideshow_header(true,$options);
    706714                            echo frontpageSlideshow('',true,$options);
     
    711719                            <input name="hosted_button_id" value="9112063" type="hidden">
    712720                            <p>
    713                                 <?php _e('If you find this plugin useful, you can support his author by making a donation.','frontpage-slideshow'); ?> 
     721                                <?php _e('If you find this plugin useful, you can support his author by making a donation.','frontpage-slideshow'); ?>
    714722                                <input name="submit" type="submit" class="button-primary" value="<?php _e('Donate to this plugin','frontpage-slideshow'); ?>" />
    715723                            </p>
     
    718726                                <pre style="overflow: auto; background-color: #f5f5f5; border: 1px solid #dadada; padding: 11px; font-size: 11px; line-height: 1.3em;">
    719727<?php echo frontpageSlideshow_createShortcodeString($options); ?></pre>
    720                        
     728
    721729                    </div>
    722730                </div>
     
    726734                    <h3><span><?php  if ($options['values']['fs_is_activated']) _e('Disable the plugin','frontpage-slideshow'); else _e('Enable the plugin','frontpage-slideshow');?></span></h3>
    727735                    <div class="inside" style="padding: 5px;">
    728                         <p><?php 
     736                        <p><?php
    729737                            if ($options['values']['fs_is_activated']) {
    730                         ?><label for="fs_disable"><?php 
    731                                 _e('The plugin is currently ENABLED : you can use the following button to disable it.','frontpage-slideshow')?> 
     738                        ?><label for="fs_disable"><?php
     739                                _e('The plugin is currently ENABLED : you can use the following button to disable it.','frontpage-slideshow')?>
    732740                                <input type="submit" class="button-primary" id="fs_disable" name="fs_disable" size="2" maxlength="2" value="<?php _e('Disable the plugin','frontpage-slideshow')?>" />
    733                         <?php 
     741                        <?php
    734742                            } else {
    735                         ?><label for="fs_enable"><?php 
    736                                 _e('The plugin is currently DISABLED : you can use the following button to enable it.','frontpage-slideshow')?> 
     743                        ?><label for="fs_enable"><?php
     744                                _e('The plugin is currently DISABLED : you can use the following button to enable it.','frontpage-slideshow')?>
    737745                                <input type="submit" class="button-primary" id="fs_enable" name="fs_enable" size="2" maxlength="2" value="<?php _e('Enable the plugin now !!','frontpage-slideshow')?>" />
    738                         <?php 
     746                        <?php
    739747                            }
    740748                        ?>
     
    753761                            <li><label for="fs_insert_2"><input type="radio" id="fs_insert_2" name="fs_insert" value="shortcode"<?php  if ($options['values']['fs_insert']=='shortcode') echo ' checked="checked"'; ?> /> <?php _e('Everywhere on content post (using the dedicated shortcode)','frontpage-slideshow')?></label><br />
    754762                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for="fs_insert_shortcode">→ <?php _e('Shortcode','frontpage-slideshow')?> : [<input id="fs_shortcode" name="fs_shortcode" value="<?php echo $options['values']['fs_shortcode']?>" />]</label>
    755                                 <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;→ <?php _e('Actual complete shortcode (to insert a slideshow with the actual settins):','frontpage-slideshow')?> 
     763                                <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;→ <?php _e('Actual complete shortcode (to insert a slideshow with the actual settins):','frontpage-slideshow')?>
    756764                                <pre style="margin-left: 47px; overflow: auto; background-color: #f5f5f5; border: 1px solid #dadada; padding: 11px; font-size: 11px; line-height: 1.3em;">
    757765<?php echo frontpageSlideshow_createShortcodeString($options); ?></pre>
     
    771779                        <p><?php _e('Frontpage Slideshow will look for posts to display as slides into these categories : ','frontpage-slideshow')?></p>
    772780                        <ul style="list-style: none">
    773                         <?php 
     781                        <?php
    774782                            $cats = get_categories('hide_empty=0&depth=1');
    775783                            $count=1;
     
    912920                    <h3><span><?php _e('About background images / textures and loader animation','frontpage-slideshow')?></span></h3>
    913921                    <div class="inside" style="padding: 5px;">
    914                    
     922
    915923                    <?php
    916924                        $attachments = get_children(array(
     
    930938                        echo '<p>'._e('Drag\'n\'drop a picture to the place you want it to be to specify a background image/texture or loader.','frontpage-slideshow').'</p>';
    931939                        echo '<textarea id="fs-pictures-chooser-keeper" style="display: none!important;">'.$pics.'</textarea><div id="background_images_selector" style="display: block; width: 100%; border: 1px solid #dfdfdf;"><a href="#" onclick="jQuery(this).parent().html(jQuery(\'#fs-pictures-chooser-keeper\').val()); return false;">'.__('Click here to load the image selector and choose an image.','frontpage-slideshow').'</a></div>';
    932                        
     940
    933941                        $image_selectors = array(
    934942                            array(
     
    985993                    ?>
    986994                        <div id="<?php echo $selector['id']; ?>_droppable" class="droppable" style="width: <?php echo $size; ?>%; margin: 0.2%; padding: 3px; border: solid 1px #aaa; text-align: center; float: left; height: 170px;">
    987                             <label for="<?php echo $selector['id']; ?>"><?php 
     995                            <label for="<?php echo $selector['id']; ?>"><?php
    988996                                if ($options['values'][$selector['id']]!='') {
    989                                     echo $selector['name']; 
     997                                    echo $selector['name'];
    990998                                } else {
    991                                     echo $selector['message']; 
     999                                    echo $selector['message'];
    9921000                                }
    9931001                            ?></label>
     
    10111019                                        case 'fs_previous_image':
    10121020                                        case 'fs_next_image':
    1013                                             (is_ssl()) ? $url = str_replace('http://','https://',$url) : $url = str_replace('https://','http://',$url); 
     1021                                            (is_ssl()) ? $url = str_replace('http://','https://',$url) : $url = str_replace('https://','http://',$url);
    10141022                                            echo ' background-image: url('.$url.'); background-repeat: '.$selector['repeat'].'!important; background-position: center center;';
    10151023                                            $options['values'][$selector['id']] = $url;
     
    10521060                        <div><?php _e('You can use the following service to create a custom loader animation :','frontpage-slideshow'); ?> <a href="http://www.ajaxload.info/" target="_blank">Ajaxload</a></div>
    10531061                        <script type="text/javascript">
    1054                             // <![CDATA[
    1055                             jQuery(".droppable").each(function() {
     1062                        // <![CDATA[
     1063                        jQuery(document).ready(function(){
     1064
     1065                            jQuery('.droppable').each(function() {
    10561066                                jQuery(this).droppable({
    10571067                                    accept: '#background_images_selector img',
     
    10751085                                                }
    10761086                                            ?>
    1077                        
     1087
    10781088                                        }
    10791089                                        jQuery(this).find('label').html('<?php _e('Slideshow background image','frontpage-slideshow')?>');
     
    10921102                                });
    10931103                            });
    1094                             //]]>
     1104                        });
     1105                        //]]>
    10951106                        </script>
    10961107                        <p><input type="submit" name="fs_preview" class="button-primary" value="<?php  _e('Preview'); ?>" /></p>
     
    11401151    </script>
    11411152
    1142     <?php 
     1153    <?php
    11431154}
    11441155/******************************************************************************/
     
    11751186function frontpageSlideshow_meta_boxes() {
    11761187    global $post, $frontpageSlideshow_meta_boxes;
    1177    
     1188
    11781189?>
    1179         <p><?php _e('All those options will be savend when you will save the changes made on this post');?></p>
    1180         <?php echo '<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />'; ?>
     1190        <p><?php _e('All those options will be saved when you will save the changes made on this post');?></p>
    11811191        <table class="widefat" cellspacing="0" width="100%" id="inactive-plugins-table">
    1182        
     1192
    11831193            <tbody class="plugins">
    11841194<?php
    1185    
     1195
    11861196            foreach ($frontpageSlideshow_meta_boxes as $meta_box) {
    1187                 $meta_box_value = get_post_meta($post->ID, $pre.'_value', true);
    1188                
    1189                 if ($meta_box_value == "")
    1190                     $meta_box_value = $meta_box['std'];
    1191                
    11921197?><tr>
    11931198                    <td width="100" align="center" style="border-bottom: 1px solid #dfdfdf; overflow: auto;">
     
    11981203<?php
    11991204                    echo '<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';
    1200                     if ($meta_box['type'] == 'picture') {
     1205                    if (isset($meta_box['type']) && $meta_box['type'] == 'picture') {
    12011206                        $attachments = get_children(array(
    12021207                                    'post_type'     => 'attachment',
     
    12091214                            foreach ($attachments as $attachment) {
    12101215                                $pics.= '<img style="border: 1px solid transparent; cursor: pointer;';
    1211                                 if (get_post_meta($post->ID, $meta_box['name'], true) == $attachment->guid) $pics.= ' border-color: red;';
    1212                                 $pics.= '" onclick="jQuery(\'#'.$meta_box['name'].'\').val(this.src); this.style.borderColor=\'red\';" onmouseout="if (jQuery(\'#'.$meta_box['name'].'\').val() != this.src) this.style.borderColor=\'transparent\';" onmouseover="if (jQuery(\'#'.$meta_box['name'].'\').val() != this.src) this.style.borderColor=\'cyan\';" src="'.$attachment->guid.'" width="100" /> ';
     1216                                if (get_post_meta($post->ID, $meta_box['name'], true) == $attachment->guid) $pics.= ' border-color: red;" _actual="true';
     1217                                $pics.= '" onclick="jQuery(\'#'.$meta_box['name'].'\').val(this.src); jQuery(this).siblings(\'img\').css(\'border-color\',\'transparent\'); this.style.borderColor=\'red\';" onmouseout="if (jQuery(\'#'.$meta_box['name'].'\').val() != this.src) this.style.borderColor=\'transparent\';" onmouseover="if (jQuery(\'#'.$meta_box['name'].'\').val() != this.src) this.style.borderColor=\'cyan\';" src="'.$attachment->guid.'" width="100" /> ';
    12131218                            }
    12141219                        } else {
     
    12371242                            $posts .= '>'.$attachment->post_title.'</option>';
    12381243                        }
    1239                         if (get_post_meta($post->ID, $meta_box['name'], true) == '') 
     1244                        if (get_post_meta($post->ID, $meta_box['name'], true) == '')
    12401245                            $posts = '<option value="" disabled="disabled" selected="selected">'.__('Choose a page on this blog').'</option>'.$posts;
    12411246                        echo '<select onchange="document.getElementById(\''.$meta_box['name'].'\').value = this.options[this.selectedIndex].value">'.$posts.'</select>';
     
    12501255            </tbody>
    12511256        </table>
    1252 <?php   
     1257<?php
    12531258}
    12541259
     
    12611266function frontpageSlideshow_save_postdata( $post_id ) {
    12621267    global $post,$frontpageSlideshow_meta_boxes;
    1263    
     1268
    12641269    foreach($frontpageSlideshow_meta_boxes as $meta_box) {
    12651270        // Verify
     
    12671272            return $post_id;
    12681273        }
    1269    
     1274
    12701275        if ( 'page' == $_POST['post_type'] ) {
    12711276            if ( !current_user_can( 'edit_page', $post_id ))
     
    12751280                return $post_id;
    12761281        }
    1277    
     1282
    12781283        $data = $_POST[$meta_box['name']];
    1279        
     1284
    12801285        if(get_post_meta($post_id, $meta_box['name']) == '')
    12811286            add_post_meta($post_id, $meta_box['name'], $data, true);
     
    12951300if (frontpageSlideshow_get_options(false,'fs_insert') == 'shortcode') {
    12961301    add_shortcode(frontpageSlideshow_get_options(false,'fs_shortcode'), 'frontpageSlideshow_dedicated_shortcode');
    1297     if (function_exists('add_action')) {
    1298         add_filter('init', 'frontpageSlideshow_init',1);
    1299     }
     1302    add_filter('init', 'frontpageSlideshow_init',1);
    13001303} else {
    1301     if (function_exists('add_action')) {
    1302         add_filter('the_content', 'frontpageSlideshow');
    1303         add_filter('init', 'frontpageSlideshow_init',1);
    1304     }
    1305 }
    1306 if (function_exists('add_action')) {
    1307     add_action('admin_menu', 'frontpageSlideshow_admin_menu');
    1308     add_action('admin_init', 'frontpageSlideshow_admin_init');
    1309     add_action('admin_menu', 'frontpageSlideshow_create_meta_box');
    1310     add_action('save_post', 'frontpageSlideshow_save_postdata');
    1311 }
     1304    add_filter('the_content', 'frontpageSlideshow');
     1305    add_filter('init', 'frontpageSlideshow_init',1);
     1306}
     1307add_action('admin_menu', 'frontpageSlideshow_admin_menu');
     1308add_action('admin_enqueue_scripts', 'frontpageSlideshow_admin_enqueue_scripts');
     1309add_action('admin_menu', 'frontpageSlideshow_create_meta_box');
     1310add_action('save_post', 'frontpageSlideshow_save_postdata');
     1311
    13121312function frontpageSlideshow_Widget_init() {
    13131313    register_widget('frontpageSlideshow_Widget');
  • frontpage-slideshow/trunk/readme.txt

    r280410 r415746  
    22Contributors: Jean-François “Jeff” VIAL
    33Donate link: http://www.modulaweb.fr/blog/wp-plugins-en/
    4 Tags: frontpage, slideshow, pictures, no-flash, css, javascript, XHTML,
     4Tags: frontpage, slideshow, pictures, no-flash, css, javascript, XHTML, slider,
    55Requires at least: 2.7.0
    6 Tested up to: 3.1
    7 Stable tag: 0.9.9.3.4
     6Tested up to: 3.2.1
     7Stable tag: 0.9.9.3.5
    88
    99Frontpage Slideshow provides a slide show like you can see in linux.com front page
     
    2424* Each slide is made from an article taken from one or more categories
    2525* Admin box added on New/Edit articles formulars
    26 * Complete admin page for whole slider parameters with preview
     26* Complete admin page for whole slider parameters with preview and easy drag'n'drop system to change background images and more
    2727* Automatic insertion on frontpage or shortcode every where you want (on post bodies and sidebar text box or with small simple PHP snipet)
    2828* Very high customization allowed by template system that allow to to control the HTML part but also the javascript and CSS parts !
     29* Native support of posts thumbnails
     30* Template system that allow you to create your very own slider
    2931
    30 = Usages = 
     32= Usages =
    3133
    3234* As an articles slideshow to present hot news
     
    5254
    5355See the <a href="http://wordpress.org/tags/frontpage-slideshow">frontpage slideshow forum</a>, look for some topics tha could match your problem or question, then if no topic helps you, create a new topic.
    54  
     56
    5557= May I use more than one slideshow on my site ? =
    5658
     
    6769= Hey ! Your plugin is messing up my beautiful website ! Can you fix it now ? =
    6870
    69 This plugin uses the Wordpress API to include the javascript frameworks properly, so that this plugin does not cause problems if other plugins or themes you use are properly encoded. 
     71This plugin uses the Wordpress API to include the javascript frameworks properly, so that this plugin does not cause problems if other plugins or themes you use are properly encoded.
    7072
    7173Otherwise, you got to troubleshoot by yourself (de-activate all plugins then re-active them one by one to determine if its the theme or a plugin, and wich plugin is messing up) then contact the guilty's author and ask him to use the Wordpress API to include javascript frameworks.
     
    116118* v 0.9.9.3.3 : fix a bug that avoided the use of excerpt as slide comment and a bug introduced in 0.9.9.3.1 that disabled buttons use
    117119* v 0.9.9.3.4 : fix a bug that not allowed to specify 1 or multiple categories by using shortcode ; silent the warning when the internet cannot be reached to get the plugin ID and add a message instead (+translation to french of this message)
     120* v 0.9.9.3.5 : fix the «always loading» bug, suppress PHP notices messages, don't use deprecated functions any more, admin page bugs, uses px per default for image and button sizes, use now WP integrated jQuery-UI files + add support of post thumbnails
    118121
    119122== Screenshots ==
     
    135138
    136139`<?php
    137 // added by <yourname> in order to add the slideshow using the frontpage-slideshow plugin
     140// added by <yourname here> in order to add the slideshow using the frontpage-slideshow plugin
    138141echo do_shortcode('[FrontpageSlideshow]');
    139142?>`
     
    158161If you need help to troubleshoot, don't forget to transmit your plugin unique ID.
    159162You can find this plugin unique ID by visiting the plugin admin page at the very end of the "How to use / Getting help" section
     163
  • frontpage-slideshow/trunk/templates/default/template.php

    r256566 r415746  
    88*/
    99/*  Copyright 2009 Jean-François VIAL  (email : [email protected])
    10  
     10
    1111    This program is free software; you can redistribute it and/or modify
    1212    it under the terms of the GNU General Public License as published by
     
    2626How to create your own template:
    27271) copy/paste this file into another folder in the template folder.
    28 2) modify thos 2 functions to feet your needs.
     282) modify those 2 functions to feet your needs.
    29293) choose this new template to use it into the plugin's admin page
    3030
     
    7070?>
    7171var fslast = <?php echo $fslast?>;
    72 var fsid = -1; 
     72var fsid = -1;
    7373var fsinterval = 0;
    7474var clicked = false;
     
    8383        window.clearInterval(fsinterval);
    8484        <?php echo frontpageSlideshow_JS_effect($options['values']['fs_transition']); ?>
    85        
     85
    8686    }
    8787}
     
    9494    jQuery('#fs-excerpt').html(jQuery('#fs-entry-comment-'+fsid).html());
    9595    <?php echo frontpageSlideshow_JS_effect($options['values']['fs_transition_on'],'In'); ?>
    96    
     96
    9797    jQuery("#fs-entry-"+fsid).addClass('fs-current');
    9898    frontpageSlideshow();
     
    100100function fsDoSlide() {
    101101    jQuery("#fs-slide").css({width : jQuery("#fs-slide").css('width')});
    102    
     102
    103103    if (fsid>-1) jQuery("#fs-entry-"+fsid).removeClass("fs-current");
    104104    fsid++;
     
    122122    fsChangeSlide(id);
    123123}
    124 jQuery('#fs-prev').click(function() {fsPrevNext(-1); return false;});
    125 jQuery('#fs-next').click(function() {fsPrevNext(1); return false;});
    126 jQuery('#fs-prev,#fs-next').hover(
    127     function(){jQuery(this).stop(true, true).fadeTo('fast',0.6);},
    128     function(){jQuery(this).stop(true, true).fadeTo('fast',0.15);}
    129 );
    130 jQuery('.fs-img').last().load(function() {fsDoSlide()});
     124jQuery(document).ready(function () {
     125
     126    jQuery('#fs-prev').click(function() {fsPrevNext(-1); return false;});
     127    jQuery('#fs-next').click(function() {fsPrevNext(1); return false;});
     128    jQuery('#fs-prev,#fs-next').hover(
     129        function(){jQuery(this).stop(true, true).fadeTo('fast',0.6);},
     130        function(){jQuery(this).stop(true, true).fadeTo('fast',0.15);}
     131    );
     132    jQuery('.fs-img').last().load(function() {fsDoSlide()});
    131133<?php
    132134for ($i=0;$i<=$fslast;$i++)
    133135    echo "jQuery('#fs-entry-{$i}').click(function() {fsChangeSlide({$i})});\n";
    134136?>
    135 <?php
     137});
     138<?php
    136139    $js = ob_get_contents();
    137140    define('FS_JS',$js);
     
    157160?>
    158161    overflow: hidden;
    159     background: <?php echo $options['values']['fs_main_color']?> <?php 
     162    background: <?php echo $options['values']['fs_main_color']?> <?php
    160163                if ($options['values']['fs_main_background_image'] != '' && $options['values']['fs_main_background_image'] != 'none') {
    161164                    $url = $options['values']['fs_main_background_image'];
     
    320323    height: 100%;
    321324    list-style: none!important;
    322     background: <?php echo $options['values']['fs_ul_background_color']?> <?php 
     325    background: <?php echo $options['values']['fs_ul_background_color']?> <?php
    323326                if ($options['values']['fs_ul_background_image'] != '' && $options['values']['fs_ul_background_image'] != 'none') {
    324327                    $url = $options['values']['fs_ul_background_image'];
     
    348351    $number = str_replace('px','',str_replace('%','',$fslast));
    349352    $height = str_replace('px','',str_replace('%','',trim($options['values']['fs_main_height'])));
    350    
     353
    351354    $h = floor($height/$number);
    352    
     355
    353356    echo $h.'px';
    354357    ?>!important;
     
    369372
    370373.fs-entry {
    371     background: <?php echo $options['values']['fs_button_normal_color']?> <?php 
     374    background: <?php echo $options['values']['fs_button_normal_color']?> <?php
    372375                if ($options['values']['fs_button_background_image'] != '' && $options['values']['fs_button_background_image'] != 'none') {
    373376                    $url = $options['values']['fs_button_background_image'];
     
    381384}
    382385.fs-entry:hover {
    383     background: <?php echo $options['values']['fs_button_hover_color']?> <?php 
     386    background: <?php echo $options['values']['fs_button_hover_color']?> <?php
    384387                if ($options['values']['fs_button_hover_background_image'] != '' && $options['values']['fs_button_hover_background_image'] != 'none') {
    385388                    $url = $options['values']['fs_button_hover_background_image'];
     
    391394}
    392395.fs-current {
    393     background: <?php echo $options['values']['fs_button_current_color']?> <?php 
     396    background: <?php echo $options['values']['fs_button_current_color']?> <?php
    394397                if ($options['values']['fs_current_button_background_image'] != '' && $options['values']['fs_current_button_background_image'] != 'none') {
    395398                    $url = $options['values']['fs_current_button_background_image'];
Note: See TracChangeset for help on using the changeset viewer.