当前位置: 首页>>代码示例>>PHP>>正文


PHP game::music_replace方法代码示例

本文整理汇总了PHP中game::music_replace方法的典型用法代码示例。如果您正苦于以下问题:PHP game::music_replace方法的具体用法?PHP game::music_replace怎么用?PHP game::music_replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在game的用法示例。


在下文中一共展示了game::music_replace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: format_data

    public static function format_data($data, $type = "bb", $args = null)
    {
        global $_base;
        switch ($type) {
            case "bb":
            case "signature":
                // bb kode
                return game::bb_to_html($data);
                // bb-kode eller egendefinert tekst hvis bb-kode er tom
            // bb-kode eller egendefinert tekst hvis bb-kode er tom
            case "bb-opt":
                $bb = trim(game::bb_to_html($data));
                if ($bb == "") {
                    return $args;
                }
                return $bb;
            case "music_pre":
                return preg_replace('~\\[music\\](https?://.+?)\\[/music\\]~ieu', 'game::music_add(\'$1\')', $data);
            case "music_post":
                return game::music_replace($data);
            case "profile":
                $data = game::format_data($data, "music_pre");
                // sett opp ranken
                $rank = game::rank_info($args->data['up_points'], $args->data['upr_rank_pos'], $args->data['up_access_level']);
                // diverse bb koder
                $data = str_replace(array("[counter]", "[visits]", "[visitor]", "[rank]", "[bank]", "[cash]", "[money]", "[renter]", "[pm_ulest]", "[pengerank]"), array('<img src="&rpath;/counter?count=' . $args->data['up_profile_hits'] . '" alt="Antall visninger: ' . $args->data['up_profile_hits'] . '" />', $args->data['up_profile_hits'], game::profile_link(), $rank['orig'] ? $rank['orig'] : $rank['name'], game::format_cash($args->data['up_bank']), game::format_cash($args->data['up_cash']), game::format_cash($args->data['up_cash'] + $args->data['up_bank']), game::format_cash($args->data['up_interest_last']), game::format_number($args->user->data['u_inbox_new']), game::cash_name($args->data['up_cash'] + $args->data['up_bank'])), game::bb_to_html($data));
                // rankbar
                $type = false;
                $match_rank = preg_match("~\\[rank_(neste_tid|neste_dato|tid|dato)\\]~iu", $data);
                if (preg_match("~\\[rankbar( type=(1|2))?\\]~iu", $data, $type) || $match_rank) {
                    // høyeste rank?
                    if ($rank['need_points'] == 0) {
                        global $_game;
                        $prosent = $args->data['up_points'] / game::$ranks['items_number'][count(game::$ranks['items_number'])]['points'] * 100;
                        $rankbar_total = '
<div class="progressbar">
	<div class="progress"><p>' . game::format_num($prosent, 3) . ' %</p></div>
</div>';
                        $rankbar_total2 = '
<div class="progressbar" style="margin-top: 1em">
	<div class="progress"><p>' . game::format_num($prosent, 3) . ' %</p></div>
</div>';
                        $data = str_replace(array("[rankbar]", "[rankbar type=1]", "[rankbar type=2]", "[rank_tid]", "[rank_dato]", "[rank_neste_tid]", "[rank_neste_dato]"), array($rankbar_total . $rankbar_total2, $rankbar_total, $rankbar_total, "Oppnådd", "Oppnådd", "Oppnådd", "Oppnådd"), $data);
                    } else {
                        // i forhold til den høyeste ranken
                        global $_game;
                        // antall poeng for den høyeste ranken
                        $points_max = game::$ranks['items'];
                        end($points_max);
                        $points_max = current($points_max);
                        $points_max = $points_max['points'];
                        // hvor langt ifra er vi?
                        $percent_total = round($args->data['up_points'] / $points_max, 2) * 100;
                        #if ($percent_total > 100) $percent_total = 100;
                        if ($percent_total == 0) {
                            $percent_total = 0.01;
                        }
                        $rankbar_total = '
<div class="progressbar">
	<div class="progress" style="width: ' . floor($percent_total) . '%"><p>' . game::format_num($percent_total, 2) . ' % i forhold til høyeste rank.</p></div>
</div>';
                        // i forhold til neste rank
                        $points_rank = $args->data['up_points'] - $rank['points'];
                        $percent = round($points_rank / $rank['need_points'] * 100, 2);
                        #if ($percent  )
                        $rankbar_next = '
<div class="progressbar">
	<div class="progress" style="width: ' . floor($percent) . '%"><p>' . game::format_num($percent, 2) . ' % i forhold til neste rank</p></div>
</div>';
                        $rankbar_next2 = '
<div class="progressbar" style="margin-top: 1em">
	<div class="progress" style="width: ' . floor($percent) . '%"><p>' . game::format_num($percent, 2) . ' % i forhold til neste rank</p></div>
</div>';
                        // fiks bb kodene
                        $data = str_replace(array("[rankbar]", "[rankbar type=1]", "[rankbar type=2]"), array($rankbar_total . $rankbar_next2, $rankbar_total, $rankbar_next), $data);
                        // beregn antatt tid det tar å nå høyeste rank
                        if ($match_rank) {
                            // hent ut aktiviteten de siste X dagene
                            $expire = ess::$b->date->get();
                            $expire->modify("-21 days");
                            $expire = max($args->data['up_created_time'], $expire->format("U"));
                            // maks tid: siste 21 dager eller siden reg (om registrert innen 30 dager)
                            $result = \Kofradia\DB::get()->query("SELECT SUM(uhi_points) FROM users_hits WHERE uhi_up_id = {$args->id} AND uhi_secs_hour >= {$expire}");
                            $points = (int) $result->fetchColumn(0);
                            if ($points == 0) {
                                $data = str_replace(array("[rank_tid]", "[rank_dato]", "[rank_neste_tid]", "[rank_neste_dato]"), array("ukjent", "ukjent", "ukjent", "ukjent"), $data);
                            } else {
                                // antall sekunder poengene skal fordeles på
                                $time_elapsed = time() - $expire;
                                // beregn til neste rank og erstatt BB-kode
                                $need = $rank['points'] + $rank['need_points'] - $args->data['up_points'];
                                $time_left = $need / $points * $time_elapsed;
                                if ($time_left > 63072000) {
                                    $text_left = "over 2 år";
                                    $text_date = "om over 2 år";
                                } else {
                                    $text_left = game::timespan($time_left);
                                    $text_date = ess::$b->date->get($time_left + time())->format(date::FORMAT_NOTIME);
                                }
                                $data = str_replace(array("[rank_neste_tid]", "[rank_neste_dato]"), array($text_left, $text_date), $data);
//.........这里部分代码省略.........
开发者ID:Kuzat,项目名称:kofradia,代码行数:101,代码来源:class.game.php


注:本文中的game::music_replace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。