本文整理汇总了PHP中elgg_get_friendly_title函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_friendly_title函数的具体用法?PHP elgg_get_friendly_title怎么用?PHP elgg_get_friendly_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_friendly_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_manager_entity_menu
function event_manager_entity_menu($hook, $entity_type, $returnvalue, $params)
{
$result = $returnvalue;
if (elgg_in_context("widgets")) {
return $result;
}
if (($entity = elgg_extract("entity", $params)) && elgg_instanceof($entity, "object", Event::SUBTYPE)) {
$attendee_menu_options = array("name" => "attendee_count", "priority" => 50, "text" => elgg_echo("event_manager:event:relationship:event_attending:entity_menu", array($entity->countAttendees())), "href" => false);
$result[] = ElggMenuItem::factory($attendee_menu_options);
// change some of the basic menus
if (!empty($result) && is_array($result)) {
foreach ($result as &$item) {
switch ($item->getName()) {
case "edit":
$item->setHref("events/event/edit/" . $entity->getGUID());
break;
case "delete":
$href = elgg_get_site_url() . "action/event_manager/event/delete?guid=" . $entity->getGUID();
$href = elgg_add_action_tokens_to_url($href);
$item->setHref($href);
$item->setConfirmText(elgg_echo("deleteconfirm"));
break;
}
}
}
// show an unregister link for non logged in users
if (!elgg_is_logged_in() && $entity->register_nologin) {
$result[] = ElggMenuItem::factory(array("name" => "unsubscribe", "text" => elgg_echo("event_manager:menu:unsubscribe"), "href" => "events/unsubscribe/" . $entity->getGUID() . "/" . elgg_get_friendly_title($entity->title), "priority" => 300));
}
}
return $result;
}
示例2: addButton
/**
* adds the buttons to the specified menu
* @param array $array
* menu_name => menu name of the button
* $title => title of button
* $url => link of the button
*
*/
protected function addButton($array)
{
extract($array);
if (!empty($title) && !empty($menu_name)) {
elgg_register_menu_item($menu_name, array('name' => elgg_get_friendly_title($title), 'href' => $url, 'text' => $title, 'link_class' => 'elgg-button elgg-button-action'));
}
}
示例3: sched_conf_url_handler
function sched_conf_url_handler($entity)
{
elgg_load_library('elgg:sched_conf');
$friendly_title = elgg_get_friendly_title($entity->title);
$event = sched_conf_get_event_for_conference($entity->guid);
return "event_calendar/view/{$event->guid}/{$friendly_title}";
}
示例4: pleiofile_add_folder_to_zip
function pleiofile_add_folder_to_zip(ZipArchive &$zip_archive, ElggObject $folder, $folder_path = "")
{
if (!empty($zip_archive) && !empty($folder) && elgg_instanceof($folder, "object", "folder")) {
$folder_title = elgg_get_friendly_title($folder->title);
$zip_archive->addEmptyDir($folder_path . $folder_title);
$folder_path .= $folder_title . DIRECTORY_SEPARATOR;
$file_options = array("type" => "object", "subtype" => "file", "limit" => false, "relationship" => "folder_of", "relationship_guid" => $folder->getGUID());
// add files from this folder to the zip
if ($files = elgg_get_entities_from_relationship($file_options)) {
foreach ($files as $file) {
// check if the file exists
if ($zip_archive->statName($folder_path . $file->originalfilename) === false) {
// doesn't exist, so add
$zip_archive->addFile($file->getFilenameOnFilestore(), $folder_path . sanitize_file_name($file->originalfilename));
} else {
// file name exists, so create a new one
$ext_pos = strrpos($file->originalfilename, ".");
$file_name = substr($file->originalfilename, 0, $ext_pos) . "_" . $file->getGUID() . substr($file->originalfilename, $ext_pos);
$zip_archive->addFile($file->getFilenameOnFilestore(), $folder_path . sanitize_file_name($file_name));
}
}
}
// check if there are subfolders
$folder_options = array("type" => "object", "subtype" => "folder", "limit" => false, "metadata_name_value_pairs" => array("parent_guid" => $folder->getGUID()));
if ($sub_folders = elgg_get_entities_from_metadata($folder_options)) {
foreach ($sub_folders as $sub_folder) {
pleiofile_add_folder_to_zip($zip_archive, $sub_folder, $folder_path);
}
}
}
}
示例5: url_handler
/**
* Give entities their own URLs
*
* @param string $hook Equals 'entity:url'
* @param string $type Equals 'object'
* @param string $return Current URL
* @param array $params Additional params
* @return string Filtered URL
*/
function url_handler($hook, $type, $return, $params)
{
$entity = elgg_extract('entity', $params);
if (elgg_instanceof($entity, 'object', 'hjplace')) {
$friendly_title = elgg_get_friendly_title($entity->title);
return elgg_normalize_url(PAGEHANDLER . '/profile/' . $entity->guid . '/' . $friendly_title);
}
return $return;
}
示例6: blogbook_url_handler
function blogbook_url_handler($entity)
{
if (!$entity->getOwnerEntity()) {
// default to a standard view if no owner.
return FALSE;
}
$friendly_title = elgg_get_friendly_title($entity->title);
return "blogbook/view/{$entity->guid}/{$friendly_title}";
}
示例7: getURL
/**
* Get the URL for this entity
*
* @see ElggEntity::getURL()
*
* @return string
*/
public function getURL()
{
$title = $this->title;
if (strlen($title) > 50) {
$title = elgg_get_excerpt($title, 50);
}
$title = str_replace("...", "", $title);
return elgg_normalize_url("user_support/support_ticket/" . $this->getGUID() . "/" . elgg_get_friendly_title($title));
}
示例8: getEntityUrl
/**
* Returns normalized category URL
*
* @param Category $entity Category
* @return string
*/
public function getEntityUrl(Category $entity)
{
$friendly = elgg_get_friendly_title($entity->getDisplayName());
$query = array();
$page_owner = elgg_get_page_owner_entity();
if ($page_owner instanceof \ElggGroup) {
$query['container_guid'] = $page_owner->guid;
}
return $this->normalize(array('view', $entity->guid, $friendly), $query);
}
示例9: getURL
/**
* Get url
*
* @see ElggEntity::getURL()
* @return string
*/
public function getURL()
{
$friendly_title = $this->friendly_title;
if (!empty($friendly_title)) {
return elgg_normalize_url("wizard/{$this->friendly_title}");
}
// something went wrong, use fallback url
$friendly_title = elgg_get_friendly_title($this->title);
return elgg_normalize_url("wizard/view/{$this->getGUID()}/{$friendly_title}");
}
示例10: developers_setup_menu
function developers_setup_menu()
{
if (elgg_in_context('admin')) {
elgg_register_admin_menu_item('develop', 'inspect');
elgg_register_admin_menu_item('develop', 'sandbox', 'develop_tools');
elgg_register_admin_menu_item('develop', 'unit_tests', 'develop_tools');
elgg_register_menu_item('page', array('name' => 'dev_settings', 'href' => 'admin/developers/settings', 'text' => elgg_echo('settings'), 'context' => 'admin', 'priority' => 10, 'section' => 'develop'));
$inspect_options = developers_get_inspect_options();
foreach ($inspect_options as $key => $value) {
elgg_register_menu_item('page', array('name' => 'dev_inspect_' . elgg_get_friendly_title($key), 'href' => "admin/develop_tools/inspect?inspect_type={$key}", 'text' => $value, 'context' => 'admin', 'section' => 'develop', 'parent_name' => 'inspect'));
}
}
}
示例11: getURL
/**
* Get album URL
*
* @param string $action Operation
* @return string
*/
public function getURL($action = 'view')
{
switch ($action) {
default:
case 'view':
$friendly_title = elgg_get_friendly_title($this->title);
return "gallery/view/{$this->guid}/{$friendly_title}";
case 'edit':
return "gallery/edit/{$this->guid}";
case 'delete':
return elgg_add_action_tokens_to_url(elgg_get_site_url() . "action/gallery/delete/object?guid={$this->guid}");
case 'manage':
return "gallery/manage/{$this->guid}";
}
}
示例12: getURL
/**
* Get URL for a specific operation
*
* @param string $action Operation name
* @return string
*/
public function getURL($action = 'view')
{
switch ($action) {
default:
case 'view':
$friendly_title = elgg_get_friendly_title($this->title);
return elgg_normalize_url("gallery/view/{$this->guid}/{$friendly_title}");
case 'edit':
return elgg_normalize_url("gallery/manage/{$this->container_guid}#elgg-object-{$this->guid}");
case 'delete':
return elgg_add_action_tokens_to_url(elgg_normalize_url("action/gallery/delete/object?guid={$this->guid}"));
case 'download':
return elgg_normalize_url("gallery/download/{$this->guid}");
}
}
示例13: amapnews_set_url
/**
* Format and return the URL for news objects, since 1.9.
*
* @param string $hook
* @param string $type
* @param string $url
* @param array $params
* @return string URL of amapnews
*/
function amapnews_set_url($hook, $type, $url, $params)
{
$entity = $params['entity'];
if (elgg_instanceof($entity, 'object', 'amapnews')) {
if ($entity->connected_guid) {
$connected_entity = get_entity($entity->connected_guid);
$friendly_title = elgg_get_friendly_title($entity->title);
if ($connected_entity) {
return $connected_entity->getURL();
} else {
return "news/view/{$entity->guid}/{$friendly_title}";
}
} else {
return "news/view/{$entity->guid}/{$friendly_title}";
}
}
}
示例14: friendly_title
/**
* When given a title, returns a version suitable for inclusion in a URL
*
* @param string $title The title
*
* @return string The optimised title
* @deprecated 1.8 Use elgg_get_friendly_title()
*/
function friendly_title($title)
{
elgg_deprecated_notice('friendly_title was deprecated by elgg_get_friendly_title', 1.8);
return elgg_get_friendly_title($title);
}
示例15: groups_url
/**
* Populates the ->getUrl() method for group objects
*
* @param ElggEntity $entity File entity
* @return string File URL
*/
function groups_url($entity)
{
$title = elgg_get_friendly_title($entity->name);
return "groups/profile/{$entity->guid}/{$title}";
}