当前位置: 首页>>代码示例>>PHP>>正文


PHP Journal2Utils::gravatar方法代码示例

本文整理汇总了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)));
     }
 }
开发者ID:erickacevedor,项目名称:Opencart----Journal,代码行数:41,代码来源:blog.php


注:本文中的Journal2Utils::gravatar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。