本文整理汇总了PHP中Journal2Utils::gravatar方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::gravatar方法的具体用法?PHP Journal2Utils::gravatar怎么用?PHP Journal2Utils::gravatar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::gravatar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: comment
public function comment()
{
if (!$this->model_journal2_blog->getCommentsStatus(Journal2Utils::getProperty($this->request->get, 'post_id'))) {
$this->response->setOutput(json_encode(array('status' => 'error', 'message' => 'Comments are not allowed on this post!')));
return;
}
$errors = array();
$name = Journal2Utils::getProperty($this->request->post, 'name', '');
$email = Journal2Utils::getProperty($this->request->post, 'email', '');
$website = Journal2Utils::getProperty($this->request->post, 'website', '');
$comment = Journal2Utils::getProperty($this->request->post, 'comment', '');
if (!$name) {
$errors[] = 'name';
}
if (!$email || !preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
$errors[] = 'email';
}
if (!$comment) {
$errors[] = 'comment';
}
if (!$errors) {
$data = $this->model_journal2_blog->createComment(array('post_id' => Journal2Utils::getProperty($this->request->get, 'post_id'), 'parent_id' => Journal2Utils::getProperty($this->request->post, 'parent_id'), 'name' => $name, 'email' => $email, 'website' => $website, 'comment' => $comment));
if ($this->journal2->settings->get('config_blog_settings.auto_approve_comments', '1') === '1') {
$data['time'] = date($this->language->get('time_format'), strtotime($data['date']));
$data['date'] = date($this->language->get('date_format_short'), strtotime($data['date']));
if ($data['website']) {
$data['website'] = trim($data['website']);
$data['website'] = trim($data['website'], '/');
$data['website'] = parse_url($data['website'], PHP_URL_SCHEME) !== null ? $data['website'] : 'http://' . $data['website'];
$data['href'] = $data['website'];
$data['website'] = preg_replace('#^https?://#', '', $data['website']);
}
$data['avatar'] = Journal2Utils::gravatar($data['email'], '', 70);
$this->response->setOutput(json_encode(array('status' => 'success', 'data' => $data, 'message' => $this->journal2->settings->get('blog_form_comment_submitted', 'Comment submitted.'))));
} else {
$this->response->setOutput(json_encode(array('status' => 'success', 'message' => $this->journal2->settings->get('blog_form_comment_awaiting_approval', 'Comment awaiting approval.'))));
}
} else {
$this->response->setOutput(json_encode(array('status' => 'error', 'errors' => $errors)));
}
}