GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: /var/www/admin.fixgini.com/vendor/cloudinary/cloudinary_php/src/Tag/TagUtils.php
<?php
/**
 * This file is part of the Cloudinary PHP package.
 *
 * (c) Cloudinary
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cloudinary\Tag;

use Cloudinary\ArrayUtils;
use Cloudinary\Configuration\Configuration;
use Cloudinary\StringUtils;

/**
 * Class TagUtils
 *
 * @package Cloudinary\Tag
 */
class TagUtils
{
    /**
     * @param array         $tagAttributes
     * @param array         $params
     * @param Configuration $configuration
     */
    public static function handleSpecialAttributes(&$tagAttributes, &$params, $configuration)
    {
        $hasLayer                 = array_key_exists('overlay', $params) || array_key_exists('underlay', $params);
        $hasAngle                 = array_key_exists('angle', $params) && ! empty($params['angle']);
        $cropMode                 = ArrayUtils::get($params, 'crop');
        $responsiveWidth          = ArrayUtils::get($params, 'responsive_width', $configuration->url->responsiveWidth);
        $useResponsiveBreakpoints = array_key_exists('responsive_breakpoints', $params);

        $noHtmlSizes = $hasLayer || $hasAngle || $cropMode === 'fit' || $cropMode === 'limit' || $responsiveWidth
                       || $useResponsiveBreakpoints;

        ArrayUtils::addNonEmpty($params, 'width', ArrayUtils::pop($params, 'html_width'));
        ArrayUtils::addNonEmpty($params, 'height', ArrayUtils::pop($params, 'html_height'));

        $width = ArrayUtils::get($params, 'width');
        if (! (is_null($width) || strlen($width) == 0 || ($width && (StringUtils::startsWith($width, 'auto')
                                                  || (float)$width < 1 || $noHtmlSizes)))) {
            ArrayUtils::addNonEmptyFromOther($tagAttributes, 'width', $params);
        }

        $height = ArrayUtils::get($params, 'height');
        if (! (is_null($height) || strlen($height) == 0 || (float)$height < 1 || $noHtmlSizes)) {
            ArrayUtils::addNonEmptyFromOther($tagAttributes, 'height', $params);
        }
    }
}