[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: parser.php
<?php namespace Elementor\Modules\Interactions; use Elementor\Modules\AtomicWidgets\Utils\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Parser { protected $post_id; protected $ids_lookup = []; public function __construct( $post_id ) { $this->post_id = $post_id; } public function assign_interaction_ids( $data ) { if ( isset( $data['elements'] ) && is_array( $data['elements'] ) ) { $data['elements'] = $this->process_interactions_for( $data['elements'] ); } return $data; } private function process_interactions_for( $elements ) { if ( ! is_array( $elements ) ) { return $elements; } foreach ( $elements as &$element ) { if ( isset( $element['interactions'] ) ) { $element['interactions'] = $this->maybe_assign_interaction_ids( $element['interactions'], $element['id'] ); } if ( isset( $element['elements'] ) && is_array( $element['elements'] ) ) { $element['elements'] = $this->process_interactions_for( $element['elements'] ); } } return $elements; } private function maybe_assign_interaction_ids( $interactions_json, $element_id ) { $interactions = $this->decode_interactions( $interactions_json ); if ( ! isset( $interactions['items'] ) ) { return []; } foreach ( $interactions['items'] as &$interaction ) { if ( ! isset( $interaction['$$type'] ) || 'interaction-item' !== $interaction['$$type'] ) { continue; } $existing_id = null; if ( isset( $interaction['value']['interaction_id']['value'] ) ) { $existing_id = $interaction['value']['interaction_id']['value']; } if ( $existing_id && $this->is_temp_id( $existing_id ) ) { $interaction['value']['interaction_id'] = [ '$$type' => 'string', 'value' => $this->get_next_interaction_id( $element_id ), ]; } elseif ( $existing_id ) { $this->ids_lookup[] = $existing_id; } else { $interaction['value']['interaction_id'] = [ '$$type' => 'string', 'value' => $this->get_next_interaction_id( $element_id ), ]; } } return wp_json_encode( $interactions ); } private function is_temp_id( $id ) { return is_string( $id ) && strpos( $id, 'temp-' ) === 0; } private function decode_interactions( $interactions ) { if ( is_array( $interactions ) ) { return $interactions; } if ( is_string( $interactions ) ) { $decoded = json_decode( $interactions, true ); if ( json_last_error() === JSON_ERROR_NONE && is_array( $decoded ) ) { return $decoded; } } return [ 'items' => [], 'version' => 1, ]; } protected function get_next_interaction_id( $prefix ) { $next_id = Utils::generate_id( "{$this->post_id}-{$prefix}-", $this->ids_lookup ); $this->ids_lookup[] = $next_id; return $next_id; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium707.web-hosting.com
Server IP: 198.177.120.115
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux premium707.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: 97.87 GB
HDD Free: 76.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:
Yes
pkexec:
No
git:
Yes
User Info
Username: urbaoubp
User ID (UID): 1252
Group ID (GID): 1257
Script Owner UID: 1252
Current Dir Owner: 1252