MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mbasepainter.class
Ir para a documentação deste ficheiro.
1<?php
7{
8 private static $count;
9 // ----------------------------------------------------------------------
10 // Generate methods
11 // ----------------------------------------------------------------------
12
13 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 # A helper function, which generates an array of theme elements.
15 # This function is called recursively, when an array elements
16 # contains another array.
17 #----------------------------------------------------------------------
29 function GenerateElements($elements, $separator = '', $method = 'Generate')
30 {
31 if (is_array($elements))
32 {
33 foreach ($elements as $e)
34 {
35 $this->GenerateElements($e, $separator);
36 }
37 }
38 else if (is_object($elements))
39 {
40 if (method_exists($elements, 'generate'))
41 {
42 if ($html = $elements->$method())
43 {
44 $this->GenerateElements($html, $separator);
45 }
46 else
47 echo $separator;
48 }
49 else
50 {
51 echo "BasePainter Error: Method Generate not defined to " . get_class($elements);
52 }
53 }
54 else if ($elements)
55 {
56 echo $elements . $separator;
57 }
58 }
59
60 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61 # Convenience function to capture the output of an element's
62 # <code>Generate</code> function as HTML string.
63 #----------------------------------------------------------------------
74 function GenerateToString($element, $separator = '')
75 {
76 $html = null;
77 /*
78 echo 'a'; echo '#'.gettype($element).'#';
79 ob_start();
80 echo 'a'; echo '{'.gettype($element).'}';
81 $this->GenerateElements($element, $separator);
82 $html = ob_get_contents();
83 ob_end_clean();
84 return $html;
85 */
86 if (is_array($element))
87 {
88 foreach ($element as $e)
89 {
90 $html .= $this->GenerateToString($e, $separator);
91 }
92 }
93 elseif (is_object($element))
94 {
95 if ( method_exists($element, 'generate') )
96 {
98
99 if ( MUtil::getBooleanValue( $MIOLO->getConf('options.loading.show') ) &&
100 MUtil::getBooleanValue( $MIOLO->getConf('options.loading.generating') ) )
101 {
102 if ( $element->name )
103 {
104 MIOLO::updateLoading("Generating... {$element->name}");
105 }
106 }
107
108 $html = $element->generate() . $separator;
109 }
110 else
111 {
112 $html = "BasePainter Error: Method Generate not defined to " . get_class($elements);
113 }
114 }
115 else
116 {
117 $html = (string)$element;
118 }
119
120 return $html;
121 }
122} // end of BasePainter
123?>
GenerateElements($elements, $separator='', $method='Generate')
GenerateToString($element, $separator='')
static updateLoading($value)
Definição miolo.class:1797
static getInstance()
Definição miolo.class:134
static getBooleanValue($value)
Definição mutil.class:100