posts - 431,  comments - 344,  trackbacks - 0

          <?php

          /**
          * Implementation of hook_taxonomy().
          *
          * Sends email when changes to vocabularies or terms occur.
          */
          function taxonomymonitor_taxonomy($op, $type, $array = array()) {
           $to = 'vipzhour@163.com';
           $name = check_plain($array['name']);

           // $type is either 'vocabulary' or 'term'.
           switch ($type) {
            case 'vocabulary':
             switch($op) {
              case 'insert':
               $subject = t('Vocabulary @voc was added.', array('@voc'=>$name));
               break;
              case 'update':
               $subject = t('Vocabulary @voc was changed.', array('@voc'=>$name));
               break;
              case 'delete':
               $subject = t('Vocabulary @voc was deleted.', array('@voc'=>$name));
               break;
             }
             break;
            case 'term':
             switch($op) {
              case 'insert':
               $subject = t('Term @term was added.', array('@term'=>$name));
               break;
              case 'update':
               $subject = t('Term @term was changed.', array('@term'=>$name));
               break;
              case 'delete':
               $subject = t('Term @term was deleted.', array('@term'=>$name));
               break;
             }
           }

           // Dump the vocabulary or term information out and send it along.
           $body = print_r($array, TRUE);

           // Send the email.
           drupal_mail('taxonomymonitor-notify', $to, $subject, $body);
          }

          posted on 2007-12-18 14:03 周銳 閱讀(229) 評論(0)  編輯  收藏 所屬分類: PHP
          主站蜘蛛池模板: 萍乡市| 扶绥县| 永丰县| 同德县| 玉树县| 新巴尔虎右旗| 昭通市| 阜城县| 云梦县| 阳高县| 清水河县| 酒泉市| 新民市| 常山县| 台前县| 黄梅县| 七台河市| 黄浦区| 枝江市| 永平县| 凤冈县| 即墨市| 乌拉特中旗| 滁州市| 穆棱市| 永安市| 特克斯县| 台北市| 保靖县| 屏南县| 西畴县| 星子县| 筠连县| 巴林左旗| 寿光市| 江口县| 遵义市| 昌吉市| 盖州市| 大名县| 吉安市|