Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feature 3010 : replace trigger_action/event by trigger_notify/change
git-svn-id: http://piwigo.org/svn/trunk@28587 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Jun 2, 2014
1 parent f98edc7 commit 4bd3200
Show file tree
Hide file tree
Showing 62 changed files with 322 additions and 344 deletions.
2 changes: 1 addition & 1 deletion about.php
Expand Up @@ -37,7 +37,7 @@
$title= l10n('About Piwigo');
$page['body_id'] = 'theAboutPage';

trigger_action('loc_begin_about');
trigger_notify('loc_begin_about');

$template->set_filename('about', 'about.tpl');

Expand Down
8 changes: 4 additions & 4 deletions admin.php
Expand Up @@ -33,7 +33,7 @@
include_once(PHPWG_ROOT_PATH.'admin/include/functions_plugins.inc.php');
include_once(PHPWG_ROOT_PATH.'admin/include/add_core_tabs.inc.php');

trigger_action('loc_begin_admin');
trigger_notify('loc_begin_admin');

// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
Expand Down Expand Up @@ -244,7 +244,7 @@
// | Plugin menu |
// +-----------------------------------------------------------------------+

$plugin_menu_links = trigger_event('get_admin_plugin_menu_links', array() );
$plugin_menu_links = trigger_change('get_admin_plugin_menu_links', array() );

function UC_name_compare($a, $b)
{
Expand Down Expand Up @@ -284,7 +284,7 @@ function UC_name_compare($a, $b)
// | Include specific page |
// +-----------------------------------------------------------------------+

trigger_action('loc_begin_admin_page');
trigger_notify('loc_begin_admin_page');
include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');

$template->assign('ACTIVE_MENU', get_active_menu($page['page']));
Expand All @@ -298,7 +298,7 @@ function UC_name_compare($a, $b)

include(PHPWG_ROOT_PATH.'include/page_header.php');

trigger_action('loc_end_admin');
trigger_notify('loc_end_admin');

flush_page_messages();

Expand Down
6 changes: 3 additions & 3 deletions admin/album_notification.php
Expand Up @@ -83,19 +83,19 @@
pwg_mail_group(
$_POST['group'],
array(
'subject' => l10n('[%s] Visit album %s', $conf['gallery_title'], trigger_event('render_category_name', $category['name'], 'admin_cat_list')),
'subject' => l10n('[%s] Visit album %s', $conf['gallery_title'], trigger_change('render_category_name', $category['name'], 'admin_cat_list')),
// TODO : change this language variable to 'Visit album %s'
// TODO : 'language_selected' => ....
),
array(
'filename' => 'cat_group_info',
'assign' => array(
'IMG_URL' => $img_url,
'CAT_NAME' => trigger_event('render_category_name', $category['name'], 'admin_cat_list'),
'CAT_NAME' => trigger_change('render_category_name', $category['name'], 'admin_cat_list'),
'LINK' => make_index_url(array(
'category' => array(
'id' => $category['id'],
'name' => trigger_event('render_category_name', $category['name'], 'admin_cat_list'),
'name' => trigger_change('render_category_name', $category['name'], 'admin_cat_list'),
'permalink' => $category['permalink']
)
)),
Expand Down
2 changes: 1 addition & 1 deletion admin/batch_manager.php
Expand Up @@ -301,7 +301,7 @@
break;
}

$filter_sets = trigger_event('perform_batch_manager_prefilters', $filter_sets, $_SESSION['bulk_manager_filter']['prefilter']);
$filter_sets = trigger_change('perform_batch_manager_prefilters', $filter_sets, $_SESSION['bulk_manager_filter']['prefilter']);
}

if (isset($_SESSION['bulk_manager_filter']['category']))
Expand Down
8 changes: 4 additions & 4 deletions admin/batch_manager_global.php
Expand Up @@ -40,7 +40,7 @@

check_status(ACCESS_ADMINISTRATOR);

trigger_action('loc_begin_element_set_global');
trigger_notify('loc_begin_element_set_global');

check_input_parameter('del_tags', $_POST, true, PATTERN_ID);
check_input_parameter('associate', $_POST, false, PATTERN_ID);
Expand Down Expand Up @@ -404,7 +404,7 @@
}
}

