public function facebookAction(Request $request) { $postId = $request->get('id'); $post = $this->service->getPost(array($postId)); $keyWords = $this->content_service->getTextById(IndexController::KEYWORDS_CONTENT_ID); $html = "<!DOCTYPE html>\n <html>\n <head>\n <meta name='title' content='" . $post[0]['title'] . "' />\n <meta name='description' content='" . $post[0]['description'] . "' />\n <meta name='keywords' content='" . $keyWords . "' />\n <meta property='og:type' content='article'>\n <meta property='og:url' content='https://yasoon.ru/social/post/" . $postId . "' />\n <meta property='og:title' content='" . $post[0]['title'] . "' />\n <meta property='og:description' content='" . $post[0]['description'] . "' />\n <meta property='og:image' content='http://yasoon.ru/frontend/img/logo.jpg' />\n <meta property='og:image:secure_url' content='https://yasoon.ru/frontend/img/logo.jpg' />\n <meta property='og:image:type' content='image/jpeg' />\n <meta property='og:image:width' content='400' />\n <meta property='og:image:height' content='300' />\n <script type='text/javascript' src='//code.jquery.com/jquery-latest.min.js' ></script>\n <script type='text/javascript'>\n \$(document).ready(function(){\n setTimeout(function(){\n window.location.href = 'https://yasoon.ru/#/post/" . $postId . "'\n },1);\n });\n </script>\n </head>\n </html>"; return new Response($html); }
/** * @Route("/getPost") * @Method({"POST"}) * */ public function getPostAction(Request $request) { $postId = $request->request->get('postid'); if (!is_array($postId)) { $postId = [$postId]; } $result = $this->service->getPost($postId); return $result; }