l10n('Crop'), 'url' => CROPIMAGE_ADMIN.'-'.$image_id, ); } return $sheets; } function cropImage_init() { global $conf, $pwg_loaded_plugins; if (!defined('PWG_HELP') and !defined('IN_ADMIN') and is_admin()) { // Add an event handler for a prefilter on picture.php pages add_event_handler('loc_begin_picture', 'cropImage_set_prefilter_add_to_pic_info', 55 ); } } //////////////////////////////////////////////////////////////////////////////// // Add the prefilter for the Crop Link on the template on picture.php //////////////////////////////////////////////////////////////////////////////// function cropImage_set_prefilter_add_to_pic_info() { global $template, $conf, $user, $page, $lang; load_language('plugin.lang', dirname(__FILE__).'/'); $url_admin = CROPIMAGE_ADMIN.'-'.$page['image_id'] .(isset($page['category']) ? '&cat_id='.$page['category']['id'] : '') ; $template->set_prefilter('picture', 'cropImage_add_button'); $template->func_combine_css(array('path' => CROPIMAGE_PATH.'/css/cropimage_toolbar_buttons.css')); //Get the Theme to display the correct icon style if ( in_array($user['theme'], array('Sylvia','sylvia')) ) { $ButtonTheme = "sylvia"; } elseif ( in_array($user['theme'], array('elegant')) ) { $ButtonTheme = "elegant"; } elseif ( in_array($user['theme'], array('clear')) ) { $ButtonTheme = "clear"; } elseif ( in_array($user['theme'], array('dark')) ) { $ButtonTheme = "dark"; } else { $ButtonTheme = "clear"; } $template->assign( array( 'U_CROPIMAGE' => $url_admin, 'U_CROPIMAGE_THEME' => $ButtonTheme, ) ); } //////////////////////////////////////////////////////////////////////////////// // Insert the template for the Crop Link on picture.php //////////////////////////////////////////////////////////////////////////////// function cropImage_add_button($content) { // Add the information after imageInfoTable so before everything else like author and date. $search = '{strip}{if isset($U_CADDIE)}{*caddie management BEGIN*}'; $replacement = ' {\'Crop Photo\'|@translate} ' . $search; return str_replace($search, $replacement, $content); } ?>