HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux bsx-1-dev 6.8.0-101-generic #101-Ubuntu SMP PREEMPT_DYNAMIC Mon Feb 9 10:15:05 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/revslider-hovermorph-addon/sr6/includes/slide.class.php
<?php
/**
 * @author    ThemePunch <info@themepunch.com>
 * @link      http://www.themepunch.com/
 * @copyright 2024 ThemePunch
 */

if( !defined( 'ABSPATH') ) exit();

class RsHoverMorphSlideFront extends RevSliderFunctions {
	
	private $title;
	
	public function __construct($title) {
		
		$this->title = $title;
		add_action('revslider_add_layer_attributes', array($this, 'write_layer_attributes'), 10, 3);
		add_filter('revslider_putCreativeLayer', array($this, 'check_hovermorph'), 10, 3);
	
	}
	
	// HANDLE ALL TRUE/FALSE
	private function isFalse($val) {
	
		$true = [true, 'on', 1, '1', 'true'];
		return !in_array($val, $true);
	
	}
	
	private function isEnabled($slider){
		
		$settings = $slider->get_params();
		$enabled = $this->get_val($settings, array('addOns', 'revslider-' . $this->title . '-addon', 'enable'), false);
		
		return ($this->isFalse($enabled)) ? false : true;
	}
	
	// removes hovermorph layers that may exist if the AddOn is not officially enabled
	public function check_hovermorph($layers, $output, $static_slide) {
		
		$slider = $this->get_val($output, 'slider', false);
		if(empty($slider)) return;
		// addon enabled
		if ($this->isEnabled($slider)) return $layers;
		$ar = array();
		foreach($layers as $layer) {
			$isHoverMorph = false;
			if(array_key_exists('subtype', $layer)) {
				$hovermorph = $this->get_val($layer, 'subtype', false);
				$isHoverMorph = $hovermorph === 'hovermorph';
			}
			if(!$isHoverMorph) $ar[] = $layer;
		}
		return $ar;
	}

	private function aO($val,$d,$s) {
		return $val==$d ? '' : $s.':'.$val.';';
	}

	private function convertColors($a) {
		if(!empty($a) && is_array($a)){
			foreach($a as $c => $v){
				$a[$c] = RSColorpicker::get($v);				
			}
		}				
		
		return $a;
	}
	
		
	public function write_layer_attributes($layer, $slide, $slider) {
		
		// addon enabled
		$enabled = $this->isEnabled($slider);
		if(empty($enabled)) return;		
		$subtype = $this->get_val($layer, 'subtype', '');
		if(!$subtype || $subtype !== 'hovermorph') return;
				
		$addOn = $this->get_val($layer, ['addOns', 'revslider-' . $this->title . '-addon'], false);
		if(!$addOn) return;
		

		//MAIN I
		$type = $this->get_val($addOn, 'type', 'default');
		$parbackground = $this->get_val($addOn, 'parbackground', 'default');
		$adjustBrightness = $this->get_val($addOn, 'adjustBrightness', 50);
		$imgScale = $this->get_val($addOn, 'imgScale', 50);
		$imageColor = $this->get_val($addOn, 'imageColor', '#ffffff');
		$imgColorOpt = $this->get_val($addOn, 'imgColorOpt', 1);
		$shapeChooser = $this->get_val($addOn, 'shapeChooser', 1);
		$shapeSelector = $this->get_val($addOn, 'shapeSelector', 3);
		$shapeFill = $this->get_val($addOn, 'shapeFill', false);
		$shapeBorderSize = $this->get_val($addOn, 'shapeBorderSize', 20);
		$shapeSize = $this->get_val($addOn, 'shapeSize', 50);
		$shapeXPos = $this->get_val($addOn, 'shapeXPos', 50);
		$shapeYPos = $this->get_val($addOn, 'shapeYPos', 25);
		$shapeZPos = $this->get_val($addOn, 'shapeZPos', 90);
		$textInput = $this->get_val($addOn, 'textInput', "ThemePunch");
		$textFont = $this->get_val($addOn, 'textFont', "Roboto");
		$textFontWeight = $this->get_val($addOn, 'textFontWeight', "300");
		$textFontSize = $this->get_val($addOn, 'textFontSize', 200);
		
		//INTERACTION I
		$interactionRadius = $this->get_val($addOn, 'interactionRadius', 80);
		$interIntens = $this->get_val($addOn, 'interIntens', 50);


		$parbackground = str_replace("http://","//",$parbackground);
		$parbackground = str_replace("https://","//",$parbackground);
		$datas = '';

		//MAIN II
		if($type != 'default') $datas .= 'ddw:'.$type.';';
		if($parbackground != 'default') $datas .= 'pbg:'.$parbackground.';';
		if($adjustBrightness != 50) $datas .= 'pl:'.$adjustBrightness.';';
		if($imgScale != 50) $datas .= 'ps:'.$imgScale.';';
		if($imageColor != '#ffffff') $datas .= 'pc:'.$imageColor.';';
		if($imgColorOpt != 1) $datas .= 'po:'.$imgColorOpt.';';
		if($shapeChooser != 1) $datas .= 'ph:'.$shapeChooser.';';
		if($shapeSelector != 3) $datas .= 'pd:'.$shapeSelector.';';
		if($shapeFill != false) $datas .= 'pf:'.$shapeFill.';';
		if($shapeBorderSize != 20) $datas .= 'pb:'.$shapeBorderSize.';';
		if($shapeSize != 50) $datas .= 'ss:'.$shapeSize.';';
		if($shapeXPos != 50) $datas .= 'sx:'.$shapeXPos.';';
		if($shapeYPos != 25) $datas .= 'sy:'.$shapeYPos.';';
		if($shapeZPos != 90) $datas .= 'sz:'.$shapeZPos.';';
		if($textInput != "ThemePunch") $datas .= 'mt:'.addslashes($textInput).';';
		if($textFont != "Roboto") $datas .= 'mf:'.addslashes($textFont).';';
		if($textFontWeight != "300") $datas .= 'mw:'.$textFontWeight.';';
		if($textFontSize != 200) $datas .= 'ms:'.$textFontSize.';';

		//INTERACTION II
		if($interactionRadius != 80) $datas .= 'ir:'.$interactionRadius.';';
		if($interIntens != 50) $datas .= 'ie:'.$interIntens.';';

		$fontloader = new RevSliderOutput();
		$fontloader->set_clean_font_import($textFont, '', '', (array)$textFontWeight);

		echo RS_T8 . 'data-wpsdata="' .$datas.'"'."'\n";
	}
	
}
?>