Server IP : 85.214.239.14 / Your IP : 3.15.218.44 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 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 : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/wordpress/wp-content/plugins/really-simple-ssl/settings/src/Modal/ |
Upload File : |
import { __ } from '@wordpress/i18n'; import * as rsssl_api from "../utils/api"; import Icon from "../utils/Icon"; import useModal from "./ModalData"; import {useState} from '@wordpress/element'; const Modal = (props) => { const {handleModal, modalData, setModalData, showModal, setIgnoredItemId, setFixedItemId, item} = useModal(); const [buttonsDisabled, setButtonsDisabled] = useState(false); const dismissModal = () => { handleModal(false, null, null); } const handleFix = (e, type) => { //set to disabled let action = modalData.action; setButtonsDisabled(true); rsssl_api.runTest(action, 'refresh', modalData ).then( ( response ) => { let data = {...modalData}; data.description = response.msg; data.subtitle = ''; setModalData(data); setButtonsDisabled(false); if (response.success) { if (type==='ignore' && item !==false ) { setIgnoredItemId(item.id); } else { setFixedItemId(item.id); } handleModal(false, null); } }); } if (!showModal) { return (<></>); } let disabled = buttonsDisabled ? 'disabled' : ''; let description = modalData.description; if ( !Array.isArray(description) ) { description = [description]; } return ( <div> <div className="rsssl-modal-backdrop" onClick={ (e) => dismissModal(e) }> </div> <div className="rsssl-modal" id="{id}"> <div className="rsssl-modal-header"> <h2 className="modal-title"> {modalData.title} </h2> <button type="button" className="rsssl-modal-close" data-dismiss="modal" aria-label="Close" onClick={ (e) => dismissModal(e) }> <Icon name='times' /> </button> </div> <div className="rsssl-modal-content"> { modalData.subtitle && <div className="rsssl-modal-subtitle">{modalData.subtitle}</div>} { Array.isArray(description) && description.map((s, i) => <div key={"modalDescription-"+i} className="rsssl-modal-description">{s}</div>) } </div> <div className="rsssl-modal-footer"> { modalData.edit && <a href={modalData.edit} target="_blank" rel="noopener noreferrer" className="button button-secondary">{__("Edit", "really-simple-ssl")}</a>} { modalData.help && <a href={modalData.help} target="_blank" rel="noopener noreferrer" className="button rsssl-button-help">{__("Help", "really-simple-ssl")}</a>} { (!modalData.ignored && modalData.action==='ignore_url') && <button disabled={disabled} className="button button-primary" onClick={ (e) => handleFix(e, 'ignore') }>{ __("Ignore", "really-simple-ssl")}</button>} { modalData.action!=='ignore_url' && <button disabled={disabled} className="button button-primary" onClick={ (e) => handleFix(e, 'fix') }>{__("Fix", "really-simple-ssl")}</button> } </div> </div> </div> ) } export default Modal;