| Server IP : 186.64.123.29 / Your IP : 216.73.217.94 Web Server : LiteSpeed System : Linux house.hostinglat.cl 5.15.0-185-generic #195-Ubuntu SMP Fri Jun 19 17:11:50 UTC 2026 x86_64 User : tuemp9827 ( 1016) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/tuempresavirtual.cl/public_html/wp-content/plugins/webp-express/lib/classes/ |
Upload File : |
<?php
namespace WebPExpress;
use \WebPExpress\PathHelper;
class ImageRoot
{
public $id;
private $imageRootDef;
/**
* Constructor.
*
* @param array $imageRootDef assoc array containing "id", "url" and either "abs-path", "rel-path" or both.
*/
public function __construct($imageRootDef)
{
$this->imageRootDef = $imageRootDef;
$this->id = $imageRootDef['id'];
}
/**
* Get / calculate abs path.
*
* If "rel-path" is set and document root is available, the abs path will be calculated from the relative path.
* Otherwise the "abs-path" is returned.
* @throws Exception In case rel-path is not
*/
public function getAbsPath()
{
$def = $this->imageRootDef;
if (isset($def['rel-path']) && PathHelper::isDocRootAvailable()) {
return rtrim($_SERVER["DOCUMENT_ROOT"], '/') . '/' . $def['rel-path'];
} elseif (isset($def['abs-path'])) {
return $def['abs-path'];
} else {
if (!isset($def['rel-path'])) {
throw new \Exception(
'Image root definition in config file is must either have a "rel-path" or "abs-path" property defined. ' .
'Probably your system setup has changed. Please re-save WebP Express options and regenerate .htaccess'
);
} else {
throw new \Exception(
'Image root definition in config file is defined by "rel-path". However, DOCUMENT_ROOT is unavailable so we ' .
'cannot use that (as the rel-path is relative to that. ' .
'Probably your system setup has changed. Please re-save WebP Express options and regenerate .htaccess'
);
}
}
}
}