HEX
Server: LiteSpeed
System: Linux premium263.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: eastcjee (525)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/ninja-forms/includes/Factories/ConstructNfSiteEntity.php
<?php

namespace NinjaForms\Includes\Factories;

use NinjaForms\Includes\Entities\NfSite;

class ConstructNfSiteEntity
{

    /**
     * Return constructed site entity
     *
     * @return NfSite
     */
    public function handle(): NfSite
    {
        $array = $this->constructSiteVariableArray();

        $return = NfSite::fromArray($array);

        return $return;
    }

    /**
     * Construct site variable array
     *
     * @return array
     */
    protected function constructSiteVariableArray(): array
    {
        $ip_address = '';
        if ( array_key_exists( 'SERVER_ADDR', $_SERVER ) ) {
            $ip_address = $_SERVER[ 'SERVER_ADDR' ];
        } else if ( array_key_exists( 'LOCAL_ADDR', $_SERVER ) ) {
            $ip_address = $_SERVER[ 'LOCAL_ADDR' ];
        }

        $return = array(
            'url'           => site_url(),
            'ip_address'    => $ip_address
        );

        return $return;
    }
}