function print_config_value_as_string($p_type, $p_value) { switch ($p_type) { case CONFIG_TYPE_INT: $t_value = (int) $p_value; echo $t_value; return; case CONFIG_TYPE_STRING: $t_value = config_eval($p_value); echo string_nl2br(string_html_specialchars("'{$t_value}'")); return; case CONFIG_TYPE_COMPLEX: $t_value = unserialize($p_value); break; default: $t_value = config_eval($p_value); break; } echo '<pre>'; if (function_exists('var_export')) { var_export($t_value); } else { print_r($t_value); } echo '</pre>'; }
function print_config_value_as_string($p_type, $p_value, $p_for_display = true) { $t_corrupted = false; switch ($p_type) { case CONFIG_TYPE_DEFAULT: return; case CONFIG_TYPE_FLOAT: echo (double) $p_value; return; case CONFIG_TYPE_INT: echo (int) $p_value; return; case CONFIG_TYPE_STRING: $t_value = string_nl2br(string_html_specialchars(config_eval($p_value))); if ($p_for_display) { $t_value = '<p id="adm-config-value">' . "'{$t_value}'" . '</p>'; } echo $t_value; return; case CONFIG_TYPE_COMPLEX: $t_value = @unserialize($p_value); if ($t_value === false) { $t_corrupted = true; } break; default: $t_value = config_eval($p_value); break; } if ($t_corrupted) { $t_output = $p_for_display ? lang_get('configuration_corrupted') : ''; } else { $t_output = var_export($t_value, true); } if ($p_for_display) { echo '<pre id="adm-config-value">' . string_attribute($t_output) . '</pre>'; } else { echo $t_output; } }
function print_config_value_as_string($p_type, $p_value) { $t_corrupted = false; switch ($p_type) { case CONFIG_TYPE_FLOAT: $t_value = (double) $p_value; echo $t_value; return; case CONFIG_TYPE_INT: $t_value = (int) $p_value; echo $t_value; return; case CONFIG_TYPE_STRING: $t_value = config_eval($p_value); echo string_nl2br(string_html_specialchars("'{$t_value}'")); return; case CONFIG_TYPE_COMPLEX: $t_value = @unserialize($p_value); if ($t_value === false) { $t_corrupted = true; } break; default: $t_value = config_eval($p_value); break; } echo '<pre>'; if ($t_corrupted) { echo lang_get('configuration_corrupted'); } else { if (function_exists('var_export')) { var_export($t_value); } else { print_r($t_value); } } echo '</pre>'; }
/** * RSS text processing. * @param string Event name * @param string Unformatted text * @return string Formatted text */ function rss($p_event, $p_string) { static $s_text, $s_urls, $s_buglinks, $s_vcslinks; $t_string = $p_string; if (null === $s_text) { $s_text = plugin_config_get('process_text'); $s_urls = plugin_config_get('process_urls'); $s_buglinks = plugin_config_get('process_buglinks'); $s_vcslinks = plugin_config_get('process_vcslinks'); } if (ON == $s_text) { $t_string = string_strip_hrefs($t_string); $t_string = string_html_specialchars($t_string); $t_string = string_restore_valid_html_tags($t_string); $t_string = string_nl2br($t_string); } if (ON == $s_urls) { $t_string = string_insert_hrefs($t_string); } if (ON == $s_buglinks) { $t_string = string_process_bug_link($t_string, true, false, true); $t_string = string_process_bugnote_link($t_string, true, false, true); } if (ON == $s_vcslinks) { $t_string = string_process_cvs_link($t_string); } return $t_string; }
/** Prepare a string for display in rss */ function string_rss_links($p_string) { // rss can not start with which spaces will be replaced into by string_display(). $t_string = trim($p_string); // same steps as string_display_links() without the preservation of spaces since is undefined in XML. $t_string = string_strip_hrefs($t_string); $t_string = string_html_specialchars($t_string); $t_string = string_restore_valid_html_tags($t_string); $t_string = string_nl2br($t_string); $t_string = string_insert_hrefs($t_string); $t_string = string_process_bug_link($t_string, true, false, true); $t_string = string_process_bugnote_link($t_string, true, false, true); $t_string = string_process_cvs_link($t_string); # another escaping to escape the special characters created by the generated links $t_string = string_html_specialchars($t_string); return $t_string; }
/** * Display a list of changeset objects in tabular format. * Assumes that a table with four columns has already been defined. * @param array Changeset objects * @param array Repository objects */ function Source_View_Changesets($p_changesets, $p_repos = null, $p_show_repos = true) { if (!is_array($p_changesets)) { return; } if (is_null($p_repos) || !is_array($p_repos)) { $t_repos = SourceRepo::load_by_changesets($p_changesets); } else { $t_repos = $p_repos; } $t_use_porting = config_get('plugin_Source_enable_porting'); foreach ($p_changesets as $t_changeset) { $t_repo = $t_repos[$t_changeset->repo_id]; $t_vcs = SourceVCS::repo($t_repo); $t_changeset->load_files(); $t_author = Source_View_Author($t_changeset, false); $t_committer = Source_View_Committer($t_changeset, false); ?> <tr class="row-1"> <td class="category" width="25%" rowspan="<?php echo count($t_changeset->files) + 1; ?> "> <a name="changeset<?php echo $t_changeset->id; ?> "><?php echo string_display(($p_show_repos ? $t_repo->name . ': ' : '') . $t_vcs->show_changeset($t_repo, $t_changeset)); ?> </a> <br/><span class="small"><?php echo plugin_lang_get('timestamp', 'Source'), ': ', string_display_line($t_changeset->timestamp); ?> </span> <br/><span class="small"><?php echo plugin_lang_get('author', 'Source'), ': ', $t_author; ?> </span> <?php if ($t_committer && $t_committer != $t_author) { ?> <br/><span class="small"><?php echo plugin_lang_get('committer', 'Source'), ': ', $t_committer; ?> </span><?php } ?> <?php if ($t_use_porting) { ?> <br/><span class="small"><?php echo plugin_lang_get('ported', 'Source'), ': ', $t_changeset->ported ? string_display_line($t_changeset->ported) : (is_null($t_changeset->ported) ? plugin_lang_get('pending', 'Source') : plugin_lang_get('na', 'Source')); ?> </span> <?php } ?> <br/><span class="small-links"> <?php print_bracket_link(plugin_page('view', false, 'Source') . '&id=' . $t_changeset->id, plugin_lang_get('details', 'Source')); if ($t_url = $t_vcs->url_changeset($t_repo, $t_changeset)) { print_bracket_link($t_url, plugin_lang_get('diff', 'Source')); } ?> </td> <td colspan="3"><?php # The commit message is manually transformed (adding href, bug and bugnote # links + nl2br) instead of calling string_display_links(), which avoids # unwanted html tags processing by the MantisCoreFormatting plugin. # Rationale: commit messages being plain text, any html they may contain # should not be considered as formatting and must be displayed as-is. echo string_nl2br(string_process_bugnote_link(string_process_bug_link(string_insert_hrefs(string_html_specialchars($t_changeset->message))))); ?> </td> </tr> <?php foreach ($t_changeset->files as $t_file) { ?> <tr class="row-2"> <td class="small mono" colspan="2"><?php echo string_display_line($t_vcs->show_file($t_repo, $t_changeset, $t_file)); ?> </td> <td class="center" width="12%"><span class="small-links"> <?php if ($t_url = $t_vcs->url_diff($t_repo, $t_changeset, $t_file)) { print_bracket_link($t_url, plugin_lang_get('diff', 'Source')); } if ($t_url = $t_vcs->url_file($t_repo, $t_changeset, $t_file)) { print_bracket_link($t_url, plugin_lang_get('file', 'Source')); } ?> </span></td> </tr> <?php } ?> <tr><td class="spacer"></td></tr> <?php } }