<?php echo do_hash('html5');?>


    <title><?php echo $title ?></title>
    <?php echo link_tag('resources/style.css');?>

</head>
<body>
<div id="conteiner">
    <h2><?php echo $page_header ?></h2>
    <div id="body">
        <?php
        echo heading('word_limiter()',3);
        $string="this is string with lotsa words in it";
        echo $string=word_limiter($string,4);


        echo heading('character_limiter()',3);
        $string2="here is some nice text string considering of eleven words ";
        echo $string2=character_limiter($string2,20);

        echo heading('word_censor()',3);
        $disallowed=array('darn','shucks','golly','phooey');
        $string3='Gooly! kids these days have no darn respect for their elders.';
        echo word_censor($string3,$disallowed,'****');


        echo heading('highlight_phrase()',3);
        $string4="here is some nice text about nothing in particular.";

        echo highlight_phrase($string4,"nice text",'<span style="color=#990000">','</span>');
        echo heading('word_wrap(),3');
        $string5="here is simple string of text that will help us demonstrate this function.";
        echo word_wrap($string5,25);

        echo heading('ellipsize()',3);
        $string6='this string is way too long and we have to do something about it.';
        echo ellipsize($string6,29,1);

        echo heading('word_censor()',3);
        $disallowed=array('darn','shucks','golly','phooey');
        $string3='Gooly! kids these days have no darn respect for their elders.';
        echo word_censor($string3,$disallowed,'****');


        echo br();

        echo heading('star_censor()',3);
        $disallowed=array('damnit','darn','gooly','wonderful');
        $string7='Damnit! kids these days have no darn respect for their wonderful elders';
        echo star_censor($string7,$disallowed);








<?php
function star_censor($str,$censored)
{

    if (!is_array($censored)) {

        return $str;
    }

    foreach ($censored as $badword) {
        $star='';
        $badword_length = strlen($badword);
        for ($i = 0; $i < $badword_length ; $i++) {
            $star=$star.'*';
        }
        $str = str_ireplace($badword, $stars, $str);


    }
    return trim($str);
}





        ?>


    </div>

</div>

</body>

</html>