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

Diff of /contributions/modules/google_keyhaviour/google_keyhaviour.module

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

revision 1.1.2.5.2.5, Sun May 3 10:35:41 2009 UTC revision 1.1.2.5.2.6, Sun Sep 20 10:52:51 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /* $Id: google_keyhaviour.module,v 1.1.2.5.2.4 2009/05/03 03:14:49 danielb Exp $ */  /* $Id: google_keyhaviour.module,v 1.1.2.5.2.5 2009/05/03 10:35:41 danielb Exp $ */
3    
4    
5  /**  /**
# Line 41  function google_keyhaviour_menu() { Line 41  function google_keyhaviour_menu() {
41      'type' => MENU_LOCAL_TASK,      'type' => MENU_LOCAL_TASK,
42    );    );
43    $items['admin/build/google_keyhaviour/%google_keyhaviour/delete'] = $admin_item + array(    $items['admin/build/google_keyhaviour/%google_keyhaviour/delete'] = $admin_item + array(
44      'title' => t('Delete google keyhaviour rule'),      'title' => 'Delete google keyhaviour rule',
45      'page callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
46      'page arguments' => array('google_keyhaviour_admin_delete', 3),      'page arguments' => array('google_keyhaviour_admin_delete', 3),
47      'access callback' => 'google_keyhaviour_menu_allow_google_keyhaviour_tabs',      'access callback' => 'google_keyhaviour_menu_allow_google_keyhaviour_tabs',
# Line 49  function google_keyhaviour_menu() { Line 49  function google_keyhaviour_menu() {
49      'type' => MENU_LOCAL_TASK,      'type' => MENU_LOCAL_TASK,
50    );    );
51    $items['admin/build/google_keyhaviour/%google_keyhaviour/edit/%/edit'] = $admin_item + array(    $items['admin/build/google_keyhaviour/%google_keyhaviour/edit/%/edit'] = $admin_item + array(
52      'title' => t('Edit google keyhaviour action'),      'title' => 'Edit google keyhaviour action',
53      'page callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
54      'page arguments' => array('google_keyhaviour_admin_action_edit', 3, 5),      'page arguments' => array('google_keyhaviour_admin_action_edit', 3, 5),
55      'access callback' => 'google_keyhaviour_menu_allow_google_keyhaviour_action_tabs',      'access callback' => 'google_keyhaviour_menu_allow_google_keyhaviour_action_tabs',
# Line 57  function google_keyhaviour_menu() { Line 57  function google_keyhaviour_menu() {
57      'type' => MENU_LOCAL_TASK,      'type' => MENU_LOCAL_TASK,
58    );    );
59    $items['admin/build/google_keyhaviour/%google_keyhaviour/edit/%/delete'] = $admin_item + array(    $items['admin/build/google_keyhaviour/%google_keyhaviour/edit/%/delete'] = $admin_item + array(
60      'title' => t('Delete google keyhaviour action'),      'title' => 'Delete google keyhaviour action',
61      'page callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
62      'page arguments' => array('google_keyhaviour_admin_action_delete', 3, 5),      'page arguments' => array('google_keyhaviour_admin_action_delete', 3, 5),
63      'access callback' => 'google_keyhaviour_menu_allow_google_keyhaviour_action_tabs',      'access callback' => 'google_keyhaviour_menu_allow_google_keyhaviour_action_tabs',
# Line 485  function google_keyhaviour_preprocess_pa Line 485  function google_keyhaviour_preprocess_pa
485        $settings = &$action->settings;        $settings = &$action->settings;
486        if ($settings['verb'] == 'replace') {        if ($settings['verb'] == 'replace') {
487          $vars[$settings['var']] = $settings['with'];          $vars[$settings['var']] = $settings['with'];
488        } else if ($settings['verb'] == 'append') {        }
489          else if ($settings['verb'] == 'append') {
490          $vars[$settings['var']] .= $settings['with'];          $vars[$settings['var']] .= $settings['with'];
491        } else if ($settings['verb'] == 'prepend') {        }
492          else if ($settings['verb'] == 'prepend') {
493          $vars[$settings['var']] = $settings['with'] . $vars[$settings['var']];          $vars[$settings['var']] = $settings['with'] . $vars[$settings['var']];
494        }        }
495                  }                  }
# Line 509  function google_keyhaviour_preprocess_bl Line 511  function google_keyhaviour_preprocess_bl
511              $vars['block']->$key = NULL;              $vars['block']->$key = NULL;
512            }            }
513          }          }
514        } else {        }
515          else {
516          // find unticked blocks and hide them;          // find unticked blocks and hide them;
517          if (!$exceptions[$vars['block']->bid]) {          if (!$exceptions[$vars['block']->bid]) {
518            foreach($vars['block'] as $key => $value) {            foreach($vars['block'] as $key => $value) {
# Line 534  function google_keyhaviour_satisfied() { Line 537  function google_keyhaviour_satisfied() {
537          // check for keywords          // check for keywords
538          $eval_strings = array();          $eval_strings = array();
539          if (!$keywords) {          if (!$keywords) {
540                  // no keywords?                  // no keywords?
541                  return array();                  return array();
542          }          }
543    
# Line 545  function google_keyhaviour_satisfied() { Line 548  function google_keyhaviour_satisfied() {
548        if (is_numeric($key)) {        if (is_numeric($key)) {
549          if ($condition['match'] == 'contain' && stripos($keywords, $condition['phrase']) !== FALSE ) {          if ($condition['match'] == 'contain' && stripos($keywords, $condition['phrase']) !== FALSE ) {
550            $eval_parts[] = 'TRUE';            $eval_parts[] = 'TRUE';
551          } else if ($condition['match'] == 'do not contain' && stripos($keywords, $condition['phrase']) === FALSE) {          }
552            else if ($condition['match'] == 'do not contain' && stripos($keywords, $condition['phrase']) === FALSE) {
553            $eval_parts[] = 'TRUE';            $eval_parts[] = 'TRUE';
554          } else if ($condition['match'] == 'are exactly' && strtolower($keywords) == strtolower($condition['phrase'])) {          }
555            else if ($condition['match'] == 'are exactly' && strtolower($keywords) == strtolower($condition['phrase'])) {
556            $eval_parts[] = 'TRUE';            $eval_parts[] = 'TRUE';
557          } else if ($condition['match'] == 'exist' && !empty($keywords)) {          }
558            else if ($condition['match'] == 'exist' && !empty($keywords)) {
559            $eval_parts[] = 'TRUE';            $eval_parts[] = 'TRUE';
560          } else {          }
561            else {
562            $eval_parts[] = 'FALSE';            $eval_parts[] = 'FALSE';
563          }          }
564        }        }

Legend:
Removed from v.1.1.2.5.2.5  
changed lines
  Added in v.1.1.2.5.2.6

  ViewVC Help
Powered by ViewVC 1.1.2