[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: plugins.js
'use strict'; const { visit } = require('../xast.js'); /** * Plugins engine. * * @module plugins * * @param {Object} ast input ast * @param {Object} info extra information * @param {Array} plugins plugins object from config * @return {Object} output ast */ const invokePlugins = (ast, info, plugins, overrides, globalOverrides) => { for (const plugin of plugins) { const override = overrides == null ? null : overrides[plugin.name]; if (override === false) { continue; } const params = { ...plugin.params, ...globalOverrides, ...override }; if (plugin.type === 'perItem') { ast = perItem(ast, info, plugin, params); } if (plugin.type === 'perItemReverse') { ast = perItem(ast, info, plugin, params, true); } if (plugin.type === 'full') { if (plugin.active) { ast = plugin.fn(ast, params, info); } } if (plugin.type === 'visitor') { if (plugin.active) { const visitor = plugin.fn(ast, params, info); if (visitor != null) { visit(ast, visitor); } } } } return ast; }; exports.invokePlugins = invokePlugins; /** * Direct or reverse per-item loop. * * @param {Object} data input data * @param {Object} info extra information * @param {Array} plugins plugins list to process * @param {boolean} [reverse] reverse pass? * @return {Object} output data */ function perItem(data, info, plugin, params, reverse) { function monkeys(items) { items.children = items.children.filter(function (item) { // reverse pass if (reverse && item.children) { monkeys(item); } // main filter let kept = true; if (plugin.active) { kept = plugin.fn(item, params, info) !== false; } // direct pass if (!reverse && item.children) { monkeys(item); } return kept; }); return items; } return monkeys(data); } const createPreset = ({ name, plugins }) => { return { name, type: 'full', fn: (ast, params, info) => { const { floatPrecision, overrides } = params; const globalOverrides = {}; if (floatPrecision != null) { globalOverrides.floatPrecision = floatPrecision; } if (overrides) { for (const [pluginName, override] of Object.entries(overrides)) { if (override === true) { console.warn( `You are trying to enable ${pluginName} which is not part of preset.\n` + `Try to put it before or after preset, for example\n\n` + `plugins: [\n` + ` {\n` + ` name: 'preset-default',\n` + ` },\n` + ` 'cleanupListOfValues'\n` + `]\n` ); } } } return invokePlugins(ast, info, plugins, overrides, globalOverrides); }, }; }; exports.createPreset = createPreset;
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.7 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:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002