Skip to content

Commit

Permalink
(#33) update some global functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Jun 28, 2023
1 parent a4cc523 commit 25a8ac7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions common/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,31 @@ function urlencoded_message(string $message): array|string
}
}

if (!function_exists('get_template')) {
/**
* Get template
*
* @param string $partialPath
* @param array $data
* @return bool|string
*/
function get_template(string $partialPath, array $data = []): bool|string
{
return (new ConfigHelper())->getTemplateData($partialPath, $data);
}
}

if (!function_exists('get_event_template')) {
/**
* Get event template
*
* @param string $partialPath
* @param array $data
* @return bool|string
*/
function get_event_template(string $partialPath, array $data = []): bool|string
{
return (new ConfigHelper())->getEventTemplate('events/' . $partialPath, $data);
return (new ConfigHelper())->getTemplateData('events/' . $partialPath, $data);
}
}

Expand All @@ -69,6 +85,6 @@ function get_event_template(string $partialPath, array $data = []): bool|string
*/
function get_tool_template(string $partialPath, array $data = []): bool|string
{
return (new ConfigHelper())->getEventTemplate('tools/' . $partialPath, $data);
return (new ConfigHelper())->getTemplateData('tools/' . $partialPath, $data);
}
}
2 changes: 1 addition & 1 deletion src/Helpers/ConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function execConfig(string $string): mixed
* @param array $data
* @return bool|string
*/
public function getEventTemplate($partialPath, array $data = []): bool|string
public function getTemplateData($partialPath, array $data = []): bool|string
{
$viewPathFile = self::VIEW_PATH . '/' . str_replace('.', '/', $partialPath) . '.php';

Expand Down

0 comments on commit 25a8ac7

Please sign in to comment.