コード例 #1
0
function om_medals_generate_medal_tag($id, $expire = null)
{
    global $forum_om_medals, $lang_om_medals, $forum_url, $forum_config;
    // load medals cache, generate if not exists
    om_medals_load_medals_cache();
    ($hook = get_hook('om_medals_fn_generate_medal_tag_start')) ? eval($hook) : null;
    // if medal has no image, then don't output it
    if (!isset($forum_om_medals[$id])) {
        return null;
    }
    // Medal title
    $medal_title = forum_htmlencode($forum_om_medals[$id]['name']);
    $expire_date = is_array($expire) && isset($expire[$id]) ? date('Y-m-d', $expire[$id]) : '';
    if ($expire_date) {
        $medal_title = forum_htmlencode(sprintf($lang_om_medals['Medal title'], $forum_om_medals[$id]['name'], $expire_date));
    }
    $tag = '<img src="' . OM_MEDALS_EXT_URL . $forum_om_medals[$id]['path'] . '" alt="' . forum_htmlencode($forum_om_medals[$id]['name']) . '" ' . 'width="' . $forum_om_medals[$id]['width'] . '" height="' . $forum_om_medals[$id]['height'] . '"/>';
    // link page to help, if we are not currently in help
    if (!defined('FORUM_PAGE') || FORUM_PAGE != 'help') {
        $tag = '<a class="exthelp" href="' . forum_link($forum_url['help'], 'om_medals') . '#m' . $id . '" title="' . $medal_title . '">' . $tag . '</a>';
    }
    ($hook = get_hook('om_medals_fn_generate_medal_tag_output')) ? eval($hook) : null;
    return $tag;
}
コード例 #2
0
ファイル: profile.php プロジェクト: keeshii/punbb-extensions
    // Setup breadcrumbs
    $forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), array(sprintf($lang_profile['Users profile'], $user['username']), forum_link($forum_url['user'], $id)), sprintf($lang_om_medals['Section medals']));
    // Setup form
    $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
    $forum_page['form_action'] = forum_link($forum_url['om_medals_profile_assign'], $id);
    $forum_page['hidden_fields'] = array('csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />');
    ($hook = get_hook('om_medals_profile_header_load')) ? eval($hook) : null;
    define('FORUM_PAGE', 'profile-om_medals');
    require FORUM_ROOT . 'header.php';
    // START SUBST - <!-- forum_main -->
    ob_start();
    if (!defined('OM_MEDALS_FUNCTIONS_LOADED')) {
        require $ext_info['path'] . '/functions.php';
    }
    // Display all the medals
    om_medals_load_medals_cache();
    ($hook = get_hook('om_medals_profile_output_start')) ? eval($hook) : null;
    ?>
	<div class="main-subhead">
		<h2 class="hn"><span><?php 
    echo $lang_om_medals['Medals assignment'];
    ?>
</span></h2>
	</div>
	<div class="main-content main-frm">
<?php 
    if (empty($forum_om_medals)) {
        ?>
		<div class="mf-box"><span><?php 
        echo $lang_om_medals['No medals definied'];
        ?>