Plugin Directory

Changeset 147332


Ignore:
Timestamp:
08/20/2009 01:02:13 AM (17 years ago)
Author:
jeff_
Message:

Fully functional administration page

Location:
frontpage-slideshow/trunk
Files:
2 edited

Legend:

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

    r146859 r147332  
    55Plugin URI: http://www.modulaweb.fr/blog/wp-plugins/frontside-slideshow/en/
    66Description: 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>
    7 Version: 0.3
     7Version: 0.4
    88Author: Jean-François VIAL
    99Author URI: http://www.modulaweb.fr/
     
    2626*/
    2727
    28 function frontpageSlideshow($content,$admin_page=false) {
    29    
    30     $options = frontpageSlideshow_get_options();
    31 
    32     $fscategory = join(',',$options['values']['fs_cats']);
     28function frontpageSlideshow($content,$admin_page=false,$options=array()) {
     29    if (!count($options)) $options = frontpageSlideshow_get_options();
     30    if (!$options['values']['fs_is_activated'] && !$admin_page) return $content;
     31
     32    $fscategories = join(',',$options['values']['fs_cats']);
    3333
    3434    if ((!is_feed() && is_front_page()) || $admin_page) { // the slideshow is only displayed on frontpage
    3535        // get the 4th newer posts
    36         $fsposts = get_posts('category_name='.$fscategory.'&orderby=ID&numberposts='.$options['values']['fs_slides'].'&order=DESC');
     36        $fsposts = get_posts('category='.$fscategories.'&orderby=ID&numberposts='.$options['values']['fs_slides'].'&order=DESC');
    3737        // put post in more logical order
    3838        $fsposts = array_reverse($fsposts);
     
    7777}
    7878
    79 function frontpageSlideshow_header($admin_page=false) {
    80     $options = frontpageSlideshow_get_options();
    81 
    82     $fscategory = join(',',$options['values']['fs_cats']);
     79function frontpageSlideshow_header($admin_page=false,$options=array()) {
     80    if (!count($options)) $options = frontpageSlideshow_get_options();
     81    if (!$options['values']['fs_is_activated'] && !$admin_page) return;
     82
     83    $fscategories = join(',',$options['values']['fs_cats']);
    8384    if ((!is_feed() && is_front_page()) || $admin_page) { // the slideshow is only displayed on frontpage
    84         $fsposts = get_posts('category_name='.$fscategory.'&orderby=ID&numberposts='.$options['values']['fs_slides']);
     85        $fsposts = get_posts('category='.$fscategories.'&orderby=ID&numberposts='.$options['values']['fs_slides']);
    8586        $fslast = count($fsposts) - 1;
    8687   
     
    138139*/
    139140?>
     141<!--[if IE]>
     142<style type="text/css">
     143/* <![CDATA[ */
     144#fs-text {
     145    filter: alpha(opacity=<?=str_replace('%','',$options['values']['fs_text_opacity'])?>);
     146}
     147/*]]>*/
     148</style>
     149<![endif]-->
     150
    140151<style type="text/css">
    141152/* <![CDATA[ */
     
    143154    width: <?=$options['values']['fs_main_width']?>;
    144155    height: <?=$options['values']['fs_main_height']?>;
    145     border: 1px solid #444;
     156    border: 1px solid <?=$options['values']['fs_main_border_color']?>;
    146157    -moz-border-radius: 5px;
    147158    -khtml-border-radius: 5px;
     
    149160    border-radius: 5px;
    150161    overflow: hidden;
    151     background-color: black;
    152     color: white;
     162    background-color: <?=$options['values']['fs_main_color']?>;
     163    color: <?=$options['values']['fs_font_color']?>;
    153164    font-family: Verdana, Sans, Helvetica, Arial, sans-serif;
    154165
    155166}
    156167#fs-slide {
    157     float: left;
    158     width: <? if ($options['values']['fs_slide_width']) echo $options['values']['fs_slide_width']; else echo '100%'; ?>;
     168    float: <? if ($options['values']['fs_buttons_position']=='right') echo 'left'; else echo 'right'; ?>;
     169    width: <? if ($options['values']['fs_show_buttons']) echo $options['values']['fs_slide_width']; else echo '100%'; ?>;
    159170    height: 100%;
    160171    -moz-border-radius: 5px;
     
    187198}
    188199#fs-text {
    189     opacity: 0.75;
    190     background-color: black;
     200    opacity: <? echo intval(str_replace('%','',$options['values']['fs_text_opacity'])) / 100; ?>;
     201    background-color: <?=$options['values']['fs_text_bgcolor']?>;
    191202    margin-top: 10px;
    192203    padding: 10px;
     
    221232    margin: 0;
    222233    padding: 0;
    223     width: 20%;
     234    width: <?=$options['values']['fs_buttons_width']?>;
    224235    height: 100%;
    225     float: right;
     236    float: <?=$options['values']['fs_buttons_position']?>;
    226237    list-style: none;
    227238    clear: none;
     
    243254}
    244255.fs-current {
    245     background-color: #444!important;
     256    background-color: <?=$options['values']['fs_button_current_color']?>!important;
    246257}
    247258.fs-entry {
    248     background-color: #000;
     259    background-color: <?=$options['values']['fs_button_normal_color']?>;
    249260    margin: 0;
    250261    overflow: hidden;
    251262}
    252263.fs-entry:hover {
    253     background-color: #333;
     264    background-color: <?=$options['values']['fs_button_hover_color']?>;
    254265}
    255266.fs-skip {
     
    262273}
    263274
    264 function frontpageSlideshow_get_options() {
    265     $options = get_option('frontpage-slideshow',array(
    266                                 'values' => array(
    267                                     'fs_cats'       => array('fs-cat'),
    268                                     'fs_slides'         => 4,
    269                                     'fs_show_buttons'   => 1,
    270                                     'fs_main_width'     => '732px',
    271                                     'fs_main_height'    => '260px',
    272                                     'fs_slide_width'    => '80%',
    273                                     'fs_placeholder_height' => '195px',
    274                                    
    275                                 ),
    276                                 'types' => array(
    277                                     'fs_cats'       => 'array of cats',
    278                                     'fs_slides'         => 'integer',
    279                                     'fs_show_buttons'   => 'bool',
    280                                     'fs_main_width'     => 'css-size',
    281                                     'fs_main_height'    => 'css-size',
    282                                     'fs_slide_width'    => 'css-size',
    283                                     'fs_placeholder_height' => 'css-size',
    284                                 ),
    285                                 'names' => array(
    286                                     'fs_cats'       => __('The categories','frontpage-slideshow'),
    287                                     'fs_slides'         => __('The number of slides to show','frontpage-slideshow'),
    288                                     'fs_show_buttons'   => __('The "Show buttons" option','frontpage-slideshow'),
    289                                     'fs_main_width'     => __('The slideshow width','frontpage-slideshow'),
    290                                     'fs_main_height'    => __('The slideshow height','frontpage-slideshow'),
    291                                     'fs_slide_width'    => __('The image width','frontpage-slideshow'),
    292                                     'fs_placeholder_height' => __('The main text top','frontpage-slideshow'),
    293                                 ),
    294                               ));
    295     return $options;
     275function frontpageSlideshow_get_options($get_defaults=false) {
     276    $defaults = array (
     277                'values' => array (
     278                    'fs_is_activated'       => 1,
     279                    'fs_cats'           => array ('1'),
     280                    'fs_slides'             => 4,
     281                    'fs_show_buttons'       => 1,
     282                    'fs_main_width'         => '732px',
     283                    'fs_main_height'        => '260px',
     284                    'fs_slide_width'        => '80%',
     285                    'fs_buttons_width'      => '20%',
     286                    'fs_placeholder_height'     => '195px',
     287                    'fs_button_normal_color'    => '#000',
     288                    'fs_button_hover_color'     => '#333',
     289                    'fs_button_current_color'   => '#444',
     290                    'fs_buttons_position'       => 'right',
     291                    'fs_text_bgcolor'       => '#000',
     292                    'fs_text_opacity'       => '75%',
     293                    'fs_main_color'         => '#000',
     294                    'fs_font_color'         => '#fff',
     295                    'fs_main_border_color'      => '#444',
     296                ));
     297    $infos = array (
     298                'types' => array (
     299                    'fs_is_activated'       => 'bool',
     300                    'fs_cats'           => 'array of cats',
     301                    'fs_slides'             => 'integer',
     302                    'fs_show_buttons'       => 'bool',
     303                    'fs_main_width'         => 'css-size',
     304                    'fs_main_height'        => 'css-size',
     305                    'fs_slide_width'        => 'css-size',
     306                    'fs_buttons_width'      => 'css-size',
     307                    'fs_placeholder_height'     => 'css-size',
     308                    'fs_button_normal_color'    => 'css-color',
     309                    'fs_button_hover_color'     => 'css-color',
     310                    'fs_button_current_color'   => 'css-color',
     311                    'fs_buttons_position'       => 'left-right',
     312                    'fs_text_bgcolor'       => 'css-color',
     313                    'fs_text_opacity'       => 'percent',
     314                    'fs_main_color'         => 'css-color',
     315                    'fs_font_color'         => 'css-color',
     316                    'fs_main_border_color'      => 'css-color',
     317                ),
     318                'names' => array (
     319                    'fs_is_activated'       => __('The activation command','frontpage-slideshow'),
     320                    'fs_cats'           => __('The categories','frontpage-slideshow'),
     321                    'fs_slides'             => __('The number of slides to show','frontpage-slideshow'),
     322                    'fs_show_buttons'       => __('The "Show buttons" option','frontpage-slideshow'),
     323                    'fs_main_width'         => __('The slideshow width','frontpage-slideshow'),
     324                    'fs_main_height'        => __('The slideshow height','frontpage-slideshow'),
     325                    'fs_slide_width'        => __('The image width','frontpage-slideshow'),
     326                    'fs_buttons_width'      => __('The buttons width','frontpage-slideshow'),
     327                    'fs_placeholder_height'     => __('The main text top','frontpage-slideshow'),
     328                    'fs_button_normal_color'    => __('The buttons\' color (normal state)','frontpage-slideshow'),
     329                    'fs_button_hover_color'     => __('The buttons\' color (hover)','frontpage-slideshow'),
     330                    'fs_button_current_color'   => __('The buttons\' color (current)','frontpage-slideshow'),
     331                    'fs_buttons_position'       => __('The buttons position','frontpage-slideshow'),
     332                    'fs_text_bgcolor'       => __('The main text background color','frontpage-slideshow'),
     333                    'fs_text_opacity'       => __('The main text opacity','frontpage-slideshow'),
     334                    'fs_main_color'         => __('The slideshow background color','frontpage-slideshow'),
     335                    'fs_font_color'         => __('The font color','frontpage-slideshow'),
     336                    'fs_main_border_color'      => __('The slideshow border color','frontpage-slideshow'),
     337                ),
     338              );
     339                   
     340    if ($get_defaults) {
     341        $options = $defaults;
     342    } else {   
     343        $options = get_option('frontpage-slideshow',$defaults);
     344    }
     345   
     346    return $options + $infos;
    296347}
    297348
     
    303354    add_options_page('Frontpage Slideshow', 'Frontpage Slideshow', 8, 'frontpage-slideshow', 'frontpageSlideshow_admin_options');
    304355}
    305 
    306 function frontpageSlideshow_admin_options() {
     356function frontpageSlideshow_validate_options() {
    307357    $options = frontpageSlideshow_get_options();
    308     if($_POST["fs_submit"]) {
    309         $bad_values = array();
    310         foreach($_POST as $key => $val) {
    311             if($key != "frontpage-slideshow_submit") {
    312                 $value_ok = false;
    313                 switch ($options['types'][$key]) {
    314                     case 'array of cats':
    315                         if (!is_array($val)) {
    316                             $bad_values[] = $options['names'][$key];
    317                         } else {
    318                             $cats = get_categories('hide_empty=0&depth=1');
    319                             $cats_ = array();
    320                             foreach($cats as $c) {
    321                                 $cats_[] = $c;
    322                             }
    323                             unset ($cats);
    324                             foreach ($val as $v) {
    325                                 if (!in_array($v,$cats_)) {
    326                                     $bad_values[] = $options['names'][$key];
    327                                     $value_ok = false;
    328                                     break;
    329                                 } else {
    330                                     $value_ok = true;
    331                                 }
     358    $submit_buttons = array('fs_submit','fs_preview','fs_reset_preview','fr_reset');
     359    $bad_values = array();
     360    foreach($_POST as $key => $val) {
     361        if (!in_array($key,$submit_buttons)) {
     362            $value_ok = false;
     363            switch ($options['types'][$key]) {
     364                case 'array of cats':
     365                    if (!is_array($val)) {
     366                        $bad_values[] = $options['names'][$key];
     367                    } else {
     368                        $cats = get_categories('hide_empty=0&depth=1');
     369                        $cats_ = array();
     370                        foreach($cats as $c) {
     371                            $cats_[] = $c->cat_ID;
     372                        }
     373                        unset ($cats);
     374                        foreach ($val as $v) {
     375                            if (!in_array($v,$cats_)) {
     376                                $bad_values[] = $options['names'][$key];
     377                                $value_ok = false;
     378                                break;
     379                            } else {
     380                                $value_ok = true;
    332381                            }
    333382                        }
    334                         break;
    335                     case 'integer':
    336                         if (!is_int($val)) {
    337                             $bad_values[] = $options['names'][$key];
    338                         } else {
    339                             $value_ok = true;
    340                         }
    341                         break;
    342                     case 'bool':
    343                         if (is_bool($val) || $val ==  1 || $val == 0) {
    344                             $value_ok = true;
    345                         } else {
    346                             $bad_values[] = $options['names'][$key];
    347                         }
    348                         break;
    349                     case 'css-size':
    350                         if (!preg_match('/^-{0,1}[0-9]{1,5}\.{0,1}[0-9]{0,2} {0,}(em|in|pt|pc|cm|mm|ex|px|%){0,1}$/i',trim($val))) {
    351                             $bad_values[] = $options['names'][$key];
    352                         } else {
    353                             $val = strtolower(str_replace(' ','',trim($val)));
    354                             $value_ok = true;
    355                         }
    356                         break;
    357                 }
    358                 if ($value_ok) {
    359                     if ( is_array($val) ) {
    360                         $options[$key] = $val;
     383                    }
     384                    break;
     385                case 'integer':
     386                    if (!preg_match('/^[1-9]$/i',trim($val))) {
     387                        $bad_values[] = $options['names'][$key];
    361388                    } else {
    362                         $options[$key] = stripslashes($val);
     389                        $value_ok = true;
    363390                    }
     391                    break;
     392                case 'bool':
     393                    if (is_bool($val) || $val ==  1 || $val == 0) {
     394                        $value_ok = true;
     395                    } else {
     396                        $bad_values[] = $options['names'][$key];
     397                    }
     398                    break;
     399                case 'css-size':
     400                    if (!preg_match('/^-{0,1}[0-9]{1,5}\.{0,1}[0-9]{0,2} {0,}(em|in|pt|pc|cm|mm|ex|px|%){0,1}$/i',trim($val))) {
     401                        $bad_values[] = $options['names'][$key];
     402                    } else {
     403                        $val = strtolower(str_replace(' ','',trim($val)));
     404                        $value_ok = true;
     405                    }
     406                    break;
     407                case 'css-color':
     408                    $colors = array('aqua','green','orange','white','black','lime','purple','yellow','blue','maroon','red','fuschia','navy','silver','gray','olive','teal');
     409                    if (!preg_match('/^#([0-9A-F]{3}|[[0-9A-F]{6})$/i',trim($val)) && !in_array(strtolower(trim($val)),$colors)) {
     410                        $bad_values[] = $options['names'][$key];
     411                    } else {
     412                        $val = strtolower(trim($val));
     413                        $value_ok = true;
     414                    }
     415                    break;
     416                case 'left-right':
     417                    $choices = array('left','right');
     418                    if (!in_array(strtolower(trim($val)),$choices)) {
     419                        $bad_values[] = $options['names'][$key];
     420                    } else {
     421                        $val = strtolower(trim($val));
     422                        $value_ok = true;
     423                    }
     424                    break;
     425                case 'percent':
     426                    if (!preg_match('/^[0-9]{1,3}%{0,1}$/i',trim($val))) {
     427                        $bad_values[] = $options['names'][$key];
     428                    } else {
     429                        $val = str_replace('%','',trim($val)).'%';
     430                        $value_ok = true;
     431                    }
     432                    break;
     433            }
     434            if ($value_ok) {
     435                if ( is_array($val) ) {
     436                    $options['values'][$key] = $val;
     437                } else {
     438                    $options['values'][$key] = stripslashes($val);
    364439                }
    365440            }
    366441        }
    367         if (count($bad_values)) {
    368             $message = __('The ptions have NOT been updated !','frontpage-slideshow').'<br />'.__('The following values got to be corrected before to save something : ','frontpage-slideshow').'<ul>';
    369             foreach($bad_values as $b) {
    370                 $message .= '<li>'.$b.'</li>';
     442    }
     443    if (count($bad_values)) {
     444        $message = '<p>'.__('The following values got to be corrected : ','frontpage-slideshow').'</p><ul style="list-style:disc inside!important;margin-left: 15px;">';
     445        foreach($bad_values as $b) {
     446            $message .= '<li>'.$b.'</li>';
     447        }
     448        $message .= '</ul>';
     449        foreach($_POST as $key => $val) {
     450            if (!in_array($key,$submit_buttons)) {
     451                $options['values'][$key] = $val;
    371452            }
    372             $message .= '</ul>';
     453        }
     454
     455        return array('ok'=>false,'message'=>$message,'options'=>$options);
     456    } else {
     457        return array('ok'=>true,'options'=>$options);
     458    }
     459}
     460
     461function frontpageSlideshow_admin_options() {
     462    $options = frontpageSlideshow_get_options();
     463    $message = '';
     464//  delete_option('frontpage-slideshow');
     465    if($_POST['fs_submit']) {
     466        $test = frontpageSlideshow_validate_options();
     467        $options = $test['options'];
     468        if ($test['ok']) {
     469            update_option('frontpage-slideshow', array('values'=>$options['values']));
     470            $message = '<p>'.__('The options have been updated.', 'frontpage-slideshow').'</p>';
    373471        } else {
    374             update_option('frontpage-slideshow', $options);
    375             $message = __('The options have been updated.', 'frontpage-slideshow');
     472            $message = '<p>'.__('The options have NOT been updated.', 'frontpage-slideshow').'</p>'.$test['message'];
    376473        }
     474        unset($test);
     475    } else if ($_POST['fs_preview']) {
     476        $test = frontpageSlideshow_validate_options();
     477        $options = $test['options'];
     478        if ($test['ok']) {
     479            $message = '<p>'.__('The preview have been updated (the options have NOT been saved yet).', 'frontpage-slideshow').'</p>';
     480        } else {
     481            $message = '<p>'.__('The preview have NOT been updated (the options have NOT been saved yet).', 'frontpage-slideshow').'</p>'.$test['message'];
     482        }
     483        unset($test);
     484    } else if ($_POST['fs_reset_preview']) {
     485        $options = frontpageSlideshow_get_options();
     486        $message = '<p>'.__('The preview have been updated with actual values.', 'frontpage-slideshow').'</p>';
     487        $message .= '<p>'.__('Note that the preview has been reseted to the ACTUAL values, not with default ones.', 'frontpage-slideshow').'</p>';
     488    } else if ($_POST['fs_reset']) {
     489        $options = frontpageSlideshow_get_options(true);
     490        delete_option('frontpage-slideshow');
     491        update_option('frontpage-slideshow', array('values'=>$options['values']));
     492        $message = '<p>'.__('The plugins runs now with default values.', 'frontpage-slideshow').'</p>';
     493    } else if ($_POST['fs_disable']) {
     494        $options['values']['fs_is_activated'] = 0;
     495        update_option('frontpage-slideshow', array('values'=>$options['values']));
     496        $message = '<p>'.__('The plugins has been disabled.', 'frontpage-slideshow').'</p>';
     497    } else if ($_POST['fs_enable']) {
     498        $options['values']['fs_is_activated'] = 1;
     499        update_option('frontpage-slideshow', array('values'=>$options['values']));
     500        $message = '<p>'.__('The plugins has been enabled.', 'frontpage-slideshow').'</p>';
    377501    }
     502   
     503    if (!$options['values']['fs_is_activated']) $message .= '<p style="color: red; font-weight: bold;">'.__('The plugin is currently disabled.', 'frontpage-slideshow').'</p>';
    378504    ?>
    379505    <div class="wrap">
    380506        <div id="icon-plugins" class="icon32"><br/></div>
    381         <h2>Frontpage Slideshow – <?_e('Option page','frontpage-slideshow')?></h2><p></p>
     507        <h2>Frontpage Slideshow – <?_e('Option page','frontpage-slideshow')?></h2>
     508            <? if ($message!='') { ?>
     509            <div id="message" class="updated"><?=$message?></div>
     510            <? } ?>
    382511            <div id="poststuff" class="meta-box-sortables">
    383512                <div class="postbox">
    384                     <h3><span><?_e('Preview','frontpage-slideshow')?></span></h3>
     513                    <h3><span><?_e('Preview')?></span></h3>
    385514                    <div class="inside" style="padding: 5px;">
    386515                        <?
    387                             frontpageSlideshow_header(true);
    388                             echo frontpageSlideshow('',true);                       
     516                            frontpageSlideshow_header(true,$options);
     517                            echo frontpageSlideshow('',true,$options);                                                 
    389518                        ?>
     519                    </div>
     520                </div>
     521            <form method="post">
     522                <div class="postbox<? if ($options['values']['fs_is_activated']) echo ' closed' ?>">
     523                    <h3><span><? if ($options['values']['fs_is_activated']) _e('Disable the plugin','frontpage-slideshow'); else _e('Enable the plugin','frontpage-slideshow');?></span></h3>
     524                    <div class="inside" style="padding: 5px;">
     525                        <p><?
     526                            if ($options['values']['fs_is_activated']) {
     527                        ?><label for="fs_disable"><?
     528                                _e('The plugin is currently ENABLED : you can use the following button to disable it.','frontpage-slideshow')?>
     529                                <input type="submit" class="button-primary" id="fs_disable" name="fs_disable" size="2" maxlength="2" value="<?_e('Disable the plugin','frontpage-slideshow')?>" />
     530                        <?
     531                            } else {
     532                        ?><label for="fs_enable"><?
     533                                _e('The plugin is currently DISABLED : you can use the following button to enable it.','frontpage-slideshow')?>
     534                                <input type="submit" class="button-primary" id="fs_enable" name="fs_enable" size="2" maxlength="2" value="<?_e('Enable the plugin now !!','frontpage-slideshow')?>" />
     535                        <?
     536                            }
     537                        ?>
     538                        </label></p>
    390539                    </div>
    391540                </div>
    392541                <div class="postbox closed">
    393542                    <div class="handlediv" title="Cliquez pour ouvrir/fermer"><br /></div>
    394                     <h3><span><?_e('Categories','frontpage-slideshow')?></span></h3>
     543                    <h3><span><?_e('About categories','frontpage-slideshow')?></span></h3>
    395544                    <div class="inside" style="padding: 5px;">
    396545                        <p><?_e('Frontpage Slideshow will look for posts to display as slides into these categories : ','frontpage-slideshow')?></p>
     
    399548                            $cats = get_categories('hide_empty=0&depth=1');
    400549                            $count=1;
    401                             echo '<li><label for="fs_cats_'.$count.'"><input type="checkbox" disabled="disabled" checked="checked" id="fs_cats_'.$count.'" name="fs_cats[]" value="fs-cat"> fs-cat</label></li>';
     550                            //echo '<li><label for="fs_cats_'.$count.'"><input type="checkbox" disabled="disabled" checked="checked" id="fs_cats_'.$count.'" name="fs_cats[]" value="fs-cat"> fs-cat</label></li>';
    402551                            foreach ($cats as $c) {
    403                                 if ($c->cat_name!='fs-cat') {
    404                                     echo '<li><label for="fs_cats_'.$count.'"><input type="checkbox" id="fs_cats_'.$count.'" name="fs_cats[]" value="' . $c->cat_name . '"';
    405                                     if (in_array($c->cat_name,$options['values']['fs_cats'])) echo ' selected="selected"';
    406                                     echo '> ' . $c->cat_name . '</label></li>';
     552//                              if ($c->cat_name!='fs-cat') {
     553                                    echo '<li><label for="fs_cats_'.$count.'"><input type="checkbox" id="fs_cats_'.$count.'" name="fs_cats[]" value="' . $c->cat_ID . '"';
     554                                    if (in_array($c->cat_ID,$options['values']['fs_cats'])) echo ' checked="checked"';
     555                                    echo '> ' . $c->cat_name . '</label></li>'."\n";
    407556                                    $count++;
    408                                 }
     557//                              }
    409558                            }
    410559                ?>
    411560                        </ul>
     561                        <p><input type="submit" name="fs_preview" class="button-primary" value="<? _e('Preview'); ?>" /></p>
    412562                    </div>
    413563                </div>
     
    416566                    <div class="inside" style="padding: 5px;">
    417567                        <p><label for="fs_slides"><?_e('How many slides to show ?','frontpage-slideshow')?> <input type="text" id="fs_slides" name="fs_slides" size="2" maxlength="2" value="<?=$options['values']['fs_slides']?>" /></label></p>
    418                         <p><label for="fs_show_buttons"><input type="checkbox" id="fs_show_buttons" name="fs_show_buttons" value="1"<? if ($options['values']['fs_slides']) echo ' checked="checked"'?> /> <?_e('Show buttons','frontpage-slideshow')?></label></p>
     568                        <p><label for="fs_show_buttons"><select id="fs_show_buttons" name="fs_show_buttons">
     569                            <option value="1"<? if ($options['values']['fs_show_buttons']) echo ' selected="selected"'?>><? _e('Show buttons','frontpage-slideshow'); ?></option>
     570                            <option value="0"<? if (!$options['values']['fs_show_buttons']) echo ' selected="selected"'?>><? _e('Hide buttons','frontpage-slideshow'); ?></option>
     571                        </select></p>
     572                        <p><input type="submit" name="fs_preview" class="button-primary" value="<? _e('Preview'); ?>" /></p>
    419573                    </div>
    420574                </div>
    421575                <div class="postbox closed">
    422                     <h3><span><?_e('About sizes and styles','frontpage-slideshow')?></span></h3>
     576                    <h3><span><?_e('About sizes and positions','frontpage-slideshow')?></span></h3>
    423577                    <div class="inside" style="padding: 5px;">
    424578                        <p><label for="fs_main_width"><?_e('Slideshow width :','frontpage-slideshow')?> <input type="text" id="fs_main_width" name="fs_main_width" size="5" value="<?=$options['values']['fs_main_width']?>" /></label></p>
    425579                        <p><label for="fs_main_height"><?_e('Slideshow height :','frontpage-slideshow')?> <input type="text" id="fs_main_height" name="fs_main_height" size="5" value="<?=$options['values']['fs_main_height']?>" /></label></p>
    426580                        <p><label for="fs_slide_width"><?_e('Image width :','frontpage-slideshow')?> <input type="text" id="fs_slide_width" name="fs_slide_width" size="5" value="<?=$options['values']['fs_slide_width']?>" /></label></p>
     581                        <p><label for="fs_buttons_width"><?_e('Buttons width :','frontpage-slideshow')?> <input type="text" id="fs_buttons_width" name="fs_buttons_width" size="5" value="<?=$options['values']['fs_buttons_width']?>" /></label></p>
    427582                        <p><label for="fs_placeholder_height"><?_e('Main text top :','frontpage-slideshow')?> <input type="text" id="fs_placeholder_height" name="fs_placeholder_height" size="5" value="<?=$options['values']['fs_placeholder_height']?>" /></label></p>
     583                        <p><label for="fs_buttons_position"><?_e('Buttons position :','frontpage-slideshow')?> <select id="fs_buttons_position" name="fs_buttons_position">
     584                            <option value="right"<? if ($options['values']['fs_buttons_position']=='right') echo ' selected="selected"';?>><? _e('right','frontpage-slideshow') ?></option>
     585                            <option value="left"<? if ($options['values']['fs_buttons_position']=='left') echo ' selected="selected"';?>><? _e('left','frontpage-slideshow') ?></option>
     586                        </select></label></p>
     587                        <p><input type="submit" name="fs_preview" class="button-primary" value="<? _e('Preview'); ?>" /></p>
    428588                    </div>
    429589                </div>
     590                <div class="postbox closed">
     591                    <h3><span><?_e('About colors and opacities','frontpage-slideshow')?></span></h3>
     592                    <div class="inside" style="padding: 5px;">
     593                        <p><label for="fs_main_color"><?_e('Slideshow background color','frontpage-slideshow')?> <input type="text" id="fs_main_color" name="fs_main_color" size="15" value="<?=$options['values']['fs_main_color']?>" /></label></p>
     594                        <p><label for="fs_main_border_color"><?_e('Slideshow border color','frontpage-slideshow')?> <input type="text" id="fs_main_border_color" name="fs_main_border_color" size="15" value="<?=$options['values']['fs_main_border_color']?>" /></label></p>
     595                        <p><label for="fs_font_color"><?_e('Font color','frontpage-slideshow')?> <input type="text" id="fs_font_color" name="fs_font_color" size="15" value="<?=$options['values']['fs_font_color']?>" /></label></p>
     596                        <p><label for="fs_button_normal_color"><?_e('Buttons\' color (normal state)','frontpage-slideshow')?> <input type="text" id="fs_button_normal_color" name="fs_button_normal_color" size="15" value="<?=$options['values']['fs_button_normal_color']?>" /></label></p>
     597                        <p><label for="fs_button_hover_color"><?_e('Buttons\' color (hover)','frontpage-slideshow')?> <input type="text" id="fs_button_hover_color" name="fs_button_hover_color" size="15" value="<?=$options['values']['fs_button_hover_color']?>" /></label></p>
     598                        <p><label for="fs_button_current_color"><?_e('Buttons\' color (current)','frontpage-slideshow')?> <input type="text" id="fs_button_current_color" name="fs_button_current_color" size="15" value="<?=$options['values']['fs_button_current_color']?>" /></label></p>
     599                        <p><label for="fs_text_bgcolor"><?_e('Main text background color','frontpage-slideshow')?> <input type="text" id="fs_text_bgcolor" name="fs_text_bgcolor" size="15" value="<?=$options['values']['fs_text_bgcolor']?>" /></label></p>
     600                        <p><label for="fs_text_opacity"><?_e('Main text opacity','frontpage-slideshow')?> <input type="text" id="fs_text_opacity" name="fs_text_opacity" size="15" value="<?=$options['values']['fs_text_opacity']?>" /></label></p>
     601                        <p><input type="submit" name="fs_preview" class="button-primary" value="<? _e('Preview'); ?>" /></p>
     602                    </div>
     603                </div>
     604                <div class="postbox closed">
     605                    <h3><span><?_e('Reset preview or plugin','frontpage-slideshow')?></span></h3>
     606                    <div class="inside" style="padding: 5px;">
     607                        <p><label for="fs_reset_preview"><?_e('Use this button to reset the preview to the actual active configuration.','frontpage-slideshow')?> <input type="submit" id="fs_reset_preview" name="fs_reset_preview" class="button-primary" value="<? _e('Reset preview','frontpage-slideshow'); ?>" /></label></p>
     608                        <p><label for="fs_reset"><?_e('Use this button to reset the plugin to its default configuration.','frontpage-slideshow')?> <input type="submit" id="fs_reset" name="fs_reset" class="button-primary" value="<? _e('Reset the plugin','frontpage-slideshow'); ?>" onclick="if(!confirm('<?_e('There will be no way back !!!','frontpage-slideshow')?>')) return false;" onkeypress="if(!confirm('<?_e('There will be no way back !!!','frontpage-slideshow')?>')) return false;" /></label></p>
     609                    </div>
     610                </div>
     611                <p><label for="fs_submit"><?_e('When you are satified by the settings, you can press this button :','frontpage-slideshow')?>
     612                <input type="submit" id="fs_submit" name="fs_submit" class="button-primary" value="<? _e('Save the settings ans apply them immediately','frontpage-slideshow'); ?>" onclick="if(!confirm('<?_e('The changes will be seen immediately !','frontpage-slideshow')?>')) return false;" onkeypress="if(!confirm('<?_e('The changes will be seen immediately !','frontpage-slideshow')?>')) return false;" /></label></p>
    430613            </div>
     614        </form>
    431615    </div>
    432616    <script type="text/javascript">
  • frontpage-slideshow/trunk/readme.txt

    r146859 r147332  
    55Requires at least: 2.0
    66Tested up to: 2.8.4
    7 Stable tag: 0.3
     7Stable tag: 0.4
    88
    99Frontpage Slideshow provides a slide show like you can see in linux.com front page
     
    2727By default, the only 4 latest slides are displayed, but you can modify the code easily to display more or less.
    2828
    29 Actually the plugin is in version 0.1 : its the very first version and there is quite a lot of things to do like a configuration page, but it is usable out of the box right now, and is quite easily customisable.
     29Via its administration page, you can tune up the look and feel of the slider
    3030
    3131== Installation ==
    3232
    33331. Upload `frontpage-slideshow.zip` to the `/wp-content/plugins/` directory and uncompress it.
    34 1. Create a specific category called "fs-cat" and put some posts on it
    35 1. Activate the plugin through the 'Plugins' menu in WordPress
     341. Go to the plugin's administration page and configure it as you want it
     351. Activate the plugin when you are ready to
    36361. No short-tag is needed : the plugin work as soon as activated
    3737
     
    4141== Changelog ==
    4242
    43 v 0.1 : very first release usable but no option page
    44 v 0.2 : some terrible graphic bugs fixed : option page under construction and preview
    45 v 0.3 : some minor javascript and CSS bugs fixed : now the plugon is ready for the option-page and fine tunes.
     43* v 0.1 : very first release usable but no option page
     44* v 0.2 : some terrible graphic bugs fixed : option page under construction and preview
     45* v 0.3 : some minor javascript and CSS bugs fixed : now the plugon is ready for the option-page and fine tunes.
     46* v 0.4 : Fully functional administration page with preview, reset to default
    4647
    4748== Screenshots ==
     
    5051== How to use ==
    5152
    52 When it has been installed and activated, you just have to create a category called "fs-cat". You could choose to not display this category or change its name by editing the source code of plugin. When done, add posts on if : the slides will be materialized by those articles.
     53When 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.
     54The displayed image onto the slideshow is the first image of each articles, so make sure the article contains at least one image.
    5355
    54 The displayed image onto the slideshow is the first image of each articles.
    55 
    56 Then you got to ad thoses custom parameters to each slide-posts :
     56Then you got to addd thoses custom parameters to each slide-posts :
    5757
    5858    * fs-button-comment : the button specific message
     
    6262The title of slides is made by the title of posts.
    6363
     64When all is done, tune up the slider and enable it.
     65
    6466== Milestones ==
    6567
    66 1. create a configuration page <= work in progress
    67     1. allow to edit of category name and number of posts
    68         1. calculate the buttons height automatically
    69         2. allow to not display buttons  <= work in progress
     681. create a configuration page <= done
     69    1. allow to edit of category name and number of posts <= done, maybe some issues... need to test more
     70        1. calculate the buttons height automatically <= work in progress
     71        2. allow to not display buttons  <= done
    7072        3. allow to display a preview and next button on side of slider
    71     2. allow to change the size of the slider <= work in progress
    72     3. allow to fine tune the appearance of buttons
    73     4. allow to change the slide display duration
    74 2. allow the use of multiples categories to find slides <= work in progress
     73    2. allow to change the size of the slider <= done
     74    3. allow to fine tune the appearance of buttons <= partially done
     75    4. allow to change the slide display duration <= work in progress
     762. allow the use of multiples categories to find slides <= done
    75773. widgetize the slider to allow to put it on sidebar an create small sliders
    7678
Note: See TracChangeset for help on using the changeset viewer.