<?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>M4d3L Blog&#039;s&#187; Développement</title>
	<atom:link href="http://www.m4d3l-network.com/category/developpement/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.m4d3l-network.com</link>
	<description>Sky is NOT the limit!</description>
	<lastBuildDate>Sat, 30 Jul 2011 19:30:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<div id='fb-root'></div>
					<script type='text/javascript'>
						window.fbAsyncInit = function()
						{
							FB.init({appId: 178184625541198, status: true, cookie: true, xfbml: true});
						};
						(function()
						{
							var e = document.createElement('script'); e.async = true;
							e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
							document.getElementById('fb-root').appendChild(e);
						}());
					</script>	
						<item>
		<title>Using Phing to build your Joomla package!</title>
		<link>http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 20:27:21 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[phing]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=735</guid>
		<description><![CDATA[Are you losing your time to build your Joomla package? For me, it&#8217;s a pain! Some thing have to be done each time we want to release a new version. And I really don&#8217;t like to repeat thing again and again! Step example : - export from svn, - change version number, - edit manifest [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/' rel='bookmark' title='Joomla PHPInfo component'>Joomla PHPInfo component</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/' rel='bookmark' title='Joomla : How to show Menu to Guest Only'>Joomla : How to show Menu to Guest Only</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/' rel='bookmark' title='Howto setup Smarty3 Engine in Joomla!'>Howto setup Smarty3 Engine in Joomla!</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>Are you losing your time to build your Joomla package? </p>
<p>For me, it&#8217;s a pain! Some thing have to be done each time we want to release a new version. And I really don&#8217;t like to repeat thing again and again!</p>
<p>Step example :<br />
- export from svn,<br />
- change version number,<br />
- edit manifest to setup free or pro version,<br />
- delete some file for free version<br />
- zip subpackage for pro version and free version for J1.5 and J1.6<br />
- create package installer for pro version and free version for J1.5 and J1.6<br />
- upload file on ftp<br />
- upload api documentation on ftp<br />
- test package on online test website to see if it work.</p>
<p>And I am sure to forgot some steps. Lot of these manipulation can be automated!<br />
<span id="more-735"></span><br />
Here is a full and complex example to automate thing. It&#8217;s not totally finish but it&#8217;s already very powerful. Package creation take me now 20 second for something that take me some hour to do before.</p>
<p>It use the power of PHP5 with an xml structure. It&#8217;s called <a href="http://phing.info" rel="nofollow">Phing</a></p>
<p>The actual feature I implement into my build script is :<br />
- update source from svn (to be sure you have latest revision)<br />
- export source,<br />
- prepare export file for free/pro version and j1.5/j1.6 package type.<br />
- package all extension in one big install extension<br />
- upload package and phpdoc on ftp.<br />
- (in future, call webservice for UpdateServer (J1.6 only) to lets him know new version available.)</p>

<div class="wp_syntax"><table><tr><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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Build Package&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;packages_list_free&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;com_zzz,plg_system_zzz,lib_smarty&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;packages_list_pro&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;com_zzz,plg_system_zzz,plg_user_zzz,lib_smarty&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- Directory Info --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dir.builds&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dir.export&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;export&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dir.packages&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;packages&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dir.final&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;final&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dir.src&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;../&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- Set some params outside of the svn. (user/password) --&gt;</span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;c:\\Projects\\zzz\\zzz.ini&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Choose valid option:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;buildjversion&quot;</span> <span style="color: #000066;">validargs</span>=<span style="color: #ff0000;">&quot;j15,j16&quot;</span> <span style="color: #000066;">defaultValue</span>=<span style="color: #ff0000;">&quot;j16&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			Which version of joomla would you want for this build?
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;buildtype&quot;</span> <span style="color: #000066;">validargs</span>=<span style="color: #ff0000;">&quot;free,pro&quot;</span> <span style="color: #000066;">defaultValue</span>=<span style="color: #ff0000;">&quot;free&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			Which build would you want to create?
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;buildstage&quot;</span> <span style="color: #000066;">validargs</span>=<span style="color: #ff0000;">&quot;dev,prod&quot;</span> <span style="color: #000066;">defaultValue</span>=<span style="color: #ff0000;">&quot;dev&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			Which build stage would you want to create?
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;buildversion&quot;</span> <span style="color: #000066;">defaultValue</span>=<span style="color: #ff0000;">&quot;2.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			What is the version number?
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;buildstate&quot;</span> <span style="color: #000066;">validargs</span>=<span style="color: #ff0000;">&quot;alfa,beta,rc,final&quot;</span> <span style="color: #000066;">defaultValue</span>=<span style="color: #ff0000;">&quot;beta&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			What is the state of the version
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;ftp-deploy&quot;</span> <span style="color: #000066;">validargs</span>=<span style="color: #ff0000;">&quot;y,n&quot;</span> <span style="color: #000066;">defaultValue</span>=<span style="color: #ff0000;">&quot;y&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			Deploy on FTP?
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;phpdoc.build&quot;</span> <span style="color: #000066;">validargs</span>=<span style="color: #ff0000;">&quot;y,n&quot;</span> <span style="color: #000066;">defaultValue</span>=<span style="color: #ff0000;">&quot;n&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			Deploy documentation?
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/input<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Subversion Info --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;svn.bin&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;svn&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;packages_list&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${packages_list_${buildtype}}&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;phpdoc.defaultpackagename&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;zzz&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;phpdoc.defaultcategoryname&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;zzz&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;phpdoc.templatebase&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\\wamp\\bin\\php\\php5.3.3\\PEAR\\PhpDocumentor\\phpDocumentor&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- FTP Default Info --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ftp.port&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;21&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ftp.mode&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;binary&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ftp.level&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;debug&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ftp.docdir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;public_html/docs/zzz/&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ftp.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;/downloads/joomla/${buildstate}/components/com_zzz/&quot;</span> <span style="color: #000066;">override</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;Building extensions package - Version ${buildversion} - State ${buildstate}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Export file out of svn directory --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;Export file out of svn directory&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svnlastrevision</span> <span style="color: #000066;">svnpath</span>=<span style="color: #ff0000;">&quot;${svn.bin}&quot;</span> <span style="color: #000066;">workingcopy</span>=<span style="color: #ff0000;">&quot;${dir.src}&quot;</span> <span style="color: #000066;">propertyname</span>=<span style="color: #ff0000;">&quot;svn.lastrevision&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phingcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_svn-export&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Setup the build for the good joomla version --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phingcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_${buildjversion}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Setup the build for the good version type of zzz--&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phingcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_type-${buildtype}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Build extensions package --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;Build extensions package&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.packages}&quot;</span> <span style="color: #000066;">includeemptydirs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.packages}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;foreach</span> <span style="color: #000066;">list</span>=<span style="color: #ff0000;">&quot;${packages_list}&quot;</span> <span style="color: #000066;">param</span>=<span style="color: #ff0000;">&quot;i&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_build-zip&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Build final package --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;Building NotifyMe final package - Version ${buildversion} - State ${buildstate}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phingcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_final-package&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Deploy the final package --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;Deploy the packages on ftp://${ftp.host}/${ftp.dir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phingcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_ftp-deploy&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- Build documentation --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phingcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_doc-deploy&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;equals</span> <span style="color: #000066;">arg1</span>=<span style="color: #ff0000;">&quot;${ftp-deploy}&quot;</span> <span style="color: #000066;">arg2</span>=<span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;then<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;http://www.zzz.com/downloads/joomla/${buildstate}/components/com_zzz/pkg_zzz-${buildversion}-${buildstate}-${buildtype}-rev${svn.lastrevision}-${buildjversion}.zip&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/then<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;DONE!!!!!!!&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_final-package&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.final}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zip</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${dir.final}/pkg_zzz-${buildversion}-${buildstate}-${buildtype}-rev${svn.lastrevision}-${buildjversion}.zip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;CHANGELOG&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;pkg_everything.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;misc/*&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.packages}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.zip&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}/misc&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/zip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_ftp-deploy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;equals</span> <span style="color: #000066;">arg1</span>=<span style="color: #ff0000;">&quot;${ftp-deploy}&quot;</span> <span style="color: #000066;">arg2</span>=<span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;then<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ftpdeploy</span> <span style="color: #000066;">host</span>=<span style="color: #ff0000;">&quot;${ftp.host}&quot;</span> <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;${ftp.port}&quot;</span> <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${ftp.username}&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${ftp.password}&quot;</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${ftp.dir}&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;${ftp.mode}&quot;</span> <span style="color: #000066;">level</span>=<span style="color: #ff0000;">&quot;${ftp.level}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.final}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ftpdeploy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/then<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;else<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;FTP transfert ignored&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/else<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_type-free&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/views/templates&quot;</span> <span style="color: #000066;">includeemptydirs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/views/templatelang&quot;</span> <span style="color: #000066;">includeemptydirs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/views/template&quot;</span> <span style="color: #000066;">includeemptydirs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/controllers/template.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/controllers/templatelang.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/controllers/templates.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/models/template.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/models/templatelang.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/models/templates.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/models/forms/template.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/models/forms/templatelang.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/tables/templatelang.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/com_zzz/admin/tables/template.php&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_type-pro&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #808080; font-style: italic;">&lt;!-- Nothing to do. Its the full version. --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_j15&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;foreach</span> <span style="color: #000066;">list</span>=<span style="color: #ff0000;">&quot;${packages_list}&quot;</span> <span style="color: #000066;">param</span>=<span style="color: #ff0000;">&quot;i&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_edit-manifest&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_j16&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;foreach</span> <span style="color: #000066;">list</span>=<span style="color: #ff0000;">&quot;${packages_list}&quot;</span> <span style="color: #000066;">param</span>=<span style="color: #ff0000;">&quot;i&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_edit-manifest&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_build-zip&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zip</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${dir.packages}/${i}.zip&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${dir.export}/${i}&quot;</span> <span style="color: #000066;">includeemptydirs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_doc-deploy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;equals</span> <span style="color: #000066;">arg1</span>=<span style="color: #ff0000;">&quot;${phpdoc.build}&quot;</span> <span style="color: #000066;">arg2</span>=<span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;then<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Buid documentation&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}/apidocs&quot;</span> <span style="color: #000066;">includeemptydirs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}/apidocs&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phpdoc</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;${phing.project.name} API Documentation&quot;</span> <span style="color: #000066;">templatebase</span>=<span style="color: #ff0000;">&quot;${phpdoc.templatebase}&quot;</span> <span style="color: #000066;">defaultcategoryname</span>=<span style="color: #ff0000;">&quot;${phpdoc.defaultcategoryname}&quot;</span> <span style="color: #000066;">defaultpackagename</span>=<span style="color: #ff0000;">&quot;${phpdoc.defaultpackagename}&quot;</span> <span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${dir.export}/apidocs&quot;</span> <span style="color: #000066;">sourcecode</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">quiet</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;HTML:frames/Extjs:default&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/*.php&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;projdocfileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;README&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;INSTALL&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;CHANGELOG&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/projdocfileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phpdoc<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
				<span style="color: #808080; font-style: italic;">&lt;!-- Deploy the documentation --&gt;</span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">msg</span>=<span style="color: #ff0000;">&quot;Deploy the documentation on ftp://${ftp.host}/${ftp.docdir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ftpdeploy</span> <span style="color: #000066;">host</span>=<span style="color: #ff0000;">&quot;${ftp.host}&quot;</span> <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;${ftp.port}&quot;</span> <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${ftp.username}&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${ftp.password}&quot;</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${ftp.docdir}&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;${ftp.mode}&quot;</span> <span style="color: #000066;">level</span>=<span style="color: #ff0000;">&quot;${ftp.level}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}/apidocs&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ftpdeploy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/then<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;else<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Documentation build ignored&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/else<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/if<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_svn-export&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}&quot;</span> <span style="color: #000066;">includeemptydirs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${dir.export}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svncheckout</span> <span style="color: #000066;">svnpath</span>=<span style="color: #ff0000;">&quot;${svn.bin}&quot;</span> <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${svn.username}&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${svn.password}&quot;</span> <span style="color: #000066;">repositoryurl</span>=<span style="color: #ff0000;">&quot;${svn.repository}&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${dir.src}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svnexport</span> <span style="color: #000066;">svnpath</span>=<span style="color: #ff0000;">&quot;${svn.bin}&quot;</span> <span style="color: #000066;">repositoryurl</span>=<span style="color: #ff0000;">&quot;${svn.repository}&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${dir.export}&quot;</span> <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;${svn.username}&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${svn.password}&quot;</span> <span style="color: #000066;">force</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;svnlog</span> <span style="color: #000066;">svnpath</span>=<span style="color: #ff0000;">&quot;${svn.bin}&quot;</span> <span style="color: #000066;">repositoryurl</span>=<span style="color: #ff0000;">&quot;${svn.repository}&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/CHANGELOG&quot;</span> <span style="color: #000066;">revision</span>=<span style="color: #ff0000;">&quot;HEAD:40&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/svnlog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;_edit-manifest&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;php</span> <span style="color: #000066;">expression</span>=<span style="color: #ff0000;">&quot;file_get_contents('${dir.export}/${i}/extension.txt')&quot;</span> <span style="color: #000066;">returnProperty</span>=<span style="color: #ff0000;">&quot;extension_name&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;move</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/${i}/manifest-${buildjversion}.xml&quot;</span> <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${dir.export}/${i}/${extension_name}.xml&quot;</span> <span style="color: #000066;">overwrite</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/${i}/extension.txt&quot;</span> <span style="color: #000066;">failonerror</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;removeproelement</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${dir.export}/${i}/${extension_name}.xml&quot;</span> <span style="color: #000066;">buildtype</span>=<span style="color: #ff0000;">&quot;${buildtype}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/removeproelement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;adhoc-task</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;svnlog&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">class svnLog extends Task { </span>
