Plugin Directory

Changeset 171580


Ignore:
Timestamp:
11/08/2009 11:35:57 PM (16 years ago)
Author:
jeff_
Message:

v 0.8 : Adding an admin zone to easily add or modify options for posts into the edit post page. + adding the complete shortcode under the preview + modifying the 'How to use / Getting help section' + if no picture is available, display a default picture (a 1x1 transparent pixel GIF) + how to use and FAQ zones in readme.txt changes

Location:
frontpage-slideshow
Files:
8 added
2 edited

Legend:

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

    r171120 r171580  
    44Plugin URI: http://www.modulaweb.fr/blog/wp-plugins/frontside-slideshow/en/
    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.7.4
     6Version: 0.8
    77Author: Jean-François VIAL
    88Author URI: http://www.modulaweb.fr/
     
    2424    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2525*/
    26 define ('FRONTPAGE_SLIDESHOW_VERSION', '0.7.4');
     26define ('FRONTPAGE_SLIDESHOW_VERSION', '0.8');
    2727$fs_already_displayed = false; // the slideshow dont have been displayed yet
    2828function frontpageSlideshow($content,$force_display=false,$options=array()) {
     
    5555            if ($image == '') { // if no image : use the first image on the post
    5656                $image = $fspost->post_content;
    57                 preg_match('/<img.*src="([^"]*)"/',$image,$matches);
    58                 $image = $matches[1];
     57                if (preg_match('/<img.*src="([^"]*)"/',$image,$matches)) {
     58                    $image = $matches[1];
     59                } else {
     60                    (is_ssl()) ? $url = str_replace('http://','https://',get_bloginfo('url')) : $url = str_replace('https://','http://',get_bloginfo('url'));
     61                    $image = $url.'/wp-content/plugins/frontpage-slideshow/images/one_transparent_pixel.gif';
     62                }
    5963            }
    6064
     
    750754                        <p><strong><?php _e('Note that this plugin is using the Wordpress API In order to include its needed Javascript files. Some other plugins or themes that are not using that API could mess up with this plugin.','frontpage-slideshow'); ?></strong></p>
    751755                        <br />
     756                        <p><big><strong><?php _e('Creating different slideshows with different parameters:','frontpage-slideshow'); ?></strong></big></p>
     757                        <p><?php _e('You can use different slideshows with different parameters easily ! Simply use the shortcode way to insert slideshows, save this options, then configure the slider, make a preview, copy the shortcode relulting of those parameters, and isert this shortcode everywhere you want a slideshow to be displayed ! You can create as many different slideshow as you got posts and pages into your blog. Remember that only the fist slideshow displayed on a page will work.','frontpage-slideshow'); ?></p>
     758                        <br />
    752759                        <p><big><strong><?php _e('In case of trouble:','frontpage-slideshow'); ?></strong></big></p>
    753760                        <ul style="list-style: disc; padding-left: 20px;">
     
    795802                            </p>
    796803                        </form>
     804                        <p><?php _e('Actual complete shortcode (use it to insert a slideshow with the actual settins when using the shortcode insert method):','frontpage-slideshow')?> </p>
     805                                <pre style="overflow: auto; background-color: #f5f5f5; border: 1px solid #dadada; padding: 11px; font-size: 11px; line-height: 1.3em;">
     806<?php echo frontpageSlideshow_createShortcodeString($options); ?></pre>
     807                       
    797808                    </div>
    798809                </div>
     
    966977    <?php
    967978}
     979/******************************************************************************/
     980/* Meta box displayed on the edit post page                   */
     981/******************************************************************************/
     982$frontpageSlideshow_meta_boxes = array(
     983                    'fs-title' => array(
     984                                'name' => 'fs-title',
     985                                'title' => __('Slide title','frontpage-slideshow'),
     986                                'description' => __('The title of the slide : if none is given, the post title is used','frontpage-slideshow'),
     987                                ),
     988                    'fs-picture' => array(
     989                                'name' => 'fs-picture',
     990                                'type' => 'url',
     991                                'title' => __('Slide picture','frontpage-slideshow'),
     992                                'description' => __('You can also use the <em>Add an Image</em> button, upload an image and paste the URL here, or use an external picture.<br />If you leave this blank, the first image found into the post content will be used.','frontpage-slideshow'),
     993                                ),
     994                    'fs-comment' => array(
     995                                'name' => 'fs-comment',
     996                                'title' => __('Slide comment','frontpage-slideshow'),
     997                                'description' => __('This comment will be displayed onto the picture. Leave blank to dont display a comment.','frontpage-slideshow'),
     998                                ),
     999                    'fs-button-comment' => array(
     1000                                'name' => 'fs-button-comment',
     1001                                'title' => __('Slide button-comment','frontpage-slideshow'),
     1002                                'description' => __('This comment will be displayed into the button, right under the title.','frontpage-slideshow'),
     1003                                ),
     1004                    'fs-link' => array(
     1005                                'name' => 'fs-link',
     1006                                'title' => __('Slide link','frontpage-slideshow'),
     1007                                'description' => __('When the user is clicking onto the picture, this URI is used. Leave blank to set this post link as the slide link (if this poton is activated into <a href="options-general.php?page=frontpage-slideshow">the plugin admin page</a>)','frontpage-slideshow'),
     1008                                ),
     1009                    );
     1010function frontpageSlideshow_meta_boxes() {
     1011    global $post, $frontpageSlideshow_meta_boxes;
     1012   
     1013?>
     1014        <p><?php _e('All those options will be savend when you will save the changes made on this post');?></p>
     1015        <table class="widefat" cellspacing="0" width="100%" id="inactive-plugins-table">
     1016       
     1017            <tbody class="plugins">
     1018<?php
     1019   
     1020            foreach ($frontpageSlideshow_meta_boxes as $meta_box) {
     1021                $meta_box_value = get_post_meta($post->ID, $pre.'_value', true);
     1022               
     1023                if ($meta_box_value == "")
     1024                    $meta_box_value = $meta_box['std'];
     1025               
     1026?><tr>
     1027                    <td width="100" align="center" style="border-bottom: 1px solid #dfdfdf; overflow: auto;">
     1028<?php
     1029                    echo '<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';
     1030                    echo '<h2>'.$meta_box['title'].'</h2>';
     1031?>  </td>
     1032                    <td style="border-bottom: 1px solid #dfdfdf;">
     1033<?php
     1034                    if ($meta_box['name'] == 'fs-picture') {
     1035                        $attachments = get_children(array(
     1036                                    'post_type'     => 'attachment',
     1037                                    'post_mime_type'    => 'image',
     1038                                    'post_status'       => null,
     1039                                    'post_parent'       => null,
     1040                                ));
     1041                        $pics = '';
     1042                        foreach ($attachments as $attachment) {
     1043                            $pics.= '<img style="border: 1px solid transparent; cursor: pointer;';
     1044                            if (get_post_meta($post->ID, $meta_box['name'], true) == $attachment->guid) $pics.= ' border-color: red;';
     1045                            $pics.= '" onclick="document.getElementById(\''.$meta_box['name'].'\').value = this.src; this.style.borderColor=\'red\';" onmouseout="if (document.getElementById(\''.$meta_box['name'].'\').value != this.src) this.style.borderColor=\'transparent\';" onmouseover="if (document.getElementById(\''.$meta_box['name'].'\').value != this.src) this.style.borderColor=\'cyan\';" src="'.$attachment->guid.'" width="100" /> ';
     1046                        }
     1047                        $pics.='<a href="media-upload.php?post_id=1&amp;type=image&amp;TB_iframe=true" id="add_image2" class="thickbox" title="'.__('Add an Image').'" onclick="return false;"><img width="100" src="images/media-button-image.gif" alt="'.__('Add an Image').'"></a>';
     1048                        echo '<p>'.__('Click on one of the following image (or add one) to choose the slide picture.').'</p>';
     1049                        echo '<div style="display: block; overflow:hidden; overflow-x: hidden; overflow-y: auto; height: 100px; width: 100%; border: 1px solid #dfdfdf;">'.$pics.'</div>';
     1050                        echo '<p><a href="#" target="_blank" onclick="if (document.getElementById(\''.$meta_box['name'].'\').value !=\'\') { this.href=document.getElementById(\''.$meta_box['name'].'\').value } else { alert(\''.__('No specified picture, no preview...').'\') }">'.__('Preview the current picture').'</a></p>';
     1051                    }
     1052                    if ($meta_box['name'] == 'fs-link') {
     1053                        $attachments = array_merge(
     1054                                get_children(array(
     1055                                    'post_type'     => 'page',
     1056                                    'post_parent'       => null,
     1057                                )),
     1058                                get_children(array(
     1059                                    'post_type'     => 'post',
     1060                                    'post_parent'       => null,
     1061                                ))
     1062                                );
     1063                        $posts = '';
     1064                        foreach ($attachments as $attachment) {
     1065                            $permalink = get_permalink($attachment->ID);
     1066                            $posts .= '<option value="'.$permalink.'"';
     1067                            if (get_post_meta($post->ID, $meta_box['name'], true) != '' && (get_post_meta($post->ID, $meta_box['name'], true) == $attachment->guid || get_post_meta($post->ID, $meta_box['name'], true) == $permalink)) $posts.= ' selected="selected"';
     1068                            $posts .= '>'.$attachment->post_title.'</option>';
     1069                        }
     1070                        if (get_post_meta($post->ID, $meta_box['name'], true) == '')
     1071                            $posts = '<option value="" disabled="disabled" selected="selected">'.__('Choose a page on this blog').'</option>'.$posts;
     1072                        echo '<select onchange="document.getElementById(\''.$meta_box['name'].'\').value = this.options[this.selectedIndex].value">'.$posts.'</select>';
     1073                    }
     1074                    echo '<input type="text" name="'.$meta_box['name'].'" id="'.$meta_box['name'].'" value="'.get_post_meta($post->ID, $meta_box['name'], true).'" style="width: 100%" /><br />';
     1075                    echo '<p><label for="'.$meta_box['name'].'">'.$meta_box['description'].'</label></p>';
     1076?>  </td>
     1077                </tr>
     1078<?php
     1079            }
     1080?>
     1081            </tbody>
     1082        </table>
     1083<?php   
     1084}
     1085
     1086function frontpageSlideshow_create_meta_box() {
     1087    if ( function_exists('add_meta_box') ) {
     1088        add_meta_box( 'fs-metabox', __('Frontpage-Slideshow Options'), 'frontpageSlideshow_meta_boxes', 'post', 'normal', 'high' );
     1089    }
     1090}
     1091
     1092function frontpageSlideshow_save_postdata( $post_id ) {
     1093    global $post,$frontpageSlideshow_meta_boxes;
     1094   
     1095    foreach($frontpageSlideshow_meta_boxes as $meta_box) {
     1096        // Verify
     1097        if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {
     1098            return $post_id;
     1099        }
     1100   
     1101        if ( 'page' == $_POST['post_type'] ) {
     1102            if ( !current_user_can( 'edit_page', $post_id ))
     1103                return $post_id;
     1104        } else {
     1105            if ( !current_user_can( 'edit_post', $post_id ))
     1106                return $post_id;
     1107        }
     1108   
     1109        $data = $_POST[$meta_box['name']];
     1110       
     1111        if(get_post_meta($post_id, $meta_box['name']) == '')
     1112            add_post_meta($post_id, $meta_box['name'], $data, true);
     1113        elseif($data != get_post_meta($post_id, $meta_box['name'], true))
     1114            update_post_meta($post_id, $meta_box['name'], $data);
     1115        elseif($data == "")
     1116            delete_post_meta($post_id, $meta_box['name'], get_post_meta($post_id, $meta_box['name'], true));
     1117    }
     1118}
     1119
     1120
     1121add_action('admin_menu', 'frontpageSlideshow_create_meta_box');
     1122add_action('save_post', 'frontpageSlideshow_save_postdata');
    9681123
    9691124/******************************************************************************/
  • frontpage-slideshow/trunk/readme.txt

    r171120 r171580  
    33Donate link: http://www.modulaweb.fr/blog/wp-plugins-en/
    44Tags: frontpage, slideshow, pictures, no-flash, css, javascript, XHTML,
    5 Requires at least: 2.8.0
     5Requires at least: 2.7.0
    66Tested up to: 2.8.5
    7 Stable tag: 0.7.4
     7Stable tag: 0.8
    88
    99Frontpage Slideshow provides a slide show like you can see in linux.com front page
     
    1111== Description ==
    1212
    13 This plugin allows you to put a slideshow on your Wordpress frontpage. like the one on linux.com
     13This plugin allows you to put a slideshow on your Wordpress front-page. like the one on linux.com
    1414
    15 The slide is made of a cliquable picture zone, some buttons with title and specific comment allowing to display a particular slide and a text zone to add a comment on slide.
     15The slide is made of a clickable picture zone, some buttons with title and specific comment allowing to display a particular slide and a text zone to add a comment on slide.
    1616
    1717pictures are pre-loaded and the default design is elegant and clean with a black background, transparencies ans rounded corners (except for IE).
     
    3333== Frequently Asked Questions ==
    3434
     35= How to use this plugin ? =
     36
     37See the <a href="../other_notes/">"how to use" section</a>
     38 
     39= May I use more than one slideshow on my site ? =
     40
     41Of course ! you just have to enable the shortcode way to display the slideshow then use as many shortcodes you want. See the <a href="../other_notes/">"how to use" section</a> for more infos.
     42
     43= The plugin is messing up my Wordpress admin page ! What can I do ? =
     44
     45The plugin just cant do that ! De-activate all plugins then re-activate them one by one and shoot the guilty !
     46
     47= Another plugin or my theme is coded with feet and messes up with your plugin ! Could you help me ? =
     48
     49I could give you some free advises but if you really want me to take precious time to debug your plugins or theme... consider to donate (I takes 45€/h)
     50
     51= Hey ! Your plugin is messing up my beautiful website ! Can you fix it now ? =
     52
     53This 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.
     54
     55Otherwise, 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.
     56
     57If you added those javascript files by yourself, consider having a look at the <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a> function.
     58
     59I could give you some free advises but if you really want me to take precious time to debug your plugins or theme... consider to donate (I takes 45€/h)
     60
     61= I got a super idea ! I want you to implement it in your plugin ! Can you do it ? =
     62
     63Yep ! Send me some interesting code and I will be pleased to add it to the plugin ! (and you could be co-author of the plugin!) but if you dont send code or if your demand is too far from my goals : I will not implement your suggestions.
     64
     65If you really want me to implement some partcular features... consider to donate or hire me (You'll get invoice with VAT etc... I takes 45€/h)
     66
    3567
    3668== Changelog ==
     
    4173* v 0.4 : fully functional administration page with preview, reset to default
    4274* v 0.5 : important bug fix when the plugin is loaded before jQuery and some CSS improvement
    43 * v 0.6 : improving the loading of javascript frameworks needed, the shortcode funtionnality added, alternative picture option added, when no link is set, the URL of the post can be used
     75* v 0.6 : improving the loading of javascript frameworks needed, the shortcode functionality added, alternative picture option added, when no link is set, the URL of the post can be used
    4476* v 0.6.1 : minor bug correction (replacing php short tags by long ones)
    4577* v 0.7 : allow to use the WP Text Widget to display the slideshow by inserting the shortcode onto the text itself, modify the original WP Text Widget to allow the use of all other shortcodes
     
    4880* v 0.7.3 : fixing bug introduced in 0.7.2 that was messing up the slideshow display in IE + XHTML validation improvements
    4981* v 0.7.4 : fixing bugs introduced in 0.7.3 that causes no start of the slideshow sometimes + possibility to change slide transitions + order of slides + putting a different title on slides + option to hide the comment zone
     82* v 0.8 : Adding an admin zone to easily add or modify options for posts into the edit post page. + adding the complete shortcode under the preview + modifying the "How to use / Getting help section" + if no picture is available, display a default picture (a 1x1 transparent pixel GIF)
    5083
    5184== Screenshots ==
    5285
    53 1. live at http://wwww.modulaweb.fr french webagency
     861. live at http://wwww.modulaweb.fr French web agency
    54872. live at http://www.smartyweb.org
    5588
    5689== How to use ==
    5790
    58 When it has been installed and activated, you just have to select from wich categories you want the slides comes from by using the administration page.
    59 The displayed picture onto the slideshow is the first picture of each articles, so make sure the article contains at least one picture.
     91There are 2 ways to use this plugin:
    6092
    61 Then you got to addd thoses custom parameters to each slide-posts :
     93* If you are using a static page as the front-page, use the front-page mode
     94      With this mode, the slideshow will be automatically added in top of the front-page content, before all other content. You don't have anything else to do.
     95* If you are not using a static page as the front-page, use the shortcode mode
     96      With this mode, you got to put a shortcode (like [FrontpageSlideshow]) where you want the slideshow to be displayed :
     97          * Somewhere into your posts content
     98          * Somewhere into some sidebar text-box
     99          * Everywhere else into the pages by inserting the following code snippet into your theme's .php files where you want the slideshow to be displayed:
    62100
    63     * fs-title : the slide title (default is the post title)
    64     * fs-button-comment : the button specific message (default : none)
    65     * fs-comment : the comment (default: none)
    66     * fs-link : the URL of page where to redirect users when they click on the picture, can be set to the page URL if none is given
    67     * fs-picture : the URL of the picture to display, the first picture on post-content is used if this parameter is missing
    68 
    69 The title of posts is used as the title of slides
    70 
    71 When all is done, tune up the slider and enable it.
    72 
    73 By default, the slideshow is added at the beginning of the front-page content. The best way to use if is to use a static-page as the front-page. If you are displaying a list of last posts, the slideshow is added at the beginning of the fist post shown.
    74 You can use a customisable shortcode to display the slideshow. You can use the shortcode as an enclosing one : you can put replacement content in case of the slideshow cannot be shown (if it has already been added earlier in the document flow) or is not activated.
    75 Example :
    76 
    77    `[FrontpageSlideshow fs_main_width=100% fs_main_color=pink]
    78    
    79 &lt;a href="/images/me.png" rel="lightbox" title="This is image caption">&lt;img src="/images/me.png" width="80" height="80" alt="This is image title" />&lt;/a>
    80 
    81 &lt;a href="/images/me2.png" rel="lightbox" title="This is image caption">&lt;img src="/images/me2.png" width="80" height="80" alt="This is image title" />&lt;/a>
    82 
    83 [/FrontpageSlideshow]`
    84 
    85 You can use this shortcode into a Text Widget to display the slideshow into the sidebar
    86 
    87 = Inserting the slideshow anywhere into your text =
    88 
    89 You can insert the slideshow anywhere you want by inserting the following php code where you want it to be displayed :
    90 
    91     `&lt;?php echo do_shortcode('[FrontpageSlideshow]'); ?>`
    92 
    93 Note that you can use all the features that shortcodes offers : for example, you can specify an alternative content (as the example before) this way.
    94 
    95 Note that FrontpageSlideshow modifies the normal Text Widget and allow you to use all the shortcodes in Text Widget.
    96 
    97 If you need a new functionality, you can ask for it by contacting the author directly or by posting a feature request on related forum on wordpress.org website.
    98 If those functionnlity can't wait, consider making a donation.
    99 
    100 == Milestones ==
    101 
    102 1. create a configuration page <= done
    103     1. allow to edit of category name and number of posts <= done, maybe some issues... need to test more
    104         1. calculate the buttons height automatically <= work in progress
    105         2. allow to not display buttons  <= done
    106         3. allow to display a previous and next button on side of slider
    107     2. allow to change the size of the slider <= done
    108     3. allow to fine tune the appearance of buttons <= partially done
    109     4. allow to change the slide display duration <= work in progress
    110 2. allow the use of multiples categories to find slides <= done
    111 3. widgetize the slider to allow to put it on sidebar an create small sliders <= done
    112 4. Allowing the use of shortcode to add the slideshow <= done
     101            `&lt;?php
     102            // added by <yourname> in order to add the slideshow using the frontpage-slideshow plugin
     103            echo do_shortcode('[FrontpageSlideshow]');
     104            ?>`
    113105
    114106
     107Note that this plugin is using the Wordpress API In order to include its needed Javascript files. Some other plugins or themes that are not using that API could mess up with this plugin.
    115108
     109= Creating different slideshows with different parameters: =
     110
     111You can use different slideshows with different parameters easily ! Simply use the shortcode way to insert slideshows, save this options, then configure the slider, make a preview, copy the shortcode relulting of those parameters, and insert this shortcode everywhere you want a slideshow to be displayed ! You can create as many different slideshow as you got posts and pages into your blog. Remember that only the fist slideshow displayed on a page will work.
     112
     113= In case of trouble: =
     114
     115    * Make sure you have read the "How to use": http://wordpress.org/extend/plugins/frontpage-slideshow/other_notes/
     116    * Read this page: http://wordpress.org/support/topic/322689
     117    * Look at the other support questions there: http://wordpress.org/tags/frontpage-slideshow
     118    * If you want to post a support question, create a new topic by using this link: http://wordpress.org/tags/frontpage-slideshow#postform
     119
     120= Plugin unique ID =
     121
     122In order to faster bug reports, troubleshoot and for some statistics, some informations are collected and sent to this plugin:'s author.
     123The informations that are sent are this site URL, this site admin email address, the Wordpress version, the used theme and its URI, and the used version of this plugin.
     124If you need help to troubleshoot, don't forget to transmit your plugin unique ID.
     125You can find this plugin unique ID by visiting the plugin admin page at the very end of the "How to use / Getting help" section
Note: See TracChangeset for help on using the changeset viewer.