예제 #1
0
/**
 * Очищает строку от тегов и обрезает до нужной длины
 * @param string $string Строка
 * @param int $max_length Максимальное кол-во символов, по умолчанию false
 * @return string
 */
function html_clean($string, $max_length = false)
{
    $string = strip_tags($string);
    if (is_int($max_length)) {
        $string = html_strip($string, $max_length);
    }
    return $string;
}
예제 #2
0
/**
 * Очищает строку от тегов и обрезает до нужной длины
 * @param string $string Строка
 * @param int $max_length Максимальное кол-во символов, по умолчанию false
 * @return string
 */
function html_clean($string, $max_length = false)
{
    // строка может быть без переносов
    // и после strip_tags не будет пробелов между словами
    $string = str_replace(array("\n", "\r", '<br>', '<br/>'), ' ', $string);
    $string = strip_tags($string);
    if (is_int($max_length)) {
        $string = html_strip($string, $max_length);
    }
    return $string;
}
예제 #3
0
<ul class="links adb_list">
    <?php 
foreach ($items as $item) {
    ?>
        <li>
            <a href="<?php 
    echo href_to($item['target_url']) . "#comment_{$item['id']}";
    ?>
"><?php 
    echo html_strip($item['target_title'], 50);
    ?>
</a>
            <div><?php 
    echo html_clean($item['content_html'], 100);
    ?>
</div>
            <div class="date"><?php 
    echo string_date_age_max($item['date_pub'], true);
    ?>
</div>
        </li>
    <?php 
}
?>
</ul>
<?php 
if ($show_count < $total) {
    ?>
<a class="view_all_link" href="<?php 
    echo href_to('admin', 'controllers', array('edit', 'comments', 'comments_list'));
    ?>
예제 #4
0
function problem_display($row)
{
    global $cache;
    $cache_id = problem_cache_id($row['contest_id'], $row['prob_id']) . '.htm';
    if ($data = $cache->get($cache_id)) {
        echo $data;
    } else {
        $prob =& problem_load($row);
        $data = "<script type=\"text/javascript\">var problemVersion = {$row['version']};</script>";
        // Display heading
        $data .= '<div id="problem_title">';
        $data .= 'Problem: <b>' . $row['prob_id'] . '</b>';
        $data .= '</div>';
        $data .= '<div id="problem">';
        $data .= '<div id="problem_header">';
        $data .= '<b>Summary:</b> ' . $row['summary'];
        $data .= '<br /><b>Weight:</b> ' . $row['weight'];
        $data .= '<br /><b>Time limit:</b> ' . $row['time_limit'] . ' second(s)';
        $data .= '<br /><b>Memory limit:</b> ' . $row['mem_limit'] . ' MB';
        $data .= '<br /><b>Test cases:</b> ' . count($prob->tests);
        $data .= '</div>';
        // Display problem description (body)
        $data .= "<div id=\"problem_body\">\n";
        $data .= "<b>Description:</b><br /><div id=\"problem_body_text\">\n";
        $data .= $prob->body;
        $data .= "</div></div>\n";
        // Display the formatting constraints
        $data .= "<div id=\"problem_constraints\">\n";
        $data .= "<b>Formatting/Constraints:</b>\n";
        $data .= "<ul>\n";
        foreach ($prob->constraints as $type => $points) {
            $data .= '<li><i>' . ucfirst(strtolower($type)) . ":</i>\n<ol>\n";
            foreach ($points as $point) {
                $data .= "<li>{$point}</li>\n";
            }
            $data .= "</ol>\n</li>\n";
        }
        $data .= "</ul>\n</div>\n";
        // Display the examples
        $data .= '<div id="problem_examples">';
        $data .= "<b>Examples:</b>\n";
        $data .= "<ol>\n";
        foreach ($prob->examples as $id => $text) {
            $data .= "<li>\n";
            $data .= "<b>Input:</b> <pre>";
            $data .= html_strip($prob->tests[$id]->getInput());
            $data .= "</pre>\n";
            $data .= "<b>Output:</b> <pre>";
            $data .= html_strip($prob->tests[$id]->getOutput());
            $data .= "</pre>\n";
            $data .= "<b>Analysis:</b> <div class=\"analysis\">\n";
            $data .= $text;
            $data .= "</div>\n";
            $data .= "</li>\n";
        }
        if (count($prob->examples) == 0) {
            $data .= "None.\n";
        }
        $data .= "</ol></div>\n";
        $data .= "</div>\n";
        $cache->save($data, $cache_id);
        echo $data;
    }
}
예제 #5
0
<ul class="links adb_list">
    <?php 
foreach ($items as $item) {
    ?>
        <li>
            <a href="<?php 
    echo $item['url'];
    ?>
"><?php 
    echo html_strip($item['title'], 50);
    ?>
</a>
            <div><?php 
    echo $item['ctype_title'];
    ?>
</div>
            <div class="date"><?php 
    echo string_date_age_max($item['date_pub'], true);
    ?>
</div>
        </li>
    <?php 
}
?>
</ul>
<?php 
if ($show_count < $total) {
    ?>
    <a class="view_all_link" href="<?php 
    echo href_to('moderation');
    ?>