本文整理汇总了PHP中ElggEntity::getURL方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggEntity::getURL方法的具体用法?PHP ElggEntity::getURL怎么用?PHP ElggEntity::getURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggEntity
的用法示例。
在下文中一共展示了ElggEntity::getURL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
/**
* Prepares notification elements
* @return \stdClass
*/
public function prepare()
{
$object_type = $this->getObjectType();
$object_link = elgg_view('output/url', array('text' => $this->object->getDisplayName(), 'href' => elgg_http_add_url_query_elements($this->object->getURL(), array('active_tab' => 'comments'))));
if ($this->author->guid == $this->object->owner_guid) {
$object_summary_title = elgg_echo('interactions:ownership:own', array($object_type), $this->language);
} else {
if ($this->recipient->guid == $this->object->owner_guid) {
$object_summary_title = elgg_echo('interactions:ownership:your', array($object_type), $this->language);
} else {
$object_owner = $this->object->getOwnerEntity() ?: elgg_get_site_entity();
$object_summary_title = elgg_echo('interactions:ownership:owner', array($object_owner->getDisplayName(), $object_type), $this->language);
}
}
if ($this->object instanceof Comment) {
$object_full_title = $object_summary_title;
} else {
$object_full_title = $object_summary_title . ' ' . $object_link;
}
if ($this->root->guid !== $this->object->guid) {
$root_link = elgg_view('output/url', array('text' => $this->root->getDisplayName(), 'href' => elgg_http_add_url_query_elements($this->root->getURL(), array('active_tab' => 'comments'))));
$object_full_title .= ' ' . elgg_echo('interactions:comment:in_thread', array($root_link));
}
$author_link = elgg_view('output/url', array('text' => $this->author->name, 'href' => $this->author->getURL()));
$object_summary_link = elgg_view('output/url', array('text' => $object_summary_title, 'href' => elgg_http_add_url_query_elements($this->object->getURL(), array('active_tab' => 'comments'))));
$action_type = $this->getActionType();
$notification = new \stdClass();
$notification->summary = elgg_echo('interactions:response:email:subject', array($author_link, $action_type, $object_summary_link), $this->language);
$notification->subject = strip_tags($notification->summary);
$notification->body = elgg_echo('interactions:response:email:body', array($author_link, $action_type, $object_full_title, $this->getComment(), $this->comment->getURL(), $this->root->getURL(), $this->author->getDisplayName(), $this->author->getURL()), $this->language);
return $notification;
}
示例2: handle
/**
* Full action script
* Validates the input, updates the entity and forwards users with feedback
* @return void
*/
public function handle()
{
try {
if ($this->validate()) {
$result = $this->update();
}
} catch (\hypeJunction\Exceptions\ActionValidationException $ex) {
register_error(elgg_echo('prototyper:validate:error'));
forward(REFERER);
} catch (\IOException $ex) {
register_error(elgg_echo('prototyper:io:error', array($ex->getMessage())));
forward(REFERER);
} catch (\Exception $ex) {
register_error(elgg_echo('prototyper:handle:error', array($ex->getMessage())));
forward(REFERER);
}
if ($result) {
system_message(elgg_echo('prototyper:action:success'));
forward($this->entity->getURL());
} else {
register_error(elgg_echo('prototyper:action:error'));
forward(REFERER);
}
}
示例3: share_notify_user
/**
* Notify $user that $sharer shared his $entity.
*
* @param type $user
* @param type $sharer
* @param type $entity
*/
function share_notify_user(ElggUser $user, ElggUser $sharer, ElggEntity $entity)
{
if (!$user instanceof ElggUser) {
return false;
}
if (!$sharer instanceof ElggUser) {
return false;
}
if (!$entity instanceof ElggEntity) {
return false;
}
$title_str = $entity->title;
if (!$title_str) {
$title_str = elgg_get_excerpt($entity->description);
}
$site = get_config('site');
$subject = elgg_echo('share:notifications:subject', array($sharer->name, $title_str));
$body = elgg_echo('share:notifications:body', array($user->name, $sharer->name, $title_str, $site->name, $entity->getURL(), $sharer->getURL()));
notify_user($user->guid, $sharer->guid, $subject, $body);
}
示例4: seo_prepare_entity_data
/**
* Prepare entity SEF data
*
* @param \ElggEntity $entity Entity
* @return array|false
*/
function seo_prepare_entity_data(\ElggEntity $entity)
{
$path = seo_get_path($entity->getURL());
if (!$path || $path == '/') {
return false;
}
$type = $entity->getType();
switch ($type) {
case 'user':
if (elgg_is_active_plugin('profile')) {
$sef_path = "/profile/{$entity->username}";
}
break;
case 'group':
$subtype = $entity->getSubtype();
$registered = (array) get_registered_entity_types('group');
if (!$subtype || in_array($subtype, $registered)) {
if ($subtype && elgg_language_key_exists("item:group:{$subtype}", 'en')) {
$prefix = elgg_get_friendly_title(elgg_echo("item:group:{$subtype}", array(), 'en'));
} else {
$prefix = elgg_get_friendly_title(elgg_echo('item:group', array(), 'en'));
}
$friendly_title = elgg_get_friendly_title($entity->getDisplayName() ?: '');
$sef_path = "/{$prefix}/{$entity->guid}-{$friendly_title}";
}
break;
case 'object':
$subtype = $entity->getSubtype();
$registered = (array) get_registered_entity_types('object');
if (in_array($subtype, $registered)) {
if (elgg_language_key_exists("item:object:{$subtype}", 'en')) {
$prefix = elgg_get_friendly_title(elgg_echo("item:object:{$subtype}", array(), 'en'));
} else {
$prefix = elgg_get_friendly_title($subtype);
}
$friendly_title = elgg_get_friendly_title($entity->getDisplayName() ?: '');
$sef_path = "/{$prefix}/{$entity->guid}-{$friendly_title}";
}
break;
}
if (!$sef_path) {
$sef_path = $path;
}
$sef_data = seo_get_data($entity->getURL());
if (!is_array($sef_data)) {
$sef_data = array();
}
$entity_sef_data = ['path' => $path, 'sef_path' => $sef_path, 'title' => $entity->getDisplayName(), 'description' => elgg_get_excerpt($entity->description), 'keywords' => is_array($entity->tags) ? implode(',', $entity->tags) : $entity->tags, 'guid' => $entity->guid];
if ($entity->guid != $entity->owner_guid) {
$owner = $entity->getOwnerEntity();
if ($owner) {
$entity_sef_data['owner'] = seo_prepare_entity_data($owner);
}
}
if ($entity->guid != $entity->container_guid && $entity->owner_guid != $entity->container_guid) {
$container = $entity->getContainerEntity();
if ($container) {
$entity_sef_data['container'] = seo_prepare_entity_data($container);
}
}
if (empty($sef_data['admin_defined'])) {
$sef_data = array_merge($sef_data, $entity_sef_data);
} else {
foreach ($entity_sef_data as $key => $value) {
if (empty($sef_data[$key])) {
$sef_data[$key] = $value;
}
}
}
$entity_sef_metatags = elgg_trigger_plugin_hook('metatags', 'discovery', ['entity' => $entity, 'url' => elgg_normalize_url($sef_path)], []);
if (!empty($entity_sef_metatags)) {
foreach ($entity_sef_metatags as $key => $value) {
if (empty($sef_data['admin_defined']) || empty($sef_data['metatags'][$key])) {
$sef_data['metatags'][$key] = $value;
}
}
}
return $sef_data;
}
示例5: getExtraValues
public static function getExtraValues(ElggEntity $entity)
{
global $CONFIG;
if (!$entity) {
return FALSE;
}
$return['url'] = $entity->getURL();
$return['subtype'] = $entity->getSubtype();
$return['title'] = $entity->title;
$return['icon_small'] = $entity->getIcon('small');
$return['icon_medium'] = $entity->getIcon('medium');
$return['icon_large'] = $entity->getIcon('large');
$return['access_id'] = $entity->access_id;
$return['site_url'] = $CONFIG->wwwroot;
if ($entity->canEdit()) {
$return['canedit'] = $entity->canEdit();
}
if ((string) $entity->container_name == '') {
$container_entity = get_entity($entity->container_guid);
if ($container_entity) {
$return['container_name'] = $container_entity->name;
$return['container_username'] = $container_entity->username;
$return['container_url'] = $container_entity->getURL();
$return['container_icon'] = str_replace('size=medium', 'size=small', $container_entity->getIcon());
}
} else {
$return['container_name'] = $entity->name;
$return['container_username'] = $entity->username;
$return['container_url'] = $entity->getURL();
$return['container_icon'] = str_replace('size=medium', 'size=small', $entity->getIcon());
}
return $return;
}