Plugin Directory

Changeset 193719


Ignore:
Timestamp:
01/13/2010 10:13:17 PM (16 years ago)
Author:
malcalevak
Message:

Rewrite of option initialization.
Implementation of URL in caption setting.
Options to select caption source order (though not functional).
Mobile setting completed.

Location:
wp-slimbox2/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-slimbox2/trunk/adminmenu.php

    r192448 r193719  
    44add_action( "admin_print_styles-$page", 'slimbox_admin_styles' );
    55
    6 if((get_option('wp_slimbox_autoload')=='')?true:false) {
    7     $options = new WPlize('wp_slimbox',array(
    8         'autoload'   => 'off',
    9         'loop' => 'off',
    10         'overlayOpacity'   => '0.8',
    11         'overlayColor' => '#000000',
    12         'overlayFadeDuration'   => '400',
    13         'resizeDuration' => '400',
    14         'resizeEasing'   => 'swing',
    15         'initialWidth' => '250',
    16         'initialHeight'   => '250',
    17         'imageFadeDuration' => '400',
    18         'captionAnimationDuration'   => '400',
    19         'counterText' => __('Image {x} of {y}', 'wp-slimbox2'),
    20         'closeKeys'   => __('27,88,67', 'wp-slimbox2'),
    21         'previousKeys' => __('37,80', 'wp-slimbox2'),
    22         'nextKeys'   =>  __('39,78', 'wp-slimbox2'),
    23         'picasaweb' => 'off',
    24         'flickr'   => 'off',
    25         'maintenance' => 'off',
    26         'cache'   => time(),
    27         'disable_css' => 'off'
    28     ));
    29 } else {
    30     $options = new WPlize('wp_slimbox',array(
     6global $options;
     7
     8if(get_option('wp_slimbox_autoload')) {//if we're using a really old version of the plugin, transfer the settings, then delete them
     9    $options->init_option(array(
    3110        'autoload'   => get_option('wp_slimbox_autoload'),
    3211        'loop' => get_option('wp_slimbox_loop'),
     
    4019        'imageFadeDuration' => get_option('wp_slimbox_imageFadeDuration'),
    4120        'captionAnimationDuration'   => get_option('wp_slimbox_captionAnimationDuration'),
     21        'caption1' => 'a-title',
     22        'caption2' => 'img-alt',
     23        'caption3' => 'img-title',
     24        'caption4' => 'None',
     25        'url' => 'on',
    4226        'counterText' => get_option('wp_slimbox_counterText'),
    4327        'closeKeys'   => get_option('wp_slimbox_closeKeys'),
     
    4630        'picasaweb' => get_option('wp_slimbox_picasaweb'),
    4731        'flickr'   => get_option('wp_slimbox_flickr'),
     32        'mobile' => 'off',
    4833        'maintenance' => get_option('wp_slimbox_maintenance'),
    49         'cache'   => get_option('wp_slimbox_cache'),
    50         'disable_css' => 'off'
     34        'cache'   => get_option('wp_slimbox_cache')
    5135    ));
    5236    delete_option('wp_slimbox_autoload');
     
    6953    delete_option('wp_slimbox_maintenance');
    7054    delete_option('wp_slimbox_cache');
     55} else if (!$options->get_option('autoload')){
     56    $options->init_option(array(
     57        'autoload'   => 'off',
     58        'loop' => 'off',
     59        'overlayOpacity'   => '0.8',
     60        'overlayColor' => '#000000',
     61        'overlayFadeDuration'   => '400',
     62        'resizeDuration' => '400',
     63        'resizeEasing'   => 'swing',
     64        'initialWidth' => '250',
     65        'initialHeight'   => '250',
     66        'imageFadeDuration' => '400',
     67        'captionAnimationDuration'   => '400',
     68        'caption1' => 'a-title',
     69        'caption2' => 'img-alt',
     70        'caption3' => 'img-title',
     71        'caption4' => 'None',
     72        'url' => 'on',
     73        'counterText' => __('Image {x} of {y}', 'wp-slimbox2'),
     74        'closeKeys'   => __('27,88,67', 'wp-slimbox2'),
     75        'previousKeys' => __('37,80', 'wp-slimbox2'),
     76        'nextKeys'   =>  __('39,78', 'wp-slimbox2'),
     77        'picasaweb' => 'off',
     78        'flickr'   => 'off',
     79        'maintenance' => 'off',
     80        'mobile' => 'off',
     81        'cache'   => time()
     82    ));
     83}
     84if (!$options->get_option('caption1')){
     85    $options->init_option(array(
     86        'caption1' => 'a-title',
     87        'caption2' => 'img-alt',
     88        'caption3' => 'img-title',
     89        'caption4' => 'None',
     90        'url' => 'on',
     91        'mobile' => 'off'
     92    ));
    7193}
    7294?>
  • wp-slimbox2/trunk/adminpage.php

    r193382 r193719  
    33    $overlayOpacity = array(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1);
    44    $msArray = array(1,100,200,300,400,500,600,700,800,900,1000);
    5     $options = new WPlize('wp_slimbox');
    6     //add donate link
     5    $caption = array('a-title','img-alt','img-title','None');
     6    global $options;
    77    //add class selection for auto-select div
    88    //choose caption source
     
    3232                'picasaweb' => $_POST['wp_slimbox_picasaweb'],
    3333                'flickr'   => $_POST['wp_slimbox_flickr'],
     34                'caption1' => $_POST['wp_slimbox_caption1'],
     35                'caption2' => $_POST['wp_slimbox_caption2'],
     36                'caption3' => $_POST['wp_slimbox_caption3'],
     37                'caption4' => $_POST['wp_slimbox_caption4'],
     38                'url' => $_POST['wp_slimbox_url'],
     39                'mobile' => $_POST['wp_slimbox_mobile'],
    3440                'maintenance' => $_POST['wp_slimbox_maintenance'],
    3541                'cache'   => $_POST['wp_slimbox_cache']
     
    4854?>
    4955    <div style="clear:both;padding-top:5px;"></div>
    50         <h2><?php _e('Settings', 'wp-slimbox2'); ?></h2>
     56        <h2><?php _e('Settings', 'wp-slimbox2');?></h2>
    5157        <table class="widefat" cellspacing="0" id="inactive-plugins-table">
    5258            <thead>
    5359            <tr>
    5460                <th scope="col" colspan="2"><?php _e('Setting', 'wp-slimbox2'); ?></th>
    55                 <th scope="col"><?php _e('Description', 'wp-slimbox2'); ?></th>
     61                <th scope="col"><?php _e('caption', 'wp-slimbox2'); ?></th>
    5662            </tr>
    5763            </thead>
     
    160166                </th>
    161167                <td class='desc'>
    162                     <p> <?php _e('This option allows the user to adjust the name of the easing effect that you want to use for the resize animation (jQuery Easing Plugin required). Many easings require a longer execution time to look good, so you should adjust the resizeDuration option above as well.', 'wp-slimbox2'); ?>
     168                    <p> <?php _e('This option allows the user to adjust the easing effect that you want to use for the resize animation (this loads an additional jQuery Easing Plugin). Many easings require a longer execution time to look good, so you should adjust the resizeDuration option above as well.', 'wp-slimbox2'); ?>
    163169                    </p>
    164170                </td>
     
    204210                <td class='desc'>
    205211                    <p> <?php _e('This option allows the user to adjust the duration of the caption animation, in milliseconds. Disabling this effect will make the caption appear instantly.', 'wp-slimbox2'); ?>
     212                    </p>
     213            </tr>
     214            <tr class='inactive'>
     215                <td class='name'><?php _e('Image Caption Source Order', 'wp-slimbox2'); ?></td>
     216                <th scope='row' class='check-column'>
     217                    <select name="wp_slimbox_caption1">
     218                    <?php selectionGen($options->get_option('caption1'),$caption); ?>
     219                    </select>
     220                    <select name="wp_slimbox_caption2">
     221                    <?php selectionGen($options->get_option('caption2'),$caption); ?>
     222                    </select>
     223                    <select name="wp_slimbox_caption3">
     224                    <?php selectionGen($options->get_option('caption3'),$caption); ?>
     225                    </select>
     226                    <select name="wp_slimbox_caption4">
     227                    <?php selectionGen($options->get_option('caption4'),$caption); ?>
     228                    </select>
     229                </th>
     230                <td class='desc'>
     231                    <p> <?php _e('This option allows the user to select the order in which to search for the caption text. The default is a-title, followed by img-alt, img-title, and None.', 'wp-slimbox2'); ?>
     232                    </p>
     233                </td>
     234            </tr>
     235            <tr class='inactive'>
     236                <td class='name'><?php _e('URL in Caption', 'wp-slimbox2'); ?></td>
     237                <th scope='row' class='check-column'>
     238                    <input type="checkbox" name="wp_slimbox_url"<?php if ($options->get_option('url') == 'on') echo ' checked="yes"';?> />
     239                </th>
     240                <td class='desc'>
     241                    <p> <?php _e('This option will render the caption as a hyperlink to the image file. This is enabled by default.', 'wp-slimbox2'); ?>
    206242                    </p>
    207243            </tr>
     
    236272                    <input type="text" name="wp_slimbox_nextKeys" class="keys" value="<?php echo $options->get_option('nextKeys'); ?>"/>
    237273                </th>
     274            </tr>
     275            <tr class='inactive'>
     276                <td class='name'><?php _e('Enable on mobiles?', 'wp-slimbox2'); ?></td>
     277                <th scope='row' class='check-column'>
     278                    <input type="checkbox" name="wp_slimbox_mobile"<?php if ($options->get_option('mobile') == 'on') echo ' checked="yes"';?> />
     279                </th>
     280                <td class='desc'>
     281                    <p> <?php _e('This option enables Slimbox on mobile phones. By default this feature is disabled.', 'wp-slimbox2'); ?>
     282                    </p>
    238283            </tr>
    239284            <tr class='inactive'>
     
    254299        <div style="clear:both;padding-top:20px;"></div>
    255300    </form>
     301    <div align="center">
     302        <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
     303            <input type="hidden" name="cmd" value="_s-xclick">
     304            <input type="hidden" name="hosted_button_id" value="<?php _e('11145898">
     305            <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
     306            <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
     307        </form>
     308        <p><b style="font-size:11px;">Support this plugin!','wp-slimbox2'); ?></b></p>
     309    </div>
    256310</div>
  • wp-slimbox2/trunk/index.php

    r193382 r193719  
    5252        wp_enqueue_script('slimbox2_autoload');
    5353        wp_localize_script( 'slimbox2_autoload', 'slimbox2_options', array(
    54             'autoload' => $options->get_option('autoload'),
     54            'autoload' => (($options->get_option('autoload') == 'on')?true:false),
    5555            'overlayColor' => $options->get_option('overlayColor'),
    5656            'loop' => (($options->get_option('loop') == 'on')?true:false),
     
    6363            'imageFadeDuration' => $options->get_option('imageFadeDuration'),
    6464            'captionAnimationDuration' => $options->get_option('captionAnimationDuration'),
     65            'caption1' => $options->get_option('caption1'),
     66            'caption2' => $options->get_option('caption2'),
     67            'caption3' => $options->get_option('caption3'),
     68            'caption4' => $options->get_option('caption4'),
     69            'url' => (($options->get_option('url') == 'on')?true:false),
    6570            'counterText' => $options->get_option('counterText'),
    6671            'closeKeys' => $options->get_option('closeKeys'),
     
    7176            'close' => WP_PLUGIN_URL.'/wp-slimbox2/images/'.__('default/closelabel.gif', 'wp-slimbox2'),
    7277            'LTR' => __('LTR', 'wp-slimbox2'),
    73             'picasaweb' => $options->get_option('picasaweb'),
    74             'flickr' => $options->get_option('flickr'),
    75             'mobile' => false
     78            'picasaweb' => (($options->get_option('picasaweb') == 'on')?true:false),
     79            'flickr' => (($options->get_option('flickr') == 'on')?true:false),
     80            'mobile' => (($options->get_option('mobile') == 'on')?true:false)
    7681        ));
    7782
  • wp-slimbox2/trunk/javascript/slimbox2_autoload.js

    r193382 r193719  
    1 //accomodate infinite scroll...clear and reset slimbox function
    2 //add support to trigger on links?
     1//pack for final release
    32jQuery(document).ready(function($) {
    43    if(slimbox2_options['mobile'] || !/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)){
     
    65        load_slimbox();
    76    }
    8 
     7});
    98    function slimbox_CSS() {
    10         $("#lbOverlay").css("background-color",String(slimbox2_options['overlayColor']));
     9    jQuery(function($) {
     10        $("#lbOverlay").css("background-color",slimbox2_options['overlayColor']);
    1111
    1212        if(slimbox2_options['LTR']=="RTL") {
     
    3434        );
    3535        $("#lbCloseLink").css("background","transparent url("+slimbox2_options["close"]+") no-repeat center");
    36     }
     36    })};
    3737
    3838    function load_slimbox() {
     39    jQuery(function($) {
    3940        var options = {
    4041                    loop: slimbox2_options['loop'],
     
    4243                    overlayFadeDuration: parseInt(slimbox2_options['overlayFadeDuration']),
    4344                    resizeDuration: parseInt(slimbox2_options['resizeDuration']),
    44                     resizeEasing: String(slimbox2_options['resizeEasing']),
     45                    resizeEasing: slimbox2_options['resizeEasing'],
    4546                    initialWidth: parseInt(slimbox2_options['initialWidth']),
    4647                    initialHeight: parseInt(slimbox2_options['initialHeight']),
    4748                    imageFadeDuration: parseInt(slimbox2_options['imageFadeDuration']),
    4849                    captionAnimationDuration: parseInt(slimbox2_options['captionAnimationDuration']),
    49                     counterText: String(slimbox2_options['counterText']),
     50                    counterText: slimbox2_options['counterText'],
    5051                    closeKeys: slimbox2_options['closeKeys'].split(',').map(Number),
    5152                    previousKeys: slimbox2_options['previousKeys'].split(',').map(Number),
     
    5354                }
    5455
    55         if(slimbox2_options['autoload']=="on") {
     56        if(slimbox2_options['autoload']) {
    5657            $("a[href]").filter(function() {
    5758                    return /\.(jpeg|bmp|jpg|png|gif)(\?[\d\w=&]*)?$/i.test(this.href);
    58                 }).slimbox(options, null, function(el) {
    59                     return (this == el) || ($(this).parents("div.post, div#page")[0] && ($(this).parents("div.post, div#page")[0] == $(el).parents("div.post, div#page")[0]));
     59                }).unbind("click").slimbox(options, function(el) {
     60                        return [el.href, (slimbox2_options['url'])?'<a href="' + el.href + '">'+el.title+'</a>':el.title];
     61                    }, function(el) {
     62                        return (this == el) || ($(this).parents("div.post, div#page")[0] && ($(this).parents("div.post, div#page")[0] == $(el).parents("div.post, div#page")[0]));
    6063                });
    6164        } else {
    62             $("a[rel^='lightbox']").slimbox(options, null, function(el) {
     65            $("a[rel^='lightbox']").unbind("click").slimbox(options, function(el) {
     66                        return [el.href, (slimbox2_options['url'])?'<a href="' + el.href + '">'+el.title+'</a>':el.title];
     67                    }, function(el) {
    6368                return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
    6469            });
    6570        }
    66         if(slimbox2_options['picasaweb']=="on") {
    67             $("a[href^='http://picasaweb.google.'] > img:first-child[src]").parent().slimbox(options, function(el) {
     71        if(slimbox2_options['picasaweb']) {
     72            $("a[href^='http://picasaweb.google.'] > img:first-child[src]").parent().unbind("click").slimbox(options, function(el) {
    6873                return [el.firstChild.src.replace(/\/s\d+(?:\-c)?\/([^\/]+)$/, "/s640/$2"),
    6974                    (el.title || el.firstChild.alt) + '<br /><a href="' + el.href + '">Picasa Web Albums page</a>'];
    7075            });
    7176        }
    72         if(slimbox2_options['flickr']=="on") {
    73             $("a[href^='http://www.flickr.com/photos/'] > img:first-child[src]").parent().slimbox(options, function(el) {
     77        if(slimbox2_options['flickr']) {
     78            $("a[href^='http://www.flickr.com/photos/'] > img:first-child[src]").parent().unbind("click").slimbox(options, function(el) {
    7479                return [el.firstChild.src.replace(/_[mts]\.(\w+)$/, ".$1"),
    7580                    (el.title || el.firstChild.alt) + '<br /><a href="' + el.href + '">Flickr page</a>'];
    7681            });
    7782        }
    78     }
    79 });
     83    })};
Note: See TracChangeset for help on using the changeset viewer.