2020-09-28 12:36:51 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Utils;
|
|
|
|
|
|
|
|
use App\Models\Client;
|
2020-10-28 11:10:49 +01:00
|
|
|
use stdClass;
|
2020-09-28 12:36:51 +02:00
|
|
|
|
|
|
|
class Helpers
|
|
|
|
{
|
2020-10-01 13:41:23 +02:00
|
|
|
public static function sharedEmailVariables(?Client $client, array $settings = null): array
|
2020-09-28 12:36:51 +02:00
|
|
|
{
|
2020-11-25 15:19:52 +01:00
|
|
|
if (!$client) {
|
|
|
|
$elements['signature'] = '';
|
|
|
|
$elements['settings'] = new stdClass;
|
|
|
|
$elements['whitelabel'] = true;
|
2020-10-01 13:41:23 +02:00
|
|
|
|
2020-11-25 15:19:52 +01:00
|
|
|
return $elements;
|
|
|
|
}
|
2020-10-01 13:41:23 +02:00
|
|
|
|
2020-09-28 12:36:51 +02:00
|
|
|
$_settings = is_null($settings) ? $client->getMergedSettings() : $settings;
|
|
|
|
|
|
|
|
$elements['signature'] = $_settings->email_signature;
|
|
|
|
$elements['settings'] = $_settings;
|
|
|
|
$elements['whitelabel'] = $client->user->account->isPaid() ? true : false;
|
|
|
|
|
|
|
|
return $elements;
|
|
|
|
}
|
|
|
|
}
|