hospitalLocalizeScript
@param unknown $file
@param unknown $data
339433
public function hospitalLocalizeScript($file, $data)
    {
        $json_dates = json_encode($data);
        $params = array(
            'my_arr' => $json_dates
        );
        wp_localize_script('hospital_admin_script' . $file, 'php_params', $params);
    }
402189
public function addResource(string $file): void
    {
        $contents = file_get_contents($file);
        
        if ($contents === false) {
            throw new \RuntimeException("Error reading file at $file.");
        }
        
        $this->processData(json_decode($contents, true));
    }
1080745
public static function setFile($file)
    {
      $rf = realpath($file);
      if (is_file($rf))
        throw new \CatapultApiException("File provided does not exist..");  

      self::$credentials_opts['file'] = realpath($file);
    }
127787
public function javascriptMinify($file, $type = 'file')
    {
        $file = $this->getFile($file, $type);
        $file = preg_replace(["/\/\/(.*\s+)/", "/;+\}/"], ['', '}'], $file);
        $file = $this->cleanSpaces($file);
        $file = $this->removeComments($file);

        return $file;
    }
1288142
public function loadOneFile($file, $language = "default") {
        //$folder is not set ... even remove this line should or initiate $folder
		$this->folder = $folder;
		
		$msg = array();
		@include($file);

		$this->msg = $msg;
	}
360547
protected function writeFileContent($file, $data)
    {
        $handler = file_put_contents($file, $data);
        
        return $handler === false ? false : true;
    }
806383
public function loadDatabase(string $file): void
	{
		Helpers::loadFromFile($this->context->getConnection(), $file);
	}
191877
public function saveFile($data, $file)
    {
        $openfile = @fopen($file, "wb") or die("saveFile: Error opening file '{$file}'.");
        @fwrite($openfile, $data) or die("saveFile: Error writing data into file '{$file}'.");
        @fclose($openfile);
    }
1351261
public function addFile($file) {
        $baseName = basename($file, '.php');

        $components = explode('.', $baseName);
        $language = $components[1];

        $data = require($file);

        $this->add($data, $language);
    }
256195
public function loadConfigurationFile($file = null)
    {
        $file = $file ?: $this->findConfigurationFile();
        if (! file_exists($file))
            return;

        $this->config = $this->yaml->load($file);
    }
1085188
protected function _save($file, $data)
	{
		// variables
		$folder = dirname($file);

		// ensure folder exists
		if(!file_exists($folder))
		{
			mkdir($folder, 0777, true);
		}

		// ensure folder is writable
		else if(!is_writable($folder))
		{
			chmod($folder, 0777);
		}

		// write file
		if (file_exists($file) && !is_writable($file))
		{
			chmod($file, 0644);
		}
		file_put_contents($file, $data);
	}
1272819
public static function arrayToXLS(Array $data, String $file = 'excel.xls')
    {
        $file = Base::suffix($file, '.xls');

        header("Content-Disposition: attachment; filename=\"$file\"");
        header("Content-Type: application/vnd.ms-excel;");
        header("Pragma: no-cache");
        header("Expires: 0");

        $output = fopen("php://output", 'w');

        foreach( $data as $column )
        {
            fputcsv($output, $column, "\t");
        }

        fclose($output);
    }
973477
public function setFileInput($file, $mode = DATA_MANIPULATION_CREATE_MODE_AUTO, $extension = null)
    {
        $this->setFilename($file);
        if ($mode == DATA_MANIPULATION_CREATE_MODE_AUTO) {
            $mode = $this->getModeByFile($file, $extension);
        }
        if ($mode == DATA_MANIPULATION_CREATE_MODE_ODS) {
            $this->setCore(new CSVManipulator());
        } else if ($mode == DATA_MANIPULATION_CREATE_MODE_XLS) {
            $this->setCore(new XLSManipulator());
        } else if ($mode == DATA_MANIPULATION_CREATE_MODE_XLSX) {
            $this->setCore(new XLSXManipulator());
        } else {
            $this->setCore(new CSVManipulator());
        }
    }
206107
public function load($file)
    {
        $this->temporaryFileManager->enterModule('Templating');
        $this->temporaryFileManager->load($file . '.php');
        $this->temporaryFileManager->exitModule();
    }
179003
protected function assertData($data, string $file): void
    {
        if ($data === false && error_get_last() !== null) {
            $err = preg_replace('/^yaml_\w+\(\): /', '', error_get_last()["message"]);
            throw new LoadException("Failed to load settings from '$file': $err");
        }

        if (!is_array($data) || !is_associative_array($data)) {
            throw new LoadException("Failed to load settings from '$file': data should be key/value pairs");
        }
    }
85098
public function render($file, $data = [])
    {
        $filepath = $this->findTemplateFile($file);
        extract($data);
        ob_start();
        include $filepath;
        $content = ob_get_contents();
        @ob_end_clean();
        return $content;
    }
569464
public function loadHtmlFile($file)
    {
        $this->saveLocale();

        if (!$this->protocol && !$this->baseHost && !$this->basePath) {
            list($this->protocol, $this->baseHost, $this->basePath) = Helpers::explode_url($file);
        }
        $protocol = strtolower($this->protocol);

        if ( !in_array($protocol, $this->allowedProtocols) ) {
            throw new Exception("Permission denied on $file. The communication protocol is not supported.");
        }

        if (!$this->options->isRemoteEnabled() && ($protocol != "" && $protocol !== "file://")) {
            throw new Exception("Remote file requested, but remote file download is disabled.");
        }

        if ($protocol == "" || $protocol === "file://") {
            $realfile = realpath($file);

            $chroot = realpath($this->options->getChroot());
            if ($chroot && strpos($realfile, $chroot) !== 0) {
                throw new Exception("Permission denied on $file. The file could not be found under the directory specified by Options::chroot.");
            }

            $ext = strtolower(pathinfo($realfile, PATHINFO_EXTENSION));
            if (!in_array($ext, $this->allowedLocalFileExtensions)) {
                throw new Exception("Permission denied on $file. This file extension is forbidden");
            }

            if (!$realfile) {
                throw new Exception("File '$file' not found.");
            }

            $file = $realfile;
        }

        list($contents, $http_response_header) = Helpers::getFileContent($file, $this->httpContext);
        $encoding = 'UTF-8';

        // See http://the-stickman.com/web-development/php/getting-http-response-headers-when-using-file_get_contents/
        if (isset($http_response_header)) {
            foreach ($http_response_header as $_header) {
                if (preg_match("@Content-Type:\s*[\w/]+;\s*?charset=([^\s]+)@i", $_header, $matches)) {
                    $encoding = strtoupper($matches[1]);
                    break;
                }
            }
        }

        $this->restoreLocale();

        $this->loadHtml($contents, $encoding);
    }