GhostManSec
Server: LiteSpeed
System: Linux premium197.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: parhudrw (1725)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/parhudrw/ve.anqa.it/wp-content/plugins/depicter/app/src/Document/Models/Elements/Vector.php
<?php

namespace Depicter\Document\Models\Elements;

use Depicter\Document\Models\Common\Styles;

class Vector extends Svg
{

	public function getSelectorAndCssList() {
		parent::getSelectorAndCssList();

		if ( empty( $this->options->customColors ) ) {
			return $this->selectorCssList;
		}
		$innerStyles = $this->prepare()->innerStyles;
		if ( !empty( $innerStyles ) ) {

			foreach( $innerStyles as $cssSelector => $styles ){
				if ( empty( $styles ) || ! $styles instanceof Styles ) {
					continue;
				}

				$generalCss = $innerStyles->{$cssSelector}->getSvgCss('svg');

				$this->selectorCssList[ '.' . $this->getStyleSelector() . ' .' . $this->removeCommonStrings( $cssSelector ) ] = $generalCss;
			}
		}

		return $this->selectorCssList;
	}

	public function removeCommonStrings( $selector ) {
		$commonStrings = [
			'depicter',
			'fill',
			'stroke',
			'stopColor',
			'color'
		];

		$selector = strtolower( $selector );
		foreach( $commonStrings as $commonString ){
			if ( $commonString == 'color') {
				if ( stripos( $selector, 'stopColor' ) === false ) {
					$selector =  $commonString == 'depicter' ? str_ireplace( $commonString, $commonString . '-' , $selector ) : str_ireplace( $commonString, '-' . $commonString , $selector );
				}
			} else {
				$selector =  $commonString == 'depicter' ? str_ireplace( $commonString, $commonString . '-' , $selector ) : str_ireplace( $commonString, '-' . $commonString , $selector );
			}
		}

		return str_replace( 'stopcolor', 'stopColor', $selector );
	}
}