prefix}referrer_detector"; $rdetector_db_version = '1.0'; $rdetector_text_domain = 'referrer_detector'; $rdetector_plugin_dir = get_settings('siteurl') . '/wp-content/plugins/referrer-detector/'; $rdetector_wpadmin_index_page = get_settings('siteurl') . '/wp-admin/index.php'; $rdetector_help_url = 'http://www.phoenixheart.net/2008/11/referrer_detector'; define('RDETECTOR_CUSTOM_TAG', '{referrer_detector}'); define('RDETECTOR_NONCE_ACTION', md5($rdetector_plugin_name . $rdetector_wpadmin_index_page)); load_plugin_textdomain($rdetector_text_domain); $rdetector_add_help = '
To add or edit an entry, you’re provided with a simple form with 5 fields.
<div><h1><h2><h3><p><span><a><ul><ol><li><hr><br><table><thead><tbody><tfoot><tr><td><th><strong><em> Also, these tags may be used:
Those options are used to specify if you want to show the greeting box on every post, page, before or after… Notice that if you can include a {referrer_detector} anywhere in your post to show the welcome text. If the visitor didn’t come from any of the referrers, don’t worry, the plugin is smart enough to hide that ugly tag from your post.
Starting from version 2.0, a template tag <?php if (function_exists(\'referrer_detector\')) referrer_detector(); ?> can be placed somewhere in the theme files (most likely index.php) to display a greet box too.
'; $rdetector_exclude_help = 'Here you can specify a list of urls (comma-seperated). If the visitor is comming from one of these urls, the welcome box will not be show.
For example, by adding google.com/reader into the list, you make sure that the readers won\'t see the box,
which is good since they should have registered to your feed already.
%s
%s
%s
| Name | Url | Icon | Welcome Message | Action |
|---|
%s
(%s)
';
return $message = strip_tags(html_entity_decode($message), $allowable_tags);
}
/**
* @desc Sends a fake error (for AJAX purpose)
*/
function rdetector_send_fake_error()
{
header('HTTP/1.0 404 Not Found');
exit();
}
function rdetector_prepare_post_data($post_content)
{
// don't display the greeting if it's a feed
if (is_feed())
{
return str_replace(RDETECTOR_CUSTOM_TAG, '', $post_content);
}
$url = get_permalink($post->ID);
$title = get_the_title();
$author_name = get_the_author();
$author_url = get_the_author_url();
$category_names = array();
$category_links = array();
foreach((get_the_category()) as $category)
{
$category_names[] = $category->cat_name;
$category_links[] = sprintf('%s', get_category_link($category->cat_ID), $category->cat_name);
}
$tags = array(
'url' => $url,
'title' => $title,
'link' => sprintf('%s', $url, $title),
'categorynames' => implode(', ', $category_names),
'categorylinks' => implode(', ', $category_links),
'authorname' => $author_name,
'authorurl' => $author_url,
'authorlink' => sprintf('%s', $author_url, $author_name),
);
// merge all the data into a hidden input's value
$data = '';
foreach ($tags as $key => $value)
{
$data .= "$key:" . base64_encode($value) . ',';
}
$data = sprintf('', rtrim($data, ','));
$data .= sprintf('', is_page() ? 'page' : 'post');
$post_content .= $data;
$post_content = str_replace(RDETECTOR_CUSTOM_TAG, '', $post_content);
return '' . $post_content . '';
}
add_filter('the_content', 'rdetector_prepare_post_data', 5);
/**
* @desc Includes the stylesheet for the greet box
*/
function rdetector_head()
{
global $rdetector_plugin_dir;
printf('', $rdetector_plugin_dir);
print('');
printf('', $rdetector_plugin_dir);
printf('', $rdetector_plugin_dir);
printf('', $rdetector_plugin_dir);
}
add_action('wp_head', 'rdetector_head');
/**
* @desc
*/
function referrer_detector()
{
echo '';
}