Version Description
- New: Storing host IP
- Fix: passing search term for pagination
- Tweak: close modal with ESC
=
Download this release
Release Info
| Developer | No3x |
| Plugin | |
| Version | 1.7.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.6.2 to 1.7.0
- WPML_Email_Log_List.php +466 -451
- WPML_OptionsManager.php +4 -2
- WPML_Plugin.php +18 -3
- WPML_Utils.php +7 -2
- css/.gitignore +0 -0
- images/.gitignore +0 -0
- inc/redux/WPML_Redux_Framework_config.php +14 -1
- js/.gitignore +0 -0
- js/modal.js +3 -1
- languages/.gitignore +0 -0
- lib/vendor/brandonwamboldt/wp-orm/.gitignore +0 -1
- model/WPML_Mail.php +6 -1
- readme.txt +12 -4
- wp-mail-logging.php +1 -1
WPML_Email_Log_List.php
CHANGED
|
@@ -1,451 +1,466 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
namespace No3x\WPML;
|
| 4 |
-
|
| 5 |
-
use No3x\WPML\Model\WPML_Mail as Mail;
|
| 6 |
-
|
| 7 |
-
// Exit if accessed directly.
|
| 8 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
| 9 |
-
|
| 10 |
-
require_once( ABSPATH . 'wp-admin/includes/screen.php' );
|
| 11 |
-
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
| 12 |
-
|
| 13 |
-
if ( ! class_exists( 'WP_List_Table' ) ) {
|
| 14 |
-
require_once( plugin_dir_path( __FILE__ ) . 'inc/class-wp-list-table.php' );
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
/**
|
| 18 |
-
* Renders the mails in a table list.
|
| 19 |
-
* @author No3x
|
| 20 |
-
* @since 1.0
|
| 21 |
-
*/
|
| 22 |
-
class WPML_Email_Log_List extends \WP_List_Table {
|
| 23 |
-
|
| 24 |
-
const NONCE_LIST_TABLE = 'wpml-list_table';
|
| 25 |
-
private $supported_formats = array();
|
| 26 |
-
/**
|
| 27 |
-
* Initializes the List Table
|
| 28 |
-
* @since 1.0
|
| 29 |
-
*/
|
| 30 |
-
function __construct( $supported_formats = array() ) {
|
| 31 |
-
$this->supported_formats = $supported_formats;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
function addActionsAndFilters() {
|
| 35 |
-
add_action( 'admin_init', array( $this, 'init') );
|
| 36 |
-
add_filter( WPML_Plugin::HOOK_LOGGING_SUPPORTED_FORMATS, function() {
|
| 37 |
-
return $this->supported_formats;
|
| 38 |
-
} );
|
| 39 |
-
add_action( 'wp_ajax_wpml_email_get', __CLASS__ . '::ajax_wpml_email_get' );
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
function init() {
|
| 43 |
-
global $status, $page, $hook_suffix;
|
| 44 |
-
|
| 45 |
-
parent::__construct( array(
|
| 46 |
-
'singular' => 'email', // singular name of the listed records
|
| 47 |
-
'plural' => 'emails', // plural name of the listed records
|
| 48 |
-
'ajax' => false, // does this table support ajax?
|
| 49 |
-
) );
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
/**
|
| 53 |
-
* Is displayed if no item is available to render
|
| 54 |
-
* @since 1.0
|
| 55 |
-
* @see WP_List_Table::no_items()
|
| 56 |
-
*/
|
| 57 |
-
function no_items() {
|
| 58 |
-
_e( 'No email found.', 'wpml' );
|
| 59 |
-
return;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
/**
|
| 63 |
-
* Defines the available columns.
|
| 64 |
-
* @since 1.0
|
| 65 |
-
* @see WP_List_Table::get_columns()
|
| 66 |
-
*/
|
| 67 |
-
function get_columns() {
|
| 68 |
-
$columns = array(
|
| 69 |
-
'cb' => '<input type="checkbox" />',
|
| 70 |
-
'mail_id' => __( 'ID', 'wpml' ),
|
| 71 |
-
'timestamp' => __( 'Time', 'wpml' ),
|
| 72 |
-
'receiver' => __( 'Receiver', 'wpml' ),
|
| 73 |
-
'subject' => __( 'Subject', 'wpml' ),
|
| 74 |
-
'message' => __( 'Message', 'wpml' ),
|
| 75 |
-
'headers' => __( 'Headers', 'wpml' ),
|
| 76 |
-
'attachments' => __( 'Attachments', 'wpml' ),
|
| 77 |
-
'plugin_version' => __( 'Plugin Version', 'wpml' ),
|
| 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 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
$
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
$
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
$
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
$
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
*
|
| 209 |
-
* @
|
| 210 |
-
* @
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
$
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
*
|
| 224 |
-
* @
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
}
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
}
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
*
|
| 393 |
-
* @
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
'
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
$
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
namespace No3x\WPML;
|
| 4 |
+
|
| 5 |
+
use No3x\WPML\Model\WPML_Mail as Mail;
|
| 6 |
+
|
| 7 |
+
// Exit if accessed directly.
|
| 8 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
| 9 |
+
|
| 10 |
+
require_once( ABSPATH . 'wp-admin/includes/screen.php' );
|
| 11 |
+
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
| 12 |
+
|
| 13 |
+
if ( ! class_exists( 'WP_List_Table' ) ) {
|
| 14 |
+
require_once( plugin_dir_path( __FILE__ ) . 'inc/class-wp-list-table.php' );
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Renders the mails in a table list.
|
| 19 |
+
* @author No3x
|
| 20 |
+
* @since 1.0
|
| 21 |
+
*/
|
| 22 |
+
class WPML_Email_Log_List extends \WP_List_Table {
|
| 23 |
+
|
| 24 |
+
const NONCE_LIST_TABLE = 'wpml-list_table';
|
| 25 |
+
private $supported_formats = array();
|
| 26 |
+
/**
|
| 27 |
+
* Initializes the List Table
|
| 28 |
+
* @since 1.0
|
| 29 |
+
*/
|
| 30 |
+
function __construct( $supported_formats = array() ) {
|
| 31 |
+
$this->supported_formats = $supported_formats;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
function addActionsAndFilters() {
|
| 35 |
+
add_action( 'admin_init', array( $this, 'init') );
|
| 36 |
+
add_filter( WPML_Plugin::HOOK_LOGGING_SUPPORTED_FORMATS, function() {
|
| 37 |
+
return $this->supported_formats;
|
| 38 |
+
} );
|
| 39 |
+
add_action( 'wp_ajax_wpml_email_get', __CLASS__ . '::ajax_wpml_email_get' );
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
function init() {
|
| 43 |
+
global $status, $page, $hook_suffix;
|
| 44 |
+
|
| 45 |
+
parent::__construct( array(
|
| 46 |
+
'singular' => 'email', // singular name of the listed records
|
| 47 |
+
'plural' => 'emails', // plural name of the listed records
|
| 48 |
+
'ajax' => false, // does this table support ajax?
|
| 49 |
+
) );
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* Is displayed if no item is available to render
|
| 54 |
+
* @since 1.0
|
| 55 |
+
* @see WP_List_Table::no_items()
|
| 56 |
+
*/
|
| 57 |
+
function no_items() {
|
| 58 |
+
_e( 'No email found.', 'wpml' );
|
| 59 |
+
return;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Defines the available columns.
|
| 64 |
+
* @since 1.0
|
| 65 |
+
* @see WP_List_Table::get_columns()
|
| 66 |
+
*/
|
| 67 |
+
function get_columns() {
|
| 68 |
+
$columns = array(
|
| 69 |
+
'cb' => '<input type="checkbox" />',
|
| 70 |
+
'mail_id' => __( 'ID', 'wpml' ),
|
| 71 |
+
'timestamp' => __( 'Time', 'wpml' ),
|
| 72 |
+
'receiver' => __( 'Receiver', 'wpml' ),
|
| 73 |
+
'subject' => __( 'Subject', 'wpml' ),
|
| 74 |
+
'message' => __( 'Message', 'wpml' ),
|
| 75 |
+
'headers' => __( 'Headers', 'wpml' ),
|
| 76 |
+
'attachments' => __( 'Attachments', 'wpml' ),
|
| 77 |
+
'plugin_version' => __( 'Plugin Version', 'wpml' ),
|
| 78 |
+
);
|
| 79 |
+
|
| 80 |
+
/* @var $instance WPML_Plugin */
|
| 81 |
+
$instance = WPML_Init::getInstance()->getService( 'plugin' );
|
| 82 |
+
|
| 83 |
+
$switch = $instance->getSetting('display-host', false );
|
| 84 |
+
if( true == $switch ) {
|
| 85 |
+
$posAfterTimestamp = array_search('timestamp', array_keys($columns) ) + 1;
|
| 86 |
+
$columns = array_merge(
|
| 87 |
+
array_slice( $columns, 0, $posAfterTimestamp),
|
| 88 |
+
[ 'host' => __( 'Host', 'wpml' ) ],
|
| 89 |
+
array_slice( $columns, $posAfterTimestamp )
|
| 90 |
+
);
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
// Give a plugin the chance to edit the columns.
|
| 94 |
+
$columns = apply_filters( WPML_Plugin::HOOK_LOGGING_COLUMNS, $columns );
|
| 95 |
+
|
| 96 |
+
$reserved = array( '_title', 'comment', 'media', 'name', 'title', 'username', 'blogname' );
|
| 97 |
+
|
| 98 |
+
// Show message for reserved column names.
|
| 99 |
+
foreach ( $reserved as $reserved_key ) {
|
| 100 |
+
if ( array_key_exists( $reserved_key, $columns ) ) {
|
| 101 |
+
echo "You should avoid $reserved_key as keyname since it is treated by WordPress specially: Your table would still work, but you won't be able to show/hide the columns. You can prefix your columns!";
|
| 102 |
+
break;
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
return $columns;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Define which columns are hidden
|
| 110 |
+
* @since 1.0
|
| 111 |
+
* @return array
|
| 112 |
+
*/
|
| 113 |
+
function get_hidden_columns() {
|
| 114 |
+
return array(
|
| 115 |
+
'plugin_version',
|
| 116 |
+
'mail_id',
|
| 117 |
+
);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
* Sanitize orderby parameter.
|
| 122 |
+
* @s
|
| 123 |
+
* @return string sanitized orderby parameter
|
| 124 |
+
*/
|
| 125 |
+
private function sanitize_orderby() {
|
| 126 |
+
return WPML_Utils::sanitize_expected_value( ( !empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : null, $this->get_sortable_columns(), 'mail_id');
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* Sanitize order parameter.
|
| 131 |
+
* @return string sanitized order parameter
|
| 132 |
+
*/
|
| 133 |
+
private function sanitize_order() {
|
| 134 |
+
return WPML_Utils::sanitize_expected_value( ( !empty( $_GET['order'] ) ) ? $_GET['order'] : null, array('desc', 'asc'), 'desc');
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/**
|
| 138 |
+
* Prepares the items for rendering
|
| 139 |
+
* @since 1.0
|
| 140 |
+
* @param string|boolean $search string you want to search for. Default false.
|
| 141 |
+
* @see WP_List_Table::prepare_items()
|
| 142 |
+
*/
|
| 143 |
+
function prepare_items( $search = false ) {
|
| 144 |
+
$orderby = $this->sanitize_orderby();
|
| 145 |
+
$order = $this->sanitize_order();
|
| 146 |
+
|
| 147 |
+
$columns = $this->get_columns();
|
| 148 |
+
$hidden = $this->get_hidden_columns();
|
| 149 |
+
$sortable = $this->get_sortable_columns();
|
| 150 |
+
$this->_column_headers = array( $columns, $hidden, $sortable );
|
| 151 |
+
|
| 152 |
+
$this->process_bulk_action();
|
| 153 |
+
|
| 154 |
+
$per_page = $this->get_items_per_page( 'per_page', 25 );
|
| 155 |
+
$current_page = $this->get_pagenum();
|
| 156 |
+
$offset = ( $current_page - 1 ) * $per_page;
|
| 157 |
+
|
| 158 |
+
$total_items = Mail::query()
|
| 159 |
+
->search( $search )
|
| 160 |
+
->find( true );
|
| 161 |
+
|
| 162 |
+
$mails = Mail::query()
|
| 163 |
+
->search( $search )
|
| 164 |
+
->sort_by( $orderby )
|
| 165 |
+
->order( $order )
|
| 166 |
+
->limit( $per_page )
|
| 167 |
+
->offset( $offset )
|
| 168 |
+
->find();
|
| 169 |
+
|
| 170 |
+
foreach ( $mails as $mail ) {
|
| 171 |
+
/* @var $mail Mail */
|
| 172 |
+
$this->items[] = $mail->to_array();
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
$this->set_pagination_args( array(
|
| 176 |
+
'total_items' => $total_items, // The total number of items.
|
| 177 |
+
'per_page' => $per_page, // Number of items per page.
|
| 178 |
+
) );
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* Renders the cell.
|
| 183 |
+
* Note: We can easily add filter for all columns if you want to / need to manipulate the content. (currently only additional column manipulation is supported)
|
| 184 |
+
* @since 1.0
|
| 185 |
+
* @param array $item The current item.
|
| 186 |
+
* @param string $column_name The current column name.
|
| 187 |
+
* @return string The cell content
|
| 188 |
+
*/
|
| 189 |
+
function column_default( $item, $column_name ) {
|
| 190 |
+
switch ( $column_name ) {
|
| 191 |
+
case 'mail_id':
|
| 192 |
+
case 'timestamp':
|
| 193 |
+
case 'host':
|
| 194 |
+
case 'subject':
|
| 195 |
+
case 'message':
|
| 196 |
+
case 'headers':
|
| 197 |
+
case 'attachments':
|
| 198 |
+
case 'plugin_version':
|
| 199 |
+
case 'receiver':
|
| 200 |
+
return $item[ $column_name ];
|
| 201 |
+
default:
|
| 202 |
+
// If we don't know this column maybe a hook does - if no hook extracted data (string) out of the array we can avoid the output of 'Array()' (array).
|
| 203 |
+
return ( is_array( $res = apply_filters( WPML_Plugin::HOOK_LOGGING_COLUMNS_RENDER, $item, $column_name ) ) ) ? '' : $res;
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
/**
|
| 208 |
+
* Sanitize message to remove unsafe html.
|
| 209 |
+
* @since 1.5.1
|
| 210 |
+
* @param string $message unsafe message.
|
| 211 |
+
* @return string safe message.
|
| 212 |
+
*/
|
| 213 |
+
function sanitize_message( $message ) {
|
| 214 |
+
$allowed_tags = wp_kses_allowed_html( 'post' );
|
| 215 |
+
$allowed_tags['a']['data-message'] = true;
|
| 216 |
+
$allowed_tags['style'][''] = true;
|
| 217 |
+
return wp_kses( $message, $allowed_tags );
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
/**
|
| 221 |
+
* Renders the message column.
|
| 222 |
+
* @since 1.3
|
| 223 |
+
* @param array $item The current item.
|
| 224 |
+
* @return void|string
|
| 225 |
+
*/
|
| 226 |
+
function column_message( $item ) {
|
| 227 |
+
if ( empty( $item['message'] ) ) {
|
| 228 |
+
return '';
|
| 229 |
+
}
|
| 230 |
+
//$content = $this->sanitize_message( $this->render_mail_html( $item ) );
|
| 231 |
+
$content = $item['mail_id'];
|
| 232 |
+
$message = '<a class="wp-mail-logging-view-message button button-secondary" href="#" data-mail-id="' . esc_attr( $content ) . '">View</a>';
|
| 233 |
+
return $message;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/**
|
| 237 |
+
* Renders the timestamp column.
|
| 238 |
+
* @since 1.5.0
|
| 239 |
+
* @param array $item The current item.
|
| 240 |
+
* @return void|string
|
| 241 |
+
*/
|
| 242 |
+
function column_timestamp( $item ) {
|
| 243 |
+
return date_i18n( apply_filters( 'wpml_get_date_time_format', '' ), strtotime( $item['timestamp'] ) );
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/**
|
| 247 |
+
* Renders the attachment column in compbat mode for mails prior 1.6.0.
|
| 248 |
+
* @since 1.6.0
|
| 249 |
+
* @param array $item The current item.
|
| 250 |
+
* @return string The attachment column.
|
| 251 |
+
*/
|
| 252 |
+
function column_attachments_compat_152( $item ) {
|
| 253 |
+
$attachment_append = '';
|
| 254 |
+
$attachments = explode( ',\n', $item['attachments'] );
|
| 255 |
+
$attachments = is_array( $attachments ) ? $attachments : array( $attachments );
|
| 256 |
+
foreach ( $attachments as $attachment ) {
|
| 257 |
+
// $attachment can be an empty string ''.
|
| 258 |
+
if ( ! empty( $attachment ) ) {
|
| 259 |
+
$filename = basename( $attachment );
|
| 260 |
+
$attachment_path = WP_CONTENT_DIR . $attachment;
|
| 261 |
+
$attachment_url = WP_CONTENT_URL . $attachment;
|
| 262 |
+
if ( is_file( $attachment_path ) ) {
|
| 263 |
+
$attachment_append .= '<a href="' . $attachment_url . '" title="' . $filename . '">' . WPML_Utils::generate_attachment_icon( $attachment_path ) . '</a> ';
|
| 264 |
+
} else {
|
| 265 |
+
$message = sprintf( __( 'Attachment %s is not present', 'wpml' ), $filename );
|
| 266 |
+
$attachment_append .= '<i class="fa fa-times" title="' . $message . '"></i>';
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
return $attachment_append;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
/**
|
| 274 |
+
* Renders the attachment column.
|
| 275 |
+
* @since 1.3
|
| 276 |
+
* @param array $item The current item.
|
| 277 |
+
* @return string The attachment column.
|
| 278 |
+
*/
|
| 279 |
+
function column_attachments( $item ) {
|
| 280 |
+
|
| 281 |
+
if ( version_compare( trim( $item ['plugin_version'] ), '1.6.0', '<' ) ) {
|
| 282 |
+
return $this->column_attachments_compat_152( $item );
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
$attachment_append = '';
|
| 286 |
+
$attachments = explode( ',\n', $item['attachments'] );
|
| 287 |
+
$attachments = is_array( $attachments ) ? $attachments : array( $attachments );
|
| 288 |
+
foreach ( $attachments as $attachment ) {
|
| 289 |
+
// $attachment can be an empty string ''.
|
| 290 |
+
if ( ! empty( $attachment ) ) {
|
| 291 |
+
$filename = basename( $attachment );
|
| 292 |
+
$basename = '/uploads';
|
| 293 |
+
$attachment_path = WP_CONTENT_DIR . $basename . $attachment;
|
| 294 |
+
$attachment_url = WP_CONTENT_URL . $basename . $attachment;
|
| 295 |
+
|
| 296 |
+
if ( is_file( $attachment_path ) ) {
|
| 297 |
+
$attachment_append .= '<a href="' . $attachment_url . '" title="' . $filename . '">' . WPML_Utils::generate_attachment_icon( $attachment_path ) . '</a> ';
|
| 298 |
+
} else {
|
| 299 |
+
$message = sprintf( __( 'Attachment %s is not present', 'wpml' ), $filename );
|
| 300 |
+
$attachment_append .= '<i class="fa fa-times" title="' . $message . '"></i>';
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
return $attachment_append;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
/**
|
| 308 |
+
* Renders all components of the mail.
|
| 309 |
+
* @since 1.3
|
| 310 |
+
* @param array $item The current item.
|
| 311 |
+
* @return string The mail as html
|
| 312 |
+
*/
|
| 313 |
+
function render_mail( $item ) {
|
| 314 |
+
$mailAppend = '';
|
| 315 |
+
foreach ( $item as $key => $value ) {
|
| 316 |
+
if ( array_key_exists( $key, $this->get_columns() ) && ! in_array( $key, $this->get_hidden_columns() ) ) {
|
| 317 |
+
$display = $this->get_columns();
|
| 318 |
+
$column_name = $key;
|
| 319 |
+
$title = "<span class=\"title\">{$display[$key]}: </span>";
|
| 320 |
+
$content = '';
|
| 321 |
+
if ( 'message' !== $column_name && method_exists( $this, 'column_' . $column_name ) ) {
|
| 322 |
+
$content .= call_user_func( array( $this, 'column_' . $column_name ), $item );
|
| 323 |
+
} else {
|
| 324 |
+
$content .= $this->column_default( $item, $column_name );
|
| 325 |
+
}
|
| 326 |
+
$mailAppend .= $title . htmlentities( $content );
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
return $mailAppend;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
/**
|
| 334 |
+
* Renders all components of the mail.
|
| 335 |
+
* @since 1.6.0
|
| 336 |
+
* @param array $item The current item.
|
| 337 |
+
* @return string The mail as html
|
| 338 |
+
*/
|
| 339 |
+
function render_mail_html( $item ) {
|
| 340 |
+
$mailAppend = '';
|
| 341 |
+
foreach ( $item as $key => $value ) {
|
| 342 |
+
if ( array_key_exists( $key, $this->get_columns() ) && ! in_array( $key, $this->get_hidden_columns() ) ) {
|
| 343 |
+
$display = $this->get_columns();
|
| 344 |
+
$column_name = $key;
|
| 345 |
+
$mailAppend .= "<span class=\"title\">{$display[$key]}: </span>";
|
| 346 |
+
if ( 'message' !== $column_name && method_exists( $this, 'column_' . $column_name ) ) {
|
| 347 |
+
$mailAppend .= call_user_func( array( $this, 'column_' . $column_name ), $item );
|
| 348 |
+
} else {
|
| 349 |
+
$mailAppend .= $this->column_default( $item, $column_name );
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
return $mailAppend;
|
| 354 |
+
}
|
| 355 |
+
/**
|
| 356 |
+
* Defines available bulk actions.
|
| 357 |
+
* @since 1.0
|
| 358 |
+
* @see WP_List_Table::get_bulk_actions()
|
| 359 |
+
*/
|
| 360 |
+
function get_bulk_actions() {
|
| 361 |
+
$actions = array(
|
| 362 |
+
'delete' => 'Delete',
|
| 363 |
+
);
|
| 364 |
+
return $actions;
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
/**
|
| 368 |
+
* Processes bulk actions.
|
| 369 |
+
* @since 1.0
|
| 370 |
+
*/
|
| 371 |
+
function process_bulk_action() {
|
| 372 |
+
if ( false === $this->current_action() ) {
|
| 373 |
+
return;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
if ( check_admin_referer( WPML_Email_Log_List::NONCE_LIST_TABLE, WPML_Email_Log_List::NONCE_LIST_TABLE . '_nonce' ) ) {
|
| 377 |
+
$name = $this->_args['singular'];
|
| 378 |
+
|
| 379 |
+
// Detect when a bulk action is being triggered.
|
| 380 |
+
if ( 'delete' === $this->current_action() ) {
|
| 381 |
+
foreach ( $_REQUEST[$name] as $item_id ) {
|
| 382 |
+
$mail = Mail::find_one( $item_id );
|
| 383 |
+
if ( false !== $mail ) {
|
| 384 |
+
$mail->delete();
|
| 385 |
+
}
|
| 386 |
+
}
|
| 387 |
+
}
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* Render the cb column
|
| 393 |
+
* @since 1.0
|
| 394 |
+
* @param array $item The current item.
|
| 395 |
+
* @return string the rendered cb cell content
|
| 396 |
+
*/
|
| 397 |
+
function column_cb($item) {
|
| 398 |
+
$name = $this->_args['singular'];
|
| 399 |
+
return sprintf(
|
| 400 |
+
'<input type="checkbox" name="%1$s[]" value="%2$s" />', $name, $item['mail_id']
|
| 401 |
+
);
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
/**
|
| 405 |
+
* Define the sortable columns
|
| 406 |
+
* @since 1.0
|
| 407 |
+
* @return array
|
| 408 |
+
*/
|
| 409 |
+
function get_sortable_columns() {
|
| 410 |
+
return array(
|
| 411 |
+
// Description: column_name => array( 'display_name', true[asc] | false[desc] ).
|
| 412 |
+
'mail_id' => array( 'mail_id', false ),
|
| 413 |
+
'timestamp' => array( 'timestamp', true ),
|
| 414 |
+
'host' => array( 'host', true ),
|
| 415 |
+
'receiver' => array( 'receiver', true ),
|
| 416 |
+
'subject' => array( 'subject', true ),
|
| 417 |
+
'message' => array( 'message', true ),
|
| 418 |
+
'headers' => array( 'headers', true ),
|
| 419 |
+
'attachments' => array( 'attachments', true ),
|
| 420 |
+
'plugin_version'=> array( 'plugin_version', true ),
|
| 421 |
+
);
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
/**
|
| 425 |
+
* Ajax function to retrieve rendered mail in certain format.
|
| 426 |
+
* @since 1.6.0
|
| 427 |
+
*/
|
| 428 |
+
public static function ajax_wpml_email_get() {
|
| 429 |
+
$formats = is_array( $additional = apply_filters( WPML_Plugin::HOOK_LOGGING_SUPPORTED_FORMATS, array() ) ) ? $additional : array();
|
| 430 |
+
|
| 431 |
+
check_ajax_referer( 'wpml-modal-show', 'ajax_nonce', true );
|
| 432 |
+
|
| 433 |
+
if( ! isset( $_POST['id'] ) )
|
| 434 |
+
wp_die( "huh?" );
|
| 435 |
+
$id = intval( $_POST['id'] );
|
| 436 |
+
|
| 437 |
+
$format_requested = isset( $_POST['format'] ) ? $_POST['format'] : 'html';
|
| 438 |
+
if ( ! in_array( $format_requested, $formats ) ) {
|
| 439 |
+
echo "Unsupported Format. Using html as fallback.";
|
| 440 |
+
$format_requested = WPML_Utils::sanitize_expected_value($format_requested, $formats, 'html');
|
| 441 |
+
}
|
| 442 |
+
$mail = Mail::find_one( $id );
|
| 443 |
+
/* @var $instance WPML_Email_Log_List */
|
| 444 |
+
$instance = WPML_Init::getInstance()->getService( 'emailLogList' );
|
| 445 |
+
$mailAppend = '';
|
| 446 |
+
switch( $format_requested ) {
|
| 447 |
+
case 'html': {
|
| 448 |
+
$mailAppend .= $instance->render_mail_html( $mail->to_array() );
|
| 449 |
+
break;
|
| 450 |
+
}
|
| 451 |
+
case 'raw': {
|
| 452 |
+
$mailAppend .= $instance->render_mail( $mail->to_array() );
|
| 453 |
+
break;
|
| 454 |
+
}
|
| 455 |
+
case 'json': {
|
| 456 |
+
$mailAppend .= json_encode( $mail->to_array() );
|
| 457 |
+
break;
|
| 458 |
+
}
|
| 459 |
+
default:
|
| 460 |
+
$mailAppend .= apply_filters( WPML_Plugin::HOOK_LOGGING_FORMAT_CONTENT . "_{$format_requested}", $mail->to_array() );
|
| 461 |
+
break;
|
| 462 |
+
}
|
| 463 |
+
echo $mailAppend;
|
| 464 |
+
wp_die(); // this is required to terminate immediately and return a proper response
|
| 465 |
+
}
|
| 466 |
+
}
|
WPML_OptionsManager.php
CHANGED
|
@@ -350,6 +350,7 @@ class WPML_OptionsManager {
|
|
| 350 |
<li>View a complete list of sent mails.</li>
|
| 351 |
<li>Search for mails.</li>
|
| 352 |
<li>Count on regular updates, enhancements, and troubleshooting.</li>
|
|
|
|
| 353 |
<li>Developer: Boost your development performance by keeping track of sent mails from your WordPress site.</li>
|
| 354 |
<li>Developer: Use Filters that are provided to extend the columns.</li>
|
| 355 |
</ul>
|
|
@@ -361,7 +362,7 @@ class WPML_OptionsManager {
|
|
| 361 |
</ul>
|
| 362 |
<h3>Donate</h3>
|
| 363 |
<p>Please consider to make a donation if you like the plugin. I spent a lot of time for support, enhancements and updates in general.</p>
|
| 364 |
-
<a title="Donate" href="http://no3x.de/web/donate">Donate</a>
|
| 365 |
</div>
|
| 366 |
<?php
|
| 367 |
}
|
|
@@ -517,11 +518,12 @@ class WPML_OptionsManager {
|
|
| 517 |
</div>
|
| 518 |
</div>
|
| 519 |
|
| 520 |
-
<form id="email-list" method="
|
| 521 |
<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
|
| 522 |
<?php
|
| 523 |
wp_nonce_field( WPML_Email_Log_List::NONCE_LIST_TABLE, WPML_Email_Log_List::NONCE_LIST_TABLE . '_nonce' );
|
| 524 |
$search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : false;
|
|
|
|
| 525 |
$emailLogList = WPML_Init::getInstance()->getService('emailLogList');
|
| 526 |
$emailLogList->prepare_items( $search );
|
| 527 |
$emailLogList->search_box( __( 'Search' ), 's' );
|
| 350 |
<li>View a complete list of sent mails.</li>
|
| 351 |
<li>Search for mails.</li>
|
| 352 |
<li>Count on regular updates, enhancements, and troubleshooting.</li>
|
| 353 |
+
<li>DevOP: IP of server sent the mail</li>
|
| 354 |
<li>Developer: Boost your development performance by keeping track of sent mails from your WordPress site.</li>
|
| 355 |
<li>Developer: Use Filters that are provided to extend the columns.</li>
|
| 356 |
</ul>
|
| 362 |
</ul>
|
| 363 |
<h3>Donate</h3>
|
| 364 |
<p>Please consider to make a donation if you like the plugin. I spent a lot of time for support, enhancements and updates in general.</p>
|
| 365 |
+
<a title="Donate" class="button button-primary" href="http://no3x.de/web/donate">Donate</a>
|
| 366 |
</div>
|
| 367 |
<?php
|
| 368 |
}
|
| 518 |
</div>
|
| 519 |
</div>
|
| 520 |
|
| 521 |
+
<form id="email-list" method="get">
|
| 522 |
<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
|
| 523 |
<?php
|
| 524 |
wp_nonce_field( WPML_Email_Log_List::NONCE_LIST_TABLE, WPML_Email_Log_List::NONCE_LIST_TABLE . '_nonce' );
|
| 525 |
$search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : false;
|
| 526 |
+
/** @var WPML_Email_Log_List $emailLogList */
|
| 527 |
$emailLogList = WPML_Init::getInstance()->getService('emailLogList');
|
| 528 |
$emailLogList->prepare_items( $search );
|
| 529 |
$emailLogList->search_box( __( 'Search' ), 's' );
|
WPML_Plugin.php
CHANGED
|
@@ -47,12 +47,13 @@ class WPML_Plugin extends WPML_LifeCycle {
|
|
| 47 |
$wpdb->query("CREATE TABLE IF NOT EXISTS `$tableName` (
|
| 48 |
`mail_id` INT NOT NULL AUTO_INCREMENT,
|
| 49 |
`timestamp` TIMESTAMP NOT NULL,
|
|
|
|
| 50 |
`receiver` VARCHAR(200) NOT NULL DEFAULT '0',
|
| 51 |
`subject` VARCHAR(200) NOT NULL DEFAULT '0',
|
| 52 |
`message` TEXT NULL,
|
| 53 |
`headers` TEXT NULL,
|
| 54 |
`attachments` VARCHAR(800) NOT NULL DEFAULT '0',
|
| 55 |
-
`plugin_version` VARCHAR(200) NOT NULL DEFAULT '
|
| 56 |
PRIMARY KEY (`mail_id`)
|
| 57 |
) DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE utf8_general_ci;");
|
| 58 |
}
|
|
@@ -79,8 +80,19 @@ class WPML_Plugin extends WPML_LifeCycle {
|
|
| 79 |
global $wpdb;
|
| 80 |
$upgradeOk = true;
|
| 81 |
$savedVersion = $this->getVersionSaved();
|
|
|
|
| 82 |
$tableName = $this->getTablename('mails');
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
if ($this->isVersionLessThan($savedVersion, '2.0')) {
|
| 85 |
if ($this->isVersionLessThan($savedVersion, '1.2')) {
|
| 86 |
$wpdb->query("ALTER TABLE `$tableName` CHANGE COLUMN `to` `receiver` VARCHAR(200)");
|
|
@@ -91,6 +103,9 @@ class WPML_Plugin extends WPML_LifeCycle {
|
|
| 91 |
if ($this->isVersionLessThan($savedVersion, '1.4')) {
|
| 92 |
$wpdb->query("ALTER TABLE `$tableName` CHARACTER SET utf8 COLLATE utf8_general_ci;");
|
| 93 |
}
|
|
|
|
|
|
|
|
|
|
| 94 |
}
|
| 95 |
|
| 96 |
if ( !empty( $wpdb->last_error ) ) {
|
|
@@ -101,7 +116,6 @@ class WPML_Plugin extends WPML_LifeCycle {
|
|
| 101 |
}
|
| 102 |
|
| 103 |
// Post-upgrade, set the current version in the options
|
| 104 |
-
$codeVersion = $this->getVersion();
|
| 105 |
if ($upgradeOk && $savedVersion != $codeVersion) {
|
| 106 |
$this->saveInstalledVersion();
|
| 107 |
}
|
|
@@ -185,7 +199,8 @@ class WPML_Plugin extends WPML_LifeCycle {
|
|
| 185 |
'headers' => $this->extractHeader( $mail['headers'] ),
|
| 186 |
'attachments' => $this->extractAttachments( $mail['attachments'] ),
|
| 187 |
'plugin_version' => $this->getVersionSaved(),
|
| 188 |
-
'timestamp' => current_time( 'mysql' )
|
|
|
|
| 189 |
);
|
| 190 |
}
|
| 191 |
|
| 47 |
$wpdb->query("CREATE TABLE IF NOT EXISTS `$tableName` (
|
| 48 |
`mail_id` INT NOT NULL AUTO_INCREMENT,
|
| 49 |
`timestamp` TIMESTAMP NOT NULL,
|
| 50 |
+
`host` VARCHAR(200) NOT NULL DEFAULT '0',
|
| 51 |
`receiver` VARCHAR(200) NOT NULL DEFAULT '0',
|
| 52 |
`subject` VARCHAR(200) NOT NULL DEFAULT '0',
|
| 53 |
`message` TEXT NULL,
|
| 54 |
`headers` TEXT NULL,
|
| 55 |
`attachments` VARCHAR(800) NOT NULL DEFAULT '0',
|
| 56 |
+
`plugin_version` VARCHAR(200) NOT NULL DEFAULT '',
|
| 57 |
PRIMARY KEY (`mail_id`)
|
| 58 |
) DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE utf8_general_ci;");
|
| 59 |
}
|
| 80 |
global $wpdb;
|
| 81 |
$upgradeOk = true;
|
| 82 |
$savedVersion = $this->getVersionSaved();
|
| 83 |
+
$codeVersion = $this->getVersion();
|
| 84 |
$tableName = $this->getTablename('mails');
|
| 85 |
|
| 86 |
+
/* check for downgrade or beta
|
| 87 |
+
if( $this->isVersionLessThan($codeVersion, $savedVersion)
|
| 88 |
+
|| false !== strpos($savedVersion, 'beta') ) {
|
| 89 |
+
$upgradeOk = false;
|
| 90 |
+
// This is only be the case if the user had a beta version installed
|
| 91 |
+
if ( is_admin() ) {
|
| 92 |
+
wp_die( "[{$this->getPluginDisplayName()}] You have installed version {$savedVersion} but try to install {$codeVersion}! This would require a database downgrade which is not supported! You need to install {$savedVersion} again, enable \"Cleanup\" in the settings and disable the plugin.");
|
| 93 |
+
}
|
| 94 |
+
}*/
|
| 95 |
+
|
| 96 |
if ($this->isVersionLessThan($savedVersion, '2.0')) {
|
| 97 |
if ($this->isVersionLessThan($savedVersion, '1.2')) {
|
| 98 |
$wpdb->query("ALTER TABLE `$tableName` CHANGE COLUMN `to` `receiver` VARCHAR(200)");
|
| 103 |
if ($this->isVersionLessThan($savedVersion, '1.4')) {
|
| 104 |
$wpdb->query("ALTER TABLE `$tableName` CHARACTER SET utf8 COLLATE utf8_general_ci;");
|
| 105 |
}
|
| 106 |
+
if ($this->isVersionLessThan($savedVersion, '1.7')) {
|
| 107 |
+
$wpdb->query("ALTER TABLE `$tableName` ADD COLUMN `host` VARCHAR(200) NOT NULL DEFAULT '' AFTER `timestamp`;");
|
| 108 |
+
}
|
| 109 |
}
|
| 110 |
|
| 111 |
if ( !empty( $wpdb->last_error ) ) {
|
| 116 |
}
|
| 117 |
|
| 118 |
// Post-upgrade, set the current version in the options
|
|
|
|
| 119 |
if ($upgradeOk && $savedVersion != $codeVersion) {
|
| 120 |
$this->saveInstalledVersion();
|
| 121 |
}
|
| 199 |
'headers' => $this->extractHeader( $mail['headers'] ),
|
| 200 |
'attachments' => $this->extractAttachments( $mail['attachments'] ),
|
| 201 |
'plugin_version' => $this->getVersionSaved(),
|
| 202 |
+
'timestamp' => current_time( 'mysql' ),
|
| 203 |
+
'host' => isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : ''
|
| 204 |
);
|
| 205 |
}
|
| 206 |
|
WPML_Utils.php
CHANGED
|
@@ -52,9 +52,10 @@ class WPML_Utils {
|
|
| 52 |
* Determines appropriate fa icon for a file
|
| 53 |
* @sine 1.3
|
| 54 |
* @param string $file_path path to file.
|
| 55 |
-
* @return
|
| 56 |
*/
|
| 57 |
public static function determine_fa_icon( $file_path ) {
|
|
|
|
| 58 |
$supported = array(
|
| 59 |
'archive' => array(
|
| 60 |
'application/zip',
|
|
@@ -79,6 +80,10 @@ class WPML_Utils {
|
|
| 79 |
'application/msword'
|
| 80 |
), 'zip'
|
| 81 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
$mime = mime_content_type( $file_path );
|
| 84 |
$mime_parts = explode( '/', $mime );
|
|
@@ -95,7 +100,7 @@ class WPML_Utils {
|
|
| 95 |
}
|
| 96 |
|
| 97 |
if ( false === $fa_icon ) {
|
| 98 |
-
return
|
| 99 |
} else {
|
| 100 |
return '<i class="fa fa-file-' . $fa_icon . '-o"></i>';
|
| 101 |
}
|
| 52 |
* Determines appropriate fa icon for a file
|
| 53 |
* @sine 1.3
|
| 54 |
* @param string $file_path path to file.
|
| 55 |
+
* @return string returns the most suitable icon or generic one if not possible.
|
| 56 |
*/
|
| 57 |
public static function determine_fa_icon( $file_path ) {
|
| 58 |
+
$default_icon = '<i class="fa fa-file-o"></i>';
|
| 59 |
$supported = array(
|
| 60 |
'archive' => array(
|
| 61 |
'application/zip',
|
| 80 |
'application/msword'
|
| 81 |
), 'zip'
|
| 82 |
);
|
| 83 |
+
|
| 84 |
+
if( !function_exists('mime_content_type') ) {
|
| 85 |
+
return $default_icon;
|
| 86 |
+
}
|
| 87 |
|
| 88 |
$mime = mime_content_type( $file_path );
|
| 89 |
$mime_parts = explode( '/', $mime );
|
| 100 |
}
|
| 101 |
|
| 102 |
if ( false === $fa_icon ) {
|
| 103 |
+
return $default_icon;
|
| 104 |
} else {
|
| 105 |
return '<i class="fa fa-file-' . $fa_icon . '-o"></i>';
|
| 106 |
}
|
css/.gitignore
DELETED
|
File without changes
|
images/.gitignore
DELETED
|
File without changes
|
inc/redux/WPML_Redux_Framework_config.php
CHANGED
|
@@ -285,6 +285,19 @@ if (!class_exists('WPML_Redux_Framework_config')) {
|
|
| 285 |
'title' => __('Default Format for Message', 'wpml'),
|
| 286 |
'subtitle' => __('Select your preferred display format.', 'wpml'),
|
| 287 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
array(
|
| 289 |
'id' => 'section-log-rotation-start',
|
| 290 |
'type' => 'section',
|
|
@@ -461,7 +474,7 @@ if (!class_exists('WPML_Redux_Framework_config')) {
|
|
| 461 |
|
| 462 |
// HINTS
|
| 463 |
'hints' => array(
|
| 464 |
-
'icon' => '
|
| 465 |
'icon_position' => 'right',
|
| 466 |
'icon_color' => 'lightgray',
|
| 467 |
'icon_size' => 'normal',
|
| 285 |
'title' => __('Default Format for Message', 'wpml'),
|
| 286 |
'subtitle' => __('Select your preferred display format.', 'wpml'),
|
| 287 |
),
|
| 288 |
+
array(
|
| 289 |
+
'id' => 'display-host',
|
| 290 |
+
'type' => 'switch',
|
| 291 |
+
'title' => __('Display Host', 'wpml' ),
|
| 292 |
+
'subtitle' => __('Display host column in list.', 'wpml'),
|
| 293 |
+
'hint' => array(
|
| 294 |
+
'title' => 'Host',
|
| 295 |
+
'content' => 'Display the IP of the host WordPress is running on. This is useful when running it on multiple servers at the same time.',
|
| 296 |
+
),
|
| 297 |
+
'default' => 0,
|
| 298 |
+
'on' => 'Enabled',
|
| 299 |
+
'off' => 'Disabled',
|
| 300 |
+
),
|
| 301 |
array(
|
| 302 |
'id' => 'section-log-rotation-start',
|
| 303 |
'type' => 'section',
|
| 474 |
|
| 475 |
// HINTS
|
| 476 |
'hints' => array(
|
| 477 |
+
'icon' => 'el el-question-sign',
|
| 478 |
'icon_position' => 'right',
|
| 479 |
'icon_color' => 'lightgray',
|
| 480 |
'icon_size' => 'normal',
|
js/.gitignore
DELETED
|
File without changes
|
js/modal.js
CHANGED
|
@@ -45,8 +45,10 @@ jQuery(function ($) {
|
|
| 45 |
wpml.modal.init();
|
| 46 |
wpml.modal.show();
|
| 47 |
});
|
| 48 |
-
|
| 49 |
$('.wp-mail-logging-modal-close').click(function () {
|
| 50 |
wpml.modal.hide();
|
| 51 |
});
|
|
|
|
|
|
|
|
|
|
| 52 |
});
|
| 45 |
wpml.modal.init();
|
| 46 |
wpml.modal.show();
|
| 47 |
});
|
|
|
|
| 48 |
$('.wp-mail-logging-modal-close').click(function () {
|
| 49 |
wpml.modal.hide();
|
| 50 |
});
|
| 51 |
+
$(document).keyup(function(e) {
|
| 52 |
+
if (e.keyCode === 27) wpml.modal.hide();
|
| 53 |
+
});
|
| 54 |
});
|
languages/.gitignore
DELETED
|
File without changes
|
lib/vendor/brandonwamboldt/wp-orm/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.DS_Store
|
|
|
model/WPML_Mail.php
CHANGED
|
@@ -25,6 +25,11 @@ class WPML_Mail extends BaseModel
|
|
| 25 |
*/
|
| 26 |
protected $timestamp;
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
/**
|
| 29 |
* @var string
|
| 30 |
*/
|
|
@@ -92,6 +97,6 @@ class WPML_Mail extends BaseModel
|
|
| 92 |
*/
|
| 93 |
public static function get_searchable_fields()
|
| 94 |
{
|
| 95 |
-
return array('receiver', 'subject', 'headers', 'message', 'attachments');
|
| 96 |
}
|
| 97 |
}
|
| 25 |
*/
|
| 26 |
protected $timestamp;
|
| 27 |
|
| 28 |
+
/**
|
| 29 |
+
* @var string
|
| 30 |
+
*/
|
| 31 |
+
protected $host;
|
| 32 |
+
|
| 33 |
/**
|
| 34 |
* @var string
|
| 35 |
*/
|
| 97 |
*/
|
| 98 |
public static function get_searchable_fields()
|
| 99 |
{
|
| 100 |
+
return array('receiver', 'subject', 'headers', 'message', 'attachments', 'host');
|
| 101 |
}
|
| 102 |
}
|
readme.txt
CHANGED
|
@@ -5,8 +5,8 @@ Tags: mail, email, log, logging, debug, list, store, collect, view
|
|
| 5 |
License: GPLv3
|
| 6 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 7 |
Requires at least: 3.0
|
| 8 |
-
Tested up to: 4.6
|
| 9 |
-
Stable tag: 1.
|
| 10 |
|
| 11 |
Logs each email sent by WordPress.
|
| 12 |
|
|
@@ -19,6 +19,7 @@ Features of the plugin include:
|
|
| 19 |
* Complete list of sent mails - view and search through the mails.
|
| 20 |
* Zero-configuration - just install and enjoy.
|
| 21 |
* Log rotation - decide which emails you want to keep.
|
|
|
|
| 22 |
* Developer: Boost your development performance by keeping track of sent mails.
|
| 23 |
* Developer: Filters are provided to extend the columns.
|
| 24 |
|
|
@@ -44,11 +45,18 @@ The logged email has been sent by WordPress but please note this does NOT mean i
|
|
| 44 |
3. The Settings
|
| 45 |
|
| 46 |
== Upgrade Notice ==
|
| 47 |
-
= 1.
|
| 48 |
-
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
== Changelog ==
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
= 1.6.2, August 7, 2016 =
|
| 53 |
- Fix: search mails
|
| 54 |
|
| 5 |
License: GPLv3
|
| 6 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 7 |
Requires at least: 3.0
|
| 8 |
+
Tested up to: 4.6.1
|
| 9 |
+
Stable tag: 1.7.0
|
| 10 |
|
| 11 |
Logs each email sent by WordPress.
|
| 12 |
|
| 19 |
* Complete list of sent mails - view and search through the mails.
|
| 20 |
* Zero-configuration - just install and enjoy.
|
| 21 |
* Log rotation - decide which emails you want to keep.
|
| 22 |
+
* DevOP: IP of server sent the mail
|
| 23 |
* Developer: Boost your development performance by keeping track of sent mails.
|
| 24 |
* Developer: Filters are provided to extend the columns.
|
| 25 |
|
| 45 |
3. The Settings
|
| 46 |
|
| 47 |
== Upgrade Notice ==
|
| 48 |
+
= 1.7.0 =
|
| 49 |
+
- New: Storing host IP
|
| 50 |
+
- Fix: passing search term for pagination
|
| 51 |
+
- Tweak: close modal with ESC
|
| 52 |
|
| 53 |
== Changelog ==
|
| 54 |
|
| 55 |
+
= 1.7.0, November 6, 2016 =
|
| 56 |
+
- New: logging host IP
|
| 57 |
+
- Fix: passing search term for pagination
|
| 58 |
+
- Tweak: close modal with ESC
|
| 59 |
+
|
| 60 |
= 1.6.2, August 7, 2016 =
|
| 61 |
- Fix: search mails
|
| 62 |
|
wp-mail-logging.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: WP Mail Logging
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-mail-logging/
|
| 5 |
Support URI: https://github.com/No3x/wp-mail-logging/issues
|
| 6 |
-
Version: 1.
|
| 7 |
Author: Christian Zöller
|
| 8 |
Author URI: http://no3x.de/
|
| 9 |
Description: Logs each email sent by WordPress.
|
| 3 |
Plugin Name: WP Mail Logging
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-mail-logging/
|
| 5 |
Support URI: https://github.com/No3x/wp-mail-logging/issues
|
| 6 |
+
Version: 1.7.0
|
| 7 |
Author: Christian Zöller
|
| 8 |
Author URI: http://no3x.de/
|
| 9 |
Description: Logs each email sent by WordPress.
|
