=') ) {
$this->init_hooks();
} else {
$this->version_warning();
}
}
/**
* Initializes the hooks for the plugin
*
* @returns Nothing
*/
function init_hooks()
{
add_action('admin_menu', array(&$this,'wp_admin'));
add_shortcode('liveadmin', array(&$this,'liveadmin_shortcode'));
global $wp_version;
if ( version_compare($wp_version, '2.8', '>=') )
add_action( 'widgets_init', array(&$this,'load_widget') );
}
/**
* Displays a warning when installed in an old Wordpress Version
*
* @returns Nothing
*/
function version_warning()
{
echo '
'.__('LiveAdmin requires WordPress version 2.7 or later!', 'liveadmin').'
';
}
/**
* Register the Widget
*
*/
function load_widget()
{
register_widget( 'liveadmin_Widget' );
}
/**
* Create and register the LiveAdmin shortcode
*
*/
function liveadmin_shortcode($atts)
{
return $this->generate_html();
}
/**
* Generate the LiveAdmin button HTML code
*
*/
function generate_html()
{
$lv_options = get_option($this->plugin_options);
if(isset($lv_options['site_key']))
$site_key = $lv_options['site_key'];
else
$site_key = 'L1ED164CV46B2D6M131A84';
$random_id = 'mod_id_wp_2_8_0';
$code = '';
$code .= '';
return $code;
}
/**
* The Admin Page and all it's functions
*
*/
function wp_admin()
{
if (function_exists('add_options_page'))
{
add_options_page( 'LiveAdmin Options', 'Live Admin', 10, __FILE__, array(&$this, 'options_page') );
}
}
function admin_message($message)
{
if ( $message )
{
?>
plugin_options, $lv_options);
$this->admin_message( __( 'The LiveAdmin settings have been updated.', 'liveadmin' ) );
}
?>
Live Admin
'widget_liveadmin', 'description' => 'LiveAdmin online customer support system' );
// Widget control settings.
$control_ops = array( 'id_base' => 'liveadmin' );
// Create the Widget
$this->WP_Widget( 'liveadmin', 'Live Admin', $widget_ops );
}
/**
* Output the Widget
*
*/
function widget( $args, $instance )
{
extract( $args );
global $liveadmin;
// Get the settings
$title = apply_filters('widget_title', $instance['title'] );
$text = $instance['text'];
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
if ( $text )
echo wpautop( $text );
echo $liveadmin->generate_html();
echo $after_widget;
}
/**
* Saves the widgets settings.
*
*/
function update( $new_instance, $old_instance )
{
$instance = $old_instance;
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
$instance['text'] = $new_instance['text'];
return $instance;
}
/**
* The Form in the Widget Admin Screen
*
*/
function form( $instance )
{
// Default Widget Settings
$defaults = array( 'title' => __('Live Support', 'liveadmin'), 'text' => '' );
$instance = wp_parse_args( (array) $instance, $defaults ); ?>