/[drupal]/contributions/modules/exif2gmap/exif2gmap.module
ViewVC logotype

Diff of /contributions/modules/exif2gmap/exif2gmap.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.5, Sat May 23 03:52:52 2009 UTC revision 1.1.2.6, Sun May 24 09:39:39 2009 UTC
# Line 52  function exif2gmap_admin_settings() { Line 52  function exif2gmap_admin_settings() {
52    );    );
53    $form['exif2gmap']['exif2gmap_imgsrc_target'] = array(    $form['exif2gmap']['exif2gmap_imgsrc_target'] = array(
54      '#type' => 'checkbox',      '#type' => 'checkbox',
55      '#title' => t('Parse jpeg file located in <img src> tag.'),      '#title' => t('Also parse jpeg file located in <img src> tag.'),
56                  '#description'=> t('If the check is on, the module parse the jpeg which locate in <img src>, instead of jpeg which locate in <a href> tag.'),                  '#description'=> t('If the check is on, the module parse the jpeg which locate in <img src>, in addiion to jpeg which locate in <a href> tag.'),
57      '#return_value' => 1,      '#return_value' => 1,
58      '#default_value' => variable_get('exif2gmap_imgsrc_target', 0),      '#default_value' => variable_get('exif2gmap_imgsrc_target', 0),
59    );    );
# Line 289  function exif2gmap_process($text, $forma Line 289  function exif2gmap_process($text, $forma
289    
290    
291    $url = trim(url('<front>', array('absolute' => TRUE)),"/");    $url = trim(url('<front>', array('absolute' => TRUE)),"/");
292          $res=array();          $res_tmp=array();
293            $res_tmp2=array();
294            $res_tmp3=array();
295            preg_match_all('/<a[^>]*href=["\']([^"\']*)["\'][^>]*>(.*?)<\/a>/', $text, $res_tmp,PREG_SET_ORDER);
296            preg_match_all('/<a[^>]*href=["\']([^"\']*)["\'][^>]*>/', $text, $res_tmp2,PREG_SET_ORDER);
297          if(variable_get('exif2gmap_imgsrc_target','')){          if(variable_get('exif2gmap_imgsrc_target','')){
298                  preg_match_all('/<img[^>]*src=["\']([^"\']*)["\'][^>]*>/', $text, $res,PREG_SET_ORDER);                  preg_match_all('/<img[^>]*src=["\']([^"\']*)["\'][^>]*>/', $text, $res_tmp3,PREG_SET_ORDER);
299                  $cnt=count($res);          }
300          }else{  
301                  preg_match_all('/<a[^>]*href=["\']([^"\']*)["\'][^>]*>(.*?)<\/a>/', $text, $res,PREG_SET_ORDER);  
302                  $cnt=count($res);          /**
303             * Delete duplicate files of each aray.
304             */
305            for($i=0;$i<count($res_tmp);$i++){
306                    for($j=0;$j<count($res_tmp2);$j++){
307                            if(strcmp($res_tmp[$i][1],$res_tmp2[$j][1])==0){
308                                    array_splice($res_tmp2,$j,1);
309                                    $j=0;
310                            }
311                    }
312                    for($j=0;$j<count($res_tmp3);$j++){
313                            if(strcmp($res_tmp[$i][1],$res_tmp3[$j][1])==0){
314                                    array_splice($res_tmp3,$j,1);
315                                    $j=0;
316                            }
317                    }
318          }          }
319            for($i=0;$i<count($res_tmp2);$i++){
320                    for($j=0;$j<count($res_tmp3);$j++){
321                            if(strcmp($res_tmp2[$i][1],$res_tmp3[$j][1])==0){
322                                    array_splice($res_tmp3,$j,1);
323                                    $j=0;
324                            }
325                    }
326            }
327    
328    
329            $res=array_merge($res_tmp,$res_tmp2,$res_tmp3);
330    
331            $cnt=count($res);
332    //              drupal_set_message($text);
333    //              drupal_set_message(print_r($res));
334    //              drupal_set_message("count=".$cnt);
335    
336          if(variable_get('exif2gmap_debug','')){          if(variable_get('exif2gmap_debug','')){
337                  drupal_set_message($url);                  drupal_set_message($url);
# Line 305  function exif2gmap_process($text, $forma Line 339  function exif2gmap_process($text, $forma
339                  drupal_set_message(print_r($res));                  drupal_set_message(print_r($res));
340                  drupal_set_message("count=".$cnt);                  drupal_set_message("count=".$cnt);
341          }          }
342    
343    $ans=array();    $ans=array();
344          $j=-1;          $j=-1;
345    for($i=0;$i<$cnt;$i++){    for($i=0;$i<$cnt;$i++){

Legend:
Removed from v.1.1.2.5  
changed lines
  Added in v.1.1.2.6

  ViewVC Help
Powered by ViewVC 1.1.2