| Server IP : 89.248.107.232 / Your IP : 216.73.217.70 Web Server : Apache System : Linux host2.kasilh.com 5.14.0-687.36.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 7 05:40:49 EDT 2026 x86_64 User : seg ( 10005) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/seg-sa.es/iticsl.com/wp-content/plugins/wp-gdpr-compliance/Utils/ |
Upload File : |
<?php
namespace WPGDPRC\Utils;
use WPGDPRC\WordPress\Plugin;
/**
* Class Template
* @package WPGDPRC\Utils
*/
class Template {
/**
* Renders the template file
* @param string $path
* @param array $args
*/
public static function render( $path = '', $args = [] ) {
$path = Plugin::getTemplatesDir() . $path;
if ( ! Helper::endsWith( $path, '.php' ) ) {
$path .= '.php';
}
self::includePath( $path, $args );
}
/**
* Gets the content of the rendered template file
* @param string $path
* @param array $args
* @return string
*/
public static function get( $path = '', $args = [] ) {
ob_start();
static::render( $path, $args );
return ob_get_clean();
}
/**
* Renders the svg file
* @param string $path
*/
public static function renderSvg( $path = '' ) {
self::includePath( Plugin::getSvgDir() . $path );
}
/**
* Gets the content of the rendered svg file
* @param string $path
* @param bool $inline
* @return string
*/
public static function getSvg( $path = '', $inline = false ) {
ob_start();
static::renderSvg( $path );
return ob_get_clean();
}
/**
* Render fa icon.
*
* @param $icon
* @param string $sprite
*/
public static function renderIcon( $icon, $sprite = 'fontawesome-pro-light' ) {
self::includePath(
Plugin::getTemplatesDir() . 'Common/icon.php',
[
'sprite' => $sprite,
'icon' => $icon,
]
);
}
/**
* Gets the content of the icon
* @param string $path
* @param bool $inline
* @return string
*/
public static function getIcon( $icon, $sprite = 'fontawesome-pro-light' ) {
ob_start();
static::renderIcon( $icon, $sprite );
return ob_get_clean();
}
/**
* @param string $path
* @param array $args
*/
public static function includePath( $path = '', $args = [] ) {
if ( ! is_readable( $path ) ) {
if ( ! is_user_logged_in() ) {
return;
}
wp_die( 'Could not find or read file at: ' . esc_html( $path ) );
}
extract( $args );
/** @noinspection PhpIncludeInspection */
include $path;
}
}