mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 15:10:22 +00:00
Create getClassName(), update renderTemplate()
This commit is contained in:
parent
2ec0738455
commit
3af68ca9a9
1 changed files with 14 additions and 3 deletions
|
@ -542,11 +542,15 @@ function ConvertToSecurity($security)
|
|||
/**
|
||||
* Renders a simple PHP template
|
||||
*/
|
||||
function renderTemplate($name, $__template_data = [])
|
||||
function renderTemplate($name, $__template_data = [], $pluginName = null)
|
||||
{
|
||||
$file = realpath(dirname(__FILE__) . "/../templates/$name.php");
|
||||
if (isset($pluginName)) {
|
||||
$file = realpath(dirname(__FILE__) . "/../plugins/$pluginName/templates/$name.php");
|
||||
} else {
|
||||
$file = realpath(dirname(__FILE__) . "/../templates/$name.php");
|
||||
}
|
||||
if (!file_exists($file)) {
|
||||
return "template $name ($file) not found";
|
||||
return "<br>template $name ($file) not found";
|
||||
}
|
||||
|
||||
if (is_array($__template_data)) {
|
||||
|
@ -1029,3 +1033,10 @@ function renderStatus($hostapd_led, $hostapd_status, $memused_led, $memused, $cp
|
|||
<?php
|
||||
}
|
||||
|
||||
// Returns a classname without its associated namespace
|
||||
function getClassName($class)
|
||||
{
|
||||
if ($pos = strrpos($class, '\\')) return substr($class, $pos + 1);
|
||||
return $pos;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue