本文整理汇总了PHP中Core_Model_Default类的典型用法代码示例。如果您正苦于以下问题:PHP Core_Model_Default类的具体用法?PHP Core_Model_Default怎么用?PHP Core_Model_Default使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Core_Model_Default类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getStoreCategeories
public static function getStoreCategeories()
{
$categories = array();
foreach (self::$_store_categories as $key => $category) {
$category_name = parent::_($category);
$categories[$category_name] = new Core_Model_Default(array('id' => $key, 'name' => parent::_($category_name)));
}
ksort($categories);
return $categories;
}
示例3: _initRequest
protected function _initRequest()
{
Core_Model_Language::prepare();
$frontController = $this->_front_controller;
$this->_request = new Siberian_Controller_Request_Http();
$this->_request->isInstalling(!Installer_Model_Installer::isInstalled());
$this->_request->setPathInfo();
$baseUrl = $this->_request->getScheme() . '://' . $this->_request->getHttpHost() . $this->_request->getBaseUrl();
$this->_request->setBaseUrl($baseUrl);
$frontController->setRequest($this->_request);
Siberian_View::setRequest($this->_request);
Core_Model_Default::setBaseUrl($this->_request->getBaseUrl());
}
示例4: save
public function save()
{
if (!$this->getId()) {
$this->setIsRead(0);
}
return parent::save();
}
示例5: save
public function save()
{
if (!$this->getPeriodId()) {
$this->setPeriodId(self::PERIOD_WEEKLY);
}
return parent::save();
}
示例6: __construct
public function __construct($params = array())
{
parent::__construct($params);
$config = array('appId' => self::getAppId(), 'secret' => self::getSecretKey());
$this->_facebook = new Facebook($config);
return $this;
}
示例7: save
public function save()
{
if ($this->getIsIllimited()) {
$this->setEndDate(null);
}
parent::save();
}
示例8: save
public function save()
{
parent::save();
if ($this->getAppId() and is_array($this->_value_ids)) {
$this->saveValueIds($this->getAppId());
}
}
示例9: save
public function save()
{
parent::save();
$blocks = $this->getData('block') ? $this->getData('block') : array();
// if($this->getData('block')) {
$this->getTable()->saveBlock($this->getId(), $blocks);
// }
}
示例10: find
public function find($id, $field = null)
{
parent::find($id, $field);
if (!$this->getId()) {
$this->setRadius(10.0);
}
return $this;
}
示例11: delete
public function delete()
{
if (!$this->getId()) {
return $this;
}
$this->getRootCategory()->delete();
return parent::delete();
}
示例12: save
public function save()
{
parent::save();
if ($resources = $this->getResources()) {
$this->getTable()->saveResources($this->getId(), $resources);
}
return $this;
}
示例13: save
public function save()
{
parent::save();
if ($this->_language_data) {
$this->getTable()->saveLanguageData($this->getId(), $this->_language_data);
}
return $this;
}
示例14: prepareFeature
public function prepareFeature($option_value)
{
parent::prepareFeature($option_value);
if (!$this->getId()) {
$this->setValueId($option_value->getValueId())->setAppId($option_value->getAppId())->save();
}
return $this;
}
示例15: save
public function save()
{
if ($this->getAppId()) {
$this->getTable()->saveAppBlock($this);
} else {
parent::save();
}
return $this;
}