title: Problem echoing php string as javascript function
body: <p>I'm using Jaipho to display images to a mobile gallery from a custom Wordpress plugin. The wordpress theme that uses the Jaipho gallery is displayed using the WP-mobile-detector plugin.</p>
  
  <p>The problem I am having is when I use php to gather the URLs to the photos to echo out a function to be parsed by javascript. I took the resulting static javascript code from the element inspector of Safari and pasted it into my code, commenting out the php, and it works everywhere. Safari for iOS doesn't seem to like the javascript code generated by the php.</p>
  
  <ul>
  <li>HTML 5
  <ul>
  <li><code>&lt;DOCTYPE html&gt;</code></li>
  <li><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;</code></li>
  <li><code>&lt;meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/&gt;</code></li>
  </ul></li>
  <li>PHP 5.2.6</li>
  <li>Wordpress 3.2.1</li>
  </ul>
  
  <p>When it works:</p>
  
  <ul>
  <li>User Agent set to iPhone on Safari</li>
  <li><p>Static code replaces php-generated code</p>
  
  <pre><code>$imageArray = $case-&gt;images_assc_array();  
  $i = 0;  
  foreach($imageArray['views'] as $view_name =&gt; $view_images) {  
     $before_img = $view_images['before'];  
     $after_img = $view_images['after'];  
  
     echo "dao.ReadImage($i,'".$before_img-&gt;medium_size()."','".$before_img-&gt;small_size()."','".ucfirst($view_name)." Before','".$case-&gt;description."');";  
     $i++;  
     echo "dao.ReadImage($i,'".$after_img-&gt;medium_size()."','".$after_img-&gt;small_size()."','".ucfirst($view_name)." After','".$case-&gt;description."');";  
     $i++;  
  }
  </code></pre></li>
  </ul>
  
  <p>Expected example generated output:   </p>
  
  <pre><code>    dao.ReadImage( 0,'/wp-content/uploads/rmgallery_images/medium/408/before-front.jpg','/wp-content/uploads/rmgallery_images/small/408/before-front.jpg','Front Before','38 year old who underwent a tummy tuck.');  
      dao.ReadImage( 1,'/wp-content/uploads/rmgallery_images/medium/410/after-front.jpg','/wp-content/uploads/rmgallery_images/small/410/after-front.jpg','Front After','38 year old who underwent a tummy tuck.');
      dao.ReadImage( 2,'/wp-content/uploads/rmgallery_images/medium/409/before-side.jpg','/wp-content/uploads/rmgallery_images/small/409/before-side.jpg','Side Before','38 year old who underwent a tummy tuck.');
      dao.ReadImage( 3,'/wp-content/uploads/rmgallery_images/medium/411/after-side.jpg','/wp-content/uploads/rmgallery_images/small/411/after-side.jpg','Side After','38 year old who underwent a tummy tuck.');
  </code></pre>