/[drupal]/contributions/modules/autotagging/autotagging.module
ViewVC logotype

Diff of /contributions/modules/autotagging/autotagging.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.9, Mon Jul 27 17:58:39 2009 UTC revision 1.10, Mon Jul 27 18:06:41 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: autotagging.module,v 1.8 2009/07/27 17:52:01 acstewart Exp $  // $Id: autotagging.module,v 1.9 2009/07/27 17:58:39 acstewart Exp $
3  /*  /*
4   * @file autotagging.module   * @file
5   * Module for base Autotagging API.   * Module for base Autotagging API.
6   */   */
7    
8    /**
9     * Implementation of hook_menu()
10     */
11  function autotagging_menu() {  function autotagging_menu() {
12    $items = array();    $items = array();
13    $items['admin/settings/autotagging'] = array(    $items['admin/settings/autotagging'] = array(
# Line 18  function autotagging_menu() { Line 21  function autotagging_menu() {
21    return $items;    return $items;
22  }  }
23    
24    /**
25     * Implementation of hook_help()
26     */
27  function autotagging_help($section) {  function autotagging_help($section) {
28      // TODO: implement
29  }  }
30    
31    /**
32     * Implementation of hook_perm()
33     */
34  function autotagging_perm() {  function autotagging_perm() {
35    return array(    return array(
36      'administer autotagging',      'administer autotagging',
# Line 29  function autotagging_perm() { Line 38  function autotagging_perm() {
38    );    );
39  }  }
40    
41    /**
42     * Implementation of hook_nodeapi()
43     */
44  function autotagging_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {  function autotagging_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
45    // act on the node    // act on the node and set up for processing by other autotagging api modules
   //  
46    switch ($op) {    switch ($op) {
47      case 'update':      case 'update':
48      case 'insert':      case 'insert':
49        $terms = array();        $terms = array();
50        // check that this node type is allowed for autotagging        // check that this node type is allowed for autotagging
       //  
51        $allowed_types = variable_get('autotagging_allowed_types', array());        $allowed_types = variable_get('autotagging_allowed_types', array());
52    
53        if (!in_array($node->type, $allowed_types)) {        if (!in_array($node->type, $allowed_types)) {
# Line 45  function autotagging_nodeapi(&$node, $op Line 55  function autotagging_nodeapi(&$node, $op
55        }        }
56    
57        // invoke autotagging api        // invoke autotagging api
       //  
58        $text = array();        $text = array();
59        $text[] = $node->title;        $text[] = $node->title;
60        $text[] = str_replace("\n", ' ', $node->body);        $text[] = str_replace("\n", ' ', $node->body);
# Line 82  function autotagging_nodeapi(&$node, $op Line 91  function autotagging_nodeapi(&$node, $op
91    }    }
92  }  }
93    
94    /**
95     * Implementation of hook_requirements()
96     */
97  function autotagging_requirements($phase) {  function autotagging_requirements($phase) {
98    switch ($phase) {    switch ($phase) {
99      case 'install':      case 'install':

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.2