PluginProbe
WP-EMail / 2.01
WP-EMail v2.01
3.0.0 trunk 1.00 2.00b 2.01 2.02 2.03 2.04 2.04a 2.05 2.06 2.07 2.10 2.11 2.20 2.30 2.31 2.40 2.50 2.51 2.52 2.61 2.62 2.63 2.64 All 42 releases
wp-email / email.php

email.php in WP-EMail 2.01, at email.php

98 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: WP-EMail
4 Plugin URI: http://www.lesterchan.net/portfolio/programming.php
5 Description: Enable You To Send Your Webblog Entry To A Friend.
6 Version: 2.01
7 Author: GaMerZ
8 Author URI: http://www.lesterchan.net
9 */
10
11
12 /* Copyright 2005 Lester Chan (email : gamerz84@hotmail.com)
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */
28
29
30 ### E-Mail Table Name
31 $wpdb->email = $table_prefix . 'email';
32
33 ### Function: E-Mail Administration Menu
34 add_action('admin_menu', 'email_menu');
35 function email_menu() {
36 if (function_exists('add_menu_page')) {
37 add_menu_page('E-Mail', 'E-Mail', 1, 'email-manager.php');
38 }
39 if (function_exists('add_submenu_page')) {
40 add_submenu_page('email-manager.php', __('Manage E-Mail'), __('Manage E-Mail'), 1, 'email-manager.php');
41 add_submenu_page('email-manager.php', __('E-Mail Option'), __('E-Mail Option'), 1, 'email-options.php');
42 }
43 }
44
45
46 ### Function: E-Mail htaccess ReWrite Rules
47 add_filter('generate_rewrite_rules', 'email_rewrite');
48 function email_rewrite($wp_rewrite) {
49 $rewrite_rules2 = $wp_rewrite->generate_rewrite_rule($wp_rewrite->permalink_structure.'email');
50 array_splice($rewrite_rules2, 1);
51 $r_rule = array_shift(array_keys($rewrite_rules2));
52 $r_rule = str_replace('/trackback', '', $r_rule);
53 $r_link = array_shift(array_values($rewrite_rules2));
54 $r_link = str_replace('tb=1', 'email=1', $r_link);
55 $email_rules = array($r_rule => $r_link, '(.+)/emailpage/?$' => 'index.php?pagename='.$wp_rewrite->preg_index(1).'&email=1');
56 $wp_rewrite->rules = $email_rules + $wp_rewrite->rules;
57 }
58
59
60 ### Function: E-Mail Public Variables
61 add_filter('query_vars', 'email_variables');
62 function email_variables($public_query_vars) {
63 $public_query_vars[] = 'email';
64 $public_query_vars[] = 'wp-email';
65 return $public_query_vars;
66 }
67
68
69 ### Function: Display E-Mail Link
70 function email_link($text_post = 'Email This Post', $text_page = 'EMail This Page') {
71 global $id;
72 $using_permalink = get_settings('permalink_structure');
73 $permalink = get_permalink();
74 if(!empty($using_permalink)) {
75 if(is_page()) {
76 echo '<a href="'.$permalink.'emailpage/">'.$text_page.'</a>';
77 } else {
78 echo '<a href="'.$permalink.'email/">'.$text_post.'</a>';
79 }
80 } else {
81 if(is_page()) {
82 echo '<a href="'.get_settings('home').'/wp-email.php?page_id='.$id.'">'.$text_page.'</a>';
83 } else {
84 echo '<a href="'.get_settings('home').'/wp-email.php?p='.$id.'">'.$text_post.'</a>';
85 }
86 }
87 }
88
89
90 ### Function: Load WP-EMail
91 add_action('template_redirect', 'wp_email');
92 function wp_email() {
93 if(intval(get_query_var('email')) == 1) {
94 include(ABSPATH . '/wp-email.php');
95 exit;
96 }
97 }
98 ?>