'16', 'post_show_browser' => 'true', 'post_show_platform' => 'true', 'general_show_unknown' => 'false', 'post_location' => 'pl_before', 'show_in_dashboard' => 'true'); $auad_save_options = get_option('auad_options'); if (!empty($auad_save_options)) { foreach ($auad_save_options as $key => $option) $auad_options[$key] = $option; } update_option('auad_options', $auad_options); return $auad_options; } function auad_options() { $auad_options = get_auad_options(); if (isset($_POST['update_auad_settings'])) { $auad_options['post_icon_size'] = isset($_POST['post_icon_size']) ? $_POST['post_icon_size'] : '16'; $auad_options['post_show_browser'] = isset($_POST['post_show_browser']) ? $_POST['post_show_browser'] : 'false'; $auad_options['post_show_platform'] = isset($_POST['post_show_platform']) ? $_POST['post_show_platform'] : 'false'; $auad_options['general_show_unknown'] = isset($_POST['general_show_unknown']) ? $_POST['general_show_unknown'] : 'false'; $auad_options['post_location'] = isset($_POST['post_location']) ? $_POST['post_location'] : 'pl_before'; $auad_options['show_in_dashboard'] = isset($_POST['show_in_dashboard']) ? $_POST['show_in_dashboard'] : 'false'; update_option('auad_options', $auad_options); ?>
';
if($auad_options['post_show_platform'] != 'false')
$auad_string .= '
';
$commentID = get_comment_id();
$result = $auad_options['post_location'] == 'pl_before' ? $auad_string."\n\n" . $comment_text . "\n\n" : $comment_text."\n\n".$auad_string;
return $result;
}
function display_user_agent_author($link)
{
//print_r($link);
$plugin_url = get_option('siteurl').'/wp-content/plugins/'.plugin_basename(dirname(__FILE__));
global $comment;
if(is_feed())
return $link;
$auad_options = get_auad_options();
$browser = new Browser($comment->comment_agent);
if($auad_options['general_show_unknown'] == 'true' and $browser->Name == "Unknown" and $browser->Platform == "Unknown")
return $link;
if($auad_options['post_show_browser'] != 'false')
$auad_string = '
';
if($auad_options['post_show_platform'] != 'false')
$auad_string .= '
';
$commentID = get_comment_id();
return $link.' '.$auad_string;
}
function display_user_agent_date($input, $d = '')
{
$plugin_url = get_option('siteurl').'/wp-content/plugins/'.plugin_basename(dirname(__FILE__));
global $comment;
if(is_feed())
return '';
$auad_options = get_auad_options();
$browser = new Browser($comment->comment_agent);
if($auad_options['general_show_unknown'] == 'true' and $browser->Name == "Unknown" and $browser->Platform == "Unknown")
return '';
if($auad_options['post_show_browser'] != 'false')
$auad_string = '
';
if($auad_options['post_show_platform'] != 'false')
$auad_string .= '
';
$commentID = get_comment_id();
if(WPLANG == 'fa_IR')
echo ' '.$auad_string.' ';
else
echo $input.' '.$auad_string.' ';
}
$auad_options = get_auad_options();
if($auad_options['post_location'] == 'pl_author')
add_filter('get_comment_author','display_user_agent_author');
elseif($auad_options['post_location'] == 'pl_date')
add_filter('get_comment_date','display_user_agent_date');
else
add_filter('get_comment_text','display_user_agent');
if($auad_options['show_in_dashboard'] == 'true')
add_filter('get_comment_excerpt', 'display_user_agent');
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'auad_links' );
function auad_links($links)
{
$settings_link = ''.__('Settings', 'advanced-user-agent-displayer').'';
array_unshift($links, $settings_link);
return $links;
}
?>