trigger_action('element_set_global_action', $action, $collection);
trigger_notify('element_set_global_action', $action, $collection);
}

// +-----------------------------------------------------------------------+
Expand All @@ -429,7 +429,7 @@
$prefilters[] = array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album'));
}

$prefilters = trigger_event('get_batch_manager_prefilters', $prefilters);
$prefilters = trigger_change('get_batch_manager_prefilters', $prefilters);
usort($prefilters, 'UC_name_compare');

$template->assign(
Expand Down Expand Up @@ -674,7 +674,7 @@
'CACHE_KEYS' => get_admin_client_cache_keys(array('tags', 'categories')),
));

trigger_action('loc_end_element_set_global');
trigger_notify('loc_end_element_set_global');

//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'batch_manager_global');
Expand Down
4 changes: 2 additions & 2 deletions admin/batch_manager_unit.php
Expand Up @@ -39,7 +39,7 @@
// +-----------------------------------------------------------------------+
check_status(ACCESS_ADMINISTRATOR);

trigger_action('loc_begin_element_set_unit');
trigger_notify('loc_begin_element_set_unit');

// +-----------------------------------------------------------------------+
// | unit mode form submission |
Expand Down Expand Up @@ -254,7 +254,7 @@
));
}

trigger_action('loc_end_element_set_unit');
trigger_notify('loc_end_element_set_unit');

// +-----------------------------------------------------------------------+
// | sending html code |
Expand Down
6 changes: 3 additions & 3 deletions admin/cat_list.php
Expand Up @@ -33,7 +33,7 @@
// +-----------------------------------------------------------------------+
check_status(ACCESS_ADMINISTRATOR);

trigger_action('loc_begin_cat_list');
trigger_notify('loc_begin_cat_list');

if (!empty($_POST) or isset($_GET['delete']))
{
Expand Down Expand Up @@ -324,7 +324,7 @@ function save_categories_order($categories)
$tpl_cat =
array(
'NAME' =>
trigger_event(
trigger_change(
'render_category_name',
$category['name'],
'admin_cat_list'
Expand Down Expand Up @@ -363,7 +363,7 @@ function save_categories_order($categories)
$template->append('categories', $tpl_cat);
}

trigger_action('loc_end_cat_list');
trigger_notify('loc_end_cat_list');

// +-----------------------------------------------------------------------+
// | sending html code |
Expand Down
4 changes: 2 additions & 2 deletions admin/cat_modify.php
Expand Up @@ -103,7 +103,7 @@ function get_site_url($category_id)
// +-----------------------------------------------------------------------+
check_status(ACCESS_ADMINISTRATOR);

trigger_action('loc_begin_cat_modify');
trigger_notify('loc_begin_cat_modify');

//---------------------------------------------------------------- verification
if ( !isset( $_GET['cat_id'] ) || !is_numeric( $_GET['cat_id'] ) )
Expand Down Expand Up @@ -368,7 +368,7 @@ function get_site_url($category_id)
$template->assign('parent_category', empty($category['id_uppercat']) ? array() : array($category['id_uppercat']));
}

trigger_action('loc_end_cat_modify');
trigger_notify('loc_end_cat_modify');

//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'album_properties');
Expand Down
4 changes: 2 additions & 2 deletions admin/comments.php
Expand Up @@ -200,9 +200,9 @@
'U_PICTURE' => get_root_url().'admin.php?page=photo-'.$row['image_id'],
'ID' => $row['id'],
'TN_SRC' => $thumb,
'AUTHOR' => trigger_event('render_comment_author', $author_name),
'AUTHOR' => trigger_change('render_comment_author', $author_name),
'DATE' => format_date($row['date'], true),
'CONTENT' => trigger_event('render_comment_content',$row['content']),
'CONTENT' => trigger_change('render_comment_content',$row['content']),
'IS_PENDING' => ('false' == $row['validated']),
)
);
Expand Down
2 changes: 1 addition & 1 deletion admin/help.php
Expand Up @@ -46,7 +46,7 @@
$tabsheet->select($selected);
$tabsheet->assign();

