本文整理汇总了PHP中Jaws_Utils::GetRemoteAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_Utils::GetRemoteAddress方法的具体用法?PHP Jaws_Utils::GetRemoteAddress怎么用?PHP Jaws_Utils::GetRemoteAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jaws_Utils
的用法示例。
在下文中一共展示了Jaws_Utils::GetRemoteAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Trackback
/**
* Saves a new trackback if all is ok and sends response
* The function other people send to so our blog gadget
* gets trackbacks
*
* @access public
* @return string trackback xml response
*/
function Trackback()
{
// Based on Wordpress trackback implementation
$tb_msg_error = '<?xml version="1.0" encoding="iso-8859-1"?><response><error>1</error><message>#MESSAGE#</message></response>';
$tb_msg_ok = '<?xml version="1.0" encoding="iso-8859-1"?><response><error>0</error></response>';
$sender = Jaws_Utils::GetRemoteAddress();
$ip = $sender['proxy'] . (!empty($sender['proxy']) ? '-' : '') . $sender['client'];
$post = jaws()->request->fetch(array('title', 'url', 'blog_name', 'excerpt'), 'post');
if (is_null($post['title']) || is_null($post['url']) || is_null($post['blog_name']) || is_null($post['excerpt'])) {
Jaws_Header::Location('');
}
$id = jaws()->request->fetch('id', 'get');
if (is_null($id)) {
$id = jaws()->request->fetch('id', 'post');
if (is_null($id)) {
$id = '';
}
}
$title = urldecode($post['title']);
$url = urldecode($post['url']);
$blogname = urldecode($post['blog_name']);
$excerpt = urldecode($post['excerpt']);
if (trim($id) == '') {
Jaws_Header::Location('');
} elseif (empty($title) && empty($url) && empty($blogname)) {
$url = $this->gadget->urlMap('SingleView', array('id' => $id), true);
Jaws_Header::Location($url);
} elseif ($this->gadget->registry->fetch('trackback') == 'true') {
header('Content-Type: text/xml');
$model = $this->gadget->model->load('Trackbacks');
$trackback = $model->NewTrackback($id, $url, $title, $excerpt, $blogname, $ip);
if (Jaws_Error::IsError($trackback)) {
return str_replace('#MESSAGE#', $trackback->GetMessage(), $tb_msg_error);
}
return $tb_msg_ok;
} else {
header('Content-Type: text/xml');
return str_replace('#MESSAGE#', _t('BLOG_TRACKBACK_DISABLED'), $tb_msg_error);
}
}