| 5 |
*/ |
*/ |
| 6 |
|
|
| 7 |
|
|
| 8 |
$exif2gmap_debug=0; |
variable_set('exif2gmap_debug',0); |
| 9 |
|
|
| 10 |
/** |
/** |
| 11 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 40 |
'#title' => t('Enable exif2gmap filter'), |
'#title' => t('Enable exif2gmap filter'), |
| 41 |
'#return_value' => 1, |
'#return_value' => 1, |
| 42 |
'#default_value' => variable_get('exif2gmap_valid', 0), |
'#default_value' => variable_get('exif2gmap_valid', 0), |
|
|
|
| 43 |
); |
); |
| 44 |
|
|
| 45 |
$form['exif2gmap']['exif2gmap_MapKey'] = array( |
$form['exif2gmap']['exif2gmap_MapKey'] = array( |
| 85 |
|
|
| 86 |
$items['admin/settings/exif2gmap'] = array( |
$items['admin/settings/exif2gmap'] = array( |
| 87 |
'title' => 'exif2gmap', |
'title' => 'exif2gmap', |
| 88 |
'description' => 'Control which and where exif2gmap links should be active.', |
'description' => 'Control which and where exif2gmap should be active.', |
| 89 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 90 |
'page arguments' => array('exif2gmap_admin_settings'), |
'page arguments' => array('exif2gmap_admin_settings'), |
| 91 |
'access arguments' => array('administer exif2gmap'), |
'access arguments' => array('administer exif2gmap'), |
| 97 |
|
|
| 98 |
|
|
| 99 |
/** |
/** |
| 100 |
* Implementation of hook_filter(), which enables exif2gmap keyword automatic link. |
* Implementation of hook_filter(), which enables exif2gmap. |
| 101 |
*/ |
*/ |
| 102 |
|
|
| 103 |
function exif2gmap_filter($op, $delta = 0, $format = -1, $text = '') { |
function exif2gmap_filter($op, $delta = 0, $format = -1, $text = '') { |
| 134 |
return $temp; |
return $temp; |
| 135 |
} |
} |
| 136 |
default: |
default: |
| 137 |
|
|
| 138 |
return $text; |
return $text; |
| 139 |
} |
} |
| 140 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
function get_gpsdata($filename){ |
function get_gpsdata($filename){ |
| 157 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 158 |
drupal_set_message("get_gpsdata called ". $filename); |
drupal_set_message("get_gpsdata called ". $filename); |
| 159 |
} |
} |
| 160 |
|
|
| 161 |
$exif = exif_read_data($filename,'COMPUTED'); |
$exif = exif_read_data($filename,'COMPUTED'); |
| 162 |
if($exif==FALSE){ |
if($exif==FALSE){ |
| 163 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 164 |
drupal_set_message("get_gpsdata failed\n"); |
drupal_set_message("get_gpsdata failed\n"); |
| 165 |
} |
} |
| 166 |
} |
} |
| 167 |
|
|
| 168 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 169 |
drupal_set_message("exif=". print_r($exif)); |
drupal_set_message("exif=". print_r($exif)); |
| 170 |
} |
} |
| 171 |
$GPS=array(); |
$GPS=array(); |
| 199 |
if ( ! isset( $gps[$num] ) || ! is_array( $gps[$num] ) ) return ''; |
if ( ! isset( $gps[$num] ) || ! is_array( $gps[$num] ) ) return ''; |
| 200 |
$temp = array(); |
$temp = array(); |
| 201 |
foreach ( $gps[$num] as $expr ) eval("\$temp[] = $expr;"); |
foreach ( $gps[$num] as $expr ) eval("\$temp[] = $expr;"); |
| 202 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 203 |
drupal_set_message($ref .":".$gps[$ref]. ":".$prefix[$gps[$ref]]); |
drupal_set_message($ref .":".$gps[$ref]. ":".$prefix[$gps[$ref]]); |
| 204 |
} |
} |
| 205 |
$ret=$prefix[$gps[$ref]]; |
$ret=$prefix[$gps[$ref]]; |
| 222 |
|
|
| 223 |
$res=array(); |
$res=array(); |
| 224 |
|
|
| 225 |
preg_match_all('/<a.*href=["\']([^"\']*)["\'][^>]*>(.*?)<\/a>/', $text, $res,PREG_SET_ORDER); |
preg_match_all('/<a[^>]*href=["\']([^"\']*)["\'][^>]*>(.*?)<\/a>/', $text, $res,PREG_SET_ORDER); |
| 226 |
$cnt=count($res); |
$cnt=count($res); |
| 227 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 228 |
|
drupal_set_message($url); |
| 229 |
drupal_set_message($text); |
drupal_set_message($text); |
| 230 |
drupal_set_message(print_r($res)); |
drupal_set_message(print_r($res)); |
| 231 |
drupal_set_message("count=".$cnt); |
drupal_set_message("count=".$cnt); |
| 241 |
if($pos!=FALSE){ |
if($pos!=FALSE){ |
| 242 |
$type=NULL; |
$type=NULL; |
| 243 |
$type=strtolower(substr($res[$i][1],$pos+1,strlen($res[$i][1]))); |
$type=strtolower(substr($res[$i][1],$pos+1,strlen($res[$i][1]))); |
| 244 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 245 |
drupal_set_message("res=". $res[$i][1]. " type=" .$type); |
drupal_set_message("res=". $res[$i][1]. " type=" .$type); |
| 246 |
} |
} |
| 247 |
if(strcmp($type,'jpg')!=0 && strcmp($type,'jpeg')!=0){ |
if(strcmp($type,'jpg')!=0 && strcmp($type,'jpeg')!=0){ |
| 248 |
//type is not jpeg.. |
//type is not jpeg.. |
| 249 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 250 |
drupal_set_message("type is not jpeg". $type); |
drupal_set_message("type is not jpeg". $type); |
| 251 |
} |
} |
| 252 |
|
|
| 254 |
}else{ |
}else{ |
| 255 |
//check basepath. |
//check basepath. |
| 256 |
$head=strtolower(substr($res[$i][1],0,4)); |
$head=strtolower(substr($res[$i][1],0,4)); |
| 257 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 258 |
drupal_set_message($head); |
drupal_set_message($head); |
| 259 |
} |
} |
| 260 |
if(strcmp($head,"http")!=0){ |
if(strcmp($head,"http")!=0){ |
| 276 |
} |
} |
| 277 |
} |
} |
| 278 |
} |
} |
| 279 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 280 |
drupal_set_message(print_r($ans)); |
drupal_set_message(print_r($ans)); |
| 281 |
drupal_set_message("latnum=" .count($ans)); |
drupal_set_message("latnum=" .count($ans)); |
| 282 |
drupal_set_message("gps=". print_r($gps)); |
drupal_set_message("gps=". print_r($gps)); |
| 306 |
$Clat=$Clat/count($ans); |
$Clat=$Clat/count($ans); |
| 307 |
$Clon=$Clon/count($ans); |
$Clon=$Clon/count($ans); |
| 308 |
|
|
| 309 |
if($exif2gmap_debug){ |
if(variable_get('exif2gmap_debug','')){ |
| 310 |
drupal_set_message("Clat=" .$Clat." Clon=".$Clon); |
drupal_set_message("Clat=" .$Clat." Clon=".$Clon); |
| 311 |
} |
} |
| 312 |
|
|