67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace KupShop\MarketingBundle\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
class WebClaimVerifiyng extends AbstractController
|
|
{
|
|
/**
|
|
* @Route(path="/google{hash}.html", name="google_claim_verify")
|
|
*
|
|
* @return Response
|
|
*/
|
|
public function getGoogleWebVerify(Request $request, $hash)
|
|
{
|
|
$dbcfg = \Settings::getDefault();
|
|
|
|
foreach ($dbcfg->analytics['google_site_verifications_file'] ?? [] as $value) {
|
|
if ($value['value'] == $hash) {
|
|
return new Response("google-site-verification: google{$hash}.html");
|
|
}
|
|
}
|
|
|
|
throw new NotFoundHttpException('Not found');
|
|
}
|
|
|
|
/**
|
|
* @Route(path="/{hash}.html", name="facebook_claim_verify", requirements={"hash"="^[a-zA-Z0-9]{30}$"})
|
|
*
|
|
* @return Response
|
|
*/
|
|
public function getFacebookWebVerify(Request $request, $hash)
|
|
{
|
|
$dbcfg = \Settings::getDefault();
|
|
|
|
foreach ($dbcfg->analytics['facebook_site_verifications_file'] ?? [] as $value) {
|
|
if ($value['value'] == $hash) {
|
|
return new Response($hash);
|
|
}
|
|
}
|
|
|
|
throw new NotFoundHttpException('Not found');
|
|
}
|
|
|
|
/**
|
|
* @Route(path="/seznam-wmt-{hash}.txt", name="seznam_claim_verify", requirements={"slug"="^[a-zA-Z0-9]{32}$"})
|
|
*
|
|
* @return Response
|
|
*/
|
|
public function getSeznamWebVerify(Request $request, $hash)
|
|
{
|
|
$dbcfg = \Settings::getDefault();
|
|
|
|
foreach ($dbcfg->analytics['seznam_site_verifications_file'] ?? [] as $value) {
|
|
if ($value['value'] == $hash) {
|
|
return new Response($hash);
|
|
}
|
|
}
|
|
|
|
throw new NotFoundHttpException('Not found');
|
|
}
|
|
}
|