Server IP : 103.119.228.120 / Your IP : 3.14.249.124 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components/ |
Upload File : |
import { LabelControl } from './label'; import { useState } from '@wordpress/element'; var pagelayer_icons = {}; export const IconControl = (props) => { const { prop, value, setAttributes } = props; const { name } = prop['c']; const [curIconSet, setCurIconSet] = useState(pagelayer_loaded_icons[0]); const [showIconsList, setShowIconsList] = useState(false); const [searchText, setSearchText] = useState(''); const [activeTabs, setActiveTabs] = useState({ fas: true, far: false, fab: false, }); var sel_name = value; // Handle the icon name if(sel_name){ var icon_name = sel_name.split(' fa-'); sel_name = icon_name[1]; } const handleIconSetChange = (event) => { setCurIconSet(event.target.value); }; const handleTabClick = (tab) => { setActiveTabs((prevTabs) => ({ ...prevTabs, [tab]: !prevTabs[tab], })); }; const handleSearchInputChange = (event) => { setSearchText(event.target.value); }; const handleIconClick = (event) => { setAttributes({ [name]: event.currentTarget.children[0].getAttribute('class')}); }; const handleIconClose = () => { setAttributes({ [name] : ''}); }; const iconHtml = (name, cat) => ( <span className="pagelayer-elp-icon-span" onClick={handleIconClick}> <i className={`${cat} fa-${name}`} icon={name}></i> {name} </span> ); var allowed_icons = {}; // Is there a specific list if( 'list' in prop && prop.list.length > 0){ for(var i in pagelayer_icons){ allowed_icons[i] = {}; for(var j in pagelayer_icons[i]){ allowed_icons[i][j] = {}; var list_icons = []; prop.list.forEach(function(item){ if(pagelayer_icons[i][j]['icons'].includes(item)){ list_icons.push(item); } }); allowed_icons[i][j]['icons'] = list_icons; allowed_icons[i][j]['pre'] = j; } } }else{ allowed_icons = pagelayer_icons; } return ( <div className="components-base-control pagelayer-base-control"> <LabelControl {...props}/> <div className="pagelayer-elp-icon-div" onClick={() => {setShowIconsList(!showIconsList)}}> <div className="pagelayer-elp-icon-preview"> <i className={value}></i> <span className="pagelayer-elp-icon-name"> {value ? sel_name : 'Choose icon'} </span> </div> <span className="pagelayer-elp-icon-open" onClick={() => setShowIconsList(!showIconsList)} >▼</span> <span className="pagelayer-elp-icon-close" style={{ display: value ? 'block' : 'none' }} onClick={handleIconClose} > <b>× </b> </span> </div> { showIconsList && ( <div className="pagelayer-elp-icon-selector"> {pagelayer_loaded_icons.length > 1 && ( <select className="pagelayer-elp-icon-sets" onChange={handleIconSetChange} value={curIconSet} > {pagelayer_loaded_icons.map((item) => ( <option key={item} value={item}> {item} </option> ))} </select> )} <span className="pagelayer-elp-icon-type"> <p onClick={() => handleTabClick('fas')} className={activeTabs.fas ? 'active' : ''} > {'Solid'} </p> <p onClick={() => handleTabClick('far')} className={activeTabs.far ? 'active' : ''} > {'Regular'} </p> <p onClick={() => handleTabClick('fab')} className={activeTabs.fab ? 'active' : ''} > {'Brand'} </p> </span> <input type="text" className="pagelayer-elp-search-icon" name="search-icon" placeholder={'search'} value={searchText} onChange={handleSearchInputChange} /> <div className="pagelayer-elp-icon-list"> {Object.keys(allowed_icons[curIconSet]).map((y) => { if(!(y in activeTabs) || pagelayer_empty(activeTabs[y])){ return; } return allowed_icons[curIconSet][y]['icons'] .filter((item) => item.includes(searchText.toLowerCase()) || searchText.length < 1) .map((z) => iconHtml(z, y)); })} </div> </div> )} </div> ); } // Function to fetch and store data function pagelayer_get_stored_data(url, version){ const name = 'pagelayer_' + url; let data = {}; let force = false; // Try to parse the data try { data = JSON.parse(localStorage.getItem(name)); if (data['version'] !== version) { force = true; } } catch (e) { force = true; } // Force download if (force) { jQuery.ajax({ url: url, type: 'GET', dataType: 'text', success: function (newData) { data = { version: version, val: newData, }; localStorage.setItem(name, JSON.stringify(data)); }, }); } return data['val']; } // Load Fonts wp.domReady(function () { pagelayer_loaded_icons.forEach((item) => { jQuery.when( pagelayer_get_stored_data(pagelayer_url + '/fonts/' + item + '.json', pagelayer_ver)) .then(() => { pagelayer_icons[item] = JSON.parse(pagelayer_get_stored_data( pagelayer_url + '/fonts/' + item + '.json', pagelayer_ver) ); }); }); });