/** * @return string */ public function getDetails() { if ($this->details === null) { $pageTitle = $this->stringFormatter->makeStringUrlSafe($this->title->getPageTitle()); $this->details = $this->request->getModule() . '-' . $this->request->getController() . '-' . $pageTitle; } return $this->details; }
/** * @return array */ public function fetchFeedItems() { $items = []; $results = $this->filesRepository->getAll($this->date->getCurrentDateTime(), 10); $cResults = count($results); for ($i = 0; $i < $cResults; ++$i) { $items[] = ['title' => $results[$i]['title'], 'date' => $this->date->timestamp($results[$i]['start']), 'description' => $this->formatter->shortenEntry($results[$i]['text'], 300, 0), 'link' => $this->router->route('files/index/details/id_' . $results[$i]['id'], true)]; } return $items; }
/** * @return JsonResponse */ public function execute() { $response = []; if ($this->request->getPost()->count() > 0) { $formData = $this->request->getPost()->all(); if (!empty($formData['title'])) { $alias = $this->stringFormatter->makeStringUrlSafe($formData['title']); if (!empty($formData['prefix'])) { $alias = $this->stringFormatter->makeStringUrlSafe($formData['prefix']) . '/' . $alias; } $response = ['alias' => $alias]; } } return new JsonResponse($response); }
/** * @param int $id * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response * @throws Core\Controller\Exception\ResultNotExistsException */ public function execute($id) { if ($this->filesRepository->resultExists($id, $this->date->getCurrentDateTime()) === true) { $file = $this->filesCache->getCache($id); $path = $this->appPath->getUploadsDir() . 'files/'; if (is_file($path . $file['file'])) { $ext = strrchr($file['file'], '.'); $filename = $this->stringFormatter->makeStringUrlSafe($file['title']) . $ext; $response = new BinaryFileResponse($path . $file['file']); $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename); return $response; } elseif (preg_match('/^([a-z]+):\\/\\//', $file['file'])) { // External file return $this->redirect()->toNewPage($file['file']); } } throw new Core\Controller\Exception\ResultNotExistsException(); }
/** * @return string */ private function getHtmlSignature() { if (!empty($this->mailSignature)) { if ($this->mailSignature === strip_tags($this->mailSignature)) { return $this->stringFormatter->nl2p($this->mailSignature); } return $this->mailSignature; } return ''; }
/** * @param string $emailAddress * @param string $hash * * @return bool */ protected function sendDoubleOptInEmail($emailAddress, $hash) { $url = $this->router->route('newsletter/index/activate/hash_' . $hash, true); $systemSettings = $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME); $settings = $this->config->getSettings(Schema::MODULE_NAME); $subject = $this->translator->t('newsletter', 'subscribe_mail_subject', ['%title%' => $systemSettings['site_title']]); $body = $this->translator->t('newsletter', 'subscribe_mail_body', ['{host}' => $this->request->getHost()]) . "\n\n"; $from = ['email' => $settings['mail'], 'name' => $systemSettings['site_title']]; $this->mailer->reset()->setFrom($from)->setSubject($subject)->setMailSignature($settings['mailsig']); if ($settings['html'] == 1) { $this->mailer->setTemplate('newsletter/layout.email.tpl'); $body .= '<a href="' . $url . '">' . $url . '<a>'; $this->mailer->setHtmlBody($this->stringFormatter->nl2p($body)); } else { $body .= $url; $this->mailer->setBody($body); } $this->mailer->setRecipients($emailAddress); return $this->mailer->send(); }
/** * @param array $news * * @return string */ protected function addReadMoreLink(array $news) { $readMoreLink = '...<a href="' . $this->router->route('news/details/id_' . $news['id']) . '">['; $readMoreLink .= $this->translator->t('news', 'readmore') . "]</a>\n"; return $this->stringFormatter->shortenEntry($news['text'], $this->newsSettings['readmore_chars'], 50, $readMoreLink); }
/** * @inheritdoc */ protected function getDbValueIfExists(array $dbResultRow, $field) { return isset($dbResultRow[$field]) ? $this->stringFormatter->nl2p($dbResultRow[$field]) : null; }
/** * @inheritdoc */ public function process($value) { return $this->stringFormatter->nl2p($value); }