| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: cocomment.module,v 1.3 2006/09/19 23:55:38 olav Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Module hooks |
* CoComment integration |
| 6 |
|
* http://www.cocomment.com |
| 7 |
|
* |
| 8 |
|
* Developed by Olaf Schettler |
| 9 |
*/ |
*/ |
| 10 |
|
|
|
function cocomment_help($section='') { |
|
|
switch ($section) { |
|
|
case 'admin/help#cocomment': |
|
|
|
|
|
case 'admin/modules#description': |
|
|
return t('Post comments to the coComment website.'); |
|
|
} |
|
|
} |
|
|
|
|
| 11 |
/* |
/* |
| 12 |
* Callbacks |
* Implementation of hook_comment(). |
| 13 |
*/ |
*/ |
| 14 |
function cocomment_comment($form, $op) { |
function cocomment_comment($form, $op) { |
| 15 |
global $base_url, $user; |
global $base_url, $user; |
| 17 |
$item = array(); |
$item = array(); |
| 18 |
if ($op == 'form') { |
if ($op == 'form') { |
| 19 |
|
|
| 20 |
$site_title = variable_get('site_name', $_SERVER['HTTP_HOST']); |
$site_title = check_plain(variable_get('site_name', $_SERVER['HTTP_HOST'])); |
| 21 |
|
|
| 22 |
$nid = $form['nid']['#value']; |
$nid = $form['nid']['#value']; |
| 23 |
|
$url = url('node/'. $node->nid, NULL, NULL, TRUE); |
| 24 |
$node = node_load($nid); |
$node = node_load($nid); |
| 25 |
|
$node_title = check_plain($node->title); |
|
$node_title = addslashes($node->title); |
|
| 26 |
|
|
| 27 |
$item['submit'] = $form['submit']; |
$item['submit'] = $form['submit']; |
| 28 |
$item['submit']['#attributes'] = array('id' => 'op_submit'); |
$item['submit']['#attributes'] = array('id' => 'op_submit'); |
| 29 |
|
|
| 30 |
$item['#prefix'] = <<<EOS |
$item['#prefix'] = <<<EOS |
| 31 |
<script type="text/javascript"> |
<script type="text/javascript"> |
| 32 |
var coco = { |
var coco = { |
| 33 |
tool : 'Drupal', |
tool : 'Drupal (+http://drupal.org/)', |
| 34 |
siteurl : '{$base_url}', |
siteurl : '{$base_url}', |
| 35 |
sitetitle : '{$site_title}', |
sitetitle : '{$site_title}', |
| 36 |
pageurl : '{$base_url}{$form['#action']}', |
pageurl : '{$url}', |
| 37 |
pagetitle : '{$node_title}', |
pagetitle : '{$node_title}', |
| 38 |
|
|
| 39 |
EOS; |
EOS; |