Traits
1 month ago
CTF_About_Us.php
1 month ago
CTF_Admin_Notices.php
1 month ago
CTF_Cache_Handler.php
1 month ago
CTF_Global_Settings.php
1 month ago
CTF_HTTP_Request.php
1 month ago
CTF_New_User.php
1 month ago
CTF_Notifications.php
1 month ago
CTF_Response.php
1 month ago
CTF_Support.php
1 month ago
CTF_Upgrader.php
1 month ago
CTF_View.php
1 month ago
PluginSilentUpgrader.php
1 month ago
PluginSilentUpgraderSkin.php
1 month ago
SB_Twitter_Cache.php
1 month ago
addon-functions.php
1 month ago
class-install-skin.php
1 month ago
CTF_View.php
44 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class CFF_View |
| 4 | * |
| 5 | * This class loads view page template files on the admin dashboard area. |
| 6 | * |
| 7 | * @since 2.0 |
| 8 | */ |
| 9 | namespace TwitterFeed\Admin; |
| 10 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 11 | |
| 12 | class CTF_View { |
| 13 | |
| 14 | /** |
| 15 | * Base file path of the templates |
| 16 | * |
| 17 | * @since 2.0 |
| 18 | */ |
| 19 | const BASE_PATH = CTF_PLUGIN_DIR . 'admin/views/'; |
| 20 | |
| 21 | public function __construct() { |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Render template |
| 26 | * |
| 27 | * @param string $file |
| 28 | * @param array $data |
| 29 | * |
| 30 | * @since 2.0 |
| 31 | */ |
| 32 | public static function render( $file, $data = array() ) { |
| 33 | $file = str_replace( '.', '/', $file ); |
| 34 | $file = self::BASE_PATH . $file . '.php'; |
| 35 | |
| 36 | if ( file_exists( $file ) ) { |
| 37 | // Use EXTR_SKIP to prevent overwriting existing variables for security |
| 38 | if ( $data !== null && ! empty( $data ) ) { |
| 39 | extract( $data, EXTR_SKIP ); |
| 40 | } |
| 41 | include_once $file; |
| 42 | } |
| 43 | } |
| 44 | } |