trigger_action('loc_end_help');
trigger_notify('loc_end_help');

$template->set_filenames(array('help' => 'help.tpl'));

Expand Down
6 changes: 3 additions & 3 deletions admin/history.php
Expand Up @@ -216,7 +216,7 @@
}

/*TODO - no need to get a huge number of rows from db (should take only what needed for display + SQL_CALC_FOUND_ROWS*/
$data = trigger_event('get_history', array(), $page['search'], $types);
$data = trigger_change('get_history', array(), $page['search'], $types);
usort($data, 'history_compare');

$page['nb_lines'] = count($data);
Expand Down Expand Up @@ -316,7 +316,7 @@
$result = pwg_query($query);
while ($row=pwg_db_fetch_assoc($result))
{
$name_of_tag[ $row['id'] ] = '<a href="'.make_index_url( array('tags'=>array($row))).'">'.trigger_event("render_tag_name", $row['name'], $row).'</a>';
$name_of_tag[ $row['id'] ] = '<a href="'.make_index_url( array('tags'=>array($row))).'">'.trigger_change("render_tag_name", $row['name'], $row).'</a>';
}
}

Expand Down Expand Up @@ -408,7 +408,7 @@

if (isset($image_infos[$line['image_id']]['label']))
{
$image_title.= ' '.trigger_event('render_element_description', $image_infos[$line['image_id']]['label']);
$image_title.= ' '.trigger_change('render_element_description', $image_infos[$line['image_id']]['label']);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion admin/include/check_integrity.class.php
Expand Up @@ -66,7 +66,7 @@ function check()
$this->retrieve_list = array();
$this->build_ignore_list = array();

trigger_action('list_check_integrity', $this);
trigger_notify('list_check_integrity', $this);

// Information
if (count($this->retrieve_list) > 0)
Expand Down
18 changes: 9 additions & 9 deletions admin/include/functions.php
Expand Up @@ -162,7 +162,7 @@ function delete_categories($ids, $photo_deletion_mode='no_delete')
WHERE cat_id IN ('.implode(',',$ids).')';
pwg_query($query);

trigger_action('delete_categories', $ids);
trigger_notify('delete_categories', $ids);
}

