本文整理汇总了PHP中filter_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_tags函数的具体用法?PHP filter_tags怎么用?PHP filter_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_tags函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: elgg_get_sticky_value
/**
* Get a specific stick variable
*
* @param string $variable The name of the variable
* @param mixed $default Default value if the variable does not exist in sticky cache
* @param boolean $filter_result Filter for bad input if true
* @return mixed
*/
function elgg_get_sticky_value($variable, $default = "", $filter_result = true)
{
if (isset($_SESSION['sticky'][$variable])) {
$var = $_SESSION['sticky'][$variable];
if ($filter_result) {
// XSS filter result
$var = filter_tags($var);
}
return $var;
}
return $default;
}
开发者ID:CashElgg,项目名称:stickyforms,代码行数:20,代码来源:start.php
示例2: get_input
/**
* Get some input from variables passed on the GET or POST line.
*
* @param $variable string The variable we want to return.
* @param $default mixed A default value for the variable if it is not found.
* @param $filter_result If true then the result is filtered for bad tags.
*/
function get_input($variable, $default = "", $filter_result = true)
{
global $CONFIG;
if (isset($CONFIG->input[$variable])) {
return $CONFIG->input[$variable];
}
if (isset($_REQUEST[$variable])) {
if (is_array($_REQUEST[$variable])) {
$var = $_REQUEST[$variable];
} else {
$var = trim($_REQUEST[$variable]);
}
if ($filter_result) {
$var = filter_tags($var);
}
return $var;
}
return $default;
}
开发者ID:eokyere,项目名称:elgg,代码行数:26,代码来源:input.php
示例3: widget_twitter_search_settings_save_hook
function widget_twitter_search_settings_save_hook($hook_name, $entity_type, $return_value, $params)
{
$widget = elgg_extract("widget", $params);
if ($widget && $entity_type == "twitter_search") {
$embed_code = elgg_extract("embed_code", get_input("params", array(), false));
// do not strip code
$widget_id = false;
if ($embed_code) {
$start_pos = strpos($embed_code, 'data-widget-id="') + strlen('data-widget-id="');
$end_pos = strpos($embed_code, '"', $start_pos);
$widget_id = filter_tags(substr($embed_code, $start_pos, $end_pos - $start_pos));
if ($widget_id) {
$widget->widget_id = $widget_id;
} else {
register_error(elgg_echo("widgets:twitter_search:embed_code:error"));
}
}
}
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:19,代码来源:start.php
示例4: get_entries
/**
* Get all the available entries from the database
* @param $view is the name of the view. By default view rule is empty.
* @param $page is the page in the view
* @return Array of associative arrays for each entry.
*/
function get_entries($view = '', $page = 1)
{
global $dbh, $config;
$rule = get_view_rule($view);
$r = rule2sql($rule, 'id, feed_id, authors, title, links, description, content, enclosures, comments, guid, pubDate, lastUpdate', $config->entries_per_page, ($page - 1) * $config->entries_per_page);
$query = $dbh->prepare($r[0]);
$query->execute($r[1]);
$fetched_entries = $query->fetchall(PDO::FETCH_ASSOC);
$entries = array();
foreach ($fetched_entries as $entry) {
switch ($config->display_entries) {
case 'content':
if (!empty($entry['content'])) {
$entry['displayed_content'] = $entry['content'];
} else {
$entry['displayed_content'] = $entry['description'];
}
break;
case 'description':
$entry['displayed_content'] = $entry['description'];
break;
case 'title':
$entry['displayed_content'] = '';
break;
default:
$entry['displayed_content'] = $entry['description'];
break;
}
$entry['authors'] = clean_authors(json_decode($entry['authors']));
$entry['links'] = json_decode($entry['links']);
$entry['enclosures'] = json_decode($entry['enclosures']);
$entry_tags = get_entry_tags($entry['id']);
$feed_tags = get_feed_tags($entry['feed_id']);
$tags = array_merge($entry_tags, $feed_tags);
$entry['system_tags'] = filter_tags($tags, SYSTEM_TAGS);
$entry['tags'] = filter_tags($tags, USER_TAGS);
$entries[] = $entry;
}
return $entries;
}
开发者ID:qwertygc,项目名称:Freeder,代码行数:46,代码来源:entries.php
示例5: izap_actionhook_bridge
/**
* validates the form and its attributes
* compulsory fields are checked,filter the tags and
* push the attributes to the config
* @global global $CONFIG
*/
function izap_actionhook_bridge()
{
global $CONFIG;
$CONFIG->post_byizap->form_validated = true;
if (isset($_REQUEST['attributes'])) {
@array_walk_recursive($_REQUEST['attributes'], 'get_input');
foreach ($_REQUEST['attributes'] as $key => $val) {
if ($key[0] == "_") {
$attr = substr($key, 1);
if ($val !== '0' && empty($val)) {
$CONFIG->post_byizap->form_validated = FALSE;
$CONFIG->post_byizap->form_errors[] = elgg_echo($_POST['attributes']['plugin'] . ':form_error:empty:' . $attr);
}
} else {
$attr = $key;
}
$CONFIG->post_byizap->attributes[$attr] = filter_tags($val);
}
// put every thing to session
elgg_make_sticky_form($CONFIG->post_byizap->attributes['plugin']);
unset($_POST['attributes']);
}
}
开发者ID:socialweb,项目名称:PiGo,代码行数:29,代码来源:start.php
示例6: execute
//.........这里部分代码省略.........
$river_access_id = elgg_get_plugin_user_setting('river_access_id', $friend_guid, 'hypeWall');
if (!is_null($river_access_id) && $river_access_id !== ACCESS_PRIVATE) {
$river_id = elgg_create_river_item(array('view' => 'river/relationship/tagged/create', 'action_type' => 'tagged', 'subject_guid' => $friend_guid, 'object_guid' => $this->post->getGUID(), 'target_guid' => $this->post->getContainerGUID(), 'access_id' => $river_access_id));
}
}
}
}
}
// Wall post access id is set to private, which means it should be visible only to the poster and tagged users
// Creating a new ACL for that
if ($this->access_id == ACCESS_PRIVATE && count($this->friend_guids)) {
$members = $this->friend_guids;
$members[] = $this->poster->guid;
$members[] = $this->container->guid;
$acl_id = AccessCollection::create($members);
$this->post->access_id = $acl_id;
$this->post->save();
}
if (!empty($this->attachment_guids)) {
foreach ($this->attachment_guids as $attachment_guid) {
add_entity_relationship($attachment_guid, 'attached', $this->post->guid);
}
}
// files being uploaded via $_FILES
$uploads = hypeApps()->uploader->handle('upload_guids');
$uploaded_file_guids = [];
if ($uploads) {
foreach ($uploads as $upload) {
if ($upload instanceof \ElggFile) {
$file_obj = $upload;
} else {
if ($upload instanceof \hypeJunction\Files\Upload) {
$file_obj = $upload->file;
}
}
if ($file_obj->guid) {
$uploaded_file_guids[] = $file_obj->guid;
}
}
}
// Something is broken in the hypeApps setter, so doing this hack for now
$this->upload_guids = array_merge($this->upload_guids, $uploaded_file_guids);
if (!empty($this->upload_guids)) {
foreach ($this->upload_guids as $upload_guid) {
$upload = get_entity($upload_guid);
if ($upload) {
$upload->description = $this->post->description;
$upload->origin = 'wall';
$upload->access_id = $this->post->access_id;
$upload->container_guid = $this->container->canWriteToContainer($this->poster->guid, 'object', 'file') ? $this->container->guid : ELGG_ENTITIES_ANY_VALUE;
if ($upload->save()) {
add_entity_relationship($upload_guid, 'attached', $this->post->guid);
}
}
}
}
$this->post->setLocation($this->location);
$this->post->address = $this->address;
if ($this->post->address && $this->make_bookmark) {
$document = elgg_trigger_plugin_hook('extract:meta', 'wall', array('src' => $this->post->address));
$bookmark = new ElggObject();
$bookmark->subtype = "bookmarks";
$bookmark->container_guid = $this->container->canWriteToContainer($this->poster->guid, 'object', 'bookmarks') ? $this->container->guid : ELGG_ENTITIES_ANY_VALUE;
$bookmark->address = $this->post->address;
$bookmark->access_id = $this->post->access_id;
$bookmark->origin = 'wall';
if (!$document) {
$bookmark->title = $this->post->title;
$bookmark->description = $this->post->description;
$bookmark->tags = $this->post->tags;
} else {
$bookmark->title = filter_tags($document->meta->title);
$bookmark->description = filter_tags($document->meta->description);
$bookmark->tags = string_to_tag_array(filter_tags($document->meta->keywords));
}
$bookmark->save();
$this->bookmark = $bookmark;
}
if ($this->post->save()) {
$message = $this->post->formatMessage();
$params = array('entity' => $this->post, 'user' => $this->poster, 'message' => $message, 'url' => $this->post->getURL(), 'origin' => 'wall');
elgg_trigger_plugin_hook('status', 'user', $params);
// Trigger a publish event, so that we can send out notifications
elgg_trigger_event('publish', 'object', $this->post);
if (get_input('widget')) {
elgg_push_context('widgets');
}
if (elgg_is_xhr()) {
$this->result->output .= elgg_list_river(array('object_guids' => $this->post->guid, 'pagination' => false, 'pagination_type' => false, 'limit' => 0));
}
$this->result->addMessage(elgg_echo('wall:create:success'));
if ($this->container instanceof \ElggUser) {
$this->result->setForwardURL(hypeWall()->router->normalize("owner/{$this->container->username}"));
} else {
$this->result->setForwardURL(hypeWall()->router->normalize("container/{$this->container->guid}"));
}
} else {
$this->result->addError(elgg_echo('wall:create:error'));
}
}
开发者ID:hypejunction,项目名称:hypewall,代码行数:101,代码来源:SavePost.php
示例7: elgg_load_library
<?php
/**
* EXIF sidebar module
*/
$image = $vars["image"];
elgg_load_library("tidypics:exif");
$exif = tp_exif_formatted($image);
if ($exif) {
$title = "EXIF";
$body = "<table class='elgg-table elgg-table-alt'>";
foreach ($exif as $key => $value) {
$body .= "<tr>";
$body .= "<td>" . elgg_view("output/text", array("value" => filter_tags($key))) . "</td>";
$body .= "<td>" . elgg_view("output/text", array("value" => filter_tags($value))) . "</td>";
$body .= "</tr>";
}
$body .= "</table>";
echo elgg_view_module("aside", $title, $body);
}
开发者ID:juho-jaakkola,项目名称:tidypics,代码行数:20,代码来源:exif.php
示例8: getStickyValues
/**
* Get all the values in a sticky form in an array
*
* @param string $form_name The name of the form
* @param bool $filter_result Filter for bad input if true
*
* @return array
*/
function getStickyValues($form_name, $filter_result = true)
{
$session = _elgg_services()->session;
$data = $session->get('sticky_forms', array());
if (!isset($data[$form_name])) {
return array();
}
$values = $data[$form_name];
if ($filter_result) {
foreach ($values as $key => $value) {
// XSS filter result
$values[$key] = filter_tags($value);
}
}
return $values;
}
开发者ID:thehereward,项目名称:Elgg,代码行数:24,代码来源:StickyForms.php
示例9: autop
<?php
/**
* Elgg display long text
* Displays a large amount of text, with new lines converted to line breaks
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*
* @uses $vars['text'] The text to display
*
*/
global $CONFIG;
echo autop(parse_urls(filter_tags($vars['value'])));
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:16,代码来源:longtext.php
示例10: elgg_extract
<?php
/**
* Elgg display long text
* Displays a large amount of text, with new lines converted to line breaks
*
* @package Elgg
* @subpackage Core
*
* @uses $vars['value'] The text to display
* @uses $vars['parse_urls'] Whether to turn urls into links. Default is true.
* @uses $vars['class']
*/
$class = 'elgg-output';
$additional_class = elgg_extract('class', $vars, '');
if ($additional_class) {
$vars['class'] = "{$class} {$additional_class}";
} else {
$vars['class'] = $class;
}
$parse_urls = elgg_extract('parse_urls', $vars, true);
unset($vars['parse_urls']);
$text = $vars['value'];
unset($vars['value']);
if ($parse_urls) {
$text = parse_urls($text);
}
$text = filter_tags($text);
$text = elgg_autop($text);
$attributes = elgg_format_attributes($vars);
echo "<div {$attributes}>{$text}</div>";
开发者ID:ibou77,项目名称:elgg,代码行数:31,代码来源:longtext.php
示例11: elgg_get_sticky_value
/**
* Get a specific stick variable
*
* @param string $variable The name of the variable
* @param mixed $default Default value if the variable does not exist in sticky cache
* @param boolean $filter_result Filter for bad input if true
* @return mixed
*
* @todo should this filter the default value?
*/
function elgg_get_sticky_value($form_name, $variable, $default = NULL, $filter_result = true)
{
if (isset($_SESSION['sticky_forms'][$form_name][$variable])) {
$value = $_SESSION['sticky_forms'][$form_name][$variable];
if ($filter_result) {
// XSS filter result
$value = filter_tags($value);
}
return $value;
}
return $default;
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:22,代码来源:elgglib.php
示例12: Embedder
$embedder = new Embedder($wall_post->address);
$document = $embedder->extractMeta('iframely');
$bookmark = new ElggObject();
$bookmark->subtype = "bookmarks";
$bookmark->container_guid = $container->canWriteToContainer($poster->guid, 'object', 'bookmarks') ? $container->guid : ELGG_ENTITIES_ANY_VALUE;
$bookmark->address = $wall_post->address;
$bookmark->access_id = $access_id;
$bookmark->origin = 'wall';
if (!$document) {
$bookmark->title = $wall_post->title;
$bookmark->description = $wall_post->description;
$bookmark->tags = $wall_post->tags;
} else {
$bookmark->title = filter_tags($document->meta->title);
$bookmark->description = filter_tags($document->meta->description);
$bookmark->tags = string_to_tag_array(filter_tags($document->meta->keywords));
}
$bookmark->save();
}
if ($wall_post->save()) {
$message = format_wall_message($wall_post);
$params = array('entity' => $wall_post, 'user' => $poster, 'message' => $message, 'url' => $wall_post->getURL(), 'origin' => 'wall');
elgg_trigger_plugin_hook('status', 'user', $params);
// Trigger a publish event, so that we can send out notifications
elgg_trigger_event('publish', 'object', $wall_post);
if (get_input('widget')) {
elgg_push_context('widgets');
}
if (elgg_is_xhr()) {
if (get_input('river') && get_input('river') != 'false') {
echo elgg_list_river(array('object_guids' => $wall_post->guid));
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:31,代码来源:status.php
示例13: getBookmarks
static function getBookmarks($a, $args, $c)
{
$user = elgg_get_logged_in_user_entity();
if ($user) {
$options = ["relationship_guid" => $user->guid, "relationship" => "bookmarked", "offset" => (int) $args["offset"], "limit" => (int) $args["limit"]];
$total = elgg_get_entities_from_relationship(array_merge($options, ["count" => true]));
foreach (elgg_get_entities_from_relationship($options) as $entity) {
$entities[] = ["guid" => $entity->guid, "ownerGuid" => $entity->owner_guid, "title" => $entity->title, "type" => $entity->type, "description" => elgg_autop(filter_tags($entity->description)), "timeCreated" => date("c", $entity->time_created), "timeUpdated" => date("c", $entity->time_updated), "tags" => Helpers::renderTags($entity->tags)];
}
} else {
$total = 0;
$entities = [];
}
return ["total" => $total, "entities" => $entities];
}
开发者ID:pleio,项目名称:rijkshuisstijl,代码行数:15,代码来源:Resolver.php
示例14: profile_sync_filter_var
/**
* Do the same as get_input() and /action/profile/edit on sync data values
*
* @param string $value the value to filter
*
* @see get_input()
*
* @return string
*/
function profile_sync_filter_var($value)
{
// convert to UTF-8
$value = profile_sync_convert_string_encoding($value);
// filter tags
$value = filter_tags($value);
// correct html encoding
if (is_array($value)) {
array_walk_recursive($value, 'profile_sync_array_decoder');
} else {
$value = trim(elgg_html_decode($value));
}
return $value;
}
开发者ID:coldtrick,项目名称:profile_sync,代码行数:23,代码来源:functions.php
示例15: filter_tags
<!-- top navbar -->
<div class="rcproject-navbar navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<span class="navbar-brand" style="max-width:80%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php echo filter_tags($app_title) ?></span>
<button type="button" class="navbar-toggle" onclick="toggleProjectMenuMobile($('#west'))">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
</div>
<!-- main window -->
<div class="container-fluid mainwindow">
<div class="row row-offcanvas row-offcanvas-left">
<div id="west" class="hidden-xs col-sm-4 col-md-3" role="navigation">
<?php echo $westHtml ?>
</div>
<div id="center" class="col-xs-12 col-sm-8 col-md-9">
<div id="subheader">
<?php if ($display_project_logo_institution) { ?>
<?php if (trim($headerlogo) != "")
echo "<img src='$headerlogo' title='".cleanHtml($institution)."' alt='".cleanHtml($institution)."' style='margin:-5px 0 5px 20px;max-width:700px; expression(this.width > 700 ? 700 : true);'>";
?>
<div id="subheaderDiv1" class="bot-left">
<?php echo $institution . (($site_org_type == "") ? "" : "<br><span style='font-family:tahoma;font-size:13px;'>$site_org_type</span>") ?>
</div>
<?php } ?>
<div id="subheaderDiv2" class="bot-left"><?php echo filter_tags($app_title) ?></div>
</div>
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:header_advanced_grid.php
示例16: autop
<?php
/**
* iZAP izap_videos
*
* @package Elgg videotizer, by iZAP Web Solutions.
* @license GNU Public License version 3
* @Contact iZAP Team "<[email protected]>"
* @Founder Tarun Jangra "<[email protected]>"
* @link http://www.izap.in/
*
*/
global $CONFIG;
//echo $vars['value'];
echo autop(izapParseUrls_izap_videos(filter_tags($vars['value'])));
开发者ID:rimpy,项目名称:izap_videos,代码行数:15,代码来源:longtext.php
示例17: action_gatekeeper
/**
* iZAP izap_videos
*
* @package Elgg videotizer, by iZAP Web Solutions.
* @license GNU Public License version 3
* @Contact iZAP Team "<[email protected]>"
* @Founder Tarun Jangra "<[email protected]>"
* @link http://www.izap.in/
*
*/
action_gatekeeper();
admin_gatekeeper();
$postedArray = get_input('izap');
$plugin = find_plugin_settings('izap_videos');
// get the video options checkboxes
$videoOptions = filter_tags($_POST['izap']['izapVideoOptions']);
if (empty($videoOptions)) {
register_error(elgg_echo('izap_videos:error:videoOptionBlank'));
forward($_SERVER['HTTP_REFERER']);
}
$postedArray['izapVideoOptions'] = $videoOptions;
// get the index page widget
if (!empty($postedArray['izapExtendVideoSupport'])) {
$postedArray['izapExtendVideoSupport'] = 'YES';
} else {
$postedArray['izapExtendVideoSupport'] = 'NO';
}
// get the index page widget
if (!empty($postedArray['izapIndexPageWidget'])) {
$postedArray['izapIndexPageWidget'] = 'YES';
} else {
开发者ID:rimpy,项目名称:izap_videos,代码行数:31,代码来源:editSettings.php
示例18: search_tags
function search_tags($tags, $start = 0, $end = false)
{
global $db, $config, $auth;
$topics_count = (int) $db->sql_fetchfield('num_topics');
if ($end === false) {
$end = $config['topics_per_page'];
}
$tag_array = filter_tags($tags);
$sql = "SELECT topi.topic_id,\n\t\t\ttopi.forum_id,\n\t\t\ttopi.topic_type,\n\t\t\ttopi.topic_replies_real,\n\t\t\ttopi.topic_replies,\n\t\t\ttopi.topic_status,\n\t\t\ttopi.topic_moved_id,\n\t\t\ttopi.topic_last_post_time,\n\t\t\ttopi.topic_approved,\n\t\t\ttopi.topic_poster,\n\t\t\ttopi.topic_first_poster_name,\n\t\t\ttopi.topic_time,\n\t\t\ttopi.topic_last_post_subject,\n\t\t\ttopi.topic_last_post_time,\n\t\t\ttopi.topic_last_poster_id,\n\t\t\ttopi.topic_views,\n\t\t\ttopi.topic_title,\n\t\t\ttopi.icon_id,\n\t\t\ttopi.topic_attachment,\n\t\t\ttopi.topic_first_poster_name,\n\t\t\ttopi.topic_last_post_id,\n\t\t\ttopi.topic_last_poster_id,\n\t\t\ttopi.topic_last_poster_name,\n\t\t\ttopi.topic_last_poster_colour,\n\t\t\ttopi.topic_last_post_subject,\n\t\t\ttopi.topic_last_post_time,\n\t\t\ttopi.topic_last_view_time,\n topi.poll_start,\n\t\t\tCOUNT(topi.topic_id) count\n\t\t\tFROM " . TAGS_TABLE . " t, " . TOPICS_TABLE . " topi";
if (!empty($tag_array['include'])) {
$sql .= " WHERE (t.tag IN (";
$sql .= prepare_search_string($tag_array['include']);
$sql .= "))";
}
if (!empty($tag_array['include']) && !empty($tag_array['exclude'])) {
$sql .= " AND ";
} else {
if (empty($tag_array['include']) && !empty($tag_array['exclude'])) {
$sql .= " WHERE ";
}
}
if (!empty($tag_array['exclude'])) {
$sql .= "(topi.topic_id NOT IN ( \n\t\t\t\t\t\tSELECT top2.topic_id\n\t\t\t\t\t\tFROM " . TAGS_TABLE . " t2, " . TOPICS_TABLE . " top2\n\t\t\t\t\t\tWHERE t2.topic_id = top2.topic_id";
$sql .= prep_exclusion_string($tag_array['exclude']);
$sql .= "))";
}
$sql .= "AND topi.topic_id = t.topic_id\n\t\t\t GROUP BY topi.topic_id,\n\t\t\t topi.forum_id,\n\t\t\t topi.topic_type,\n\t\t\t topi.topic_replies_real,\n\t\t\t topi.topic_replies,\n\t\t\t topi.topic_status,\n\t\t\t topi.topic_moved_id,\n\t\t\t topi.topic_last_post_time,\n\t\t\t topi.topic_approved,\n\t\t\t topi.topic_poster,\n\t\t\t topi.topic_first_poster_name,\n\t\t\t topi.topic_time,\n\t\t\t topi.topic_last_post_subject,\n\t\t\t topi.topic_last_post_time,\n\t\t\t topi.topic_last_poster_id,\n\t\t\t topi.topic_views,\n\t\t\t topi.topic_title,\n\t\t\t topi.icon_id,\n\t\t\t topi.topic_attachment,\n\t\t\t topi.topic_first_poster_name,\n\t\t\t topi.topic_last_post_id,\n\t\t\t topi.topic_last_poster_id,\n\t\t\t topi.topic_last_poster_name,\n\t\t\t topi.topic_last_poster_colour,\n\t\t\t topi.topic_last_post_subject,\n\t\t\t topi.topic_last_post_time,\n\t\t\t topi.topic_last_view_time\n\t\t\t ORDER BY topic_time DESC";
if (!($result = $db->sql_query_limit($sql, $end, $start))) {
message_die(GENERAL_ERROR, 'Error retrieving search results', '', __LINE__, __FILE__, $sql);
}
$topic_list = array();
while ($row = $db->sql_fetchrow($result)) {
// Do not include those topics the user has no permission to access
if ($auth->acl_get('f_read', $row['forum_id'])) {
$topic_list[] = $row;
}
}
return $topic_list;
}
开发者ID:robscc,项目名称:phpBB3-Topic-Tagging,代码行数:39,代码来源:functions_phpbb_topic_tagging.php
示例19: getFormValues
/**
* loads the form with the pre-filled values from the sticky form or entity
* supplied
*
* @param array $params
* 'entity' => entity for filling the values in edit case
* 'plugin' => pluign id to get the sticky form values
*
* @return stdClass object values
*/
public static function getFormValues($params)
{
// params must be array
if (!is_array($params)) {
return FALSE;
}
$return_value = $params['entity'];
if (elgg_is_sticky_form($params['plugin'])) {
$attribs = $_SESSION['sticky_forms'][$params['plugin']]['attributes'];
foreach ($attribs as $key => $val) {
if ($key[0] == "_") {
$attr = substr($key, 1);
} else {
$attr = $key;
}
$return_value->{$attr} = filter_tags($_SESSION['sticky_forms'][$params['plugin']]['attributes'][$key]);
}
}
elgg_clear_sticky_form($params['plugin']);
return $return_value;
}
开发者ID:socialweb,项目名称:PiGo,代码行数:31,代码来源:IzapBase.php
示例20: getCustomRecordLabelsSecondaryFieldAllRecords
public static function getCustomRecordLabelsSecondaryFieldAllRecords($records = array(), $removeHtml = false, $arm = null, $boldSecondaryPkValue = false, $cssClass = 'crl')
{
global $is_child, $secondary_pk, $custom_record_label, $Proj;
// Determine which arm to pull these values for
if ($arm == 'all' && $Proj->longitudinal && $Proj->multiple_arms) {
// If project has more than one arm, then get first event_id of each arm
$event_ids = array();
foreach (array_keys($Proj->events) as $this_arm) {
$event_ids[] = $Proj->getFirstEventIdArm($this_arm);
}
} else {
// Get arm
if ($arm === null) {
$arm = getArm();
}
// Get event_id of first event of the given arm
$event_ids = array($Proj->getFirstEventIdArm(is_numeric($arm) ? $arm : getArm()));
}
// Place all records/labels in array
$extra_record_labels = array();
// If $records is a string, then convert to array
$singleRecordName = null;
if (!is_array($records)) {
$singleRecordName = $records;
$records = array($records);
}
// Set flag to limit records
$limitRecords = !empty($records);
// Customize the Record ID pulldown menus using the SECONDARY_PK appended on end, if set.
if ($secondary_pk != '' && !$is_child) {
// Get validation type of secondary unique field
$val_type = $Proj->metadata[$secondary_pk]['element_validation_type'];
$convert_date_format = substr($val_type, 0, 5) == 'date_' && (substr($val_type, -4) == '_mdy' || substr($val_type, -4) == '_mdy');
// Set secondary PK field label
$secondary_pk_label = $Proj->metadata[$secondary_pk]['element_label'];
// PIPING: Obtain saved data for all piping receivers used in secondary PK label
if (strpos($secondary_pk_label, '[') !== false && strpos($secondary_pk_label, ']') !== false) {
// Get fields in the label
$secondary_pk_label_fields = array_keys(getBracketedFields($secondary_pk_label, true, true, true));
// If has at least one field piped in the label, then get all the data for these fields and insert one at a time below
if (!empty($secondary_pk_label_fields)) {
$piping_record_data = Records::getData('array', $records, $secondary_pk_label_fields, $event_ids);
}
}
// Get back-end data for the secondary PK field
$sql = "select record, event_id, value from redcap_data \n\t\t\t\t\twhere project_id = " . PROJECT_ID . " and field_name = '{$secondary_pk}' \n\t\t\t\t\tand event_id in (" . prep_implode($event_ids) . ")";
if ($limitRecords) {
$sql .= " and record in (" . prep_implode($records) . ")";
}
$q = db_query($sql);
while ($row = db_fetch_assoc($q)) {
// Set the label for this loop (label may be different if using piping in it)
if (isset($piping_record_data)) {
// Piping: pipe record data into label for each record
$this_secondary_pk_label = Piping::replaceVariablesInLabel($secondary_pk_label, $row['record'], $event_ids, $piping_record_data);
} else {
// Static label for all records
$this_secondary_pk_label = $secondary_pk_label;
}
// If the secondary unique field is a date/time field in MDY or DMY format, then convert to that format
if ($convert_date_format) {
$row['value'] = DateTimeRC::datetimeConvert($row['value'], 'ymd', substr($val_type, -3));
}
// Set text value
$this_string = "(" . remBr($this_secondary_pk_label . " " . ($boldSecondaryPkValue ? "<b>" : "") . filter_tags(label_decode($row['value']))) . ($boldSecondaryPkValue ? "</b>" : "") . ")";
// Add HTML around string (unless specified otherwise)
$extra_record_labels[$Proj->eventInfo[$row['event_id']]['arm_num']][$row['record']] = $removeHtml ? $this_string : RCView::span(array('class' => $cssClass), $this_string);
}
db_free_result($q);
}
// [Retrieval of ALL records] If Custom Record Label is specified (such as "[last_name], [first_name]"), then parse and display
// ONLY get data from FIRST EVENT
if (!empty($custom_record_label)) {
// Loop through each event (will only be one UNLESS we are attempting to get label for multiple arms)
$customRecordLabelsArm = array();
foreach ($event_ids as $this_event_id) {
$customRecordLabels = getCustomRecordLabels($custom_record_label, $this_event_id, $singleRecordName ? $records[0] : null);
if (!is_array($customRecordLabels)) {
$customRecordLabels = array($records[0] => $customRecordLabels);
}
$customRecordLabelsArm[$Proj->eventInfo[$this_event_id]['arm_num']] = $customRecordLabels;
}
foreach ($customRecordLabelsArm as $this_arm => &$customRecordLabels) {
foreach ($customRecordLabels as $this_record => $this_custom_record_label) {
// If limiting by records, ignore if not in $records array
if ($limitRecords && !in_array($this_record, $records)) {
continue;
}
// Set text value
$this_string = remBr(filter_tags(label_decode($this_custom_record_label)));
// Add initial space OR add placeholder
if (isset($extra_record_labels[$this_arm][$this_record])) {
$extra_record_labels[$this_arm][$this_record] .= ' ';
} else {
$extra_record_labels[$this_arm][$this_record] = '';
}
// Add HTML around string (unless specified otherwise)
$extra_record_labels[$this_arm][$this_record] .= $removeHtml ? $this_string : RCView::span(array('class' => $cssClass), $this_string);
}
}
//.........这里部分代码省略.........
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:101,代码来源:LongitudinalRecords.php
注:本文中的filter_tags函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论