HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/appointmentbook.me/wp-content/plugins/booknetic/app/Providers/Core/FrontendAjax.php
<?php

namespace BookneticApp\Providers\Core;

use BookneticApp\Providers\Core\Frontend;
use BookneticApp\Providers\Helpers\Helper;

class FrontendAjax
{

	final protected function view( $name, $parameters = [], $response_data = [] )
	{
		$viewsPath	= Frontend::VIEW_DIR . str_replace('.', DIRECTORY_SEPARATOR, basename( $name )) . '.php';

		// check if called view exists
		if( ! file_exists( $viewsPath ) )
		{
            if( file_exists( $name ) )
            {
                $viewsPath = $name;
            }
            else
            {
                return $this->response( false, htmlspecialchars( $name ) . ' - view not exists!' );
            }
		}

		ob_start();
		require $viewsPath;
		$viewOutput = ob_get_clean();

		$response_data['html'] = htmlspecialchars( $viewOutput );

		return $this->response( true, $response_data );
	}

	final protected function response( $status , $arr = [] )
	{
		return Helper::response( $status , $arr, true );
	}


}