本文整理汇总了PHP中geo_latlng函数的典型用法代码示例。如果您正苦于以下问题:PHP geo_latlng函数的具体用法?PHP geo_latlng怎么用?PHP geo_latlng使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了geo_latlng函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
switch ($argv[0]) {
case '_best':
$tab_option = 2;
$page_title = _('mejores notas') . ' | ' . _('menéame');
$min_date = date("Y-m-d H:00:00", time() - 86400);
// about 24 hours
$where = "post_date > '{$min_date}'";
$order_by = "ORDER BY post_karma desc";
$limit = "LIMIT {$offset},{$page_size}";
$rows = $db->get_var("SELECT count(*) FROM posts where post_date > '{$min_date}'");
break;
case '_geo':
$tab_option = 3;
$page_title = _('nótame') . ' geo | ' . _('menéame');
require_once mnminclude . 'geo.php';
if ($current_user->user_id > 0 && ($latlng = geo_latlng('user', $current_user->user_id))) {
geo_init('onLoad', $latlng, 5);
} else {
geo_init('onLoad', false, 2);
}
break;
case '':
case '_all':
$tab_option = 1;
//$sql = "SELECT SQL_CACHE post_id FROM posts ORDER BY post_id desc limit $offset,$page_size";
$where = "post_id > 0";
$order_by = "ORDER BY post_id desc";
$limit = "LIMIT {$offset},{$page_size}";
//$rows = $db->get_var("SELECT count(*) FROM posts");
$rows = Post::count();
$min_date = date("Y-m-d 00:00:00", time() - 86400 * 10);
示例2: foreach
foreach ($posts as $post_id) {
$post = Post::from_db($post_id);
if (!$post) {
continue;
}
$title = text_to_summary($post->clean_content(), 40);
$title = $post->username . ': ' . htmlentities2unicodeentities($title);
$content = htmlentities2unicodeentities(put_smileys($post->to_html($post->clean_content())));
echo "\t<item>\n";
echo "\t\t<title>{$title}</title>\n";
echo "\t\t<link>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</link>\n";
echo "\t\t<pubDate>" . date("r", $post->date) . "</pubDate>\n";
echo "\t\t<dc:creator>{$post->username}</dc:creator>\n";
echo "\t\t<guid>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</guid>\n";
// Insert GEO
if ($latlng = geo_latlng('user', $post->author)) {
echo "\t\t<georss:point>{$latlng->lat} {$latlng->lng}</georss:point>\n";
}
echo "\t\t<description><![CDATA[{$content}";
echo '</p><p>» ' . _('autor') . ': <strong>' . $post->username . '</strong></p>';
echo "]]></description>\n";
echo "\t</item>\n\n";
}
}
do_footer();
function do_header($title)
{
global $if_modified, $last_modified, $dblang, $globals;
if (!$last_modified > 0) {
if ($if_modified > 0) {
$last_modified = $if_modified;
示例3: do_profile
function do_profile()
{
global $user, $current_user, $login, $db, $globals;
$options = array();
$options[$user->username] = get_user_uri($user->username);
//$options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories');
if ($current_user->user_id == $user->id || $current_user->user_level == 'god') {
$options[_('modificar perfil') . ' →'] = $globals['base_url'] . 'profile?login=' . urlencode($login);
$globals['extra_js'][] = 'jquery.flot.min.js';
$globals['extra_js'][] = 'jquery.flot.time.min.js';
}
$post = new Post();
if (!$post->read_last($user->id)) {
$post = NULL;
}
if (!empty($user->url)) {
if ($user->karma < 10) {
$nofollow = 'rel="nofollow"';
} else {
$nofollow = '';
}
if (!preg_match('/^http/', $user->url)) {
$url = 'http://' . $user->url;
} else {
$url = $user->url;
}
}
if ($current_user->user_id > 0 && $current_user->user_id != $user->id) {
$friend_icon = User::friend_teaser($current_user->user_id, $user->id);
}
$selected = 0;
$rss = 'rss?sent_by=' . $user->id;
$rss_title = _('envíos en rss2');
$geodiv = $current_user->user_id > 0 && $current_user->user_id != $user->id && $globals['latlng'] && ($my_latlng = geo_latlng('user', $current_user->user_id));
$show_email = $current_user->user_id > 0 && !empty($user->public_info) && ($current_user->user_id == $user->id || $current_user->user_level == 'god');
$clones_from = "and clon_date > date_sub(now(), interval 30 day)";
if ($current_user->admin) {
$nclones = $db->get_var("select count(distinct clon_to) from clones where clon_from = {$user->id} {$clones_from}");
}
$user->all_stats();
if (!$user->bio) {
$user->bio = '';
}
if ($user->total_links > 1) {
$entropy = intval(($user->blogs() - 1) / ($user->total_links - 1) * 100);
}
if ($user->total_links > 0 && $user->published_links > 0) {
$percent = intval($user->published_links / $user->total_links * 100);
} else {
$percent = 0;
}
if ($globals['do_geo'] && $current_user->user_id == $user->id) {
ob_start();
geo_coder_print_form('user', $current_user->user_id, $globals['latlng'], _('ubícate en el mapa (si te apetece)'), 'user');
$geo_form = ob_get_clean();
}
$addresses = array();
if ($current_user->user_id == $user->id || $current_user->user_level == 'god' && !$user->admin) {
// gods and admins know each other for sure, keep privacy
$dbaddresses = $db->get_results("select distinct(vote_ip_int) as ip from votes where vote_type in ('links', 'comments', 'posts') and vote_user_id = {$user->id} order by vote_date desc limit 30");
// Try with comments
if (!$dbaddresses) {
$dbaddresses = $db->get_results("select distinct(comment_ip_int) as ip from comments where comment_user_id = {$user->id} and comment_date > date_sub(now(), interval 30 day) order by comment_date desc limit 30");
}
if ($dbaddresses) {
foreach ($dbaddresses as $dbaddress) {
$ip = inet_dtop($dbaddress->ip);
$ip_pattern = preg_replace('/[\\.\\:][0-9a-f]+$/i', '', $ip);
if (!in_array($ip_pattern, $addresses)) {
$addresses[] = $ip_pattern;
}
}
}
}
$prefs['use_bar'] = User::get_pref($user->id, 'use_bar');
$prefs['last_com_first'] = User::get_pref($user->id, 'last_com_first');
$vars = compact('post', 'options', 'selected', 'rss', 'rss_title', 'geodiv', 'user', 'my_latlng', 'url', 'nofollow', 'nclones', 'show_email', 'entropy', 'percent', 'geo_form', 'addresses', 'friend_icon');
return Haanga::Load('/user/profile.html', $vars);
}
示例4: date
} else {
echo " <pubDate>" . date("r", $link->date) . "</pubDate>\n";
}
echo "\t\t<dc:creator>{$link->username}</dc:creator>\n";
echo "\t\t<category><![CDATA[{$category_name}]]></category>\n";
// Add tags as categories
if (!empty($link->tags)) {
$tags_array = explode(",", $link->tags);
foreach ($tags_array as $tag_item) {
$tag_item = trim($tag_item);
echo "\t\t<category><![CDATA[" . $tag_item . "]]></category>\n";
}
}
echo "\t\t<guid>{$permalink}</guid>\n";
// Insert GEO
if ($latlng = geo_latlng('link', $link->id)) {
echo "\t\t<georss:point>{$latlng->lat} {$latlng->lng}</georss:point>\n";
}
echo ' <description><![CDATA[';
// In case of meta, only sends votes and karma
// developed for alianzo.com
if ($thumb = $link->has_thumb()) {
echo "<img src='{$thumb}' width='{$link->thumb_x}' height='{$link->thumb_y}' alt='' class='thumbnail' style='float:right;margin-left: 3px' align='right' hspace='3'/>";
}
echo '<p>' . $content . '</p>';
echo '<p><strong>' . _('etiquetas') . '</strong>: ' . preg_replace('/,([^ ])/', ', $1', $link->tags) . '</p>';
if (time() - $link->date < 172800) {
// Only add the votes/comments image if the link has less than two days
echo '<p><a href="' . $permalink . '"><img src="http://' . get_server_name() . $globals['base_url'] . 'backend/vote_com_img.php?id=' . $link->id . '" alt="votes" width="200" height="16"/></a></p>';
}
if ($link->status != 'published') {
示例5: get_latlng
function get_latlng() {
require_once(mnminclude.'geo.php');
return geo_latlng('link', $this->id);
}
示例6: do_profile
function do_profile() {
global $user, $current_user, $login, $db, $globals;
$options = array();
$options[$user->username] = get_user_uri($user->username);
$options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories');
if ($current_user->user_id == $user->id || $current_user->user_level == 'god') {
$options[_('modificar perfil').' →'] = $globals['base_url'].'profile.php?login='.urlencode($login);
}
do_user_subheader($options, 0, 'rss2.php?sent_by='.$user->id, _('envíos en rss2'));
if(!empty($user->url)) {
if ($user->karma < 10) $nofollow = 'rel="nofollow"';
if (!preg_match('/^http/', $user->url)) $url = 'http://'.$user->url;
else $url = $user->url;
}
// Print last user's note
$post = new Post;
if ($post->read_last($user->id)) {
echo '<div id="addpost"></div>';
echo '<ol class="comments-list" id="last_post">';
echo '<li>';
$post->print_summary();
echo '</li>';
echo "</ol>\n";
}
echo '<fieldset><legend>';
echo _('información personal');
echo '</legend>';
// Avatar
echo '<div style="float:right;text-align:center">';
echo '<img id="avatar" class="avatar" src="'.get_avatar_url($user->id, $user->avatar, 80).'" width="80" height="80" alt="'.$user->username.'" title="avatar" />';
// Print the button and associated div to change the avatar
if ($current_user->user_id == $user->id) {
echo '<div id="avatar_indicator" style="margin:0;padding:0;height:12px"></div>';
echo '<button id="avatar_upload" style="margin:0" title="'._('imagen cuadrada de no más de 400 KB, sin transparencias').'">'._('cambiar avatar').'</button>'."\n";
@include(mnminclude.'foreign/avatar_upload.html');
}
echo '</div>';
// Geo div
echo '<div style="width:140px; float:left;">';
if($globals['do_geo']) {
echo '<div id="map" class="thumbnail" style="width:130px; height:130px; overflow:hidden; float:left"></div>';
if ($current_user->user_id > 0 && $current_user->user_id != $user->id && $globals['latlng'] && ($my_latlng = geo_latlng('user', $current_user->user_id))) {
$distance = (int) geo_distance($my_latlng, $globals['latlng']);
echo '<p style="color: #FF9400; font-size: 90%">'."$user->username "._('está a')." <strong>$distance kms</strong></p>";
}
}
echo ' </div>';
echo '<div style="float:left;min-width:65%">';
echo '<dl>';
if(!empty($user->username)) {
echo '<dt>'._('usuario').':</dt><dd>';
if (!empty($url)) {
echo '<a href="'.$url.'" '.$nofollow.'>'.$user->username.'</a>';
} else {
echo $user->username;
}
$user->print_medals();
$clones_from = "and clon_date > date_sub(now(), interval 30 day)";
if ($current_user->admin &&
($nclones = $db->get_var("select count(distinct clon_to) from clones where clon_from = $user->id $clones_from")) > 0 ) {
echo ' (<a href="javascript:modal_from_ajax(\''.$globals['base_url'].'backend/ip_clones.php?id='.
$user->id.'\', \''. _('clones por IP'). '\')" title="'._('clones').'">'._('clones').'</a><sup>'.$nclones.'</sup>) ';
}
// Print friend icon
if ($current_user->user_id > 0 && $current_user->user_id != $user->id) {
echo ' <a id="friend-'.$current_user->user_id.'-'.$user->id.'" href="javascript:get_votes(\'get_friend.php\',\''.$current_user->user_id.'\',\'friend-'.$current_user->user_id.'-'.$user->id.'\',0,\''.$user->id.'\')">'.User::friend_teaser($current_user->user_id, $user->id).'</a>';
}
// Print user detailed info
if ($user->id==$current_user->user_id || $current_user->admin) {
echo " (" . _('id'). ": <em>$user->id</em>, ";
echo "<em>$user->level</em>)";
}
if($current_user->user_level=='god') {
echo " (<em>$user->username_register</em>)";
}
echo '</dd>';
}
if(!empty($user->names)) {
echo '<dt>'._('nombre').':</dt><dd>'.$user->names.'</dd>';
}
// Show public info is it's a friend or god
if($current_user->user_id > 0 && !empty($user->public_info) && (
$current_user->user_id == $user->id
|| $current_user->user_level=='god'
//.........这里部分代码省略.........
示例7: get_latlng
function get_latlng()
{
require_once mnminclude . 'geo.php';
return geo_latlng('user', $this->id);
}
示例8: intval
include_once mnminclude . 'geo.php';
if (empty($_GET['id'])) {
die;
}
$id = intval($_GET['id']);
$user = new User();
$user->id = $id;
if (!$user->read()) {
die;
}
if ($user->avatar) {
echo '<div style="float: left;"><img hspace="4" src="' . get_avatar_url($user->id, $user->avatar, 80) . '" width="80" height="80" alt="' . $user->username . '"/></div>';
}
echo '<strong>' . _('usuario') . ':</strong> ' . $user->username;
if ($current_user->user_id > 0 && $current_user->user_id != $user->id) {
echo ' ' . friend_teaser($current_user->user_id, $user->id);
}
echo '<br/>';
echo '<strong>' . _('nombre') . ':</strong> ' . $user->names . '<br/>';
echo '<strong>' . _('web') . ':</strong> ' . $user->url . '<br/>';
echo '<strong>' . _('karma') . ':</strong> ' . $user->karma . '<br/>';
echo '<strong>' . _('desde') . ':</strong> ' . get_date($user->date) . '<br/>';
if ($current_user->user_id > 0 && $current_user->user_id != $user->id && ($her_latlng = geo_latlng('user', $user->id)) && ($my_latlng = geo_latlng('user', $current_user->user_id))) {
$distance = (int) geo_distance($my_latlng, $her_latlng);
echo '<strong>' . _('distancia') . ':</strong> ' . $distance . ' kms<br/>';
}
$post = new Post();
if ($post->read_last($user->id)) {
echo '<br clear="left"><strong>' . _('última nota') . '</strong>: ';
$post->print_text();
}
示例9: do_profile
function do_profile()
{
global $user, $current_user, $login, $db, $globals;
if (!empty($user->url)) {
if ($user->karma < 10) {
$nofollow = 'rel="nofollow"';
}
if (!preg_match('/^http/', $user->url)) {
$url = 'http://' . $user->url;
} else {
$url = $user->url;
}
}
$post = new Post();
if ($post->read_last($user->id)) {
echo '<ol class="comments-list" id="last_post">';
$post->print_summary();
echo "</ol>\n";
}
echo '<fieldset><legend>';
echo _('información personal');
if ($login === $current_user->user_login) {
echo ' (<a href="' . $globals['base_url'] . 'profile.php">' . _('modificar') . '</a>)';
} elseif ($current_user->user_level == 'god') {
echo ' (<a href="' . $globals['base_url'] . 'profile.php?login=' . urlencode($login) . '">' . _('modificar') . '</a>)';
}
echo '</legend>';
// Avatar
echo '<img class="thumbnail" src="' . get_avatar_url($user->id, $user->avatar, 80) . '" width="80" height="80" alt="' . $user->username . '" title="avatar" />';
// Geo div
echo '<div style="width:140px; float:left;">';
if ($globals['do_geo']) {
echo '<div id="map" class="thumbnail" style="width:130px; height:130px; overflow:hidden; float:left"></div>';
if ($current_user->user_id > 0 && $current_user->user_id != $user->id && $globals['latlng'] && ($my_latlng = geo_latlng('user', $current_user->user_id))) {
$distance = (int) geo_distance($my_latlng, $globals['latlng']);
echo '<p style="color: #FF9400; font-size: 90%">' . _('estás a') . " <strong>{$distance} kms</strong> " . _('de') . ' ' . $user->username . '</p>';
}
}
echo ' </div>';
echo '<div style="float:left;min-width:65%">';
echo '<dl>';
if (!empty($user->username)) {
echo '<dt>' . _('usuario') . ':</dt><dd>';
if (!empty($url)) {
echo '<a href="' . $url . '" ' . $nofollow . '>' . $user->username . '</a>';
} else {
echo $user->username;
}
// Print friend icon
if ($current_user->user_id > 0 && $current_user->user_id != $user->id) {
echo ' <a id="friend-' . $current_user->user_id . '-' . $user->id . '" href="javascript:get_votes(\'get_friend.php\',\'' . $current_user->user_id . '\',\'friend-' . $current_user->user_id . '-' . $user->id . '\',0,\'' . $user->id . '\')">' . friend_teaser($current_user->user_id, $user->id) . '</a>';
}
// Print user detailed info
if ($login === $current_user->user_login || $current_user->user_level == 'god') {
echo " (" . _('id') . ": <em>{$user->id}</em>)";
echo " (<em>{$user->level}</em>)";
}
if ($current_user->user_level == 'god') {
echo " (<em>{$user->username_register}</em>)";
}
echo '</dd>';
}
if (!empty($user->names)) {
echo '<dt>' . _('nombre') . ':</dt><dd>' . $user->names . '</dd>';
}
// Show public info is it's a friend or god
if ($current_user->user_id > 0 && !empty($user->public_info) && ($current_user->user_id == $user->id || $current_user->user_level == 'god')) {
//friends cannot see the IM address (it was public before)
echo '<dt>' . _('IM/email') . ':</dt><dd> ' . $user->public_info . '</dd>';
}
if (!empty($url)) {
echo '<dt>' . _('sitio web') . ':</dt><dd><a href="' . $url . '" ' . $nofollow . '>' . $url . '</a></dd>';
}
echo '<dt>' . _('desde') . ':</dt><dd>' . get_date_time($user->date) . '</dd>';
if ($current_user->user_level == 'god') {
echo '<dt>' . _('email') . ':</dt><dd>' . $user->email . " (<em>{$user->email_register}</em>)</dd>";
}
if ($user->id == $current_user->user_id || $current_user->user_level == 'god') {
echo '<dt>' . _('clave API') . ':</dt><dd id="api-key"><a href="javascript:get_votes(\'get_user_api_key.php\',\'\',\'api-key\',0,\'' . $user->id . '\')">' . _('leer clave API') . '</a> (' . _('no la divulgues') . ')</dd>';
if (!empty($user->adcode)) {
echo '<dt>' . _('Código AdSense') . ':</dt><dd>' . $user->adcode . ' </dd>';
echo '<dt>' . _('Canal AdSense') . ':</dt><dd>' . $user->adchannel . ' </dd>';
}
}
echo '<dt>' . _('karma') . ':</dt><dd>' . $user->karma;
// Karma details
if ($user->id == $current_user->user_id || $current_user->user_level == 'god') {
echo ' (<a href="javascript:modal_from_ajax(\'' . $globals['base_url'] . 'backend/get_karma_numbers.php?id=' . $user->id . '\', \'' . _('cálculo del karma') . '\')" title="' . _('detalles') . '">' . _('detalle cálculo') . '</a>)';
}
echo '</dd>';
$user->all_stats();
echo '<dt>' . _('noticias enviadas') . ':</dt><dd>' . $user->total_links . '</dd>';
if ($user->total_links > 0 && $user->published_links > 0) {
$percent = intval($user->published_links / $user->total_links * 100);
} else {
$percent = 0;
}
if ($user->total_links > 1) {
$entropy = intval(($user->blogs() - 1) / ($user->total_links - 1) * 100);
echo '<dt><em>' . _('entropía') . '</em>:</dt><dd>' . $entropy . '%</dd>';
//.........这里部分代码省略.........
示例10: _
echo '<br/>';
if ($user->names) {
echo '<strong>' . _('nombre') . ':</strong> ' . $user->names . '<br/>';
}
if ($user->url) {
echo '<strong>' . _('web') . ':</strong> ' . $user->url . '<br/>';
}
echo '<strong>' . _('karma') . ':</strong> ' . $user->karma . '<br/>';
/*
echo '<strong>' . _('ranking') . ':</strong> #' . $user->ranking() . '<br/>';
*/
echo '<strong>' . _('desde') . ':</strong> ' . get_date($user->date) . '<br/>';
if ($user->total_images > 0) {
echo '<strong>' . _('imágenes') . ':</strong> ' . $user->total_images . '<br/>';
}
if ($globals['google_maps_api'] && $current_user->user_id > 0 && $current_user->user_id != $user->id && ($her_latlng = geo_latlng('user', $user->id)) && ($my_latlng = geo_latlng('user', $current_user->user_id))) {
$distance = (int) geo_distance($my_latlng, $her_latlng);
echo '<strong>' . _('distancia') . ':</strong> ' . $distance . ' kms<br/>';
}
if ($user->bio) {
echo '<br clear="left"><strong>' . _('bio') . '</strong>:<br/>';
echo text_to_html($user->bio);
}
/*
$post = new Post;
if ($post->read_last($user->id)) {
echo '<br clear="left"><strong>'._('última nota').'</strong>:<br/>';
$post->show_avatar = false;
$post->print_text(150);
}
*/