Admin
2 months ago
Builder
2 months ago
Customizer
2 months ago
Exceptions
2 months ago
Helpers
2 months ago
Integrations
2 months ago
Migrations
2 months ago
ReviewAlerts
2 months ago
Services
2 months ago
Settings
2 months ago
Support
2 months ago
Traits
2 months ago
Utils
2 months ago
AuthorizationStatusCheck.php
2 months ago
BusinessDataCache.php
2 months ago
Clear_Cache.php
2 months ago
Container.php
2 months ago
DisplayElements.php
2 months ago
Email_Notification.php
2 months ago
Error_Reporter.php
2 months ago
Feed.php
2 months ago
FeedCache.php
2 months ago
FeedCacheUpdater.php
2 months ago
FeedDisplay.php
2 months ago
Feed_Locator.php
2 months ago
Parser.php
2 months ago
PostAggregator.php
2 months ago
RemoteRequest.php
2 months ago
SBR_Education.php
2 months ago
SBR_Settings.php
2 months ago
ServiceContainer.php
2 months ago
SinglePostCache.php
2 months ago
TemplateRenderer.php
2 months ago
Tooltip_Wizard.php
2 months ago
Util.php
2 months ago
TemplateRenderer.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SmashBalloon\Reviews\Common; |
| 4 | |
| 5 | class TemplateRenderer { |
| 6 | /** |
| 7 | * Base file path of the templates |
| 8 | * |
| 9 | * @since 1.0 |
| 10 | */ |
| 11 | public const BASE_PATH = SBR_PLUGIN_DIR . 'templates/'; |
| 12 | |
| 13 | /** |
| 14 | * Render template |
| 15 | * |
| 16 | * @param string $file |
| 17 | * @param array $data |
| 18 | * |
| 19 | * @since 1.0 |
| 20 | */ |
| 21 | public static function render($file, $data = array()) |
| 22 | { |
| 23 | $file = str_replace('.', '/', $file); |
| 24 | $file = self::BASE_PATH . $file . '.php'; |
| 25 | |
| 26 | if (is_file($file)) { |
| 27 | if (! empty($data)) { |
| 28 | extract($data); |
| 29 | } |
| 30 | include_once $file; |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 |