"; } return $content; } function jquery() { } function ass_loadjs(){ DEFINE('get_plugin_directory_uri', get_bloginfo('wpurl') . '/wp-content/plugins/active-share-by-orangesoda/'); if(is_single()||is_page()){ $options = get_option('as_options'); wp_register_script('active-share', get_plugin_directory_uri . 'active-share.js', array('jquery'),'1.0'); wp_enqueue_script('active-share'); if($options['as-digg']==1){ wp_register_script('as-digg', get_plugin_directory_uri . 'digg.js', array('jquery', 'active-share'),'1.0'); wp_enqueue_script('as-digg'); } } } function html2rgb($color) { if ($color[0] == '#') $color = substr($color, 1); if (strlen($color) == 6) list($r, $g, $b) = array($color[0].$color[1], $color[2].$color[3], $color[4].$color[5]); elseif (strlen($color) == 3) list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]); else return false; $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); return "$r, $g, $b"; } function print_shares($id){ $title = get_the_title($id); $options = get_option('as_options'); $bgcolor = "rgba(" . $this->html2rgb($options['as-bgcolor']) . ", " . $options['as-opacity']/100 . ")"; $color = $options['as-color']; $twocolor = $options['as-twocolor']; $width = $options['as-width']; $message = $options['as-message']; print "
'', 'as-buzzwidget'=>'', 'as-facebook'=>'', 'as-stumbleupon'=>'', 'as-digg'=>'', 'as-message'=>$_POST['as-message'], 'as-width'=>'', 'as-level'=>'' ); //validation, old change color if a valid hex colorcode if(preg_match('(#?([A-Fa-f0-9]){3}(([A-Fa-f0-9]){3})?)', $_POST['as-bgcolor'])) { $update['as-bgcolor'] = $_POST['as-bgcolor']; } else { $update['as-bgcolor'] = $oldoptions['as-bgcolor']; } if(preg_match('(#?([A-Fa-f0-9]){3}(([A-Fa-f0-9]){3})?)', $_POST['as-color'])) { $update['as-color'] = $_POST['as-color']; } else { $update['as-color'] = $oldoptions['as-color']; } if(preg_match('(#?([A-Fa-f0-9]){3}(([A-Fa-f0-9]){3})?)', $_POST['as-twocolor'])) { $update['as-twocolor'] = $_POST['as-twocolor']; } else { $update['as-color'] = $oldoptions['as-color']; } if($_POST['as-width'] < 1500 && $_POST['as-width'] > 600) { $update['as-width'] = $_POST['as-width']; } else { $update['as-width'] = 800; } if($_POST['as-opacity'] <= 100 && $_POST['as-opacity'] >= 0) { $update['as-opacity'] = $_POST['as-opacity']; } else { $update['as-opacity'] = 80; } $checkboxes = array( //all the checkboxes on the page 'as-tweetmeme'=>'', 'as-buzzwidget'=>'', 'as-facebook'=>'', 'as-stumbleupon'=>'', 'as-digg'=>'', ); //check if a checkbox is present, if so mark it as 1 in the DB else mark as 0 $checked = array_flip($_POST['checks']); foreach($checkboxes AS $check => $null){ if(isset($checked[$check])){ $update[$check] = 1; } else { $update[$check] = 0; } } update_option('as_options', $update); //update options } $option = get_option('as_options'); //load options for form display ?>