Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.96.2  /  Your IP : 104.23.243.201
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
PHP Version : 7.4.33
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/nicolasj/www/propulseasbl.be/wp-content/plugins/meow-gallery/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nicolasj/www/propulseasbl.be/wp-content/plugins/meow-gallery/classes/run.php
<?php

class Meow_MGL_Run {
	private $isEnqueued = false;
	private $core;
	private $atts;

	public function __construct( $core ) {
		$this->core = $core;

		$override_disabled = get_option( 'mgl_options', [] )[ 'gallery_shortcode_override_disabled' ] ?? false;
		if ( !$override_disabled ) { add_shortcode( 'gallery', array( $core, 'gallery' ) ); }
		add_shortcode( 'meow-gallery', array( $core, 'gallery' ) );

		if ( is_admin() ) {
			add_action( 'init', array( $this, 'enqueue_scripts' ) );
			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
		} else {
			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ), 10 );
			
			add_action( 'mgl_gallery_created', array( $this, 'enqueue_scripts' ), 10, 0 );
			add_action( 'mgl_collection_created', array( $this, 'enqueue_scripts' ), 10, 0 );
		}

		// Yoast: Some people really want this, but it needs to be reviewed as Yoast changed its API
		//add_filter( 'wpseo_sitemap_urlimages', array( $this, 'wpseo_siteimap' ), 10, 2 );
	}

	function enqueue_styles() {
		// Cache buster for CSS
		$css_file = MGL_PATH . '/app/style.min.css';
		$css_cache_buster = file_exists( $css_file ) ? filemtime( $css_file ) : MGL_VERSION;
		wp_enqueue_style( 'mgl-css', plugins_url( '/app/style.min.css', __DIR__ ), null, $css_cache_buster );
	}

	function enqueue_scripts() {
		// Only need to load the scripts once.
		if ( $this->isEnqueued ) { 
			return;
		}
		$this->isEnqueued = true;

		// Load the JS for Meow Gallery
		$physical_file = MGL_PATH . '/app/galleries.js';
		$cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MGL_VERSION;
		wp_enqueue_script( 'mgl-js', plugins_url( '/app/galleries.js', __DIR__ ), array(), $cache_buster, true );


		// TODO: This should be moved in a getter (since it is also used by tiles.php)
		$density = [];
		if ( isset( $this->atts['density'] ) ) {
			$density['desktop'] = $this->atts['density'];
			$density['tablet'] = $this->atts['density'];
			$density['mobile'] = $this->atts['density'];
		}
		else {
			$density['desktop'] = $this->core->get_option( 'tiles_density', 'high' );
			$density['tablet'] = $this->core->get_option( 'tiles_density_tablet', 'medium' );
			$density['mobile'] = $this->core->get_option( 'tiles_density_mobile', 'low' );
		}

		wp_localize_script('mgl-js', 'mgl_settings',
			array(
				'infinite_buffer' => $this->core->get_option( 'infinite_buffer', 0 ),
				'disable_right_click' => !$this->core->get_option( 'right_click', false ),
				'tiles' => array( 'density' => $density ),
				'api_url' => get_rest_url( null, '/meow-gallery/v1/' ),
				'rest_nonce' => wp_create_nonce( 'wp_rest' ),
				'options' => $this->core->get_all_options(),
			)
		);
	}

	/*
		For Yoast SEO
	*/

	function wpseo_siteimap( $images, $post_id ) {
		$galleries = get_post_galleries( $post_id );
		$images_ids = array();
		foreach ( $galleries as $gallery ) {
			preg_match_all( '/wp\-image\-([0-9]{1,16})/', $gallery, $matches );
			if ( !empty( $matches ) ) {
				foreach ( $matches[1] as $id )
					array_push( $images_ids, $id );
			}
		}
		$images_ids = array_unique( $images_ids );
		foreach ( $images_ids as $id ) {
			array_push( $images, array(
				'src' => wp_get_attachment_url( $id ),
				'title' => get_the_title( $id ),
				'alt' => get_post_meta( $id, '_wp_attachment_image_alt', true )
			) );
		}
		return $images;
	}

}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit