| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
define('EMAIL_SHOW_REMARKS', true); |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
if (!function_exists('add_action')) { |
|---|
| 37 |
$wp_root = '../../..'; |
|---|
| 38 |
if (file_exists($wp_root.'/wp-load.php')) { |
|---|
| 39 |
require_once($wp_root.'/wp-load.php'); |
|---|
| 40 |
} else { |
|---|
| 41 |
require_once($wp_root.'/wp-config.php'); |
|---|
| 42 |
} |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
if (!defined('WP_CONTENT_DIR')) { |
|---|
| 48 |
define( 'WP_CONTENT_DIR', ABSPATH.'wp-content'); |
|---|
| 49 |
} |
|---|
| 50 |
if (!defined('WP_CONTENT_URL')) { |
|---|
| 51 |
define('WP_CONTENT_URL', get_option('siteurl').'/wp-content'); |
|---|
| 52 |
} |
|---|
| 53 |
if (!defined('WP_PLUGIN_DIR')) { |
|---|
| 54 |
define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins'); |
|---|
| 55 |
} |
|---|
| 56 |
if (!defined('WP_PLUGIN_URL')) { |
|---|
| 57 |
define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins'); |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
add_action('init', 'email_textdomain'); |
|---|
| 63 |
function email_textdomain() { |
|---|
| 64 |
if (!function_exists('wp_print_styles')) { |
|---|
| 65 |
load_plugin_textdomain('wp-email', 'wp-content/plugins/wp-email'); |
|---|
| 66 |
} else { |
|---|
| 67 |
load_plugin_textdomain('wp-email', false, 'wp-email'); |
|---|
| 68 |
} |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
global $wpdb; |
|---|
| 74 |
$wpdb->email = $wpdb->prefix.'email'; |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
add_action('admin_menu', 'email_menu'); |
|---|
| 79 |
function email_menu() { |
|---|
| 80 |
if (function_exists('add_menu_page')) { |
|---|
| 81 |
add_menu_page(__('E-Mail', 'wp-email'), __('E-Mail', 'wp-email'), 'manage_email', 'wp-email/email-manager.php'); |
|---|
| 82 |
} |
|---|
| 83 |
if (function_exists('add_submenu_page')) { |
|---|
| 84 |
add_submenu_page('wp-email/email-manager.php', __('Manage E-Mail', 'wp-email'), __('Manage E-Mail', 'wp-email'), 'manage_email', 'wp-email/email-manager.php'); |
|---|
| 85 |
add_submenu_page('wp-email/email-manager.php', __('E-Mail Options', 'wp-email'), __('E-Mail Options', 'wp-email'), 'manage_email', 'wp-email/email-options.php'); |
|---|
| 86 |
add_submenu_page('wp-email/email-manager.php', __('Uninstall WP-EMail', 'wp-email'), __('Uninstall WP-EMail', 'wp-email'), 'manage_email', 'wp-email/email-uninstall.php'); |
|---|
| 87 |
} |
|---|
| 88 |
} |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
add_filter('generate_rewrite_rules', 'email_rewrite'); |
|---|
| 93 |
function email_rewrite($wp_rewrite) { |
|---|
| 94 |
$email_link = get_permalink(); |
|---|
| 95 |
$page_uris = $wp_rewrite->page_uri_index(); |
|---|
| 96 |
$uris = $page_uris[0]; |
|---|
| 97 |
if(substr($email_link, -1, 1) != '/' && substr($wp_rewrite->permalink_structure, -1, 1) != '/') { |
|---|
| 98 |
$email_link_text = '/email'; |
|---|
| 99 |
$email_popup_text = '/emailpopup'; |
|---|
| 100 |
} else { |
|---|
| 101 |
$email_link_text = 'email'; |
|---|
| 102 |
$email_popup_text = 'emailpopup'; |
|---|
| 103 |
} |
|---|
| 104 |
|
|---|
| 105 |
$rewrite_rules = $wp_rewrite->generate_rewrite_rule($wp_rewrite->permalink_structure.$email_link_text, EP_PERMALINK); |
|---|
| 106 |
$rewrite_rules = array_slice($rewrite_rules, 4, 1); |
|---|
| 107 |
$r_rule = array_keys($rewrite_rules); |
|---|
| 108 |
$r_rule = array_shift($r_rule); |
|---|
| 109 |
$r_rule = str_replace('/trackback', '', $r_rule); |
|---|
| 110 |
$r_link = array_values($rewrite_rules); |
|---|
| 111 |
$r_link = array_shift($r_link); |
|---|
| 112 |
$r_link = str_replace('tb=1', 'email=1', $r_link); |
|---|
| 113 |
$wp_rewrite->rules = array_merge(array($r_rule => $r_link), $wp_rewrite->rules); |
|---|
| 114 |
|
|---|
| 115 |
if(is_array($uris)) { |
|---|
| 116 |
$email_page_rules = array(); |
|---|
| 117 |
foreach ($uris as $uri => $pagename) { |
|---|
| 118 |
$wp_rewrite->add_rewrite_tag('%pagename%', "($uri)", 'pagename='); |
|---|
| 119 |
$rewrite_rules = $wp_rewrite->generate_rewrite_rules($wp_rewrite->get_page_permastruct().'/emailpage', EP_PAGES); |
|---|
| 120 |
$rewrite_rules = array_slice($rewrite_rules, 4, 1); |
|---|
| 121 |
$r_rule = array_keys($rewrite_rules); |
|---|
| 122 |
$r_rule = array_shift($r_rule); |
|---|
| 123 |
$r_rule = str_replace('/trackback', '', $r_rule); |
|---|
| 124 |
$r_link = array_values($rewrite_rules); |
|---|
| 125 |
$r_link = array_shift($r_link); |
|---|
| 126 |
$r_link = str_replace('tb=1', 'email=1', $r_link); |
|---|
| 127 |
$email_page_rules = array_merge($email_page_rules, array($r_rule => $r_link)); |
|---|
| 128 |
} |
|---|
| 129 |
$wp_rewrite->rules = array_merge($email_page_rules, $wp_rewrite->rules); |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
$rewrite_rules = $wp_rewrite->generate_rewrite_rule($wp_rewrite->permalink_structure.$email_popup_text, EP_PERMALINK); |
|---|
| 134 |
$rewrite_rules = array_slice($rewrite_rules, 4, 1); |
|---|
| 135 |
$r_rule = array_keys($rewrite_rules); |
|---|
| 136 |
$r_rule = array_shift($r_rule); |
|---|
| 137 |
$r_rule = str_replace('/trackback', '', $r_rule); |
|---|
| 138 |
$r_link = array_values($rewrite_rules); |
|---|
| 139 |
$r_link = array_shift($r_link); |
|---|
| 140 |
$r_link = str_replace('tb=1', 'emailpopup=1', $r_link); |
|---|
| 141 |
$wp_rewrite->rules = array_merge(array($r_rule => $r_link), $wp_rewrite->rules); |
|---|
| 142 |
if(is_array($uris)) { |
|---|
| 143 |
$email_page_rules = array(); |
|---|
| 144 |
foreach ($uris as $uri => $pagename) { |
|---|
| 145 |
$wp_rewrite->add_rewrite_tag('%pagename%', "($uri)", 'pagename='); |
|---|
| 146 |
$rewrite_rules = $wp_rewrite->generate_rewrite_rules($wp_rewrite->get_page_permastruct().'/emailpopuppage', EP_PAGES); |
|---|
| 147 |
$rewrite_rules = array_slice($rewrite_rules, 4, 1); |
|---|
| 148 |
$r_rule = array_keys($rewrite_rules); |
|---|
| 149 |
$r_rule = array_shift($r_rule); |
|---|
| 150 |
$r_rule = str_replace('/trackback', '', $r_rule); |
|---|
| 151 |
$r_link = array_values($rewrite_rules); |
|---|
| 152 |
$r_link = array_shift($r_link); |
|---|
| 153 |
$r_link = str_replace('tb=1', 'emailpopup=1', $r_link); |
|---|
| 154 |
$email_page_rules = array_merge($email_page_rules, array($r_rule => $r_link)); |
|---|
| 155 |
} |
|---|
| 156 |
$wp_rewrite->rules = array_merge($email_page_rules, $wp_rewrite->rules); |
|---|
| 157 |
} |
|---|
| 158 |
} |
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
add_filter('query_vars', 'email_variables'); |
|---|
| 163 |
function email_variables($public_query_vars) { |
|---|
| 164 |
$public_query_vars[] = 'email'; |
|---|
| 165 |
$public_query_vars[] = 'emailpopup'; |
|---|
| 166 |
return $public_query_vars; |
|---|
| 167 |
} |
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
add_action('wp_head', 'email_js'); |
|---|
| 172 |
function email_js() { |
|---|
| 173 |
$email_max = intval(get_option('email_multiple')); |
|---|
| 174 |
echo "\n".'<!-- Start Of Script Generated By WP-EMail 2.31 -->'."\n"; |
|---|
| 175 |
echo '<script type="text/javascript">'."\n"; |
|---|
| 176 |
echo '/* <![CDATA[ */'."\n"; |
|---|
| 177 |
echo "\t".'var email_ajax_url = \''.WP_PLUGIN_URL.'/wp-email/wp-email.php'."';\n"; |
|---|
| 178 |
echo "\t".'var email_max_allowed = \''.$email_max.'\';'."\n"; |
|---|
| 179 |
echo "\t".'var email_verify = \''.$_SESSION['email_verify'].'\';'."\n"; |
|---|
| 180 |
echo "\t".'var email_text_error = \''.js_escape(__('The Following Error Occurs:', 'wp-email')).'\';'."\n"; |
|---|
| 181 |
echo "\t".'var email_text_name_invalid = \''.js_escape(__('- Your Name is empty/invalid', 'wp-email')).'\';'."\n"; |
|---|
| 182 |
echo "\t".'var email_text_email_invalid = \''.js_escape(__('- Your Email is empty/invalid', 'wp-email')).'\';'."\n"; |
|---|
| 183 |
echo "\t".'var email_text_remarks_invalid = \''.js_escape(__('- Your Remarks is invalid', 'wp-email')).'\';'."\n"; |
|---|
| 184 |
echo "\t".'var email_text_friend_names_empty = \''.js_escape(__('- Friend Name(s) is empty', 'wp-email')).'\';'."\n"; |
|---|
| 185 |
echo "\t".'var email_text_friend_name_invalid = \''.js_escape(__('- Friend Name is empty/invalid:', 'wp-email')).'\';'."\n"; |
|---|
| 186 |
echo "\t".'var email_text_max_friend_names_allowed = \''.js_escape(sprintf(__('- Maximum %s Friend Name(s) allowed', 'wp-email'), $email_max)).'\';'."\n"; |
|---|
| 187 |
echo "\t".'var email_text_friend_emails_empty = \''.js_escape(__('- Friend Email(s) is empty', 'wp-email')).'\';'."\n"; |
|---|
| 188 |
echo "\t".'var email_text_friend_email_invalid = \''.js_escape(__('- Friend Email is invalid:', 'wp-email')).'\';'."\n"; |
|---|
| 189 |
echo "\t".'var email_text_max_friend_emails_allowed = \''.js_escape(sprintf(__('- Maximum %s Friend Email(s) allowed', 'wp-email'), $email_max)).'\';'."\n"; |
|---|
| 190 |
echo "\t".'var email_text_friends_tally = \''.js_escape(__('- Friend Name(s) count does not tally with Friend Email(s) count', 'wp-email')).'\';'."\n"; |
|---|
| 191 |
echo "\t".'var email_text_image_verify_empty = \''.js_escape(__('- Image Verification is empty', 'wp-email')).'\';'."\n"; |
|---|
| 192 |
echo '/* ]]> */'."\n"; |
|---|
| 193 |
echo '</script>'."\n"; |
|---|
| 194 |
wp_register_script('wp-email', WP_PLUGIN_URL.'/wp-email/email-js-packed.js', false, '2.31'); |
|---|
| 195 |
wp_print_scripts(array('sack', 'wp-email')); |
|---|
| 196 |
if(@file_exists(TEMPLATEPATH.'/email-css.css')) { |
|---|
| 197 |
echo '<link rel="stylesheet" href="'.get_stylesheet_directory_uri().'/email-css.css" type="text/css" media="screen" />'."\n"; |
|---|
| 198 |
} else { |
|---|
| 199 |
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/wp-email/email-css.css" type="text/css" media="screen" />'."\n"; |
|---|
| 200 |
} |
|---|
| 201 |
echo '<!-- End Of Script Generated By WP-EMail 2.31 -->'."\n"; |
|---|
| 202 |
} |
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
function email_link($email_post_text = '', $email_page_text = '', $echo = true) { |
|---|
| 207 |
global $id; |
|---|
| 208 |
$output = ''; |
|---|
| 209 |
$using_permalink = get_option('permalink_structure'); |
|---|
| 210 |
$email_options = get_option('email_options'); |
|---|
| 211 |
$email_style = intval($email_options['email_style']); |
|---|
| 212 |
$email_type = intval($email_options['email_type']); |
|---|
| 213 |
if(empty($email_post_text)) { |
|---|
| 214 |
$email_text = stripslashes($email_options['post_text']); |
|---|
| 215 |
} else { |
|---|
| 216 |
$email_text = $email_post_text; |
|---|
| 217 |
} |
|---|
| 218 |
$email_icon = WP_PLUGIN_URL.'/wp-email/images/'.$email_options['email_icon']; |
|---|
| 219 |
$email_link = get_permalink(); |
|---|
| 220 |
$email_html = stripslashes($email_options['email_html']); |
|---|
| 221 |
$onclick = ''; |
|---|
| 222 |
|
|---|
| 223 |
if(get_option('show_on_front') == 'page' && is_page()) { |
|---|
| 224 |
if(intval(get_option('page_on_front')) > 0) { |
|---|
| 225 |
$email_link = _get_page_link(); |
|---|
| 226 |
} |
|---|
| 227 |
} |
|---|
| 228 |
switch($email_type) { |
|---|
| 229 |
|
|---|
| 230 |
case 1: |
|---|
| 231 |
if(!empty($using_permalink)) { |
|---|
| 232 |
if(substr($email_link, -1, 1) != '/') { |
|---|
| 233 |
$email_link= $email_link.'/'; |
|---|
| 234 |
} |
|---|
| 235 |
if(is_page()) { |
|---|
| 236 |
if(empty($email_page_text)) { |
|---|
| 237 |
$email_text = stripslashes($email_options['page_text']); |
|---|
| 238 |
} else { |
|---|
| 239 |
$email_text = $email_page_text; |
|---|
| 240 |
} |
|---|
| 241 |
$email_link = $email_link.'emailpage/'; |
|---|
| 242 |
} else { |
|---|
| 243 |
$email_link = $email_link.'email/'; |
|---|
| 244 |
} |
|---|
| 245 |
} else { |
|---|
| 246 |
if(is_page()) { |
|---|
| 247 |
if(empty($email_page_text)) { |
|---|
| 248 |
$email_text = stripslashes($email_options['page_text']); |
|---|
| 249 |
} else { |
|---|
| 250 |
$email_text = $email_page_text; |
|---|
| 251 |
} |
|---|
| 252 |
} |
|---|
| 253 |
$email_link = $email_link.'&email=1'; |
|---|
| 254 |
} |
|---|
| 255 |
break; |
|---|
| 256 |
|
|---|
| 257 |
case 2: |
|---|
| 258 |
if(!empty($using_permalink)) { |
|---|
| 259 |
if(substr($email_link, -1, 1) != '/') { |
|---|
| 260 |
$email_link= $email_link.'/'; |
|---|
| 261 |
} |
|---|
| 262 |
if(is_page()) { |
|---|
| 263 |
if(empty($email_page_text)) { |
|---|
| 264 |
$email_text = stripslashes($email_options['page_text']); |
|---|
| 265 |
} else { |
|---|
| 266 |
$email_text = $email_page_text; |
|---|
| 267 |
} |
|---|
| 268 |
$email_link = $email_link.'emailpopuppage/'; |
|---|
| 269 |
} else { |
|---|
| 270 |
$email_link = $email_link.'emailpopup/'; |
|---|
| 271 |
} |
|---|
| 272 |
} else { |
|---|
| 273 |
if(is_page()) { |
|---|
| 274 |
if(empty($email_page_text)) { |
|---|
| 275 |
$email_text = stripslashes($email_options['page_text']); |
|---|
| 276 |
} else { |
|---|
| 277 |
$email_text = $email_page_text; |
|---|
| 278 |
} |
|---|
| 279 |
} |
|---|
| 280 |
$email_link = $email_link.'&emailpopup=1'; |
|---|
| 281 |
} |
|---|
| 282 |
$onclick = ' onclick="email_popup(this.href); return false;" '; |
|---|
| 283 |
break; |
|---|
| 284 |
} |
|---|
| 285 |
unset($email_options); |
|---|
| 286 |
switch($email_style) { |
|---|
| 287 |
|
|---|
| 288 |
case 1: |
|---|
| 289 |
$output = '<a href="'.$email_link.'"'.$onclick.' title="'.$email_text.'" rel="nofollow"><img class="WP-EmailIcon" src="'.$email_icon.'" alt="'.$email_text.'" title="'.$email_text.'" style="border: 0px;" /></a> <a href="'.$email_link.'"'.$onclick.' title="'.$email_text.'" rel="nofollow">'.$email_text.'</a>'; |
|---|
| 290 |
break; |
|---|
| 291 |
|
|---|
| 292 |
case 2: |
|---|
| 293 |
$output = '<a href="'.$email_link.'"'.$onclick.' title="'.$email_text.'" rel="nofollow"><img class="WP-EmailIcon" src="'.$email_icon.'" alt="'.$email_text.'" title="'.$email_text.'" style="border: 0px;" /></a>'; |
|---|
| 294 |
break; |
|---|
| 295 |
|
|---|
| 296 |
case 3: |
|---|
| 297 |
$output = '<a href="'.$email_link.'"'.$onclick.' title="'.$email_text.'" rel="nofollow">'.$email_text.'</a>'; |
|---|
| 298 |
break; |
|---|
| 299 |
case 4: |
|---|
| 300 |
$email_html = str_replace("%EMAIL_URL%", $email_link, $email_html); |
|---|
| 301 |
$email_html = str_replace("%EMAIL_POPUP%", $onclick, $email_html); |
|---|
| 302 |
$email_html = str_replace("%EMAIL_TEXT%", $email_text, $email_html); |
|---|
| 303 |
$email_html = str_replace("%EMAIL_ICON_URL%", $email_icon, $email_html); |
|---|
| 304 |
$output = $email_html; |
|---|
| 305 |
break; |
|---|
| 306 |
} |
|---|
| 307 |
if($echo) { |
|---|
| 308 |
echo $output."\n"; |
|---|
| 309 |
} else { |
|---|
| 310 |
return $output; |
|---|
| 311 |
} |
|---|
| 312 |
} |
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 |
add_shortcode('email_link', 'email_link_shortcode'); |
|---|
| 317 |
function email_link_shortcode($atts) { |
|---|
| 318 |
if(!is_feed()) { |
|---|
| 319 |
return email_link('', '', false); |
|---|
| 320 |
} else { |
|---|
| 321 |
return __('Note: There is an email link embedded within this post, please visit this post to email it.', 'wp-email'); |
|---|
| 322 |
} |
|---|
| 323 |
} |
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 |
|
|---|
| 327 |
if(!function_exists('snippet_words')) { |
|---|
| 328 |
function snippet_words($text, $length = 0) { |
|---|
| 329 |
$words = split(' ', $text); |
|---|
| 330 |
return join(" ",array_slice($words, 0, $length)).'...'; |
|---|
| 331 |
} |
|---|
| 332 |
} |
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
if(!function_exists('snippet_text')) { |
|---|
| 337 |
function snippet_text($text, $length = 0) { |
|---|
| 338 |
$text = html_entity_decode($text, ENT_QUOTES, get_option('blog_charset')); |
|---|
| 339 |
if (strlen($text) > $length) { |
|---|
| 340 |
return htmlentities(substr($text,0,$length), ENT_COMPAT, get_option('blog_charset')).'...'; |
|---|
| 341 |
} else { |
|---|
| 342 |
return htmlentities($text, ENT_COMPAT, get_option('blog_charset')); |
|---|
| 343 |
} |
|---|
| 344 |
} |
|---|
| 345 |
} |
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
function email_addfilters() { |
|---|
| 350 |
global $emailfilters_count; |
|---|
| 351 |
if(get_option('k2version') === false) { |
|---|
| 352 |
$loop_count = 0; |
|---|
| 353 |
} else { |
|---|
| 354 |
$loop_count = 1; |
|---|
| 355 |
} |
|---|
| 356 |
if(intval($emailfilters_count) == $loop_count) { |
|---|
| 357 |
add_filter('the_title', 'email_title'); |
|---|
| 358 |
add_filter('the_content', 'email_form', '', false, false); |
|---|
| 359 |
} |
|---|
| 360 |
$emailfilters_count++; |
|---|
| 361 |
} |
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 |
|
|---|
| 365 |
function email_removefilters() { |
|---|
| 366 |
remove_filter('the_title', 'email_title'); |
|---|
| 367 |
remove_filter('the_content', 'email_form'); |
|---|
| 368 |
} |
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
function email_pagetitle($page_title) { |
|---|
| 373 |
$page_title = '» '.__('E-Mail', 'wp-email').$page_title; |
|---|
| 374 |
return $page_title; |
|---|
| 375 |
} |
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
if(!function_exists('get_the_id')) { |
|---|
| 380 |
function get_the_id() { |
|---|
| 381 |
global $id; |
|---|
| 382 |
return $id; |
|---|
| 383 |
} |
|---|
| 384 |
} |
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
function email_get_title() { |
|---|
| 389 |
global $post; |
|---|
| 390 |
$post_title = $post->post_title; |
|---|
| 391 |
if(!empty($post->post_password)) { |
|---|
| 392 |
$post_title = sprintf(__('Protected: %s', 'wp-email'), $post_title); |
|---|
| 393 |
} elseif($post->post_status == 'private') { |
|---|
| 394 |
$post_title = sprintf(__('Private: %s', 'wp-email'), $post_title); |
|---|
| 395 |
} |
|---|
| 396 |
return $post_title; |
|---|
| 397 |
} |
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
function email_title($page_title) { |
|---|
| 402 |
if(in_the_loop()) { |
|---|
| 403 |
$post_title = email_get_title(); |
|---|
| 404 |
$post_author = the_author('', false); |
|---|
| 405 |
$post_date = get_the_time(get_option('date_format').' ('.get_option('time_format').')', '', '', false); |
|---|
| 406 |
$post_category = email_category(); |
|---|
| 407 |
$post_category_alt = strip_tags($post_category); |
|---|
| 408 |
$template_title = stripslashes(get_option('email_template_title')); |
|---|
| 409 |
$template_title = str_replace("%EMAIL_POST_TITLE%", $post_title, $template_title); |
|---|
| 410 |
$template_title = str_replace("%EMAIL_POST_AUTHOR%", $post_author, $template_title); |
|---|
| 411 |
$template_title = str_replace("%EMAIL_POST_DATE%", $post_date, $template_title); |
|---|
| 412 |
$template_title = str_replace("%EMAIL_POST_CATEGORY%", $post_category, $template_title); |
|---|
| 413 |
$template_title = str_replace("%EMAIL_BLOG_NAME%", get_bloginfo('name'), $template_title); |
|---|
| 414 |
$template_title = str_replace("%EMAIL_BLOG_URL%", get_bloginfo('url'), $template_title); |
|---|
| 415 |
$template_title = str_replace("%EMAIL_PERMALINK%", get_permalink(), $template_title); |
|---|
| 416 |
return $template_title; |
|---|
| 417 |
} else { |
|---|
| 418 |
return $page_title; |
|---|
| 419 |
} |
|---|
| 420 |
} |
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
function email_category($separator = ', ', $parents='') { |
|---|
| 425 |
return get_the_category_list($separator, $parents); |
|---|
| 426 |
} |
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
function email_content() { |
|---|
| 431 |
$content = get_email_content(); |
|---|
| 432 |
$email_snippet = intval(get_option('email_snippet')); |
|---|
| 433 |
if($email_snippet > 0) { |
|---|
| 434 |
return snippet_words($content , $email_snippet); |
|---|
| 435 |
} else { |
|---|
| 436 |
return $content; |
|---|
| 437 |
} |
|---|
| 438 |
} |
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
function email_content_alt() { |
|---|
| 443 |
remove_filter('the_content', 'wptexturize'); |
|---|
| 444 |
$content = get_email_content |
|---|