本文整理汇总了PHP中elgg_strip_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_strip_tags函数的具体用法?PHP elgg_strip_tags怎么用?PHP elgg_strip_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_strip_tags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ws_pack_created_river_event_handler
/**
* Send push notifications if event is added to the activity river
*
* @param string $event name of the event
* @param string $type type of the event
* @param ElggRiverItem $river_item river item object
*
* @return void
*/
function ws_pack_created_river_event_handler($event, $type, $river_item)
{
if (!empty($river_item) && $river_item instanceof ElggRiverItem) {
if (!function_exists('str_get_html')) {
elgg_load_library("simple_html_dom");
}
$message = "";
$html_view = elgg_view_river_item($river_item);
if ($res = str_get_html($html_view)) {
// get the river summary
if ($summary_element = $res->find("div.elgg-river-summary")) {
$summary_element = $summary_element[0];
$text = $summary_element->innertext();
list($left, $right) = explode("<span class=\"elgg-river-timestamp\">", $text);
$message = trim(elgg_strip_tags($left));
}
}
if (!empty($message)) {
$user_guids = false;
switch ($river_item->access_id) {
case ACCESS_PRIVATE:
// do nothing
break;
case ACCESS_PUBLIC:
case ACCESS_LOGGED_IN:
// notify everyone
$site_user_options = array("type" => "user", "limit" => false, "relationship" => "member_of_site", "relationship_guid" => elgg_get_site_entity()->getGUID(), "inverse_relationship" => true, "callback" => "ws_pack_row_to_guid");
$user_guids = elgg_get_entities_from_relationship($site_user_options);
break;
case ACCESS_FRIENDS:
// notify friends of subject_guid
$friends_options = array("type" => "user", "limit" => false, "relationship" => "friend", "relationship_guid" => $river_item->subject_guid, "callback" => "ws_pack_row_to_guid", "joins" => array("JOIN " . elgg_get_config("dbprefix") . "entity_relationships r2 ON e.guid = r2.guid_one"), "wheres" => array("(r2.relationship = 'member_of_site' AND r2.guid_two = " . elgg_get_site_entity()->getGUID() . ")"));
$user_guids = elgg_get_entities_from_relationship($friends_options);
break;
default:
// probably some acl, so notify members of the acl
$user_guids = get_members_of_access_collection($river_item->access_id, true);
break;
}
// we found potential interested users, so push
if (!empty($user_guids) && is_array($user_guids)) {
$api_application_options = array("type" => "object", "subtype" => APIApplication::SUBTYPE, "limit" => false, "annotation_name" => "push_notification_service");
if ($api_applications = elgg_get_entities_from_annotations($api_application_options)) {
foreach ($api_applications as $api_application) {
$api_application->sendPushNotification($message, $user_guids);
}
}
}
}
}
}
示例2: elgg_get_excerpt
/**
* Returns an excerpt.
* Will return up to n chars stopping at the nearest space.
* If no spaces are found (like in Japanese) will crop off at the
* n char mark. Adds ... if any text was chopped.
*
* @param string $text The full text to excerpt
* @param int $num_chars Return a string up to $num_chars long
*
* @return string
* @since 1.7.2
*/
function elgg_get_excerpt($text, $num_chars = 250)
{
$text = trim(elgg_strip_tags($text));
$string_length = elgg_strlen($text);
if ($string_length <= $num_chars) {
return $text;
}
// handle cases
$excerpt = elgg_substr($text, 0, $num_chars);
$space = elgg_strrpos($excerpt, ' ', 0);
// don't crop if can't find a space.
if ($space === false) {
$space = $num_chars;
}
$excerpt = trim(elgg_substr($excerpt, 0, $space));
if ($string_length != elgg_strlen($excerpt)) {
$excerpt .= '...';
}
return $excerpt;
}
示例3: elgg_tokeninput_export_entity
/**
* Get exportable entity values
*
* @param ElggEntity $entity
* @return array
*/
function elgg_tokeninput_export_entity($entity)
{
if (!elgg_instanceof($entity)) {
if ($entity_from_guid = get_entity($entity)) {
$entity = $entity_from_guid;
} else {
return elgg_tokeninput_export_metadata($entity);
}
}
$type = $entity->getType();
$subtype = $entity->getSubtype();
$icon = elgg_view_entity_icon($entity, 'small', array('use_hover' => false));
if (elgg_instanceof($entity, 'user')) {
$title = "{$entity->name} ({$entity->username})";
} else {
if (elgg_instanceof($entity, 'group')) {
$title = $entity->name;
} else {
$title = $entity->getDisplayName();
if (!$title) {
$title = elgg_echo('untitled');
}
$metadata[] = elgg_echo('byline', array($entity->getOwnerEntity()->name));
}
}
if ($entity->description) {
$metadata[] = elgg_get_excerpt(elgg_strip_tags($entity->description), 100);
}
if ($entity->location) {
$metadata[] = $entity->location;
}
$export = array('label' => $title, 'value' => $entity->guid, 'metadata' => $metadata ? implode('<br />', $metadata) : '', 'icon' => $icon, 'type' => $type, 'subtype' => $subtype, 'html_result' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('entity' => $entity, 'for' => 'result')) : null, 'html_token' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('entity' => $entity, 'for' => 'token')) : null);
$export = elgg_trigger_plugin_hook('tokeninput:entity:export', $type, array('entity' => $entity), $export);
array_walk_recursive($export, function (&$value) {
$value = is_string($value) ? html_entity_decode($value, ENT_QUOTES, 'UTF-8') : $value;
});
return $export;
}
示例4: elgg_solr_comment_search
//.........这里部分代码省略.........
$default_sort = array('score' => 'desc', 'time_created' => 'desc');
$sorts = $params['sorts'] ? $params['sorts'] : $default_sort;
$query->addSorts($sorts);
$description_boost = elgg_solr_get_description_boost();
// get the dismax component and set a boost query
$dismax = $query->getEDisMax();
$qf = "description^{$description_boost}";
if ($params['qf']) {
$qf = $params['qf'];
}
$dismax->setQueryFields($qf);
$boostQuery = elgg_solr_get_boost_query();
if ($boostQuery) {
$dismax->setBoostQuery($boostQuery);
}
// this query is now a dismax query
$query->setQuery($params['query']);
// make sure we're only getting comments
$params['fq']['type'] = 'type:annotation';
$params['fq']['subtype'] = 'subtype:generic_comment';
$default_fq = elgg_solr_get_default_fq($params);
if ($params['fq']) {
$filter_queries = array_merge($default_fq, $params['fq']);
} else {
$filter_queries = $default_fq;
}
if (!empty($filter_queries)) {
foreach ($filter_queries as $key => $value) {
$query->createFilterQuery($key)->setQuery($value);
}
}
// get highlighting component and apply settings
$hl = $query->getHighlighting();
$hl->setFields(array('description'));
$hl->setSimplePrefix('<span data-hl="elgg-solr">');
$hl->setSimplePostfix('</span>');
$fragsize = elgg_solr_get_fragsize();
if (isset($params['fragsize'])) {
$fragsize = (int) $params['fragsize'];
}
$hl->setFragSize($fragsize);
// this executes the query and returns the result
try {
$resultset = $client->select($query);
} catch (Exception $e) {
error_log($e->getMessage());
return null;
}
// Get the highlighted snippet
try {
$highlighting = $resultset->getHighlighting();
} catch (Exception $e) {
error_log($e->getMessage());
return null;
}
// Count the total number of documents found by solr
$count = $resultset->getNumFound();
$hl_prefix = elgg_solr_get_hl_prefix();
$hl_suffix = elgg_solr_get_hl_suffix();
$show_score = elgg_get_plugin_setting('show_score', 'elgg_solr');
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
foreach ($resultset as $document) {
// comments entity_guid stored as container_guid in solr
$entity = get_entity($document->container_guid);
if (!$entity) {
$entity = new ElggObject();
$entity->setVolatileData('search_unavailable_entity', TRUE);
}
// highlighting results can be fetched by document id (the field defined as uniquekey in this schema)
$highlightedDoc = $highlighting->getResult($document->id);
if ($highlightedDoc) {
foreach ($highlightedDoc as $highlight) {
$snippet = implode(' (...) ', $highlight);
// get our highlight based on the wrapped tokens
// note, this is to prevent partial html from breaking page layouts
$match = array();
preg_match('/<span data-hl="elgg-solr">(.*)<\\/span>/', $snippet, $match);
if ($match[1]) {
$snippet = str_replace($match[1], $hl_prefix . $match[1] . $hl_suffix, $snippet);
$snippet = $purifier->purify($snippet);
}
}
}
if (!$snippet) {
$snippet = search_get_highlighted_relevant_substrings(elgg_get_excerpt($document->description), $params['query']);
}
if ($show_score == 'yes' && elgg_is_admin_logged_in()) {
$snippet .= elgg_view('output/longtext', array('value' => elgg_echo('elgg_solr:relevancy', array($document->score)), 'class' => 'elgg-subtext'));
}
$comments_data = $entity->getVolatileData('search_comments_data');
if (!$comments_data) {
$comments_data = array();
}
$comments_data[] = array('annotation_id' => substr(strstr(elgg_strip_tags($document->id), ':'), 1), 'text' => $snippet, 'owner_guid' => $document->owner_guid, 'time_created' => $document->time_created);
$entity->setVolatileData('search_comments_data', $comments_data);
$entities[] = $entity;
}
return array('entities' => $entities, 'count' => $count);
}
示例5: elggpg_send_email_handler
/**
* It hijacks the email sender to encrypt the messages if needed.
*
* @param string $hook
* @param string $type
* @param bool $return
* @param array $params Includes $from, $to, $subject, $body and $headers
*
* @return bool
*/
function elggpg_send_email_handler($hook, $type, $return, $params)
{
$from = $params['from'];
$to = $params['to'];
$subject = $params['subject'];
$body = $params['body'];
$headers = $params['headers'];
$receiver = current(get_user_by_email($to));
// Format message
$body = html_entity_decode($body, ENT_COMPAT, 'UTF-8');
// Decode any html entities
$body = elgg_strip_tags($body);
// Strip tags from message
$body = preg_replace("/(\r\n|\r)/", "\n", $body);
// Convert to unix line endings in body
$body = preg_replace("/^From/", ">From", $body);
// Change lines starting with From to >From
$body = wordwrap($body);
// Encrypting
if (elgg_get_plugin_user_setting('encrypt_emails', $receiver->guid, 'elggpg') != 'no') {
elgg_load_library('elggpg');
$encrypted_body = elggpg_encrypt($body, $receiver, false);
if ($encrypted_body) {
$body = $encrypted_body;
}
}
// The following code is the same that in elgg's
$header_eol = "\r\n";
if (elgg_get_config('broken_mta')) {
// Allow non-RFC 2822 mail headers to support some broken MTAs
$header_eol = "\n";
}
// Windows is somewhat broken, so we use just address for to and from
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
// strip name from to and from
if (strpos($to, '<')) {
preg_match('/<(.*)>/', $to, $matches);
$to = $matches[1];
}
if (strpos($from, '<')) {
preg_match('/<(.*)>/', $from, $matches);
$from = $matches[1];
}
}
if (empty($headers)) {
$headers = "From: {$from}{$header_eol}" . "Content-Type: text/plain; charset=UTF-8; format=flowed{$header_eol}" . "MIME-Version: 1.0{$header_eol}" . "Content-Transfer-Encoding: 8bit{$header_eol}";
}
// Sanitise subject by stripping line endings
$subject = preg_replace("/(\r\n|\r|\n)/", " ", $subject);
// this is because Elgg encodes everything and matches what is done with body
$subject = html_entity_decode($subject, ENT_COMPAT, 'UTF-8');
// Decode any html entities
if (is_callable('mb_encode_mimeheader')) {
$subject = mb_encode_mimeheader($subject, "UTF-8", "B");
}
return mail($to, $subject, $body, $headers);
}
示例6: elgg_extract
// if the form comes back from a failed save we can't use the presets
$sticky_form = (bool) elgg_extract('group_tools_presets', $vars, false);
$presets = false;
if (!$sticky_form) {
$presets = group_tools_get_tool_presets();
}
// we need to be able to tell if we came from a sticky form
echo elgg_view('input/hidden', ['name' => 'group_tools_presets', 'value' => '1']);
// new group can choose from preset (if any)
if (empty($entity) && !empty($presets)) {
echo elgg_view('output/longtext', ['value' => elgg_echo('group_tools:create_group:tool_presets:description')]);
$preset_selectors = '';
$preset_descriptions = '';
$presets_tools = [];
foreach ($presets as $index => $values) {
$preset_selectors .= elgg_view('output/url', ['text' => elgg_extract('title', $values), 'href' => '#', 'class' => 'elgg-button elgg-button-action mrm', 'rel' => $index, 'title' => elgg_strip_tags(elgg_extract('description', $values))]);
$preset_tools = elgg_extract('tools', $values);
foreach ($preset_tools as $tool_name => $tool) {
if ($tool == 'yes') {
$presets_tools[$tool_name][] = "group-tools-preset-{$index}";
}
}
$preset_descriptions .= elgg_format_element('div', ['id' => "group-tools-preset-description-{$index}", 'class' => 'hidden'], elgg_extract('description', $values));
}
// blank preset
$preset_selectors .= elgg_view('output/url', ['text' => elgg_echo('group_tools:create_group:tool_presets:blank:title'), 'href' => '#', 'class' => 'elgg-button elgg-button-action mrm', 'rel' => 'blank']);
$preset_descriptions .= elgg_format_element('div', ['id' => 'group-tools-preset-description-blank', 'class' => 'hidden'], elgg_echo('group_tools:create_group:tool_presets:blank:description'));
echo elgg_format_element('label', ['class' => 'mbs'], elgg_echo('group_tools:create_group:tool_presets:select')) . ':';
echo elgg_format_element('div', ['id' => 'group-tools-preset-selector'], $preset_selectors);
echo elgg_format_element('div', ['id' => 'group-tools-preset-descriptions'], $preset_descriptions);
$more_link = elgg_view('output/url', ['text' => elgg_echo('group_tools:create_group:tool_presets:show_more'), 'href' => '#group-tools-preset-more', 'rel' => 'toggle', 'class' => 'float-alt']);
示例7: elgg_extract
$md_entities = elgg_extract("entities", $vars);
$selected_guid = (int) get_input("multi_dashboard_guid", 0);
$tabs = array();
// add the default tab
$default_tab = array("text" => elgg_echo("dashboard"), "href" => "dashboard", "title" => elgg_echo("dashboard"), "class" => "widget-manager-multi-dashboard-tab-widgets");
if (empty($selected_guid)) {
$default_tab["selected"] = true;
}
$tabs[0] = $default_tab;
if (!empty($md_entities)) {
foreach ($md_entities as $key => $entity) {
$selected = false;
if ($entity->getGUID() == $selected_guid) {
$selected = true;
}
$tab_title = elgg_strip_tags($entity->title);
if (strlen($tab_title) > $max_tab_title_length) {
$tab_title = substr($tab_title, 0, $max_tab_title_length);
}
$order = $entity->order ? $entity->order : $entity->time_created;
$tabs[$order] = array("text" => $tab_title . elgg_view_icon("settings-alt", "widget-manager-multi-dashboard-tabs-edit"), "href" => $entity->getURL(), "title" => $entity->title, "selected" => $selected, "rel" => $entity->getGUID(), "id" => $entity->getGUID(), "class" => "widget-manager-multi-dashboard-tab widget-manager-multi-dashboard-tab-" . $entity->getDashboardType());
}
}
ksort($tabs);
// add tab tab
if (is_array($md_entities) && count($md_entities) < MULTI_DASHBOARD_MAX_TABS) {
$tabs[] = array("text" => elgg_view_icon("round-plus", "widget-manager-multi-dashboard-tabs-add"), "href" => "multi_dashboard/edit", "title" => elgg_echo('widget_manager:multi_dashboard:add'), "id" => "widget-manager-multi-dashboard");
}
echo elgg_view("navigation/tabs", array("id" => "widget-manager-multi-dashboard-tabs", "tabs" => $tabs));
?>
<script type="text/javascript">
示例8: stripTags
/**
* Hook to strip tags from selected entity fields
*
* @param string $hook the name of the hook
* @param string $type the type of the hook
* @param string $returnvalue current return value
* @param array $params supplied params
*
* @return void
*/
public static function stripTags($hook, $type, $returnvalue, $params)
{
if (!elgg_in_context('search:index')) {
return;
}
$fields = ['title', 'name', 'description'];
foreach ($fields as $field) {
if (!isset($returnvalue->{$field})) {
continue;
}
$curval = $returnvalue->{$field};
if (empty($curval)) {
continue;
}
$curval = html_entity_decode($curval, ENT_QUOTES, 'UTF-8');
$returnvalue->{$field} = elgg_strip_tags($curval);
}
return $returnvalue;
}
示例9: ws_pack_export_river_items
/**
* Export river items
*
* @param array $items river items to export
*
* @return boolean|array
*/
function ws_pack_export_river_items($items)
{
elgg_load_library("simple_html_dom");
$result = false;
if (!empty($items) && is_array($items)) {
$result = array();
foreach ($items as $item) {
if ($item instanceof ElggRiverItem) {
$tmp_result = array();
// default export values
$export_values = array("id", "subject_guid", "object_guid", "annotation_id", "type", "subtype", "action_type", "posted");
foreach ($export_values as $field_name) {
$tmp_result[$field_name] = $item->{$field_name};
}
// add object and subject entities
$tmp_result["object"] = ws_pack_export_entity($item->getObjectEntity());
$tmp_result["subject"] = ws_pack_export_entity($item->getSubjectEntity());
// add some html views
// set viewtype to default
$viewtype = elgg_get_viewtype();
elgg_set_viewtype("default");
$tmp_result["html_view"] = elgg_view_river_item($item);
// parse the html to get some usefull information
if ($res = str_get_html($tmp_result["html_view"])) {
// get the river summary
if ($summary_element = $res->find("div.elgg-river-summary")) {
$summary_element = $summary_element[0];
$text = $summary_element->innertext();
list($left, $right) = explode("<span class=\"elgg-river-timestamp\">", $text);
$tmp_result["summary"] = trim(elgg_strip_tags($left));
}
// get the river message (optional)
if ($message_element = $res->find("div.elgg-river-message")) {
$message_element = $message_element[0];
$tmp_result["message"] = trim(elgg_strip_tags($message_element->innertext()));
}
// get river attachments (optional)
if ($attachment_element = $res->find("div.elgg-river-attachments")) {
$attachment_element = $attachment_element[0];
$tmp_result["attachments"] = array();
// find images
if ($images = $attachment_element->find("img")) {
$image_urls = array();
foreach ($images as $img) {
$image_urls[] = $img->src;
}
$tmp_result["attachments"]["images"] = $image_urls;
}
// find links
if ($links = $attachment_element->find("a")) {
$link_urls = array();
foreach ($links as $link) {
$link_urls[] = $link->href;
}
$tmp_result["attachments"]["links"] = $link_urls;
}
}
}
// add friendly time
$friendly_time = elgg_view_friendly_time($item->posted);
$tmp_result["friendly_time"] = trim(elgg_strip_tags($friendly_time));
// restore viewtype
elgg_set_viewtype($viewtype);
// add this item to the result set
$result[] = $tmp_result;
}
}
}
return $result;
}
示例10: elgg_extract
<?php
/**
* Output view for elgg_get_excerpt
*
* @uses $vars['text'] The text to get the excerpt for
* @uses $vars['num_chars'] The max number of characters of the excerpt
* @uses $vars['suffix'] The suffix to be added if text is cut
*/
$text = elgg_extract('text', $vars);
$text = trim(elgg_strip_tags($text));
$suffix = elgg_extract('suffix', $vars, '...');
$string_length = elgg_strlen($text);
$num_chars = (int) elgg_extract('num_chars', $vars, 250);
if ($string_length <= $num_chars) {
echo $text;
return;
}
// handle cases
$excerpt = elgg_substr($text, 0, $num_chars);
$space = elgg_strrpos($excerpt, ' ', 0);
// don't crop if can't find a space.
if ($space === false) {
$space = $num_chars;
}
$excerpt = trim(elgg_substr($excerpt, 0, $space));
if ($string_length != elgg_strlen($excerpt)) {
$excerpt .= $suffix;
}
echo $excerpt;
示例11: elgg_extract
<?php
namespace hypeJunction\Gallery;
$entity = elgg_extract('entity', $vars, false);
$full = elgg_extract('full_view', $vars, false);
$size = elgg_extract('size', $vars, '325x200');
if (!elgg_instanceof($entity, 'object', hjAlbum::SUBTYPE)) {
return true;
}
$title = elgg_view('output/url', array('text' => $entity->title, 'href' => $entity->getURL(), 'title' => elgg_strip_tags($entity->description), 'is_trusted' => true));
$count = $entity->getContainedFiles(array('count' => true));
if ($count) {
$cover = elgg_view_entity_icon($entity, $size);
$cover .= elgg_view('output/url', array('text' => '<i class="gallery-icon-slideshow gallery-icon-small"></i>', 'title' => elgg_echo('gallery:slideshow'), 'class' => 'gallery-popup', 'href' => '#', 'data-guid' => $entity->guid));
} else {
$cover = "<div class=\"gallery-album-cover-placeholder\" style=\"display:block;width:100%;height:200px;\"></div>";
}
$owner = get_entity($entity->owner_guid);
if ($owner) {
$author = elgg_view('output/url', array('text' => elgg_view('output/img', array('src' => $owner->getIconURL('small'))), 'href' => $owner->getURL(), 'title' => $owner->name));
$owner_link = elgg_view('output/url', array('href' => $owner->getURL(), 'text' => $owner->name, 'is_trusted' => true));
}
$info_link = elgg_view('output/url', array('text' => '<i class="gallery-icon-info icon-small"></i>', 'href' => "#gallery-info-{$entity->guid}", 'rel' => 'toggle'));
$info .= elgg_view('object/hjalbum/meta', $vars);
$info .= elgg_view('output/longtext', array('value' => $entity->description, 'class' => 'gallery-description'));
$subtitle = elgg_echo('gallery:byline', array($owner_link, elgg_view_friendly_time($entity->time_created)));
$menu = elgg_view_menu('entity', array('entity' => $entity, 'sort_by' => 'priority', 'class' => 'gallery-media-menu'));
if (!$full) {
$summary = elgg_view('object/elements/summary', array('entity' => $entity, 'title' => false, 'subtitle' => $subtitle, 'tags' => $entity->tags, 'content' => $info));
$html = <<<__HTML
示例12: elgg_get_excerpt
wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html -->
<meta content="width=device-width, initial-scale=1" name="viewport" />
<!-- Meta data -->
<?php
//Load in global variable with entity to create metadata tags
global $my_page_entity;
if ($my_page_entity) {
/*
echo elgg_get_excerpt($my_page_entity->title) . '<br>';
echo date ("Y-m-d", elgg_get_excerpt($my_page_entity->time_created)) . '<br>';
echo date ("Y-m-d", elgg_get_excerpt($my_page_entity->time_updated));
*/
if (elgg_instanceof($my_page_entity, 'group')) {
$desc = elgg_strip_tags(elgg_get_excerpt($my_page_entity->description));
$briefdesc = $my_page_entity->briefdescription;
} else {
if (elgg_instanceof($my_page_entity, 'user')) {
$desc = elgg_echo('profile:title', array($my_page_entity->name));
$briefdesc = elgg_echo('profile:title', array($my_page_entity->name));
} else {
$desc = $my_page_entity->title;
$briefdesc = $my_page_entity->title;
}
}
$pubDate = date("Y-m-d", elgg_get_excerpt($my_page_entity->time_created));
$lastModDate = date("Y-m-d", elgg_get_excerpt($my_page_entity->time_updated));
$datemeta = '<meta name="dcterms.issued" title="W3CDTF" content="' . $pubDate . '"/>';
$datemeta .= '<meta name="dcterms.modified" title="W3CDTF" content="' . $lastModDate . '" />';
} else {
示例13: elgg_extract
* @author Jeff Tilson
* @copyright THINK Global School 2010 - 2013
* @link http://www.thinkglobalschool.com/
*
*/
$podcast = elgg_extract('entity', $vars, FALSE);
if (!elgg_instanceof($podcast, 'object', 'podcast')) {
return TRUE;
}
$owner = $podcast->getOwnerEntity();
$container = $podcast->getContainerEntity();
$owner_url = "podcasts/owner/{$owner->username}";
$owner_name = $owner->name;
$episode_title = elgg_echo('podcasts:episode_title', array(podcasts_get_episode_number($podcast), $podcast->title));
$subtitle = elgg_get_excerpt($podcast->description);
$summary = trim(elgg_strip_tags($podcast->description));
$image = $owner->getIconURL('large');
$image = str_replace("&", "&", $image);
$guid = $podcast->getURL();
// For iTunes
$pubDate = date("r", $podcast->time_created);
// RFC 2822
$duration_string = podcasts_sec_toHHMMSS($podcast->duration);
// Build keyword string
if ($podcast->tags) {
$keywords = "<itunes:keywords>";
for ($i = 0; $i < count($podcast->tags); $i++) {
$keywords .= $podcast->tags[$i];
if ($i != count($podcast->tags) - 1) {
$keywords .= ", ";
}
示例14: elgg_extract
// if the form comes back from a failed save we can't use the presets
$sticky_form = (bool) elgg_extract('group_tools_presets', $vars, false);
$presets = false;
if (!$sticky_form) {
$presets = group_tools_get_tool_presets();
}
// we need to be able to tell if we came from a sticky form
echo elgg_view('input/hidden', array('name' => 'group_tools_presets', 'value' => '1'));
// new group can choose from preset (if any)
if (empty($entity) && !empty($presets)) {
echo elgg_view("output/longtext", array("value" => elgg_echo("group_tools:create_group:tool_presets:description")));
$preset_selectors = "";
$preset_descriptions = "";
$presets_tools = array();
foreach ($presets as $index => $values) {
$preset_selectors .= elgg_view("output/url", array("text" => elgg_extract("title", $values), "href" => "#", "class" => "elgg-button elgg-button-action mrm", "rel" => $index, "title" => elgg_strip_tags(elgg_extract("description", $values))));
$preset_tools = elgg_extract("tools", $values);
foreach ($preset_tools as $tool_name => $tool) {
if ($tool == "yes") {
$presets_tools[$tool_name][] = "group-tools-preset-" . $index;
}
}
$preset_descriptions .= "<div id='group-tools-preset-description-" . $index . "' class='hidden'>" . elgg_extract("description", $values) . "</div>";
}
// blank preset
$preset_selectors .= elgg_view("output/url", array("text" => elgg_echo("group_tools:create_group:tool_presets:blank:title"), "href" => "#", "class" => "elgg-button elgg-button-action mrm", "rel" => "blank"));
$preset_descriptions .= "<div id='group-tools-preset-description-blank' class='hidden'>" . elgg_echo("group_tools:create_group:tool_presets:blank:description") . "</div>";
echo "<label class='mbs'>" . elgg_echo("group_tools:create_group:tool_presets:select") . ":</label>";
echo "<div id='group-tools-preset-selector'>" . $preset_selectors . "</div>";
echo "<div id='group-tools-preset-descriptions'>" . $preset_descriptions . "</div>";
$more_link = elgg_view("output/url", array("text" => elgg_echo("group_tools:create_group:tool_presets:show_more"), "href" => "#group-tools-preset-more", "rel" => "toggle", "class" => "float-alt"));
示例15: notifyOnRsvp
/**
* Notifies an user of the RSVP
*
* @param string $type type of the RSVP
* @param string $to guid of the user
*
* @return void
*/
protected function notifyOnRsvp($type, $to = null)
{
if ($type == EVENT_MANAGER_RELATION_ATTENDING_PENDING) {
return;
}
$ia = elgg_set_ignore_access(true);
if ($to === null) {
$to = elgg_get_logged_in_user_guid();
}
$to_entity = get_entity($to);
if (empty($to_entity)) {
elgg_set_ignore_access($ia);
return;
}
// can we make nice links in the emails
$html_email_handler_enabled = elgg_is_active_plugin("html_email_handler");
// do we have a registration link
$registrationLink = "";
$unsubscribeLink = "";
if ($type == EVENT_MANAGER_RELATION_ATTENDING) {
if ($this->registration_needed) {
$link = elgg_get_site_url() . 'events/registration/view/' . $this->getGUID() . '?u_g=' . $to . '&k=' . elgg_build_hmac([$this->time_created, $to])->getToken();
$registrationLink = PHP_EOL . PHP_EOL;
$registrationLink .= elgg_echo('event_manager:event:registration:notification:program:linktext');
$registrationLink .= PHP_EOL . PHP_EOL;
if ($html_email_handler_enabled) {
$registrationLink .= elgg_view("output/url", array("text" => $link, "href" => $link));
} else {
$registrationLink .= $link;
}
}
if ($this->register_nologin) {
$link = elgg_get_site_url() . "events/unsubscribe/" . $this->getGUID() . "/" . elgg_get_friendly_title($this->title) . "?e=" . $to_entity->email;
$unsubscribeLink = PHP_EOL . PHP_EOL;
$unsubscribeLink .= elgg_echo('event_manager:event:registration:notification:unsubscribe:linktext');
$unsubscribeLink .= PHP_EOL . PHP_EOL;
if ($html_email_handler_enabled) {
$unsubscribeLink .= elgg_view("output/url", array("text" => $link, "href" => $link));
} else {
$unsubscribeLink .= $link;
}
}
if ($html_email_handler_enabled) {
// add addthisevent banners in footer
$registrationLink .= elgg_view('event_manager/email/addevent', ['entity' => $this]);
}
}
// make the event title for in the e-mail
if ($html_email_handler_enabled) {
$event_title_link = elgg_view("output/url", array("text" => $this->title, "href" => $this->getURL()));
} else {
$event_title_link = $this->title;
}
// notify the owner of the event
$this->notifyOwnerOnRSVP($type, $to_entity, $event_title_link, $registrationLink);
// notify the attending user
$user_subject = elgg_echo('event_manager:event:registration:notification:user:subject');
$user_message = elgg_echo('event_manager:event:registration:notification:user:text:' . $type, [$to_entity->name, $event_title_link]);
$completed_text = elgg_strip_tags($this->registration_completed, '<a>');
if (!empty($completed_text)) {
$completed_text = str_ireplace('[NAME]', $to_entity->name, $completed_text);
$completed_text = str_ireplace('[EVENT]', $this->title, $completed_text);
$user_message .= PHP_EOL . $completed_text;
}
$user_message .= $registrationLink . $unsubscribeLink;
if ($to_entity instanceof ElggUser) {
// use notification system for real users
$summary = elgg_echo('event_manager:event:registration:notification:user:summary:' . $type, [$this->title]);
// set params for site notifications
$params = ['summary' => $summary, 'object' => $this, 'action' => 'rsvp'];
notify_user($to, $this->getOwnerGUID(), $user_subject, $user_message, $params);
} else {
// send e-mail for non users
$to_email = $to_entity->name . "<" . $to_entity->email . ">";
$site = elgg_get_site_entity($this->site_guid);
$site_from = $this->getSiteEmailAddress($site);
elgg_send_email($site_from, $to_email, $user_subject, $user_message);
}
elgg_set_ignore_access($ia);
}