<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bright Cherry</title>
	<atom:link href="http://www.brightcherry.co.uk/scribbles/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brightcherry.co.uk/scribbles</link>
	<description></description>
	<lastBuildDate>Tue, 20 Dec 2011 19:54:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>PHP- Alternative To The Depreciated mime_content_type Function And Fileinfo Functions</title>
		<link>http://www.brightcherry.co.uk/scribbles/php-alternative-to-the-depreciated-mime_content_type-function-and-fileinfo-functions/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/php-alternative-to-the-depreciated-mime_content_type-function-and-fileinfo-functions/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 19:54:26 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[PHP Scripts, Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=453</guid>
		<description><![CDATA[You&#8217;ve probably landed on this page because you want to find the Content-type of a file by using the mime_content_type function. But when you tried using the function, you were returned with a PHP error because it&#8217;s a depreciated function (PHP 4). Then you may have tried to use the Fileinfo function (am alternative suggested [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve probably landed on this page because you want to find the <b class="pink">Content-type</b> of a file by using the <a href="http://php.net/manual/en/function.mime-content-type.php" target="new" rel="nofollow" title"PHP mime_content_type">mime_content_type function</a>. But when you tried using the function, you were returned with a PHP error because it&#8217;s a depreciated function (PHP 4). Then you may have tried to use the <a href="http://www.php.net/manual/en/ref.fileinfo.php" target="new" rel="nofollow" title"PHP Fileinfo function">Fileinfo function</a> (am alternative suggested by the PHP website), but then realised you haven&#8217;t got the PHP Fileinfo extension/library installed (because you were returned with an error again). <b>So what&#8217;s your alternative</b>?</p>
<h4>Possible solutions</h4>
<ul>
<li>Firstly, if you&#8217;re running off a dedicated sever or VPS, you could install the Fileinfo extension. However, if you&#8217;re on hosted on a shared server, your hosting provider may not install the extension for you. But it might be worth trying to contact them to get it installed first.</li>
<li>The second solution is to write your own function, which is the code I&#8217;m going to provide in this blog post</li>
</ul>
<h4>Write your own mime_content_type Function</h4>

<div class="wp_codebox"><table><tr id="p4532"><td class="line_numbers"><pre>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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
</pre></td><td class="code" id="p453code2"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mime_content_type'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">mime_content_type</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$idx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filename</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$count_explode</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$idx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$idx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$idx</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$count_explode</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$mimet</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>	
        <span style="color: #0000ff;">'ai'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/postscript'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'aif'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/x-aiff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'aifc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/x-aiff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'aiff'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/x-aiff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'asc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/plain'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'atom'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/atom+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'avi'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/x-msvideo'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'bcpio'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-bcpio'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'bmp'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/bmp'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cdf'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-netcdf'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cgm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/cgm'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cpio'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-cpio'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cpt'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/mac-compactpro'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'crl'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-pkcs7-crl'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'crt'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-x509-ca-cert'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'csh'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-csh'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'css'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/css'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'dcr'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-director'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'dir'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-director'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'djv'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/vnd.djvu'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'djvu'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/vnd.djvu'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'doc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/msword'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'dtd'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/xml-dtd'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'dvi'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-dvi'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'dxr'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-director'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'eps'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/postscript'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'etx'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/x-setext'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ez'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/andrew-inset'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'gif'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/gif'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'gram'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/srgs'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'grxml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/srgs+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'gtar'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-gtar'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'hdf'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-hdf'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'hqx'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/mac-binhex40'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'html'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/html'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'html'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/html'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ice'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'x-conference/x-cooltalk'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ico'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-icon'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ics'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/calendar'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ief'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/ief'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ifb'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/calendar'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'iges'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'model/iges'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'igs'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'model/iges'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'jpe'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/jpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'jpeg'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/jpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'jpg'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/jpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'js'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-javascript'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'kar'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/midi'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'latex'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-latex'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'m3u'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/x-mpegurl'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'man'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-troff-man'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mathml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/mathml+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'me'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-troff-me'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mesh'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'model/mesh'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mid'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/midi'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'midi'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/midi'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mif'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.mif'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mov'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/quicktime'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'movie'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/x-sgi-movie'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mp2'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/mpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mp3'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/mpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mpe'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mpeg'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mpg'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mpga'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/mpeg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ms'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-troff-ms'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'msh'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'model/mesh'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'mxu m4u'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/vnd.mpegurl'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'nc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-netcdf'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'oda'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/oda'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ogg'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/ogg'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pbm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-portable-bitmap'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pdb'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'chemical/x-pdb'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pdf'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/pdf'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pgm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-portable-graymap'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pgn'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-chess-pgn'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'php'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-httpd-php'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'php4'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-httpd-php'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'php3'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-httpd-php'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'phtml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-httpd-php'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'phps'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-httpd-php-source'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'png'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/png'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pnm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-portable-anymap'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ppm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-portable-pixmap'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ppt'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.ms-powerpoint'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ps'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/postscript'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'qt'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'video/quicktime'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ra'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/x-pn-realaudio'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ram'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/x-pn-realaudio'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ras'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-cmu-raster'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'rdf'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/rdf+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'rgb'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-rgb'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'rm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.rn-realmedia'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'roff'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-troff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'rtf'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/rtf'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'rtx'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/richtext'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'sgm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/sgml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'sgml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/sgml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'sh'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-sh'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'shar'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-shar'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'shtml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/html'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'silo'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'model/mesh'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'sit'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-stuffit'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'skd'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-koan'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'skm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-koan'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'skp'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-koan'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'skt'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-koan'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'smi'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/smil'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'smil'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/smil'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'snd'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/basic'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'spl'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-futuresplash'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'src'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-wais-source'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'sv4cpio'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-sv4cpio'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'sv4crc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-sv4crc'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'svg'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/svg+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'swf'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-shockwave-flash'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'t'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-troff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tar'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-tar'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tcl'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-tcl'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tex'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-tex'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'texi'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-texinfo'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'texinfo'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-texinfo'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tgz'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-tar'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tif'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/tiff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tiff'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/tiff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tr'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-troff'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tsv'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/tab-separated-values'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'txt'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/plain'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'ustar'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-ustar'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'vcd'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/x-cdlink'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'vrml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'model/vrml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'vxml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/voicexml+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wav'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'audio/x-wav'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wbmp'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/vnd.wap.wbmp'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wbxml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.wap.wbxml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/vnd.wap.wml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wmlc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.wap.wmlc'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wmlc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.wap.wmlc'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wmls'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text/vnd.wap.wmlscript'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wmlsc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.wap.wmlscriptc'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wmlsc'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.wap.wmlscriptc'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'wrl'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'model/vrml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xbm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-xbitmap'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xht'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/xhtml+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xhtml'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/xhtml+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xls'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.ms-excel'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xml xsl'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xpm'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-xpixmap'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xslt'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/xslt+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xul'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/vnd.mozilla.xul+xml'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xwd'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image/x-xwindowdump'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'xyz'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'chemical/x-xyz'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'zip'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'application/zip'</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$mimet</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$idx</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$mimet</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$idx</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	 <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'application/octet-stream'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//$mm_type will return the content type (note, I still use the original function name mime_content_type)</span>
<span style="color: #000088;">$mm_type</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mime_content_type</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filepath</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>If anyone has a better solution of retrieving the content-type without using the depreciated mime_content_type function and the Fileinfo library, please let me know.</p>
<p>Also, please let me know if this worked for you <img src='http://www.brightcherry.co.uk/scribbles/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/php-alternative-to-the-depreciated-mime_content_type-function-and-fileinfo-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Display Latest Tweet On Website</title>
		<link>http://www.brightcherry.co.uk/scribbles/how-to-display-latest-tweet-on-website/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/how-to-display-latest-tweet-on-website/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 12:50:29 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[jQuery Scripts & Helpful Snippets]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=447</guid>
		<description><![CDATA[Here&#8217;s a really quick and simple way to display your latest Tweet on your website like the example below (the graphics obviously won&#8217;t appear, just the Tweet): 1 2 3 4 5 6 7 8 9 10 11 &#60;script src=&#34;http://code.jquery.com/jquery-latest.js&#34;&#62;&#60;/script&#62; &#60;script&#62; $(document).ready(function () { $.getJSON(&#34;http://twitter.com/statuses/user_timeline/USERNAME.json?callback=?&#34;, function(data) { $(&#34;.show_tweet&#34;).html(data[0].text); }); }); &#60;/script&#62; &#160; &#60;div class=&#34;show_tweet&#34;&#62;&#60;/div&#62; Simply [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a really quick and simple way to display your latest Tweet on your website like the example below (the graphics obviously won&#8217;t appear, just the Tweet):</p>
<p><img src="http://www.brightcherry.co.uk/images/blogimages/latest_tweet.jpg" title="Latest Tweet" alt="Latest Tweet" /></p>

<div class="wp_codebox"><table><tr id="p4474"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p447code4"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function ()
{
 $.getJSON(&quot;http://twitter.com/statuses/user_timeline/USERNAME.json?callback=?&quot;, function(data) {
  $(&quot;.show_tweet&quot;).html(data[0].text);
 });
});
&lt;/script&gt;
&nbsp;
&lt;div class=&quot;show_tweet&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>Simply replace USERNAME with your unique Twitter username. The show_tweet class is where the Tweet will display. </p>
<p>The &#8220;follow us&#8221; link won&#8217;t appear by default, I hard-coded that into the show_tweet div <img src='http://www.brightcherry.co.uk/scribbles/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>It&#8217;s as easy as that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/how-to-display-latest-tweet-on-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Javascript &#8211; Get The Hash Tag Value From A URL</title>
		<link>http://www.brightcherry.co.uk/scribbles/jquery-get-the-hash-tag-value-from-a-url/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/jquery-get-the-hash-tag-value-from-a-url/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 17:47:35 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=421</guid>
		<description><![CDATA[So, you have the following URL: http://www.example.com/page/#comment-12 You want to get the value after the hash tag (#), which is comment-12 The following Javascript code will help you achieve what you&#8217;re after: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 &#160; &#60;script type=&#34;text/javascript&#34;&#62; &#160; //check if hash tag exists [...]]]></description>
			<content:encoded><![CDATA[<p>So, you have the following URL:</p>
<p><b class="pink">http://www.example.com/page/#comment-12</b></p>
<p>You want to get the value after the hash tag (#), which is <b>comment-12</b></p>
<p>The following Javascript code will help you achieve what you&#8217;re after:</p>

<div class="wp_codebox"><table><tr id="p4216"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p421code6"><pre class="js" style="font-family:monospace;">&nbsp;
&lt;script type=&quot;text/javascript&quot;&gt;
&nbsp;
//check if hash tag exists in the URL
if(window.location.hash) {
&nbsp;
 //set the value as a variable, and remove the #
 var hash_value = window.location.hash.replace('#', '');
&nbsp;
 //show the value with an alert pop-up
 alert(hash_value);
&nbsp;
}
&lt;/script&gt;</pre></td></tr></table></div>

<p>That&#8217;s it. It&#8217;s as easy that.</p>
<p>Please let me know if it did or didn&#8217;t work for you. Alternatively, if you know of a better way to achieve the same output. Thanks in advance!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/jquery-get-the-hash-tag-value-from-a-url/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>htaccess- 301 Redirect Old URLs With Spaces</title>
		<link>http://www.brightcherry.co.uk/scribbles/htaccess-301-redirect-old-urls-with-spaces/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/htaccess-301-redirect-old-urls-with-spaces/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 00:50:19 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[htaccess fun]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=416</guid>
		<description><![CDATA[Here&#8217;s a quick and easy htaccess 301 redirect tip. So, you have a URL like this: http://www.example.co.uk/this is_a_file.html and you want to redirect it to: http://www.example.co.uk/this_is_a_file.html All you need to is quote the URL like this: 1 Redirect 301 &#34;/this is_a_file.html&#34; http://www.example.co.uk/this_is_a_file.html]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick and easy htaccess 301 redirect tip.</p>
<p><b class="pink">So, you have a URL like this:</b><br />
http://www.example.co.uk/this is_a_file.html</p>
<p><b class="pink">and you want to redirect it to:</b></p>
<p>http://www.example.co.uk/this_is_a_file.html</p>
<p><b class="pink">All you need to is quote the URL like this:</b></p>

<div class="wp_codebox"><table><tr id="p4168"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p416code8"><pre class="php" style="font-family:monospace;">Redirect <span style="color: #cc66cc;">301</span> <span style="color: #0000ff;">&quot;/this is_a_file.html&quot;</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.example.co.uk/this_is_a_file.html</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/htaccess-301-redirect-old-urls-with-spaces/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery- Show The Height And Width Of The Browser Viewport in Real-Time</title>
		<link>http://www.brightcherry.co.uk/scribbles/jquery-show-the-height-and-width-of-the-browser-viewport-in-real-time/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/jquery-show-the-height-and-width-of-the-browser-viewport-in-real-time/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 20:23:45 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[jQuery Scripts & Helpful Snippets]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=402</guid>
		<description><![CDATA[Strange. I looked around everywhere for this code, and couldn&#8217;t find it anymore online. I simply wanted jQuery code that would show the height and width of the browser viewport in &#8220;real-time&#8221; I found plenty of code samples that would show the viewport size on page load/refresh, but nothing that would update live, as I [...]]]></description>
			<content:encoded><![CDATA[<p>Strange. I looked around everywhere for this code, and couldn&#8217;t find it anymore online. I simply wanted jQuery code that would show the height and width of the browser viewport in &#8220;real-time&#8221; I found plenty of code samples that would show the viewport size on page load/refresh, but nothing that would update live, as I was reducing/expanding the browser size. So I decided to write my own code, and it turned it to be a lot easier than anticipated.</p>
<h4>Demo</h4>
<p>Simply change the size of your browser and the values (height and width) below should automatically update.</p>
<h3>Width in pixels:</h3>
<input type="input" id="output_width" value="" name="width" />
<h3>Height in pixels:</h3>
<input type="input" id="output_height" value="" name="height" />
<h4>Code</h4>
<p>All you need to do is copy/paste the code and it should work.</p>

<div class="wp_codebox"><table><tr id="p40210"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p402code10"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function ()
{
 $(window).resize(function()
 {
  var show_width = $(window).width();
  document.getElementById(&quot;output_width&quot;).value=show_width.toString();
&nbsp;
  var show_height = $(window).height();
  document.getElementById(&quot;output_height&quot;).value=show_height.toString();
 });
});
&lt;/script&gt;
&nbsp;
&nbsp;
&lt;h3&gt;Width:&lt;/h3&gt;
&lt;input type=&quot;input&quot; id=&quot;output_width&quot; value=&quot;&quot; name=&quot;width&quot; /&gt;
&nbsp;
&lt;h3&gt;Height:&lt;/h3&gt;
&lt;input type=&quot;input&quot; id=&quot;output_height&quot; value=&quot;&quot; name=&quot;height&quot; /&gt;</pre></td></tr></table></div>

<p>So, what do you think? Does it work?</p>
<p>Does anyone know of a more efficient way of getting this result? If so, please let me know.</p>
<p><script src="http://code.jquery.com/jquery-latest.js"></script><br />
<script src="/includes/height_width_demo.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/jquery-show-the-height-and-width-of-the-browser-viewport-in-real-time/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

