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

Diff of /contributions/modules/nodewords_nodetype/nodewords_nodetype.module

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

revision 1.1.2.5, Mon Sep 15 15:06:45 2008 UTC revision 1.1.2.6, Mon Jun 1 18:37:16 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /* $Id: nodewords_nodetype.module,v 1.1.2.4 2008/06/03 01:18:50 hanoii Exp $ */  /* $Id: nodewords_nodetype.module,v 1.1.2.5 2008/09/15 15:06:45 hanoii Exp $ */
3    
4  function nodewords_nodetype_form_alter($form_id, &$form) {  function nodewords_nodetype_form_alter($form_id, &$form) {
5    if ($form_id == 'node_type_form' && isset($form['#node_type'])) {    if ($form_id == 'node_type_form' && isset($form['#node_type'])) {
6      $settings = _nodewords_get_settings();      $settings = _nodewords_get_settings();
7      $form['nodewords_nodetype'] = array(      $form['nodewords_nodetype'] = array(
8          '#type' => 'fieldset',        '#type' => 'fieldset',
9          '#title' => t('Meta tags node type'),        '#title' => t('Meta tags node type'),
10          '#collapsible' => TRUE,        '#collapsible' => TRUE,
11          '#collapsed' => FALSE,        '#collapsed' => FALSE,
12        );      );
13        $form['nodewords_nodetype']['nodewords_nodetype_robots'] = array(
14          '#type' => 'select',
15          '#title' => t('Default "robots" meta tag'),
16          '#options' => array(
17            '' => t('Use Meta tags default'),
18            'index,follow' => 'ALL=INDEX,FOLLOW',
19            'noindex,follow' => 'NOINDEX,FOLLOW',
20            'index,nofollow' => 'INDEX,NOFOLLOW',
21            'noindex,nofollow' => 'NONE=NOINDEX,NOFOLLOW',
22          ),
23          '#multiple' => FALSE,
24          '#default_value' => variable_get('nodewords_nodetype_robots_'. $form['#node_type']->type, ''),
25          '#description' => t('The ROBOTS meta tag offers a simple mechanism to indicate to web robots and crawlers wether the page should be indexed (INDEX or NOINDEX) and whether links on the page should be followed (FOLLOW or NOFOLLOW). Here you can enter the default robots meta tag to use for all pages. If unsure, select "ALL=INDEX,FOLLOW".'),
26        );
27    
28      $form['nodewords_nodetype']['nodewords_nodetype_keywords'] = array(      $form['nodewords_nodetype']['nodewords_nodetype_keywords'] = array(
29        '#type' => 'textfield',        '#type' => 'textfield',
# Line 21  function nodewords_nodetype_form_alter($ Line 35  function nodewords_nodetype_form_alter($
35      );      );
36    
37      $form['nodewords_nodetype']['description'] = array(      $form['nodewords_nodetype']['description'] = array(
38          '#type' => 'fieldset',        '#type' => 'fieldset',
39          '#title' => t('Description'),        '#title' => t('Description'),
40          '#collapsible' => TRUE,        '#collapsible' => TRUE,
41        );      );
42    
43      $form['nodewords_nodetype']['description']['nodewords_nodetype_description'] = array(      $form['nodewords_nodetype']['description']['nodewords_nodetype_description'] = array(
44        '#type' => 'textarea',        '#type' => 'textarea',
# Line 34  function nodewords_nodetype_form_alter($ Line 48  function nodewords_nodetype_form_alter($
48      );      );
49    
50      $form['nodewords_nodetype']['nodewords_nodetype_token'] = array(      $form['nodewords_nodetype']['nodewords_nodetype_token'] = array(
51          '#type' => 'fieldset',        '#type' => 'fieldset',
52          '#title' => t('Token replacements'),        '#title' => t('Token replacements'),
53          '#collapsible' => TRUE,        '#collapsible' => TRUE,
54          '#collapsed' => TRUE,        '#collapsed' => TRUE,
55        );      );
56      $form['nodewords_nodetype']['nodewords_nodetype_token']['help'] = array(      $form['nodewords_nodetype']['nodewords_nodetype_token']['help'] = array(
57          '#type' => 'markup',        '#type' => 'markup',
58          '#value' => theme('token_help'),        '#value' => theme('token_help'),
59        );      );
60    
61      $form['nodewords_nodetype']['description']['advanced'] = array(      if (user_access('allow PHP replacements')) {
62          $form['nodewords_nodetype']['description']['advanced'] = array(
63          '#type' => 'fieldset',          '#type' => 'fieldset',
64          '#title' => t('Advanced PHP replacement'),          '#title' => t('Advanced PHP replacement'),
65          '#collapsible' => TRUE,          '#collapsible' => TRUE,
66          '#collapsed' => TRUE,          '#collapsed' => TRUE,
67        );        );
68      $form['nodewords_nodetype']['description']['advanced']['nodewords_nodetype_desc_php'] = array(        $form['nodewords_nodetype']['description']['advanced']['nodewords_nodetype_desc_php'] = array(
69          '#type' => 'textarea',          '#type' => 'textarea',
70          '#title' => t('PHP replacement'),          '#title' => t('PHP replacement'),
71          '#default_value' => variable_get('nodewords_nodetype_desc_php_'. $form['#node_type']->type, ''),          '#default_value' => variable_get('nodewords_nodetype_desc_php_'. $form['#node_type']->type, ''),
72          '#description' => t('Code must be included within %php_tags tags. You can add any php code here to perform a particular replacement on the description meta tag information after token substitution. %description and %php_description are available to be used within this code. %title is the actual description meta tags defined above with any token replacement. Be careful if the title has single or double quotes in it. %php_description is replaced with a PHP code that defines a $description variable that you can use along your eval code with the replaced string (quotes are not a problem here). A good starting poing would be: <code>%code</code>.', array('%php_tags' => '<?php ?>', '%code' => '<?php %php_description return $description; ?>')),          '#description' => t('Code must be included within %php_tags tags. You can add any php code here to perform a particular replacement on the description meta tag information after token substitution. %description and %php_description are available to be used within this code. %title is the actual description meta tags defined above with any token replacement. Be careful if the title has single or double quotes in it. %php_description is replaced with a PHP code that defines a $description variable that you can use along your eval code with the replaced string (quotes are not a problem here). A good starting poing would be: <code>%code</code>.', array('%php_tags' => '<?php ?>', '%code' => '<?php %php_description return $description; ?>')),
73        );        );
74        }
75    }    }
76  }  }
77    
# Line 87  function nodewords_nodetype_nodewords(&$ Line 103  function nodewords_nodetype_nodewords(&$
103          if ( ( $keywords = variable_get('nodewords_nodetype_keywords_'. $node->type, '') ) !== '' ) {          if ( ( $keywords = variable_get('nodewords_nodetype_keywords_'. $node->type, '') ) !== '' ) {
104            $tags['keywords'] = _nodewords_check_content(token_replace($keywords, 'node', $node));            $tags['keywords'] = _nodewords_check_content(token_replace($keywords, 'node', $node));
105          }          }
106            if ( ( $robots = variable_get('nodewords_nodetype_robots_'. $node->type, '') ) !== '' ) {
107              $tags['robots'] = _nodewords_check_content(token_replace($robots, 'node', $node));
108            }
109        }        }
110    
111        break;        break;
112    }    }
113    }
114    
115    /**
116     * Implementation of hook_perm().
117     */
118    function nodewords_nodetype_perm() {
119      return array('allow PHP replacements');
120  }  }

Legend:
Removed from v.1.1.2.5  
changed lines
  Added in v.1.1.2.6

  ViewVC Help
Powered by ViewVC 1.1.2