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


PHP Core_Model_Default::setData方法代码示例

本文整理汇总了PHP中Core_Model_Default::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Core_Model_Default::setData方法的具体用法?PHP Core_Model_Default::setData怎么用?PHP Core_Model_Default::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core_Model_Default的用法示例。


在下文中一共展示了Core_Model_Default::setData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepareFbPost

 protected function _prepareFbPost($post_datas)
 {
     $post = new Core_Model_Default();
     $icon_url = "https://graph.facebook.com/{$post_datas['from']['id']}/picture";
     $count_comments = isset($post_datas['comments']['data']) ? count($post_datas['comments']['data']) : 0;
     if ($count_comments == 25) {
         $count_comments = ' > ' . $count_comments;
     }
     $count_likes = isset($post_datas['likes']['data']) ? count($post_datas['likes']['data']) : 0;
     if ($count_likes == 25) {
         $count_likes = ' > ' . $count_likes;
     }
     $comments = array();
     if (!empty($post_datas['comments']['data']) && is_array($post_datas['comments']['data'])) {
         foreach ($post_datas['comments']['data'] as $comment) {
             $created_at = new Zend_Date($comment['created_time'], Zend_Date::ISO_8601, new Zend_Locale('en_US'));
             $comments[] = new Core_Model_Default(array('id' => $comment['id'], 'name' => $comment['from']['name'], 'message' => $comment['message'], 'picture' => "https://graph.facebook.com/{$comment['from']['id']}/picture", 'created_at' => $created_at->toString($this->_("MM/dd/y hh:mm a"))));
         }
     }
     $created_at = new Zend_Date($post_datas['created_time'], Zend_Date::ISO_8601, new Zend_Locale('en_US'));
     $message = '';
     if (!empty($post_datas['message'])) {
         $message = $post_datas['message'];
     } else {
         if (!empty($post_datas['story'])) {
             $message = $post_datas['story'];
         }
     }
     $picture = !empty($post_datas['picture']) ? $post_datas['picture'] : '';
     $picture = !empty($post_datas['object_id']) ? "https://graph.facebook.com/{$post_datas['object_id']}/picture?width=200" : $picture;
     $datas = array('id' => $post_datas['id'], 'author' => $post_datas['from']['name'], "avatar_url" => $icon_url, 'message' => $message, 'short_message' => strlen($message) > 300 ? Core_Model_Lib_String::truncate($message, 300) : $message, 'picture' => $picture, 'details' => !empty($post_datas['name']) ? $post_datas['name'] : '', "link" => isset($post_datas['link']) ? $post_datas['link'] : '', "created_at" => $created_at->toString($this->_("MM/dd/y hh:mm a")), "comments" => $comments, "nbr_of_comments" => $count_comments, "nbr_of_likes" => $count_likes);
     $post->setData($datas);
     return $post;
 }
开发者ID:bklein01,项目名称:SiberianCMS,代码行数:34,代码来源:Facebook.php


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