.
*/
class wpgb {
function get_default_options() {
return array(
'before_greet' => '
',
'after_greet' => '
',
'before_icon' => '
',
'after_icon' => '
',
'before_text' => '
',
'after_text' => '
',
'exclude_referrer' => 'friendfeed.com'.chr(10).'google.com/reader',
'can_close' => 1,
'regex_rules' => 0,
'show_post' => 1,
'show_page' => 0,
'position' => 'before',
'show_link' => 1,
'show_advanced_options' => 0,
'show_related' => 1,
'show_related_excerpt' => 1,
'related_limit' => 5,
'related_excerpt_len' => 20,
'rss_link' => get_bloginfo('rss_url'),
'message_default' => array(
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'rss_icon.png',
'timeout' => 14400,
'text' => 'Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic.'
),
'message_noscript' => array(
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'rss_icon.png',
'text' => 'Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic.'
),
'messages' => array(
array(
'referrer' => 'del.icio.us, delicious.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'delicious_icon.png',
'timeout' => 0,
'text' => 'Hello fellow Delicious user! Feel free to bookmark this page for future reference if you like it!'
),
array(
'referrer' => 'digg.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'digg_icon.png',
'timeout' => 0,
'text' => 'Hello fellow Digger! If you like this article, please help me out by giving me some digg love!'
),
array(
'referrer' => 'google.*',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'google_icon.png',
'timeout' => 1440,
'text' => 'Welcome Googler! If you find this page useful, you might want to subscribe to the RSS feed for updates on this topic.'
),
array(
'referrer' => 'stumbleupon.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'stumbleupon_icon.png',
'timeout' => 0,
'text' => 'Hello fellow Stumbler! Don\'t forget to give me a thumbs up and subscribe to the RSS feed if you like this page!'
),
array(
'referrer' => 'technorati.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'technorati_icon.png',
'timeout' => 0,
'text' => 'Hello fellow Technorati user! Don\'t forget to favorite this blog if you like it!'
),
array(
'referrer' => 'twitter.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'twitter_icon.png',
'timeout' => 0,
'text' => 'Hello fellow Twitter user! Don\'t forget to Twit this post if you like it, or follow me on Twitter if you find me interesting.'
),
array(
'referrer' => 'search.yahoo.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'yahoo_icon.png',
'timeout' => 1440,
'text' => 'Welcome fellow Yahooligan! If you find this page useful, you might want to subscribe to the RSS feed for updates on this topic.'
),
array(
'referrer' => 'search.live.com, search.msn.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'live_icon.png',
'timeout' => 1440,
'text' => 'Hello there Live-ly searcher! If you find this page useful, you might want to subscribe to the RSS feed for updates on this topic.'
),
array(
'referrer' => 'blinklist.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'blinklist_icon.png',
'timeout' => 0,
'text' => 'Hello there fellow Blinklist user! Feel free to bookmark this page for future reference if you like it!'
),
array(
'referrer' => 'blogmarks.net',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'blogmarks_icon.png',
'timeout' => 0,
'text' => 'Hello there Blogmarks user! Feel free to bookmark this page for future reference if you like it!'
),
array(
'referrer' => 'diigo.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'diigo_icon.png',
'timeout' => 0,
'text' => 'Hello there Diigo user! Feel free to bookmark this page for future reference if you like it!'
),
array(
'referrer' => 'facebook.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'facebook_icon.png',
'timeout' => 0,
'text' => 'Hello there Facebook friend! If you like this article, please help spread the word by sharing this post with your friends.'
),
array(
'referrer' => 'furl.net',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'furl_icon.png',
'timeout' => 0,
'text' => 'Hello there Furl user! Please feel free to bookmark this page for future reference if you like it.'
),
array(
'referrer' => 'ma.gnolia.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'magnolia_icon.png',
'timeout' => 0,
'text' => 'Hello there Magnolia user! Please feel free to bookmark this page for future reference if you like it.'
),
array(
'referrer' => 'mister-wong.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'mrwong_icon.png',
'timeout' => 0,
'text' => 'Hello there Mister Wong user! Please feel free to bookmark this page for future reference if you like it.'
),
array(
'referrer' => 'myspace.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'myspace_icon.png',
'timeout' => 0,
'text' => 'Hello there friend of MySpace! If you like this article, please help spread the word by sharing this post with your friends.'
),
array(
'referrer' => 'newsvine.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'newsvine_icon.png',
'timeout' => 0,
'text' => 'Hello there Newsvine user! If you find this article useful, please remember to vote for this article on Newsvine.'
),
array(
'referrer' => 'reddit.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'reddit_icon.png',
'timeout' => 0,
'text' => 'Hello there follow Reddit user! If you like this article, please remember to vote for this article on Reddit.'
),
array(
'referrer' => 'simpy.com',
'disable' => 0,
'icon' => wpgb::get_plugin_url().'/images/'.'simpy_icon.png',
'timeout' => 0,
'text' => 'Hello there Simpy user! Please feel free to bookmark this page for future reference if you like it.'
),
array(
'referrer' => 'example.com',
'disable' => 1,
'icon' => wpgb::get_plugin_url().'/images/'.'favorite_icon.png',
'timeout' => 0,
'text' => 'Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic.'
),
array(
'referrer' => 'netvibes.com',
'disable' => 1,
'icon' => wpgb::get_plugin_url().'/images/'.'netvibes_icon.png',
'timeout' => 0,
'text' => 'Hello there Netvibes user! If you find this article useful, then you should consider subscribing to the RSS feed in your feed reader.'
),
array(
'referrer' => 'youtube.com',
'disable' => 1,
'icon' => wpgb::get_plugin_url().'/images/'.'youtube_icon.png',
'timeout' => 0,
'text' => 'Hello there YouTuber! If you like my videos, feel free to subscribe to my RSS feed for more of my video updates.'
),
array(
'referrer' => 'flickr.com',
'disable' => 1,
'icon' => wpgb::get_plugin_url().'/images/'.'flickr_icon.png',
'timeout' => 0,
'text' => 'Hello there Flickr user! If you like my photo, you might want to subscribe to my RSS feed to receive regular photo updates.'
)
)
);
}
function activate() {
global $wpdb;
$wpdb->hide_errors();
$wpdb->query('ALTER TABLE '.$wpdb->posts.' ENGINE = MYISAM;');
$wpdb->query('ALTER TABLE '.$wpdb->posts.' ADD FULLTEXT '.wpgb::get_name().'_post_related (post_title, post_content);');
$wpdb->show_errors();
wpgb::upgrade_options();
}
function load_admin_scripts() {
echo(
''.
''
);
// Generate admin_onload.js for security reasons.
?>
'.
''
);
}
function load_styles() {
$style= wpgb::get_plugin_url().'/css/wp-greet-box.css';
wp_register_style(wpgb::get_name().'_style', $style);
wp_enqueue_style(wpgb::get_name().'_style');
}
function queue_jquery() {
wp_enqueue_script('jquery');
}
function display_default_row($type, $wrap=true) {
extract(get_option(wpgb::get_name()));
if($type == "default"){
$m = $message_default;
$type = 'default';
}
else{
$m = $message_noscript;
$type = 'noscript';
}
if($m['disable']){
$a_action = 'activate';
$a_class = 'inactive';
$a_text= 'Activate';
}
else{
$a_action = 'deactivate';
$a_class = 'active';
$a_text = 'Deactivate';
}
if($wrap){
echo(
'
';
}
elseif ( isset($_POST['wpgb_options_reset']) ) {
// if user wants to reset all options
check_admin_referer('wpgb');
wpgb::reset_options();
echo '
WP Greet Box options has been reset.
';
}
$wpgb_options = get_option(wpgb::get_name());
// reindex here when we get the chance to reload page
$wpgb_options['messages'] = array_values($wpgb_options['messages']);
// Update options
update_option(wpgb::get_name(), $wpgb_options );
extract(get_option(wpgb::get_name()));
?>