$class_name, 'description' => $calc_desc ) ); // wp_register_sidebar_widget wp_register_widget_control( $class_name, $calc_title, array($class_name, 'bodycomp_calculator_control'), array('width' => '100%') ); // wp_register_widget_congrol add_shortcode( $class_name, array($class_name, 'bodycomp_calculator_shortcode') ); // add_shortcode } // function bodycomp_calc_init function display($is_widget, $args=array()) { if ($is_widget) { extract($args); $options = get_option('eatregularlydotcom_bodycomp_calculator'); $title = $options['title']; $output[] = $before_widget . $before_title . $title . $after_title; } // if $is_widget $output[] = '
Title:
'; echo ''; } // function bodycomp_calculator_control function bodycomp_calculator_shortcode($args, $content=null) { wp_enqueue_script('bodycomp-script', plugins_url('bodycomp.js', __FILE__), false, false, false); return eatregularlydotcom_bodycomp_calculator::display(false, $args); } // function bodycomp_calculator_shortcode function bodycomp_calculator_widget($args) { wp_enqueue_script('bodycomp-script', plugins_url('bodycomp.js', __FILE__), false, false, false); echo eatregularlydotcom_bodycomp_calculator::display(true, $args); } // function bodycomp_calculator_widget } // class eatregularlydotcom_bodycomp_calculator add_action('widgets_init', array('eatregularlydotcom_bodycomp_calculator', 'bodycomp_calculator_init')); ?>