Admin
3 weeks ago
Builder
3 weeks ago
Customizer
3 weeks ago
Exceptions
3 weeks ago
Helpers
3 weeks ago
Integrations
3 weeks ago
Migrations
3 weeks ago
ReviewAlerts
3 weeks ago
Services
3 weeks ago
Settings
3 weeks ago
Support
3 weeks ago
Traits
3 weeks ago
Utils
3 weeks ago
AuthorizationStatusCheck.php
3 weeks ago
BusinessDataCache.php
3 weeks ago
Clear_Cache.php
3 weeks ago
Container.php
3 weeks ago
DisplayElements.php
3 weeks ago
Email_Notification.php
3 weeks ago
Error_Reporter.php
3 weeks ago
Feed.php
3 weeks ago
FeedCache.php
3 weeks ago
FeedCacheUpdater.php
3 weeks ago
FeedDisplay.php
3 weeks ago
Feed_Locator.php
3 weeks ago
Parser.php
3 weeks ago
PostAggregator.php
3 weeks ago
RemoteRequest.php
3 weeks ago
SBR_Education.php
3 weeks ago
SBR_Schema_Service.php
3 weeks ago
SBR_Settings.php
3 weeks ago
ServiceContainer.php
3 weeks ago
SinglePostCache.php
3 weeks ago
TemplateRenderer.php
3 weeks ago
Tooltip_Wizard.php
3 weeks ago
Util.php
3 weeks 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 |