| 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 |
); |
); |
| 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); |
| 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++){ |