Example #1
0
function break_long_words($input, $with_tags)
{
    // new routine, deals with html tags...
    if (defined('LNG_MAX')) {
        $lng_max = LNG_MAX;
    } else {
        $lng_max = 100;
    }
    //echo $lng_max;
    $input = stripslashes($input);
    while ($trun_str = truncate_html_str($input, $lng_max, $trunc_str_len, false, $with_tags)) {
        //echo "trun_str:".htmlentities($trun_str)."<br>";
        if ($trunc_str_len == $lng_max) {
            // string was truncated
            //echo "truncate!";
            if (strrpos($trun_str, " ") !== false) {
                // if trun_str has a space?
                $new_str .= $trun_str;
                //echo " has space![".htmlentities($trun_str)."]<br>";
            } else {
                $new_str .= $trun_str . " ";
                //echo " no space[".htmlentities($trun_str)."]<br>";
            }
        } else {
            $new_str .= $trun_str;
        }
        $input = substr($input, strlen($trun_str));
    }
    $new_str = addslashes($new_str);
    return $new_str;
}
Example #2
0
function display_sub_cats_compact(&$cats, $index)
{
    global $label;
    $children = $cats[$index]['category_children'];
    $space = "";
    echo "<div class='cat_subcategory'>";
    for ($x = 0; $x < $cats[$index]['category_child_cnt']; $x++) {
        //echo CAT_NAME_CUTOFF;
        if (CAT_NAME_CUTOFF == "YES") {
            //if (strlen($children[$x]['category_name']) > CAT_NAME_CUTOFF_CHARS) {
            $children[$x]['category_name'] = truncate_html_str($children[$x]['category_name'], CAT_NAME_CUTOFF_CHARS, $trunc_str_len);
            //}
            //echo "river";
        }
        echo $space . "<a href='" . cat_url_write($children[$x]['category_id'], $children[$x]['category_name']) . "'>" . $children[$x]['category_name'] . "</a>";
        if (CAT_SHOW_OBJ_COUNT == 'YES') {
            echo "<small>(" . $children[$x]['category_obj_cnt'] . ")</small>";
        }
        $space = " &nbsp; ";
        if ($x >= SHOW_SUBCATS) {
            echo " &nbsp; [<a href='" . cat_url_write($cats[$index]['category_id'], $cats[$index]['category_name']) . "'><b>" . $label["category_expand_more"] . "</b></a>] ";
            break;
        }
    }
    echo "</div>";
}
Example #3
0
function echo_ad_list_data($admin)
{
    global $column_list, $column_info, $label, $cur_offset, $order_str, $q_offset, $show_emp, $cat, $list_mode;
    if ($_REQUEST['order_by'] != '') {
        $ord = $_REQUEST['ord'];
        if ($ord == 'asc') {
            $ord = 'desc';
        } elseif ($ord == 'desc') {
            $ord = 'asc';
        } else {
            $ord = 'desc';
        }
        $order_str = "&order_by=" . $_REQUEST['order_by'] . "&ord=" . $ord;
    }
    foreach ($column_list as $template_tag) {
        $val = get_template_value($template_tag, 1, $admin);
        //$val = $val.$template_tag;
        if ($column_info[$template_tag]['admin'] == 'Y' && !$admin) {
            continue;
            // do not render this column
        }
        if ($column_info[$template_tag]['trunc'] > 0) {
            $val = truncate_html_str($val, $column_info[$template_tag]['trunc'], $trunc_str_len);
        }
        // process the value depending on what kind of template tag it was given.
        if ($template_tag == 'DATE') {
            $init_date = strtotime(trim_date($val) . " GMT");
            // the last date modified
            $dst_date = strtotime(trim_date(gmdate("r")) . " GMT");
            // now
            if (!$init_date) {
                $days = "x";
            } else {
                $diff = $dst_date - $init_date;
                $days = floor($diff / 60 / 60 / 24);
            }
            //echo $days;
            $FORMATTED_DATE = get_formatted_date(get_local_time($val));
            $val = $FORMATTED_DATE . "<br>";
            if ($days == 0) {
                $val = $val . '<span class="today"><b>' . $label["ads_list_today"] . '</span>';
            } elseif ($days > 0 && $days < 2) {
                $val = $val . '<span class="days_ago">' . $days . " " . $label["ads_list_day_ago"] . "</span>";
            } elseif ($days > 1 && $days < 8) {
                $val = $val . '<span class="days_ago">' . $days . " " . $label["ads_list_days_ago"] . "</span>";
            } elseif ($days >= 8) {
                $val = $val . '<span class="days_ago2">' . $days . " " . $label["ads_list_days_ago"] . "</span>";
            }
        }
        if ($column_info[$template_tag]['is_bold'] == 'Y') {
            $b1 = "<b>";
            $b2 = "</b>";
        } else {
            $b1 = '';
            $b2 = '';
        }
        if ($column_info[$template_tag]['clean'] == 'Y') {
            // fix up punctuation spacing
            $val = preg_replace('/ *(,|\\.|\\?|!|\\/|\\\\) */i', '$1 ', $val);
        }
        if ($column_info[$template_tag]['link'] == 'Y') {
            // Render as a Link to the record?
            $AD_ID = get_template_value('AD_ID', 1, $admin);
            $val = '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?ad_id=' . $AD_ID . '&offset=' . $cur_offset . $order_str . $q_string . '"';
            /// IMAGE PREVIEW MOUSEOVER Code
            // Note: to have this feature working, you must have a template tag called 'IMAGE' defined in the resume form
            define('PREVIEW_AD', 'YES');
            if (PREVIEW_AD == 'YES') {
                $ALT_TEXT = get_template_value('ALT_TEXT', 1, $admin);
                //$AD_ID = get_template_value ('AD_ID', 1, $admin);
                $js_str = " onmousemove=\"sB(event,'" . htmlspecialchars(str_replace("'", "\\'", $ALT_TEXT)) . "',this, " . $AD_ID . ")\" onmouseout=\"hI()\" ";
                $val = $val . $js_str;
            }
            $val = $val . '>' . get_template_value($template_tag, 1, $admin) . "</a>";
        }
        ?>
		<td class="list_data_cell" <?php 
        if ($column_info[$template_tag]['no_wrap'] == 'Y') {
            echo ' nowrap ';
        }
        ?>
>
			<?php 
        echo $b1 . $val . $b2;
        ?>
		</td>

		<?php 
    }
}