PluginProbe
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager / 10
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager v10
10.56 1.2.1 10 10.1 10.2 10.3 10.31 10.32 10.33 10.34 10.50 10.51 10.52 10.53 10.55 9.0 9.0.1 9.4 trunk 1.0.0 1.1 1.2
easy-code-manager / framework / html / component.class.php

component.class.php in FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager 10, at framework/html/component.class.php

94 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 // No direct access allowed.
7 defined('ABSPATH') or die("Access denied");
8
9 /**
10 *
11 */
12 abstract class HTMLComponent {
13
14 /**
15 *
16 */
17 const DEFAULT_TEMPLATE_DIR = 'tmpl';
18
19 /**
20 *
21 */
22 const DEFAULT_TEMPLATE_EXTENSION = 'html.tmpl';
23
24 /**
25 * put your comment there...
26 *
27 * @var mixed
28 */
29 protected $componentFile = null;
30
31 /**
32 * put your comment there...
33 *
34 * @var mixed
35 */
36 protected $templatesDir = null;
37
38 /**
39 * put your comment there...
40 *
41 * @var mixed
42 */
43 protected $templateFileExtension = null;
44
45 /**
46 * put your comment there...
47 *
48 * @param mixed $file
49 * @return HTMLComponent
50 */
51 protected function __construct($file, $templatesDir = self::DEFAULT_TEMPLATE_DIR, $templateFileExtension = self::DEFAULT_TEMPLATE_EXTENSION) {
52 // Intialize object vars.
53 $this->componentFile = $file;
54 $this->templatesDir = $templatesDir;
55 $this->templateFileExtension = $templateFileExtension;
56 }
57
58 /**
59 * put your comment there...
60 *
61 */
62 public abstract function __toString();
63
64 /**
65 * put your comment there...
66 *
67 * @param mixed $basePath
68 * @param mixed $baseURI
69 * @param mixed $path
70 */
71 public function getURI($basePath, $baseURI, $path = '') {
72 // Build path to the component file.
73 $pathToComponent = str_replace($basePath, '', dirname($this->componentFile));
74 // Build component resource URI.
75 $resourceURI = "{$baseURI}{$pathToComponent}/public/{$path}";
76 return $resourceURI;
77 }
78
79 /**
80 * put your comment there...
81 *
82 * @param mixed $name
83 */
84 public function getTemplate($name) {
85 $templatePath = dirname($this->componentFile);
86 // Get content into alternate output buffer.
87 ob_start();
88 // Import template file.
89 require "{$templatePath}/{$this->templatesDir}/{$name}.{$this->templateFileExtension}";
90 // Return content.
91 return ob_get_clean();
92 }
93
94 } // End class.