/** * @param Request $request * * @return \Symfony\Component\HttpFoundation\JsonResponse */ protected function getWebsiteSnapshotAction(Request $request) { $data = ['success' => 0]; if ($this->get('mautic.security')->isGranted('plugin:focus:items:create')) { $website = InputHelper::url($request->request->get('website')); if ($website) { // Let's try to extract colors from image $id = InputHelper::int($request->request->get('id')); if (!empty($id)) { // Tell the JS to not populate with default colors $data['ignoreDefaultColors'] = true; } $snapshotUrl = $this->get('mautic.helper.core_parameters')->getParameter('website_snapshot_url'); $snapshotKey = $this->get('mautic.helper.core_parameters')->getParameter('website_snapshot_key'); $http = $this->get('mautic.http.connector'); $response = $http->get($snapshotUrl . '?url=' . urlencode($website) . '&key=' . $snapshotKey, [], 30); if ($response->code === 200) { $package = json_decode($response->body, true); if (isset($package['images'])) { $data['image']['desktop'] = $package['images']['desktop']; $data['image']['mobile'] = $package['images']['mobile']; $palette = $package['palette']; $data['colors'] = ['primaryColor' => $palette[0], 'textColor' => FocusModel::isLightColor($palette[0]) ? '#000000' : '#ffffff', 'buttonColor' => $palette[1], 'buttonTextColor' => FocusModel::isLightColor($palette[1]) ? '#000000' : '#ffffff']; $data['success'] = 1; } } } } return $this->sendJsonResponse($data); }
echo $scale; ?> ) rotate(<?php echo $direction; ?> <?php echo $transformSize; ?> <?php echo $transformSize; ?> )"> <desc>Created with Raphaël 2.1.2</desc> <defs> <?php $color = \MauticPlugin\MauticFocusBundle\Model\FocusModel::isLightColor($props['colors']['primary']) ? '000000' : 'ffffff'; ?> <linearGradient gradientTransform="matrix(1,0,0,1,-4,-4)" y2="0" x2="6.123233995736766e-17" y1="1" x1="0" id="1390-_0050af-_002c62"> <stop stop-color="#<?php echo $color; ?> " offset="0%"></stop> <stop stop-color="#<?php echo $color; ?> " offset="100%"></stop> </linearGradient> </defs> <path transform="matrix(1,0,0,1,4,4)" opacity="0" stroke-linejoin="round" stroke-width="3" d="M16,1.466C7.973,1.466,1.466,7.973,1.466,16C1.466,24.027,7.973,30.534,16,30.534C24.027,30.534,30.534,24.027,30.534,15.999999999999998C30.534,7.973,24.027,1.466,16,1.466ZM13.665,25.725L10.129,22.186L16.316,15.998999999999999L10.128999999999998,9.811999999999998L13.664999999999997,6.275999999999998L23.388999999999996,15.998999999999999L13.665,25.725Z"