本文整理汇总了PHP中event_signal函数的典型用法代码示例。如果您正苦于以下问题:PHP event_signal函数的具体用法?PHP event_signal怎么用?PHP event_signal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了event_signal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_ready_function
function render_ready_function()
{
$html = '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . '$(document).ready(function() {' . "\n";
$parts = event_signal('EVENT_LAYOUT_RESOURCES_JQUERY_ONLOAD');
foreach ($parts as $part) {
$html .= $part['onload'];
}
$html .= '});' . "\n" . '//]]>' . "\n" . '</script>' . "\n";
return $html;
}
示例2: log_event
/**
* Log an event
* @param int $p_level
* @param string $p_msg
* @return null
*/
function log_event($p_level, $p_msg)
{
global $g_log_levels;
# check to see if logging is enabled
$t_sys_log = config_get_global('log_level');
if (0 == ($t_sys_log & $p_level)) {
return;
}
$t_now = date(config_get_global('complete_date_format'));
$t_level = $g_log_levels[$p_level];
$t_plugin_event = '[' . $t_level . '] ' . $p_msg;
if (function_exists('event_signal')) {
event_signal('EVENT_LOG', array($t_plugin_event));
}
$t_php_event = $t_now . ' ' . $t_level . ' ' . $p_msg;
$t_log_destination = config_get_global('log_destination');
if (is_blank($t_log_destination)) {
$t_destination = '';
} else {
# Use @ to avoid error when there is no delimiter in log destination
@(list($t_destination, $t_modifiers) = explode(':', $t_log_destination, 2));
}
switch ($t_destination) {
case 'file':
error_log($t_php_event . PHP_EOL, 3, $t_modifiers);
break;
case 'firebug':
if (!class_exists('FirePHP')) {
if (file_exists(BASE_PATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'FirePHPCore' . DIRECTORY_SEPARATOR . 'FirePHP.class.php')) {
require_once BASE_PATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'FirePHPCore' . DIRECTORY_SEPARATOR . 'FirePHP.class.php';
}
}
if (class_exists('FirePHP')) {
static $firephp;
if ($firephp === null) {
$firephp = FirePHP::getInstance(true);
}
$firephp->log($t_php_event);
return;
}
// if firebug is not available, fall through
// if firebug is not available, fall through
default:
# use default PHP error log settings
error_log($t_php_event . PHP_EOL);
break;
}
# If running from command line, echo log event to stdout
if (php_sapi_name() == 'cli') {
echo $t_php_event . PHP_EOL;
}
}
示例3: get
/**
* Gets the avatar information for the user. The avatars are provided by
* plugins that can integrate with a variety of services like gravatar.com,
* LDAP, Social Identities, etc.
*
* If logged in user doesn't have access to view avatars or not avatar is found,
* then a default avatar will be used.
*
* Note that the provided user id may no longer has a corresponding user in the
* system, if the user was deleted.
*
* @param integer $p_user_id The user id.
* @param integer $p_size The desired width/height of the avatar.
*
* @return array The array with avatar information.
*/
public static function get($p_user_id, $p_size = 80)
{
$t_enabled = config_get('show_avatar') !== OFF;
$t_avatar = null;
if ($t_enabled) {
$t_user_exists = user_exists($p_user_id);
if ($t_user_exists && access_has_project_level(config_get('show_avatar_threshold'), null, $p_user_id)) {
$t_avatar = event_signal('EVENT_USER_AVATAR', array($p_user_id, $p_size));
}
if ($t_avatar === null) {
$t_avatar = new Avatar();
}
$t_avatar->normalize($p_user_id, $t_user_exists);
}
return $t_avatar;
}
示例4: filter_get_plugin_filters
/**
* Allow plugins to define a set of class-based filters, and register/load
* them here to be used by the rest of filter_api.
* @return array Mapping of field name to filter object
*/
function filter_get_plugin_filters()
{
static $s_field_array = null;
if (is_null($s_field_array)) {
$s_field_array = array();
$t_all_plugin_filters = event_signal('EVENT_FILTER_FIELDS');
foreach ($t_all_plugin_filters as $t_plugin => $t_plugin_filters) {
foreach ($t_plugin_filters as $t_callback => $t_plugin_filter_array) {
if (is_array($t_plugin_filter_array)) {
foreach ($t_plugin_filter_array as $t_filter_class) {
if (class_exists($t_filter_class) && is_subclass_of($t_filter_class, 'MantisFilter')) {
$t_filter_object = new $t_filter_class();
$t_field_name = $t_plugin . '_' . $t_filter_object->field;
$s_field_array[$t_field_name] = $t_filter_object;
}
}
}
}
}
}
return $s_field_array;
}
示例5: columns_get_plugin_columns
/**
* Allow plugins to define a set of class-based columns, and register/load
* them here to be used by columns_api.
* @return array Mapping of column name to column object
*/
function columns_get_plugin_columns()
{
static $s_column_array = null;
if (is_null($s_column_array)) {
$s_column_array = array();
$t_all_plugin_columns = event_signal('EVENT_FILTER_COLUMNS');
foreach ($t_all_plugin_columns as $t_plugin => $t_plugin_columns) {
foreach ($t_plugin_columns as $t_callback => $t_plugin_column_array) {
if (is_array($t_plugin_column_array)) {
foreach ($t_plugin_column_array as $t_column_class) {
if (class_exists($t_column_class) && is_subclass_of($t_column_class, 'MantisColumn')) {
$t_column_object = new $t_column_class();
$t_column_name = utf8_strtolower($t_plugin . '_' . $t_column_object->column);
$s_column_array[$t_column_name] = $t_column_object;
}
}
}
}
}
}
return $s_column_array;
}
示例6: helper_get_tab_index
</label>
</th>
<td>
<select <?php
echo helper_get_tab_index();
?>
id="target_version" name="target_version">
<?php
print_version_option_list('', null, VERSION_FUTURE);
?>
</select>
</td>
</tr>
<?php
}
event_signal('EVENT_REPORT_BUG_FORM', array($t_project_id));
?>
<tr>
<th class="category">
<span class="required">*</span><label for="summary"><?php
print_documentation_link('summary');
?>
</label>
</th>
<td>
<input <?php
echo helper_get_tab_index();
?>
type="text" id="summary" name="summary" size="105" maxlength="128" value="<?php
echo string_attribute($f_summary);
?>
示例7: init
/**
* Initialize the extension cache.
*/
public static function init()
{
if (is_array(self::$cache) && !empty(self::$cache)) {
return;
}
$t_raw_data = event_signal('EVENT_SOURCE_INTEGRATION');
foreach ($t_raw_data as $t_plugin => $t_callbacks) {
foreach ($t_callbacks as $t_callback => $t_object) {
if (is_subclass_of($t_object, 'MantisSourcePlugin') && is_string($t_object->type) && !is_blank($t_object->type)) {
$t_type = strtolower($t_object->type);
self::$cache[$t_type] = new SourceVCSWrapper($t_object);
}
}
}
ksort(self::$cache);
}
示例8: print_bug_attachment_header
/**
* Prints a single textual line of information about an attachment including download link, file
* size and upload timestamp.
* @param array $p_attachment An attachment array from within the array returned by the file_get_visible_attachments() function.
* @return void
*/
function print_bug_attachment_header(array $p_attachment)
{
echo "\n";
if ($p_attachment['exists']) {
if ($p_attachment['can_download']) {
echo '<a href="' . string_attribute($p_attachment['download_url']) . '">';
}
print_file_icon($p_attachment['display_name']);
if ($p_attachment['can_download']) {
echo '</a>';
}
echo lang_get('word_separator');
if ($p_attachment['can_download']) {
echo '<a href="' . string_attribute($p_attachment['download_url']) . '">';
}
echo string_display_line($p_attachment['display_name']);
if ($p_attachment['can_download']) {
echo '</a>';
}
echo lang_get('word_separator') . '(' . number_format($p_attachment['size']) . lang_get('word_separator') . lang_get('bytes') . ')';
echo lang_get('word_separator') . '<span class="italic">' . date(config_get('normal_date_format'), $p_attachment['date_added']) . '</span>';
event_signal('EVENT_VIEW_BUG_ATTACHMENT', array($p_attachment));
} else {
print_file_icon($p_attachment['display_name']);
echo lang_get('word_separator') . '<span class="strike">' . string_display_line($p_attachment['display_name']) . '</span>' . lang_get('word_separator') . '(' . lang_get('attachment_missing') . ')';
}
if ($p_attachment['can_delete']) {
echo lang_get('word_separator') . '[';
print_link('bug_file_delete.php?file_id=' . $p_attachment['id'] . form_security_param('bug_file_delete'), lang_get('delete_link'), false, 'small');
echo ']';
}
}
示例9: string_display_links
break;
}
echo string_display_links($t_bugnote->note);
?>
</td>
</tr>
<?php
event_signal('EVENT_VIEW_BUGNOTE', array($f_bug_id, $t_bugnote->id, VS_PRIVATE == $t_bugnote->view_state));
?>
<tr class="spacer">
<td colspan="2"></td>
</tr>
<?php
}
# end for loop
event_signal('EVENT_VIEW_BUGNOTES_END', $f_bug_id);
?>
</table>
<?php
if ($t_total_time > 0 && access_has_bug_level(config_get('time_tracking_view_threshold'), $f_bug_id)) {
echo '<p class="time-tracking-total">', sprintf(lang_get('total_time_for_issue'), '<span class="time-tracked">' . db_minutes_to_hhmm($t_total_time) . '</span>'), '</p>';
}
collapse_closed('bugnotes');
?>
<table class="width100" cellspacing="1">
<tr>
<td class="form-title" colspan="2">
<?php
collapse_icon('bugnotes');
?>
示例10: require_api
require_api('error_api.php');
require_api('event_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('print_api.php');
require_api('string_api.php');
form_security_validate('bugnote_update');
$f_bugnote_id = gpc_get_int('bugnote_id');
$f_bugnote_text = gpc_get_string('bugnote_text', '');
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
# Check if the current user is allowed to edit the bugnote
$t_user_id = auth_get_current_user_id();
$t_reporter_id = bugnote_get_field($f_bugnote_id, 'reporter_id');
if ($t_user_id == $t_reporter_id) {
access_ensure_bugnote_level(config_get('bugnote_user_edit_threshold'), $f_bugnote_id);
} else {
access_ensure_bugnote_level(config_get('update_bugnote_threshold'), $f_bugnote_id);
}
# Check if the bug is readonly
$t_bug_id = bugnote_get_field($f_bugnote_id, 'bug_id');
if (bug_is_readonly($t_bug_id)) {
error_parameters($t_bug_id);
trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
}
$f_bugnote_text = trim($f_bugnote_text) . "\n\n";
bugnote_set_text($f_bugnote_id, $f_bugnote_text);
bugnote_set_time_tracking($f_bugnote_id, $f_time_tracking);
# Plugin integration
event_signal('EVENT_BUGNOTE_EDIT', array($t_bug_id, $f_bugnote_id));
form_security_purge('bugnote_update');
print_successful_redirect(string_get_bug_view_url($t_bug_id) . '#bugnotes');
示例11: version_update
}
if (is_null($obsolete)) {
$version->obsolete = false;
} else {
if ($obsolete == 'on') {
$version->obsolete = true;
}
}
if (!is_null($date_order)) {
$new_date_order = $date_order[$version_index];
$version->date_order = $new_date_order;
}
if (!is_null($type)) {
$new_type = $type[$version_index];
if (strlen($new_type) > 0) {
$new_type_id = $specmanagement_database_api->get_type_id($new_type);
$specmanagement_database_api->update_version_associated_type($project_id, $version_ids[$version_index], $new_type_id);
} else {
$specmanagement_database_api->update_version_associated_type($project_id, $version_ids[$version_index], 9999);
}
}
if (!is_null($description)) {
$new_description = $description[$version_index];
$version->description = $new_description;
}
version_update($version);
event_signal('EVENT_MANAGE_VERSION_UPDATE', array($version_id));
}
}
form_security_purge('plugin_SpecManagement_manage_versions_update');
print_successful_redirect(plugin_page('manage_versions', true));
开发者ID:Cre-ator,项目名称:Whiteboard.SpecificationManagement-Plugin,代码行数:31,代码来源:manage_versions_update.php
示例12: bugnote_add
/**
* Add a bugnote to a bug
* return the ID of the new bugnote
* @param int $p_bug_id bug id
* @param string $p_bugnote_text bugnote text
* @param string $p_time_tracking hh:mm string
* @param bool $p_private whether bugnote is private
* @param int $p_type bugnote type
* @param string $p_attr
* @param int $p_user_id user id
* @param bool $p_send_email generate email?
* @return false|int false or indicating bugnote id added
* @access public
*/
function bugnote_add($p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_private = false, $p_type = BUGNOTE, $p_attr = '', $p_user_id = null, $p_send_email = TRUE, $p_log_history = TRUE)
{
$c_bug_id = db_prepare_int($p_bug_id);
$c_time_tracking = helper_duration_to_minutes($p_time_tracking);
$c_type = db_prepare_int($p_type);
if (REMINDER !== $p_type) {
# Check if this is a time-tracking note
$t_time_tracking_enabled = config_get('time_tracking_enabled');
if (ON == $t_time_tracking_enabled && $c_time_tracking > 0) {
$t_time_tracking_without_note = config_get('time_tracking_without_note');
if (is_blank($p_bugnote_text) && OFF == $t_time_tracking_without_note) {
error_parameters(lang_get('bugnote'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$c_type = TIME_TRACKING;
} else {
if (is_blank($p_bugnote_text)) {
# This is not time tracking (i.e. it's a normal bugnote)
# @todo should we not trigger an error in this case ?
return false;
}
}
}
$t_bugnote_text_table = db_get_table('mantis_bugnote_text_table');
$t_bugnote_table = db_get_table('mantis_bugnote_table');
# Event integration
$t_bugnote_text = event_signal('EVENT_BUGNOTE_DATA', $p_bugnote_text, $c_bug_id);
# insert bugnote text
$query = 'INSERT INTO ' . $t_bugnote_text_table . ' ( note ) VALUES ( ' . db_param() . ' )';
db_query_bound($query, array($t_bugnote_text));
# retrieve bugnote text id number
$t_bugnote_text_id = db_insert_id($t_bugnote_text_table);
# get user information
if ($p_user_id === null) {
$c_user_id = auth_get_current_user_id();
} else {
$c_user_id = db_prepare_int($p_user_id);
}
# Check for private bugnotes.
# @@@ VB: Should we allow users to report private bugnotes, and possibly see only their own private ones
if ($p_private && access_has_bug_level(config_get('private_bugnote_threshold'), $p_bug_id, $c_user_id)) {
$t_view_state = VS_PRIVATE;
} else {
$t_view_state = VS_PUBLIC;
}
# insert bugnote info
$query = "INSERT INTO {$t_bugnote_table}\n\t\t\t\t(bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified, note_type, note_attr, time_tracking )\n\t\t\tVALUES\n\t\t\t\t(" . db_param() . ', ' . db_param() . ',' . db_param() . ', ' . db_param() . ', ' . db_param() . ',' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';
db_query_bound($query, array($c_bug_id, $c_user_id, $t_bugnote_text_id, $t_view_state, db_now(), db_now(), $c_type, $p_attr, $c_time_tracking));
# get bugnote id
$t_bugnote_id = db_insert_id($t_bugnote_table);
# update bug last updated
bug_update_date($p_bug_id);
# log new bug
if (TRUE == $p_log_history) {
history_log_event_special($p_bug_id, BUGNOTE_ADDED, bugnote_format_id($t_bugnote_id));
}
# if it was FEEDBACK its NEW_ now
if (config_get('reassign_on_feedback') && bug_get_field($p_bug_id, 'status') == config_get('bug_feedback_status') && bug_get_field($p_bug_id, 'reporter_id') == $c_user_id) {
if (bug_get_field($p_bug_id, 'handler_id') == 0) {
bug_set_field($p_bug_id, 'status', config_get('bug_submit_status'));
} else {
bug_set_field($p_bug_id, 'status', config_get('bug_assigned_status'));
}
}
# Event integration
event_signal('EVENT_BUGNOTE_ADD', array($p_bug_id, $t_bugnote_id));
# only send email if the text is not blank, otherwise, it is just recording of time without a comment.
if (TRUE == $p_send_email && !is_blank($t_bugnote_text)) {
email_bugnote_add($p_bug_id);
}
return $t_bugnote_id;
}
示例13: lang_get
}
echo lang_get('viewing_bugs_title');
echo " ({$v_start} - {$v_end} / {$t_bug_count})";
?>
</span>
<span class="floatleft small">
<?php
# -- Print and Export links --
echo ' ';
print_bracket_link('print_all_bug_page.php', lang_get('print_all_bug_page_link'));
echo ' ';
print_bracket_link('csv_export.php', lang_get('csv_export'));
echo ' ';
print_bracket_link('excel_xml_export.php', lang_get('excel_export'));
$t_event_menu_options = $t_links = event_signal('EVENT_MENU_FILTER');
foreach ($t_event_menu_options as $t_plugin => $t_plugin_menu_options) {
foreach ($t_plugin_menu_options as $t_callback => $t_callback_menu_options) {
if (!is_array($t_callback_menu_options)) {
$t_callback_menu_options = array($t_callback_menu_options);
}
foreach ($t_callback_menu_options as $t_menu_option) {
if ($t_menu_option) {
print_bracket_link_prepared($t_menu_option);
}
}
}
}
?>
</span>
示例14: lang_get
?>
>
<td class="category">
<?php
echo lang_get('obsolete');
?>
</td>
<td>
<input type="checkbox" name="obsolete" <?php
check_checked($t_version->obsolete, true);
?>
/>
</td>
</tr>
<?php
event_signal('EVENT_MANAGE_VERSION_UPDATE_FORM', array($t_version->id));
?>
<tr>
<td>
 
</td>
<td>
<input type="submit" class="button" value="<?php
echo lang_get('update_version_button');
?>
" />
</td>
</tr>
</table>
</form>
</div>
示例15: plugin_init_installed
/**
* Initialize all installed plugins.
* Post-signals EVENT_PLUGIN_INIT.
*/
function plugin_init_installed()
{
if (OFF == config_get_global('plugins_enabled') || !db_table_exists(db_get_table('plugin'))) {
return;
}
global $g_plugin_cache, $g_plugin_current, $g_plugin_cache_priority, $g_plugin_cache_protected, $g_plugin_cache_init;
$g_plugin_cache = array();
$g_plugin_current = array();
$g_plugin_cache_init = array();
$g_plugin_cache_priority = array();
$g_plugin_cache_protected = array();
plugin_register('MantisCore');
plugin_register_installed();
$t_plugins = array_keys($g_plugin_cache);
do {
$t_continue = false;
$t_plugins_retry = array();
foreach ($t_plugins as $t_basename) {
if (plugin_init($t_basename)) {
$t_continue = true;
} else {
# Dependent plugin
$t_plugins_retry[] = $t_basename;
}
}
$t_plugins = $t_plugins_retry;
} while ($t_continue);
event_signal('EVENT_PLUGIN_INIT');
}