Server IP : 66.29.132.122 / Your IP : 3.135.216.170 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 : |
import { useState, useEffect } from '@wordpress/element'; var pagelayer_posts_data = {}; var pagelayer_ajax_data = {}; export const RenderArchivePostsBlock = (props) => { const { _props, pl_props, tag, data } = props; const { id, atts } = data; const { attributes } = _props; const [response, setResponse] = useState(''); useEffect(() => { var post = {}; // All atts post['atts'] = JSON.parse(JSON.stringify(atts)); post['atts']['pagelayer-id'] = id; post['pagelayer_nonce'] = pagelayer_ajax_nonce; if (pagelayer_empty(pagelayer_posts_data) || !pagelayer_compare_object(pagelayer_posts_data, post) || pagelayer_empty(pagelayer_ajax_data[id])) { pagelayer_posts_data = post; jQuery.ajax({ url: pagelayer_ajax_url + 'action=pagelayer_archive_posts_data', type: 'post', data: post, success: function (data) { var d = jQuery(data) d.children('style').remove(); var html = d.html(); setResponse(html) pagelayer_ajax_data[id] = html; } }); }else{ setResponse( pagelayer_ajax_data[id]) } }, [attributes]) return ( <div dangerouslySetInnerHTML={{__html: response}} /> ) }