summaryrefslogtreecommitdiff
path: root/scripts/ext_skel_ng/php_logo.php
blob: 5d2adf6fad806b941ebb04d3f03575e78cf9cdb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

	class php_logo extends php_element {
		function php_logo($name, $attr) {
			$this->name = $name;
			$this->attr = $attr;
			$this->id = '"'.strtoupper($name).'_LOGO_ID"';

			$this->data = file_get_contents($attr['src']);
			$this->size = strlen($this->data);

			$this->mime_type = "image/gif";
		} 
		
		function docbook_xml($base) {
			return "";
		}

		function minit_code() {
			return "  php_register_info_logo({$this->id}, \"{$this->mime_type}\", {$this->name}_logo, {$this->size});\n";
		}

		function c_code() {
			return "
static unsigned char {$this->name}_logo[] = {
#include \"{$this->name}_logo.h\"
}; 
";
		}

		function h_code() {
			$len = strlen($this->data);
			$code = " ";
			$i=0;
			for($n = 0; $n < $len; $n++) {
				$code .= sprintf(" %3d",ord($this->data[$n]));
				if($n == $len - 1) break;
				$code .=  ",";
				if(++$i==8) {
					$code .= "\n ";
					$i=0;
				}
			}
			
			$code .= "\n";
			
			return $code;
		}
	}

?>