[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/ -> wp-formatting.php (source)

   1  <?php
   2  /** Formatting
   3  
   4  Taken from bbPress, taken from WordPress
   5  
   6  */
   7  
   8  if ( !function_exists( 'clean_pre' ) ) : // Current at [WP9840]
   9  /**
  10   * Accepts matches array from preg_replace_callback in wpautop() or a string.
  11   *
  12   * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not
  13   * converted into paragraphs or line-breaks.
  14   *
  15   * @since WP 1.2.0
  16   *
  17   * @param array|string $matches The array or string
  18   * @return string The pre block without paragraph/line-break conversion.
  19   */
  20  function clean_pre($matches) {
  21      if ( is_array($matches) )
  22          $text = $matches[1] . $matches[2] . "</pre>";
  23      else
  24          $text = $matches;
  25  
  26      $text = str_replace('<br />', '', $text);
  27      $text = str_replace('<p>', "\n", $text);
  28      $text = str_replace('</p>', '', $text);
  29  
  30      return $text;
  31  }
  32  endif;
  33  
  34  if ( !function_exists( 'js_escape' ) ) : // Current at [WP9840]
  35  /**
  36   * Escape single quotes, specialchar double quotes, and fix line endings.
  37   *
  38   * The filter 'js_escape' is also applied here.
  39   *
  40   * @since WP 2.0.4
  41   *
  42   * @param string $text The text to be escaped.
  43   * @return string Escaped text.
  44   */
  45  function js_escape($text) {
  46      $safe_text = wp_check_invalid_utf8( $text );
  47      $safe_text = wp_specialchars( $safe_text, ENT_COMPAT );
  48      $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
  49      $safe_text = preg_replace( "/\r?\n/", "\\n", addslashes( $safe_text ) );
  50      return apply_filters( 'js_escape', $safe_text, $text );
  51  }
  52  endif;
  53  
  54  if ( !function_exists( 'attribute_escape' ) ) : // Not like WordPress - uses wp_check_invalid_utf8() and wp_entities()
  55  /**
  56   * Escaping for HTML attributes.
  57   *
  58   * @since WP 2.0.6
  59   *
  60   * @param string $text
  61   * @return string
  62   */
  63  function attribute_escape( $text ) {
  64      $safe_text = wp_check_invalid_utf8( $text );
  65      $safe_text = wp_specialchars( $safe_text, ENT_QUOTES );
  66      return apply_filters( 'attribute_escape', $safe_text, $text );
  67  }
  68  endif;
  69  
  70  if ( !function_exists( 'build_query' ) ) : // Current at [WP9840]
  71  /**
  72   * Build URL query based on an associative and, or indexed array.
  73   *
  74   * This is a convenient function for easily building url queries. It sets the
  75   * separator to '&' and uses _http_build_query() function.
  76   *
  77   * @see _http_build_query() Used to build the query
  78   * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
  79   *        http_build_query() does.
  80   *
  81   * @since WP 2.3.0
  82   *
  83   * @param array $data URL-encode key/value pairs.
  84   * @return string URL encoded string
  85   */
  86  function build_query( $data ) {
  87      return _http_build_query( $data, null, '&', '', false );
  88  }
  89  endif;
  90  
  91  if ( !function_exists( 'add_query_arg' ) ) : // Current at [WP9840]
  92  /**
  93   * Retrieve a modified URL query string.
  94   *
  95   * You can rebuild the URL and append a new query variable to the URL query by
  96   * using this function. You can also retrieve the full URL with query data.
  97   *
  98   * Adding a single key & value or an associative array. Setting a key value to
  99   * emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER
 100   * value.
 101   *
 102   * @since WP 1.5.0
 103   *
 104   * @param mixed $param1 Either newkey or an associative_array
 105   * @param mixed $param2 Either newvalue or oldquery or uri
 106   * @param mixed $param3 Optional. Old query or uri
 107   * @return string New URL query string.
 108   */
 109  function add_query_arg() {
 110      $ret = '';
 111      if ( is_array( func_get_arg(0) ) ) {
 112          if ( @func_num_args() < 2 || false === @func_get_arg( 1 ) )
 113              $uri = $_SERVER['REQUEST_URI'];
 114          else
 115              $uri = @func_get_arg( 1 );
 116      } else {
 117          if ( @func_num_args() < 3 || false === @func_get_arg( 2 ) )
 118              $uri = $_SERVER['REQUEST_URI'];
 119          else
 120              $uri = @func_get_arg( 2 );
 121      }
 122  
 123      if ( $frag = strstr( $uri, '#' ) )
 124          $uri = substr( $uri, 0, -strlen( $frag ) );
 125      else
 126          $frag = '';
 127  
 128      if ( preg_match( '|^https?://|i', $uri, $matches ) ) {
 129          $protocol = $matches[0];
 130          $uri = substr( $uri, strlen( $protocol ) );
 131      } else {
 132          $protocol = '';
 133      }
 134  
 135      if ( strpos( $uri, '?' ) !== false ) {
 136          $parts = explode( '?', $uri, 2 );
 137          if ( 1 == count( $parts ) ) {
 138              $base = '?';
 139              $query = $parts[0];
 140          } else {
 141              $base = $parts[0] . '?';
 142              $query = $parts[1];
 143          }
 144      } elseif ( !empty( $protocol ) || strpos( $uri, '=' ) === false ) {
 145          $base = $uri . '?';
 146          $query = '';
 147      } else {
 148          $base = '';
 149          $query = $uri;
 150      }
 151  
 152      wp_parse_str( $query, $qs );
 153      $qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
 154      if ( is_array( func_get_arg( 0 ) ) ) {
 155          $kayvees = func_get_arg( 0 );
 156          $qs = array_merge( $qs, $kayvees );
 157      } else {
 158          $qs[func_get_arg( 0 )] = func_get_arg( 1 );
 159      }
 160  
 161      foreach ( (array) $qs as $k => $v ) {
 162          if ( $v === false )
 163              unset( $qs[$k] );
 164      }
 165  
 166      $ret = build_query( $qs );
 167      $ret = trim( $ret, '?' );
 168      $ret = preg_replace( '#=(&|$)#', '$1', $ret );
 169      $ret = $protocol . $base . $ret . $frag;
 170      $ret = rtrim( $ret, '?' );
 171      return $ret;
 172  }
 173  endif;
 174  
 175  if ( !function_exists( 'remove_query_arg' ) ) : // Current at [WP9840]
 176  /**
 177   * Removes an item or list from the query string.
 178   *
 179   * @since WP 1.5.0
 180   *
 181   * @param string|array $key Query key or keys to remove.
 182   * @param bool $query When false uses the $_SERVER value.
 183   * @return string New URL query string.
 184   */
 185  function remove_query_arg( $key, $query=false ) {
 186      if ( is_array( $key ) ) { // removing multiple keys
 187          foreach ( $key as $k )
 188              $query = add_query_arg( $k, false, $query );
 189          return $query;
 190      }
 191      return add_query_arg( $key, false, $query );
 192  }
 193  endif;
 194  
 195  if ( !function_exists( 'ent2ncr' ) ) : // Current at [WP9840]
 196  /**
 197   * Converts named entities into numbered entities.
 198   *
 199   * @since WP 1.5.1
 200   *
 201   * @param string $text The text within which entities will be converted.
 202   * @return string Text with converted entities.
 203   */
 204  function ent2ncr($text) {
 205      $to_ncr = array(
 206          '&quot;' => '&#34;',
 207          '&amp;' => '&#38;',
 208          '&frasl;' => '&#47;',
 209          '&lt;' => '&#60;',
 210          '&gt;' => '&#62;',
 211          '|' => '&#124;',
 212          '&nbsp;' => '&#160;',
 213          '&iexcl;' => '&#161;',
 214          '&cent;' => '&#162;',
 215          '&pound;' => '&#163;',
 216          '&curren;' => '&#164;',
 217          '&yen;' => '&#165;',
 218          '&brvbar;' => '&#166;',
 219          '&brkbar;' => '&#166;',
 220          '&sect;' => '&#167;',
 221          '&uml;' => '&#168;',
 222          '&die;' => '&#168;',
 223          '&copy;' => '&#169;',
 224          '&ordf;' => '&#170;',
 225          '&laquo;' => '&#171;',
 226          '&not;' => '&#172;',
 227          '&shy;' => '&#173;',
 228          '&reg;' => '&#174;',
 229          '&macr;' => '&#175;',
 230          '&hibar;' => '&#175;',
 231          '&deg;' => '&#176;',
 232          '&plusmn;' => '&#177;',
 233          '&sup2;' => '&#178;',
 234          '&sup3;' => '&#179;',
 235          '&acute;' => '&#180;',
 236          '&micro;' => '&#181;',
 237          '&para;' => '&#182;',
 238          '&middot;' => '&#183;',
 239          '&cedil;' => '&#184;',
 240          '&sup1;' => '&#185;',
 241          '&ordm;' => '&#186;',
 242          '&raquo;' => '&#187;',
 243          '&frac14;' => '&#188;',
 244          '&frac12;' => '&#189;',
 245          '&frac34;' => '&#190;',
 246          '&iquest;' => '&#191;',
 247          '&Agrave;' => '&#192;',
 248          '&Aacute;' => '&#193;',
 249          '&Acirc;' => '&#194;',
 250          '&Atilde;' => '&#195;',
 251          '&Auml;' => '&#196;',
 252          '&Aring;' => '&#197;',
 253          '&AElig;' => '&#198;',
 254          '&Ccedil;' => '&#199;',
 255          '&Egrave;' => '&#200;',
 256          '&Eacute;' => '&#201;',
 257          '&Ecirc;' => '&#202;',
 258          '&Euml;' => '&#203;',
 259          '&Igrave;' => '&#204;',
 260          '&Iacute;' => '&#205;',
 261          '&Icirc;' => '&#206;',
 262          '&Iuml;' => '&#207;',
 263          '&ETH;' => '&#208;',
 264          '&Ntilde;' => '&#209;',
 265          '&Ograve;' => '&#210;',
 266          '&Oacute;' => '&#211;',
 267          '&Ocirc;' => '&#212;',
 268          '&Otilde;' => '&#213;',
 269          '&Ouml;' => '&#214;',
 270          '&times;' => '&#215;',
 271          '&Oslash;' => '&#216;',
 272          '&Ugrave;' => '&#217;',
 273          '&Uacute;' => '&#218;',
 274          '&Ucirc;' => '&#219;',
 275          '&Uuml;' => '&#220;',
 276          '&Yacute;' => '&#221;',
 277          '&THORN;' => '&#222;',
 278          '&szlig;' => '&#223;',
 279          '&agrave;' => '&#224;',
 280          '&aacute;' => '&#225;',
 281          '&acirc;' => '&#226;',
 282          '&atilde;' => '&#227;',
 283          '&auml;' => '&#228;',
 284          '&aring;' => '&#229;',
 285          '&aelig;' => '&#230;',
 286          '&ccedil;' => '&#231;',
 287          '&egrave;' => '&#232;',
 288          '&eacute;' => '&#233;',
 289          '&ecirc;' => '&#234;',
 290          '&euml;' => '&#235;',
 291          '&igrave;' => '&#236;',
 292          '&iacute;' => '&#237;',
 293          '&icirc;' => '&#238;',
 294          '&iuml;' => '&#239;',
 295          '&eth;' => '&#240;',
 296          '&ntilde;' => '&#241;',
 297          '&ograve;' => '&#242;',
 298          '&oacute;' => '&#243;',
 299          '&ocirc;' => '&#244;',
 300          '&otilde;' => '&#245;',
 301          '&ouml;' => '&#246;',
 302          '&divide;' => '&#247;',
 303          '&oslash;' => '&#248;',
 304          '&ugrave;' => '&#249;',
 305          '&uacute;' => '&#250;',
 306          '&ucirc;' => '&#251;',
 307          '&uuml;' => '&#252;',
 308          '&yacute;' => '&#253;',
 309          '&thorn;' => '&#254;',
 310          '&yuml;' => '&#255;',
 311          '&OElig;' => '&#338;',
 312          '&oelig;' => '&#339;',
 313          '&Scaron;' => '&#352;',
 314          '&scaron;' => '&#353;',
 315          '&Yuml;' => '&#376;',
 316          '&fnof;' => '&#402;',
 317          '&circ;' => '&#710;',
 318          '&tilde;' => '&#732;',
 319          '&Alpha;' => '&#913;',
 320          '&Beta;' => '&#914;',
 321          '&Gamma;' => '&#915;',
 322          '&Delta;' => '&#916;',
 323          '&Epsilon;' => '&#917;',
 324          '&Zeta;' => '&#918;',
 325          '&Eta;' => '&#919;',
 326          '&Theta;' => '&#920;',
 327          '&Iota;' => '&#921;',
 328          '&Kappa;' => '&#922;',
 329          '&Lambda;' => '&#923;',
 330          '&Mu;' => '&#924;',
 331          '&Nu;' => '&#925;',
 332          '&Xi;' => '&#926;',
 333          '&Omicron;' => '&#927;',
 334          '&Pi;' => '&#928;',
 335          '&Rho;' => '&#929;',
 336          '&Sigma;' => '&#931;',
 337          '&Tau;' => '&#932;',
 338          '&Upsilon;' => '&#933;',
 339          '&Phi;' => '&#934;',
 340          '&Chi;' => '&#935;',
 341          '&Psi;' => '&#936;',
 342          '&Omega;' => '&#937;',
 343          '&alpha;' => '&#945;',
 344          '&beta;' => '&#946;',
 345          '&gamma;' => '&#947;',
 346          '&delta;' => '&#948;',
 347          '&epsilon;' => '&#949;',
 348          '&zeta;' => '&#950;',
 349          '&eta;' => '&#951;',
 350          '&theta;' => '&#952;',
 351          '&iota;' => '&#953;',
 352          '&kappa;' => '&#954;',
 353          '&lambda;' => '&#955;',
 354          '&mu;' => '&#956;',
 355          '&nu;' => '&#957;',
 356          '&xi;' => '&#958;',
 357          '&omicron;' => '&#959;',
 358          '&pi;' => '&#960;',
 359          '&rho;' => '&#961;',
 360          '&sigmaf;' => '&#962;',
 361          '&sigma;' => '&#963;',
 362          '&tau;' => '&#964;',
 363          '&upsilon;' => '&#965;',
 364          '&phi;' => '&#966;',
 365          '&chi;' => '&#967;',
 366          '&psi;' => '&#968;',
 367          '&omega;' => '&#969;',
 368          '&thetasym;' => '&#977;',
 369          '&upsih;' => '&#978;',
 370          '&piv;' => '&#982;',
 371          '&ensp;' => '&#8194;',
 372          '&emsp;' => '&#8195;',
 373          '&thinsp;' => '&#8201;',
 374          '&zwnj;' => '&#8204;',
 375          '&zwj;' => '&#8205;',
 376          '&lrm;' => '&#8206;',
 377          '&rlm;' => '&#8207;',
 378          '&ndash;' => '&#8211;',
 379          '&mdash;' => '&#8212;',
 380          '&lsquo;' => '&#8216;',
 381          '&rsquo;' => '&#8217;',
 382          '&sbquo;' => '&#8218;',
 383          '&ldquo;' => '&#8220;',
 384          '&rdquo;' => '&#8221;',
 385          '&bdquo;' => '&#8222;',
 386          '&dagger;' => '&#8224;',
 387          '&Dagger;' => '&#8225;',
 388          '&bull;' => '&#8226;',
 389          '&hellip;' => '&#8230;',
 390          '&permil;' => '&#8240;',
 391          '&prime;' => '&#8242;',
 392          '&Prime;' => '&#8243;',
 393          '&lsaquo;' => '&#8249;',
 394          '&rsaquo;' => '&#8250;',
 395          '&oline;' => '&#8254;',
 396          '&frasl;' => '&#8260;',
 397          '&euro;' => '&#8364;',
 398          '&image;' => '&#8465;',
 399          '&weierp;' => '&#8472;',
 400          '&real;' => '&#8476;',
 401          '&trade;' => '&#8482;',
 402          '&alefsym;' => '&#8501;',
 403          '&crarr;' => '&#8629;',
 404          '&lArr;' => '&#8656;',
 405          '&uArr;' => '&#8657;',
 406          '&rArr;' => '&#8658;',
 407          '&dArr;' => '&#8659;',
 408          '&hArr;' => '&#8660;',
 409          '&forall;' => '&#8704;',
 410          '&part;' => '&#8706;',
 411          '&exist;' => '&#8707;',
 412          '&empty;' => '&#8709;',
 413          '&nabla;' => '&#8711;',
 414          '&isin;' => '&#8712;',
 415          '&notin;' => '&#8713;',
 416          '&ni;' => '&#8715;',
 417          '&prod;' => '&#8719;',
 418          '&sum;' => '&#8721;',
 419          '&minus;' => '&#8722;',
 420          '&lowast;' => '&#8727;',
 421          '&radic;' => '&#8730;',
 422          '&prop;' => '&#8733;',
 423          '&infin;' => '&#8734;',
 424          '&ang;' => '&#8736;',
 425          '&and;' => '&#8743;',
 426          '&or;' => '&#8744;',
 427          '&cap;' => '&#8745;',
 428          '&cup;' => '&#8746;',
 429          '&int;' => '&#8747;',
 430          '&there4;' => '&#8756;',
 431          '&sim;' => '&#8764;',
 432          '&cong;' => '&#8773;',
 433          '&asymp;' => '&#8776;',
 434          '&ne;' => '&#8800;',
 435          '&equiv;' => '&#8801;',
 436          '&le;' => '&#8804;',
 437          '&ge;' => '&#8805;',
 438          '&sub;' => '&#8834;',
 439          '&sup;' => '&#8835;',
 440          '&nsub;' => '&#8836;',
 441          '&sube;' => '&#8838;',
 442          '&supe;' => '&#8839;',
 443          '&oplus;' => '&#8853;',
 444          '&otimes;' => '&#8855;',
 445          '&perp;' => '&#8869;',
 446          '&sdot;' => '&#8901;',
 447          '&lceil;' => '&#8968;',
 448          '&rceil;' => '&#8969;',
 449          '&lfloor;' => '&#8970;',
 450          '&rfloor;' => '&#8971;',
 451          '&lang;' => '&#9001;',
 452          '&rang;' => '&#9002;',
 453          '&larr;' => '&#8592;',
 454          '&uarr;' => '&#8593;',
 455          '&rarr;' => '&#8594;',
 456          '&darr;' => '&#8595;',
 457          '&harr;' => '&#8596;',
 458          '&loz;' => '&#9674;',
 459          '&spades;' => '&#9824;',
 460          '&clubs;' => '&#9827;',
 461          '&hearts;' => '&#9829;',
 462          '&diams;' => '&#9830;'
 463      );
 464  
 465      return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
 466  }
 467  endif;
 468  
 469  if ( !function_exists( 'urlencode_deep' ) ) : // Current at [WP9840]
 470  /**
 471   * Navigates through an array and encodes the values to be used in a URL.
 472   *
 473   * Uses a callback to pass the value of the array back to the function as a 
 474   * string. 
 475   *
 476   * @since WP 2.2.0
 477   *
 478   * @param array|string $value The array or string to be encoded.
 479   * @return array|string $value The encoded array (or string from the callback).
 480   */
 481  function urlencode_deep($value) {
 482      $value = is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value);
 483      return $value;
 484  }
 485  endif;
 486  
 487  if ( !function_exists( 'zeroise' ) ) : // Current at [WP9840]
 488  /**
 489   * Add leading zeros when necessary.
 490   *
 491   * If you set the threshold to '4' and the number is '10', then you will get
 492   * back '0010'. If you set the number to '4' and the number is '5000', then you
 493   * will get back '5000'.
 494   *
 495   * Uses sprintf to append the amount of zeros based on the $threshold parameter
 496   * and the size of the number. If the number is large enough, then no zeros will
 497   * be appended.
 498   *
 499   * @since WP 0.71
 500   *
 501   * @param mixed $number Number to append zeros to if not greater than threshold.
 502   * @param int $threshold Digit places number needs to be to not have zeros added.
 503   * @return string Adds leading zeros to number if needed.
 504   */
 505  function zeroise($number, $threshold) {
 506      return sprintf('%0'.$threshold.'s', $number);
 507  }
 508  endif;
 509  
 510  if ( !function_exists( 'backslashit' ) ) : // Current at [WP9840]
 511  /**
 512   * Adds backslashes before letters and before a number at the start of a string.
 513   *
 514   * @since WP 0.71
 515   *
 516   * @param string $string Value to which backslashes will be added.
 517   * @return string String with backslashes inserted.
 518   */
 519  function backslashit($string) {
 520      $string = preg_replace('/^([0-9])/', '\\\\\\\\\1', $string);
 521      $string = preg_replace('/([a-z])/i', '\\\\\1', $string);
 522      return $string;
 523  }
 524  endif;
 525  
 526  if ( !function_exists( '_make_url_clickable_cb' ) ): // Current at [WP11307]
 527  /**
 528   * Callback to convert URI match to HTML A element.
 529   *
 530   * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
 531   * make_clickable()}.
 532   *
 533   * @since 2.3.2
 534   * @access private
 535   *
 536   * @param array $matches Single Regex Match.
 537   * @return string HTML A element with URI address.
 538   */
 539  function _make_url_clickable_cb($matches) {
 540      $url = $matches[2];
 541      $url = clean_url($url);
 542      if ( empty($url) )
 543          return $matches[0];
 544      return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>";
 545  }
 546  endif;
 547  
 548  if ( !function_exists( '_make_web_ftp_clickable_cb' ) ): // Current at [WP11307]
 549  /**
 550   * Callback to convert URL match to HTML A element.
 551   *
 552   * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
 553   * make_clickable()}.
 554   *
 555   * @since 2.3.2
 556   * @access private
 557   *
 558   * @param array $matches Single Regex Match.
 559   * @return string HTML A element with URL address.
 560   */
 561  function _make_web_ftp_clickable_cb($matches) {
 562      $ret = '';
 563      $dest = $matches[2];
 564      $dest = 'http://' . $dest;
 565      $dest = clean_url($dest);
 566      if ( empty($dest) )
 567          return $matches[0];
 568      // removed trailing [,;:] from URL
 569      if ( in_array(substr($dest, -1), array('.', ',', ';', ':')) === true ) {
 570          $ret = substr($dest, -1);
 571          $dest = substr($dest, 0, strlen($dest)-1);
 572      }
 573      return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>" . $ret;
 574  }
 575  endif;
 576  
 577  if ( !function_exists( '_make_email_clickable_cb' ) ): // Current at [WP11307]
 578  /**
 579   * Callback to convert email address match to HTML A element.
 580   *
 581   * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
 582   * make_clickable()}.
 583   *
 584   * @since 2.3.2
 585   * @access private
 586   *
 587   * @param array $matches Single Regex Match.
 588   * @return string HTML A element with email address.
 589   */
 590  function _make_email_clickable_cb($matches) {
 591      $email = $matches[2] . '@' . $matches[3];
 592      return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
 593  }
 594  endif;
 595  
 596  if ( !function_exists( 'make_clickable' ) ): // Current at [WP11307]
 597  /**
 598   * Convert plaintext URI to HTML links.
 599   *
 600   * Converts URI, www and ftp, and email addresses. Finishes by fixing links
 601   * within links.
 602   *
 603   * @since 0.71
 604   *
 605   * @param string $ret Content to convert URIs.
 606   * @return string Content with converted URIs.
 607   */
 608  function make_clickable($ret) {
 609      $ret = ' ' . $ret;
 610      // in testing, using arrays here was found to be faster
 611      $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/\-=?@\[\](+]|[.,;:](?![\s<])|(?(1)\)(?![\s<])|\)))+)#is', '_make_url_clickable_cb', $ret);
 612      $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
 613      $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
 614      // this one is not in an array because we need it to run last, for cleanup of accidental links within links
 615      $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
 616      $ret = trim($ret);
 617      return $ret;
 618  }
 619  endif;


Generated: Thu May 24 03:59:35 2012 Hosted by follow the white rabbit.