本文整理汇总了PHP中Self::loadObjectByURI方法的典型用法代码示例。如果您正苦于以下问题:PHP Self::loadObjectByURI方法的具体用法?PHP Self::loadObjectByURI怎么用?PHP Self::loadObjectByURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Self
的用法示例。
在下文中一共展示了Self::loadObjectByURI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mediaObject
/**
* Models a collection media object for media feeds
*
* @param type $mediaObject
* @param type $mediaObjectType
* @param type $mediaObjectId
*
* return void;
*/
public static function mediaObject(&$mediaObject, $collection)
{
//If the media object is not a collection! skip it
//1.Load the collection!
if (!is_object($collection) && is_a($collection, Entity::class)) {
$thisModel = new Self();
$attachment = $thisModel->loadObjectByURI($collection);
}
//If the media object is not a collection! skip it
$objectTypeshaystack = array("collection");
if (!in_array($collection->getObjectType(), $objectTypeshaystack)) {
return;
}
//Nothing to do here if we can't deal with it!
$collectionObject = new Media\Collection();
//2.Get all the elements in the collection, limit 5 if more than 5
//3.Trigger their timeline display
$collectionObject->set("objectType", "collection");
$collectionObject->set("uri", $collection->getObjectURI());
//Now lets populate our collection with Items
$collectionItems = $collection->getPropertyValue("collection_items");
$collectionItemize = explode(",", $collectionItems);
$collectionObject->set("totalItems", count($collectionItemize));
if (is_array($collectionItemize) && !empty($collectionItemize)) {
$items = array();
foreach ($collectionItemize as $item) {
$itemObject = Media\MediaLink::getNew();
//@TODO Will probably need to query for objectType of items in collection?
//@TODO Also this will help in removing objects from collections that have previously been deleted
$itemObjectEntity = $thisModel->load->model("attachment", "system")->loadObjectByURI($item);
//Load the item with the attachment to get all its properties
//Now check object_id exists;
//If not delete the object all together;
//Also check if attachments_src is defined and exsits;
//If attachments id does not exists, delete the item from this collection;
$itemObjectURL = !empty($item) ? "/system/object/{$item}/" : "http://placeskull.com/100/100/999999";
$itemObject->set("url", $itemObjectURL);
$itemObject->set("uri", $item);
$itemObject->set("height", null);
$itemObject->set("width", null);
$itemObject->set("type", $itemObjectEntity->getPropertyValue("attachment_type"));
$itemObject->set("name", $itemObjectEntity->getPropertyValue("attachment_name"));
$items[] = $itemObject::getArray();
unset($itemObject);
}
$collectionObject->set("items", $items);
}
//Now set the collection Object as the media Object
$mediaObject = $collectionObject;
unset($collection);
unset($collectionObject);
//All done
return true;
}
示例2: mediaObject
/**
* Models a collection media object for media feeds
*
* @param type $mediaObject
* @param type $mediaObjectType
* @param type $mediaObjectId
*
* return void;
*/
public static function mediaObject(&$mediaObject, $attachment)
{
//Allowed media objects
$types = \Library\Config::getParam("allowed-types", array(), "attachments");
//1.Load the collection!
if (!is_object($attachment) && is_a($attachment, 'Platform\\Entity')) {
$thisModel = new Self();
$attachment = $thisModel->loadObjectByURI($attachment);
}
//If the media object is not a collection! skip it
$objectTypeshaystack = array("attachment");
if (!in_array($attachment->getObjectType(), $objectTypeshaystack)) {
return;
}
//Nothing to do here if we can't deal with it!
$attachmentObject = new MediaLink();
//2.Get all the elements in the collection, limit 5 if more than 5
//3.Trigger their timeline display
$mediaObjectURI = $attachment->getObjectURI();
$attachmentObject::set("objectType", "attachment");
$attachmentObject::set("uri", $attachment->getObjectURI());
//Now lets populate our collection with Items
//@TODO Will probably need to query for objectType of items in collection?
//@TODO Also this will help in removing objects from collections that have previously been deleted
$attachmentObjectURL = !empty($mediaObjectURI) ? "/system/object/{$mediaObjectURI}" : "http://placeskull.com/100/100/999999";
$attachmentObject->set("url", $attachmentObjectURL);
$attachmentObject->set("uri", $mediaObjectURI);
//AttachmentTypes
//$mediaType = $attachment->getPropertyValue("attachment_type");
$attachmentObject->set("name", $attachment->getPropertyValue("attachment_name"));
$attachmentObject->set("type", $attachment->getPropertyValue("attachment_type"));
$attachmentObject->set("height", null);
$attachmentObject->set("width", null);
//echo $mediaObjectURI;
//Now set the collection Object as the media Object
$mediaObject = $attachmentObject;
return true;
}