Version Description
Changed: Added base64 encode for username and passwords ( https://github.com/WPChill/wp-smtp/issues/2 ) Added: Setting to disable the email logging. ( https://github.com/WPChill/wp-smtp/issues/3 )
Download this release
Release Info
Developer | altesin |
Plugin | WP SMTP |
Version | 1.2.4 |
Comparing to | |
See all releases |
Code changes from version 1.2.3 to 1.2.4
- assets/css/table.css +20 -20
- assets/js/table.js +126 -126
- inc/Admin.php +130 -127
- inc/Config.php +39 -39
- inc/Db.php +133 -133
- inc/Logger/Process.php +61 -49
- inc/Logger/Table.php +60 -60
- lang/wp-smtp-zh_CN.po +106 -106
- readme.txt +6 -2
- vendor/autoload.php +7 -7
- vendor/composer/ClassLoader.php +445 -445
- vendor/composer/LICENSE +21 -21
- vendor/composer/autoload_classmap.php +12 -12
- vendor/composer/autoload_namespaces.php +9 -9
- vendor/composer/autoload_psr4.php +10 -10
- vendor/composer/autoload_real.php +52 -52
- vendor/composer/autoload_static.php +38 -38
- wp-smtp.php +41 -3
- wp_smtp_admin.php +18 -5
assets/css/table.css
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
td.details-control {
|
2 |
-
background: url('../images/details_open.png') no-repeat center center;
|
3 |
-
cursor: pointer;
|
4 |
-
}
|
5 |
-
|
6 |
-
tr.details td.details-control {
|
7 |
-
background: url('../images/details_close.png') no-repeat center center;
|
8 |
-
}
|
9 |
-
|
10 |
-
#example_wrapper {
|
11 |
-
padding-top: 20px;
|
12 |
-
}
|
13 |
-
|
14 |
-
#example_wrapper .dataTables_length {
|
15 |
-
padding-right: 10px;
|
16 |
-
}
|
17 |
-
|
18 |
-
#example_wrapper .select-info {
|
19 |
-
padding-left: 5px;
|
20 |
-
font-weight: bold;
|
21 |
}
|
1 |
+
td.details-control {
|
2 |
+
background: url('../images/details_open.png') no-repeat center center;
|
3 |
+
cursor: pointer;
|
4 |
+
}
|
5 |
+
|
6 |
+
tr.details td.details-control {
|
7 |
+
background: url('../images/details_close.png') no-repeat center center;
|
8 |
+
}
|
9 |
+
|
10 |
+
#example_wrapper {
|
11 |
+
padding-top: 20px;
|
12 |
+
}
|
13 |
+
|
14 |
+
#example_wrapper .dataTables_length {
|
15 |
+
padding-right: 10px;
|
16 |
+
}
|
17 |
+
|
18 |
+
#example_wrapper .select-info {
|
19 |
+
padding-left: 5px;
|
20 |
+
font-weight: bold;
|
21 |
}
|
assets/js/table.js
CHANGED
@@ -1,127 +1,127 @@
|
|
1 |
-
function format ( d ) {
|
2 |
-
return d.message;
|
3 |
-
}
|
4 |
-
|
5 |
-
jQuery(document).ready(function($) {
|
6 |
-
var selectedIds = [];
|
7 |
-
var security = $('#md-security').data('security');
|
8 |
-
var dt = $('#example').DataTable( {
|
9 |
-
"idSrc": "mail_id",
|
10 |
-
rowId: 'mail_id',
|
11 |
-
select: true,
|
12 |
-
paging: true,
|
13 |
-
"pagingType": "full_numbers",
|
14 |
-
"processing": true,
|
15 |
-
"serverSide": true,
|
16 |
-
"ajax": wpsmtp.ajaxurl + '?action=wpsmtp_get_logs&security=' + security,
|
17 |
-
"columns": [
|
18 |
-
{
|
19 |
-
"class": "details-control",
|
20 |
-
"orderable": true,
|
21 |
-
"data": null,
|
22 |
-
"defaultContent": ""
|
23 |
-
},
|
24 |
-
{ "data": "to" },
|
25 |
-
{ "data": "timestamp" },
|
26 |
-
{ "data": "subject" },
|
27 |
-
{ "data": "error" },
|
28 |
-
],
|
29 |
-
"order": [[2, 'desc']],
|
30 |
-
dom: 'lBfrtip',
|
31 |
-
buttons: [
|
32 |
-
{ extend: 'copy', className: 'button' },
|
33 |
-
{ extend: 'csv', className: 'button' },
|
34 |
-
{
|
35 |
-
text: 'Delete Selected Rows',
|
36 |
-
className: 'button',
|
37 |
-
action: function ( e, dt, node, config ) {
|
38 |
-
var count = dt.rows( { selected: true } ).ids().toArray();
|
39 |
-
|
40 |
-
console.log( count.join(',') );
|
41 |
-
|
42 |
-
var button = $(e.target);
|
43 |
-
var security = $('#md-security').data('security');
|
44 |
-
|
45 |
-
$.ajax({
|
46 |
-
url: wpsmtp.ajaxurl + '?action=wpsmtp_delete_rows&ids=' + count.join(',') + '&security=' + security,
|
47 |
-
success : function(data){
|
48 |
-
//delete the row
|
49 |
-
dt.row('.selected').remove().draw( false );
|
50 |
-
},
|
51 |
-
error: function(xhr){
|
52 |
-
alert( 'There was an error delete the row' );
|
53 |
-
}
|
54 |
-
});
|
55 |
-
}
|
56 |
-
},
|
57 |
-
{
|
58 |
-
text: 'Delete All Rows',
|
59 |
-
className: 'button',
|
60 |
-
action: function ( e, dt, node, config ) {
|
61 |
-
|
62 |
-
var r = confirm( 'Are you sure you want to delete all log records?' );
|
63 |
-
|
64 |
-
if ( r === false ) {
|
65 |
-
return;
|
66 |
-
}
|
67 |
-
|
68 |
-
var button = $(e.target);
|
69 |
-
var security = $('#md-security').data('security');
|
70 |
-
|
71 |
-
$.ajax({
|
72 |
-
url: wpsmtp.ajaxurl + '?action=wpsmtp_delete_all_rows&security=' + security,
|
73 |
-
success : function(data){
|
74 |
-
location.reload();
|
75 |
-
},
|
76 |
-
error: function(xhr){
|
77 |
-
alert( 'There was an error delete the row' );
|
78 |
-
}
|
79 |
-
});
|
80 |
-
}
|
81 |
-
}
|
82 |
-
]
|
83 |
-
} );
|
84 |
-
|
85 |
-
dt.on('select.dt', function(e, dt, type, indexes) {
|
86 |
-
selectedIds.push(indexes[0]);
|
87 |
-
})
|
88 |
-
|
89 |
-
dt.on('deselect.dt', function(e, dt, type, indexes) {
|
90 |
-
selectedIds.splice(selectedIds.indexOf(indexes[0]), 1);
|
91 |
-
})
|
92 |
-
|
93 |
-
// Array to track the ids of the details displayed rows
|
94 |
-
var detailRows = [];
|
95 |
-
|
96 |
-
$('#example tbody').on( 'click', 'tr td.details-control', function () {
|
97 |
-
var tr = $(this).closest('tr');
|
98 |
-
var row = dt.row( tr );
|
99 |
-
var idx = $.inArray( tr.attr('id'), detailRows );
|
100 |
-
|
101 |
-
if ( row.child.isShown() ) {
|
102 |
-
tr.removeClass( 'details' );
|
103 |
-
row.child.hide();
|
104 |
-
|
105 |
-
// Remove from the 'open' array
|
106 |
-
detailRows.splice( idx, 1 );
|
107 |
-
}
|
108 |
-
else {
|
109 |
-
tr.addClass( 'details' );
|
110 |
-
row.child( format( row.data() ) ).show();
|
111 |
-
|
112 |
-
// Add to the 'open' array
|
113 |
-
if ( idx === -1 ) {
|
114 |
-
detailRows.push( tr.attr('id') );
|
115 |
-
}
|
116 |
-
}
|
117 |
-
} );
|
118 |
-
|
119 |
-
|
120 |
-
// On each draw, loop over the `detailRows` array and show any child rows
|
121 |
-
dt.on( 'draw', function () {
|
122 |
-
$.each( detailRows, function ( i, id ) {
|
123 |
-
$('#'+id+' td.details-control').trigger( 'click' );
|
124 |
-
} );
|
125 |
-
} );
|
126 |
-
|
127 |
} );
|
1 |
+
function format ( d ) {
|
2 |
+
return d.message;
|
3 |
+
}
|
4 |
+
|
5 |
+
jQuery(document).ready(function($) {
|
6 |
+
var selectedIds = [];
|
7 |
+
var security = $('#md-security').data('security');
|
8 |
+
var dt = $('#example').DataTable( {
|
9 |
+
"idSrc": "mail_id",
|
10 |
+
rowId: 'mail_id',
|
11 |
+
select: true,
|
12 |
+
paging: true,
|
13 |
+
"pagingType": "full_numbers",
|
14 |
+
"processing": true,
|
15 |
+
"serverSide": true,
|
16 |
+
"ajax": wpsmtp.ajaxurl + '?action=wpsmtp_get_logs&security=' + security,
|
17 |
+
"columns": [
|
18 |
+
{
|
19 |
+
"class": "details-control",
|
20 |
+
"orderable": true,
|
21 |
+
"data": null,
|
22 |
+
"defaultContent": ""
|
23 |
+
},
|
24 |
+
{ "data": "to" },
|
25 |
+
{ "data": "timestamp" },
|
26 |
+
{ "data": "subject" },
|
27 |
+
{ "data": "error" },
|
28 |
+
],
|
29 |
+
"order": [[2, 'desc']],
|
30 |
+
dom: 'lBfrtip',
|
31 |
+
buttons: [
|
32 |
+
{ extend: 'copy', className: 'button' },
|
33 |
+
{ extend: 'csv', className: 'button' },
|
34 |
+
{
|
35 |
+
text: 'Delete Selected Rows',
|
36 |
+
className: 'button',
|
37 |
+
action: function ( e, dt, node, config ) {
|
38 |
+
var count = dt.rows( { selected: true } ).ids().toArray();
|
39 |
+
|
40 |
+
console.log( count.join(',') );
|
41 |
+
|
42 |
+
var button = $(e.target);
|
43 |
+
var security = $('#md-security').data('security');
|
44 |
+
|
45 |
+
$.ajax({
|
46 |
+
url: wpsmtp.ajaxurl + '?action=wpsmtp_delete_rows&ids=' + count.join(',') + '&security=' + security,
|
47 |
+
success : function(data){
|
48 |
+
//delete the row
|
49 |
+
dt.row('.selected').remove().draw( false );
|
50 |
+
},
|
51 |
+
error: function(xhr){
|
52 |
+
alert( 'There was an error delete the row' );
|
53 |
+
}
|
54 |
+
});
|
55 |
+
}
|
56 |
+
},
|
57 |
+
{
|
58 |
+
text: 'Delete All Rows',
|
59 |
+
className: 'button',
|
60 |
+
action: function ( e, dt, node, config ) {
|
61 |
+
|
62 |
+
var r = confirm( 'Are you sure you want to delete all log records?' );
|
63 |
+
|
64 |
+
if ( r === false ) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
|
68 |
+
var button = $(e.target);
|
69 |
+
var security = $('#md-security').data('security');
|
70 |
+
|
71 |
+
$.ajax({
|
72 |
+
url: wpsmtp.ajaxurl + '?action=wpsmtp_delete_all_rows&security=' + security,
|
73 |
+
success : function(data){
|
74 |
+
location.reload();
|
75 |
+
},
|
76 |
+
error: function(xhr){
|
77 |
+
alert( 'There was an error delete the row' );
|
78 |
+
}
|
79 |
+
});
|
80 |
+
}
|
81 |
+
}
|
82 |
+
]
|
83 |
+
} );
|
84 |
+
|
85 |
+
dt.on('select.dt', function(e, dt, type, indexes) {
|
86 |
+
selectedIds.push(indexes[0]);
|
87 |
+
})
|
88 |
+
|
89 |
+
dt.on('deselect.dt', function(e, dt, type, indexes) {
|
90 |
+
selectedIds.splice(selectedIds.indexOf(indexes[0]), 1);
|
91 |
+
})
|
92 |
+
|
93 |
+
// Array to track the ids of the details displayed rows
|
94 |
+
var detailRows = [];
|
95 |
+
|
96 |
+
$('#example tbody').on( 'click', 'tr td.details-control', function () {
|
97 |
+
var tr = $(this).closest('tr');
|
98 |
+
var row = dt.row( tr );
|
99 |
+
var idx = $.inArray( tr.attr('id'), detailRows );
|
100 |
+
|
101 |
+
if ( row.child.isShown() ) {
|
102 |
+
tr.removeClass( 'details' );
|
103 |
+
row.child.hide();
|
104 |
+
|
105 |
+
// Remove from the 'open' array
|
106 |
+
detailRows.splice( idx, 1 );
|
107 |
+
}
|
108 |
+
else {
|
109 |
+
tr.addClass( 'details' );
|
110 |
+
row.child( format( row.data() ) ).show();
|
111 |
+
|
112 |
+
// Add to the 'open' array
|
113 |
+
if ( idx === -1 ) {
|
114 |
+
detailRows.push( tr.attr('id') );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
} );
|
118 |
+
|
119 |
+
|
120 |
+
// On each draw, loop over the `detailRows` array and show any child rows
|
121 |
+
dt.on( 'draw', function () {
|
122 |
+
$.each( detailRows, function ( i, id ) {
|
123 |
+
$('#'+id+' td.details-control').trigger( 'click' );
|
124 |
+
} );
|
125 |
+
} );
|
126 |
+
|
127 |
} );
|
inc/Admin.php
CHANGED
@@ -1,128 +1,131 @@
|
|
1 |
-
<?php
|
2 |
-
namespace WPSMTP;
|
3 |
-
|
4 |
-
class Admin {
|
5 |
-
|
6 |
-
private $wsOptions;
|
7 |
-
|
8 |
-
public static $phpmailer_error;
|
9 |
-
|
10 |
-
public function __construct() {
|
11 |
-
$this->wsOptions = get_option( 'wp_smtp_options' );
|
12 |
-
|
13 |
-
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
14 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
15 |
-
add_action( 'wp_ajax_wpsmtp_get_logs', array( $this, 'wpsmtp_get_logs' ) );
|
16 |
-
add_action( 'wp_ajax_wpsmtp_delete_rows', array( $this, 'wpsmtp_delete_rows' ) );
|
17 |
-
add_action( 'wp_ajax_wpsmtp_delete_all_rows', array( $this, 'wpsmtp_delete_all_rows' ) );
|
18 |
-
}
|
19 |
-
|
20 |
-
public function add_menu() {
|
21 |
-
add_menu_page( __( 'WP SMTP'), __( 'WP SMTP'), 'manage_options', 'wp-smtp/wp-smtp.php', array( $this, 'render_setup_menu' ) );
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
wp_register_script( '
|
44 |
-
|
45 |
-
wp_register_script( '
|
46 |
-
|
47 |
-
|
48 |
-
) );
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
'
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
128 |
}
|
1 |
+
<?php
|
2 |
+
namespace WPSMTP;
|
3 |
+
|
4 |
+
class Admin {
|
5 |
+
|
6 |
+
private $wsOptions;
|
7 |
+
|
8 |
+
public static $phpmailer_error;
|
9 |
+
|
10 |
+
public function __construct() {
|
11 |
+
$this->wsOptions = get_option( 'wp_smtp_options' );
|
12 |
+
|
13 |
+
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
14 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
15 |
+
add_action( 'wp_ajax_wpsmtp_get_logs', array( $this, 'wpsmtp_get_logs' ) );
|
16 |
+
add_action( 'wp_ajax_wpsmtp_delete_rows', array( $this, 'wpsmtp_delete_rows' ) );
|
17 |
+
add_action( 'wp_ajax_wpsmtp_delete_all_rows', array( $this, 'wpsmtp_delete_all_rows' ) );
|
18 |
+
}
|
19 |
+
|
20 |
+
public function add_menu() {
|
21 |
+
add_menu_page( __( 'WP SMTP'), __( 'WP SMTP'), 'manage_options', 'wp-smtp/wp-smtp.php', array( $this, 'render_setup_menu' ) );
|
22 |
+
|
23 |
+
if( ! isset( $this->wsOptions['disable_logs'] ) || 'yes' !== $this->wsOptions['disable_logs'] ) {
|
24 |
+
add_submenu_page( 'wp-smtp/wp-smtp.php', __( 'Mail Logs'), __( 'Mail Logs'), 'manage_options','wpsmtp_logs', array( $this, 'render_log_menu' ) );
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
public function enqueue_scripts() {
|
29 |
+
|
30 |
+
$screen = get_current_screen();
|
31 |
+
|
32 |
+
if ( ! $screen ) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
|
36 |
+
if ( $screen->id !== 'wp-smtp_page_wpsmtp_logs' ) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
wp_enqueue_style( 'wpsmtp-table', WPSMTP_ASSETS_URL . 'css/table.css' );
|
41 |
+
wp_enqueue_style( 'datatable', 'https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css' );
|
42 |
+
|
43 |
+
wp_register_script( 'datatable', 'https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js', array( 'jquery' ), false, true );
|
44 |
+
wp_register_script( 'dataTables.buttons', 'https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js', array( 'datatable' ), false, true );
|
45 |
+
wp_register_script( 'buttons.html5', 'https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js', array( 'datatable', 'dataTables.buttons' ), false, true );
|
46 |
+
wp_register_script( 'dataTables.select', 'https://cdn.datatables.net/select/1.3.1/js/dataTables.select.min.js', array( 'datatable', 'buttons.html5' ), false, true );
|
47 |
+
|
48 |
+
wp_register_script( 'wpsmtp-table', WPSMTP_ASSETS_URL . 'js/table.js', array('jquery', 'dataTables.select'),false, true );
|
49 |
+
wp_localize_script( 'wpsmtp-table', 'wpsmtp', array(
|
50 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
51 |
+
) );
|
52 |
+
|
53 |
+
wp_enqueue_script('wpsmtp-table');
|
54 |
+
}
|
55 |
+
|
56 |
+
function render_setup_menu() {
|
57 |
+
require_once WPSMTP_PATH . '/wp_smtp_admin.php';
|
58 |
+
}
|
59 |
+
|
60 |
+
public function render_log_menu() {
|
61 |
+
?>
|
62 |
+
<div class="wrap">
|
63 |
+
<h1>WPSMTP Email Logs</h1>
|
64 |
+
<?php Table::view(); ?>
|
65 |
+
</div>
|
66 |
+
<?php
|
67 |
+
}
|
68 |
+
|
69 |
+
public function wpsmtp_get_logs() {
|
70 |
+
|
71 |
+
check_ajax_referer('wpsmtp', 'security' );
|
72 |
+
|
73 |
+
$result = Db::get_instance()->get();
|
74 |
+
$records_count = Db::get_instance()->records_count();
|
75 |
+
|
76 |
+
foreach ( $result as $key => $value ) {
|
77 |
+
foreach ( $value as $index => $data ) {
|
78 |
+
if ( $index == 'message' ) {
|
79 |
+
|
80 |
+
if ( ! preg_match ('/<br>/', $data, $matches ) && ! preg_match ('/<p>/', $data, $matches ) ) {
|
81 |
+
$data = nl2br( $data );
|
82 |
+
}
|
83 |
+
|
84 |
+
$result[$key][$index] = wp_kses_post( $data );
|
85 |
+
} elseif ( is_serialized( $data ) ) {
|
86 |
+
$result[ $key ][ $index ] = implode( ',', array_map( 'esc_html', maybe_unserialize( $data ) ) );
|
87 |
+
} else {
|
88 |
+
$result[ $key ][ $index ] = esc_html( $data );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
$response = array(
|
95 |
+
"draw" => isset( $_GET['draw'] ) ? absint( $_GET['draw'] ) : 1,
|
96 |
+
"recordsTotal" => $records_count,
|
97 |
+
"recordsFiltered" => $records_count,
|
98 |
+
'data' => $result
|
99 |
+
);
|
100 |
+
|
101 |
+
if ( isset($_GET['search']['value'] ) && ! empty( $_GET['search']['value'] ) ) {
|
102 |
+
$response['recordsFiltered'] = count( $result );
|
103 |
+
}
|
104 |
+
|
105 |
+
wp_send_json( $response );
|
106 |
+
die();
|
107 |
+
}
|
108 |
+
|
109 |
+
public function wpsmtp_delete_rows() {
|
110 |
+
check_admin_referer('wpsmtp', 'security' );
|
111 |
+
|
112 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
113 |
+
wp_die( 'Permissions Error.' );
|
114 |
+
}
|
115 |
+
|
116 |
+
$data = explode( ',', $_GET['ids'] );
|
117 |
+
wp_send_json_success( Db::get_instance()->delete_items( array_map( 'absint', $data ) ) );
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
public function wpsmtp_delete_all_rows() {
|
122 |
+
check_admin_referer('wpsmtp', 'security' );
|
123 |
+
|
124 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
125 |
+
wp_die( 'Permissions Error.' );
|
126 |
+
}
|
127 |
+
|
128 |
+
wp_send_json_success( Db::get_instance()->delete_all_items() );
|
129 |
+
}
|
130 |
+
|
131 |
}
|
inc/Config.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
namespace WPSMTP;
|
3 |
-
|
4 |
-
class Config {
|
5 |
-
|
6 |
-
public static function get_setup() {
|
7 |
-
return array(
|
8 |
-
'gmail' => array(
|
9 |
-
'host' => 'smtp.gmail.com',
|
10 |
-
'security' => array(
|
11 |
-
'ssl' => 465,
|
12 |
-
'tls' => 587,
|
13 |
-
),
|
14 |
-
),
|
15 |
-
'sendgrid' => array(
|
16 |
-
'host' => 'smtp.sendgrid.net',
|
17 |
-
'security' => array(
|
18 |
-
'ssl' => 465,
|
19 |
-
'tls' => 587,
|
20 |
-
),
|
21 |
-
'username' => 'api'
|
22 |
-
),
|
23 |
-
'mailgun' => array(
|
24 |
-
'host' => 'smtp.mailgun.org',
|
25 |
-
'security' => array(
|
26 |
-
'ssl' => 465,
|
27 |
-
'tls' => 587,
|
28 |
-
),
|
29 |
-
),
|
30 |
-
'sendinblue' => array(
|
31 |
-
'host' => 'smtp-relay.sendinblue.com',
|
32 |
-
'security' => array(
|
33 |
-
'tls' => 587,
|
34 |
-
),
|
35 |
-
)
|
36 |
-
);
|
37 |
-
}
|
38 |
-
|
39 |
-
}
|
1 |
+
<?php
|
2 |
+
namespace WPSMTP;
|
3 |
+
|
4 |
+
class Config {
|
5 |
+
|
6 |
+
public static function get_setup() {
|
7 |
+
return array(
|
8 |
+
'gmail' => array(
|
9 |
+
'host' => 'smtp.gmail.com',
|
10 |
+
'security' => array(
|
11 |
+
'ssl' => 465,
|
12 |
+
'tls' => 587,
|
13 |
+
),
|
14 |
+
),
|
15 |
+
'sendgrid' => array(
|
16 |
+
'host' => 'smtp.sendgrid.net',
|
17 |
+
'security' => array(
|
18 |
+
'ssl' => 465,
|
19 |
+
'tls' => 587,
|
20 |
+
),
|
21 |
+
'username' => 'api'
|
22 |
+
),
|
23 |
+
'mailgun' => array(
|
24 |
+
'host' => 'smtp.mailgun.org',
|
25 |
+
'security' => array(
|
26 |
+
'ssl' => 465,
|
27 |
+
'tls' => 587,
|
28 |
+
),
|
29 |
+
),
|
30 |
+
'sendinblue' => array(
|
31 |
+
'host' => 'smtp-relay.sendinblue.com',
|
32 |
+
'security' => array(
|
33 |
+
'tls' => 587,
|
34 |
+
),
|
35 |
+
)
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
inc/Db.php
CHANGED
@@ -1,134 +1,134 @@
|
|
1 |
-
<?php
|
2 |
-
namespace WPSMTP;
|
3 |
-
|
4 |
-
|
5 |
-
class Db {
|
6 |
-
|
7 |
-
private $db;
|
8 |
-
|
9 |
-
private $table;
|
10 |
-
|
11 |
-
private static $instance;
|
12 |
-
|
13 |
-
public static function get_instance() {
|
14 |
-
|
15 |
-
if ( ! self::$instance ) {
|
16 |
-
self::$instance = new static();
|
17 |
-
}
|
18 |
-
|
19 |
-
return self::$instance;
|
20 |
-
}
|
21 |
-
|
22 |
-
private function __construct() {
|
23 |
-
global $wpdb;
|
24 |
-
|
25 |
-
$this->db = $wpdb;
|
26 |
-
$this->table = $wpdb->prefix . 'wpsmtp_logs';
|
27 |
-
}
|
28 |
-
|
29 |
-
public function insert( $data ) {
|
30 |
-
|
31 |
-
array_walk( $data, function ( &$value, $key ) {
|
32 |
-
if ( is_array( $value ) ) {
|
33 |
-
$value = maybe_serialize( $value );
|
34 |
-
}
|
35 |
-
});
|
36 |
-
|
37 |
-
$result_set = $this->db->insert(
|
38 |
-
$this->table,
|
39 |
-
$data,
|
40 |
-
array_fill( 0, count( $data ), '%s' )
|
41 |
-
);
|
42 |
-
|
43 |
-
if ( ! $result_set ) {
|
44 |
-
error_log( 'WP SMTP Log insert error: ' . $this->db->last_error );
|
45 |
-
|
46 |
-
return false;
|
47 |
-
}
|
48 |
-
|
49 |
-
return $this->db->insert_id;
|
50 |
-
}
|
51 |
-
|
52 |
-
public function update( $data, $where = array() ) {
|
53 |
-
array_walk( $data, function ( &$value, $key ) {
|
54 |
-
if ( is_array( $value ) ) {
|
55 |
-
$value = maybe_serialize( $value );
|
56 |
-
}
|
57 |
-
});
|
58 |
-
|
59 |
-
$this->db->update(
|
60 |
-
$this->table,
|
61 |
-
$data,
|
62 |
-
$where,
|
63 |
-
array_fill( 0, count( $data ), '%s' ),
|
64 |
-
array( '%d' )
|
65 |
-
);
|
66 |
-
}
|
67 |
-
|
68 |
-
public function get_item( $id ) {
|
69 |
-
$sql = sprintf( "SELECT * from {$this->table} WHERE `id` = '%d';", $id );
|
70 |
-
|
71 |
-
return $this->db->get_results( $sql, ARRAY_A );
|
72 |
-
|
73 |
-
}
|
74 |
-
|
75 |
-
public function get() {
|
76 |
-
$where = '';
|
77 |
-
$where_cols = array();
|
78 |
-
if ( isset($_GET['search']['value'] ) && ! empty( $_GET['search']['value'] ) ) {
|
79 |
-
$search = sanitize_text_field( $_GET['search']['value'] );
|
80 |
-
|
81 |
-
foreach ( $_GET['columns'] as $key => $col ) {
|
82 |
-
if ( $col['searchable'] && ! empty( $col['data'] ) && $col['data'] !== 'timestamp' ) {
|
83 |
-
$where_cols[] = "`{$col['data']}` LIKE '%$search%'";
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
if ( ! empty( $where_cols ) ) {
|
88 |
-
$where .= ' WHERE ' . implode( ' OR ', $where_cols );
|
89 |
-
}
|
90 |
-
|
91 |
-
}
|
92 |
-
|
93 |
-
$limit = array();
|
94 |
-
if ( isset( $_GET['start'] ) ) {
|
95 |
-
$limit[] = absint( $_GET['start'] );
|
96 |
-
}
|
97 |
-
|
98 |
-
if ( isset( $_GET['length'] ) ) {
|
99 |
-
$limit[] = absint( $_GET['length'] );
|
100 |
-
}
|
101 |
-
|
102 |
-
$limit_query = '';
|
103 |
-
if ( ! empty( $limit ) ) {
|
104 |
-
$limit_query = ' LIMIT ' . implode( ',', $limit );
|
105 |
-
}
|
106 |
-
|
107 |
-
$order = ' ORDER BY `timestamp` desc';
|
108 |
-
if ( ! empty( $_GET['order'][0] ) ) {
|
109 |
-
$col_num = $_GET['order'][0]['column'];
|
110 |
-
$col_name = $_GET['columns'][$col_num]['data'];
|
111 |
-
$order_dir = $_GET['order'][0]['dir'];
|
112 |
-
$order = " ORDER BY `{$col_name}` {$order_dir}";
|
113 |
-
}
|
114 |
-
|
115 |
-
$sql = "SELECT * from {$this->table}{$where}{$order}{$limit_query};";
|
116 |
-
|
117 |
-
error_log( $sql );
|
118 |
-
|
119 |
-
return $this->db->get_results( $sql, ARRAY_A );
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
public function delete_items( $ids ) {
|
124 |
-
return $this->db->query( "DELETE FROM {$this->table} WHERE mail_id IN(" . implode(',', $ids) . ")" );
|
125 |
-
}
|
126 |
-
|
127 |
-
public function delete_all_items() {
|
128 |
-
return $this->db->query( "TRUNCATE {$this->table};" );
|
129 |
-
}
|
130 |
-
|
131 |
-
public function records_count() {
|
132 |
-
return $this->db->get_var( "SELECT COUNT(*) FROM {$this->table};" );
|
133 |
-
}
|
134 |
}
|
1 |
+
<?php
|
2 |
+
namespace WPSMTP;
|
3 |
+
|
4 |
+
|
5 |
+
class Db {
|
6 |
+
|
7 |
+
private $db;
|
8 |
+
|
9 |
+
private $table;
|
10 |
+
|
11 |
+
private static $instance;
|
12 |
+
|
13 |
+
public static function get_instance() {
|
14 |
+
|
15 |
+
if ( ! self::$instance ) {
|
16 |
+
self::$instance = new static();
|
17 |
+
}
|
18 |
+
|
19 |
+
return self::$instance;
|
20 |
+
}
|
21 |
+
|
22 |
+
private function __construct() {
|
23 |
+
global $wpdb;
|
24 |
+
|
25 |
+
$this->db = $wpdb;
|
26 |
+
$this->table = $wpdb->prefix . 'wpsmtp_logs';
|
27 |
+
}
|
28 |
+
|
29 |
+
public function insert( $data ) {
|
30 |
+
|
31 |
+
array_walk( $data, function ( &$value, $key ) {
|
32 |
+
if ( is_array( $value ) ) {
|
33 |
+
$value = maybe_serialize( $value );
|
34 |
+
}
|
35 |
+
});
|
36 |
+
|
37 |
+
$result_set = $this->db->insert(
|
38 |
+
$this->table,
|
39 |
+
$data,
|
40 |
+
array_fill( 0, count( $data ), '%s' )
|
41 |
+
);
|
42 |
+
|
43 |
+
if ( ! $result_set ) {
|
44 |
+
error_log( 'WP SMTP Log insert error: ' . $this->db->last_error );
|
45 |
+
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
return $this->db->insert_id;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function update( $data, $where = array() ) {
|
53 |
+
array_walk( $data, function ( &$value, $key ) {
|
54 |
+
if ( is_array( $value ) ) {
|
55 |
+
$value = maybe_serialize( $value );
|
56 |
+
}
|
57 |
+
});
|
58 |
+
|
59 |
+
$this->db->update(
|
60 |
+
$this->table,
|
61 |
+
$data,
|
62 |
+
$where,
|
63 |
+
array_fill( 0, count( $data ), '%s' ),
|
64 |
+
array( '%d' )
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
public function get_item( $id ) {
|
69 |
+
$sql = sprintf( "SELECT * from {$this->table} WHERE `id` = '%d';", $id );
|
70 |
+
|
71 |
+
return $this->db->get_results( $sql, ARRAY_A );
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
public function get() {
|
76 |
+
$where = '';
|
77 |
+
$where_cols = array();
|
78 |
+
if ( isset($_GET['search']['value'] ) && ! empty( $_GET['search']['value'] ) ) {
|
79 |
+
$search = sanitize_text_field( $_GET['search']['value'] );
|
80 |
+
|
81 |
+
foreach ( $_GET['columns'] as $key => $col ) {
|
82 |
+
if ( $col['searchable'] && ! empty( $col['data'] ) && $col['data'] !== 'timestamp' ) {
|
83 |
+
$where_cols[] = "`{$col['data']}` LIKE '%$search%'";
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
if ( ! empty( $where_cols ) ) {
|
88 |
+
$where .= ' WHERE ' . implode( ' OR ', $where_cols );
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
$limit = array();
|
94 |
+
if ( isset( $_GET['start'] ) ) {
|
95 |
+
$limit[] = absint( $_GET['start'] );
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( isset( $_GET['length'] ) ) {
|
99 |
+
$limit[] = absint( $_GET['length'] );
|
100 |
+
}
|
101 |
+
|
102 |
+
$limit_query = '';
|
103 |
+
if ( ! empty( $limit ) ) {
|
104 |
+
$limit_query = ' LIMIT ' . implode( ',', $limit );
|
105 |
+
}
|
106 |
+
|
107 |
+
$order = ' ORDER BY `timestamp` desc';
|
108 |
+
if ( ! empty( $_GET['order'][0] ) ) {
|
109 |
+
$col_num = $_GET['order'][0]['column'];
|
110 |
+
$col_name = $_GET['columns'][$col_num]['data'];
|
111 |
+
$order_dir = $_GET['order'][0]['dir'];
|
112 |
+
$order = " ORDER BY `{$col_name}` {$order_dir}";
|
113 |
+
}
|
114 |
+
|
115 |
+
$sql = "SELECT * from {$this->table}{$where}{$order}{$limit_query};";
|
116 |
+
|
117 |
+
error_log( $sql );
|
118 |
+
|
119 |
+
return $this->db->get_results( $sql, ARRAY_A );
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
public function delete_items( $ids ) {
|
124 |
+
return $this->db->query( "DELETE FROM {$this->table} WHERE mail_id IN(" . implode(',', $ids) . ")" );
|
125 |
+
}
|
126 |
+
|
127 |
+
public function delete_all_items() {
|
128 |
+
return $this->db->query( "TRUNCATE {$this->table};" );
|
129 |
+
}
|
130 |
+
|
131 |
+
public function records_count() {
|
132 |
+
return $this->db->get_var( "SELECT COUNT(*) FROM {$this->table};" );
|
133 |
+
}
|
134 |
}
|
inc/Logger/Process.php
CHANGED
@@ -1,50 +1,62 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WPSMTP;
|
4 |
-
|
5 |
-
use WP_Error;
|
6 |
-
|
7 |
-
class Process {
|
8 |
-
|
9 |
-
private $mail_id;
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
$
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPSMTP;
|
4 |
+
|
5 |
+
use WP_Error;
|
6 |
+
|
7 |
+
class Process {
|
8 |
+
|
9 |
+
private $mail_id;
|
10 |
+
private $wsOptions;
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
global $wpdb;
|
14 |
+
|
15 |
+
$this->wsOptions = get_option( 'wp_smtp_options' );
|
16 |
+
|
17 |
+
if ( ! isset( $this->wsOptions['disable_logs'] ) || 'yes' !== $this->wsOptions['disable_logs'] ) {
|
18 |
+
add_filter( 'wp_mail', array( $this, 'log_mails' ), PHP_INT_MAX );
|
19 |
+
}
|
20 |
+
|
21 |
+
add_action( 'wp_mail_failed', array( $this, 'update_failed_status' ), PHP_INT_MAX );
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
public function log_mails( $parts ) {
|
26 |
+
|
27 |
+
global $wpdb;
|
28 |
+
|
29 |
+
$data = $parts;
|
30 |
+
|
31 |
+
unset( $data['attachments'] );
|
32 |
+
|
33 |
+
$this->mail_id = Db::get_instance()->insert( $data );
|
34 |
+
|
35 |
+
return $parts;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param WP_Error $wp_error
|
40 |
+
*/
|
41 |
+
public function update_failed_status( $wp_error ) {
|
42 |
+
|
43 |
+
Admin::$phpmailer_error = $wp_error;
|
44 |
+
|
45 |
+
if ( ! isset( $this->wsOptions['disable_logs'] ) || 'yes' !== $this->wsOptions['disable_logs'] ) {
|
46 |
+
|
47 |
+
global $wpdb;
|
48 |
+
$data = $wp_error->get_error_data('wp_mail_failed' );
|
49 |
+
|
50 |
+
unset( $data['phpmailer_exception_code'] );
|
51 |
+
unset( $data['attachments'] );
|
52 |
+
|
53 |
+
$data['error'] = $wp_error->get_error_message();
|
54 |
+
|
55 |
+
if ( ! is_numeric( $this->mail_id ) ) {
|
56 |
+
Db::get_instance()->insert( $data );
|
57 |
+
} else {
|
58 |
+
Db::get_instance()->update( $data, array( 'mail_id' => $this->mail_id ) );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
}
|
inc/Logger/Table.php
CHANGED
@@ -1,61 +1,61 @@
|
|
1 |
-
<?php
|
2 |
-
namespace WPSMTP;
|
3 |
-
|
4 |
-
class Table {
|
5 |
-
|
6 |
-
public static $name;
|
7 |
-
|
8 |
-
public function __construct() {
|
9 |
-
|
10 |
-
|
11 |
-
}
|
12 |
-
|
13 |
-
public static function install() {
|
14 |
-
|
15 |
-
global $wpdb;
|
16 |
-
|
17 |
-
self::$name = $wpdb->prefix . 'wpsmtp_logs';
|
18 |
-
|
19 |
-
$sql = "CREATE TABLE IF NOT EXISTS `" . self::$name . "` (
|
20 |
-
`mail_id` INT NOT NULL AUTO_INCREMENT,
|
21 |
-
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
22 |
-
`to` VARCHAR(200) NOT NULL DEFAULT '0',
|
23 |
-
`subject` VARCHAR(200) NOT NULL DEFAULT '0',
|
24 |
-
`message` TEXT NULL,
|
25 |
-
`headers` TEXT NULL,
|
26 |
-
`error` TEXT NULL,
|
27 |
-
PRIMARY KEY (`mail_id`)
|
28 |
-
) DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE utf8_general_ci;";
|
29 |
-
|
30 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
31 |
-
dbDelta( $sql );
|
32 |
-
}
|
33 |
-
|
34 |
-
public static function view() {
|
35 |
-
?>
|
36 |
-
<div id="md-security" data-security="<?php echo wp_create_nonce('wpsmtp' ); ?>"></div>
|
37 |
-
<table id="example" class="display widefat" style="width:100%">
|
38 |
-
<thead>
|
39 |
-
<tr>
|
40 |
-
<th></th>
|
41 |
-
<th>To</th>
|
42 |
-
<th>Timestamp</th>
|
43 |
-
<th>Subject</th>
|
44 |
-
<th>Error</th>
|
45 |
-
</tr>
|
46 |
-
</thead>
|
47 |
-
<tbody></tbody>
|
48 |
-
<tfoot>
|
49 |
-
<tr>
|
50 |
-
<th></th>
|
51 |
-
<th>To</th>
|
52 |
-
<th>Timestamp</th>
|
53 |
-
<th>Subject</th>
|
54 |
-
<th>Error</th>
|
55 |
-
</tr>
|
56 |
-
</tfoot>
|
57 |
-
</table>
|
58 |
-
<?php
|
59 |
-
}
|
60 |
-
|
61 |
}
|
1 |
+
<?php
|
2 |
+
namespace WPSMTP;
|
3 |
+
|
4 |
+
class Table {
|
5 |
+
|
6 |
+
public static $name;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
public static function install() {
|
14 |
+
|
15 |
+
global $wpdb;
|
16 |
+
|
17 |
+
self::$name = $wpdb->prefix . 'wpsmtp_logs';
|
18 |
+
|
19 |
+
$sql = "CREATE TABLE IF NOT EXISTS `" . self::$name . "` (
|
20 |
+
`mail_id` INT NOT NULL AUTO_INCREMENT,
|
21 |
+
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
22 |
+
`to` VARCHAR(200) NOT NULL DEFAULT '0',
|
23 |
+
`subject` VARCHAR(200) NOT NULL DEFAULT '0',
|
24 |
+
`message` TEXT NULL,
|
25 |
+
`headers` TEXT NULL,
|
26 |
+
`error` TEXT NULL,
|
27 |
+
PRIMARY KEY (`mail_id`)
|
28 |
+
) DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE utf8_general_ci;";
|
29 |
+
|
30 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
31 |
+
dbDelta( $sql );
|
32 |
+
}
|
33 |
+
|
34 |
+
public static function view() {
|
35 |
+
?>
|
36 |
+
<div id="md-security" data-security="<?php echo wp_create_nonce('wpsmtp' ); ?>"></div>
|
37 |
+
<table id="example" class="display widefat" style="width:100%">
|
38 |
+
<thead>
|
39 |
+
<tr>
|
40 |
+
<th></th>
|
41 |
+
<th>To</th>
|
42 |
+
<th>Timestamp</th>
|
43 |
+
<th>Subject</th>
|
44 |
+
<th>Error</th>
|
45 |
+
</tr>
|
46 |
+
</thead>
|
47 |
+
<tbody></tbody>
|
48 |
+
<tfoot>
|
49 |
+
<tr>
|
50 |
+
<th></th>
|
51 |
+
<th>To</th>
|
52 |
+
<th>Timestamp</th>
|
53 |
+
<th>Subject</th>
|
54 |
+
<th>Error</th>
|
55 |
+
</tr>
|
56 |
+
</tfoot>
|
57 |
+
</table>
|
58 |
+
<?php
|
59 |
+
}
|
60 |
+
|
61 |
}
|
lang/wp-smtp-zh_CN.po
CHANGED
@@ -1,106 +1,106 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: WP-SMTP Languages\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2013-10-07 00:39+0800\n"
|
6 |
-
"PO-Revision-Date: 2013-10-07 00:39+0800\n"
|
7 |
-
"Last-Translator: 夜光 <berttung(#)gmail.com>\n"
|
8 |
-
"Language-Team: 玻璃泉BoLiQuan.COM <berttung(#)gmail.com>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-KeywordsList: __;_e\n"
|
13 |
-
"X-Poedit-Basepath: .\n"
|
14 |
-
"X-Poedit-Language: English\n"
|
15 |
-
"X-Poedit-Country: CHINA\n"
|
16 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
-
"X-Poedit-SearchPath-0: D:\\xampp\\htdocs\\wordpress\\wp-content\\plugins\\wp-smtp\n"
|
18 |
-
|
19 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp-smtp.php:66
|
20 |
-
msgid "Settings"
|
21 |
-
msgstr "设置"
|
22 |
-
|
23 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:21
|
24 |
-
msgid "The field \"From\" must be a valid email address!"
|
25 |
-
msgstr "“发件人地址”必须是一个有效的电子邮件地址!"
|
26 |
-
|
27 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:24
|
28 |
-
msgid "The field \"SMTP Host\" can not be left blank!"
|
29 |
-
msgstr "“SMTP服务器地址”不能为空!"
|
30 |
-
|
31 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:27
|
32 |
-
msgid "Options saved."
|
33 |
-
msgstr "设置已保存。"
|
34 |
-
|
35 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:47
|
36 |
-
msgid "Message sent!"
|
37 |
-
msgstr "邮件已发送!"
|
38 |
-
|
39 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:54
|
40 |
-
msgid "Some errors occurred!"
|
41 |
-
msgstr "发生了一些错误!"
|
42 |
-
|
43 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:57
|
44 |
-
msgid "The fields \"To\" \"Subject\" \"Message\" can not be left blank when testing!"
|
45 |
-
msgstr "测试时“收件地址”“邮件标题”“邮件正文”均不能为空!"
|
46 |
-
|
47 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:80
|
48 |
-
msgid "From"
|
49 |
-
msgstr "发件人地址"
|
50 |
-
|
51 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:90
|
52 |
-
msgid "From Name"
|
53 |
-
msgstr "发件人昵称"
|
54 |
-
|
55 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:100
|
56 |
-
msgid "SMTP Host"
|
57 |
-
msgstr "SMTP服务器地址"
|
58 |
-
|
59 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:110
|
60 |
-
msgid "SMTP Secure"
|
61 |
-
msgstr "SMTP加密方式"
|
62 |
-
|
63 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:131
|
64 |
-
msgid "SMTP Port"
|
65 |
-
msgstr "SMTP端口"
|
66 |
-
|
67 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:141
|
68 |
-
msgid "SMTP Authentication"
|
69 |
-
msgstr "SMTP认证"
|
70 |
-
|
71 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:157
|
72 |
-
msgid "Username"
|
73 |
-
msgstr "认证用户名 (完整邮件地址)"
|
74 |
-
|
75 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:167
|
76 |
-
msgid "Password"
|
77 |
-
msgstr "认证密码"
|
78 |
-
|
79 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:177
|
80 |
-
msgid "Delete Options"
|
81 |
-
msgstr "禁用时自动删除设置"
|
82 |
-
|
83 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:182
|
84 |
-
msgid "Delete options while deactivate this plugin."
|
85 |
-
msgstr "当禁用此插件时自动删除此插件的设置数据."
|
86 |
-
|
87 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:190
|
88 |
-
msgid "Save Changes"
|
89 |
-
msgstr "保存更改"
|
90 |
-
|
91 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:199
|
92 |
-
msgid "To:"
|
93 |
-
msgstr "收件地址:"
|
94 |
-
|
95 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:209
|
96 |
-
msgid "Subject:"
|
97 |
-
msgstr "邮件标题:"
|
98 |
-
|
99 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:219
|
100 |
-
msgid "Message:"
|
101 |
-
msgstr "邮件正文:"
|
102 |
-
|
103 |
-
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:230
|
104 |
-
msgid "Send Test"
|
105 |
-
msgstr "发送测试"
|
106 |
-
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP-SMTP Languages\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-10-07 00:39+0800\n"
|
6 |
+
"PO-Revision-Date: 2013-10-07 00:39+0800\n"
|
7 |
+
"Last-Translator: 夜光 <berttung(#)gmail.com>\n"
|
8 |
+
"Language-Team: 玻璃泉BoLiQuan.COM <berttung(#)gmail.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-Language: English\n"
|
15 |
+
"X-Poedit-Country: CHINA\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-SearchPath-0: D:\\xampp\\htdocs\\wordpress\\wp-content\\plugins\\wp-smtp\n"
|
18 |
+
|
19 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp-smtp.php:66
|
20 |
+
msgid "Settings"
|
21 |
+
msgstr "设置"
|
22 |
+
|
23 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:21
|
24 |
+
msgid "The field \"From\" must be a valid email address!"
|
25 |
+
msgstr "“发件人地址”必须是一个有效的电子邮件地址!"
|
26 |
+
|
27 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:24
|
28 |
+
msgid "The field \"SMTP Host\" can not be left blank!"
|
29 |
+
msgstr "“SMTP服务器地址”不能为空!"
|
30 |
+
|
31 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:27
|
32 |
+
msgid "Options saved."
|
33 |
+
msgstr "设置已保存。"
|
34 |
+
|
35 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:47
|
36 |
+
msgid "Message sent!"
|
37 |
+
msgstr "邮件已发送!"
|
38 |
+
|
39 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:54
|
40 |
+
msgid "Some errors occurred!"
|
41 |
+
msgstr "发生了一些错误!"
|
42 |
+
|
43 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:57
|
44 |
+
msgid "The fields \"To\" \"Subject\" \"Message\" can not be left blank when testing!"
|
45 |
+
msgstr "测试时“收件地址”“邮件标题”“邮件正文”均不能为空!"
|
46 |
+
|
47 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:80
|
48 |
+
msgid "From"
|
49 |
+
msgstr "发件人地址"
|
50 |
+
|
51 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:90
|
52 |
+
msgid "From Name"
|
53 |
+
msgstr "发件人昵称"
|
54 |
+
|
55 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:100
|
56 |
+
msgid "SMTP Host"
|
57 |
+
msgstr "SMTP服务器地址"
|
58 |
+
|
59 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:110
|
60 |
+
msgid "SMTP Secure"
|
61 |
+
msgstr "SMTP加密方式"
|
62 |
+
|
63 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:131
|
64 |
+
msgid "SMTP Port"
|
65 |
+
msgstr "SMTP端口"
|
66 |
+
|
67 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:141
|
68 |
+
msgid "SMTP Authentication"
|
69 |
+
msgstr "SMTP认证"
|
70 |
+
|
71 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:157
|
72 |
+
msgid "Username"
|
73 |
+
msgstr "认证用户名 (完整邮件地址)"
|
74 |
+
|
75 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:167
|
76 |
+
msgid "Password"
|
77 |
+
msgstr "认证密码"
|
78 |
+
|
79 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:177
|
80 |
+
msgid "Delete Options"
|
81 |
+
msgstr "禁用时自动删除设置"
|
82 |
+
|
83 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:182
|
84 |
+
msgid "Delete options while deactivate this plugin."
|
85 |
+
msgstr "当禁用此插件时自动删除此插件的设置数据."
|
86 |
+
|
87 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:190
|
88 |
+
msgid "Save Changes"
|
89 |
+
msgstr "保存更改"
|
90 |
+
|
91 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:199
|
92 |
+
msgid "To:"
|
93 |
+
msgstr "收件地址:"
|
94 |
+
|
95 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:209
|
96 |
+
msgid "Subject:"
|
97 |
+
msgstr "邮件标题:"
|
98 |
+
|
99 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:219
|
100 |
+
msgid "Message:"
|
101 |
+
msgstr "邮件正文:"
|
102 |
+
|
103 |
+
#: D:\xampp\htdocs\wordpress\wp-content\plugins\wp-smtp/wp_smtp_admin.php:230
|
104 |
+
msgid "Send Test"
|
105 |
+
msgstr "发送测试"
|
106 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: wpchill,silkalns,raldea89,giucu91,andylukak
|
|
4 |
License: GPLv3 or later
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 5.9
|
7 |
-
Stable tag: 1.2.
|
8 |
|
9 |
WP SMTP can help us to send emails via SMTP instead of the PHP mail() function.
|
10 |
|
@@ -17,7 +17,7 @@ If the field "From" was not a valid email address, or the field "SMTP Host" was
|
|
17 |
|
18 |
= CREDITS =
|
19 |
|
20 |
-
WP SMTP plugin was originally created by BoLiQuan. It is now owned and maintained by
|
21 |
|
22 |
= Usage =
|
23 |
|
@@ -35,6 +35,10 @@ WP SMTP plugin was originally created by BoLiQuan. It is now owned and maintaine
|
|
35 |
|
36 |
== Changelog ==
|
37 |
|
|
|
|
|
|
|
|
|
38 |
= 1.2.3 =
|
39 |
Fix auto loading require path
|
40 |
|
4 |
License: GPLv3 or later
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 5.9
|
7 |
+
Stable tag: 1.2.4
|
8 |
|
9 |
WP SMTP can help us to send emails via SMTP instead of the PHP mail() function.
|
10 |
|
17 |
|
18 |
= CREDITS =
|
19 |
|
20 |
+
WP SMTP plugin was originally created by BoLiQuan. It is now owned and maintained by WPChill.
|
21 |
|
22 |
= Usage =
|
23 |
|
35 |
|
36 |
== Changelog ==
|
37 |
|
38 |
+
= 1.2.4 =
|
39 |
+
Changed: Added base64 encode for username and passwords ( https://github.com/WPChill/wp-smtp/issues/2 )
|
40 |
+
Added: Setting to disable the email logging. ( https://github.com/WPChill/wp-smtp/issues/3 )
|
41 |
+
|
42 |
= 1.2.3 =
|
43 |
Fix auto loading require path
|
44 |
|
vendor/autoload.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload.php @generated by Composer
|
4 |
-
|
5 |
-
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
-
|
7 |
-
return ComposerAutoloaderInit9799005e6bc7e1043be402f070604920::getLoader();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInit9799005e6bc7e1043be402f070604920::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -1,445 +1,445 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of Composer.
|
5 |
-
*
|
6 |
-
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
-
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
-
*
|
9 |
-
* For the full copyright and license information, please view the LICENSE
|
10 |
-
* file that was distributed with this source code.
|
11 |
-
*/
|
12 |
-
|
13 |
-
namespace Composer\Autoload;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
-
*
|
18 |
-
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
-
*
|
20 |
-
* // register classes with namespaces
|
21 |
-
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
-
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
-
*
|
24 |
-
* // activate the autoloader
|
25 |
-
* $loader->register();
|
26 |
-
*
|
27 |
-
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
-
* $loader->setUseIncludePath(true);
|
29 |
-
*
|
30 |
-
* In this example, if you try to use a class in the Symfony\Component
|
31 |
-
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
-
* the autoloader will first look for the class under the component/
|
33 |
-
* directory, and it will then fallback to the framework/ directory if not
|
34 |
-
* found before giving up.
|
35 |
-
*
|
36 |
-
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
-
*
|
38 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
-
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
-
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
-
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
-
*/
|
43 |
-
class ClassLoader
|
44 |
-
{
|
45 |
-
// PSR-4
|
46 |
-
private $prefixLengthsPsr4 = array();
|
47 |
-
private $prefixDirsPsr4 = array();
|
48 |
-
private $fallbackDirsPsr4 = array();
|
49 |
-
|
50 |
-
// PSR-0
|
51 |
-
private $prefixesPsr0 = array();
|
52 |
-
private $fallbackDirsPsr0 = array();
|
53 |
-
|
54 |
-
private $useIncludePath = false;
|
55 |
-
private $classMap = array();
|
56 |
-
private $classMapAuthoritative = false;
|
57 |
-
private $missingClasses = array();
|
58 |
-
private $apcuPrefix;
|
59 |
-
|
60 |
-
public function getPrefixes()
|
61 |
-
{
|
62 |
-
if (!empty($this->prefixesPsr0)) {
|
63 |
-
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
-
}
|
65 |
-
|
66 |
-
return array();
|
67 |
-
}
|
68 |
-
|
69 |
-
public function getPrefixesPsr4()
|
70 |
-
{
|
71 |
-
return $this->prefixDirsPsr4;
|
72 |
-
}
|
73 |
-
|
74 |
-
public function getFallbackDirs()
|
75 |
-
{
|
76 |
-
return $this->fallbackDirsPsr0;
|
77 |
-
}
|
78 |
-
|
79 |
-
public function getFallbackDirsPsr4()
|
80 |
-
{
|
81 |
-
return $this->fallbackDirsPsr4;
|
82 |
-
}
|
83 |
-
|
84 |
-
public function getClassMap()
|
85 |
-
{
|
86 |
-
return $this->classMap;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* @param array $classMap Class to filename map
|
91 |
-
*/
|
92 |
-
public function addClassMap(array $classMap)
|
93 |
-
{
|
94 |
-
if ($this->classMap) {
|
95 |
-
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
-
} else {
|
97 |
-
$this->classMap = $classMap;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
-
* appending or prepending to the ones previously set for this prefix.
|
104 |
-
*
|
105 |
-
* @param string $prefix The prefix
|
106 |
-
* @param array|string $paths The PSR-0 root directories
|
107 |
-
* @param bool $prepend Whether to prepend the directories
|
108 |
-
*/
|
109 |
-
public function add($prefix, $paths, $prepend = false)
|
110 |
-
{
|
111 |
-
if (!$prefix) {
|
112 |
-
if ($prepend) {
|
113 |
-
$this->fallbackDirsPsr0 = array_merge(
|
114 |
-
(array) $paths,
|
115 |
-
$this->fallbackDirsPsr0
|
116 |
-
);
|
117 |
-
} else {
|
118 |
-
$this->fallbackDirsPsr0 = array_merge(
|
119 |
-
$this->fallbackDirsPsr0,
|
120 |
-
(array) $paths
|
121 |
-
);
|
122 |
-
}
|
123 |
-
|
124 |
-
return;
|
125 |
-
}
|
126 |
-
|
127 |
-
$first = $prefix[0];
|
128 |
-
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
-
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
-
|
131 |
-
return;
|
132 |
-
}
|
133 |
-
if ($prepend) {
|
134 |
-
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
-
(array) $paths,
|
136 |
-
$this->prefixesPsr0[$first][$prefix]
|
137 |
-
);
|
138 |
-
} else {
|
139 |
-
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
-
$this->prefixesPsr0[$first][$prefix],
|
141 |
-
(array) $paths
|
142 |
-
);
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
-
* appending or prepending to the ones previously set for this namespace.
|
149 |
-
*
|
150 |
-
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
-
* @param array|string $paths The PSR-4 base directories
|
152 |
-
* @param bool $prepend Whether to prepend the directories
|
153 |
-
*
|
154 |
-
* @throws \InvalidArgumentException
|
155 |
-
*/
|
156 |
-
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
-
{
|
158 |
-
if (!$prefix) {
|
159 |
-
// Register directories for the root namespace.
|
160 |
-
if ($prepend) {
|
161 |
-
$this->fallbackDirsPsr4 = array_merge(
|
162 |
-
(array) $paths,
|
163 |
-
$this->fallbackDirsPsr4
|
164 |
-
);
|
165 |
-
} else {
|
166 |
-
$this->fallbackDirsPsr4 = array_merge(
|
167 |
-
$this->fallbackDirsPsr4,
|
168 |
-
(array) $paths
|
169 |
-
);
|
170 |
-
}
|
171 |
-
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
-
// Register directories for a new namespace.
|
173 |
-
$length = strlen($prefix);
|
174 |
-
if ('\\' !== $prefix[$length - 1]) {
|
175 |
-
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
-
}
|
177 |
-
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
-
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
-
} elseif ($prepend) {
|
180 |
-
// Prepend directories for an already registered namespace.
|
181 |
-
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
-
(array) $paths,
|
183 |
-
$this->prefixDirsPsr4[$prefix]
|
184 |
-
);
|
185 |
-
} else {
|
186 |
-
// Append directories for an already registered namespace.
|
187 |
-
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
-
$this->prefixDirsPsr4[$prefix],
|
189 |
-
(array) $paths
|
190 |
-
);
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
-
* replacing any others previously set for this prefix.
|
197 |
-
*
|
198 |
-
* @param string $prefix The prefix
|
199 |
-
* @param array|string $paths The PSR-0 base directories
|
200 |
-
*/
|
201 |
-
public function set($prefix, $paths)
|
202 |
-
{
|
203 |
-
if (!$prefix) {
|
204 |
-
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
-
} else {
|
206 |
-
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
-
* replacing any others previously set for this namespace.
|
213 |
-
*
|
214 |
-
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
-
* @param array|string $paths The PSR-4 base directories
|
216 |
-
*
|
217 |
-
* @throws \InvalidArgumentException
|
218 |
-
*/
|
219 |
-
public function setPsr4($prefix, $paths)
|
220 |
-
{
|
221 |
-
if (!$prefix) {
|
222 |
-
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
-
} else {
|
224 |
-
$length = strlen($prefix);
|
225 |
-
if ('\\' !== $prefix[$length - 1]) {
|
226 |
-
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
-
}
|
228 |
-
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
-
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
-
}
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Turns on searching the include path for class files.
|
235 |
-
*
|
236 |
-
* @param bool $useIncludePath
|
237 |
-
*/
|
238 |
-
public function setUseIncludePath($useIncludePath)
|
239 |
-
{
|
240 |
-
$this->useIncludePath = $useIncludePath;
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Can be used to check if the autoloader uses the include path to check
|
245 |
-
* for classes.
|
246 |
-
*
|
247 |
-
* @return bool
|
248 |
-
*/
|
249 |
-
public function getUseIncludePath()
|
250 |
-
{
|
251 |
-
return $this->useIncludePath;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Turns off searching the prefix and fallback directories for classes
|
256 |
-
* that have not been registered with the class map.
|
257 |
-
*
|
258 |
-
* @param bool $classMapAuthoritative
|
259 |
-
*/
|
260 |
-
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
-
{
|
262 |
-
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Should class lookup fail if not found in the current class map?
|
267 |
-
*
|
268 |
-
* @return bool
|
269 |
-
*/
|
270 |
-
public function isClassMapAuthoritative()
|
271 |
-
{
|
272 |
-
return $this->classMapAuthoritative;
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
-
*
|
278 |
-
* @param string|null $apcuPrefix
|
279 |
-
*/
|
280 |
-
public function setApcuPrefix($apcuPrefix)
|
281 |
-
{
|
282 |
-
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
-
*
|
288 |
-
* @return string|null
|
289 |
-
*/
|
290 |
-
public function getApcuPrefix()
|
291 |
-
{
|
292 |
-
return $this->apcuPrefix;
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* Registers this instance as an autoloader.
|
297 |
-
*
|
298 |
-
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
-
*/
|
300 |
-
public function register($prepend = false)
|
301 |
-
{
|
302 |
-
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
-
}
|
304 |
-
|
305 |
-
/**
|
306 |
-
* Unregisters this instance as an autoloader.
|
307 |
-
*/
|
308 |
-
public function unregister()
|
309 |
-
{
|
310 |
-
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Loads the given class or interface.
|
315 |
-
*
|
316 |
-
* @param string $class The name of the class
|
317 |
-
* @return bool|null True if loaded, null otherwise
|
318 |
-
*/
|
319 |
-
public function loadClass($class)
|
320 |
-
{
|
321 |
-
if ($file = $this->findFile($class)) {
|
322 |
-
includeFile($file);
|
323 |
-
|
324 |
-
return true;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
/**
|
329 |
-
* Finds the path to the file where the class is defined.
|
330 |
-
*
|
331 |
-
* @param string $class The name of the class
|
332 |
-
*
|
333 |
-
* @return string|false The path if found, false otherwise
|
334 |
-
*/
|
335 |
-
public function findFile($class)
|
336 |
-
{
|
337 |
-
// class map lookup
|
338 |
-
if (isset($this->classMap[$class])) {
|
339 |
-
return $this->classMap[$class];
|
340 |
-
}
|
341 |
-
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
-
return false;
|
343 |
-
}
|
344 |
-
if (null !== $this->apcuPrefix) {
|
345 |
-
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
-
if ($hit) {
|
347 |
-
return $file;
|
348 |
-
}
|
349 |
-
}
|
350 |
-
|
351 |
-
$file = $this->findFileWithExtension($class, '.php');
|
352 |
-
|
353 |
-
// Search for Hack files if we are running on HHVM
|
354 |
-
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
-
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
-
}
|
357 |
-
|
358 |
-
if (null !== $this->apcuPrefix) {
|
359 |
-
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
-
}
|
361 |
-
|
362 |
-
if (false === $file) {
|
363 |
-
// Remember that this class does not exist.
|
364 |
-
$this->missingClasses[$class] = true;
|
365 |
-
}
|
366 |
-
|
367 |
-
return $file;
|
368 |
-
}
|
369 |
-
|
370 |
-
private function findFileWithExtension($class, $ext)
|
371 |
-
{
|
372 |
-
// PSR-4 lookup
|
373 |
-
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
-
|
375 |
-
$first = $class[0];
|
376 |
-
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
-
$subPath = $class;
|
378 |
-
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
-
$subPath = substr($subPath, 0, $lastPos);
|
380 |
-
$search = $subPath . '\\';
|
381 |
-
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
-
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
-
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
384 |
-
if (file_exists($file = $dir . $pathEnd)) {
|
385 |
-
return $file;
|
386 |
-
}
|
387 |
-
}
|
388 |
-
}
|
389 |
-
}
|
390 |
-
}
|
391 |
-
|
392 |
-
// PSR-4 fallback dirs
|
393 |
-
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
-
return $file;
|
396 |
-
}
|
397 |
-
}
|
398 |
-
|
399 |
-
// PSR-0 lookup
|
400 |
-
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
-
// namespaced class name
|
402 |
-
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
-
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
-
} else {
|
405 |
-
// PEAR-like class name
|
406 |
-
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
-
}
|
408 |
-
|
409 |
-
if (isset($this->prefixesPsr0[$first])) {
|
410 |
-
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
-
if (0 === strpos($class, $prefix)) {
|
412 |
-
foreach ($dirs as $dir) {
|
413 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
-
return $file;
|
415 |
-
}
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
}
|
420 |
-
|
421 |
-
// PSR-0 fallback dirs
|
422 |
-
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
-
return $file;
|
425 |
-
}
|
426 |
-
}
|
427 |
-
|
428 |
-
// PSR-0 include paths.
|
429 |
-
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
-
return $file;
|
431 |
-
}
|
432 |
-
|
433 |
-
return false;
|
434 |
-
}
|
435 |
-
}
|
436 |
-
|
437 |
-
/**
|
438 |
-
* Scope isolated include.
|
439 |
-
*
|
440 |
-
* Prevents access to $this/self from included files.
|
441 |
-
*/
|
442 |
-
function includeFile($file)
|
443 |
-
{
|
444 |
-
include $file;
|
445 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
private $classMapAuthoritative = false;
|
57 |
+
private $missingClasses = array();
|
58 |
+
private $apcuPrefix;
|
59 |
+
|
60 |
+
public function getPrefixes()
|
61 |
+
{
|
62 |
+
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
+
}
|
65 |
+
|
66 |
+
return array();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPrefixesPsr4()
|
70 |
+
{
|
71 |
+
return $this->prefixDirsPsr4;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getFallbackDirs()
|
75 |
+
{
|
76 |
+
return $this->fallbackDirsPsr0;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getFallbackDirsPsr4()
|
80 |
+
{
|
81 |
+
return $this->fallbackDirsPsr4;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getClassMap()
|
85 |
+
{
|
86 |
+
return $this->classMap;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $classMap Class to filename map
|
91 |
+
*/
|
92 |
+
public function addClassMap(array $classMap)
|
93 |
+
{
|
94 |
+
if ($this->classMap) {
|
95 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
+
} else {
|
97 |
+
$this->classMap = $classMap;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
+
* appending or prepending to the ones previously set for this prefix.
|
104 |
+
*
|
105 |
+
* @param string $prefix The prefix
|
106 |
+
* @param array|string $paths The PSR-0 root directories
|
107 |
+
* @param bool $prepend Whether to prepend the directories
|
108 |
+
*/
|
109 |
+
public function add($prefix, $paths, $prepend = false)
|
110 |
+
{
|
111 |
+
if (!$prefix) {
|
112 |
+
if ($prepend) {
|
113 |
+
$this->fallbackDirsPsr0 = array_merge(
|
114 |
+
(array) $paths,
|
115 |
+
$this->fallbackDirsPsr0
|
116 |
+
);
|
117 |
+
} else {
|
118 |
+
$this->fallbackDirsPsr0 = array_merge(
|
119 |
+
$this->fallbackDirsPsr0,
|
120 |
+
(array) $paths
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
$first = $prefix[0];
|
128 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
+
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
if ($prepend) {
|
134 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
+
(array) $paths,
|
136 |
+
$this->prefixesPsr0[$first][$prefix]
|
137 |
+
);
|
138 |
+
} else {
|
139 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
+
$this->prefixesPsr0[$first][$prefix],
|
141 |
+
(array) $paths
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
+
* appending or prepending to the ones previously set for this namespace.
|
149 |
+
*
|
150 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
+
* @param array|string $paths The PSR-4 base directories
|
152 |
+
* @param bool $prepend Whether to prepend the directories
|
153 |
+
*
|
154 |
+
* @throws \InvalidArgumentException
|
155 |
+
*/
|
156 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
+
{
|
158 |
+
if (!$prefix) {
|
159 |
+
// Register directories for the root namespace.
|
160 |
+
if ($prepend) {
|
161 |
+
$this->fallbackDirsPsr4 = array_merge(
|
162 |
+
(array) $paths,
|
163 |
+
$this->fallbackDirsPsr4
|
164 |
+
);
|
165 |
+
} else {
|
166 |
+
$this->fallbackDirsPsr4 = array_merge(
|
167 |
+
$this->fallbackDirsPsr4,
|
168 |
+
(array) $paths
|
169 |
+
);
|
170 |
+
}
|
171 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
+
// Register directories for a new namespace.
|
173 |
+
$length = strlen($prefix);
|
174 |
+
if ('\\' !== $prefix[$length - 1]) {
|
175 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
+
}
|
177 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
+
} elseif ($prepend) {
|
180 |
+
// Prepend directories for an already registered namespace.
|
181 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
+
(array) $paths,
|
183 |
+
$this->prefixDirsPsr4[$prefix]
|
184 |
+
);
|
185 |
+
} else {
|
186 |
+
// Append directories for an already registered namespace.
|
187 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
+
$this->prefixDirsPsr4[$prefix],
|
189 |
+
(array) $paths
|
190 |
+
);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
+
* replacing any others previously set for this prefix.
|
197 |
+
*
|
198 |
+
* @param string $prefix The prefix
|
199 |
+
* @param array|string $paths The PSR-0 base directories
|
200 |
+
*/
|
201 |
+
public function set($prefix, $paths)
|
202 |
+
{
|
203 |
+
if (!$prefix) {
|
204 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
+
} else {
|
206 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
+
* replacing any others previously set for this namespace.
|
213 |
+
*
|
214 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
+
* @param array|string $paths The PSR-4 base directories
|
216 |
+
*
|
217 |
+
* @throws \InvalidArgumentException
|
218 |
+
*/
|
219 |
+
public function setPsr4($prefix, $paths)
|
220 |
+
{
|
221 |
+
if (!$prefix) {
|
222 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
+
} else {
|
224 |
+
$length = strlen($prefix);
|
225 |
+
if ('\\' !== $prefix[$length - 1]) {
|
226 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
+
}
|
228 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Turns on searching the include path for class files.
|
235 |
+
*
|
236 |
+
* @param bool $useIncludePath
|
237 |
+
*/
|
238 |
+
public function setUseIncludePath($useIncludePath)
|
239 |
+
{
|
240 |
+
$this->useIncludePath = $useIncludePath;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Can be used to check if the autoloader uses the include path to check
|
245 |
+
* for classes.
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
public function getUseIncludePath()
|
250 |
+
{
|
251 |
+
return $this->useIncludePath;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Turns off searching the prefix and fallback directories for classes
|
256 |
+
* that have not been registered with the class map.
|
257 |
+
*
|
258 |
+
* @param bool $classMapAuthoritative
|
259 |
+
*/
|
260 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
+
{
|
262 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Should class lookup fail if not found in the current class map?
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
public function isClassMapAuthoritative()
|
271 |
+
{
|
272 |
+
return $this->classMapAuthoritative;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
+
*
|
278 |
+
* @param string|null $apcuPrefix
|
279 |
+
*/
|
280 |
+
public function setApcuPrefix($apcuPrefix)
|
281 |
+
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
+
*
|
288 |
+
* @return string|null
|
289 |
+
*/
|
290 |
+
public function getApcuPrefix()
|
291 |
+
{
|
292 |
+
return $this->apcuPrefix;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Registers this instance as an autoloader.
|
297 |
+
*
|
298 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
+
*/
|
300 |
+
public function register($prepend = false)
|
301 |
+
{
|
302 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Unregisters this instance as an autoloader.
|
307 |
+
*/
|
308 |
+
public function unregister()
|
309 |
+
{
|
310 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Loads the given class or interface.
|
315 |
+
*
|
316 |
+
* @param string $class The name of the class
|
317 |
+
* @return bool|null True if loaded, null otherwise
|
318 |
+
*/
|
319 |
+
public function loadClass($class)
|
320 |
+
{
|
321 |
+
if ($file = $this->findFile($class)) {
|
322 |
+
includeFile($file);
|
323 |
+
|
324 |
+
return true;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Finds the path to the file where the class is defined.
|
330 |
+
*
|
331 |
+
* @param string $class The name of the class
|
332 |
+
*
|
333 |
+
* @return string|false The path if found, false otherwise
|
334 |
+
*/
|
335 |
+
public function findFile($class)
|
336 |
+
{
|
337 |
+
// class map lookup
|
338 |
+
if (isset($this->classMap[$class])) {
|
339 |
+
return $this->classMap[$class];
|
340 |
+
}
|
341 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
if (null !== $this->apcuPrefix) {
|
345 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
+
if ($hit) {
|
347 |
+
return $file;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
$file = $this->findFileWithExtension($class, '.php');
|
352 |
+
|
353 |
+
// Search for Hack files if we are running on HHVM
|
354 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
+
}
|
357 |
+
|
358 |
+
if (null !== $this->apcuPrefix) {
|
359 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
+
}
|
361 |
+
|
362 |
+
if (false === $file) {
|
363 |
+
// Remember that this class does not exist.
|
364 |
+
$this->missingClasses[$class] = true;
|
365 |
+
}
|
366 |
+
|
367 |
+
return $file;
|
368 |
+
}
|
369 |
+
|
370 |
+
private function findFileWithExtension($class, $ext)
|
371 |
+
{
|
372 |
+
// PSR-4 lookup
|
373 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
+
|
375 |
+
$first = $class[0];
|
376 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
+
$subPath = $class;
|
378 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
+
$subPath = substr($subPath, 0, $lastPos);
|
380 |
+
$search = $subPath . '\\';
|
381 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
384 |
+
if (file_exists($file = $dir . $pathEnd)) {
|
385 |
+
return $file;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
// PSR-4 fallback dirs
|
393 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
+
return $file;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// PSR-0 lookup
|
400 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
+
// namespaced class name
|
402 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
+
} else {
|
405 |
+
// PEAR-like class name
|
406 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
+
}
|
408 |
+
|
409 |
+
if (isset($this->prefixesPsr0[$first])) {
|
410 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
+
if (0 === strpos($class, $prefix)) {
|
412 |
+
foreach ($dirs as $dir) {
|
413 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
+
return $file;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
// PSR-0 fallback dirs
|
422 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
+
return $file;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
// PSR-0 include paths.
|
429 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
+
return $file;
|
431 |
+
}
|
432 |
+
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Scope isolated include.
|
439 |
+
*
|
440 |
+
* Prevents access to $this/self from included files.
|
441 |
+
*/
|
442 |
+
function includeFile($file)
|
443 |
+
{
|
444 |
+
include $file;
|
445 |
+
}
|
vendor/composer/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
|
2 |
-
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
-
|
4 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
-
of this software and associated documentation files (the "Software"), to deal
|
6 |
-
in the Software without restriction, including without limitation the rights
|
7 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
-
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
-
to do so, subject to the following conditions:
|
10 |
-
|
11 |
-
The above copyright notice and this permission notice shall be included in all
|
12 |
-
copies or substantial portions of the Software.
|
13 |
-
|
14 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
-
THE SOFTWARE.
|
21 |
-
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_classmap.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'WPSMTP\\Config' => $baseDir . '/inc/Config.php',
|
10 |
-
'WPSMTP\\Process' => $baseDir . '/inc/Logger/Process.php',
|
11 |
-
'WPSMTP\\Table' => $baseDir . '/inc/Logger/Table.php',
|
12 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'WPSMTP\\Config' => $baseDir . '/inc/Config.php',
|
10 |
+
'WPSMTP\\Process' => $baseDir . '/inc/Logger/Process.php',
|
11 |
+
'WPSMTP\\Table' => $baseDir . '/inc/Logger/Table.php',
|
12 |
+
);
|
vendor/composer/autoload_namespaces.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_namespaces.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_psr4.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'WPSMTP\\' => array($baseDir . '/inc'),
|
10 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'WPSMTP\\' => array($baseDir . '/inc'),
|
10 |
+
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_real.php @generated by Composer
|
4 |
-
|
5 |
-
class ComposerAutoloaderInit9799005e6bc7e1043be402f070604920
|
6 |
-
{
|
7 |
-
private static $loader;
|
8 |
-
|
9 |
-
public static function loadClassLoader($class)
|
10 |
-
{
|
11 |
-
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
-
require __DIR__ . '/ClassLoader.php';
|
13 |
-
}
|
14 |
-
}
|
15 |
-
|
16 |
-
public static function getLoader()
|
17 |
-
{
|
18 |
-
if (null !== self::$loader) {
|
19 |
-
return self::$loader;
|
20 |
-
}
|
21 |
-
|
22 |
-
spl_autoload_register(array('ComposerAutoloaderInit9799005e6bc7e1043be402f070604920', 'loadClassLoader'), true, true);
|
23 |
-
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('ComposerAutoloaderInit9799005e6bc7e1043be402f070604920', 'loadClassLoader'));
|
25 |
-
|
26 |
-
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
-
if ($useStaticLoader) {
|
28 |
-
require_once __DIR__ . '/autoload_static.php';
|
29 |
-
|
30 |
-
call_user_func(\Composer\Autoload\ComposerStaticInit9799005e6bc7e1043be402f070604920::getInitializer($loader));
|
31 |
-
} else {
|
32 |
-
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
-
foreach ($map as $namespace => $path) {
|
34 |
-
$loader->set($namespace, $path);
|
35 |
-
}
|
36 |
-
|
37 |
-
$map = require __DIR__ . '/autoload_psr4.php';
|
38 |
-
foreach ($map as $namespace => $path) {
|
39 |
-
$loader->setPsr4($namespace, $path);
|
40 |
-
}
|
41 |
-
|
42 |
-
$classMap = require __DIR__ . '/autoload_classmap.php';
|
43 |
-
if ($classMap) {
|
44 |
-
$loader->addClassMap($classMap);
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
$loader->register(true);
|
49 |
-
|
50 |
-
return $loader;
|
51 |
-
}
|
52 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit9799005e6bc7e1043be402f070604920
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit9799005e6bc7e1043be402f070604920', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit9799005e6bc7e1043be402f070604920', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
+
if ($useStaticLoader) {
|
28 |
+
require_once __DIR__ . '/autoload_static.php';
|
29 |
+
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit9799005e6bc7e1043be402f070604920::getInitializer($loader));
|
31 |
+
} else {
|
32 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
+
foreach ($map as $namespace => $path) {
|
34 |
+
$loader->set($namespace, $path);
|
35 |
+
}
|
36 |
+
|
37 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
38 |
+
foreach ($map as $namespace => $path) {
|
39 |
+
$loader->setPsr4($namespace, $path);
|
40 |
+
}
|
41 |
+
|
42 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
43 |
+
if ($classMap) {
|
44 |
+
$loader->addClassMap($classMap);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$loader->register(true);
|
49 |
+
|
50 |
+
return $loader;
|
51 |
+
}
|
52 |
+
}
|
vendor/composer/autoload_static.php
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_static.php @generated by Composer
|
4 |
-
|
5 |
-
namespace Composer\Autoload;
|
6 |
-
|
7 |
-
class ComposerStaticInit9799005e6bc7e1043be402f070604920
|
8 |
-
{
|
9 |
-
public static $prefixLengthsPsr4 = array (
|
10 |
-
'W' =>
|
11 |
-
array (
|
12 |
-
'WPSMTP\\' => 7,
|
13 |
-
),
|
14 |
-
);
|
15 |
-
|
16 |
-
public static $prefixDirsPsr4 = array (
|
17 |
-
'WPSMTP\\' =>
|
18 |
-
array (
|
19 |
-
0 => __DIR__ . '/../..' . '/inc',
|
20 |
-
),
|
21 |
-
);
|
22 |
-
|
23 |
-
public static $classMap = array (
|
24 |
-
'WPSMTP\\Config' => __DIR__ . '/../..' . '/inc/Config.php',
|
25 |
-
'WPSMTP\\Process' => __DIR__ . '/../..' . '/inc/Logger/Process.php',
|
26 |
-
'WPSMTP\\Table' => __DIR__ . '/../..' . '/inc/Logger/Table.php',
|
27 |
-
);
|
28 |
-
|
29 |
-
public static function getInitializer(ClassLoader $loader)
|
30 |
-
{
|
31 |
-
return \Closure::bind(function () use ($loader) {
|
32 |
-
$loader->prefixLengthsPsr4 = ComposerStaticInit9799005e6bc7e1043be402f070604920::$prefixLengthsPsr4;
|
33 |
-
$loader->prefixDirsPsr4 = ComposerStaticInit9799005e6bc7e1043be402f070604920::$prefixDirsPsr4;
|
34 |
-
$loader->classMap = ComposerStaticInit9799005e6bc7e1043be402f070604920::$classMap;
|
35 |
-
|
36 |
-
}, null, ClassLoader::class);
|
37 |
-
}
|
38 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInit9799005e6bc7e1043be402f070604920
|
8 |
+
{
|
9 |
+
public static $prefixLengthsPsr4 = array (
|
10 |
+
'W' =>
|
11 |
+
array (
|
12 |
+
'WPSMTP\\' => 7,
|
13 |
+
),
|
14 |
+
);
|
15 |
+
|
16 |
+
public static $prefixDirsPsr4 = array (
|
17 |
+
'WPSMTP\\' =>
|
18 |
+
array (
|
19 |
+
0 => __DIR__ . '/../..' . '/inc',
|
20 |
+
),
|
21 |
+
);
|
22 |
+
|
23 |
+
public static $classMap = array (
|
24 |
+
'WPSMTP\\Config' => __DIR__ . '/../..' . '/inc/Config.php',
|
25 |
+
'WPSMTP\\Process' => __DIR__ . '/../..' . '/inc/Logger/Process.php',
|
26 |
+
'WPSMTP\\Table' => __DIR__ . '/../..' . '/inc/Logger/Table.php',
|
27 |
+
);
|
28 |
+
|
29 |
+
public static function getInitializer(ClassLoader $loader)
|
30 |
+
{
|
31 |
+
return \Closure::bind(function () use ($loader) {
|
32 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit9799005e6bc7e1043be402f070604920::$prefixLengthsPsr4;
|
33 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit9799005e6bc7e1043be402f070604920::$prefixDirsPsr4;
|
34 |
+
$loader->classMap = ComposerStaticInit9799005e6bc7e1043be402f070604920::$classMap;
|
35 |
+
|
36 |
+
}, null, ClassLoader::class);
|
37 |
+
}
|
38 |
+
}
|
wp-smtp.php
CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
4 |
/**
|
5 |
* Plugin Name: WP SMTP
|
6 |
* Description: WP SMTP can help us to send emails via SMTP instead of the PHP mail() function and email logger built-in.
|
7 |
-
* Version: 1.2.
|
8 |
* Author: WPChill
|
9 |
* Author URI: https://www.wpchill.com/
|
10 |
* Text Domain: wp-smtp
|
@@ -82,6 +82,7 @@ class WP_SMTP {
|
|
82 |
|
83 |
\WPSMTP\Table::install();
|
84 |
|
|
|
85 |
}
|
86 |
|
87 |
function wp_smtp_deactivate() {
|
@@ -111,8 +112,8 @@ class WP_SMTP {
|
|
111 |
$phpmailer->SMTPAuth = ($this->wsOptions["smtpauth"]=="yes") ? TRUE : FALSE;
|
112 |
|
113 |
if( $phpmailer->SMTPAuth ){
|
114 |
-
$phpmailer->Username = $this->wsOptions["username"];
|
115 |
-
$phpmailer->Password = $this->wsOptions["password"];
|
116 |
}
|
117 |
}
|
118 |
|
@@ -129,6 +130,43 @@ class WP_SMTP {
|
|
129 |
return $action_links;
|
130 |
}
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
new WP_SMTP();
|
4 |
/**
|
5 |
* Plugin Name: WP SMTP
|
6 |
* Description: WP SMTP can help us to send emails via SMTP instead of the PHP mail() function and email logger built-in.
|
7 |
+
* Version: 1.2.4
|
8 |
* Author: WPChill
|
9 |
* Author URI: https://www.wpchill.com/
|
10 |
* Text Domain: wp-smtp
|
82 |
|
83 |
\WPSMTP\Table::install();
|
84 |
|
85 |
+
$this->backwards_encrypt_base64();
|
86 |
}
|
87 |
|
88 |
function wp_smtp_deactivate() {
|
112 |
$phpmailer->SMTPAuth = ($this->wsOptions["smtpauth"]=="yes") ? TRUE : FALSE;
|
113 |
|
114 |
if( $phpmailer->SMTPAuth ){
|
115 |
+
$phpmailer->Username = base64_decode( $this->wsOptions["username"] );
|
116 |
+
$phpmailer->Password = base64_decode( $this->wsOptions["password"] );
|
117 |
}
|
118 |
}
|
119 |
|
130 |
return $action_links;
|
131 |
}
|
132 |
|
133 |
+
public function wp_smtp_is_base64( $data ){
|
134 |
+
|
135 |
+
$str = base64_decode($data, true);
|
136 |
+
if ($str === false) {
|
137 |
+
return false;
|
138 |
+
} else {
|
139 |
+
$b64 = base64_encode($str);
|
140 |
+
|
141 |
+
// Check if input string and real Base64 are identical
|
142 |
+
if ($data === $b64) {
|
143 |
+
return true;
|
144 |
+
} else {
|
145 |
+
return false;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
public function backwards_encrypt_base64(){
|
151 |
+
$options = get_option( 'wp_smtp_options' );
|
152 |
+
$changes = false;
|
153 |
+
|
154 |
+
if( '' != $options['username'] && '' != $options['password'] ){
|
155 |
+
if( !$this->wp_smtp_is_base64( $options['username'] ) ){
|
156 |
+
$options['username'] = base64_encode( $options['username'] );
|
157 |
+
$changes = true;
|
158 |
+
}
|
159 |
+
|
160 |
+
if( !$this->wp_smtp_is_base64( $options['password'] ) ){
|
161 |
+
$options['password'] = base64_encode( $options['password'] );
|
162 |
+
$changes = true;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
if( $changes ){
|
167 |
+
update_option( 'wp_smtp_options', $options );
|
168 |
+
}
|
169 |
+
}
|
170 |
}
|
171 |
|
172 |
new WP_SMTP();
|
wp_smtp_admin.php
CHANGED
@@ -13,9 +13,10 @@ if (isset($_POST['wp_smtp_update']) && isset($_POST['wp_smtp_nonce_update'])) {
|
|
13 |
$this->wsOptions["smtpsecure"] = sanitize_text_field( trim( $_POST['wp_smtp_smtpsecure'] ) );
|
14 |
$this->wsOptions["port"] = is_numeric( trim( $_POST['wp_smtp_port'] ) ) ? trim( $_POST['wp_smtp_port'] ) : '';
|
15 |
$this->wsOptions["smtpauth"] = sanitize_text_field( trim( $_POST['wp_smtp_smtpauth'] ) );
|
16 |
-
$this->wsOptions["username"] = defined( 'WP_SMTP_USER' ) ? WP_SMTP_USER : sanitize_text_field( trim( $_POST['wp_smtp_username'] ) );
|
17 |
-
$this->wsOptions["password"] = defined( 'WP_SMTP_PASS' ) ? WP_SMTP_PASS : sanitize_text_field( trim( $_POST['wp_smtp_password'] ) );
|
18 |
$this->wsOptions["deactivate"] = ( isset($_POST['wp_smtp_deactivate'] ) ) ? sanitize_text_field( trim( $_POST['wp_smtp_deactivate'] ) ) : '';
|
|
|
19 |
|
20 |
update_option("wp_smtp_options", $this->wsOptions);
|
21 |
|
@@ -166,7 +167,7 @@ $ws_nonce = wp_create_nonce('my_ws_nonce');
|
|
166 |
</th>
|
167 |
<td>
|
168 |
<label>
|
169 |
-
<input type="text" name="wp_smtp_username" value="<?php echo $this->wsOptions["username"]; ?>"
|
170 |
size="43" style="width:272px;height:24px;"/>
|
171 |
</label>
|
172 |
</td>
|
@@ -177,7 +178,7 @@ $ws_nonce = wp_create_nonce('my_ws_nonce');
|
|
177 |
</th>
|
178 |
<td>
|
179 |
<label>
|
180 |
-
<input type="password" name="wp_smtp_password" value="<?php echo $this->wsOptions["password"]; ?>"
|
181 |
size="43" style="width:272px;height:24px;"/>
|
182 |
</label>
|
183 |
</td>
|
@@ -190,7 +191,19 @@ $ws_nonce = wp_create_nonce('my_ws_nonce');
|
|
190 |
<label>
|
191 |
<input type="checkbox" name="wp_smtp_deactivate"
|
192 |
value="yes" <?php if ($this->wsOptions["deactivate"] == 'yes') echo 'checked="checked"'; ?> />
|
193 |
-
<?php _e('Delete options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
</label>
|
195 |
</td>
|
196 |
</tr>
|
13 |
$this->wsOptions["smtpsecure"] = sanitize_text_field( trim( $_POST['wp_smtp_smtpsecure'] ) );
|
14 |
$this->wsOptions["port"] = is_numeric( trim( $_POST['wp_smtp_port'] ) ) ? trim( $_POST['wp_smtp_port'] ) : '';
|
15 |
$this->wsOptions["smtpauth"] = sanitize_text_field( trim( $_POST['wp_smtp_smtpauth'] ) );
|
16 |
+
$this->wsOptions["username"] = base64_encode( defined( 'WP_SMTP_USER' ) ? WP_SMTP_USER : sanitize_text_field( trim( $_POST['wp_smtp_username'] ) ) );
|
17 |
+
$this->wsOptions["password"] = base64_encode( defined( 'WP_SMTP_PASS' ) ? WP_SMTP_PASS : sanitize_text_field( trim( $_POST['wp_smtp_password'] ) ) );
|
18 |
$this->wsOptions["deactivate"] = ( isset($_POST['wp_smtp_deactivate'] ) ) ? sanitize_text_field( trim( $_POST['wp_smtp_deactivate'] ) ) : '';
|
19 |
+
$this->wsOptions["disable_logs"] = ( isset($_POST['wp_smtp_disable_logs'] ) ) ? sanitize_text_field( trim( $_POST['wp_smtp_disable_logs'] ) ) : '';
|
20 |
|
21 |
update_option("wp_smtp_options", $this->wsOptions);
|
22 |
|
167 |
</th>
|
168 |
<td>
|
169 |
<label>
|
170 |
+
<input type="text" name="wp_smtp_username" value="<?php echo esc_attr( base64_decode( $this->wsOptions["username"] ) ); ?>"
|
171 |
size="43" style="width:272px;height:24px;"/>
|
172 |
</label>
|
173 |
</td>
|
178 |
</th>
|
179 |
<td>
|
180 |
<label>
|
181 |
+
<input type="password" name="wp_smtp_password" value="<?php echo esc_attr( base64_decode( $this->wsOptions["password"] ) ); ?>"
|
182 |
size="43" style="width:272px;height:24px;"/>
|
183 |
</label>
|
184 |
</td>
|
191 |
<label>
|
192 |
<input type="checkbox" name="wp_smtp_deactivate"
|
193 |
value="yes" <?php if ($this->wsOptions["deactivate"] == 'yes') echo 'checked="checked"'; ?> />
|
194 |
+
<?php _e('Delete options when deactivating this plugin.', 'wp-smtp'); ?>
|
195 |
+
</label>
|
196 |
+
</td>
|
197 |
+
</tr>
|
198 |
+
<tr valign="top">
|
199 |
+
<th scope="row">
|
200 |
+
<?php _e('Disable Logs', 'wp-smtp'); ?>
|
201 |
+
</th>
|
202 |
+
<td>
|
203 |
+
<label>
|
204 |
+
<input type="checkbox" name="wp_smtp_disable_logs"
|
205 |
+
value="yes" <?php if ( isset( $this->wsOptions['disable_logs'] ) && 'yes' === $this->wsOptions["disable_logs"] ) echo 'checked="checked"'; ?> />
|
206 |
+
<?php _e('Disable the email logging functionality.', 'wp-smtp'); ?>
|
207 |
</label>
|
208 |
</td>
|
209 |
</tr>
|