<span style="color: #339933;">    private $file;</span>
<span style="color: #339933;">    private $svnpath;</span>
<span style="color: #339933;">    private $repositoryurl;</span>
<span style="color: #339933;">    private $revision;</span>
&nbsp;
<span style="color: #339933;">    function setFile($file) { </span>
<span style="color: #339933;">        $this-&gt;file = $file; </span>
<span style="color: #339933;">    }</span>
&nbsp;
<span style="color: #339933;">    function setRevision($revision) { </span>
<span style="color: #339933;">        $this-&gt;revision = $revision; </span>
<span style="color: #339933;">    }</span>
&nbsp;
<span style="color: #339933;">    function setSvnPath($svnpath) { </span>
<span style="color: #339933;">        $this-&gt;svnpath = $svnpath; </span>
<span style="color: #339933;">    }</span>
&nbsp;
<span style="color: #339933;">    function setRepositoryUrl($repositoryurl) { </span>
<span style="color: #339933;">        $this-&gt;repositoryurl = $repositoryurl; </span>
<span style="color: #339933;">    }</span>
&nbsp;
<span style="color: #339933;">    private function writeSvnLog($svnpath=&quot;/usr/bin/svn&quot;, $repositoryurl, $file){</span>
<span style="color: #339933;">        $cmd = $svnpath . &quot; log &quot; . $repositoryurl . &quot; -r &quot;.$revision.&quot; &gt; &quot; . $file;</span>
<span style="color: #339933;">        echo $cmd . &quot;\n&quot;;</span>
<span style="color: #339933;">        system($cmd);</span>
<span style="color: #339933;">        return true;</span>
<span style="color: #339933;">    } </span>
&nbsp;
<span style="color: #339933;">    private function getSvnLog($svnpath=&quot;/usr/bin/svn&quot;, $repositoryurl, $file, $revision = &quot;HEAD:1&quot;){</span>
<span style="color: #339933;">        $cmd = $svnpath . &quot; log &quot; . $repositoryurl . &quot; -r &quot;.$revision.&quot; &gt; &quot; . $file;</span>
<span style="color: #339933;">        echo $cmd . &quot;\n&quot;;</span>
<span style="color: #339933;">        system($cmd);</span>
<span style="color: #339933;">		return true;</span>
<span style="color: #339933;">    } </span>
&nbsp;
<span style="color: #339933;">    function parse($changelog){</span>
<span style="color: #339933;">    	$filename = $this-&gt;file;</span>
<span style="color: #339933;">		$fh = fopen($filename, &quot;r&quot;);</span>
<span style="color: #339933;">		$contents = fread($fh, filesize($filename));</span>
<span style="color: #339933;">		fclose($fh);</span>
&nbsp;
<span style="color: #339933;">    	//parse contents.</span>
<span style="color: #339933;">    	$contents = utf8_encode($contents);</span>
&nbsp;
<span style="color: #339933;">    	$fh = fopen($filename, &quot;w&quot;) or die(&quot;can't open file&quot;);</span>
<span style="color: #339933;">    	fwrite($fh, $contents);</span>
<span style="color: #339933;">    	fclose($fh);</span>
<span style="color: #339933;">    	return true;</span>
<span style="color: #339933;">    }</span>
&nbsp;
<span style="color: #339933;">    function main() { </span>
<span style="color: #339933;">        $changelog = $this-&gt;getSvnLog($this-&gt;svnpath, $this-&gt;repositoryurl, $this-&gt;file, $this-&gt;revision);</span>
<span style="color: #339933;">        $changelog = $this-&gt;parse($changelog);</span>
<span style="color: #339933;">    } </span>
<span style="color: #339933;">}</span>
<span style="color: #339933;">]]&gt;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/adhoc-task<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;adhoc-task</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;removeproelement&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">class removeproelement extends Task { </span>
<span style="color: #339933;">    private $file;</span>
<span style="color: #339933;">    private $buildtype;</span>
&nbsp;
<span style="color: #339933;">    function setFile($file) { </span>
<span style="color: #339933;">        $this-&gt;file = $file; </span>
<span style="color: #339933;">    }</span>
&nbsp;
<span style="color: #339933;">    function setBuildtype($buildtype) { </span>
<span style="color: #339933;">        $this-&gt;buildtype = $buildtype; </span>
<span style="color: #339933;">    }</span>
&nbsp;
<span style="color: #339933;">    function main() { </span>
<span style="color: #339933;">        $doc = new DOMDocument;</span>
&nbsp;
<span style="color: #339933;">		// We don't want to bother with white spaces</span>
<span style="color: #339933;">		$doc-&gt;preserveWhiteSpace = false;</span>
<span style="color: #339933;">        $doc-&gt;Load($this-&gt;file);</span>
<span style="color: #339933;">        $xpath = new DOMXPath($doc);</span>
&nbsp;
<span style="color: #339933;">        if ($this-&gt;buildtype == &quot;free&quot;){</span>
<span style="color: #339933;">	        $elements = $xpath-&gt;query(&quot;//*[@buildtype='pro']&quot;);</span>
<span style="color: #339933;">	        if (!is_null($elements)) {</span>
<span style="color: #339933;">		       	foreach ($elements as $element){</span>
<span style="color: #339933;">		        	$element-&gt;parentNode-&gt;removeChild($element);   		</span>
<span style="color: #339933;">		        }</span>
<span style="color: #339933;">	        }</span>
<span style="color: #339933;">        }</span>
<span style="color: #339933;">        $doc-&gt;save($this-&gt;file);</span>
<span style="color: #339933;">    } </span>
<span style="color: #339933;">}</span>
<span style="color: #339933;">]]&gt;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/adhoc-task<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Here is my project file structure on my repository and Eclipse project.</p>
<pre>
Project ZZZ
..pkg_everything.xml
..builds
....build.xml
....export
....final
....packages
..com_zzz
....manifest-j16.xml
....manifest-j15.xml
....extension.txt (content only extension name for builder)
....admin
......admin component file...
....site
......frontent component file...
..lib_zzz
....manifest-j16.xml
....manifest-j15.xml
....extension.txt
..plg_system_zzz
....manifest-j16.xml
....manifest-j15.xml
....extension.txt
..plg_user_zzz
....manifest-j16.xml
....manifest-j15.xml
....extension.txt
</pre>
<p><br/></p>
<blockquote><p>To setup your Phing environment in Eclipse, read this very nice tutorial : <a href="http://docs.joomla.org/Extension_development_using_eclipse_and_phing">Extension development using eclipse and phing</a></p></blockquote>
<p>I hope this help you to release your Joomla extension faster!</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=735&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/' rel='bookmark' title='Joomla PHPInfo component'>Joomla PHPInfo component</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/' rel='bookmark' title='Joomla : How to show Menu to Guest Only'>Joomla : How to show Menu to Guest Only</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/' rel='bookmark' title='Howto setup Smarty3 Engine in Joomla!'>Howto setup Smarty3 Engine in Joomla!</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Your host block PHPInfo function?</title>
		<link>http://www.m4d3l-network.com/developpement/php/your-host-block-phpinfo-function/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/your-host-block-phpinfo-function/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 17:07:17 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[issue]]></category>
		<category><![CDATA[phpinfo]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=703</guid>
		<description><![CDATA[If your host has block the access to the information given by the PHPInfo() function, you can try this userfull code to fix this issue. If it&#8217;s not working. First, try with other command line function like exec(), shell_exec(), popen() or passthru(). 1 2 3 4 5 6 7 8 9 10 11 12 13 [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/your-host-block-phpinfo-function/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>If your host has block the access to the information given by the PHPInfo() function, you can try this userfull code to fix this issue.<br />
<span id="more-703"></span><br />
If it&#8217;s not working. First, try with other command line function like exec(), shell_exec(), popen() or passthru().</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;pre&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Outputs all the result of shellcommand &quot;ls&quot;, and returns</span>
<span style="color: #666666; font-style: italic;">// the last output line into $last_line. Stores the return value</span>
<span style="color: #666666; font-style: italic;">// of the shell command in $retval.</span>
<span style="color: #000088;">$last_line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">system</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'php -i -r'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$retval</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Printing additional info</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'
&lt;/p re&gt;
&lt;hr /&gt;Last line of the output: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$last_line</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'
&lt;hr /&gt;Return value: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$retval</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<blockquote><p>Special thank to <em>primorialhobbit</em> on irc freenode to help me to find this tips.</p></blockquote>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=703&type=feed" alt="" /><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/your-host-block-phpinfo-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JTable and composed primary key</title>
		<link>http://www.m4d3l-network.com/developpement/php/joomla/jtable-and-composed-primary-key/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/joomla/jtable-and-composed-primary-key/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 04:56:28 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[jtable]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[primary key]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=688</guid>
		<description><![CDATA[JTable on 1.5 and 1.6 actually doesn&#8217;t support to have multiple keys as Primary Key. It doesn&#8217;t help when it&#8217;s time to make more complex database design. So I decided to make a parallel class to JTable to use any number of of column as Primary key (PK) that you need. So with this code, [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/joomla/jtable-and-composed-primary-key/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>JTable on 1.5 and 1.6 actually doesn&#8217;t support to have multiple keys as Primary Key. It doesn&#8217;t help when it&#8217;s time to make more complex database design. So I decided to make a parallel class to JTable to use any number of of column as Primary key (PK) that you need.<br />
<span id="more-688"></span><br />
So with this code, the use of <strong>two columns</strong> as the <strong>combined primary key</strong> come reality!</p>
<p>Modifications require :</p>
<ul>
<li>Following <a href="#JTableMultiKeys">JTableMultiKeys</a> class.</li>
<li>Edit your model with <a href="#edit-model">this code</a></li>
</ul>
<p><strong>It&#8217;s highly in development so don&#8217;t use it in production. </strong></p>
<p>Actually, this code is suppose to work for select, insert and update but at this time, I have just tested select. I will make update as soon I tested it and I will also add checkout support when everything will be tested. </p>
<p>It support Joomla 1.6. I didn&#8217;t test it on Joomla 1.5.</p>
<h2><a name="JTableMultiKeys">JTableMultiKeys Class</a></h2>
<p>First of all, you must save this Abstract class in your project. It&#8217;s a modified clone of JTable. You will be able with this class to set any number of fields that compose your Primary key. (e.g. id, code_lang)</p>

<div class="wp_syntax"><table><tr><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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * JNotifyMe is a notification and confirmation system for Joomla 1.6+
 * It send email on triggered event
 *
 * @version $Id$
 * @link $HeadURL$
 * @author $Author$
 * @package    JNotifyMe
 * @subpackage component
 * @since 1.0
 * @copyright Copyright (C) 2010 - 2011 Webonaute.ca, Inc. All rights reserved.
 * @license   GNU General Public License version 2 or later; see LICENSE.txt
 */</span>
&nbsp;
&nbsp;
<span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JPATH_BASE'</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Abstract JTableMultiKeys class
 * This class is a copy of JTable and modified to support multi fields as primary key.
 *
 * @since 2.0
 */</span>
abstract <span style="color: #000000; font-weight: bold;">class</span> JTableMultiKeys <span style="color: #000000; font-weight: bold;">extends</span> JObject
<span style="color: #009900;">&#123;</span>
	<span style="color: #009933; font-style: italic;">/**
	 * Name of the database table to model.
	 *
	 * @var		string
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_tbl</span>	<span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Name of the primary key field in the table.
	 *
	 * @var		array
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_tbl_keys</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * JDatabase connector object.
	 *
	 * @var		JDatabase
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_db</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Should rows be tracked as ACL assets?
	 *
	 * @var		boolean
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_trackAssets</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * The rules associated with this record.
	 *
	 * @var	JRules	A JRules object.
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_rules</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Indicator that the tables have been locked.
	 *
	 * @var		boolean
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$_locked</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Object constructor to set table and key fields.  In most cases this will
	 * be overridden by child classes to explicitly set the table and key fields
	 * for a particular database table.
	 *
	 * @param	string Name of the table to model.
	 * @param	string Name of the primary key field in the table.
	 * @param	object JDatabase connector object.
	 */</span>
	<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span> <span style="color: #000088;">$keys</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Set internal variables.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl		<span style="color: #339933;">=</span> <span style="color: #000088;">$table</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$keys</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;">$keys</span><span style="color: #009900;">&#41;</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys	<span style="color: #339933;">=</span> <span style="color: #000088;">$keys</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db	<span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$db</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Initialise the table properties.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFields</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// Add the field if it is not already present.</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</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;">// If we are tracking assets, make sure an access field exists and initially set the default.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'asset_id'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			jimport<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'joomla.access.rules'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_trackAssets <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If the acess property exists, set the default.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'access'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">access</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getConfig</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'access'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Get the columns from database table.
	 *
	 * @return	mixed	An array of the field names, or false if an error occurs.
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getFields<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		static <span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Lookup the fields for this table only once.</span>
			<span style="color: #000088;">$name</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #339933;">;</span>
			<span style="color: #000088;">$fields</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTableFields</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</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: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</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: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_COLUMNS_NOT_FOUND'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$cache</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Static method to get an instance of a JTable class if it can be found in
	 * the table include paths.  To add include paths for searching for JTable
	 * classes @see JTable::addIncludePath().
	 *
	 * @param	string	The type (name) of the JTable class to get an instance of.
	 * @param	string	An optional prefix for the table class name.
	 * @param	array	An optional array of configuration values for the JTable object.
	 * @return	mixed	A JTable object if found or boolean false if one could not be found.
	 * @link	http://docs.joomla.org/JTable/getInstance
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> getInstance<span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$prefix</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'JTable'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Sanitize and prepare the table class name.</span>
		<span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/[^A-Z0-9_\.-]/i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$tableClass</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$prefix</span><span style="color: #339933;">.</span><span style="color: #990000;">ucfirst</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Only try to load the class if it doesn't already exist.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">class_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tableClass</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Search for the class file in the JTable include paths.</span>
			jimport<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'joomla.filesystem.path'</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: #000088;">$path</span> <span style="color: #339933;">=</span> JPath<span style="color: #339933;">::</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span>JTableMultiKeys<span style="color: #339933;">::</span><span style="color: #004000;">addIncludePath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// Import the class file.</span>
				<span style="color: #b1b100;">require_once</span> <span style="color: #000088;">$path</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// If we were unable to load the proper class, raise a warning and return false.</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">class_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tableClass</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseWarning</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_CLASS_NOT_FOUND_IN_FILE'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tableClass</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// If we were unable to find the class file in the JTable include paths, raise a warning and return false.</span>
				JError<span style="color: #339933;">::</span><span style="color: #004000;">raiseWarning</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_NOT_SUPPORTED_FILE_NOT_FOUND'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If a database object was passed in the configuration array use it, otherwise get the global one from JFactory.</span>
		<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbo'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDbo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Instantiate a new table class and return it.</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000088;">$tableClass</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Add a filesystem path where JTable should search for table class files.
	 * You may either pass a string or an array of paths.
	 *
	 * @param	mixed	A filesystem path or array of filesystem paths to add.
	 * @return	array	An array of filesystem paths to find JTable classes in.
	 * @link	http://docs.joomla.org/JTable/addIncludePath
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> addIncludePath<span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Declare the internal paths as a static variable.</span>
		static <span style="color: #000088;">$_paths</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If the internal paths have not been initialised, do so with the base table path.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_paths</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$_paths</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>DS<span style="color: #339933;">.</span><span style="color: #0000ff;">'table'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Convert the passed path(s) to add to an array.</span>
		<span style="color: #990000;">settype</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'array'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If we have new paths to add, do so.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_paths</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Check and add each individual new path.</span>
			<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// Sanitize path.</span>
				<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// Add to the front of the list so that custom paths are searched first.</span>
				<span style="color: #990000;">array_unshift</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_paths</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$_paths</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to compute the default name of the asset.
	 * The default name is in the form `table_name.id`
	 * where id is the value of the primary key of the table.
	 *
	 * @return	string
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _getAssetName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$name</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$k</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #339933;">.</span><span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to return the title to use for the asset table.  In
	 * tracking the assets a title is kept for each asset so that there is some
	 * context available in a unified access manager.  Usually this woud just
	 * return $this-&gt;title or $this-&gt;name or whatever is being used for the
	 * primary name of the row. If this method is not overriden, the asset name is used.
	 *
	 * @return	string	The string to use as the title in the asset table.
	 * @link	http://docs.joomla.org/JTable/getAssetTitle
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _getAssetTitle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getAssetName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to get the parent asset under which to register this one.
	 * By default, all assets are registered to the ROOT node with ID 1.
	 * The extended class can define a table and id to lookup.  If the
	 * asset does not exist it will be created.
	 *
	 * @param	JTable	A JTable object for the asset parent.
	 *
	 * @return	int
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _getAssetParentId<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// For simple cases, parent to the asset root.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</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: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to get the database table name for the class.
	 *
	 * @return	string	The name of the database table being modeled.
	 * @link	http://docs.joomla.org/JTable/getTableName
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTableName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to get the primary key field name for the table.
	 *
	 * @return	array	The name of the primary key for the table.
	 * @since	1.5
	 * @link	http://docs.joomla.org/JTable/getKeyName
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getKeyName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to get the JDatabase connector object.
	 *
	 * @return	object	The internal database connector object.
	 * @link	http://docs.joomla.org/JTable/getDBO
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getDbo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to set the JDatabase connector object.
	 *
	 * @param	object	A JDatabase connector object to be used by the table object.
	 * @return	boolean	True on success.
	 * @link	http://docs.joomla.org/JTable/setDBO
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setDBO<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Make sure the new database object is a JDatabase.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span> instanceof JDatabase<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: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$db</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to set rules for the record.
	 *
	 * @param	mixed	A JRules object, JSON string, or array.
	 */</span>
	<span style="color: #000000; font-weight: bold;">function</span> setRules<span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span> instanceof JRules<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_rules <span style="color: #339933;">=</span> <span style="color: #000088;">$input</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_rules <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JRules<span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to get the rules for the record.
	 *
	 * @return	JRules
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getRules<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_rules<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to reset class properties to the defaults set in the class
	 * definition.  It will ignore the primary key as well as any private class
	 * properties.
	 *
	 * @return	void
	 * @link	http://docs.joomla.org/JTable/reset
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">reset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Get the default values for the class from the table.</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFields</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// If the property is not the primary key or private, reset it.</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isPk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$v</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Default</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: #009933; font-style: italic;">/**
	 * Method to bind an associative array or object to the JTable instance.This
	 * method only binds properties that are publicly accessible and optionally
	 * takes an array of properties to ignore when binding.
	 *
	 * @param	mixed	An associative array or object to bind to the JTable instance.
	 * @param	mixed	An optional array or space separated list of properties
	 *					to ignore while binding.
	 * @return	boolean	True on success.
	 * @since	1.0
	 * @link	http://docs.joomla.org/JTable/bind
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> bind<span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// If the source value is not an array or object return false.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_BIND_FAILED_INVALID_SOURCE_ARGUMENT'</span><span style="color: #339933;">,</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If the source value is an object, get its accessible properties.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$src</span> <span style="color: #339933;">=</span> <span style="color: #990000;">get_object_vars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If the ignore value is a string, explode it over spaces.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ignore</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$ignore</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;">$ignore</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Bind the source value, excluding the ignored fields.</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProperties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Only process fields not in the ignore array.</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<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;">$src</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$src</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#93;</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: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to load a row from the database by primary key and bind the fields
	 * to the JTable instance properties.
	 *
	 * @param	mixed	An optional primary key value to load the row by, or an array of fields to match.  If not
	 *					set the instance property value is used.
	 * @param	boolean	True to reset the default values before loading the new row.
	 * @return	boolean	True if successful. False if row not found or on error (internal error state set in that case).
	 * @link	http://docs.joomla.org/JTable/load
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> load<span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reset</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$keyValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$key</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// If empty primary key there's is no need to load anything</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keyValue</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: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$keyValue</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Load by primary key.</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JTABLEMULTIKEYS_KEYS_IS_NOT_ARRAY'</span><span style="color: #339933;">,</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$keys</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</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: #000088;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_combine</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">,</span> <span style="color: #000088;">$keys</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$reset</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reset</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Initialise the query.</span>
		<span style="color: #000088;">$query</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'*'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProperties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$field</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Check that $field is in the table.</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_CLASS_IS_MISSING_FIELD'</span><span style="color: #339933;">,</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #666666; font-style: italic;">// Add the search tuple to the query.</span>
			<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadAssoc</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check for a database error.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorNum</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check that we have a result.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_EMPTY_ROW_RETURNED'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Bind the object with the row and return.</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to perform sanity checks on the JTable instance properties to ensure
	 * they are safe to store in the database.  Child classes should override this
	 * method to make sure the data they are storing in the database is safe and
	 * as expected before storage.
	 *
	 * @return	boolean	True if the instance is sane and able to be stored in the database.
	 * @link	http://docs.joomla.org/JTable/check
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> checkAllPk<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> and <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$ret</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to store a row in the database from the JTable instance properties.
	 * If a primary key value is set the row with that primary key value will be
	 * updated with the instance property values.  If no primary key value is set
	 * a new row will be inserted into the database with the properties from the
	 * JTable instance.
	 *
	 * @param	boolean True to update fields even if they are null.
	 * @return	boolean	True on success.
	 * @link	http://docs.joomla.org/JTable/store
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> store<span style="color: #009900;">&#40;</span><span style="color: #000088;">$updateNulls</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Initialise variables.</span>
&nbsp;
&nbsp;
		<span style="color: #666666; font-style: italic;">// The asset id field is managed privately by this class.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_trackAssets<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asset_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If all primary keys exists update the object, otherwise insert it.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkAllPk</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$stored</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updateObject</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$updateNulls</span><span style="color: #009900;">&#41;</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: #000088;">$stored</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insertObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If the store failed return false.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$stored</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_STORE_FAILED'</span><span style="color: #339933;">,</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If the table is not set to track assets return true.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_trackAssets<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_locked<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_unlock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//</span>
		<span style="color: #666666; font-style: italic;">// Asset Tracking</span>
		<span style="color: #666666; font-style: italic;">//</span>
&nbsp;
		<span style="color: #000088;">$parentId</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getAssetParentId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$name</span>		<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getAssetName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$title</span>		<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getAssetTitle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$asset</span>	<span style="color: #339933;">=</span> JTableMultiKeys<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Asset'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadByName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Re-inject the asset id.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asset_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check for an error.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Specify how a new or moved node asset is inserted into the tree.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asset_id</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parent_id</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$parentId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLocation</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parentId</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'last-child'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Prepare the asset to be stored.</span>
		<span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parent_id</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$parentId</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span>		<span style="color: #339933;">=</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span>		<span style="color: #339933;">=</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_rules instanceof JRules<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rules</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_rules<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">check</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">store</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$updateNulls</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asset_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Update the asset_id field in this table.</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asset_id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'asset_id = '</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">asset_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</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: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_STORE_FAILED_UPDATE_ASSET_ID'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to provide a shortcut to binding, checking and storing a JTable
	 * instance to the database table.  The method will check a row in once the
	 * data has been stored and if an ordering filter is present will attempt to
	 * reorder the table rows based on the filter.  The ordering filter is an instance
	 * property name.  The rows that will be reordered are those whose value matches
	 * the JTable instance for the property specified.
	 *
	 * @param	mixed	An associative array or object to bind to the JTable instance.
	 * @param	string	Filter for the order updating
	 * @param	mixed	An optional array or space separated list of properties
	 *					to ignore while binding.
	 * @return	boolean	True on success.
	 * @link	http://docs.joomla.org/JTable/save
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> save<span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #339933;">,</span> <span style="color: #000088;">$orderingFilter</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Attempt to bind the source to the instance.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ignore</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: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Run any sanity checks on the instance and verify that it is ready for storage.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">check</span><span style="color: #009900;">&#40;</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: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Attempt to store the properties to the database table.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">store</span><span style="color: #009900;">&#40;</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: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Attempt to check the row in, just in case it was checked out.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkin</span><span style="color: #009900;">&#40;</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: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If an ordering filter is set, attempt reorder the rows in the table based on the filter and value.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$orderingFilter</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$filterValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$orderingFilter</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reorder</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$orderingFilter</span> ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$orderingFilter</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">Quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filterValue</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Set the error to empty and return true.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to delete a row from the database table by primary key value.
	 *
	 * @param	mixed	An optional primary key value to delete.  If not set the
	 *					instance property value is used.
	 * @return	boolean	True on success.
	 * @link	http://docs.joomla.org/JTable/delete
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> delete<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Initialise variables.</span>
		<span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">;</span>
		<span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$pk</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If no primary key is given, return false.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_NULL_PRIMARY_KEY'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If tracking assets, remove the asset first.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_trackAssets<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Get and the asset name.</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$pk</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$name</span>		<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getAssetName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$asset</span>		<span style="color: #339933;">=</span> JTableMultiKeys<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Asset'</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: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadByName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">delete</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$asset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Delete the row by primary key.</span>
		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">delete</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check for a database error.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_DELETE_FAILED'</span><span style="color: #339933;">,</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to check a row out if the necessary properties/fields exist.  To
	 * prevent race conditions while editing rows in a database, a row can be
	 * checked out if the fields 'checked_out' and 'checked_out_time' are available.
	 * While a row is checked out, any attempt to store the row by a user other
	 * than the one who checked the row out should be held until the row is checked
	 * in again.
	 *
	 * @param	integer	The Id of the user checking out the row.
	 * @param	mixed	An optional primary key value to check out.  If not set
	 *					the instance property value is used.
	 * @return	boolean	True on success.
	 * @link	http://docs.joomla.org/JTable/checkOut
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> checkOut<span style="color: #009900;">&#40;</span><span style="color: #000088;">$userId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// If there is no checked_out or checked_out_time field, just return true.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'checked_out'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'checked_out_time'</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: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Initialise variables.</span>
		<span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">;</span>
		<span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$pk</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If no primary key is given, return false.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_NULL_PRIMARY_KEY'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Get the current time in MySQL format.</span>
		<span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #990000;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">toMysql</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check the row out by primary key.</span>
		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checked_out'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$userId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checked_out_time'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</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: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_CHECKOUT_FAILED'</span><span style="color: #339933;">,</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Set table values in the object.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checked_out</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$userId</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checked_out_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$time</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to check a row in if the necessary properties/fields exist.  Checking
	 * a row in will allow other users the ability to edit the row.
	 *
	 * @param	mixed	An optional primary key value to check out.  If not set
	 *					the instance property value is used.
	 * @return	boolean	True on success.
	 * @link	http://docs.joomla.org/JTable/checkIn
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> checkIn<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// If there is no checked_out or checked_out_time field, just return true.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'checked_out'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'checked_out_time'</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: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Initialise variables.</span>
		<span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">;</span>
		<span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$k</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$pk</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If no primary key is given, return false.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span>_<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_NULL_PRIMARY_KEY'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check the row in by primary key.</span>
		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checked_out'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = 0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checked_out_time'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNullDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">.</span><span style="color: #0000ff;">' = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check for a database error.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JException<span style="color: #009900;">&#40;</span>JText<span style="color: #339933;">::</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'JLIB_DATABASE_ERROR_CHECKIN_FAILED'</span><span style="color: #339933;">,</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Set table values in the object.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checked_out</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checked_out_time</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * TODO: This either needs to be static or not.
	 *
	 * Method to determine if a row is checked out and therefore uneditable by
	 * a user.  If the row is checked out by the same user, then it is considered
	 * not checked out -- as the user can still edit it.
	 *
	 * @param	integer	The userid to preform the match with, if an item is checked
	 *					out by this user the function will return false.
	 * @param	integer	The userid to perform the match against when the function
	 *					is used as a static function.
	 * @return	boolean	True if checked out.
	 * @link	http://docs.joomla.org/JTable/isCheckedOut
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isCheckedOut<span style="color: #009900;">&#40;</span><span style="color: #000088;">$with</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$against</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Handle the non-static case.</span>
		<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;">$this</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span> instanceof JTableMultiKeys<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$against</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$against</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'checked_out'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// The item is not checked out or is checked out by the same user.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$against</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$against</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$with</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: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'SELECT COUNT(userid)'</span> <span style="color: #339933;">.</span>
			<span style="color: #0000ff;">' FROM `#__session`'</span> <span style="color: #339933;">.</span>
			<span style="color: #0000ff;">' WHERE `userid` = '</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$against</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$checkedOut</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>boolean<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadResult</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If a session exists for the user then it is checked out.</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$checkedOut</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to lock the database table for writing.
	 *
	 * @return	boolean	True on success.
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _lock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Lock the table for writing.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'LOCK TABLES `'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #339933;">.</span><span style="color: #0000ff;">'` WRITE'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check for a database error.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorNum</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_locked <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Method to unlock the database table for writing.
	 *
	 * @return	boolean	True on success.
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _unlock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Unlock the table.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UNLOCK TABLES'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Check for a database error.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorNum</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorMsg</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_locked <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> isPk<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Description
	 *
	 * @param [type] $updateNulls
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> updateObject<span style="color: #009900;">&#40;</span><span style="color: #000088;">$updateNulls</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$fmtsql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' SET %s WHERE %s'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$where</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">get_object_vars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> or <span style="color: #000088;">$k</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'_'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// internal or NA field</span>
				<span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isPk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// PK not to be updated</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$where</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; AND &quot;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #000088;">$where</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">Quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$updateNulls</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'NULL'</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;">continue</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">isQuoted</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">Quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$v</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$tmp</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$val</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Nothing to update.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tmp</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: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fmtsql</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tmp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Inserts a row into a table based on an objects properties
	 *
	 * @param	string	The name of the table
	 * @param	object	An object whose properties match table fields
	 * @param	string	The name of the primary key. If provided the object property is updated.
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> insertObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$fmtsql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'INSERT INTO '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' (%s) VALUES (%s) '</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">get_object_vars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> or <span style="color: #000088;">$v</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'_'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// internal field</span>
				<span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">nameQuote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">isQuoted</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">Quote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$v</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQuery</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fmtsql</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span>  <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</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: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_db<span style="color: #339933;">-&gt;</span><span style="color: #004000;">insertid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_tbl_keys<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2><a name="edit-model">Method to add or edit in your model</a></h2>
<p>This is an example with 2 fields as PK. If you have more than 2 fields, you will have to adapt this code to your reality.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
175
176
177
178
179
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
     * Method to get a single record.
     *
     * @param	integer	field1 value of primary key.
     * @param	string	field2 value of primary key.
     * @return	mixed	Object on success, false on failure.
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getItem<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk1</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pk2</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Initialise variables.</span>
&nbsp;
        <span style="color: #000088;">$pk1</span>		<span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$pk1</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getState</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.template_id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$pk2</span>		<span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$pk2</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getState</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.lang'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$table</span>	<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTable</span><span style="color: #009900;">&#40;</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: #000088;">$pk1</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> and <span style="color: #000088;">$pk2</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// Attempt to load the row.</span>
            <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pk1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pk2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Check for a table object error.</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$return</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Convert to the JObject before adding other data.</span>
        <span style="color: #000088;">$properties</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProperties</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> JArrayHelper<span style="color: #339933;">::</span><span style="color: #004000;">toObject</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$properties</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'JObject'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$item</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Stock method to auto-populate the model state.
     *
     * @return	void
     * @since	1.6
     */</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> populateState<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Initialise variables.</span>
        <span style="color: #000088;">$app</span> <span style="color: #339933;">=</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getApplication</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'administrator'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$table</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getKeyName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$pk</span> <span style="color: #339933;">=</span> JRequest<span style="color: #339933;">::</span><span style="color: #004000;">getVar</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setState</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pk</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #666666; font-style: italic;">// Get the pk of the record from the request.</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Load the parameters.</span>
        <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> JComponentHelper<span style="color: #339933;">::</span><span style="color: #004000;">getParams</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">option</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setState</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'params'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If you have any question, comment or bug fix, please leave a message in the comment. When This will be stable, I will propose it for inclusion in next version of Joomla.</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=688&type=feed" alt="" /><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/joomla/jtable-and-composed-primary-key/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Joomla unified SITE and ADMIN session</title>
		<link>http://www.m4d3l-network.com/developpement/php/joomla/joomla-unified-session/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/joomla/joomla-unified-session/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 19:02:03 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[core hack]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[site]]></category>
		<category><![CDATA[unified]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=672</guid>
		<description><![CDATA[For a Joomla installation, I have to merge SITE and ADMIN session to be able to switch between them without reconnect. We have to transform Joomla into a content manager for Mailing List and it was not use for website. So the SITE client is just a preview part for the ADMIN. Here is a [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/' rel='bookmark' title='Using Phing to build your Joomla package!'>Using Phing to build your Joomla package!</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/joomla/joomla-unified-session/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>For a Joomla installation, I have to merge SITE and ADMIN session to be able to switch between them without reconnect. We have to transform Joomla into a content manager for Mailing List and it was not use for website. So the SITE client is just a preview part for the ADMIN. </p>
<p>Here is a small hack to merge you SITE and ADMIN session together.<br />
<span id="more-672"></span><br />
In libraries/application/application.php make this change:</p>
<p>1- First of all we need to change the session_name to load the same session on each client side.</p>
<p>Search for :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>85
86
87
</pre></td><td class="code"><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;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'session_name'</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: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'session_name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_name<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Change it for :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>85
86
87
</pre></td><td class="code"><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;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'session_name'</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: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'session_name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;administrator&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>2- After, we have to same thing where the session is inserted into database. </p>
<p>Search for :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>784
785
786
</pre></td><td class="code"><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: #000088;">$storage</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$session</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getClientId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    jexit<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$storage</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And change it for this :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>784
785
786
</pre></td><td class="code"><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: #000088;">$storage</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$session</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    jexit<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$storage</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>3- Now connect on SITE and after go on ADMIN client and you must be also logged in!</p>
<p>I Hop this will help other because I search a lot to find this session hack!</p>
<p>Enjoy!!</p>
<blockquote><p>UPDATE : You can change &laquo;&nbsp;administrator&nbsp;&raquo; for anything you want. it doesn&#8217;t change anything. And session client ID can be 1 or 0. It make no difference. It must just be hard coded.</p></blockquote>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=672&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/' rel='bookmark' title='Using Phing to build your Joomla package!'>Using Phing to build your Joomla package!</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/joomla/joomla-unified-session/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Howto setup Smarty3 Engine in Joomla!</title>
		<link>http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 00:33:02 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[autoloader]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[smarty]]></category>
		<category><![CDATA[template engine]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=647</guid>
		<description><![CDATA[First of all, you would probably ask me why I want to integrate Smarty3 Template engine in Joomla! The answer is simple. I want to easily parse email template to send personalized notification! Smarty3 is all designated to do this! With Smarty, email templates now have just no limit! You can do some very well [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/' rel='bookmark' title='Joomla PHPInfo component'>Joomla PHPInfo component</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/' rel='bookmark' title='Using Phing to build your Joomla package!'>Using Phing to build your Joomla package!</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/' rel='bookmark' title='Joomla : How to show Menu to Guest Only'>Joomla : How to show Menu to Guest Only</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p><img src="http://www.m4d3l-network.com/wp-content/uploads/2010/12/smarty.png" alt="" title="smarty" width="210" height="71" class="alignleft size-full wp-image-648" /><br />
First of all, you would probably ask me why I want to integrate Smarty3 Template engine in Joomla! </p>
<p>The answer is simple. I want to easily parse email template to send personalized notification! Smarty3 is all designated to do this! With Smarty, email templates now have just no limit! You can do some very well designed email template!<br />
<span id="more-647"></span><br />
Here is a small code example working in Joomla! I use it in a Joomla System plugin.</p>
<p>The most important part to make Smarty working is registering the autoloader. Joomla use __autoload but it must be register with spl_autoload_register() function.</p>
<p>Simply add:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #990000;">spl_autoload_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__autoload'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Before:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>SMARTY_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;Smarty.class.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$smarty</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smarty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<blockquote><p>UPDATE NOTE: On Joomla 1.6, spl_autoload_register() is doesn&#8217;t need anymore.</p></blockquote>
<p>This will fix the Autoloader error we got after Smarty is loaded.</p>
<p>After that. Smarty3 Template engine must be fully working!</p>
<p>Here is my full method to load Smarty in my Joomla plugin.</p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #009933; font-style: italic;">/**
	 * Get Smarty object
	 *
	 * @access protected
	 * @since 1.2.0
	 * @return Smarty
	 */</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _getSmarty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//-- Fix: Register Joomla autoloader</span>
		<span style="color: #990000;">spl_autoload_register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__autoload'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//-- Set Smarty librairy directory</span>
		<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SMARTY_DIR'</span><span style="color: #339933;">,</span> JPATH_ADMINISTRATOR<span style="color: #339933;">.</span><span style="color: #0000ff;">'/components/COMPONENT_NAME/librairies/Smarty-'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty_version<span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;Smarty&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>SMARTY_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;Smarty.class.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smarty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">template_dir</span> <span style="color: #339933;">=</span> JPATH_ADMINISTRATOR<span style="color: #339933;">.</span><span style="color: #0000ff;">'/components/COMPONENT_NAME/smarty/templates/'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">compile_dir</span>  <span style="color: #339933;">=</span> JPATH_ADMINISTRATOR<span style="color: #339933;">.</span><span style="color: #0000ff;">'/components/COMPONENT_NAME/smarty/templates_c/'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config_dir</span>   <span style="color: #339933;">=</span> JPATH_ADMINISTRATOR<span style="color: #339933;">.</span><span style="color: #0000ff;">'/components/COMPONENT_NAME/smarty/configs/'</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">left_delimiter</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getParam<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'smarty_left_delimiter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">right_delimiter</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getParam<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'smarty_right_delimiter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$cache_dir</span> <span style="color: #339933;">=</span> JPATH_SITE<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/cache/COMPONENT_NAME/smarty&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				jimport<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'joomla.filesystem.folder'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				JFolder<span style="color: #339933;">::</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_dir</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$cache_dir</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_smarty<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>After some primary test, everything work very well. I will update if I found any other problems!</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=647&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/' rel='bookmark' title='Joomla PHPInfo component'>Joomla PHPInfo component</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/using-phing-to-build-your-joomla-package/' rel='bookmark' title='Using Phing to build your Joomla package!'>Using Phing to build your Joomla package!</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/' rel='bookmark' title='Joomla : How to show Menu to Guest Only'>Joomla : How to show Menu to Guest Only</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla PHPInfo component</title>
		<link>http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 02:22:35 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Joomla]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=616</guid>
		<description><![CDATA[I have looking arround for an administration componant showing PHPinfo and I didn&#8217;t find anything. So just for fun, I have decided to build my own PHPInfo component else just printing phpinfo() function in a single php file. So there is my first official public component for Joomla. Feature Show PHPInfo() Embedded in Joomla administration [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/' rel='bookmark' title='Joomla : How to show Menu to Guest Only'>Joomla : How to show Menu to Guest Only</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/' rel='bookmark' title='Howto setup Smarty3 Engine in Joomla!'>Howto setup Smarty3 Engine in Joomla!</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/your-host-block-phpinfo-function/' rel='bookmark' title='Your host block PHPInfo function?'>Your host block PHPInfo function?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p><img src="http://www.m4d3l-network.com/wp-content/uploads/2010/12/81609-php-logo-300x227.png" alt="phpinfo()" title="PHP-Logo" width="212" class="alignleft size-medium wp-image-639" />I have looking arround for an administration componant showing PHPinfo and I didn&#8217;t find anything. So just for fun, I have decided to build my own PHPInfo component else just printing phpinfo() function in a single php file.<br />
<span id="more-616"></span><br />
So there is my first official public component for Joomla.</p>
<h2>Feature</h2>
<ul>
<li>Show PHPInfo()</li>
<li>Embedded in Joomla administration template</li>
<li>Nice looking <img src='http://www.m4d3l-network.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li>PHP Variables (Joomla core doesn&#8217;t show them.)</li>
</ul>
<p>To download it : <a class="downloadlink" href="http://www.m4d3l-network.com/wp-content/plugins/download-monitor/download.php?id=1" title="Version1.0 téléchargé 85 fois" >Phpinfo component (85)</a></p>
<p>Enjoy it!</p>
<p>If you found bugs, please, lets me know in the comment. I will sometime put online a bugs tracker for my future projects.</p>
<p>UPDATE: I just see joomla already have PHPinfo in the core in HELP/System info. but my component give a little more. It give also PHP Variables ($_COOKIE, $_SESSION, $_ENV, $_GET, $_POST, $_SERVER)</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=616&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/' rel='bookmark' title='Joomla : How to show Menu to Guest Only'>Joomla : How to show Menu to Guest Only</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/' rel='bookmark' title='Howto setup Smarty3 Engine in Joomla!'>Howto setup Smarty3 Engine in Joomla!</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/your-host-block-phpinfo-function/' rel='bookmark' title='Your host block PHPInfo function?'>Your host block PHPInfo function?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto make a simple progress bar in PHP</title>
		<link>http://www.m4d3l-network.com/developpement/php/simple-progress-bar/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/simple-progress-bar/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 01:06:14 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[progressbar]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=608</guid>
		<description><![CDATA[If you are looking for a Progress Bar in PHP. Here is a simple one. In some situations you might need to display a progress bar. There are many methods for doing this, using php, or/and JavaScript, CSS, Ajax, and more. I will give you an example with pure html and css to display to [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/simple-progress-bar/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><h2>If you are looking for a Progress Bar in PHP. Here is a simple one.</h2>
<p>In some situations you might need to display a progress bar. There are many methods for doing this, using php, or/and JavaScript, CSS, Ajax, and more. I will give you an example with pure html and css to display to a user the step they are before finish to feed a form for example.</p>
<p>This progress bar can show tip for progress % or a step by step message.<br />
See use cases at the bottom of the page.</p>
<p><img src="http://www.m4d3l-network.com/wp-content/uploads/2010/12/progressbar.png" alt="progressbar use case" title="progressbar" width="426" height="118" class="size-full wp-image-632" /></p>
<p><span id="more-608"></span></p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> ProgressbarHelper<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$step_total</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$progress</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$show_text</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$msg_progress</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%s</span>&amp;#37;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$msg_step</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Étape %s sur %s'</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$msg_custom</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$progress</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$step_total</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span> <span style="color: #000088;">$show_text</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;progress-container&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">step_total</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$step_total</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">progress</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$progress</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">show_text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$show_text</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg_custom</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$msg</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">class</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$class</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">step_total</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$calc</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">100</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">step_total</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">progress</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: #000088;">$calc</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">progress</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$code</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&lt;div class=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">class</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$code</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'&lt;div style=&quot;width: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$calc</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'%&quot;&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">show_text</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">step_total</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$code</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'&lt;span&gt;'</span><span style="color: #339933;">.</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg_custom</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg_custom</span><span style="color: #339933;">:</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg_step</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">progress</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">step_total</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">show_text</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">step_total</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$code</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'&lt;span&gt;'</span><span style="color: #339933;">.</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg_custom</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg_custom</span><span style="color: #339933;">:</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">msg_progress</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">progress</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$code</span><span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$code</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$code</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">div<span style="color: #6666ff;">.progressbar</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">5px</span> <span style="color: #933;">2px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>  
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
div<span style="color: #6666ff;">.progressbar</span> <span style="color: #00AA00;">&gt;</span> div <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ACE97C</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
div<span style="color: #6666ff;">.progressbar</span> <span style="color: #00AA00;">&gt;</span> div span<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Use case 1 :<br />
Want to have step by step progress bare. :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$current_step</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$total_step</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$print_text</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000000; font-weight: bold;">new</span> ProgressbarHelper<span style="color: #009900;">&#40;</span><span style="color: #000088;">$current_step</span><span style="color: #339933;">,</span><span style="color: #000088;">$total_step</span><span style="color: #339933;">,</span><span style="color: #000088;">$print_text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Use case 2:<br />
Only show a progressbar based on % :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$progress</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$print_text</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000000; font-weight: bold;">new</span> ProgressbarHelper<span style="color: #009900;">&#40;</span><span style="color: #000088;">$progress</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$print_text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<blockquote><p>UPDATE 2011-01-28 : Add possibility to customize the class you want to use with your progressbar. </p></blockquote>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=608&type=feed" alt="" /><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/simple-progress-bar/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Expression: FileMaker to PHP</title>
		<link>http://www.m4d3l-network.com/developpement/php/expression-filemaker-to-php/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/expression-filemaker-to-php/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 00:10:37 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[expression]]></category>
		<category><![CDATA[filemaker]]></category>
		<category><![CDATA[functions]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=601</guid>
		<description><![CDATA[Common FileMaker calculation expressions and their PHP equivalents I dont remember where I found this but it was helpful to found some PHP equivalence for field that are validated by Filemaker when using the PHP Filemaker API. FMP Expression PHP Expression Result Notes 10^2 pow ( 10 , 2 ) 100 Abs ( -37 ) [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/expression-filemaker-to-php/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><h2>Common FileMaker calculation expressions and their PHP equivalents</h2>
<p>I dont remember where I found this but it was helpful to found some PHP equivalence for field that are validated by Filemaker when using the PHP Filemaker API.</p>
<p><span id="more-601"></span></p>
<table class="large-table" border="1">
<tbody>
<tr>
<th>FMP Expression</th>
<th>PHP Expression</th>
<th style="width: 60px;">Result</th>
<th style="width: 60px;">Notes</th>
</tr>
<tr>
<td>10^2</td>
<td>pow ( 10 , 2 )</td>
<td>100</td>
<td></td>
</tr>
<tr>
<td>Abs ( -37 )</td>
<td>abs ( -37 )</td>
<td>37</td>
<td></td>
</tr>
<tr>
<td>Ceiling ( 6.1 )</td>
<td>ceil ( 6.1 )</td>
<td>7</td>
<td></td>
</tr>
<tr>
<td>Date ( 7 ; 26 ; 2007 )</td>
<td>date ( &laquo;&nbsp;n/j/Y&nbsp;&raquo;, mktime ( 0, 0, 0, 7, 26, 2007 ) )</td>
<td>7/26/2007</td>
<td></td>
</tr>
<tr>
<td>Date ( 5 ; 7 ; 2007 ) + 1</td>
<td>date (&laquo;&nbsp;n/j/Y&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/7/2007 + 1 day&nbsp;&raquo; ) )</td>
<td>5/8/2007</td>
<td>This is an example of math with dates.</td>
</tr>
<tr>
<td>Day ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;j&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) )</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>DayName ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;l&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) )</td>
<td>Tuesday</td>
<td></td>
</tr>
<tr>
<td>DayOfWeek ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;N&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) ) + 1</td>
<td>3</td>
<td>PHP treats Monday as day 1 of the week and FMP treats Sunday as day 1</td>
</tr>
<tr>
<td>DayOfYear ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;z&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) ) + 1</td>
<td>121</td>
<td></td>
</tr>
<tr>
<td>Floor ( -6.1 )</td>
<td>floor ( -6.1 )</td>
<td>-7</td>
<td></td>
</tr>
<tr>
<td>GetAsDate ( &laquo;&nbsp;3/1/2007&#8243; ) &#8211; 1</td>
<td>date ( &laquo;&nbsp;n/j/Y&nbsp;&raquo;, strtotime ( &laquo;&nbsp;3/1/2007 &#8211; 1 day&nbsp;&raquo; ) )</td>
<td>2/28/2007</td>
<td>This example demonstrates how to find the last day of the month.</td>
</tr>
<tr>
<td>GetAsDate ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date ( &laquo;&nbsp;n/j/Y&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) )</td>
<td>5/1/2007</td>
<td></td>
</tr>
<tr>
<td>GetAsNumber ( &laquo;&nbsp;PLAT-NO.1234&#8243; )</td>
<td>preg_replace (&laquo;&nbsp;/[^0-9.-]*/&nbsp;&raquo;, &laquo;&nbsp;&nbsp;&raquo;, &laquo;&nbsp;PLAT-NO.1234&#8243;)</td>
<td>-.1234</td>
<td>There is no built-in, elegant way for PHP to emulate FileMaker&#8217;s string to number conversion, but this regular expression is not too bad and does the job.</td>
</tr>
<tr>
<td>GetAsTime ( &laquo;&nbsp;12:34:56&#8243; )</td>
<td>date ( &laquo;&nbsp;H:i:s&nbsp;&raquo;, strtotime ( &laquo;&nbsp;12:34:56&#8243; ) )</td>
<td>12:34:56</td>
<td></td>
</tr>
<tr>
<td>GetAsTimestamp ( &laquo;&nbsp;5/1/2007 12:34:56&#8243; )</td>
<td>date ( &laquo;&nbsp;n/j/Y H:i:s A&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007 12:34:56&#8243; ) )</td>
<td>5/1/2007 12:34:56 PM</td>
<td></td>
</tr>
<tr>
<td>Hour ( &laquo;&nbsp;12:34:56&#8243; )</td>
<td>date (&laquo;&nbsp;H&nbsp;&raquo;, strtotime ( &laquo;&nbsp;12:34:56&#8243; ) )</td>
<td>12</td>
<td></td>
</tr>
<tr>
<td>Int ( -6.1 )</td>
<td>(int) -6.1</td>
<td>-6</td>
<td>This PHP example looks weird. This is the syntax for &laquo;&nbsp;typecasting&nbsp;&raquo;, or converting a value from one type to another. Here, I am casting the fractional value from a float (roughly equivalent to FMPs Number data type) to an integer (FMP has no equivalent for the integer type).</td>
</tr>
<tr>
<td>Int ( Random * 100 )</td>
<td>rand ( 1, 100 )</td>
<td>36</td>
<td>Generate a random integer between 1 and 100 inclusive.</td>
</tr>
<tr>
<td>IsValid ( GetAsDate ( &laquo;&nbsp;5/32/2007&#8243; ) )</td>
<td>strtotime ( &laquo;&nbsp;5/32/2007&#8243; ) ? 1 : 0</td>
<td>0</td>
<td>The strtotime function returns FALSE if a given string can not be converted to a valid date. However, when you echo FALSE in PHP, you get an empty string. FMPs IsValid function returns 0 on failure and 1 on success, so to emulate that behavior I had to append the ternary conditional operator to the expression.</td>
</tr>
<tr>
<td>Left ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; 4 )</td>
<td>substr ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo;, 0, 4 )</td>
<td>File</td>
<td></td>
</tr>
<tr>
<td>LeftWords ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; 2 )</td>
<td>implode ( &nbsp;&raquo; &laquo;&nbsp;, array_slice ( str_word_count ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo;, 1 ), 0, 2 ) )</td>
<td>FileMaker Pro</td>
<td>I was afraid that I was not going to be able to come up with a PHP version of any of the word based FMP functions, but after some research I discovered the str_word_count() function. Used in conjunction with the array_slice() and implode() functions, it does the job pretty well. The only gray area is that I am not 100% sure that what str_word_count() considers a word is the same thing as what FMP considers a word.</td>
</tr>
<tr>
<td>Length ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>strlen ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>22</td>
<td></td>
</tr>
<tr>
<td>Lower ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>strtolower ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>filemaker pro advanced</td>
<td></td>
</tr>
<tr>
<td>Middle ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; 5 ; 4 )</td>
<td>substr ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo;, 4, 4 )</td>
<td>Make</td>
<td></td>
</tr>
<tr>
<td>MiddleWords ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; 2 ; 1 )</td>
<td>implode ( &nbsp;&raquo; &laquo;&nbsp;, array_slice ( str_word_count ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo;, 1 ), 1, 1 ) )</td>
<td>Pro</td>
<td>(see LeftWords for comments)</td>
</tr>
<tr>
<td>Minute ( &laquo;&nbsp;12:34:56&#8243; )</td>
<td>date (&laquo;&nbsp;i&nbsp;&raquo;, strtotime ( &laquo;&nbsp;12:34:56&#8243; ) )</td>
<td>34</td>
<td></td>
</tr>
<tr>
<td>Mod ( 3 ; 2 )</td>
<td>3 % 2</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>Month ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;n&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) )</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>MonthName ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;M&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) )</td>
<td>May</td>
<td></td>
</tr>
<tr>
<td>PatternCount ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; &laquo;&nbsp;a&nbsp;&raquo; )</td>
<td>substr_count ( strtolower ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ) , &laquo;&nbsp;a&nbsp;&raquo; )</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>Position ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; &laquo;&nbsp;e&nbsp;&raquo; ; 4 ; 1 )</td>
<td>stripos ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo;, &laquo;&nbsp;e&nbsp;&raquo;, 4 )</td>
<td>4</td>
<td>- stripos() has no equivalent to the fourth param of the Position function (occurrence).</p>
<p>- The offset parameter of stripos() is &laquo;&nbsp;between&nbsp;&raquo; the letters, not on them.</p>
<p>- stripos() returns the position starting from 0, so you have to add 1 to the result to make them match.</p>
<p>- stripos() returns FALSE if no match is found, not 0.</td>
</tr>
<tr>
<td>Proper ( &laquo;&nbsp;filemaker pro advanced&nbsp;&raquo; )</td>
<td>ucwords ( &laquo;&nbsp;filemaker pro advanced&nbsp;&raquo; )</td>
<td>Filemaker Pro Advanced</td>
<td></td>
</tr>
<tr>
<td>Random</td>
<td>1 / rand ( 1, 100 )</td>
<td>.58839604844730164501</td>
<td>In theory, this PHP expression should return a random number between 0 and 1, just like the Random function in FMP. However, the FMPs Random always returns 20 digits after the decimal, and my PHP expression does not. Truthfully, I usually use the FMP Random function to generate a random integer which the regular PHP rand function is excellent at. See the other Random record for an example.</td>
</tr>
<tr>
<td>Right ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; 4 )</td>
<td>substr ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo;, -4 )</td>
<td>nced</td>
<td></td>
</tr>
<tr>
<td>RightWords ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; 2 )</td>
<td>implode ( &nbsp;&raquo; &laquo;&nbsp;, array_slice ( str_word_count ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo;, 1 ), -2 ) )</td>
<td>Pro Advanced</td>
<td>(see LeftWords for comments)</td>
</tr>
<tr>
<td>Round ( 3.147 ; 2 )</td>
<td>round ( 3.147, 2 )</td>
<td>3.15</td>
<td></td>
</tr>
<tr>
<td>Seconds ( &laquo;&nbsp;12:34:56&#8243; )</td>
<td>date (&laquo;&nbsp;s&nbsp;&raquo;, strtotime ( &laquo;&nbsp;12:34:56&#8243; ) )</td>
<td>56</td>
<td></td>
</tr>
<tr>
<td>Substitute ( &laquo;&nbsp;aaaaa&nbsp;&raquo; ; &laquo;&nbsp;aa&nbsp;&raquo; ; &laquo;&nbsp;a&nbsp;&raquo; )</td>
<td>str_replace ( &laquo;&nbsp;aa&nbsp;&raquo;, &laquo;&nbsp;a&nbsp;&raquo;, &laquo;&nbsp;aaaaaa&nbsp;&raquo; )</td>
<td>aaa</td>
<td>Notice that both examples take only one pass at the replacement. Therefore, the resulting text can sometimes still contain instances of the search pattern.</td>
</tr>
<tr>
<td>Substitute ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; ; &laquo;&nbsp;a&nbsp;&raquo; ; &laquo;&nbsp;o&nbsp;&raquo; )</td>
<td>str_replace ( &laquo;&nbsp;a&nbsp;&raquo;, &laquo;&nbsp;o&nbsp;&raquo;, &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>FileMoker Pro Advonced</td>
<td></td>
</tr>
<tr>
<td>Time ( 12 ; 34 ; 56 )</td>
<td>date ( &laquo;&nbsp;H:i:s&nbsp;&raquo;, mktime ( 12, 34, 56 ) )</td>
<td>12:34:56</td>
<td></td>
</tr>
<tr>
<td>Timestamp ( Date ( 1 ; 0 ; 2007 ) ; Time ( 12 ; 34 ; 56 ) )</td>
<td>date ( &laquo;&nbsp;n/j/Y H:i:s A&nbsp;&raquo;, mktime ( 12, 34, 56, 1, 0, 2007 ) )</td>
<td>12/31/2006 12:34:56 PM</td>
<td></td>
</tr>
<tr>
<td>Trim ( &nbsp;&raquo; FileMaker Pro Advanced &nbsp;&raquo; )</td>
<td>trim ( &nbsp;&raquo; FileMaker Pro Advanced &nbsp;&raquo; )</td>
<td>FileMaker Pro Advanced</td>
<td></td>
</tr>
<tr>
<td>Truncate ( 1.234 ; 2 )</td>
<td>(int) ( 1.234 * pow ( 10 , 2 ) ) / pow ( 10 , 2 )</td>
<td>1.23</td>
<td></td>
</tr>
<tr>
<td>Upper ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>strtoupper ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>FILEMAKER PRO ADVANCED</td>
<td></td>
</tr>
<tr>
<td>WeekOfYear ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;W&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) )</td>
<td>18</td>
<td></td>
</tr>
<tr>
<td>WordCount ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>str_word_count ( &laquo;&nbsp;FileMaker Pro Advanced&nbsp;&raquo; )</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>Year ( &laquo;&nbsp;5/1/2007&#8243; )</td>
<td>date (&laquo;&nbsp;Y&nbsp;&raquo;, strtotime ( &laquo;&nbsp;5/1/2007&#8243; ) )</td>
<td>2007</td>
<td></td>
</tr>
</tbody>
</table>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=601&type=feed" alt="" /><p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/expression-filemaker-to-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla : How to show Menu to Guest Only</title>
		<link>http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 21:20:13 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Guest]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Menu]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=589</guid>
		<description><![CDATA[This is a simple tutorial on how to show a Menu Item only to Guest user on Joomla. Because actually, it&#8217;s not include in the basic ACL of Joomla. We have to hack a little the Administration component of the Menu and the Module Mainmenu but it&#8217;s simple to do. It&#8217;s not fully tested so [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/' rel='bookmark' title='Joomla PHPInfo component'>Joomla PHPInfo component</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/' rel='bookmark' title='Howto setup Smarty3 Engine in Joomla!'>Howto setup Smarty3 Engine in Joomla!</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/joomla-unified-session/' rel='bookmark' title='Joomla unified SITE and ADMIN session'>Joomla unified SITE and ADMIN session</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>This is a simple tutorial on how to show a Menu Item only to Guest user on Joomla. Because actually, it&#8217;s not include in the basic ACL of Joomla.</p>
<p>We have to hack a little the Administration component of the Menu and the Module Mainmenu but it&#8217;s simple to do. It&#8217;s not fully tested so if you have a best solution or find error, post it in the comment.<br />
<span id="more-589"></span><br />
1. In the file JPATH_ADMIN/com_menus/models/metadata/component.xml add this line after line 20.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>21
22
23
24
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;show_to_guest_only&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;radio&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;Show to Guest only&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Show menu to guest user only.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>No<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/option<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Yes<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/option<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>2. Open file JPATH_SITE/modules/mod_mainmenu/helper.php before line 50, add this code :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>50
51
52
53
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$row_params</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JParameter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row_params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'show_to_guest_only'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>3. Go edit your menu item and put &laquo;&nbsp;Show to Guest only&nbsp;&raquo; to &laquo;&nbsp;Yes&nbsp;&raquo; then save.</p>
<p>4. Login and see the menu item disappear. If you log out, your menu will be show again. </p>
<blockquote><p>UPDATE NOTE.<br />
This hack doesn&#8217;t work with <strong>ALL LEGACY</strong> Menu Style !</p></blockquote>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=589&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/phpinfo-component/' rel='bookmark' title='Joomla PHPInfo component'>Joomla PHPInfo component</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/howto-setup-smarty3-in-joomla/' rel='bookmark' title='Howto setup Smarty3 Engine in Joomla!'>Howto setup Smarty3 Engine in Joomla!</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/joomla/joomla-unified-session/' rel='bookmark' title='Joomla unified SITE and ADMIN session'>Joomla unified SITE and ADMIN session</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/joomla/how-to-show-menu-to-guest-only/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to use Flickr with Zend Framework?</title>
		<link>http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 22:23:53 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[service api]]></category>
		<category><![CDATA[zend cache]]></category>
		<category><![CDATA[Zend_Service_Flickr]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=454</guid>
		<description><![CDATA[Zend Framework have a good API to play with Flickr Service. You will find it in the service API of Zend Framework. First of all, we take the tag we want to search on the Flickr database. 1 $flirktag = &#34;php, mysql&#34; After, we dont want to call each time the Flickr database so we [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/' rel='bookmark' title='Add language route to your Zend Framework project.'>Add language route to your Zend Framework project.</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/' rel='bookmark' title='Phenix_Wiki, a parser componant for Zend Framework'>Phenix_Wiki, a parser componant for Zend Framework</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>Zend Framework have a good API to play with Flickr Service. You will find it in the <a href="http://framework.zend.com/manual/en/zend.service.html">service </a>API of Zend Framework.<br />
<span id="more-454"></span><br />
First of all, we take the tag we want to search on the Flickr database.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$flirktag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;php, mysql&quot;</span></pre></td></tr></table></div>

<p>After, we dont want to call each time the Flickr database so we will settup a cache of 10 minutes.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$frontendOptions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'lifetime'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">600</span><span style="color: #339933;">,</span>                   <span style="color: #666666; font-style: italic;">// cache lifetime of 10 minute</span>
    <span style="color: #0000ff;">'automatic_serialization'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span>  <span style="color: #666666; font-style: italic;">// this is the default anyways</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$backendOptions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_dir'</span> <span style="color: #339933;">=&gt;</span> MYAPP_PATH_DATA<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> Zend_Cache<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Output'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'File'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$frontendOptions</span><span style="color: #339933;">,</span> <span style="color: #000088;">$backendOptions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>We check first if it already have cache for the query we want. If no cache we execute the query like this :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><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: #000088;">$flickrPlugin</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;flickr&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flirktag</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$flickr</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Service_Flickr<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'###YOUR#ID###'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'per_page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span> 
        <span style="color: #0000ff;">'page'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'tag_mode'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'extras'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'license, date_upload, date_taken, owner_name, icon_server'</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$flirktag</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$flickr_results</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$flickr</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tagSearch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>After, if we have some result, we can show data like this :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div class=&quot;flickr section&quot;&gt;&lt;ul class=&quot;gallery&quot;&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickr_results</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$flickr_result</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flickr</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: #000088;">$substring</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$substring</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;.jpg&quot;</span> or <span style="color: #000088;">$substring</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;.gif&quot;</span> or <span style="color: #000088;">$substring</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;.png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flickr</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: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a rel=&quot;lightbox-tour&quot; href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Medium</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; title=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;img class=&quot;thumb&quot; src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Square</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/ul&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Finally, we save the cache for future request than print the result.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>38
39
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickrPlugin</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;flickr&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flirktag</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickrPlugin</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This is a very simple exemple of what we can do with the Zend_Service_Flickr component.</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=454&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/' rel='bookmark' title='Add language route to your Zend Framework project.'>Add language route to your Zend Framework project.</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/' rel='bookmark' title='Phenix_Wiki, a parser componant for Zend Framework'>Phenix_Wiki, a parser componant for Zend Framework</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

