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


PHP Core_Model_Item_Abstract::getTitle方法代码示例

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


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

示例1: index

 public function index(Core_Model_Item_Abstract $item)
 {
     // Check if not search allowed
     if (isset($item->search) && !$item->search) {
         return false;
     }
     // Get info
     $type = $item->getType();
     $id = $item->getIdentity();
     $title = substr(trim($item->getTitle()), 0, 255);
     $description = substr(trim($item->getDescription()), 0, 255);
     $keywords = substr(trim($item->getKeywords()), 0, 255);
     $hiddenText = substr(trim($item->getHiddenSearchData()), 0, 255);
     // Ignore if no title and no description
     if (!$title && !$description) {
         return false;
     }
     // Check if already indexed
     $table = Engine_Api::_()->getDbtable('search', 'core');
     $select = $table->select()->where('type = ?', $type)->where('id = ?', $id)->limit(1);
     $row = $table->fetchRow($select);
     if (null === $row) {
         $row = $table->createRow();
         $row->type = $type;
         $row->id = $id;
     }
     $row->title = $title;
     $row->description = $description;
     $row->keywords = $keywords;
     $row->hidden = $hiddenText;
     $row->save();
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:32,代码来源:Search.php

示例2: addNotification

 /**
  * Add a notification
  *
  * @param User_Model_User $user The user to receive the notification
  * @param Core_Model_Item_Abstract $subject The item responsible for causing the notification
  * @param Core_Model_Item_Abstract $object Bleh
  * @param string $type
  * @param array $params
  * @return Activity_Model_Notification
  */
 public function addNotification(User_Model_User $user, Core_Model_Item_Abstract $subject, Core_Model_Item_Abstract $object, $type, array $params = null)
 {
     // We may want to check later if a request exists of the same type already
     $row = $this->createRow();
     $row->user_id = $user->getIdentity();
     $row->subject_type = $subject->getType();
     $row->subject_id = $subject->getIdentity();
     $row->object_type = $object->getType();
     $row->object_id = $object->getIdentity();
     $row->type = $type;
     $row->params = $params;
     $row->date = date('Y-m-d H:i:s');
     $row->save();
     // Try to add row to caching
     if (Zend_Registry::isRegistered('Zend_Cache')) {
         $cache = Zend_Registry::get('Zend_Cache');
         $id = __CLASS__ . '_new_' . $user->getIdentity();
         $cache->save(true, $id);
     }
     // Try to send an email
     $notificationSettingsTable = Engine_Api::_()->getDbtable('notificationSettings', 'activity');
     if ($notificationSettingsTable->checkEnabledNotification($user, $type) && !empty($user->email)) {
         // Main params
         $defaultParams = array('host' => $_SERVER['HTTP_HOST'], 'email' => $user->email, 'date' => time(), 'recipient_title' => $user->getTitle(), 'recipient_link' => $user->getHref(), 'recipient_photo' => $user->getPhotoUrl('thumb.icon'), 'sender_title' => $subject->getTitle(), 'sender_link' => $subject->getHref(), 'sender_photo' => $subject->getPhotoUrl('thumb.icon'), 'object_title' => $object->getTitle(), 'object_link' => $object->getHref(), 'object_photo' => $object->getPhotoUrl('thumb.icon'), 'object_description' => $object->getDescription());
         // Extra params
         try {
             $objectParent = $object->getParent();
             if ($objectParent && !$objectParent->isSelf($object)) {
                 $defaultParams['object_parent_title'] = $objectParent->getTitle();
                 $defaultParams['object_parent_link'] = $objectParent->getHref();
                 $defaultParams['object_parent_photo'] = $objectParent->getPhotoUrl('thumb.icon');
                 $defaultParams['object_parent_description'] = $objectParent->getDescription();
             }
         } catch (Exception $e) {
         }
         try {
             $objectOwner = $object->getParent();
             if ($objectOwner && !$objectOwner->isSelf($object)) {
                 $defaultParams['object_owner_title'] = $objectOwner->getTitle();
                 $defaultParams['object_owner_link'] = $objectOwner->getHref();
                 $defaultParams['object_owner_photo'] = $objectOwner->getPhotoUrl('thumb.icon');
                 $defaultParams['object_owner_description'] = $objectOwner->getDescription();
             }
         } catch (Exception $e) {
         }
         // Send
         try {
             Engine_Api::_()->getApi('mail', 'core')->sendSystem($user, 'notify_' . $type, array_merge($defaultParams, (array) $params));
         } catch (Exception $e) {
             // Silence exception
         }
     }
     return $row;
 }
开发者ID:robeendey,项目名称:ce,代码行数:64,代码来源:Notifications.php


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