• 自动给新闻正文图片添加ALT和TITLE属性:
    1. 将以下函数添加到e/class/userfun.php文件中:
      function user_AddImgAlt($mid, $f, $isadd, $isq, $value, $cs) {
          $title = $_POST['title'];
          $htmls = $value;
          $pattern = "/<img[^>]+>/";
          preg_match_all($pattern, $htmls, $matches);
          for ($i = 0; $i <= count($matches[0]); $i++) {
              preg_match_all("/alt=\".+?\"/", $matches[0][$i], $altimg);
              preg_match_all("/title=\".+?\"/", $matches[0][$i], $titleimg);
              $t_alt = count($altimg[0]);
              if ($t_alt == 0) {
                  $htmls = str_replace("<img", "<img alt=\"{$title}\"", $htmls);
                  $htmls = str_replace("<img", "<img title=\"{$title}\"", $htmls);
              }
          }
          return $htmls;
      }
    2. 修改数据表中的新闻正文字段(如newstext),在字段处理函数文本框中填入user_AddImgAlt