mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 09:13:02 +02:00
feature 3010 : replace trigger_action/event by trigger_notify/change
git-svn-id: http://piwigo.org/svn/trunk@28587 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -49,7 +49,7 @@ class BlockManager
|
||||
*/
|
||||
public function load_registered_blocks()
|
||||
{
|
||||
trigger_action('blockmanager_register_blocks', array($this));
|
||||
trigger_notify('blockmanager_register_blocks', array($this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +110,7 @@ class BlockManager
|
||||
$idx++;
|
||||
}
|
||||
$this->sort_blocks();
|
||||
trigger_action('blockmanager_prepare_display', array($this));
|
||||
trigger_notify('blockmanager_prepare_display', array($this));
|
||||
$this->sort_blocks();
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ class BlockManager
|
||||
global $template;
|
||||
|
||||
$template->set_filename('menubar', $file);
|
||||
trigger_action('blockmanager_apply', array($this) );
|
||||
trigger_notify('blockmanager_apply', array($this) );
|
||||
|
||||
foreach ($this->display_blocks as $id=>$block)
|
||||
{
|
||||
|
||||
@@ -269,7 +269,7 @@ if (count($categories) > 0)
|
||||
|
||||
$template->set_filename('index_category_thumbnails', 'mainpage_categories.tpl');
|
||||
|
||||
trigger_action('loc_begin_index_category_thumbnails', $categories);
|
||||
trigger_notify('loc_begin_index_category_thumbnails', $categories);
|
||||
|
||||
$tpl_thumbnails_var = array();
|
||||
|
||||
@@ -280,7 +280,7 @@ if (count($categories) > 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
$category['name'] = trigger_event(
|
||||
$category['name'] = trigger_change(
|
||||
'render_category_name',
|
||||
$category['name'],
|
||||
'subcatify_category_name'
|
||||
@@ -316,8 +316,8 @@ if (count($categories) > 0)
|
||||
'<br>'
|
||||
),
|
||||
'DESCRIPTION' =>
|
||||
trigger_event('render_category_literal_description',
|
||||
trigger_event('render_category_description',
|
||||
trigger_change('render_category_literal_description',
|
||||
trigger_change('render_category_description',
|
||||
@$category['comment'],
|
||||
'subcatify_category_description')),
|
||||
'NAME' => $name,
|
||||
@@ -367,8 +367,8 @@ if (count($categories) > 0)
|
||||
$conf['nb_categories_page']
|
||||
);
|
||||
|
||||
$derivative_params = trigger_event('get_index_album_derivative_params', ImageStdParams::get_by_type(IMG_THUMB) );
|
||||
$tpl_thumbnails_var_selection = trigger_event('loc_end_index_category_thumbnails', $tpl_thumbnails_var_selection);
|
||||
$derivative_params = trigger_change('get_index_album_derivative_params', ImageStdParams::get_by_type(IMG_THUMB) );
|
||||
$tpl_thumbnails_var_selection = trigger_change('loc_end_index_category_thumbnails', $tpl_thumbnails_var_selection);
|
||||
$template->assign( array(
|
||||
'maxRequests' =>$conf['max_requests'],
|
||||
'category_thumbnails' => $tpl_thumbnails_var_selection,
|
||||
|
||||
@@ -35,7 +35,7 @@ $selection = array_slice(
|
||||
$page['nb_image_page']
|
||||
);
|
||||
|
||||
$selection = trigger_event('loc_index_thumbnails_selection', $selection);
|
||||
$selection = trigger_change('loc_index_thumbnails_selection', $selection);
|
||||
|
||||
if (count($selection) > 0)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ SELECT image_id, COUNT(*) AS nb_comments
|
||||
// template thumbnail initialization
|
||||
$template->set_filenames( array( 'index_thumbnails' => 'thumbnails.tpl',));
|
||||
|
||||
trigger_action('loc_begin_index_thumbnails', $pictures);
|
||||
trigger_notify('loc_begin_index_thumbnails', $pictures);
|
||||
$tpl_thumbnails_var = array();
|
||||
|
||||
foreach ($pictures as $row)
|
||||
@@ -152,11 +152,11 @@ foreach ($pictures as $row)
|
||||
}
|
||||
|
||||
$template->assign( array(
|
||||
'derivative_params' => trigger_event('get_index_derivative_params', ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) ) ),
|
||||
'derivative_params' => trigger_change('get_index_derivative_params', ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) ) ),
|
||||
'maxRequests' =>$conf['max_requests'],
|
||||
'SHOW_THUMBNAIL_CAPTION' =>$conf['show_thumbnail_caption'],
|
||||
) );
|
||||
$tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
|
||||
$tpl_thumbnails_var = trigger_change('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
|
||||
$template->assign('thumbnails', $tpl_thumbnails_var);
|
||||
|
||||
$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
|
||||
|
||||
@@ -175,7 +175,7 @@ if ( is_admin() || (defined('IN_ADMIN') and IN_ADMIN) )
|
||||
{
|
||||
load_language('admin.lang');
|
||||
}
|
||||
trigger_action('loading_lang');
|
||||
trigger_notify('loading_lang');
|
||||
load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
|
||||
|
||||
// only now we can set the localized username of the guest user (and not in
|
||||
@@ -272,5 +272,5 @@ if ( !empty($conf['original_url_protection']) )
|
||||
add_event_handler('get_element_url', 'get_element_url_protection_handler', EVENT_HANDLER_PRIORITY_NEUTRAL, 2 );
|
||||
add_event_handler('get_src_image_url', 'get_src_image_url_protection_handler', EVENT_HANDLER_PRIORITY_NEUTRAL, 2 );
|
||||
}
|
||||
trigger_action('init');
|
||||
trigger_notify('init');
|
||||
?>
|
||||
|
||||
@@ -67,7 +67,7 @@ final class SrcImage
|
||||
else
|
||||
{
|
||||
$ext = strtolower($ext);
|
||||
$this->rel_path = trigger_event('get_mimetype_location', get_themeconf('mime_icon_dir').$ext.'.png', $ext );
|
||||
$this->rel_path = trigger_change('get_mimetype_location', get_themeconf('mime_icon_dir').$ext.'.png', $ext );
|
||||
$this->flags |= self::IS_MIMETYPE;
|
||||
if ( ($size=@getimagesize(PHPWG_ROOT_PATH.$this->rel_path)) === false)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ final class SrcImage
|
||||
$url = get_root_url().$this->rel_path;
|
||||
if ( !($this->flags & self::IS_MIMETYPE) )
|
||||
{
|
||||
$url = trigger_event('get_src_image_url', $url, $this);
|
||||
$url = trigger_change('get_src_image_url', $url, $this);
|
||||
}
|
||||
return embellish_url($url);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ final class DerivativeImage
|
||||
return $src_image->get_url();
|
||||
}
|
||||
return embellish_url(
|
||||
trigger_event('get_derivative_url',
|
||||
trigger_change('get_derivative_url',
|
||||
get_root_url().$rel_url,
|
||||
$params, $src_image, $rel_url
|
||||
) );
|
||||
@@ -405,7 +405,7 @@ final class DerivativeImage
|
||||
return $this->src_image->get_url();
|
||||
}
|
||||
return embellish_url(
|
||||
trigger_event('get_derivative_url',
|
||||
trigger_change('get_derivative_url',
|
||||
get_root_url().$this->rel_url,
|
||||
$this->params, $this->src_image, $this->rel_url
|
||||
) );
|
||||
|
||||
@@ -423,7 +423,7 @@ function pwg_log($image_id = null, $image_type = null)
|
||||
$do_log = $conf['history_guest'];
|
||||
}
|
||||
|
||||
$do_log = trigger_event('pwg_log_allowed', $do_log, $image_id, $image_type);
|
||||
$do_log = trigger_change('pwg_log_allowed', $do_log, $image_id, $image_type);
|
||||
|
||||
if (!$do_log)
|
||||
{
|
||||
@@ -773,7 +773,7 @@ function redirect_html( $url , $msg = '', $refresh_time = 0)
|
||||
{
|
||||
$user = build_user( $conf['guest_id'], true);
|
||||
load_language('common.lang');
|
||||
trigger_action('loading_lang');
|
||||
trigger_notify('loading_lang');
|
||||
load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
|
||||
$template = new Template(PHPWG_ROOT_PATH.'themes', get_default_theme());
|
||||
}
|
||||
@@ -870,7 +870,7 @@ SELECT
|
||||
}
|
||||
|
||||
// plugins want remove some themes based on user status maybe?
|
||||
$themes = trigger_event('get_pwg_themes', $themes);
|
||||
$themes = trigger_change('get_pwg_themes', $themes);
|
||||
|
||||
return $themes;
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ SELECT '.$conf['user_fields']['email'].'
|
||||
;';
|
||||
list($email) = pwg_db_fetch_row(pwg_query($query));
|
||||
|
||||
$email = trigger_event('get_webmaster_mail_address', $email);
|
||||
$email = trigger_change('get_webmaster_mail_address', $email);
|
||||
|
||||
return $email;
|
||||
}
|
||||
@@ -1154,7 +1154,7 @@ SELECT param, value
|
||||
$conf[ $row['param'] ] = $val;
|
||||
}
|
||||
|
||||
trigger_action('load_conf', $condition);
|
||||
trigger_notify('load_conf', $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,7 +108,7 @@ FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
||||
);
|
||||
}
|
||||
|
||||
$where = trigger_event('get_categories_menu_sql_where',
|
||||
$where = trigger_change('get_categories_menu_sql_where',
|
||||
$where, $user['expand'], $filter['enabled'] );
|
||||
|
||||
$query.= '
|
||||
@@ -123,7 +123,7 @@ WHERE '.$where.'
|
||||
$child_date_last = @$row['max_date_last']> @$row['date_last'];
|
||||
$row = array_merge($row,
|
||||
array(
|
||||
'NAME' => trigger_event(
|
||||
'NAME' => trigger_change(
|
||||
'render_category_name',
|
||||
$row['name'],
|
||||
'get_categories_menu'
|
||||
@@ -230,7 +230,7 @@ function get_category_preferred_image_orders()
|
||||
{
|
||||
global $conf, $page;
|
||||
|
||||
return trigger_event('get_category_preferred_image_orders', array(
|
||||
return trigger_change('get_category_preferred_image_orders', array(
|
||||
array(l10n('Default'), '', true),
|
||||
array(l10n('Photo title, A → Z'), 'name ASC', true),
|
||||
array(l10n('Photo title, Z → A'), 'name DESC', true),
|
||||
@@ -279,7 +279,7 @@ function display_select_categories($categories,
|
||||
(3 * substr_count($category['global_rank'], '.')));
|
||||
$option.= '- ';
|
||||
$option.= strip_tags(
|
||||
trigger_event(
|
||||
trigger_change(
|
||||
'render_category_name',
|
||||
$category['name'],
|
||||
'display_select_categories'
|
||||
|
||||
@@ -31,7 +31,7 @@ add_event_handler('user_comment_check', 'user_comment_check',
|
||||
|
||||
/**
|
||||
* Does basic check on comment and returns action to perform.
|
||||
* This method is called by a trigger_event()
|
||||
* This method is called by a trigger_change()
|
||||
*
|
||||
* @param string $action before check
|
||||
* @param array $comment
|
||||
@@ -211,7 +211,7 @@ SELECT count(1) FROM '.COMMENTS_TABLE.'
|
||||
}
|
||||
|
||||
// perform more spam check
|
||||
$comment_action = trigger_event('user_comment_check',
|
||||
$comment_action = trigger_change('user_comment_check',
|
||||
$comment_action, $comm
|
||||
);
|
||||
|
||||
@@ -303,7 +303,7 @@ $user_where_clause.'
|
||||
array('author' => $GLOBALS['user']['username'],
|
||||
'comment_id' => $comment_id
|
||||
));
|
||||
trigger_action('user_comment_deletion', $comment_id);
|
||||
trigger_notify('user_comment_deletion', $comment_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ function update_user_comment($comment, $post_key)
|
||||
|
||||
// perform more spam check
|
||||
$comment_action =
|
||||
trigger_event('user_comment_check',
|
||||
trigger_change('user_comment_check',
|
||||
$comment_action,
|
||||
array_merge($comment,
|
||||
array('author' => $GLOBALS['user']['username'])
|
||||
@@ -509,7 +509,7 @@ UPDATE '.COMMENTS_TABLE.'
|
||||
pwg_query($query);
|
||||
|
||||
invalidate_user_cache_nb_comments();
|
||||
trigger_action('user_comment_validation', $comment_id);
|
||||
trigger_notify('user_comment_validation', $comment_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ function get_cat_display_name($cat_informations, $url='')
|
||||
'get_cat_display_name wrong type for category ', E_USER_WARNING
|
||||
);
|
||||
|
||||
$cat['name'] = trigger_event(
|
||||
$cat['name'] = trigger_change(
|
||||
'render_category_name',
|
||||
$cat['name'],
|
||||
'get_cat_display_name'
|
||||
@@ -132,7 +132,7 @@ SELECT id, name, permalink
|
||||
{
|
||||
$cat = $cache['cat_names'][$category_id];
|
||||
|
||||
$cat['name'] = trigger_event(
|
||||
$cat['name'] = trigger_change(
|
||||
'render_category_name',
|
||||
$cat['name'],
|
||||
'get_cat_display_name_cache'
|
||||
@@ -463,7 +463,7 @@ function get_tags_content_title()
|
||||
.'" title="'
|
||||
.l10n('display photos linked to this tag')
|
||||
.'">'
|
||||
.trigger_event('render_tag_name', $page['tags'][$i]['name'], $page['tags'][$i])
|
||||
.trigger_change('render_tag_name', $page['tags'][$i]['name'], $page['tags'][$i])
|
||||
.'</a>';
|
||||
|
||||
if (count($page['tags']) > 2)
|
||||
@@ -517,12 +517,12 @@ function set_status_header($code, $text='')
|
||||
$protocol = 'HTTP/1.0';
|
||||
|
||||
header( "$protocol $code $text", true, $code );
|
||||
trigger_action('set_status_header', $code, $text);
|
||||
trigger_notify('set_status_header', $code, $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the category comment for rendering in html textual mode (subcatify)
|
||||
* This method is called by a trigger_action()
|
||||
* This method is called by a trigger_notify()
|
||||
*
|
||||
* @param string $desc
|
||||
* @return string
|
||||
@@ -534,7 +534,7 @@ function render_category_literal_description($desc)
|
||||
|
||||
/**
|
||||
* Add known menubar blocks.
|
||||
* This method is called by a trigger_event()
|
||||
* This method is called by a trigger_change()
|
||||
*
|
||||
* @param BlockManager[] $menu_ref_arr
|
||||
*/
|
||||
@@ -562,7 +562,7 @@ function render_element_name($info)
|
||||
{
|
||||
if (!empty($info['name']))
|
||||
{
|
||||
return trigger_event('render_element_name', $info['name']);
|
||||
return trigger_change('render_element_name', $info['name']);
|
||||
}
|
||||
return get_name_from_file($info['file']);
|
||||
}
|
||||
@@ -578,7 +578,7 @@ function render_element_description($info, $param='')
|
||||
{
|
||||
if (!empty($info['comment']))
|
||||
{
|
||||
return trigger_event('render_element_description', $info['comment'], $param);
|
||||
return trigger_change('render_element_description', $info['comment'], $param);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@@ -624,7 +624,7 @@ function get_thumbnail_title($info, $title, $comment='')
|
||||
}
|
||||
|
||||
$title = htmlspecialchars(strip_tags($title));
|
||||
$title = trigger_event('get_thumbnail_title', $title, $info);
|
||||
$title = trigger_change('get_thumbnail_title', $title, $info);
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ function switch_lang_to($language)
|
||||
load_language($filename, $dirname, array('language'=>$language) );
|
||||
}
|
||||
|
||||
trigger_action('loading_lang');
|
||||
trigger_notify('loading_lang');
|
||||
load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR,
|
||||
array('language'=>$language, 'no_fallback'=>true, 'local'=>true)
|
||||
);
|
||||
@@ -696,7 +696,7 @@ function pwg_mail($to, $args=array(), $tpl=array())
|
||||
if (!isset($conf_mail[$cache_key]['theme']))
|
||||
{
|
||||
$conf_mail[$cache_key]['theme'] = get_mail_template($content_type);
|
||||
trigger_action('before_parse_mail_template', $cache_key, $content_type);
|
||||
trigger_notify('before_parse_mail_template', $cache_key, $content_type);
|
||||
}
|
||||
$template = &$conf_mail[$cache_key]['theme'];
|
||||
|
||||
@@ -854,7 +854,7 @@ function pwg_mail($to, $args=array(), $tpl=array())
|
||||
}
|
||||
|
||||
$ret = true;
|
||||
$pre_result = trigger_event('before_send_mail', true, $to, $args, $mail);
|
||||
$pre_result = trigger_change('before_send_mail', true, $to, $args, $mail);
|
||||
|
||||
if ($pre_result)
|
||||
{
|
||||
@@ -945,6 +945,6 @@ function pwg_send_mail_test($success, $mail, $args)
|
||||
}
|
||||
}
|
||||
|
||||
trigger_action('functions_mail_included');
|
||||
trigger_notify('functions_mail_included');
|
||||
|
||||
?>
|
||||
@@ -104,7 +104,7 @@ function clean_iptc_value($value)
|
||||
{
|
||||
// apparently mac uses some MacRoman crap encoding. I don't know
|
||||
// how to detect it so a plugin should do the trick.
|
||||
$value = trigger_event('clean_iptc_value', $value);
|
||||
$value = trigger_change('clean_iptc_value', $value);
|
||||
if ( ($qual = qualify_utf8($value)) != 0)
|
||||
{// has non ascii chars
|
||||
if ($qual>0)
|
||||
@@ -152,7 +152,7 @@ function get_exif_data($filename, $map)
|
||||
// Read EXIF data
|
||||
if ($exif = @read_exif_data($filename))
|
||||
{
|
||||
$exif = trigger_event('format_exif_data', $exif, $filename, $map);
|
||||
$exif = trigger_change('format_exif_data', $exif, $filename, $map);
|
||||
|
||||
// configured fields
|
||||
foreach ($map as $key => $field)
|
||||
|
||||
@@ -246,7 +246,6 @@ function remove_event_handler($event, $func,
|
||||
* optional _$args_ are not transmitted.
|
||||
*
|
||||
* @since 2.6
|
||||
* @todo remove trigger_event()
|
||||
*
|
||||
* @param string $event
|
||||
* @param mixed $data data to transmit to all handlers
|
||||
@@ -254,22 +253,12 @@ function remove_event_handler($event, $func,
|
||||
* @return mixed $data
|
||||
*/
|
||||
function trigger_change($event, $data=null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return call_user_func_array('trigger_event', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.6
|
||||
* @see trigger_change
|
||||
*/
|
||||
function trigger_event($event, $data=null)
|
||||
{
|
||||
global $pwg_event_handlers;
|
||||
|
||||
if (isset($pwg_event_handlers['trigger']))
|
||||
{// debugging
|
||||
trigger_action('trigger',
|
||||
trigger_notify('trigger',
|
||||
array('type'=>'event', 'event'=>$event, 'data'=>$data)
|
||||
);
|
||||
}
|
||||
@@ -298,7 +287,7 @@ function trigger_event($event, $data=null)
|
||||
|
||||
if (isset($pwg_event_handlers['trigger']))
|
||||
{// debugging
|
||||
trigger_action('trigger',
|
||||
trigger_notify('trigger',
|
||||
array('type'=>'post_event', 'event'=>$event, 'data'=>$data)
|
||||
);
|
||||
}
|
||||
@@ -311,28 +300,17 @@ function trigger_event($event, $data=null)
|
||||
* trigger_notify() is only used as a notifier, no modification of data is possible
|
||||
*
|
||||
* @since 2.6
|
||||
* @todo remove trigger_action()
|
||||
*
|
||||
* @param string $event
|
||||
* @param mixed $args,... optional arguments
|
||||
*/
|
||||
function trigger_notify($event)
|
||||
{
|
||||
$args = func_get_args();
|
||||
return call_user_func_array('trigger_action', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 2.6
|
||||
* @see trigger_notify
|
||||
*/
|
||||
function trigger_action($event)
|
||||
{
|
||||
global $pwg_event_handlers;
|
||||
|
||||
if (isset($pwg_event_handlers['trigger']) and $event!='trigger')
|
||||
{// debugging - avoid recursive calls
|
||||
trigger_action('trigger',
|
||||
trigger_notify('trigger',
|
||||
array('type'=>'action', 'event'=>$event, 'data'=>null)
|
||||
);
|
||||
}
|
||||
@@ -455,7 +433,7 @@ function load_plugins()
|
||||
{// include main from a function to avoid using same function context
|
||||
load_plugin($plugin);
|
||||
}
|
||||
trigger_action('plugins_loaded');
|
||||
trigger_notify('plugins_loaded');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ INSERT
|
||||
*/
|
||||
function update_rating_score($element_id = false)
|
||||
{
|
||||
if ( ($alt_result = trigger_event('update_rating_score', false, $element_id)) !== false)
|
||||
if ( ($alt_result = trigger_change('update_rating_score', false, $element_id)) !== false)
|
||||
{
|
||||
return $alt_result;
|
||||
}
|
||||
|
||||
@@ -928,7 +928,7 @@ function qsearch_get_images(QExpression $expr, QResults $qsr)
|
||||
break;
|
||||
default:
|
||||
// allow plugins to have their own scope with columns added in db by themselves
|
||||
$clauses = trigger_event('qsearch_get_images_sql_scopes', $clauses, $token, $expr);
|
||||
$clauses = trigger_change('qsearch_get_images_sql_scopes', $clauses, $token, $expr);
|
||||
break;
|
||||
}
|
||||
if (!empty($clauses))
|
||||
@@ -1019,7 +1019,7 @@ SELECT image_id FROM '.IMAGE_TAG_TABLE.'
|
||||
usort($all_tags, 'tag_alpha_compare');
|
||||
foreach ( $all_tags as &$tag )
|
||||
{
|
||||
$tag['name'] = trigger_event('render_tag_name', $tag['name'], $tag);
|
||||
$tag['name'] = trigger_change('render_tag_name', $tag['name'], $tag);
|
||||
}
|
||||
$qsr->all_tags = $all_tags;
|
||||
$qsr->tag_ids = $token_tag_ids;
|
||||
@@ -1151,7 +1151,7 @@ function get_quick_search_results_no_cache($q, $options)
|
||||
$scopes[] = new QDateRangeScope('posted', $postedDateAliases);
|
||||
|
||||
// allow plugins to add their own scopes
|
||||
$scopes = trigger_event('qsearch_get_scopes', $scopes);
|
||||
$scopes = trigger_change('qsearch_get_scopes', $scopes);
|
||||
$expression = new QExpression($q, $scopes);
|
||||
|
||||
// get inflections for terms
|
||||
@@ -1176,7 +1176,7 @@ function get_quick_search_results_no_cache($q, $options)
|
||||
}
|
||||
|
||||
|
||||
trigger_action('qsearch_expression_parsed', $expression);
|
||||
trigger_notify('qsearch_expression_parsed', $expression);
|
||||
//var_export($expression);
|
||||
|
||||
if (count($expression->stokens)==0)
|
||||
@@ -1188,7 +1188,7 @@ function get_quick_search_results_no_cache($q, $options)
|
||||
qsearch_get_images($expression, $qsr);
|
||||
|
||||
// allow plugins to evaluate their own scopes
|
||||
trigger_action('qsearch_before_eval', $expression, $qsr);
|
||||
trigger_notify('qsearch_before_eval', $expression, $qsr);
|
||||
|
||||
$ids = qsearch_eval($expression, $qsr, $tmp, $search_results['qs']['unmatched_terms']);
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ SELECT *
|
||||
if ( $counter )
|
||||
{
|
||||
$row['counter'] = $counter;
|
||||
$row['name'] = trigger_event('render_tag_name', $row['name'], $row);
|
||||
$row['name'] = trigger_change('render_tag_name', $row['name'], $row);
|
||||
$tags[] = $row;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ SELECT *
|
||||
$tags = array();
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
$row['name'] = trigger_event('render_tag_name', $row['name'], $row);
|
||||
$row['name'] = trigger_change('render_tag_name', $row['name'], $row);
|
||||
$tags[] = $row;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ SELECT t.*, count(*) AS counter
|
||||
$tags = array();
|
||||
while($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
$row['name'] = trigger_event('render_tag_name', $row['name'], $row);
|
||||
$row['name'] = trigger_change('render_tag_name', $row['name'], $row);
|
||||
$tags[] = $row;
|
||||
}
|
||||
usort($tags, 'tag_alpha_compare');
|
||||
|
||||
@@ -174,7 +174,7 @@ function register_user($login, $password, $mail_address, $notify_admin=true, &$e
|
||||
}
|
||||
}
|
||||
|
||||
$errors = trigger_event(
|
||||
$errors = trigger_change(
|
||||
'register_user_check',
|
||||
$errors,
|
||||
array(
|
||||
@@ -273,7 +273,7 @@ SELECT id
|
||||
);
|
||||
}
|
||||
|
||||
trigger_action(
|
||||
trigger_notify(
|
||||
'register_user',
|
||||
array(
|
||||
'id'=>$user_id,
|
||||
@@ -959,7 +959,7 @@ function log_user($user_id, $remember_me)
|
||||
$_SESSION['pwg_uid'] = (int)$user_id;
|
||||
|
||||
$user['id'] = $_SESSION['pwg_uid'];
|
||||
trigger_action('user_login', $user['id']);
|
||||
trigger_notify('user_login', $user['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -984,7 +984,7 @@ function auto_login()
|
||||
if ($key!==false and $key===$cookie[2])
|
||||
{
|
||||
log_user($cookie[0], true);
|
||||
trigger_action('login_success', stripslashes($username));
|
||||
trigger_notify('login_success', stripslashes($username));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1085,7 +1085,7 @@ function pwg_password_verify($password, $hash, $user_id=null)
|
||||
*/
|
||||
function try_log_user($username, $password, $remember_me)
|
||||
{
|
||||
return trigger_event('try_log_user', false, $username, $password, $remember_me);
|
||||
return trigger_change('try_log_user', false, $username, $password, $remember_me);
|
||||
}
|
||||
|
||||
add_event_handler('try_log_user', 'pwg_login', EVENT_HANDLER_PRIORITY_NEUTRAL, 4);
|
||||
@@ -1121,10 +1121,10 @@ SELECT '.$conf['user_fields']['id'].' AS id,
|
||||
if ($conf['password_verify']($password, $row['password'], $row['id']))
|
||||
{
|
||||
log_user($row['id'], $remember_me);
|
||||
trigger_action('login_success', stripslashes($username));
|
||||
trigger_notify('login_success', stripslashes($username));
|
||||
return true;
|
||||
}
|
||||
trigger_action('login_failure', stripslashes($username));
|
||||
trigger_notify('login_failure', stripslashes($username));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1135,7 +1135,7 @@ function logout_user()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
trigger_action('user_logout', @$_SESSION['pwg_uid']);
|
||||
trigger_notify('user_logout', @$_SESSION['pwg_uid']);
|
||||
|
||||
$_SESSION = array();
|
||||
session_unset();
|
||||
|
||||
@@ -97,7 +97,7 @@ SELECT
|
||||
);
|
||||
}
|
||||
|
||||
trigger_action('loc_end_no_photo_yet');
|
||||
trigger_notify('loc_end_no_photo_yet');
|
||||
|
||||
$template->pparse('no_photo_yet');
|
||||
exit();
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
$template->set_filenames(array('header'=>'header.tpl'));
|
||||
|
||||
trigger_action('loc_begin_page_header');
|
||||
trigger_notify('loc_begin_page_header');
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
@@ -35,7 +35,7 @@ $template->assign(
|
||||
$page['gallery_title'] : $conf['gallery_title'],
|
||||
|
||||
'PAGE_BANNER' =>
|
||||
trigger_event(
|
||||
trigger_change(
|
||||
'render_page_banner',
|
||||
str_replace(
|
||||
'%gallery_title%',
|
||||
@@ -96,10 +96,10 @@ if ( isset( $refresh ) and intval($refresh) >= 0
|
||||
));
|
||||
}
|
||||
|
||||
trigger_action('loc_end_page_header');
|
||||
trigger_notify('loc_end_page_header');
|
||||
|
||||
header('Content-Type: text/html; charset='.get_pwg_charset());
|
||||
$template->parse('header');
|
||||
|
||||
trigger_action('loc_after_page_header');
|
||||
trigger_notify('loc_after_page_header');
|
||||
?>
|
||||
@@ -22,7 +22,7 @@
|
||||
// +-----------------------------------------------------------------------+
|
||||
$template->set_filenames(array('tail'=>'footer.tpl'));
|
||||
|
||||
trigger_action('loc_begin_page_tail');
|
||||
trigger_notify('loc_begin_page_tail');
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
@@ -76,7 +76,7 @@ if ( !empty($conf['mobile_theme']) && (get_device() != 'desktop' || mobile_theme
|
||||
);
|
||||
}
|
||||
|
||||
trigger_action('loc_end_page_tail');
|
||||
trigger_notify('loc_end_page_tail');
|
||||
//
|
||||
// Generate the page
|
||||
//
|
||||
|
||||
@@ -73,7 +73,7 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
|
||||
}
|
||||
|
||||
// allow plugins to notify what's going on
|
||||
trigger_action( 'user_comment_insertion',
|
||||
trigger_notify( 'user_comment_insertion',
|
||||
array_merge($comm, array('action'=>$comment_action) )
|
||||
);
|
||||
}
|
||||
@@ -181,9 +181,9 @@ SELECT
|
||||
$tpl_comment =
|
||||
array(
|
||||
'ID' => $row['id'],
|
||||
'AUTHOR' => trigger_event('render_comment_author', $row['author']),
|
||||
'AUTHOR' => trigger_change('render_comment_author', $row['author']),
|
||||
'DATE' => format_date($row['date'], true),
|
||||
'CONTENT' => trigger_event('render_comment_content',$row['content']),
|
||||
'CONTENT' => trigger_change('render_comment_content',$row['content']),
|
||||
'WEBSITE_URL' => $row['website_url'],
|
||||
);
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ if ('categories' == $page['section'])
|
||||
$page = array_merge(
|
||||
$page,
|
||||
array(
|
||||
'comment' => trigger_event(
|
||||
'comment' => trigger_change(
|
||||
'render_category_description',
|
||||
$page['category']['comment'],
|
||||
'main_page_category_description'
|
||||
@@ -637,5 +637,5 @@ if ( 'categories'==$page['section'] and isset($page['category']) )
|
||||
unset( $need_redirect, $page['hit_by'] );
|
||||
}
|
||||
|
||||
trigger_action('loc_end_section_init');
|
||||
trigger_notify('loc_end_section_init');
|
||||
?>
|
||||
@@ -521,7 +521,7 @@ class Template
|
||||
if ($combi->version !== false)
|
||||
$href .= '?v' . ($combi->version ? $combi->version : PHPWG_VERSION);
|
||||
// trigger the event for eventual use of a cdn
|
||||
$href = trigger_event('combined_css', $href, $combi);
|
||||
$href = trigger_change('combined_css', $href, $combi);
|
||||
$content[] = '<link rel="stylesheet" type="text/css" href="'.$href.'">';
|
||||
}
|
||||
$this->output = str_replace(self::COMBINED_CSS_TAG,
|
||||
@@ -878,7 +878,7 @@ var s,after = document.getElementsByTagName(\'script\')[document.getElementsByTa
|
||||
}
|
||||
}
|
||||
// trigger the event for eventual use of a cdn
|
||||
$ret = trigger_event('combined_script', $ret, $script);
|
||||
$ret = trigger_change('combined_script', $ret, $script);
|
||||
return embellish_url($ret);
|
||||
}
|
||||
|
||||
@@ -1934,7 +1934,7 @@ final class FileCombiner
|
||||
global $template;
|
||||
$handle = $this->type. '.' .$combinable->id;
|
||||
$template->set_filename($handle, realpath(PHPWG_ROOT_PATH.$combinable->path));
|
||||
trigger_action( 'combinable_preparse', $template, $combinable, $this); //allow themes and plugins to set their own vars to template ...
|
||||
trigger_notify( 'combinable_preparse', $template, $combinable, $this); //allow themes and plugins to set their own vars to template ...
|
||||
$content = $template->parse($handle, true);
|
||||
|
||||
if ($this->is_css)
|
||||
@@ -1990,7 +1990,7 @@ final class FileCombiner
|
||||
require_once(PHPWG_ROOT_PATH.'include/cssmin.class.php');
|
||||
$css = CssMin::minify($css, array('Variables'=>false));
|
||||
}
|
||||
$css = trigger_event('combined_css_postfilter', $css);
|
||||
$css = trigger_change('combined_css_postfilter', $css);
|
||||
return $css;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,5 +72,5 @@ if ($conf['browser_language'] and (is_a_guest() or is_generic()) )
|
||||
{
|
||||
get_browser_language($user['language']);
|
||||
}
|
||||
trigger_action('user_init', $user);
|
||||
trigger_notify('user_init', $user);
|
||||
?>
|
||||
|
||||
@@ -291,7 +291,7 @@ Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseF
|
||||
array('methodName')
|
||||
);
|
||||
|
||||
trigger_action('ws_add_methods', array(&$this) );
|
||||
trigger_notify('ws_add_methods', array(&$this) );
|
||||
uksort( $this->_methods, 'strnatcmp' );
|
||||
$this->_requestHandler->handleRequest($this);
|
||||
}
|
||||
@@ -306,7 +306,7 @@ Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseF
|
||||
|
||||
@header('Content-Type: '.$contentType.'; charset='.get_pwg_charset());
|
||||
print_r($encodedResponse);
|
||||
trigger_action('sendResponse', $encodedResponse );
|
||||
trigger_notify('sendResponse', $encodedResponse );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -598,7 +598,7 @@ Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseF
|
||||
return new PwgError(WS_ERR_MISSING_PARAM, 'Missing parameters: '.implode(',',$missing_params));
|
||||
}
|
||||
|
||||
$result = trigger_event('ws_invoke_allowed', true, $methodName, $params);
|
||||
$result = trigger_change('ws_invoke_allowed', true, $methodName, $params);
|
||||
if ( strtolower( @get_class($result) )!='pwgerror')
|
||||
{
|
||||
if ( !empty($method['include']) )
|
||||
|
||||
@@ -264,7 +264,7 @@ SELECT
|
||||
else
|
||||
{
|
||||
$row['name'] = strip_tags(
|
||||
trigger_event(
|
||||
trigger_change(
|
||||
'render_category_name',
|
||||
$row['name'],
|
||||
'ws_categories_getList'
|
||||
@@ -273,7 +273,7 @@ SELECT
|
||||
}
|
||||
|
||||
$row['comment'] = strip_tags(
|
||||
trigger_event(
|
||||
trigger_change(
|
||||
'render_category_description',
|
||||
$row['comment'],
|
||||
'ws_categories_getList'
|
||||
@@ -501,7 +501,7 @@ SELECT id, name, comment, uppercats, global_rank, dir
|
||||
$row['nb_images'] = isset($nb_images_of[$id]) ? $nb_images_of[$id] : 0;
|
||||
|
||||
$row['name'] = strip_tags(
|
||||
trigger_event(
|
||||
trigger_change(
|
||||
'render_category_name',
|
||||
$row['name'],
|
||||
'ws_categories_getAdminList'
|
||||
@@ -514,7 +514,7 @@ SELECT id, name, comment, uppercats, global_rank, dir
|
||||
)
|
||||
);
|
||||
$row['comment'] = strip_tags(
|
||||
trigger_event(
|
||||
trigger_change(
|
||||
'render_category_description',
|
||||
$row['comment'],
|
||||
'ws_categories_getAdminList'
|
||||
@@ -787,7 +787,7 @@ SELECT id, name, dir
|
||||
if (!empty($row['dir']))
|
||||
{
|
||||
$row['name'] = strip_tags(
|
||||
trigger_event(
|
||||
trigger_change(
|
||||
'render_category_name',
|
||||
$row['name'],
|
||||
'ws_categories_move'
|
||||
|
||||
Reference in New Issue
Block a user