Send email to customer

This commit is contained in:
FreeScout
2018-08-02 09:17:13 -07:00
parent 37e53e588c
commit 26e3acd283
548 changed files with 30472 additions and 1809 deletions

View File

@@ -1,15 +1,12 @@
APP_URL=http://localhost
APP_NAME=FreeScout
APP_URL=https://example.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_DATABASE=freescout
DB_USERNAME=freescout
DB_PASSWORD=XXX
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
# System FreeScout emails will be sent to admin from this email address use PHP's mail() function
MAIL_FROM_ADDRESS=noreply@example.com

View File

@@ -2,7 +2,7 @@
<img src="https://raw.githubusercontent.com/freescout-helpdesk/freescout/master/public/img/logo-300.png" width="180" height="180" />
[![PHP version](https://img.shields.io/badge/PHP-%207.0%2B-blue.svg)](https://github.com/freescout-helpdesk/freescout#requirements) [![Laravel version](https://img.shields.io/badge/Laravel-5.5-blue.svg)](https://github.com/freescout-helpdesk/freescout#requirements)
[![PHP version](https://freescout-helpdesk.github.io/img/badges/PHP-7.0%2B-blue.svg)](https://github.com/freescout-helpdesk/freescout#requirements) [![Laravel version](https://freescout-helpdesk.github.io/img/badges/Laravel-5.5-blue.svg)](https://github.com/freescout-helpdesk/freescout#requirements)
[![Build Status](https://travis-ci.org/freescout-helpdesk/freescout.svg?branch=master)](https://travis-ci.org/freescout-helpdesk/freescout) [![Join the chat at https://gitter.im/freescout-helpdesk/Lobby](https://badges.gitter.im/freescout-helpdesk/Lobby.svg)](https://gitter.im/freescout-helpdesk/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![HitCount](http://hits.dwyl.io/freescout-helpdesk/freescout.svg)](http://hits.dwyl.io/freescout-helpdesk/freescout)
**FreeScout** is a free open source help desk and shared inbox written in PHP7 (Laravel 5.5 framework), full analog of HelpScout. As you may know, Help Scout on **November 29, 2018** will force all free accounts to upgrade to the paid plan, so developing a free open source alternative is kind of urgent.

View File

@@ -6,7 +6,8 @@ use Spatie\Activitylog\Models\Activity;
class ActivityLog extends Activity
{
const NAME_USER = 'user';
const NAME_USER = 'users';
const NAME_EMAILS_SENDING = 'emails_sending';
const DESCRIPTION_USER_LOGIN = 'login';
const DESCRIPTION_USER_LOGOUT = 'logout';
@@ -14,6 +15,7 @@ class ActivityLog extends Activity
const DESCRIPTION_USER_LOCKED = 'locked';
const DESCRIPTION_USER_LOGIN_FAILED = 'login_failed';
const DESCRIPTION_USER_PASSWORD_RESET = 'password_reset';
const DESCRIPTION_EMAILS_SENDING_ERROR = 'error_sending_email';
public function getEventDescription()
{
@@ -30,9 +32,26 @@ class ActivityLog extends Activity
return __('Failed login');
case self::DESCRIPTION_USER_PASSWORD_RESET:
return __('Reset password');
case self::DESCRIPTION_EMAILS_SENDING_ERROR:
return __('Error sending email');
default:
return $this->description;
break;
}
}
/**
* Get title for the log record.
*/
public static function getLogTitle($log_name)
{
switch ($log_name) {
case self::NAME_USER:
return __('Users');
case self::NAME_EMAILS_SENDING:
return __('Emails Sending');
default:
return ucfirst($log_name);
}
}
}

View File

@@ -25,8 +25,34 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
// Remove failed jobs
$schedule->command('queue:flush')
->daily();
// Restart processing queued jobs (just in case)
$schedule->command('queue:restart')
->hourly();
// Command runs as subprocess and sets cache mutex. If schedule:run command is killed
// subprocess does not clear the mutex and it stays in the cache until cache:clear is executed.
// By default, the lock will expire after 24 hours.
// No need
// So on receiving a kill signal we need to manually remove all mutexes.
// $pid = getmypid();
// register_shutdown_function(function () use ($pid, $schedule) {
// if ($pid === getmypid()) {
// foreach ($schedule->events() as $event) {
// if ($event->description) {
// $event->mutex->forget($event);
// }
// }
// }
// });
$schedule->command('queue:work', Config('app.queue_work_params'))
//->everyMinute()
->withoutOverlapping()
->sendOutputTo(storage_path() . '/logs/queue-jobs.log');
}
/**

View File

@@ -66,7 +66,7 @@ class Conversation extends Model
public static $status_colors = [
self::STATUS_ACTIVE => 'success',
self::STATUS_PENDING => 'warning',
self::STATUS_PENDING => 'default',
self::STATUS_CLOSED => 'grey',
self::STATUS_SPAM => 'danger',
//self::STATUS_OPEN => 'folder-open',
@@ -189,6 +189,20 @@ class Conversation extends Model
return $this->belongsTo('App\User');
}
/**
* Get only reply threads from conversations.
*
* @return Collection
*/
public function getReplies()
{
return $this->threads()
->whereIn('type', [Thread::TYPE_CUSTOMER, Thread::TYPE_MESSAGE])
->where('state', Thread::STATE_PUBLISHED)
->orderBy('created_at', 'desc')
->get();
}
/**
* Set preview text.
*
@@ -418,6 +432,34 @@ class Conversation extends Model
}
}
/**
* Get CC recipients.
*
* @return array
*/
public function getCcArray()
{
if ($this->cc) {
return json_decode($this->cc);
} else {
return [];
}
}
/**
* Get BCC recipients.
*
* @return array
*/
public function getBccArray()
{
if ($this->bcc) {
return json_decode($this->bcc);
} else {
return [];
}
}
/**
* Convert list of email to array.
*

View File

@@ -645,4 +645,26 @@ class Customer extends Model
return $customer;
}
/**
* Get customer URL.
*
* @return string
*/
public function url()
{
return route('customers.update', ['id'=>$this->id]);
}
/**
* Format date according to customer's timezone.
*
* @param Carbon $date
* @param string $format
* @return string
*/
public static function dateFormat($date, $format = 'M j, Y H:i')
{
return $date->format($format);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Events;
use App\Conversation;
class ConversationCreated
{
public $conversation;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Conversation $conversation)
{
$this->conversation = $conversation;
}
}

13
app/FailedJob.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class FailedJob extends Model
{
/**
* Automatically converted into Carbon dates.
*/
protected $dates = ['failed_at'];
}

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Conversation;
use App\Customer;
use App\Events\ConversationCreated;
use App\Events\ConversationStatusChanged;
use App\Events\ConversationUserChanged;
use App\Folder;
@@ -30,15 +31,21 @@ class ConversationsController extends Controller
public function view($id)
{
$conversation = Conversation::findOrFail($id);
$this->authorize('view', $conversation);
// Detect folder
if ($conversation->user_id == auth()->user()->id) {
$folder = $conversation->mailbox->folders()->where('type', Folder::TYPE_MINE)->first();
} else {
$folder = $conversation->folder;
}
return view('conversations/view', [
'conversation' => $conversation,
'mailbox' => $conversation->mailbox,
'customer' => $conversation->customer,
'threads' => $conversation->threads()->orderBy('created_at', 'desc')->get(),
'folder' => $conversation->folder,
'folder' => $folder,
'folders' => $conversation->mailbox->getAssesibleFolders(),
]);
}
@@ -203,6 +210,21 @@ class ConversationsController extends Controller
$conversation->setUser($new_user_id);
$conversation->save();
// Create lineitem thread
$thread = new Thread();
$thread->conversation_id = $conversation->id;
$thread->user_id = $conversation->user_id;
$thread->type = Thread::TYPE_LINEITEM;
$thread->state = Thread::STATE_PUBLISHED;
$thread->status = Thread::STATUS_NOCHANGE;
$thread->action_type = Thread::ACTION_TYPE_USER_CHANGED;
$thread->source_via = Thread::PERSON_USER;
// todo: this need to be changed for API
$thread->source_type = Thread::SOURCE_TYPE_WEB;
$thread->customer_id = $conversation->customer_id;
$thread->created_by_user_id = $user->id;
$thread->save();
event(new ConversationUserChanged($conversation));
$response['status'] = 'success';
@@ -250,6 +272,21 @@ class ConversationsController extends Controller
$conversation->setStatus($new_status, $user);
$conversation->save();
// Create lineitem thread
$thread = new Thread();
$thread->conversation_id = $conversation->id;
$thread->user_id = $conversation->user_id;
$thread->type = Thread::TYPE_LINEITEM;
$thread->state = Thread::STATE_PUBLISHED;
$thread->status = $conversation->status;
$thread->action_type = Thread::ACTION_TYPE_STATUS_CHANGED;
$thread->source_via = Thread::PERSON_USER;
// todo: this need to be changed for API
$thread->source_type = Thread::SOURCE_TYPE_WEB;
$thread->customer_id = $conversation->customer_id;
$thread->created_by_user_id = $user->id;
$thread->save();
event(new ConversationStatusChanged($conversation));
$response['status'] = 'success';
@@ -329,7 +366,8 @@ class ConversationsController extends Controller
if (!$response['msg']) {
$now = date('Y-m-d H:i:s');
$status_changed = false;
$user_changed = false;
if ($new) {
// New conversation
$customer = Customer::create($to_array[0]);
@@ -352,12 +390,17 @@ class ConversationsController extends Controller
$conversation->source_type = Conversation::SOURCE_TYPE_WEB;
} else {
$customer = $conversation->customer;
if ((int)$request->status != (int)$conversation->status) {
$status_changed = true;
}
}
$conversation->status = $request->status;
if ((int) $request->user_id != -1) {
// Check if user has access to the current mailbox
if ($mailbox->userHasAccess($request->user_id)) {
if ((int)$conversation->user_id != (int)$request->user_id && $mailbox->userHasAccess($request->user_id)) {
$conversation->user_id = $request->user_id;
$user_changed = true;
}
} else {
$conversation->user_id = null;
@@ -368,6 +411,16 @@ class ConversationsController extends Controller
$conversation->updateFolder();
$conversation->save();
// Fire events
if (!$new) {
if ($status_changed) {
event(new ConversationStatusChanged($conversation));
}
if ($user_changed) {
event(new ConversationUserChanged($conversation));
}
}
// Create thread
$thread = new Thread();
$thread->conversation_id = $conversation->id;
@@ -385,6 +438,8 @@ class ConversationsController extends Controller
$thread->created_by_user_id = auth()->user()->id;
$thread->save();
event(new ConversationCreated($conversation));
$response['status'] = 'success';
$response['redirect_url'] = route('conversations.view', ['id' => $conversation->id]);

View File

@@ -44,10 +44,10 @@ class SecureController extends Controller
$cols = [];
$current_name = '';
if (!empty($request->name)) {
$activities = ActivityLog::inLog($request->name)->get();
$activities = ActivityLog::inLog($request->name)->orderBy('created_at', 'desc')->get();
$current_name = $request->name;
} elseif (count($names)) {
$activities = ActivityLog::inLog($names[0])->get();
$activities = ActivityLog::inLog($names[0])->orderBy('created_at', 'desc')->get();
$current_name = $names[0];
}
@@ -55,10 +55,18 @@ class SecureController extends Controller
foreach ($activities as $activity) {
$log = [
'date' => $activity->created_at,
'user' => $activity->causer,
'causer' => $activity->causer,
'event' => $activity->getEventDescription(),
];
$cols = ['date', 'user', 'event'];
$cols = ['date'];
if ($activity->causer_type == 'App\User') {
$cols[] = __('User');
} else {
$cols[] = __('Customer');
}
$cols[] = 'event';
foreach ($activity->properties as $property_name => $property_value) {
if (!is_string($property_value)) {
@@ -73,4 +81,15 @@ class SecureController extends Controller
return view('secure/logs', ['logs' => $logs, 'names' => $names, 'current_name' => $current_name, 'cols' => $cols]);
}
/**
* System status.
*/
public function system(Request $request)
{
$queued_jobs = \App\Job::orderBy('created_at', 'desc')->get();
$failed_jobs = \App\FailedJob::orderBy('failed_at', 'desc')->get();
return view('secure/system', ['queued_jobs' => $queued_jobs, 'failed_jobs' => $failed_jobs]);
}
}

View File

@@ -57,5 +57,6 @@ class Kernel extends HttpKernel
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'roles' => \App\Http\Middleware\CheckRole::class,
];
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Middleware;
use App\User;
use Closure;
class CheckRole{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// Get the required roles from the route
$roles = $this->getRequiredRoleForRoute($request->route());
// Check if a role is required for the route, and
// if so, ensure that the user has that role.
if (!$roles || in_array($request->user()->getRoleName(), $roles)) {
return $next($request);
}
abort(403, __('You are not authorized to access this resource.'));
// return response([
// 'error' => [
// 'code' => 'INSUFFICIENT_ROLE',
// 'description' =>
// ]
// ], 401);
}
private function getRequiredRoleForRoute($route)
{
$actions = $route->getAction();
return isset($actions['roles']) ? $actions['roles'] : null;
}
}

13
app/Job.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Job extends Model
{
/**
* Automatically converted into Carbon dates.
*/
protected $dates = ['created_at', 'available_at', 'reserved_at'];
}

View File

@@ -0,0 +1,123 @@
<?php
namespace App\Jobs;
use App\Mail\ReplyToCustomer;
use App\Thread;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Mail;
class SendReplyToCustomer implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $conversation;
public $threads;
public $customer;
public $user;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($conversation, $threads, $customer, $user)
{
$this->conversation = $conversation;
$this->threads = $threads;
$this->customer = $customer;
$this->user = $user;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$mailbox = $this->conversation->mailbox;
// Configure mail driver according to Mailbox settings
\App\Mail\Mail::setMailDriver($mailbox, $this->user);
// Threads has to be sorted here, if sorted before, they come here in wrong order
$this->threads = $this->threads->sortByDesc(function ($item, $key) {
return $item->created_at;
});
$new = false;
$headers = [];
$last_thread = $this->threads->first();
$prev_thread = null;
if (count($this->threads) == 1) {
$new = true;
}
$i = 0;
foreach ($this->threads as $thread) {
if ($i == 1) {
$prev_thread = $thread;
break;
}
$i++;
}
// Get penultimate email Message-Id if reply
if (!$new && !empty($prev_thread) && $prev_thread->message_id) {
$headers['In-Reply-To'] = '<'.$prev_thread->message_id.'>';
$headers['References'] = '<'.$prev_thread->message_id.'>';
}
$message_id = 'thread-'.$last_thread->id.'-'.time().'@'.$mailbox->getEmailDomain();
$headers['Message-ID'] = $message_id;
Mail::to([['name' => $this->customer->getFullName(), 'email' => $this->customer->getMainEmail()]])
->cc($this->conversation->getCcArray())
->bcc($this->conversation->getBccArray())
->send(new ReplyToCustomer($this->conversation, $this->threads, $headers));
$last_thread->message_id = $message_id;
// Laravel tells us exactly what email addresses failed, let's send back the first
$failures = Mail::failures();
if (!empty($failures)) {
$last_thread->send_status = Thread::SEND_STATUS_SEND_ERROR;
$last_thread->save();
throw new \Exception('Could not send email to: '.implode(', ', $failures));
} else {
$last_thread->send_status = Thread::SEND_STATUS_SEND_SUCCESS;
$last_thread->save();
}
}
/**
* The job failed to process.
*
* @param Exception $exception
* @return void
*/
public function failed(\Exception $exception)
{
$this->threads = $this->threads->sortByDesc(function ($item, $key) {
return $item->created_at;
});
$this->threads[0]->send_status = Thread::SEND_STATUS_SEND_ERROR;
$this->threads[0]->save();
activity()
->causedBy($this->customer)
->withProperties([
'error' => $exception->getMessage(),
'to' => $this->customer->getMainEmail()
])
->useLog(\App\ActivityLog::NAME_EMAILS_SENDING)
->log(\App\ActivityLog::DESCRIPTION_EMAILS_SENDING_ERROR);
}
}

View File

@@ -1,43 +0,0 @@
<?php
namespace App\Listeners;
use App\Events\ConversationStatusChanged;
use App\Thread;
class CreateThreadStatusChanged
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param ConversationStatusChanged $event
*
* @return void
*/
public function handle(ConversationStatusChanged $event)
{
$thread = new Thread();
$thread->conversation_id = $event->conversation->id;
$thread->user_id = $event->conversation->user_id;
$thread->type = Thread::TYPE_LINEITEM;
$thread->state = Thread::STATE_PUBLISHED;
$thread->status = $event->conversation->status;
$thread->action_type = Thread::ACTION_TYPE_STATUS_CHANGED;
$thread->source_via = Thread::PERSON_USER;
// todo: this need to be changed for API
$thread->source_type = Thread::SOURCE_TYPE_WEB;
$thread->customer_id = $event->conversation->customer_id;
$thread->created_by_user_id = auth()->user()->id;
$thread->save();
}
}

View File

@@ -1,43 +0,0 @@
<?php
namespace App\Listeners;
use App\Events\ConversationUserChanged;
use App\Thread;
class CreateThreadUserChanged
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param ConversationStatusChanged $event
*
* @return void
*/
public function handle(ConversationUserChanged $event)
{
$thread = new Thread();
$thread->conversation_id = $event->conversation->id;
$thread->user_id = $event->conversation->user_id;
$thread->type = Thread::TYPE_LINEITEM;
$thread->state = Thread::STATE_PUBLISHED;
$thread->status = Thread::STATUS_NOCHANGE;
$thread->action_type = Thread::ACTION_TYPE_USER_CHANGED;
$thread->source_via = Thread::PERSON_USER;
// todo: this need to be changed for API
$thread->source_type = Thread::SOURCE_TYPE_WEB;
$thread->customer_id = $event->conversation->customer_id;
$thread->created_by_user_id = auth()->user()->id;
$thread->save();
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Listeners;
use App\Events\ConversationCreated;
use App\Thread;
class SendReplyToCustomer
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param ConversationCreated $event
*
* @return void
*/
public function handle(ConversationCreated $event)
{
$conversation = $event->conversation;
if (!$conversation->imported) {
\App\Jobs\SendReplyToCustomer::dispatch($conversation, $conversation->getReplies(), $conversation->customer, auth()->user())
->onQueue('emails');
}
}
}

26
app/Mail/Mail.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
namespace App\Mail;
class Mail
{
/**
* Configure mail sending parameters.
*
* @param App\Mailbox $mailbox
*/
public static function setMailDriver($mailbox = null, $user = null)
{
if ($mailbox) {
// Configure mail driver according to Mailbox settings
\Config::set('mail.driver', $mailbox->getMailDriverName());
\Config::set('mail.from', $mailbox->getMailFrom($user));
} else {
// Use default settings
\Config::set('mail.driver', env('MAIL_DRIVER'));
\Config::set('mail.from', ['address' => env('MAIL_FROM_ADDRESS'), 'name' => '']);
}
(new \Illuminate\Mail\MailServiceProvider(app()))->register();
}
}

View File

@@ -0,0 +1,125 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Container\Container;
use Illuminate\Contracts\Mail\Mailer as MailerContract;
use Illuminate\Contracts\Queue\ShouldQueue;
// https://medium.com/@guysmilez/queuing-mailables-with-custom-headers-in-laravel-5-4-ab615f022f17
//abstract class AbstractMessage extends Mailable
class ReplyToCustomer extends Mailable
{
use Queueable, SerializesModels;
/**
* Conversation to send.
*
* @var [type]
*/
public $conversation;
/**
* Threads to send.
*
* @var [type]
*/
public $threads;
/**
* Custome haders.
*
* @var array
*/
public $headers = [];
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($conversation, $threads, $headers)
{
$this->conversation = $conversation;
$this->threads = $threads;
$this->headers = $headers;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
// Set Message-ID
// Settings via $this->addCustomHeaders does not work
if (!empty($this->headers['Message-ID'])) {
//$message_id = $this->headers['Message-ID'];
$new_headers = $this->headers;
$this->withSwiftMessage(function ($swiftmessage) use ($new_headers) {
$swiftmessage->setId($new_headers['Message-ID']);
$headers = $swiftmessage->getHeaders();
foreach ($new_headers as $header => $value) {
if ($header != 'Message-ID') {
$headers->addTextHeader($header, $value);
}
}
return $swiftmessage;
});
//unset($this->headers['Message-ID']);
}
$subject = $this->conversation->subject;
if (count($this->threads) > 1) {
$subject = 'Re: '.$subject;
}
// from($this->from) Sets only email, name stays empty.
return $this->subject($subject)
->view('emails/customer/reply_fancy')
->text('emails/customer/reply_fancy_text');
// ->attach('/path/to/file');
}
/**
* Send the message using the given mailer.
*
* @param \Illuminate\Contracts\Mail\Mailer $mailer
* @return void
*/
// public function send(MailerContract $mailer)
// {
// Container::getInstance()->call([$this, 'build']);
// $mailer->send($this->buildView(), $this->buildViewData(), function ($message) {
// $this->buildFrom($message)
// ->buildRecipients($message)
// ->buildSubject($message)
// ->buildAttachments($message)
// ->addCustomHeaders($message) // This is new!
// ->runCallbacks($message);
// });
// }
/**
* Add custom headers to the message.
*
* @param \Illuminate\Mail\Message $message
* @return $this
*/
// protected function addCustomHeaders($message)
// {
// $swift = $message->getSwiftMessage();
// $headers = $swift->getHeaders();
// // By some reason $this->headers are empty here
// foreach ($this->headers as $header => $value) {
// $headers->addTextHeader($header, $value);
// }
// return $this;
// }
}

View File

@@ -35,7 +35,7 @@ class Mailbox extends Model
const TEMPLATE_PLAIN = 2;
/**
* Sending Emails.
* Outgoing method. Must be listed in getMailDriverName.
*/
const OUT_METHOD_PHP_MAIL = 1;
const OUT_METHOD_SENDMAIL = 2;
@@ -297,4 +297,54 @@ class Mailbox extends Model
return (bool) $this->users()->where('users.id', $user_id)->count();
}
}
/**
* Get From array for the Mail function.
*
* @param App\User $from_user
* @return array
*/
public function getMailFrom($from_user = null)
{
$name = $this->name;
if ($this->from_name == self::FROM_NAME_CUSTOM && $this->from_name_custom) {
$name = $this->from_name_custom;
} elseif ($this->from_name == self::FROM_NAME_CUSTOM && $from_user) {
$name = $from_user->getFullName();
}
return ['address' => $this->email, 'name' => $name];
}
/**
* Get corresponding Laravel mail driver name.
*/
public function getMailDriverName()
{
switch ($this->out_method) {
case self::OUT_METHOD_PHP_MAIL:
return 'mail';
case self::OUT_METHOD_SENDMAIL:
return 'sendmail';
case self::OUT_METHOD_SMTP:
return 'smtp';
default:
return 'mail';
break;
}
}
/**
* Get domain part of the mailbox email.
*
* @return string
*/
public function getEmailDomain()
{
return explode('@', $this->email)[1];
}
}

View File

@@ -38,14 +38,28 @@ class EventServiceProvider extends ServiceProvider
],
'App\Events\ConversationStatusChanged' => [
'App\Listeners\CreateThreadStatusChanged',
'App\Listeners\UpdateMailboxCounters',
],
'App\Events\ConversationUserChanged' => [
'App\Listeners\CreateThreadUserChanged',
'App\Listeners\UpdateMailboxCounters',
],
'App\Events\ConversationCreated' => [
'App\Listeners\SendReplyToCustomer',
],
'App\Events\ConversationUserReplied' => [
],
// 'App\Events\ConversationUserAddedNote' => [
// ],
// 'App\Events\ConversationCustomerReplied' => [
// ],
];
/**

View File

@@ -73,6 +73,8 @@ class Thread extends Model
const STATE_DRAFT = 1;
const STATE_PUBLISHED = 2;
const STATE_HIDDEN = 3;
// A state of review means the thread has been stopped by Traffic Cop and is waiting
// to be confirmed (or discarded) by the person that created the thread.
const STATE_REVIEW = 4;
public static $states = [
@@ -140,9 +142,10 @@ class Thread extends Model
* Status of the email sent to the customer or user, to whom the thread is assigned.
*/
const SEND_STATUS_TOSEND = 1;
const SEND_STATUS_SENT = 2;
const SEND_STATUS_DELIVERY_SUCCESS = 3;
const SEND_STATUS_DELIVERY_ERROR = 4;
const SEND_STATUS_SEND_SUCCESS = 2;
const SEND_STATUS_SEND_ERROR = 3;
const SEND_STATUS_DELIVERY_SUCCESS = 4;
const SEND_STATUS_DELIVERY_ERROR = 5;
/**
* The user assigned to this thread (assignedTo).
@@ -199,7 +202,7 @@ class Thread extends Model
*
* @return array
*/
public function getTos()
public function getToArray()
{
if ($this->to) {
return json_decode($this->to);
@@ -213,7 +216,7 @@ class Thread extends Model
*
* @return array
*/
public function getCcs()
public function getCcArray()
{
if ($this->cc) {
return json_decode($this->cc);
@@ -227,7 +230,7 @@ class Thread extends Model
*
* @return array
*/
public function getBccs()
public function getBccArray()
{
if ($this->bcc) {
return json_decode($this->bcc);
@@ -330,4 +333,16 @@ class Thread extends Model
return $this->user->getFullName();
}
}
/**
* Get user or customer who created the thead.
*/
public function getCreatedBy()
{
if (!empty($this->created_by_user_id)) {
return $this->created_by_user;
} else {
return $this->created_by_customer;
}
}
}

View File

@@ -161,7 +161,7 @@ class User extends Authenticatable
*
* @return string
*/
public function urlEdit()
public function url()
{
return route('users.profile', ['id'=>$this->id]);
}
@@ -209,7 +209,7 @@ class User extends Authenticatable
*
* @return string
*/
public static function dateFormat($date, $format)
public static function dateFormat($date, $format = 'M j, Y H:i')
{
$user = auth()->user();
if ($user) {

View File

@@ -13,7 +13,8 @@
"mews/purifier": "2.1.0",
"spatie/laravel-activitylog": "2.7.0",
"lord/laroute": "2.4.7",
"axn/laravel-laroute": "1.3.0"
"axn/laravel-laroute": "1.3.0",
"soundasleep/html2text": "0.5.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "v2.4.3",

View File

@@ -11,7 +11,7 @@ return [
* When the clean-command is executed, all recording activities older than
* the number of days specified here will be deleted.
*/
'delete_records_older_than_days' => 30,
'delete_records_older_than_days' => env('ACTIVITY_LOGGER_DELETE_RECORDS_OLDER_THAN_DAYS', 30),
/*
* If no log name is passed to the activity() helper
@@ -40,5 +40,5 @@ return [
* This is the name of the table that will be created by the migration and
* used by the Activity model shipped with this package.
*/
'table_name' => 'activity_log',
'table_name' => 'activity_logs',
];

View File

@@ -146,6 +146,14 @@ return [
*/
'freescout_url' => 'https://github.com/freescout-helpdesk/freescout',
/*
|--------------------------------------------------------------------------
| Parameters used to run queued jobs processing.
| Must contained comma separeted list of existing queues
|-------------------------------------------------------------------------
*/
'queue_work_params' => ['--queue' => 'emails', '--tries' => '7', '--sleep' => '3'],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers

View File

@@ -16,7 +16,7 @@ return [
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
'driver' => env('MAIL_DRIVER', 'mail'),
/*
|--------------------------------------------------------------------------

View File

@@ -15,7 +15,7 @@ return [
|
*/
'default' => env('QUEUE_DRIVER', 'sync'),
'default' => env('QUEUE_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------

View File

@@ -1,9 +1,9 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateActivityLogTable extends Migration
class CreateActivityLogsTable extends Migration
{
/**
* Run the migrations.

View File

@@ -33,6 +33,8 @@ class CreateThreadsTable extends Migration
$table->text('to')->nullable(); // JSON
$table->text('cc')->nullable(); // JSON
$table->text('bcc')->nullable(); // JSON
// Email Message-ID header for email received from customer
$table->string('message_id', 998)->nullable();
// source.via - Originating source of the thread - user or customer
$table->unsignedTinyInteger('source_via');
// source.type - Originating type of the thread (email, web, API etc)

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

25
public/css/style.css vendored
View File

@@ -381,8 +381,8 @@ select.form-control {
}
.btn-grey {
color: #fff;
background-color: #8f9aa6;
border-color: #72808e;
background-color: #87939f;
border-color: #727f8b;
}
.btn-grey:focus,
.btn-grey:hover {
@@ -390,6 +390,17 @@ select.form-control {
background-color: #64717b;
border-color: #4f5d69;
}
.btn-lightgrey {
color: #fff;
background-color: #a5b2bd;
border-color: #7e8d99;
}
.btn-lightgrey:focus,
.btn-lightgrey:hover {
color: #fff;
background-color: #72808e;
border-color: #72808e;
}
.btn-success.btn-light {
background-color: #71c171;
}
@@ -1646,6 +1657,16 @@ table.table-conversations td.conv-attachment {
border: 1px solid #8a6d3b;
}
/**
* Tables
*/
.table-dark-header th {
background-color: #f9f9f9;
}
.table-main-col {
width: 70%;
}
/**
* Misc
*/

6
public/js/main.js vendored
View File

@@ -123,6 +123,7 @@ function mailboxUpdateInit(from_name_custom)
minHeight: 120,
dialogsInBody: true,
disableResizeEditor: true,
followingToolbar: false,
toolbar: [
// [groupName, [list of button]]
['style', ['bold', 'italic', 'underline', 'ul', 'ol', 'link', 'codeview']],
@@ -187,7 +188,9 @@ function userCreateInit()
function logsInit()
{
$(document).ready(function() {
$('#table-logs').DataTable();
$('#table-logs').DataTable({
"ordering": false
});
} );
}
@@ -382,6 +385,7 @@ function convEditorInit()
dialogsInBody: true,
dialogsFade: true,
disableResizeEditor: true,
followingToolbar: false,
toolbar: [
// [groupName, [list of button]]
['style', ['attachment', 'bold', 'italic', 'underline', 'ul', 'ol', 'link', 'picture', 'codeview', 'savedreplies']],

View File

@@ -207,31 +207,31 @@
@endif
</div>
<div class="thread-recipients">
@if ($thread->getTos() == 1 && $thread->getTos()[0] == $mailbox->email)
@elseif ($thread->getTos())
@if ($thread->getToArray() == 1 && $thread->getToArray()[0] == $mailbox->email)
@elseif ($thread->getToArray())
<div>
<strong>
{{ __("To") }}:
</strong>
{{ implode(', ', $thread->getTos()) }}
{{ implode(', ', $thread->getToArray()) }}
</div>
@endif
@if ($thread->getCcs() == 1 && $thread->getCcs()[0] == $mailbox->email)
@elseif ($thread->getCcs())
@if ($thread->getCcArray() == 1 && $thread->getCcArray()[0] == $mailbox->email)
@elseif ($thread->getCcArray())
<div>
<strong>
{{ __("Cc") }}:
</strong>
{{ implode(', ', $thread->getCcs()) }}
{{ implode(', ', $thread->getCcArray()) }}
</div>
@endif
@if ($thread->getBccs() == 1 && $thread->getBccs()[0] == $mailbox->email)
@elseif ($thread->getBccs())
@if ($thread->getBccArray() == 1 && $thread->getBccArray()[0] == $mailbox->email)
@elseif ($thread->getBccArray())
<div>
<strong>
{{ __("Bcc") }}:
</strong>
{{ implode(', ', $thread->getBccs()) }}
{{ implode(', ', $thread->getBccArray()) }}
</div>
@endif
</div>

View File

@@ -0,0 +1,77 @@
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="viewport" content="initial-scale=1.0">
<style>
p { margin:0 0 1.6em 0; }
pre { font-family: Menlo, Monaco, monospace, sans-serif; padding: 0 0 1.6em 0; color:#333333; line-height:15px; }
img { max-width:100%; }
a { color: #346CC4; text-decoration:none; }
</style>
</head>
<body style="-webkit-text-size-adjust:none;">
<table cellspacing="0" border="0" cellpadding="0" width="100%">
<tr>
<td>
<table id="fsReplyAbove" class="fsReplyAbove" width="100%" border="0" cellspacing="0" cellpadding="0">
@foreach ($threads as $thread)
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin:0;">
<tr>
<td style="padding:8px 0 10px 0;">
<h3 style="font-family:Arial, 'Helvetica Neue', Helvetica, Tahoma, sans-serif; color:#727272; font-size:16px; line-height:22px; margin:0; font-weight:normal;">
<strong style="color:#000000;">{{ $thread->getCreatedBy()->first_name }}</strong> @if ($loop->last){{ __('sent a message') }}@else {{ __('replied') }}@endif
</h3>
@if ($thread->getCcArray())
<p style="font-family:Arial, 'Helvetica Neue', Helvetica, Tahoma, sans-serif; color:#9F9F9F; font-size:12px; line-height:16px; margin:0;">
Cc: {{ implode(', ', $thread->getCcArray() )}}
<br>
</p>
@endif
</td>
<td style="padding:8px 0 10px 0;" valign="top">
<div style="font-family: Arial, 'Helvetica Neue', Helvetica, Tahoma, sans-serif; color:#9F9F9F; font-size:12px; line-height:18px; margin:0;" align="right">{{ App\Customer::dateFormat($thread->created_at, 'M j, H:i') }}</div>
</td>
</tr>
<tr>
<td colspan="2" style="padding:8px 0 10px 0;">
<div>
<div style="font-family:Arial, 'Helvetica Neue', Helvetica, Tahoma, sans-serif; color: #232323; font-size:13px; line-height:19px; margin:0;">
{!! $thread->body !!}
{{-- todo: Satisfaction ratings --}}
{{--<br><br>How would you rate my reply?<br><a href="" style="color:#50bc1c;">Great</a> &nbsp;&nbsp; <a href="" style="color:#555555;">Okay</a> &nbsp;&nbsp; <a href="" style="color:#f10000;">Not Good</a>
--}}
{!! $conversation->mailbox->signature !!}
<br><br>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1"><div style="border-bottom:1px solid #e7e7e7;"></div></td>
</tr>
<tr>
<td height="20"></td>
</tr>
@endforeach
<tr>
<td height="0" style="font-size: 0px; line-height: 0px; color:#ffffff;">
{{-- todo: view tracking --}}
{{--<img src="" alt="" />
<div style="font-size: 0px; line-height: 0px; color:#ffffff !important; display:none;">{#FS:123-123#}</div>
--}}
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,8 @@
-- Please reply above this line --
@foreach ($threads as $thread)
-----------------------------------------------------------
## {{ $thread->getCreatedBy()->first_name }} @if ($loop->last){{ __('sent a message') }}@else {{ __('replied') }}@endif, {{ __('on :date', ['date' => App\Customer::dateFormat($thread->created_at, 'M j @ H:i')]) }} ({{ \Config::get('app.timezone') }}):
{{ Html2Text\Html2Text::convert($thread->body)}}{{-- (new \Html2Text\Html2Text($thread->body))->getText() --}}
{{ Html2Text\Html2Text::convert($conversation->mailbox->signature) }}{{-- (new \Html2Text\Html2Text($conversation->mailbox->signature))->getText() --}}
@endforeach

View File

@@ -101,6 +101,7 @@
<li><a href="#">{{ __('Teams') }} (todo)</a></li>
<li><a href="{{ route('users') }}">{{ __('Users') }}</a></li>
<li><a href="{{ route('logs') }}">{{ __('Logs') }}</a></li>
<li><a href="{{ route('system') }}">{{ __('System') }}</a></li>
@endif
</ul>
</li>

View File

@@ -73,47 +73,37 @@
<td class="conv-cb">
<input type="checkbox" id="cb-{{ $conversation->id }}" name="cb_{{ $conversation->id }}" value="{{ $conversation->id }}">
</td>
<td class="conv-customer" data-label="{{ __('Customer') }}">
<td class="conv-customer">
<a href="{{ route('conversations.view', ['id' => $conversation->id]) }}">
{{ $conversation->customer->getFullName(true)}}
</a>
</td>
<td class="conv-attachment" data-label="{{ __('Attachments') }}">
<td class="conv-attachment">
@if ($conversation->has_attachments)
<i class="glyphicon glyphicon-paperclip"></i>
@else
&nbsp;
@endif
</td>
<td class="conv-subject" data-label="{{ __('Conversation') }}">
<td class="conv-subject">
<a href="{{ route('conversations.view', ['id' => $conversation->id]) }}" title="{{ __('View conversation') }}">
<span class="conv-fader"></span>
<p><span class="conv-subject-number">#{{ $conversation->number }} </span>{{ $conversation->subject }}</p>
<p class="conv-preview">{{ $conversation->preview }}</p>
</a>
</td>
<td class="conv-thread-count" data-label="{{ __('Threads') }}">
<td class="conv-thread-count">
<a href="{{ route('conversations.view', ['id' => $conversation->id]) }}" title="{{ __('View conversation') }}">@if ($conversation->threads_count <= 1)&nbsp;@else<span>{{ $conversation->threads_count }}</span>@endif</a>
</td>
@if ($folder->type == App\Folder::TYPE_ASSIGNED || $folder->type == App\Folder::TYPE_CLOSED)
<td class="conv-owner" data-label="{{ __('Assigned To') }}">
<td class="conv-owner">
<a href="{{ route('conversations.view', ['id' => $conversation->id]) }}" title="{{ __('View conversation') }}"> {{ $conversation->user->getFullName() }} </a>
</td>
@endif
<td class="conv-number" data-label="
@if ($folder->type == App\Folder::TYPE_CLOSED)
{{ __("Closed") }}
@elseif ($folder->type == App\Folder::TYPE_DRAFTS)
{{ __("Last Updated") }}
@elseif ($folder->type == App\Folder::TYPE_DELETED)
{{ __("Deleted") }}
@else
{{ __("Waiting Since") }}
@endif
">
<td class="conv-number">
<a href="{{ route('conversations.view', ['id' => $conversation->id]) }}" title="{{ __('View conversation') }}">{{ $conversation->number }}</a>
</td>
<td class="conv-date" data-label="{{ __('Assigned To') }}">
<td class="conv-date">
<a href="{{ route('conversations.view', ['id' => $conversation->id]) }}" @if (!in_array($conversation->type, [App\Folder::TYPE_CLOSED, App\Folder::TYPE_DRAFTS, App\Folder::TYPE_DELETED])) data-toggle="tooltip" data-html="true" data-placement="left" title="{{ $conversation->getDateTitle() }}"@else title="{{ __('View conversation') }}" @endif >
@if ($folder->type == App\Folder::TYPE_CLOSED)
{{ App\User::dateDiffForHumans($conversation->closed_at) }}

View File

@@ -11,7 +11,7 @@
</div>
<ul class="sidebar-menu">
@foreach ($names as $name)
<li @if ($current_name == $name)class="active"@endif><i class="glyphicon glyphicon-minus"></i> <a href="{{ route('logs', ['name'=>$name]) }}">{{ ucfirst($name) }}</a></li>
<li @if ($current_name == $name)class="active"@endif><i class="glyphicon glyphicon-list-alt"></i> <a href="{{ route('logs', ['name'=>$name]) }}">{{ App\ActivityLog::getLogTitle($name) }}</a></li>
@endforeach
</ul>
@endsection
@@ -35,8 +35,8 @@
<tr>
@foreach ($row as $col => $value)
<td>
@if ($col == 'user')
<a href="{{ $value->urlEdit() }}">{{ $value->getFullName() }}</a>
@if ($col == 'causer')
<a href="{{ $value->url() }}">{{ $value->getFullName(true) }}</a>
@else
{{ $value }}
@endif

View File

@@ -0,0 +1,85 @@
@extends('layouts.app')
@section('title', __('System'))
@section('sidebar')
@include('partials/sidebar_menu_toggle')
<div class="dropdown sidebar-title">
<span class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" v-pre>
{{ __('System') }}
</span>
</div>
<ul class="sidebar-menu">
<li><a href="#jobs"><i class="glyphicon glyphicon-time"></i> {{ __('Jobs') }}</a></li>
</ul>
@endsection
@section('content')
<div class="container">
<h3 id="jobs">{{ __('Jobs') }}</h3>
<table class="table table-dark-header table-bordered table-responsive">
<tbody>
<tr>
<th>{{ __('Queued Jobs') }}</th>
<td class="table-main-col">
<p>
{{ __('Total') }}: <strong>{{ count($queued_jobs)}}</strong>
</p>
@foreach ($queued_jobs as $job)
<table class="table">
<tbody>
<tr>
<th colspan="2">{{ $loop->index+1 }}. {{ json_decode($job->payload, true)['displayName'] }}</th>
</tr>
<tr>
<td>{{ __('Queue') }}</td>
<td>{{ $job->queue }}</td>
</tr>
<tr>
<td>{{ __('Attempts') }}</td>
<td>
@if ($job->attempts > 0)<strong class="text-danger">@endif
{{ $job->attempts }}
@if ($job->attempts > 0)</strong>@endif
</td>
</tr>
<tr>
<td>{{ __('Created At') }}</td>
<td>{{ App\User::dateFormat($job->created_at) }}</td>
</tr>
</tbody>
</table>
@endforeach
</td>
</tr>
<tr>
<th>{{ __('Failed Jobs') }}</th>
<td>
<p>
{{ __('Total') }}: @if (count($failed_jobs) > 0)<strong class="text-danger">@endif{{ count($failed_jobs) }}</strong>
</p>
@foreach ($failed_jobs as $job)
<table class="table">
<tbody>
<tr>
<th colspan="2">{{ $loop->index+1 }}. {{ json_decode($job->payload, true)['displayName'] }}</th>
</tr>
<tr>
<td>{{ __('Queue') }}</td>
<td>{{ $job->queue }}</td>
</tr>
<tr>
<td>{{ __('Failed At') }}</td>
<td>{{ App\User::dateFormat($job->failed_at) }}</td>
</tr>
</tbody>
</table>
@endforeach
</td>
</tr>
</tbody>
</table>
</div>
@endsection

View File

@@ -19,7 +19,8 @@ Auth::routes();
// General routes for logged in users
Route::get('/', 'SecureController@dashboard')->name('dashboard');
Route::get('/logs/{name?}', 'SecureController@logs')->name('logs');
Route::get('/logs/{name?}', ['uses' => 'SecureController@logs', 'middleware' => ['auth', 'roles'], 'roles' => ['admin']])->name('logs');
Route::get('/system', ['uses' => 'SecureController@system', 'middleware' => ['auth', 'roles'], 'roles' => ['admin']])->name('system');
// Users
Route::get('/users', 'UsersController@users')->name('users');

View File

@@ -7,13 +7,18 @@ $baseDir = dirname($vendorDir);
return array(
'App\\ActivityLog' => $baseDir . '/app/ActivityLog.php',
'App\\Console\\Commands\\Build' => $baseDir . '/app/Console/Commands/Build.php',
'App\\Console\\Commands\\CreateUser' => $baseDir . '/app/Console/Commands/CreateUser.php',
'App\\Console\\Commands\\GenerateVarsJs' => $baseDir . '/app/Console/Commands/GenerateVarsJs.php',
'App\\Console\\Kernel' => $baseDir . '/app/Console/Kernel.php',
'App\\Conversation' => $baseDir . '/app/Conversation.php',
'App\\Customer' => $baseDir . '/app/Customer.php',
'App\\Email' => $baseDir . '/app/Email.php',
'App\\Events\\Event' => $baseDir . '/app/Events/Event.php',
'App\\Events\\ConversationCreated' => $baseDir . '/app/Events/ConversationCreated.php',
'App\\Events\\ConversationStatusChanged' => $baseDir . '/app/Events/ConversationStatusChanged.php',
'App\\Events\\ConversationUserChanged' => $baseDir . '/app/Events/ConversationUserChanged.php',
'App\\Exceptions\\Handler' => $baseDir . '/app/Exceptions/Handler.php',
'App\\FailedJob' => $baseDir . '/app/FailedJob.php',
'App\\Folder' => $baseDir . '/app/Folder.php',
'App\\Http\\Controllers\\Auth\\ForgotPasswordController' => $baseDir . '/app/Http/Controllers/Auth/ForgotPasswordController.php',
'App\\Http\\Controllers\\Auth\\LoginController' => $baseDir . '/app/Http/Controllers/Auth/LoginController.php',
@@ -26,17 +31,24 @@ return array(
'App\\Http\\Controllers\\SecureController' => $baseDir . '/app/Http/Controllers/SecureController.php',
'App\\Http\\Controllers\\UsersController' => $baseDir . '/app/Http/Controllers/UsersController.php',
'App\\Http\\Kernel' => $baseDir . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\CheckRole' => $baseDir . '/app/Http/Middleware/CheckRole.php',
'App\\Http\\Middleware\\EncryptCookies' => $baseDir . '/app/Http/Middleware/EncryptCookies.php',
'App\\Http\\Middleware\\RedirectIfAuthenticated' => $baseDir . '/app/Http/Middleware/RedirectIfAuthenticated.php',
'App\\Http\\Middleware\\TrimStrings' => $baseDir . '/app/Http/Middleware/TrimStrings.php',
'App\\Http\\Middleware\\TrustProxies' => $baseDir . '/app/Http/Middleware/TrustProxies.php',
'App\\Http\\Middleware\\VerifyCsrfToken' => $baseDir . '/app/Http/Middleware/VerifyCsrfToken.php',
'App\\Job' => $baseDir . '/app/Job.php',
'App\\Jobs\\SendReplyToCustomer' => $baseDir . '/app/Jobs/SendReplyToCustomer.php',
'App\\Listeners\\LogFailedLogin' => $baseDir . '/app/Listeners/LogFailedLogin.php',
'App\\Listeners\\LogLockout' => $baseDir . '/app/Listeners/LogLockout.php',
'App\\Listeners\\LogPasswordReset' => $baseDir . '/app/Listeners/LogPasswordReset.php',
'App\\Listeners\\LogRegisteredUser' => $baseDir . '/app/Listeners/LogRegisteredUser.php',
'App\\Listeners\\LogSuccessfulLogin' => $baseDir . '/app/Listeners/LogSuccessfulLogin.php',
'App\\Listeners\\LogSuccessfulLogout' => $baseDir . '/app/Listeners/LogSuccessfulLogout.php',
'App\\Listeners\\SendReplyToCustomer' => $baseDir . '/app/Listeners/SendReplyToCustomer.php',
'App\\Listeners\\UpdateMailboxCounters' => $baseDir . '/app/Listeners/UpdateMailboxCounters.php',
'App\\Mail\\Mail' => $baseDir . '/app/Mail/Mail.php',
'App\\Mail\\ReplyToCustomer' => $baseDir . '/app/Mail/ReplyToCustomer.php',
'App\\Mailbox' => $baseDir . '/app/Mailbox.php',
'App\\MailboxUser' => $baseDir . '/app/MailboxUser.php',
'App\\Observers\\ConversationObserver' => $baseDir . '/app/Observers/ConversationObserver.php',
@@ -1069,6 +1081,8 @@ return array(
'Hamcrest\\Type\\IsString' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsString.php',
'Hamcrest\\Util' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php',
'Hamcrest\\Xml\\HasXPath' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php',
'Html2Text\\Html2Text' => $vendorDir . '/soundasleep/html2text/src/Html2Text.php',
'Html2Text\\Html2TextException' => $vendorDir . '/soundasleep/html2text/src/Html2TextException.php',
'Illuminate\\Auth\\Access\\AuthorizationException' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php',
'Illuminate\\Auth\\Access\\Gate' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
'Illuminate\\Auth\\Access\\HandlesAuthorization' => $vendorDir . '/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php',
@@ -3495,6 +3509,7 @@ return array(
'Symfony\\Component\\HttpKernel\\HttpCache\\Ssi' => $vendorDir . '/symfony/http-kernel/HttpCache/Ssi.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\Store' => $vendorDir . '/symfony/http-kernel/HttpCache/Store.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/StoreInterface.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler' => $vendorDir . '/symfony/http-kernel/HttpCache/SubRequestHandler.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\SurrogateInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/SurrogateInterface.php',
'Symfony\\Component\\HttpKernel\\HttpKernel' => $vendorDir . '/symfony/http-kernel/HttpKernel.php',
'Symfony\\Component\\HttpKernel\\HttpKernelInterface' => $vendorDir . '/symfony/http-kernel/HttpKernelInterface.php',

View File

@@ -42,6 +42,7 @@ return array(
'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
'Laravel\\Tinker\\' => array($vendorDir . '/laravel/tinker/src'),
'Illuminate\\' => array($vendorDir . '/laravel/framework/src/Illuminate'),
'Html2Text\\' => array($vendorDir . '/soundasleep/html2text/src'),
'Fideloper\\Proxy\\' => array($vendorDir . '/fideloper/proxy/src'),
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/EmailValidator'),

View File

@@ -94,6 +94,10 @@ class ComposerStaticInit992853026b5d9a5aba1df559a69505cb
array (
'Illuminate\\' => 11,
),
'H' =>
array (
'Html2Text\\' => 10,
),
'F' =>
array (
'Fideloper\\Proxy\\' => 16,
@@ -275,6 +279,10 @@ class ComposerStaticInit992853026b5d9a5aba1df559a69505cb
array (
0 => __DIR__ . '/..' . '/laravel/framework/src/Illuminate',
),
'Html2Text\\' =>
array (
0 => __DIR__ . '/..' . '/soundasleep/html2text/src',
),
'Fideloper\\Proxy\\' =>
array (
0 => __DIR__ . '/..' . '/fideloper/proxy/src',
@@ -385,13 +393,18 @@ class ComposerStaticInit992853026b5d9a5aba1df559a69505cb
public static $classMap = array (
'App\\ActivityLog' => __DIR__ . '/../..' . '/app/ActivityLog.php',
'App\\Console\\Commands\\Build' => __DIR__ . '/../..' . '/app/Console/Commands/Build.php',
'App\\Console\\Commands\\CreateUser' => __DIR__ . '/../..' . '/app/Console/Commands/CreateUser.php',
'App\\Console\\Commands\\GenerateVarsJs' => __DIR__ . '/../..' . '/app/Console/Commands/GenerateVarsJs.php',
'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
'App\\Conversation' => __DIR__ . '/../..' . '/app/Conversation.php',
'App\\Customer' => __DIR__ . '/../..' . '/app/Customer.php',
'App\\Email' => __DIR__ . '/../..' . '/app/Email.php',
'App\\Events\\Event' => __DIR__ . '/../..' . '/app/Events/Event.php',
'App\\Events\\ConversationCreated' => __DIR__ . '/../..' . '/app/Events/ConversationCreated.php',
'App\\Events\\ConversationStatusChanged' => __DIR__ . '/../..' . '/app/Events/ConversationStatusChanged.php',
'App\\Events\\ConversationUserChanged' => __DIR__ . '/../..' . '/app/Events/ConversationUserChanged.php',
'App\\Exceptions\\Handler' => __DIR__ . '/../..' . '/app/Exceptions/Handler.php',
'App\\FailedJob' => __DIR__ . '/../..' . '/app/FailedJob.php',
'App\\Folder' => __DIR__ . '/../..' . '/app/Folder.php',
'App\\Http\\Controllers\\Auth\\ForgotPasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/ForgotPasswordController.php',
'App\\Http\\Controllers\\Auth\\LoginController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/LoginController.php',
@@ -404,17 +417,24 @@ class ComposerStaticInit992853026b5d9a5aba1df559a69505cb
'App\\Http\\Controllers\\SecureController' => __DIR__ . '/../..' . '/app/Http/Controllers/SecureController.php',
'App\\Http\\Controllers\\UsersController' => __DIR__ . '/../..' . '/app/Http/Controllers/UsersController.php',
'App\\Http\\Kernel' => __DIR__ . '/../..' . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\CheckRole' => __DIR__ . '/../..' . '/app/Http/Middleware/CheckRole.php',
'App\\Http\\Middleware\\EncryptCookies' => __DIR__ . '/../..' . '/app/Http/Middleware/EncryptCookies.php',
'App\\Http\\Middleware\\RedirectIfAuthenticated' => __DIR__ . '/../..' . '/app/Http/Middleware/RedirectIfAuthenticated.php',
'App\\Http\\Middleware\\TrimStrings' => __DIR__ . '/../..' . '/app/Http/Middleware/TrimStrings.php',
'App\\Http\\Middleware\\TrustProxies' => __DIR__ . '/../..' . '/app/Http/Middleware/TrustProxies.php',
'App\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyCsrfToken.php',
'App\\Job' => __DIR__ . '/../..' . '/app/Job.php',
'App\\Jobs\\SendReplyToCustomer' => __DIR__ . '/../..' . '/app/Jobs/SendReplyToCustomer.php',
'App\\Listeners\\LogFailedLogin' => __DIR__ . '/../..' . '/app/Listeners/LogFailedLogin.php',
'App\\Listeners\\LogLockout' => __DIR__ . '/../..' . '/app/Listeners/LogLockout.php',
'App\\Listeners\\LogPasswordReset' => __DIR__ . '/../..' . '/app/Listeners/LogPasswordReset.php',
'App\\Listeners\\LogRegisteredUser' => __DIR__ . '/../..' . '/app/Listeners/LogRegisteredUser.php',
'App\\Listeners\\LogSuccessfulLogin' => __DIR__ . '/../..' . '/app/Listeners/LogSuccessfulLogin.php',
'App\\Listeners\\LogSuccessfulLogout' => __DIR__ . '/../..' . '/app/Listeners/LogSuccessfulLogout.php',
'App\\Listeners\\SendReplyToCustomer' => __DIR__ . '/../..' . '/app/Listeners/SendReplyToCustomer.php',
'App\\Listeners\\UpdateMailboxCounters' => __DIR__ . '/../..' . '/app/Listeners/UpdateMailboxCounters.php',
'App\\Mail\\Mail' => __DIR__ . '/../..' . '/app/Mail/Mail.php',
'App\\Mail\\ReplyToCustomer' => __DIR__ . '/../..' . '/app/Mail/ReplyToCustomer.php',
'App\\Mailbox' => __DIR__ . '/../..' . '/app/Mailbox.php',
'App\\MailboxUser' => __DIR__ . '/../..' . '/app/MailboxUser.php',
'App\\Observers\\ConversationObserver' => __DIR__ . '/../..' . '/app/Observers/ConversationObserver.php',
@@ -1447,6 +1467,8 @@ class ComposerStaticInit992853026b5d9a5aba1df559a69505cb
'Hamcrest\\Type\\IsString' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsString.php',
'Hamcrest\\Util' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php',
'Hamcrest\\Xml\\HasXPath' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php',
'Html2Text\\Html2Text' => __DIR__ . '/..' . '/soundasleep/html2text/src/Html2Text.php',
'Html2Text\\Html2TextException' => __DIR__ . '/..' . '/soundasleep/html2text/src/Html2TextException.php',
'Illuminate\\Auth\\Access\\AuthorizationException' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php',
'Illuminate\\Auth\\Access\\Gate' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/Gate.php',
'Illuminate\\Auth\\Access\\HandlesAuthorization' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php',
@@ -3873,6 +3895,7 @@ class ComposerStaticInit992853026b5d9a5aba1df559a69505cb
'Symfony\\Component\\HttpKernel\\HttpCache\\Ssi' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/Ssi.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\Store' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/Store.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\StoreInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/StoreInterface.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/SubRequestHandler.php',
'Symfony\\Component\\HttpKernel\\HttpCache\\SurrogateInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/SurrogateInterface.php',
'Symfony\\Component\\HttpKernel\\HttpKernel' => __DIR__ . '/..' . '/symfony/http-kernel/HttpKernel.php',
'Symfony\\Component\\HttpKernel\\HttpKernelInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpKernelInterface.php',

View File

@@ -3502,6 +3502,58 @@
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version"
},
{
"name": "soundasleep/html2text",
"version": "0.5.0",
"version_normalized": "0.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/soundasleep/html2text.git",
"reference": "cdb89f6ffa2c4cc78f8ed9ea6ee0594a9133ccad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/soundasleep/html2text/zipball/cdb89f6ffa2c4cc78f8ed9ea6ee0594a9133ccad",
"reference": "cdb89f6ffa2c4cc78f8ed9ea6ee0594a9133ccad",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": ">=4.0",
"soundasleep/component-tests": "dev-master"
},
"time": "2017-04-19T22:01:50+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Html2Text\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"EPL-1.0"
],
"authors": [
{
"name": "Jevon Wright",
"homepage": "https://jevon.org",
"role": "Developer"
}
],
"description": "A PHP script to convert HTML into a plain text format",
"homepage": "https://github.com/soundasleep/html2text",
"keywords": [
"email",
"html",
"php",
"text"
]
},
{
"name": "spatie/laravel-activitylog",
"version": "2.7.0",
@@ -3692,17 +3744,17 @@
},
{
"name": "symfony/console",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "e54f84c50e3b12972e7750edfc5ca84b2284c44e"
"reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/e54f84c50e3b12972e7750edfc5ca84b2284c44e",
"reference": "e54f84c50e3b12972e7750edfc5ca84b2284c44e",
"url": "https://api.github.com/repos/symfony/console/zipball/6b217594552b9323bcdcfc14f8a0ce126e84cd73",
"reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73",
"shasum": ""
},
"require": {
@@ -3728,7 +3780,7 @@
"symfony/lock": "",
"symfony/process": ""
},
"time": "2018-07-10T14:02:11+00:00",
"time": "2018-07-26T11:19:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -3763,23 +3815,23 @@
},
{
"name": "symfony/css-selector",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "d2ce52290b648ae33b5301d09bc14ee378612914"
"reference": "edda5a6155000ff8c3a3f85ee5c421af93cca416"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/d2ce52290b648ae33b5301d09bc14ee378612914",
"reference": "d2ce52290b648ae33b5301d09bc14ee378612914",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/edda5a6155000ff8c3a3f85ee5c421af93cca416",
"reference": "edda5a6155000ff8c3a3f85ee5c421af93cca416",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"time": "2018-05-16T12:49:49+00:00",
"time": "2018-07-26T09:06:28+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -3818,17 +3870,17 @@
},
{
"name": "symfony/debug",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "0e3ca9cbde90fffec8038f4d4e16fd4046bbd018"
"reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/0e3ca9cbde90fffec8038f4d4e16fd4046bbd018",
"reference": "0e3ca9cbde90fffec8038f4d4e16fd4046bbd018",
"url": "https://api.github.com/repos/symfony/debug/zipball/d5a058ff6ecad26b30c1ba452241306ea34c65cc",
"reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc",
"shasum": ""
},
"require": {
@@ -3841,7 +3893,7 @@
"require-dev": {
"symfony/http-kernel": "~2.8|~3.0|~4.0"
},
"time": "2018-06-26T08:45:54+00:00",
"time": "2018-07-26T11:19:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -3876,17 +3928,17 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8"
"reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8",
"reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb",
"reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb",
"shasum": ""
},
"require": {
@@ -3906,7 +3958,7 @@
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
},
"time": "2018-04-06T07:35:25+00:00",
"time": "2018-07-26T09:06:28+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -3941,23 +3993,23 @@
},
{
"name": "symfony/finder",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394"
"reference": "8a84fcb207451df0013b2c74cbbf1b62d47b999a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394",
"reference": "3a8c3de91d2b2c68cd2d665cf9d00f7ef9eaa394",
"url": "https://api.github.com/repos/symfony/finder/zipball/8a84fcb207451df0013b2c74cbbf1b62d47b999a",
"reference": "8a84fcb207451df0013b2c74cbbf1b62d47b999a",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"time": "2018-06-19T20:52:10+00:00",
"time": "2018-07-26T11:19:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -3992,17 +4044,17 @@
},
{
"name": "symfony/http-foundation",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "2b8e08c085e2dc7449ee6d55a238be87d3727c96"
"reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/2b8e08c085e2dc7449ee6d55a238be87d3727c96",
"reference": "2b8e08c085e2dc7449ee6d55a238be87d3727c96",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6",
"reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6",
"shasum": ""
},
"require": {
@@ -4013,7 +4065,7 @@
"require-dev": {
"symfony/expression-language": "~2.8|~3.0|~4.0"
},
"time": "2018-07-19T07:08:28+00:00",
"time": "2018-08-01T14:04:26+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -4048,17 +4100,17 @@
},
{
"name": "symfony/http-kernel",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "22a1d000d45f09966a363223548a150aec759e61"
"reference": "8e84cc498f0ffecfbabdea78b87828fd66189544"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/22a1d000d45f09966a363223548a150aec759e61",
"reference": "22a1d000d45f09966a363223548a150aec759e61",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/8e84cc498f0ffecfbabdea78b87828fd66189544",
"reference": "8e84cc498f0ffecfbabdea78b87828fd66189544",
"shasum": ""
},
"require": {
@@ -4071,7 +4123,7 @@
},
"conflict": {
"symfony/config": "<2.8",
"symfony/dependency-injection": "<3.4.5|<4.0.5,>=4",
"symfony/dependency-injection": "<3.4.10|<4.0.10,>=4",
"symfony/var-dumper": "<3.3",
"twig/twig": "<1.34|<2.4,>=2"
},
@@ -4085,7 +4137,7 @@
"symfony/config": "~2.8|~3.0|~4.0",
"symfony/console": "~2.8|~3.0|~4.0",
"symfony/css-selector": "~2.8|~3.0|~4.0",
"symfony/dependency-injection": "^3.4.5|^4.0.5",
"symfony/dependency-injection": "^3.4.10|^4.0.10",
"symfony/dom-crawler": "~2.8|~3.0|~4.0",
"symfony/expression-language": "~2.8|~3.0|~4.0",
"symfony/finder": "~2.8|~3.0|~4.0",
@@ -4104,7 +4156,7 @@
"symfony/finder": "",
"symfony/var-dumper": ""
},
"time": "2018-07-23T16:37:31+00:00",
"time": "2018-08-01T14:47:47+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -4318,23 +4370,23 @@
},
{
"name": "symfony/process",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "f741672edfcfe3a2ea77569d419006f23281d909"
"reference": "0414db29bd770ec5a4152683e655f55efd4fa60f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/f741672edfcfe3a2ea77569d419006f23281d909",
"reference": "f741672edfcfe3a2ea77569d419006f23281d909",
"url": "https://api.github.com/repos/symfony/process/zipball/0414db29bd770ec5a4152683e655f55efd4fa60f",
"reference": "0414db29bd770ec5a4152683e655f55efd4fa60f",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"time": "2018-07-09T09:01:07+00:00",
"time": "2018-07-26T11:19:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -4369,17 +4421,17 @@
},
{
"name": "symfony/routing",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "6b9fef5343828e542db17e2519722ef08992f2c1"
"reference": "e20f4bb79502c3c0db86d572f7683a30d4143911"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/6b9fef5343828e542db17e2519722ef08992f2c1",
"reference": "6b9fef5343828e542db17e2519722ef08992f2c1",
"url": "https://api.github.com/repos/symfony/routing/zipball/e20f4bb79502c3c0db86d572f7683a30d4143911",
"reference": "e20f4bb79502c3c0db86d572f7683a30d4143911",
"shasum": ""
},
"require": {
@@ -4407,7 +4459,7 @@
"symfony/http-foundation": "For using a Symfony Request object",
"symfony/yaml": "For using the YAML loader"
},
"time": "2018-06-19T20:52:10+00:00",
"time": "2018-07-26T11:19:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -4448,17 +4500,17 @@
},
{
"name": "symfony/translation",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "0d1c0965c3e82250b9786909cf584fd4a50c9c5b"
"reference": "9749930bfc825139aadd2d28461ddbaed6577862"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/0d1c0965c3e82250b9786909cf584fd4a50c9c5b",
"reference": "0d1c0965c3e82250b9786909cf584fd4a50c9c5b",
"url": "https://api.github.com/repos/symfony/translation/zipball/9749930bfc825139aadd2d28461ddbaed6577862",
"reference": "9749930bfc825139aadd2d28461ddbaed6577862",
"shasum": ""
},
"require": {
@@ -4483,7 +4535,7 @@
"symfony/config": "",
"symfony/yaml": ""
},
"time": "2018-07-23T08:18:36+00:00",
"time": "2018-07-26T11:19:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -4518,17 +4570,17 @@
},
{
"name": "symfony/var-dumper",
"version": "v3.4.13",
"version_normalized": "3.4.13.0",
"version": "v3.4.14",
"version_normalized": "3.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "c501f46bb1eaf4c8d65ba070ab65a1986da1cd7f"
"reference": "f62a394bd3de96f2f5e8f4c7d685035897fb3cb3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/c501f46bb1eaf4c8d65ba070ab65a1986da1cd7f",
"reference": "c501f46bb1eaf4c8d65ba070ab65a1986da1cd7f",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/f62a394bd3de96f2f5e8f4c7d685035897fb3cb3",
"reference": "f62a394bd3de96f2f5e8f4c7d685035897fb3cb3",
"shasum": ""
},
"require": {
@@ -4547,7 +4599,7 @@
"ext-intl": "To show region name in time zone dump",
"ext-symfony_debug": ""
},
"time": "2018-07-09T08:21:26+00:00",
"time": "2018-07-26T11:19:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -4728,17 +4780,17 @@
},
{
"name": "vlucas/phpdotenv",
"version": "v2.5.0",
"version_normalized": "2.5.0.0",
"version": "v2.5.1",
"version_normalized": "2.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "6ae3e2e6494bb5e58c2decadafc3de7f1453f70a"
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/6ae3e2e6494bb5e58c2decadafc3de7f1453f70a",
"reference": "6ae3e2e6494bb5e58c2decadafc3de7f1453f70a",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e",
"shasum": ""
},
"require": {
@@ -4747,7 +4799,7 @@
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.0"
},
"time": "2018-07-01T10:25:50+00:00",
"time": "2018-07-29T20:33:41+00:00",
"type": "library",
"extra": {
"branch-alias": {

View File

@@ -0,0 +1,19 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
[spec/examples/*]
indent_style = tabs
trim_trailing_whitespace = false
insert_final_newline = false

View File

@@ -0,0 +1,4 @@
tests/*.output
*.sublime-project
*.sublime-workspace
vendor/

View File

@@ -0,0 +1,10 @@
language: php
php:
- 5.5
group: stable
before_install:
- composer self-update
install:
- composer install
script:
- ./vendor/bin/phpunit

203
vendor/soundasleep/html2text/LICENSE.md vendored Normal file
View File

@@ -0,0 +1,203 @@
Eclipse Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates'
from a Contributor if it was added to the Program by such Contributor
itself or anyone acting on such Contributor's behalf. Contributions do not
include additions to the Program which: (i) are separate modules of
software distributed in conjunction with the Program under their own
license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license to
reproduce, prepare derivative works of, publicly display, publicly
perform, distribute and sublicense the Contribution of such Contributor,
if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under
Licensed Patents to make, use, sell, offer to sell, import and otherwise
transfer the Contribution of such Contributor, if any, in source code and
object code form. This patent license shall apply to the combination of
the Contribution and the Program if, at the time the Contribution is
added by the Contributor, such addition of the Contribution causes such
combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Contribution.
No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses
to its Contributions set forth herein, no assurances are provided by any
Contributor that the Program does not infringe the patent or other
intellectual property rights of any other entity. Each Contributor
disclaims any liability to Recipient for claims brought by any other
entity based on infringement of intellectual property rights or
otherwise. As a condition to exercising the rights and licenses granted
hereunder, each Recipient hereby assumes sole responsibility to secure
any other intellectual property rights needed, if any. For example, if a
third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient
copyright rights in its Contribution, if any, to grant the copyright
license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under
its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties
and conditions, express and implied, including warranties or
conditions of title and non-infringement, and implied warranties or
conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for
damages, including direct, indirect, special, incidental and
consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are
offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such
Contributor, and informs licensees how to obtain it in a reasonable
manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained
within the Program.
Each Contributor must identify itself as the originator of its Contribution,
if
any, in a manner that reasonably allows subsequent Recipients to identify the
originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with
respect to end users, business partners and the like. While this license is
intended to facilitate the commercial use of the Program, the Contributor who
includes the Program in a commercial product offering should do so in a manner
which does not create potential liability for other Contributors. Therefore,
if a Contributor includes the Program in a commercial product offering, such
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
every other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits and
other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such Commercial
Contributor in connection with its distribution of the Program in a commercial
product offering. The obligations in this section do not apply to any claims
or Losses relating to any actual or alleged intellectual property
infringement. In order to qualify, an Indemnified Contributor must:
a) promptly notify the Commercial Contributor in writing of such claim, and
b) allow the Commercial Contributor to control, and cooperate with the
Commercial Contributor in, the defense and any related settlement
negotiations. The Indemnified Contributor may participate in any such claim at
its own expense.
For example, a Contributor might include the Program in a commercial product
offering, Product X. That Contributor is then a Commercial Contributor. If
that Commercial Contributor then makes performance claims, or offers
warranties related to Product X, those performance claims and warranties are
such Commercial Contributor's responsibility alone. Under this section, the
Commercial Contributor would have to defend claims against the other
Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
Recipient is solely responsible for determining the appropriateness of using
and distributing the Program and assumes all risks associated with its
exercise of rights under this Agreement , including but not limited to the
risks and costs of program errors, compliance with applicable laws, damage to
or loss of data, programs or equipment, and unavailability or interruption of
operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of the
remainder of the terms of this Agreement, and without further action by the
parties hereto, such provision shall be reformed to the minimum extent
necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
(excluding combinations of the Program with other software or hardware)
infringes such Recipient's patent(s), then such Recipient's rights granted
under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and does
not cure such failure in a reasonable period of time after becoming aware of
such noncompliance. If all Recipient's rights under this Agreement terminate,
Recipient agrees to cease use and distribution of the Program as soon as
reasonably practicable. However, Recipient's obligations under this Agreement
and any licenses granted by Recipient relating to the Program shall continue
and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in
order to avoid inconsistency the Agreement is copyrighted and may only be
modified in the following manner. The Agreement Steward reserves the right to
publish new versions (including revisions) of this Agreement from time to
time. No one other than the Agreement Steward has the right to modify this
Agreement. The Eclipse Foundation is the initial Agreement Steward. The
Eclipse Foundation may assign the responsibility to serve as the Agreement
Steward to a suitable separate entity. Each new version of the Agreement will
be given a distinguishing version number. The Program (including
Contributions) may always be distributed subject to the version of the
Agreement under which it was received. In addition, after a new version of the
Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly
stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
licenses to the intellectual property of any Contributor under this Agreement,
whether expressly, by implication, estoppel or otherwise. All rights in the
Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the
intellectual property laws of the United States of America. No party to this
Agreement will bring a legal action under this Agreement more than one year
after the cause of action arose. Each party waives its rights to a jury trial in
any resulting litigation.

75
vendor/soundasleep/html2text/README.md vendored Normal file
View File

@@ -0,0 +1,75 @@
html2text [![Build Status](https://travis-ci.org/soundasleep/html2text.svg?branch=master)](https://travis-ci.org/soundasleep/html2text) [![Total Downloads](https://poser.pugx.org/soundasleep/html2text/downloads.png)](https://packagist.org/packages/soundasleep/html2text)
=========
html2text is a very simple script that uses PHP's DOM methods to load from HTML, and then iterates over the resulting DOM to correctly output plain text. For example:
```html
<html>
<title>Ignored Title</title>
<body>
<h1>Hello, World!</h1>
<p>This is some e-mail content.
Even though it has whitespace and newlines, the e-mail converter
will handle it correctly.
<p>Even mismatched tags.</p>
<div>A div</div>
<div>Another div</div>
<div>A div<div>within a div</div></div>
<a href="http://foo.com">A link</a>
</body>
</html>
```
Will be converted into:
```text
Hello, World!
This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.
Even mismatched tags.
A div
Another div
A div
within a div
[A link](http://foo.com)
```
See the [original blog post](http://journals.jevon.org/users/jevon-phd/entry/19818) or the related [StackOverflow answer](http://stackoverflow.com/a/2564472/39531).
## Installing
You can use [Composer](http://getcomposer.org/) to add the [package](https://packagist.org/packages/soundasleep/html2text) to your project:
```json
{
"require": {
"soundasleep/html2text": "~0.5"
}
}
```
And then use it quite simply:
```php
$text = Html2Text\Html2Text::convert($html);
```
You can also include the supplied `html2text.php` and use `$text = convert_html_to_text($html);` instead.
## Tests
Some very basic tests are provided in the `tests/` directory. Run them with `composer install --dev && vendor/bin/phpunit`.
## License
`html2text` is dual licensed under both [EPL v1.0](https://www.eclipse.org/legal/epl-v10.html) and [LGPL v3.0](http://www.gnu.org/licenses/lgpl.html), making it suitable for both Eclipse and GPL projects.
## Other versions
Also see [html2text_ruby](https://github.com/soundasleep/html2text_ruby), a Ruby implementation.

View File

@@ -0,0 +1,32 @@
{
"name": "soundasleep/html2text",
"description": "A PHP script to convert HTML into a plain text format",
"type": "library",
"keywords": [ "php", "html", "text", "email" ],
"homepage": "https://github.com/soundasleep/html2text",
"license": "EPL-1.0",
"authors": [
{
"name": "Jevon Wright",
"homepage": "https://jevon.org",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Html2Text\\": "src"
}
},
"support": {
"email": "support@jevon.org"
},
"require": {
"php": ">=5.3.2",
"ext-dom": "*",
"ext-libxml": "*"
},
"require-dev": {
"phpunit/phpunit": ">=4.0",
"soundasleep/component-tests": "dev-master"
}
}

View File

@@ -0,0 +1,38 @@
<?php
/******************************************************************************
* Copyright (c) 2010 Jevon Wright and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* or
*
* LGPL which is available at http://www.gnu.org/licenses/lgpl.html
*
*
* Contributors:
* Jevon Wright - initial API and implementation
****************************************************************************/
/**
* This file allows you to convert through the command line.
* Usage:
* php -f convert.php [input file]
*/
if (count($argv) < 2) {
throw new \InvalidArgumentException("Expected: php -f convert.php [input file]");
}
if (!file_exists($argv[1])) {
throw new \InvalidArgumentException("'" . $argv[1] . "' does not exist");
}
$input = file_get_contents($argv[1]);
require_once(__DIR__ . "/src/Html2Text.php");
require_once(__DIR__ . "/src/Html2TextException.php");
echo Html2Text\Html2Text::convert($input);

View File

@@ -0,0 +1,32 @@
<?php
/******************************************************************************
* Copyright (c) 2010 Jevon Wright and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* or
*
* LGPL which is available at http://www.gnu.org/licenses/lgpl.html
*
*
* Contributors:
* Jevon Wright - initial API and implementation
****************************************************************************/
/**
* This file is available if you still want to use functions rather than
* autoloading classes.
*/
require_once(__DIR__ . "/src/Html2Text.php");
require_once(__DIR__ . "/src/Html2TextException.php");
function convert_html_to_text($html) {
return Html2Text\Html2Text::convert($html);
}
function fix_newlines($text) {
return Html2Text\Html2Text::fixNewlines($text);
}

View File

@@ -0,0 +1,8 @@
<phpunit stop-on-failure="true" stop-on-error="true">
<testsuites>
<testsuite name="Tests">
<!-- loads all *Test.php -->
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@@ -0,0 +1,394 @@
<?php
/******************************************************************************
* Copyright (c) 2010 Jevon Wright and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* or
*
* LGPL which is available at http://www.gnu.org/licenses/lgpl.html
*
*
* Contributors:
* Jevon Wright - initial API and implementation
****************************************************************************/
namespace Html2Text;
class Html2Text {
/**
* Tries to convert the given HTML into a plain text format - best suited for
* e-mail display, etc.
*
* <p>In particular, it tries to maintain the following features:
* <ul>
* <li>Links are maintained, with the 'href' copied over
* <li>Information in the &lt;head&gt; is lost
* </ul>
*
* @param string $html the input HTML
* @param boolean $ignore_error Ignore xml parsing errors
* @return string the HTML converted, as best as possible, to text
* @throws Html2TextException if the HTML could not be loaded as a {@link DOMDocument}
*/
public static function convert($html, $ignore_error = false) {
// replace &nbsp; with spaces
$html = str_replace("&nbsp;", " ", $html);
$html = str_replace("\xc2\xa0", " ", $html);
$is_office_document = static::isOfficeDocument($html);
if ($is_office_document) {
// remove office namespace
$html = str_replace(array("<o:p>", "</o:p>"), "", $html);
}
$html = static::fixNewlines($html);
if (mb_detect_encoding($html, "UTF-8", true)) {
$html = mb_convert_encoding($html, "HTML-ENTITIES", "UTF-8");
}
$doc = static::getDocument($html, $ignore_error);
$output = static::iterateOverNode($doc, null, false, $is_office_document);
// remove leading and trailing spaces on each line
$output = preg_replace("/[ \t]*\n[ \t]*/im", "\n", $output);
$output = preg_replace("/ *\t */im", "\t", $output);
// unarmor pre blocks
$output = str_replace("\r", "\n", $output);
// remove unnecessary empty lines
$output = preg_replace("/\n\n\n*/im", "\n\n", $output);
// remove leading and trailing whitespace
$output = trim($output);
return $output;
}
/**
* Unify newlines; in particular, \r\n becomes \n, and
* then \r becomes \n. This means that all newlines (Unix, Windows, Mac)
* all become \ns.
*
* @param string $text text with any number of \r, \r\n and \n combinations
* @return string the fixed text
*/
static function fixNewlines($text) {
// replace \r\n to \n
$text = str_replace("\r\n", "\n", $text);
// remove \rs
$text = str_replace("\r", "\n", $text);
return $text;
}
/**
* Parse HTML into a DOMDocument
*
* @param string $html the input HTML
* @param boolean $ignore_error Ignore xml parsing errors
* @return DOMDocument the parsed document tree
*/
static function getDocument($html, $ignore_error = false) {
$doc = new \DOMDocument();
$html = trim($html);
if (!$html) {
// DOMDocument doesn't support empty value and throws an error
// Return empty document instead
return $doc;
}
if ($html[0] !== '<') {
// If HTML does not begin with a tag, we put a body tag around it.
// If we do not do this, PHP will insert a paragraph tag around
// the first block of text for some reason which can mess up
// the newlines. See pre.html test for an example.
$html = '<body>' . $html . '</body>';
}
if ($ignore_error) {
$doc->strictErrorChecking = false;
$doc->recover = true;
$doc->xmlStandalone = true;
$old_internal_errors = libxml_use_internal_errors(true);
$load_result = $doc->loadHTML($html, LIBXML_NOWARNING | LIBXML_NOERROR | LIBXML_NONET);
libxml_use_internal_errors($old_internal_errors);
}
else {
$load_result = $doc->loadHTML($html);
}
if (!$load_result) {
throw new Html2TextException("Could not load HTML - badly formed?", $html);
}
return $doc;
}
/**
* Can we guess that this HTML is generated by Microsoft Office?
*/
static function isOfficeDocument($html) {
return strpos($html, "urn:schemas-microsoft-com:office") !== false;
}
static function isWhitespace($text) {
return strlen(trim($text, "\n\r\t ")) === 0;
}
static function nextChildName($node) {
// get the next child
$nextNode = $node->nextSibling;
while ($nextNode != null) {
if ($nextNode instanceof \DOMText) {
if (!static::isWhitespace($nextNode->wholeText)) {
break;
}
}
if ($nextNode instanceof \DOMElement) {
break;
}
$nextNode = $nextNode->nextSibling;
}
$nextName = null;
if (($nextNode instanceof \DOMElement || $nextNode instanceof \DOMText) && $nextNode != null) {
$nextName = strtolower($nextNode->nodeName);
}
return $nextName;
}
static function iterateOverNode($node, $prevName = null, $in_pre = false, $is_office_document = false) {
if ($node instanceof \DOMText) {
// Replace whitespace characters with a space (equivilant to \s)
if ($in_pre) {
$text = "\n" . trim($node->wholeText, "\n\r\t ") . "\n";
// Remove trailing whitespace only
$text = preg_replace("/[ \t]*\n/im", "\n", $text);
// armor newlines with \r.
return str_replace("\n", "\r", $text);
} else {
$text = preg_replace("/[\\t\\n\\f\\r ]+/im", " ", $node->wholeText);
if (!static::isWhitespace($text) && ($prevName == 'p' || $prevName == 'div')) {
return "\n" . $text;
}
return $text;
}
}
if ($node instanceof \DOMDocumentType) {
// ignore
return "";
}
if ($node instanceof \DOMProcessingInstruction) {
// ignore
return "";
}
$name = strtolower($node->nodeName);
$nextName = static::nextChildName($node);
// start whitespace
switch ($name) {
case "hr":
$prefix = '';
if ($prevName != null) {
$prefix = "\n";
}
return $prefix . "---------------------------------------------------------------\n";
case "style":
case "head":
case "title":
case "meta":
case "script":
// ignore these tags
return "";
case "h1":
case "h2":
case "h3":
case "h4":
case "h5":
case "h6":
case "ol":
case "ul":
// add two newlines, second line is added below
$output = "\n";
break;
case "td":
case "th":
// add tab char to separate table fields
$output = "\t";
break;
case "p":
// Microsoft exchange emails often include HTML which, when passed through
// html2text, results in lots of double line returns everywhere.
//
// To fix this, for any p element with a className of `MsoNormal` (the standard
// classname in any Microsoft export or outlook for a paragraph that behaves
// like a line return) we skip the first line returns and set the name to br.
if ($is_office_document && $node->getAttribute('class') == 'MsoNormal') {
$output = "";
$name = 'br';
break;
}
// add two lines
$output = "\n\n";
break;
case "pre":
case "tr":
case "div":
// add one line
$output = "\n";
break;
case "li":
$output = "- ";
break;
default:
// print out contents of unknown tags
$output = "";
break;
}
// debug
//$output .= "[$name,$nextName]";
if (isset($node->childNodes)) {
$n = $node->childNodes->item(0);
$previousSiblingName = null;
while($n != null) {
$text = static::iterateOverNode($n, $previousSiblingName, $in_pre || $name == 'pre', $is_office_document);
// Pass current node name to next child, as previousSibling does not appear to get populated
if ($n instanceof \DOMDocumentType
|| $n instanceof \DOMProcessingInstruction
|| ($n instanceof \DOMText && static::isWhitespace($text))) {
// Keep current previousSiblingName, these are invisible
}
else {
$previousSiblingName = strtolower($n->nodeName);
}
$node->removeChild($n);
$n = $node->childNodes->item(0);
// suppress last br tag inside a node list
if ($n != null || $previousSiblingName != 'br') {
$output .= $text;
}
}
}
// end whitespace
switch ($name) {
case "h1":
case "h2":
case "h3":
case "h4":
case "h5":
case "h6":
$output .= "\n";
break;
case "p":
// add two lines
$output .= "\n\n";
break;
case "pre":
case "br":
// add one line
$output .= "\n";
break;
case "div":
break;
case "a":
// links are returned in [text](link) format
$href = $node->getAttribute("href");
$output = trim($output);
// remove double [[ ]] s from linking images
if (substr($output, 0, 1) == "[" && substr($output, -1) == "]") {
$output = substr($output, 1, strlen($output) - 2);
// for linking images, the title of the <a> overrides the title of the <img>
if ($node->getAttribute("title")) {
$output = $node->getAttribute("title");
}
}
// if there is no link text, but a title attr
if (!$output && $node->getAttribute("title")) {
$output = $node->getAttribute("title");
}
if ($href == null) {
// it doesn't link anywhere
if ($node->getAttribute("name") != null) {
$output = "[$output]";
}
} else {
if ($href == $output || $href == "mailto:$output" || $href == "http://$output" || $href == "https://$output") {
// link to the same address: just use link
$output;
} else {
// replace it
if ($output) {
$output = "[$output]($href)";
} else {
// empty string
$output = $href;
}
}
}
// does the next node require additional whitespace?
switch ($nextName) {
case "h1": case "h2": case "h3": case "h4": case "h5": case "h6":
$output .= "\n";
break;
}
break;
case "img":
if ($node->getAttribute("title")) {
$output = "[" . $node->getAttribute("title") . "]";
} elseif ($node->getAttribute("alt")) {
$output = "[" . $node->getAttribute("alt") . "]";
} else {
$output = "";
}
break;
case "li":
$output .= "\n";
break;
default:
// do nothing
}
return $output;
}
}

View File

@@ -0,0 +1,28 @@
<?php
/******************************************************************************
* Copyright (c) 2010 Jevon Wright and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* or
*
* LGPL which is available at http://www.gnu.org/licenses/lgpl.html
*
*
* Contributors:
* Jevon Wright - initial API and implementation
****************************************************************************/
namespace Html2Text;
class Html2TextException extends \Exception {
var $more_info;
public function __construct($message = "", $more_info = "") {
parent::__construct($message);
$this->more_info = $more_info;
}
}

View File

@@ -0,0 +1,10 @@
# EditorConfig is awesome: http://EditorConfig.org
# don't add newlines to test files
[*]
insert_final_newline = false
trim_trailing_whitespace = false
[**.txt]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@@ -0,0 +1,9 @@
<?php
class Html2TextComponentTest extends \ComponentTests\ComponentTest {
function getRoots() {
return array(__DIR__ . "/..");
}
}

View File

@@ -0,0 +1,101 @@
<?php
class Html2TextTest extends PHPUnit_Framework_TestCase {
function doTest($test, $ignoreXmlError = false) {
$this->assertTrue(file_exists(__DIR__ . "/$test.html"), "File '$test.html' did not exist");
$this->assertTrue(file_exists(__DIR__ . "/$test.txt"), "File '$test.txt' did not exist");
$input = file_get_contents(__DIR__ . "/$test.html");
$expected = Html2Text\Html2Text::fixNewlines(file_get_contents(__DIR__ . "/$test.txt"));
$output = Html2Text\Html2Text::convert($input, $ignoreXmlError);
if ($output != $expected) {
file_put_contents(__DIR__ . "/$test.output", $output);
}
$this->assertEquals($output, $expected);
}
function testBasic() {
$this->doTest("basic");
}
function testAnchors() {
$this->doTest("anchors");
}
function testMoreAnchors() {
$this->doTest("more-anchors");
}
function test3() {
$this->doTest("test3");
}
function test4() {
$this->doTest("test4");
}
function testTable() {
$this->doTest("table");
}
function testNbsp() {
$this->doTest("nbsp");
}
function testLists() {
$this->doTest("lists");
}
function testPre() {
$this->doTest("pre");
}
function testFullEmail() {
$this->doTest("full_email");
}
function testImages() {
$this->doTest("images");
}
function testNonBreakingSpaces() {
$this->doTest("non-breaking-spaces");
}
function testUtf8Example() {
$this->doTest("utf8-example");
}
function testWindows1252Example() {
$this->doTest("windows-1252-example");
}
function testMsoffice() {
$this->doTest("msoffice");
}
function testDOMProcessing() {
$this->doTest("dom-processing");
}
function testEmpty() {
$this->doTest("empty");
}
function testHugeMsoffice() {
$this->doTest("huge-msoffice");
}
/**
* @expectedException PHPUnit_Framework_Error_Warning
*/
function testInvalidXML() {
$this->doTest("invalid", false);
}
function testInvalidXMLIgnore() {
$this->doTest("invalid", true);
}
}

View File

@@ -0,0 +1,12 @@
A document without any HTML open/closing tags.
<hr>
We try and use the representation given by common browsers of the
HTML document, so that it looks similar when converted to plain text.
<a href="http://foo.com">visit foo.com</a> - or <a href="http://www.foo.com">http://www.foo.com</a>
<a href="http://foo.com" title="a link with a title">link</a>
<h2><a name="anchor">An anchor which will not appear</a></h2>

View File

@@ -0,0 +1,5 @@
A document without any HTML open/closing tags.
---------------------------------------------------------------
We try and use the representation given by common browsers of the HTML document, so that it looks similar when converted to plain text. [visit foo.com](http://foo.com) - or http://www.foo.com [link](http://foo.com)
[An anchor which will not appear]

View File

@@ -0,0 +1,21 @@
<html>
<title>Ignored Title</title>
<body>
<h1>Hello, World!</h1>
<p>This is some e-mail content.
Even though it has whitespace and newlines, the e-mail converter
will handle it correctly.
<p>Even mismatched tags.</p>
<div>A div</div>
<div>Another div</div>
<div>A div<div>within a div</div></div>
<p>Another line<br />Yet another line</p>
<a href="http://foo.com">A link</a>
</body>
</html>

View File

@@ -0,0 +1,15 @@
Hello, World!
This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.
Even mismatched tags.
A div
Another div
A div
within a div
Another line
Yet another line
[A link](http://foo.com)

View File

@@ -0,0 +1,8 @@
<html>
<body>
<?a
I am a random piece of code
?>
Hello
</body>
</html>

View File

@@ -0,0 +1 @@
Hello

View File

View File

View File

@@ -0,0 +1,220 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=680">
</head>
<body class="cat-update-email cat-update" style="background: #ffccee; color: blue; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0; text-align: center" bgcolor="#ffccee">
<style type="text/css">
body.cat-update-email {
margin: 0; padding: 0; background: #ffccee; color: blue; text-align: center;
}
body.cat-update-email {
font-size: 12px; font-family: Times New Roman; font-weight: normal;
}
body.cat-update-email th {
font-size: 12px; font-family: Times New Roman; font-weight: normal;
}
body.cat-update-email td {
font-size: 12px; font-family: Times New Roman; font-weight: normal;
}
</style>
<table class="header-wrapper" style="border-spacing: 0; border: none; margin: 0; width: 100%">
<tr>
<td class="header" style="background: none; color: #999; font-family: Times New Roman; font-size: 12px; font-weight: normal; padding: 15px 0">
<table cellspacing="0" cellpadding="0" border="0" style="margin: 0 auto; padding: 0 20px; width: 640px">
<tr>
<th style="font-family: Times New Roman; font-size: 12px; font-weight: normal">
<a class="logo" href="http://localhost/home" style="color: red; text-decoration: none">
<img border="0" height="32" src="test.png" width="200" style="display: block">
</a> </th>
<td class="account-number" style="color: white; font-family: Times New Roman; font-size: 12px; font-weight: normal; text-align: right" align="right">
16 December 2015<br>
Account 123
</td>
</tr>
</table>
</td>
</tr>
</table>
<table class="section-wrapper" style="border-spacing: 0; border: none; margin: 0 auto 20px; width: 640px">
<tr>
<td class="salutation section" style="background: white; color: black; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0 auto 20px; padding: 40px 20px; text-align: left; width: 600px" align="left" bgcolor="white">
<h1 class="user_greeting" style="font-family: Times New Roman; font-size: 1.8; font-weight: normal; line-height: 1.2; margin: 0 0 1em">
Hi Susan
</h1>
<p class="message" style="font-size: 1.5em; line-height: 1.2; margin: 0">
Here is your cat report.
</p>
</td>
</tr>
</table>
<table class="section-wrapper" style="border-spacing: 0; border: none; margin: 0 auto 20px; width: 640px">
<tr>
<td class="balance section" style="background: white; color: black; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0 auto 20px; padding: 40px 20px; text-align: left; width: 600px" align="left" bgcolor="white">
<div class="account-status-heading" style="font-size: 2.5em; line-height: 1em; padding: 30px 20px; text-align: center" align="center">You have found <span class="status-cats-negative" style="color: #df0000">5 cats</span> less than anyone else</div>
<div id="cat-update-action-buttons">
<div id="buy-button" style="text-align: center" align="center">
<a class="btn-alert" href="http://localhost/cats" id="buy-cats-button" style="-moz-appearance: none; -webkit-appearance: none; background: #DF0000; border-radius: 3px; border: 11px solid #df0000; color: #fff; cursor: pointer; display: block; font-size: 16px; height: 16px; line-height: 16px; margin: 0 auto; text-decoration: none; transition: background-color .15s; width: 120px">Find more cats</a>
</div>
</div>
</td>
</tr>
</table>
<table class="section-wrapper" style="border-spacing: 0; border: none; margin: 0 auto 20px; width: 640px">
<tr>
<td class="cats section" id="cats" style="background: white; color: black; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0 auto 20px; padding: 40px 20px; text-align: left; width: 600px" align="left" bgcolor="white">
<div class="cats-usage">
<h2 style="font-family: Times New Roman; font-size: 1.8; font-weight: normal; line-height: 1.2; margin: 0">Down the road</h2>
<p class="fine-print" style="margin: 0">Across the hall</p>
<h3 style="font-family: Times New Roman; font-size: 18px; font-weight: normal; line-height: 2em; margin: 10px 0 0">Your achievements</h3>
<table class="current-usage with-icon-left" style="border-collapse: collapse; border-spacing: 0; margin-bottom: 20px; margin-top: 20px; width: 100%">
<tr>
<th style="border: none; font-family: Times New Roman; font-size: 14px; font-weight: bold; margin: 0; padding: 0; text-align: left; vertical-align: middle; width: 50px" align="left" valign="middle"><img src="test.png"></th>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0; vertical-align: top; width: 550px" valign="top">
<div class="top">You're currently finding about</div>
<div class="large" style="color: black; font-size: 18px; padding: 4px 0">12 cats</div>
<div class="bottom">per day</div>
</td>
</tr>
<tr><td colspan="2" style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0; vertical-align: top; width: 550px" valign="top"> </td></tr>
<tr>
<td colspan="2" style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0; vertical-align: top; width: 550px" valign="top"><img alt="Number of cats found" src="test.png"></td>
</tr>
</table>
</div>
<div class="summary">
<hr class="fine-print" style="border-bottom-color: #eee; border-bottom-style: solid; border-width: 0 0 1px; margin: 20px 0">
<h3 style="font-family: Times New Roman; font-size: 18px; font-weight: normal; line-height: 2em; margin: 10px 0 0">Your last cat was found two days ago.</h3>
<p class="fine-print" style="margin: 0">One type of cat is a kitten.</p>
<table class="readings" style="border-collapse: collapse; border-spacing: 0; margin: 10px 0; width: 100%">
<tr style="color: #BD236C">
<td class="left-column" style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0; width: 5%">
<img src="test.png" style="padding-top: 10px">
</td>
<td class="center-column" style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0; width: 60%">
<h3 style="font-family: Times New Roman; font-size: 18px; font-weight: normal; line-height: 2em; margin: 10px 0 0">Special account <span class="nickname" style="font-size: 12px"></span> <span class="fine-print">A1</span>
</h3>
</td>
<td class="right-column" style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0; width: 20%">
<h3 style="font-family: Times New Roman; font-size: 18px; font-weight: normal; line-height: 2em; margin: 10px 0 0">12.345</h3>
</td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 0"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<div class="banner" style="margin: 0 auto 20px; padding: 10px; text-align: center; width: 640px" align="center">
<a href="http://localhost/logout" style="color: red; text-decoration: none">
<img alt="" border="0" height="177" src="http://localhost/photo1.png" width="600">
</a>
</div>
<table class="section-wrapper" style="border-spacing: 0; border: none; margin: 0 auto 20px; width: 640px">
<tr>
<td class="tips section" style="background: white; color: black; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0 auto 20px; padding: 40px 20px; text-align: left; width: 600px" align="left" bgcolor="white">
<table style="border-collapse: collapse; border-spacing: 0; width: 100%">
<tr>
<td colspan="3" style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0; vertical-align: top; width: 200px" valign="top"><h2 style="font-family: Times New Roman; font-size: 1.8; font-weight: normal; line-height: 1.2; margin: 0 0 10px">How can you find more cats?</h2></td>
</tr>
<tr class="icon">
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0; vertical-align: top; width: 200px" valign="top"><img height="40" src="http://localhost/photo1.png" width="40"></td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top"><img height="40" src="http://localhost/photo2.png" width="40"></td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top"><img height="40" src="http://localhost/photo3.png" width="40"></td>
</tr>
<tr class="subtitle">
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0; vertical-align: top; width: 200px" valign="top"><h3 style="font-family: Times New Roman; font-size: 18px; font-weight: normal; line-height: 2em; margin: 0 0 5px">Look in trash cans</h3></td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top"><h3 style="font-family: Times New Roman; font-size: 18px; font-weight: normal; line-height: 2em; margin: 0 0 5px">Start meowing</h3></td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top"><h3 style="font-family: Times New Roman; font-size: 18px; font-weight: normal; line-height: 2em; margin: 0 0 5px">Eat cat food</h3></td>
</tr>
<tr class="body" style="color: green">
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0; vertical-align: top; width: 200px" valign="top">Some cats like to hang out in trash cans. Some cats do not.</td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top">Some cats are attracted to similar tones.</td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top">So one day your tears may smell like cat food, attracting more cats.</td>
</tr>
<tr class="image">
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0; vertical-align: top; width: 200px" valign="top">
<a href="https://localhost/about" style="color: red; text-decoration: none">
<img border="0" height="130" src="http://localhost/photo1.png" style="display: block; margin: 10px 0" width="165">
</a>
</td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top">
<a href="https://localhost/about" style="color: red; text-decoration: none">
<img border="0" height="130" src="http://localhost/photo2.png" style="display: block; margin: 10px 0" width="165">
</a>
</td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top">
<a href="https://localhost/about" style="color: red; text-decoration: none">
<img border="0" height="130" src="http://localhost/photo3.png" style="display: block; margin: 10px 0" width="165">
</a>
</td>
</tr>
<tr class="tips-footer" style="color: green">
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0; vertical-align: top; width: 200px" valign="top">
<a href="https://github.com/soundasleep/html2text_ruby" style="color: red; text-decoration: none">Cats are great.</a>
</td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top">
<a href="https://github.com/soundasleep/html2text_ruby" style="color: red; text-decoration: none">Find more cats.</a>
</td>
<td style="border: none; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0; padding: 5px 0 0 17px; vertical-align: top; width: 200px" valign="top">
<a href="https://github.com/soundasleep/html2text_ruby" style="color: red; text-decoration: none">Do more things.</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table class="footer-wrapper" style="margin: 0 auto 20px">
<tr>
<td class="footer" style="color: #9B9B9B; font-family: Times New Roman; font-size: 12px; font-weight: normal; margin: 0 auto 4em; text-align: left; width: 600px" align="left">
<h3 style="font-family: Times New Roman; font-size: 1.2; font-weight: normal; line-height: 2em; margin: 0">
<a href="http://localhost/contact" style="color: red; text-decoration: none">Contact us</a>
</h3>
<p style="margin: 0 0 1em">
cats@cats.com<br>
Monday and Friday
</p>
<p style="margin: 0 0 1em"><a href="https://github.com/soundasleep/html2text" style="color: red; text-decoration: none"><img align="absmiddle" height="26" src="test.png" width="26"></a>
<a href="https://github.com/soundasleep/html2text_ruby" style="color: red; text-decoration: none"><img align="absmiddle" height="26" src="test.png" width="26"></a>
</p>
<p class="message no-web-display" style="margin: 0">Having trouble seeing this email?
<a href="http://localhost/view_it_online" style="color: red; text-decoration: none">View it online</a>.
</p>
</td>
</tr>
</table>
<script async type="text/javascript" id="profiler" src="/profiler.js" data-version="1.0"></script>
</body>
</html>

View File

@@ -0,0 +1,54 @@
http://localhost/home 16 December 2015
Account 123
Hi Susan
Here is your cat report.
You have found 5 cats less than anyone else
[Find more cats](http://localhost/cats)
Down the road
Across the hall
Your achievements
You're currently finding about
12 cats
per day
[Number of cats found]
---------------------------------------------------------------
Your last cat was found two days ago.
One type of cat is a kitten.
Special account A1
12.345
http://localhost/logout
How can you find more cats?
Look in trash cans
Start meowing
Eat cat food
Some cats like to hang out in trash cans. Some cats do not. Some cats are attracted to similar tones. So one day your tears may smell like cat food, attracting more cats.
https://localhost/about https://localhost/about https://localhost/about
[Cats are great.](https://github.com/soundasleep/html2text_ruby) [Find more cats.](https://github.com/soundasleep/html2text_ruby) [Do more things.](https://github.com/soundasleep/html2text_ruby)
[Contact us](http://localhost/contact)
cats@cats.com
Monday and Friday
https://github.com/soundasleep/html2text https://github.com/soundasleep/html2text_ruby
Having trouble seeing this email? [View it online](http://localhost/view_it_online).

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
<body>
<p>
One: <img src="one.png">
</p>
<p>
Two: <img src="two.png" alt="two">
</p>
<p>
Three: <img src="three.png" title="three">
</p>
<p>
Four: <img src="four.png" title="four" alt="four alt">
</p>
<h1>With links</h1>
<p>
One: <a href="http://localhost"><img src="one.png"></a>
</p>
<p>
Two: <a href="http://localhost"><img src="two.png" alt="two"></a>
</p>
<p>
Three: <a href="http://localhost"><img src="three.png" title="three"></a>
</p>
<p>
Four: <a href="http://localhost"><img src="four.png" title="four" alt="four alt"></a>
</p>
<h1>With links with titles</h1>
<p>
One: <a href="http://localhost" title="one link"><img src="one.png"></a>
</p>
<p>
Two: <a href="http://localhost" title="two link"><img src="two.png" alt="two"></a>
</p>
<p>
Three: <a href="http://localhost" title="three link"><img src="three.png" title="three"></a>
</p>
<p>
Four: <a href="http://localhost" title="four link"><img src="four.png" title="four" alt="four alt"></a>
</p>
</body>
</html>

View File

@@ -0,0 +1,27 @@
One:
Two: [two]
Three: [three]
Four: [four]
With links
One: http://localhost
Two: [two](http://localhost)
Three: [three](http://localhost)
Four: [four](http://localhost)
With links with titles
One: [one link](http://localhost)
Two: [two link](http://localhost)
Three: [three link](http://localhost)
Four: [four link](http://localhost)

View File

@@ -0,0 +1,4 @@
<b>Hello &nbsnbsp; world</b>
<div class=">
Error
</div>

View File

@@ -0,0 +1 @@
Hello &nbsnbsp; world

View File

@@ -0,0 +1,24 @@
<h1>List tests</h1>
<p>
Add some lists.
</p>
<ol>
<li>one</li>
<li>two
<li>three
</ol>
<h2>An unordered list</h2>
<ul>
<li>one
<li>two</li>
<li>three</li>
</ul>
<ul>
<li>one
<li>two</li>
<li>three</li>
</ul>

View File

@@ -0,0 +1,17 @@
List tests
Add some lists.
- one
- two
- three
An unordered list
- one
- two
- three
- one
- two
- three

View File

@@ -0,0 +1,14 @@
<h1>Anchor tests</h1>
<p>
Visit http://openiaml.org or <a href="http://openiaml.org">openiaml.org</a> or <a href="http://openiaml.org">http://openiaml.org</a>.
</p>
<p>
To visit with SSL, visit https://openiaml.org or <a href="https://openiaml.org">openiaml.org</a> or <a href="https://openiaml.org">https://openiaml.org</a>.
</p>
<p>
To mail, email support@openiaml.org or mailto:support@openiaml.org
or <a href="mailto:support@openiaml.org">support@openiaml.org</a> or <a href="mailto:support@openiaml.org">mailto:support@openiaml.org</a>.
</p>

View File

@@ -0,0 +1,7 @@
Anchor tests
Visit http://openiaml.org or openiaml.org or http://openiaml.org.
To visit with SSL, visit https://openiaml.org or openiaml.org or https://openiaml.org.
To mail, email support@openiaml.org or mailto:support@openiaml.org or support@openiaml.org or mailto:support@openiaml.org.

View File

@@ -0,0 +1 @@
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;} a:link, span.MsoHyperlink {mso-style-priority:99; color:#0563C1; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:#954F72; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri",sans-serif; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;} @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--></head><body lang=EN-GB link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Dear html2text,<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>This is an example email that can be used to test html2text conversion of outlook / exchange emails.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>The addition of &lt;o:p&gt; tags is very annoying!<o:p></o:p></p><p class=MsoNormal>This is a single line return<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><b>This is bold<o:p></o:p></b></p><p class=MsoNormal><i>This is italic<o:p></o:p></i></p><p class=MsoNormal><u>This is underline<o:p></o:p></u></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Andrew<o:p></o:p></p></div></body></html>

View File

@@ -0,0 +1,12 @@
Dear html2text,
This is an example email that can be used to test html2text conversion of outlook / exchange emails.
The addition of <o:p> tags is very annoying!
This is a single line return
This is bold
This is italic
This is underline
Andrew

View File

@@ -0,0 +1 @@
hello &nbsp; world &amp; people &lt; &gt; &NBSP;

View File

@@ -0,0 +1 @@
hello world & people < > &NBSP;

View File

@@ -0,0 +1,31 @@
<html>
<body>
<div>
Hello
<br>
</div>
<div>
How are you?
<br>
</div>
<p>
How are you?
<br>
<p></p>
</p>
<p>
How are you?
<br>
</p>
This is not the end!
<div>
How are you again?
<br>
</div>
This is the end!
<br>
</body>
</html>

View File

@@ -0,0 +1,10 @@
Hello
How are you?
How are you?
How are you?
This is not the end!
How are you again?
This is the end!

View File

@@ -0,0 +1 @@
these spaces are non-breaking

View File

@@ -0,0 +1 @@
these spaces are non-breaking

View File

@@ -0,0 +1,10 @@
Here is the code
<pre>
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
int main(){
return 0;
};
</pre>

View File

@@ -0,0 +1,8 @@
Here is the code
#include <stdlib.h>
#include <stdio.h>
int main(){
return 0;
};

View File

@@ -0,0 +1,53 @@
<html>
<title>Ignored Title</title>
<body>
<h1>Hello, World!</h1>
<table>
<thead>
<tr>
<th>Col A</th>
<th>Col B</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Data A1
</td>
<td>
Data B1
</td>
</tr>
<tr>
<td>
Data A2
</td>
<td>
Data B2
</td>
</tr>
<tr>
<td>
Data A3
</td>
<td>
Data B4
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
Total A
</td>
<td>
Total B
</td>
</tr>
</tfoot>
</table>
</body>
</html>

View File

@@ -0,0 +1,7 @@
Hello, World!
Col A Col B
Data A1 Data B1
Data A2 Data B2
Data A3 Data B4
Total A Total B

View File

@@ -0,0 +1 @@
test one<br />test two

View File

@@ -0,0 +1,2 @@
test one
test two

View File

@@ -0,0 +1 @@
1<br />2<br />3<br />4<br />5 6

View File

@@ -0,0 +1,5 @@
1
2
3
4
5 6

View File

@@ -0,0 +1,4 @@
<ul>
<li>ÅÄÖ</li>
<li>åäö</li>
</ul>

View File

@@ -0,0 +1,2 @@
- ÅÄÖ
- åäö

View File

@@ -0,0 +1,4 @@
<ul>
<li>ÅÄÖ</li>
<li>åäö</li>
</ul>

View File

@@ -0,0 +1,2 @@
- ÅÄÖ
- åäö

Some files were not shown because too many files have changed in this diff Show More