public static function syncDictionaryItem(\PHPMailer $mail, $keyName, $lang = '', array $params = []) { $app = App::getInstance(); /** @var \LT\DAO\Dictionary $dictionaryDAO */ $dictionaryDAO = $app->container->get('LT\\DAO\\Dictionary'); $config = Config::getInstance(); if (empty($lang)) { $lang = $config->currentLocale; } $params['name'] = $config->partnerName; $params['url'] = $config->getPartnerSiteUrl(); $params['affiliateUrl'] = $config->partnerUrl; $params1 = []; foreach ($params as $key => $value) { $params1['{' . $key . '}'] = $value; } $params = $params1; $dictionary = $dictionaryDAO->getDictionaryItem($keyName, $lang); if (isset($dictionary)) { $mail->isHTML(true); $mail->Subject = strtr($dictionary->title, $params); $mail->Body = strtr($dictionary->content, $params); } return $mail; }
/** * @return AjaxResponse */ protected function initResponse() { $ajaxResponse = new AjaxResponse(); try { $app = App::getInstance(); $ajaxResponse->status = true; $ajaxResponse->result = $app->callFromRequest($this->arguments); } catch (\Exception $e) { $ajaxResponse->status = false; $ajaxResponse->result = null; App::exceptionHandler($e); } $ajaxResponse->notification = Notification::getAll(); return $ajaxResponse; }
// 4 + e- - // 10 + e- - // 29 + e- - // 81 + e- - // 107 + e+ - // 112 + e- - // 113 + e- - // 114 + e- - // 115 + e- - // 126 + e- - // 136 + e+ - // 138 + e- - // 148 + e+ - // 169 + e+ - $config = Config::getInstance(); $app = App::getInstance(); $fromDate = new \DateTime('2015-08-19 10:00:00'); $toDate = new \DateTime('2015-08-19 10:00:00'); /** @var \LT\Services\PusherService $pusherService */ $pusherService = $app->container->get('LT\\Services\\PusherService'); /** @var \LT\Services\CoreService $coreService */ $coreService = $app->container->get('LT\\Services\\CoreService'); $interval = new \DateInterval('P1D'); $toDate->modify('+1 day'); $dateRange = new \DatePeriod($fromDate, $interval, $toDate); $start = microtime(true); foreach ($dateRange as $date) { $scopeStart = microtime(true); /** @var $date \DateTime */ $date->setTime(10, 0, 0); $newFromDate = clone $date;
public static function init($skinDir = '', array $params = []) { if (empty($skinDir) && !empty($_SERVER['DOCUMENT_ROOT'])) { $skinDir = $_SERVER['DOCUMENT_ROOT']; } $globalConfig = []; static::$rootDir = dirname(dirname(__DIR__)); $globalConfigPath = static::$rootDir . DIRECTORY_SEPARATOR . 'config.php'; // only for test , delete on realise if ($skinDir == 'test') { $globalConfigPath = static::$rootDir . DIRECTORY_SEPARATOR . 'test_config.php'; } if (file_exists($globalConfigPath)) { $globalConfig = (require $globalConfigPath); if (!is_array($globalConfig)) { $globalConfig = []; } } $skinConfig = []; $skinConfigPath = $skinDir . DIRECTORY_SEPARATOR . 'config.php'; if (file_exists($skinConfigPath)) { $skinConfig = (require $skinConfigPath); if (!is_array($skinConfig)) { $skinConfig = []; } } static::$skinRootDir = $skinDir; // for test if (empty(static::$skinRootDir)) { static::$skinRootDir = __DIR__; } // only for test , delete on realise if ($skinDir == 'test') { static::$skinRootDir = static::$rootDir . '/skins/test'; } $config = $globalConfig; if (!empty($params)) { $skinConfig = array_replace_recursive($skinConfig, $params); } if (!empty($skinConfig)) { $config = array_replace_recursive($globalConfig, $skinConfig); } static::$instance = new self($config); App::getInstance(); }