<?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>Utah PHP Users Group &#187; Code</title>
	<atom:link href="http://uphpu.org/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://uphpu.org</link>
	<description>PHP application development and support</description>
	<lastBuildDate>Fri, 18 May 2012 06:30:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Read boolean HTML attributes with jQuery</title>
		<link>http://uphpu.org/2010/01/01/read-boolean-html-attributes-with-jquery/</link>
		<comments>http://uphpu.org/2010/01/01/read-boolean-html-attributes-with-jquery/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 19:02:26 +0000</pubDate>
		<dc:creator>wade</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://uphpu.org/?p=625</guid>
		<description><![CDATA[After much testing, I have concluded that in order to use jQuery with boolean attributes (and have it work in the big four browsers), the following markup must be used: checked=&#8221;checked&#8221;. While browsers except any of the following… checked checked=&#34;&#34; checked=&#34;true&#34; checked=&#34;1&#34; checked=&#34;checked&#34; …only the last option works with jQuery in all browsers.]]></description>
			<content:encoded><![CDATA[<p>After much testing, I have concluded that in order to use <a href="http://jquery.com">jQuery</a> with boolean attributes (and have it work in the big four browsers), the following markup must be used: checked=&#8221;checked&#8221;.</p>
<p>While browsers except any of the following…</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">checked
checked=&quot;&quot;
checked=&quot;true&quot;
checked=&quot;1&quot;
checked=&quot;checked&quot;</pre></div></div>

<p>…only the last option works with jQuery in all browsers.</p>]]></content:encoded>
			<wfw:commentRss>http://uphpu.org/2010/01/01/read-boolean-html-attributes-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Display 12, read/write 24 TimePicker jQuery plugin</title>
		<link>http://uphpu.org/2009/12/30/display-12-readwrite-24-timepicker-jquery-plugin/</link>
		<comments>http://uphpu.org/2009/12/30/display-12-readwrite-24-timepicker-jquery-plugin/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 23:47:15 +0000</pubDate>
		<dc:creator>wade</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://uphpu.org/?p=615</guid>
		<description><![CDATA[Jason Huck&#8217;s jQuery TimePicker plugin didn&#8217;t work for me as-is since it reads and writes in 12-hour format. While most people (strangely) prefer 12 hour format for interacting with, database time fields are 24 hour. I could have converted the format with scripting on the back-end but decided I would prefer to have the picker [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://devblog.jasonhuck.com/">Jason Huck&#8217;s</a> <a href="http://jquery.com">jQuery</a> <a href="http://code.google.com/p/jquery-timepicker/">TimePicker plugin</a> didn&#8217;t work for me as-is since it reads and writes in 12-hour format. While most people (strangely) prefer 12 hour format for interacting with, database time fields are 24 hour. I could have converted the format with scripting on the back-end but decided I would prefer to have the picker display 12-hour but read/write 24-hour. So, I took Jason&#8217;s great design and rewrote it to suite my needs.</p>
<p>Other changes I made were adding a colon between the hour and the minute select lists, adding a space between the minute and the am/pm list, and changed the hours and minutes arrays such that the hours no longer have leading zeros and the minutes are every five instead of every fifteen.</p>
<p>I have intergrated tomsalfield (issue 3) and jasonalanharris&#8217; (issue 5) changes as well.</p>
<p>My version of the script can be found in the <a href="http://code.google.com/p/jquery-timepicker/issues/detail?id=6">issue tracker</a> on the Google Code project for the plugin. Here&#8217;s a screenshot of it in use next to a date field:</p>
<p><img src="http://uphpu.org/wp-content/uploads/2009/12/timepicker.jpg" /></p>]]></content:encoded>
			<wfw:commentRss>http://uphpu.org/2009/12/30/display-12-readwrite-24-timepicker-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>zebra striping across rowspans with jQuery</title>
		<link>http://uphpu.org/2008/12/13/zebra-striping-across-rowspan/</link>
		<comments>http://uphpu.org/2008/12/13/zebra-striping-across-rowspan/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 16:46:27 +0000</pubDate>
		<dc:creator>wade</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://uphpu.org/?p=408</guid>
		<description><![CDATA[On one of my current projects, I am adding alternating shading (&#8220;zebra striping&#8221;) to rows in a table with javascript. This last week I encountered a scenario where I needed this to work on a table that had some cells that spanned multiple rows. My current script could not handle this as it was using [...]]]></description>
			<content:encoded><![CDATA[<p>On one of my current projects, I am adding alternating shading (&#8220;zebra striping&#8221;) to rows in a table with javascript. This last week I encountered a scenario where I needed this to work on a table that had some cells that spanned multiple rows.</p>
<p>My current script could not handle this as it was using jQuery&#8217;s <a href="http://docs.jquery.com/Selectors/odd">:odd</a> selector and I now needed to stripe all of the spanned rows together instead of just every other one. The additional shading that I was applying when hovering over the row was also broken as it too needed to shade all of the spanned rows instead of just the one the mouse was over.</p>
<p>So, I enhanced my script to work with both scenarios. I hope it can be of use to someone.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// check for rowspans</span>
rows <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.datatable &gt; tbody &gt; tr:first &gt; td:first'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>attr<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rowspan'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">var</span> rows_count <span style="color: #339933;">=</span> rows <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// if, shade spanned rows; else, shade for every other row</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>rows_count <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #666666; font-style: italic;">// find the row group leader</span>
   <span style="color: #000000; font-weight: bold;">function</span> rgl<span style="color: #009900;">&#40;</span>who<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #990000;">current</span> <span style="color: #339933;">=</span> who<span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> rows_count<span style="color: #339933;">;</span> i<span style="color: #339933;">++</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: #009900;">&#40;</span><span style="color: #990000;">current</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'td:first'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>attr<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rowspan'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">var</span> rgl <span style="color: #339933;">=</span> <span style="color: #990000;">current</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #990000;">current</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #990000;">current</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #b1b100;">return</span> rgl<span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// row shading</span>
   <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>r <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> r <span style="color: #339933;">&lt;=</span> rows_count<span style="color: #339933;">;</span> r<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">var</span> nth <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>rows_count <span style="color: #339933;">*</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">'n+'</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>rows_count <span style="color: #339933;">+</span> r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.datatable &gt; tbody &gt; tr:nth-child('</span> <span style="color: #339933;">+</span> nth <span style="color: #339933;">+</span> <span style="color: #0000ff;">')'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>addClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'odd'</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;">// row hover shading</span>
   $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.datatable &gt; tbody &gt; tr'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>hover<span style="color: #009900;">&#40;</span>
      <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #000000; font-weight: bold;">var</span> who <span style="color: #339933;">=</span> rgl<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> rows_count<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span>who<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'td'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>toggleClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hover'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            who <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>who<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">next</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
      <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #000000; font-weight: bold;">var</span> who <span style="color: #339933;">=</span> rgl<span style="color: #009900;">&#40;</span>this<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> rows_count<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            $<span style="color: #009900;">&#40;</span>who<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'td'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>toggleClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hover'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            who <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>who<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">next</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tr'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</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: #009900;">&#40;</span><span style="color: #0000ff;">'.datatable &gt; tbody &gt; tr:odd'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>addClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'odd'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://uphpu.org/2008/12/13/zebra-striping-across-rowspan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chainlove alerts</title>
		<link>http://uphpu.org/2008/10/12/chainlove-alerts/</link>
		<comments>http://uphpu.org/2008/10/12/chainlove-alerts/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 03:02:08 +0000</pubDate>
		<dc:creator>wade</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://uphpu.org/2008/10/12/chainlove-alerts/</guid>
		<description><![CDATA[Any other cyclists out there? You a chainlove junkie too? After finding myself spending too much time refreshing and refreshing, I wrote the following script to watch the site for things I was interested in and send me a text message when they come up. I put it on my machine that&#8217;s always on and [...]]]></description>
			<content:encoded><![CDATA[<p>Any other cyclists out there? You a <a href="http://chainlove.com">chainlove</a> junkie too? After finding myself spending too much time refreshing and refreshing, I wrote the following script to watch the site for things I was interested in and send me a text message when they come up. I put it on my machine that&#8217;s always on and scheduled it to run every ten minutes with <a href="http://developer.apple.com/macosx/launchd.html">launchd</a>. Hopefully it will save you a little time and sanity as well. (Note the wrapped lines.)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* 
 * CHAINLOVE ALERTS
 * 
 * This script scrapes chainlove.com and sends an email when words in 
 * the &quot;watch list&quot; are included in the current product offering.
 */</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// list of words to watch for</span>
<span style="color: #000088;">$watch_list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sunglasses'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'warmers'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'jersey'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'giordana'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// cache file (including path)</span>
<span style="color: #000088;">$cache_file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/tmp/chainlove_alerts.cache'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// scrape page</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">curl_error</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: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;http://www.chainlove.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">curl_error</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: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// pull out the product details</span>
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;h1 id=&quot;item_title&quot;&gt;([^&lt;]+)&lt;\/h1&gt;.*&lt;h3 class=&quot;price&quot;&gt; ¬
   ([^&lt;]+)&lt;\/h3&gt;.*&lt;div id=&quot;regular_price&quot;&gt;\n*\t*\s*([^&lt;]+)&lt;br \/&gt; ¬
   \n\t*\s*([^&lt;]+)&lt;\/div&gt;/sm'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// compare current product against cache product... if same, exit</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #990000;">file_put_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</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;">$cache_product</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</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;">$cache_product</span> <span style="color: #339933;">==</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</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: #990000;">exit</span><span style="color: #009900;">&#40;</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: #990000;">file_put_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</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: #666666; font-style: italic;">// search current product title with &quot;watch list&quot;</span>
<span style="color: #000088;">$send_mail</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$watch_list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$watch_item</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;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$watch_item</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$send_mail</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;">// send email</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$send_mail</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;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'to'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'8015551212@txt.att.net'</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subject'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</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: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</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: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</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;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'from'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Chainlove Alerts &lt;user@example.com&gt;'</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'additional_headers'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'From: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'from'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
   <span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'to'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subject'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> ¬
      <span style="color: #000088;">$mail</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'additional_headers'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://uphpu.org/2008/10/12/chainlove-alerts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