/**
Expand Down Expand Up @@ -250,7 +250,7 @@ function delete_elements($ids, $physical_deletion=false)
{
return 0;
}
trigger_action('begin_delete_elements', $ids);
trigger_notify('begin_delete_elements', $ids);

if ($physical_deletion)
{
Expand Down Expand Up @@ -325,7 +325,7 @@ function delete_elements($ids, $physical_deletion=false)
update_category($category_ids);
}

trigger_action('delete_elements', $ids);
trigger_notify('delete_elements', $ids);
return count($ids);
}

Expand Down Expand Up @@ -383,7 +383,7 @@ function delete_user($user_id)
;';
pwg_query($query);

trigger_action('delete_user', $user_id);
trigger_notify('delete_user', $user_id);
}

/**
Expand Down Expand Up @@ -1573,7 +1573,7 @@ function tag_id_from_tag_name($tag_name)
;';
if (count($existing_tags = array_from_query($query, 'id')) == 0)
{
$url_name = trigger_event('render_tag_url', $tag_name);
$url_name = trigger_change('render_tag_url', $tag_name);
// search existing by url name
$query = '
SELECT id
Expand Down Expand Up @@ -1841,7 +1841,7 @@ function invalidate_user_cache($full = true)
SET need_update = \'true\';';
pwg_query($query);
}
trigger_action('invalidate_user_cache', $full);
trigger_notify('invalidate_user_cache', $full);
}

/**
Expand Down Expand Up @@ -1976,7 +1976,7 @@ function create_tag($tag_name)
TAGS_TABLE,
array(
'name' => $tag_name,
'url_name' => trigger_event('render_tag_url', $tag_name),
'url_name' => trigger_change('render_tag_url', $tag_name),
)
);

Expand Down Expand Up @@ -2326,7 +2326,7 @@ function get_taglist($query, $only_user_language=true)
while ($row = pwg_db_fetch_assoc($result))
{
$raw_name = $row['name'];
$name = trigger_event('render_tag_name', $raw_name, $row);
$name = trigger_change('render_tag_name', $raw_name, $row);

$taglist[] = array(
'name' => $name,
Expand All @@ -2335,7 +2335,7 @@ function get_taglist($query, $only_user_language=true)

if (!$only_user_language)
{
$alt_names = trigger_event('get_tag_alt_names', array(), $raw_name);
$alt_names = trigger_change('get_tag_alt_names', array(), $raw_name);

foreach( array_diff( array_unique($alt_names), array($name) ) as $alt)
{
Expand Down
2 changes: 1 addition & 1 deletion admin/include/functions_history.inc.php
Expand Up @@ -177,6 +177,6 @@ function get_history($data, $search, $types)
}

add_event_handler('get_history', 'get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
trigger_action('functions_history_included');
trigger_notify('functions_history_included');

?>
2 changes: 1 addition & 1 deletion admin/include/image.class.php
Expand Up @@ -64,7 +64,7 @@ function __construct($source_filepath, $library=null)
{
$this->source_filepath = $source_filepath;

trigger_action('load_image_library', array(&$this) );
trigger_notify('load_image_library', array(&$this) );

if (is_object($this->image))
{
Expand Down
2 changes: 1 addition & 1 deletion admin/include/tabsheet.class.php
Expand Up @@ -88,7 +88,7 @@ function delete($name)
*/
function select($name)
{
$this->sheets = trigger_event('tabsheet_before_select', $this->sheets, $this->uniqid);
$this->sheets = trigger_change('tabsheet_before_select', $this->sheets, $this->uniqid);
if (!array_key_exists($name, $this->sheets))
{
$keys = array_keys($this->sheets);
Expand Down
2 changes: 1 addition & 1 deletion admin/maintenance.php
Expand Up @@ -220,7 +220,7 @@
$advanced_features = array();

//$advanced_features is array of array composed of CAPTION & URL
$advanced_features = trigger_event(
$advanced_features = trigger_change(
'get_admin_advanced_features_links',
$advanced_features
);
Expand Down
6 changes: 3 additions & 3 deletions admin/notification_by_mail.php
Expand Up @@ -253,7 +253,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
}

$customize_mail_content =
trigger_event('nbm_render_global_customize_mail_content', $customize_mail_content);
trigger_change('nbm_render_global_customize_mail_content', $customize_mail_content);


// Prepare message after change language
Expand Down Expand Up @@ -340,7 +340,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
}

$nbm_user_customize_mail_content =
trigger_event('nbm_render_user_customize_mail_content',
trigger_change('nbm_render_user_customize_mail_content',
$customize_mail_content, $nbm_user);
if (!empty($nbm_user_customize_mail_content))
{
Expand Down Expand Up @@ -482,7 +482,7 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
// | Add event handler |
// +-----------------------------------------------------------------------+
add_event_handler('nbm_render_global_customize_mail_content', 'render_global_customize_mail_content');
trigger_action('nbm_event_handler_added');
trigger_notify('nbm_event_handler_added');


// +-----------------------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion admin/picture_modify.php
Expand Up @@ -415,7 +415,7 @@
'CACHE_KEYS' => get_admin_client_cache_keys(array('tags', 'categories')),
));

trigger_action('loc_end_picture_modify');
trigger_notify('loc_end_picture_modify');

//----------------------------------------------------------- sending html code

Expand Down
2 changes: 1 addition & 1 deletion admin/popuphelp.php
Expand Up @@ -55,7 +55,7 @@
$help_content = '';
}

$help_content = trigger_event(
$help_content = trigger_change(
'get_popup_help_content', $help_content, $_GET['page']);
}
else
Expand Down

0 comments on commit 4bd3200

Please sign in to comment.