i've been trying to knock out a whitelist style widget so that users could use those csocial sites with getting us hacked... again. thought i found a shortcut and took the MyBlogLog plugin and modded it with Blogcatalog. all thats been changed is any information referencing bloglog. but the js is getting eatin. not sure why. looking at the code below, can anyone see why it might work for one site but not for the other/
'// This gets called at the plugins_loaded action
function widget_blogcatalog_init() {
// Check for the required API functions
if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') )
return;
// This saves options and prints the widget's config form.
function widget_blogcatalog_control() {
$options = $newoptions = get_option('widget_blogcatalog');
if ( $_POST['blogcatalog-submit'] ) {
$valid_code = trim(stripslashes($_POST['blogcatalog-code']));
// Making sure it's a blogcatalog widget
$n_m = preg_match('/^<(script|iframe|object|a)(.+)(src|value|href)(.+)(blogcatalog\.com\/)(.+)mblID=([0-9]+)(.+)<\/(script|iframe|object|a)>$/im', $valid_code);
if($n_m == 0) {
$valid_code = '';
}
$newoptions['blogcatalog_code'] = $valid_code;
}
if ( $options != $newoptions ) {
$options = $newoptions;
update_option('widget_blogcatalog', $options);
}
?>
<div>
<p style="text-align:left">blogcatalog is how you get to know who reads your blog and why. Just install this widget. You'll get both a public photo lineup of who's been reading your blog recently and a private reporting page of what your readers read and clicked on.</p>
<p style="text-align:left">To make it work, you must go and get one of blogcatalog widget codes and then paste it below.</p>
<textarea id="blogcatalog-code" name="blogcatalog-code" style="width:370px;height:110px;padding:0px;margin:0px;"><?php echo wp_specialchars($options['blogcatalog_code'], true); ?></textarea>
<input type="hidden" name="blogcatalog-submit" id="blogcatalog-submit" value="1" />
</div>
<?php
}
// This prints the widget
function widget_blogcatalog($args) {
extract($args);
$defaults = array();
$options = (array) get_option('widget_blogcatalog');
foreach ( $defaults as $key => $value )
if ( !isset($options[$key]) )
$options[$key] = $defaults[$key];
?>
<?php echo $before_widget; ?>
<?php echo $before_title . "" . $after_title; ?>
<?php echo $options['blogcatalog_code']; ?>
<?php echo $after_widget; ?>
<?php
}
// Tell Dynamic Sidebar about our new widget and its control
register_sidebar_widget('blogcatalog', 'widget_blogcatalog');
register_widget_control('blogcatalog', 'widget_blogcatalog_control', 370, 300);
}
// Delay plugin execution to ensure Dynamic Sidebar has a chance to load first
add_action('widgets_init', 'widget_blogcatalog_init');
?>'