PHP replaces the inner chain of the function PHP keyword replacement (with mask to restore the original link function)

Source: Internet
Author: User
  1. /*

  2. * PHP replacement article inside the chain
  3. * by bbs.it-home.org
  4. */
  5. function _base64_encode ($t, $str) {
  6. Return $t. " \ "". Base64_encode ($STR). " \"";
  7. }
  8. function _base64_decode ($t, $str) {
  9. Return $t. " \ "". Base64_decode ($STR). " \"";
  10. }

  11. function _keylinks ($txt, $replacenum = ", $link _mode = 1) {

  12. /* Block the original A */
  13. $replace _a = "\_base64_encode (' ori_a= ', ' \\0 ')";
  14. $replace 1_a = "\stripslashes (Base64_decode (' \\1 ')");
  15. $search _a = "/.*?<\/a>/isxe";
  16. $search 1_a = "/ori_a= (\". *?\ ")/isxe";
  17. $txt = Preg_replace ($search _a, $replace _a, $txt);

  18. /* Block ALT title SRC */

  19. $search = "/(alt\s*=\s*|title\s*=\s*|src\s*=\s*) # find ([\" \])? (.*?) # find single or double quote
  20. (? (2) \\2|\s+?) # If quote found, match up to next matching
  21. # quote, otherwise match up to next space
  22. /isxe ";
  23. $replace = "\_base64_encode (' \\1 ', ' \\3 ')";
  24. $replace 1 = "\_base64_decode (' \\1 ', ' \\3 ')";
  25. $txt = Preg_replace ($search, $replace, $txt);
  26. Echo $txt;
  27. echo "
    http://bbs.it-home.org/



    ";
  28. /*
  29. $keywords = $this->data[' keywords ');
  30. if ($keywords) $keywords = Strpos (', ', $keywords) = = = False? Explode (', $keywords): Explode (', ', $keywords);
  31. if ($link _mode &&!empty ($keywords)) {
  32. foreach ($keywords as $keyword) {
  33. $linkdatas [] = $keyword;
  34. }
  35. } else {
  36. $linkdatas = GetCache (' Keylink ', ' Commons ');
  37. }
  38. if ($linkdatas) {
  39. $word = $replacement = Array ();
  40. foreach ($linkdatas as $v) {
  41. if ($link _mode && $keywords) {
  42. $word 1[] = '/'. Preg_quote ($v, '/'). ' /';
  43. $word 2[] = $v;
  44. $replacement [] = ". $v.";
  45. } else {
  46. $word 1[] = '/'. Preg_quote ($v [0], '/'). ' /';
  47. $word 2[] = $v [0];
  48. $replacement [] = ". $v [0].";
  49. }
  50. }
  51. if ($replacenum! = ") {
  52. $txt = Preg_replace ($word 1, $replacement, $txt, $replacenum);
  53. } else {
  54. $txt = Str_replace ($word 2, $replacement, $txt);
  55. }
  56. }
  57. */
  58. /* Restore Original A */
  59. $txt = Preg_replace ($search 1_a, $replace 1_a, $txt);
  60. /* Restore ALT title SRC */
  61. $txt = Preg_replace ($search, $replace 1, $txt);
  62. Echo $txt;
  63. return $txt;
  64. }

  65. $con = "

     Sex excessively hurts the prostate. Harmonious and happy sex life, is the natural needs of men and women, is one of the bond between husband and wife, is a couple of important part of life. But a couple with this idea should be aware of it. Because doing X love time is not the longer the better, couples ' sexual life harmony and happiness is not determined by the length of sex Xai time. On the contrary, the time-out of XZ love, but also affect the health of couples, and even cause a variety of diseases.

  66. ";

  67. _keylinks ($con);

  68. ?>

Copy Code
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.