Location: PHPKode > projects > YW-GuestBook > YW Guestbook 1.45/YW Guestbook/ywgb/libs/string.php
<?php
  //-------------------------------------------------------------------------
  //                             YW Guestbook
  //                                string.php
  //
  //                              Version: 1.2
  //-------------------------------------------------------------------------
  //                     Copyright (c) 2005  YahooWebs
  //                        http://www.yahoowebs.tk
  //-------------------------------------------------------------------------
  //  This program is free software. You can redistribute it and/or modify
  //  it under the terms of the License that was distributed with this file!
  //-------------------------------------------------------------------------

  function vgb_maxlen () {
    return 127;
  }

  function vgb_lenfactor () {
    return 1;
  }
  
  function vgb_strlen ( $s ) {
    return strlen($s);
  }

  function vgb_string ( $t ) {
    return $t;
  }

  function vgb_wrapWords ( $t ) {
    global $settings;

    $maxcount = $settings['FORCEBREAK'];
    if (($maxcount == 0) || ($t == ""))
      return $t;

    $t = str_replace("&gt;",">>>>",str_replace("&lt;",">>><",$t));
    $o = "";
    $inTag = false;
    $count = 0;
    $tlen = strlen($t);
    $skip = 0;

    for ($i=0;$i<$tlen;$i++)
      if ($skip > 1)
        $skip--;
      elseif ($inTag) {
        if ($t[$i] == '>') {
          $inTag = false;
          $tag = explode(" ",$buffer,2);
          switch ($tag[0]) {
            case "li":
            case "pre":
            case "/pre":
            case "div":
            case "/div":
            case "ul":
            case "/ul": $count = 0;
          }
        }
        else
          $buffer .= $t[$i];
        $o .= $t[$i];
      }
      elseif ($t[$i] == '>' && ($skip == 0))
        $skip = 3;
      elseif (($t[$i] == '<') && ($skip == 0)) {
        $o .= '<';
        $buffer = "";
        $inTag = true;
      }
      else {
        if (vgb_isWhiteSpace($t[$i])) {
          $count = 0;
          $o .= $t[$i];
        }
        else {
          $count++;
          if ($count > $maxcount) {
            $count = 1;
            $o .= ($settings['USEWBR']) ? "<wbr />" : " ";
          }
          if ($skip > 0) {
            if ($t[$i] == '>')
              $o .= "&gt;";
            else
              $o .= "&lt;";
            $skip = 0;
          }
          else
            $o .= $t[$i];
        }
      }
      return $o;
  }

  function vgb_substr ( $t , $n ) {
    return substr($t,0,$n);
  }

  function vgb_nextchar( $in ) {
    
    return $in[0];
  }
  
  function vgb_ord ( $c ) {
    global $charmap;
    
    if (ord($c) < 128)
      return ord($c);
    if (isset($charmap)) 
      return $charmap[ord($c)-128];
    else
      return ord($c);
  }
  
?>
Return current item: YW-GuestBook