GRAYBYTE WORDPRESS FILE MANAGER1393

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/nioscentre.in/wp-content/plugins/elementskit-lite/widgets/lottie/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/nioscentre.in/wp-content/plugins/elementskit-lite/widgets/lottie//json-handler.php
<?php

namespace ElementsKit_Lite;

defined('ABSPATH') || exit;

class ElementsKit_Json_Handler {

	const MIME_TYPE = 'application/json';
	const EXT = 'json';


	/**
	 * The plugin instance.
	 */
	public static $instance = null;


	/**
	 * constructor function.
	 */
	public function __construct() {
		add_filter('upload_mimes', array($this, 'upload_mimes'));
		add_filter('wp_handle_upload_prefilter', array($this, 'wp_handle_upload_prefilter'));
		add_filter('wp_check_filetype_and_ext', array($this, 'wp_check_filetype_and_ext'), 10, 4);
	}


	/**
	 * Adds json file format
	 */
	public function upload_mimes($allowed_types) {
		$allowed_types[self::EXT] = self::MIME_TYPE;

		return $allowed_types;
	}


	public function wp_handle_upload_prefilter($file) {
		if(self::MIME_TYPE !== $file['type']) {
			return $file;
		}

		$ext = pathinfo($file['name'], PATHINFO_EXTENSION);

		if(self::EXT !== $ext) {
			$file['error'] = sprintf('%1a %2s $3s',
				esc_html__('The uploaded', 'elementskit-lite'),
				$file['name'],
				esc_html__('file is not supported. Please upload a valid JSON file', 'elementskit-lite'),
			);

			return $file;
		}

		return $file;
	}


	public function wp_check_filetype_and_ext($data, $file, $filename, $mimes) {
		if(!empty($data['ext']) && !empty($data['type'])) {
			return $data;
		}

		$filetype = wp_check_filetype($filename, $mimes);

		if(self::EXT === $filetype['ext']) {
			$data['ext']  = self::EXT;
			$data['type'] = self::MIME_TYPE;
		}

		return $data;
	}


	/**
	 * Instance.
	 */
	public static function instance() {
		if(is_null(self::$instance)) {
			// Fire when ElementsKit_Lite instance.
			self::$instance = new self();
		}

		return self::$instance;
	}
}

// Run the instance.
ElementsKit_Json_Handler::instance();

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
June 25 2025 08:35:10
giriqfky / giriqfky
0755
assets
--
June 25 2025 08:35:10
giriqfky / giriqfky
0755
json-handler.php
1.728 KB
November 28 2023 17:47:40
giriqfky / giriqfky
0644
lottie-handler.php
0.857 KB
January 17 2023 10:06:26
giriqfky / giriqfky
0644
lottie.php
14.986 KB
August 12 2024 16:02:26
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF