mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Create getClassName(), update renderTemplate()
This commit is contained in:
parent
2ec0738455
commit
3af68ca9a9
@ -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…
x
Reference in New Issue
Block a user