/[drupal]/contributions/modules/seo_checklist/seochecklist.module
ViewVC logotype

Diff of /contributions/modules/seo_checklist/seochecklist.module

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

revision 1.1.2.9 by davereid, Thu Oct 29 00:01:46 2009 UTC revision 1.1.2.10 by davereid, Sat Nov 21 00:15:59 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: seochecklist.module,v 1.1.2.8 2009/10/23 00:00:27 davereid Exp $  // $Id: seochecklist.module,v 1.1.2.9 2009/10/29 00:01:46 davereid Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 91  function seochecklist_admin_settings() { Line 91  function seochecklist_admin_settings() {
91          $row->links[] = l(t('Configure'), $row->configure);          $row->links[] = l(t('Configure'), $row->configure);
92        }        }
93    
94        $form['group_' . $group_id]['seochecklist_nodetypes_' . intval($row->id)] = array(        $task = $form['group_' . $group_id]['seochecklist_task_' . $row->id] = array(
95          '#type' => 'checkbox',          '#type' => 'checkbox',
96          '#title' => t($row->name),          '#title' => t($row->name),
97          '#default_value' => $row->completed || ($row->module && module_exists($row->module)),          '#default_value' => $row->completed || ($row->module && module_exists($row->module)),
98          '#description' => join(' | ', $row->links),          '#description' => join(' | ', $row->links),
99        );        );
100        if (strpos($row->name, 'Clean URLs') === 0) {        if (strpos($row->name, 'Clean URLs') === 0) {
101          $form['group_' . $group_id]['seochecklist_nodetypes_' . intval($row->id)]['#disabled'] = !variable_get('clean_url', 0);          $task['#disabled'] = !variable_get('clean_url', 0);
102          $form['group_' . $group_id]['seochecklist_nodetypes_' . intval($row->id)]['#default_value'] |= variable_get('clean_url', 0);          $task['#default_value'] |= variable_get('clean_url', 0);
103        }        }
104      }      }
105    }    }
106    
107    $form['bottom_code'] = array(    $form['extras'] = array(
108      '#type' => 'fieldset',      '#type' => 'fieldset',
109      '#title' => t('Extras'),      '#title' => t('Extras'),
110      '#collapsible' => TRUE,      '#collapsible' => TRUE,
111    );    );
112    $form['bottom_code']['seo_checklist_link'] = array(    $form['extras']['seo_checklist_link'] = array(
113      '#type' => 'checkbox',      '#type' => 'checkbox',
114      '#title' => t("Link to Volacci to thank them for this awesome module. <strong>Don't forget to click Save!</strong>"),      '#title' => t('Link to Volacci to thank them for this awesome module.'),
     '#description' => t("A small link will appear at the very bottom of your website. You can disable it at any time by un-checking this box. We really appreciate it!!!"),  
115      '#default_value' => variable_get('seo_checklist_link', 0),      '#default_value' => variable_get('seo_checklist_link', 0),
116        '#description' => t('A small link will appear at the very bottom of your website. You can disable it at any time by un-checking this box. We really appreciate it!'),
117    );    );
118    $form['bottom_code']['seo_checklist_thanks'] = array(    $form['extras']['seo_checklist_thanks'] = array(
119      '#type' => 'checkbox',      '#type' => 'checkbox',
120      '#title' => t("Link to us then send us feedback on the Drupal 6 SEO Checklist module or just say \"Thanks!\" and we will link to you from our website. Send your feedback and link information to !email. (If you don't know why you should link with other websites, read this: !link.)", array('!email' => l('seochecklist@volacci.com', 'mailto:seochecklist@volacci.com'), '!link' => l('Why links help SEO', 'http://www.volacci.com/why-links-help-seo'))),      '#title' => t('Send us feedback on the Drupal 6 SEO Checklist module or just say <em>Thanks!</em> and we will link to you from our website. Send your feedback and link information to <a href="mailto:@email">@email</a>.', array('@email' => 'seochecklist@volacci.com')),
121      '#default_value' => variable_get('seo_checklist_thanks', 0),      '#default_value' => variable_get('seo_checklist_thanks', 0),
122        '#description' => t('If you do not know why you should link with other websites, read the following article: <a href="@link">Why links help SEO</a>.', array('@link' => 'http://www.volacci.com/why-links-help-seo')),
123    );    );
124    $form['bottom_code']['seo_checklist_podcast'] = array(    $form['extras']['seo_checklist_podcast'] = array(
125      '#type' => 'checkbox',      '#type' => 'checkbox',
126      '#title' => t("Listen to the Volacci Drupal SEO Podcast for more tips and tricks about Drupal SEO: !link", array('!link' => l('http://www.volacci.com/podcast', 'http://www.volacci.com/podcast'))),      '#title' => t('Listen to the <a href="@podcast">Volacci Drupal SEO Podcast</a> for more tips and tricks about Drupal SEO.', array('@podcast' => 'http://www.volacci.com/podcast')),
127      '#default_value' => variable_get('seo_checklist_podcast', 0),      '#default_value' => variable_get('seo_checklist_podcast', 0),
128    );    );
129    
# Line 140  function seochecklist_admin_settings() { Line 141  function seochecklist_admin_settings() {
141  function seochecklist_admin_settings_submit($form_id, $form_values) {  function seochecklist_admin_settings_submit($form_id, $form_values) {
142    global $user;    global $user;
143    
144      $count = 0;
145    foreach ($form_values as $key => $value) {    foreach ($form_values as $key => $value) {
146      if (preg_match('/seochecklist_nodetypes/', $key)) {      if (preg_match('/seochecklist_task_/', $key)) {
147        $key = explode('_', $key);        $key = explode('_', $key);
148        $key = $key[2];        $key = $key[2];
149        $current = (bool) db_result(db_query("SELECT completed FROM {seo_checklist} WHERE id = %d", $key));        $current = (bool) db_result(db_query("SELECT completed FROM {seo_checklist} WHERE id = %d", $key));
150        if ($current != $value) {        if ($current != $value) {
151          // If the checkbox changed states, update the record.          // If the checkbox changed states, update the record.
152          db_query("UPDATE {seo_checklist} SET completed = %d, uid = %d WHERE id = %d", ($value ? time() : 0), $user->uid, $key);          db_query("UPDATE {seo_checklist} SET completed = %d, uid = %d WHERE id = %d", ($value ? time() : 0), $user->uid, $key);
153            $count++;
154        }        }
155      }      }
156    }    }
# Line 156  function seochecklist_admin_settings_sub Line 159  function seochecklist_admin_settings_sub
159    variable_set('seo_checklist_link', $form_values['seo_checklist_link']);    variable_set('seo_checklist_link', $form_values['seo_checklist_link']);
160    variable_set('seo_checklist_thanks', $form_values['seo_checklist_thanks']);    variable_set('seo_checklist_thanks', $form_values['seo_checklist_thanks']);
161    variable_set('seo_checklist_podcast', $form_values['seo_checklist_podcast']);    variable_set('seo_checklist_podcast', $form_values['seo_checklist_podcast']);
162    
163      drupal_set_message(format_plural($count, t('Updated @count task successfully.'), t('Updated @count tasks successfully.')));
164  }  }
165    
166  /**  /**

Legend:
Removed from v.1.1.2.9  
changed lines
  Added in v.1.1.2.10

  ViewVC Help
Powered by ViewVC 1.1.3