Initial commit: CloudOps infrastructure platform

This commit is contained in:
root
2026-04-09 19:58:57 +02:00
commit 1166a52f26
7762 changed files with 839452 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
namespace Mautic\AssetBundle\Helper;
class PointActionHelper
{
public static function validateAssetDownload($eventDetails, $action): bool
{
$assetId = $eventDetails->getId();
$limitToAssets = $action['properties']['assets'];
if (!empty($limitToAssets) && !in_array($assetId, $limitToAssets)) {
// no points change
return false;
}
return true;
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Mautic\AssetBundle\Helper;
use Mautic\AssetBundle\Model\AssetModel;
class TokenHelper
{
public const REGEX = '/{assetlink=(.*?)}/';
public function __construct(
protected AssetModel $model,
) {
}
public function findAssetTokens($content, $clickthrough = []): array
{
$tokens = [];
preg_match_all(self::REGEX, $content, $matches);
foreach ($matches[1] as $key => $assetId) {
$token = $matches[0][$key];
if (isset($tokens[$token])) {
continue;
}
$asset = $this->model->getEntity($assetId);
$tokens[$token] = (null !== $asset) ? $this->model->generateUrl($asset, true, $clickthrough) : '';
}
return $tokens;
}
}