set_prefilter('picture', 'dlsize_picture_prefilter'); $params = array( 'id' => $picture['current']['id'], 'part' => 'e', 'download' => null, ); $base_dl_url = add_url_params(get_root_url().PHPWG_PLUGINS_PATH.'download_by_size/action.php', $params); $template->assign( array( 'DLSIZE_URL' => $base_dl_url.'&size=', ) ); if ($conf['picture_download_icon']) { // even if original can't be downloaded, we set U_DOWNLOAD so that // visitor can download smaller sizes $template->append('current', array('U_DOWNLOAD' => '#'), true); if (!empty($picture['current']['download_url'])) { $template->assign('DLSIZE_ORIGINAL', $picture['current']['download_url']); } } $template->set_filename('dlsize_picture', realpath(DLSIZE_PATH.'picture.tpl')); $template->parse('dlsize_picture'); } function dlsize_picture_prefilter($content, &$smarty) { $pattern = '#\{if isset\(\$current\.U_DOWNLOAD\)\}\s*