\r\n" . 'Bcc: ' .$bcc. "\r\n" . 'Reply-To: ' .$sender. "\r\n" . 'X-Mailer: Microsoft Office Outlook, Build 11.0.5510 \r\n' . 'MIME-Version: 1.0 \r\n'. 'Content-type: text/html; charset=utf-8 \r\n'; $resmail = wp_mail($recipient,$subject,$message,$header); } else $resmail = false; return $resmail; } /** * Validate email address * @param string $email * @return bool True if email address is correct */ function wpsoptin_validate_email_address($email){ return (strpos($email,"@")!==false && strpos($email,".")!==false)?true:false; } /** * Formats an error message * @param string $message * @return string The formatted message * @deprecated */ function wpsoptin_error($message){ return "
$message
"; } /** * Filter for wordpress header * Echoes styles and links to stylesheets * @todo Optimize (only use one css file) and use Wordpress standards */ function wpsoptin_head(){ global $wpsoptin; $options = $wpsoptin->get_options(); echo ' '; echo ' '; } /** * HTML button * @return string Generated HTML * @todo This function is not in use yet. Should optimize wpsoptin_content */ function wpsoptin_button($medium,$id){ } /** * Filtering the content of posts or pages * @param string $content * @return string The manipulated content */ function wpsoptin_content_filter($content){ $social_content = wpsoptin_content(); return $content.$social_content; } /** * Generate HTML optin bar * @return string Generated HTML */ function wpsoptin_content(){ global $post, $wpsoptin; $social_url = get_permalink(); $social_twitter_message = $post->post_title; $social_facebook_message = $post->post_title; $social_email_message = $post->post_title; $options = $wpsoptin->get_options(); $social_content = '
'; if($options["show_headline"]!=1) $social_content.= '
'.$options["headline"].'
'; $social_content.= ' '; if($options["show_description"]!=1) $social_content.= '

'.$options["description"].'

'; $social_content.= '
'; return $social_content; } /** * Removes all optin bars from content * Used to cleanup feeds * @param string $content * @return string Content without optin bars */ function wpsoptin_remove_for_feed($content){ while(strpos($content,"")!==false){ $begin = strpos($content,""); $end = strpos($content,""); $content = substr($content,0,$begin).substr($content,$end+strlen("")); } return $content; } /** * Generate stuff for wordpress footer and echo it * @todo Remove direct echo */ function wpsoptin_footer(){ global $wpsoptin; $options = $wpsoptin->get_options(); echo ' '; if($options["mail"]!=1){ echo '

'. __('All form fields are required.','wp-soptin').'







'. __('All form fields are required.','wp-soptin') .'

'; } } /** * Enqueue JavaScripts/CSS * @todo Add css used in wpsoptin_head and js used in wpsoptin_footer */ function wpsoptin_scripts() { global $wpsoptin; $options = $wpsoptin->get_options(); if($options["mail"]!=1) wp_enqueue_script('wp-soptin', plugins_url('social-opt-in/jquery-ui.min.js'), array('jquery'), '2.50', 'all'); else wp_enqueue_script("jquery"); } /** * Function to be called directly from theme * Echoes the optin bar */ function social_opt_in(){ global $wpsoptin; $options = $wpsoptin->get_options(); if($options["callmethod"]=="function"){ echo wpsoptin_content(); } } /** * Registration of filters and actions */ add_action('wp_footer', 'wpsoptin_footer'); add_filter('wp_head', 'wpsoptin_head'); //echo (function_exists("wpsoptin_init"))?"yes":"no"; if(!$wpsoptin) $wpsoptin = wpsoptin_init(); $options = $wpsoptin->get_options(); if($options["callmethod"]=="filter"){ add_filter('the_content', 'wpsoptin_content_filter'); add_filter('the_content_feed', 'wpsoptin_remove_for_feed'); } add_action('wp_enqueue_scripts', 'wpsoptin_scripts'); ?>