HEX
Server: Apache
System: Linux web15f74.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: lucendi (859622)
PHP: 7.4.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/lucendi/www/wp-content/themes/divi/includes/builder/module/settings/migration/Animation.php
<?php


class ET_Builder_Module_Settings_Migration_Animation extends ET_Builder_Module_Settings_Migration {

	public $version = '3.0.72';

	public function get_fields() {
		return array(
			'animation_style'    => array(
				'affected_fields' => array(
					'animation' => $this->get_modules( 'image' ),
				),
				'map' => array(
					'off'     => 'none',
					'fade_in' => 'fade',
				),
			),
			'animation_duration'    => array(
				'affected_fields' => array(
					'animation' => $this->get_modules( 'image' ),
				),
			),
			'animation_intensity_slide'    => array(
				'affected_fields' => array(
					'animation' => $this->get_modules( 'image' ),
				),
			),
			'animation_direction'    => array(
				'affected_fields' => array(
					'animation' => $this->get_modules( 'image' ),
				),
				'map' => array(
					'off'     => '',
					'fade_in' => 'center',
					''        => 'left',
				),
			),
		);
	}

	public function get_modules( $group = '' ) {
		$modules = array();

		if ( in_array( $group, array( '', 'image' ) ) ) {
			$modules[] = 'et_pb_image';
			$modules[] = 'et_pb_fullwidth_image';
		}

		return $modules;
	}

	public function migrate( $field_name, $current_value, $module_slug, $saved_value, $saved_field_name, $attrs ) {
		// Image & Fullwidth Image modules migration setting
		if ( in_array( $module_slug, $this->get_modules( 'image' ) ) ) {

			// Migrate 'animation' attribute value to new animation UI attributes.
			// The following migration setting is basically default value for image module's legacy animation setting
			if ( 'animation' === $saved_field_name ) {

				// Image module specific override
				if ( 'et_pb_image' === $module_slug ) {
					// Overwrite default animation if global setting is modified via customizer
					$global_animation_direction = ET_Global_Settings::get_value( 'et_pb_image-animation' );
					$default_animation          = $global_animation_direction && '' !== $global_animation_direction ? $global_animation_direction : 'left';

					if ( '' === $current_value ) {
						$current_value = $default_animation;
					}
				}

				// Animation is set to off on legacy animation setting
				$is_animation_off = 'off' === $current_value;

				// Set animation duration to 500ms
				if ( 'animation_duration' === $field_name && ! $is_animation_off ) {
					return '500ms';
				}

				// Set animation intensity to 10%
				if ( 'animation_intensity_slide' === $field_name && ! $is_animation_off ) {
					return '10%';
				}

				// Map animation style to provided configuration, otherwise it is 'slide' style
				if ( 'animation_style' === $field_name ) {
					return isset( $this->fields['animation_style']['map'][ $current_value ] ) ? $this->fields['animation_style']['map'][ $current_value ] : 'slide';
				}

				// Map animation direction to provided configuration, otherwise keep current value
				if ( 'animation_direction' === $field_name ) {
					return isset( $this->fields['animation_direction']['map'][ $current_value ] ) ? $this->fields['animation_direction']['map'][ $current_value ] : $current_value;
				}
			}
		}

		return $saved_value;
	}
}

return new ET_Builder_Module_Settings_Migration_Animation();