Plugin Directory

Changeset 145693


Ignore:
Timestamp:
08/14/2009 02:32:16 AM (17 years ago)
Author:
Lentil
Message:
 
Location:
gallery2-image-block-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gallery2-image-block-widget/trunk/Gallery2_ImageBlock.php

    r64764 r145693  
    44Plugin URI: http://www.theschierers.net/blog/g2-imageblock-plugin
    55Description: Display a Gallery2 Image Block if you're NOT using WPG2
    6 Version: 0.1.4
     6Version: 0.1.5
    77Author: Chris Schierer (aka Lentil)
    88Author URI: http://www.theschierers.net/blog
     
    1313// 0.1.3  2008-05-07 Initial public release candidate.
    1414// 0.1.4  2008-09-14 Update to mark valid for WP 2.6.2
     15// 0.1.5  2009-08-13 Add locally defined sanitize_key_names function, Valid for WP2.8.4
     16
     17  function sanitize_key_names($name) {
     18    $name = strtolower($name); // all lowercase
     19    $name = preg_replace('/[^a-z0-9 ]/','', $name); // nothing but a-z 0-9 and spaces
     20    $name = preg_replace('/\s+/','-', $name); // spaces become hyphens
     21    return $name;
     22  }
     23
    1524
    1625// Put functions into one big function we'll call at the plugins_loaded
     
    95104      // Remember to sanitize and format use input appropriately.
    96105      foreach($options as $key => $value)
    97         if(array_key_exists('G2_ImageBlock-'.sanitize($key), $_POST))
    98           $options[$key] = strip_tags(stripslashes($_POST['G2_ImageBlock-'.sanitize($key)]));
     106        if(array_key_exists('G2_ImageBlock-'.sanitize_key_names($key), $_POST))
     107          $options[$key] = strip_tags(stripslashes($_POST['G2_ImageBlock-'.sanitize_key_names($key)]));
    99108
    100109      // Save changes
     
    107116    // before displayihng them on the page.
    108117    foreach($options as $key => $value): ?>
    109       <p style="text-align:left"><label for="G2_ImageBlock-<?=sanitize($key)?>"><?=$key?>: <input style="width: 200px;" id="G2_ImageBlock-<?=sanitize($key)?>" name="G2_ImageBlock-<?=sanitize($key)?>" type="text" value="<?=htmlspecialchars($value, ENT_QUOTES)?>" /></label></p>
     118      <p style="text-align:left"><label for="G2_ImageBlock-<?=sanitize_key_names($key)?>"><?=$key?>: <input style="width: 200px;" id="G2_ImageBlock-<?=sanitize_key_names($key)?>" name="G2_ImageBlock-<?=sanitize_key_names($key)?>" type="text" value="<?=htmlspecialchars($value, ENT_QUOTES)?>" /></label></p>
    110119    <? endforeach;
    111120    echo '<input type="hidden" id="G2_ImageBlock-submit" name="G2_ImageBlock-submit" value="1" />';
  • gallery2-image-block-widget/trunk/readme.txt

    r64764 r145693  
    44Tags: Gallery2, image block, plugin, widget
    55Requires at least: 2.5.1?
    6 Tested up to: 2.6.2
     6Tested up to: 2.8.4
    77Stable tag: trunk
    88
Note: See TracChangeset for help on using the changeset viewer.