Skip to content

Commit 5d73415

Browse files
committed
Update doc. New standards.
1 parent 105c345 commit 5d73415

File tree

3 files changed

+55
-57
lines changed

3 files changed

+55
-57
lines changed

os2web_print_send_to_friend.info

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ name = OS2Web Print or Send to Friend
22
description = A module allowing print bullet point ot send it to friend via email.
33
core = 7.x
44
package = OS2Web - Frontend
5+
project = os2web_print_send_to_friend
6+
version = 1.0-beta1
7+

os2web_print_send_to_friend.make

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ core = 7.x
55

66
; OS2Web Modules
77

8-
# projects[os2web_print_send_to_friend][type] = "module"
9-
# projects[os2web_print_send_to_friend][download][type] = "git"
10-
# projects[os2web_print_send_to_friend][download][branch] = "master"
11-
# projects[os2web_print_send_to_friend][download][url] = "git://github.com/OS2web/os2web_print_send_to_friend.git"
12-
138
;; Contrib modules below:
149

1510
; Libraries

os2web_print_send_to_friend.module

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
2-
32
/**
4-
* OS2Web_Print_Send_to_Friend
3+
* @file
4+
* os2web_print_send_to_friend
55
*
66
* PHP version 5
77
*
@@ -13,9 +13,7 @@
1313
*/
1414

1515
/**
16-
* Implementation of hook_menu().
17-
*
18-
* @return array of links.
16+
* Implements hook_menu().
1917
*/
2018
function os2web_print_send_to_friend_menu() {
2119
$items = array();
@@ -51,10 +49,10 @@ function os2web_print_send_to_friend_menu() {
5149
}
5250

5351
/**
54-
* Creates a light version of the bullet point for printing
55-
*
56-
* @param int $bullet_point_id bullet point id
52+
* Creates a light version of the bullet point for printing.
5753
*
54+
* @param int $bullet_point_id
55+
* bullet point id
5856
*/
5957
function os2web_print_send_to_friend_print_bullet_point($bullet_point_id) {
6058
$bullet_point = node_load($bullet_point_id);
@@ -66,18 +64,19 @@ function os2web_print_send_to_friend_print_bullet_point($bullet_point_id) {
6664
$html .= '<h3>' . $attachment->title . '</h3>';
6765
$html .= $attachment->field_bpa_body['und'][0]['value'];
6866
}
67+
6968
}
7069
return ('<div class="node" id="content">' . $html . '</div>');
7170
}
7271

7372
/**
74-
* Creates a form that allows to send the content of the bullet point to an email addess.
75-
*
76-
* @param int $bullet_point_id bullet point id
73+
* Form callback for send_to_friend_form.
7774
*
75+
* Creates a form that allows to send the content of the
76+
* bullet point to an email addess.
7877
*/
7978
function os2web_print_send_to_friend_send_to_friend_form($bullet_point_id) {
80-
//adding css that tweaks the elements for the modal window
79+
// Adding css that tweaks the elements for the modal window.
8180
drupal_add_css(drupal_get_path('module', 'os2web_print_send_to_friend') . '/css/os2web_print_send_to_friend.css');
8281

8382
drupal_add_js(drupal_get_path('module', 'os2web_print_send_to_friend') . '/js/os2web_print_send_to_friend.js');
@@ -96,57 +95,58 @@ function os2web_print_send_to_friend_send_to_friend_form($bullet_point_id) {
9695
return '<div class="bullet-point-send-to-friend-form ajax-progress">' . $html . '</div>';
9796
}
9897

98+
/**
99+
* Form access callback.
100+
*/
99101
function os2web_print_send_to_friend_bullet_point_access($bullet_point_id) {
100102
$bullet_point = node_load($bullet_point_id);
101-
102103
if (strcmp($bullet_point->type, 'bullet_point') == 0) {
103-
if ($bullet_point->field_bul_point_closed['und'][0]['value'])
104+
if ($bullet_point->field_bul_point_closed['und'][0]['value']) {
104105
return TRUE;
105-
else
106+
}
107+
else {
106108
return FALSE;
109+
}
107110
}
108111
return FALSE;
109112
}
110113

111114
/**
112-
* Does the actual sending to the provided email
115+
* Form callback for os2web_print_send_to_friend_send_to_friend.
113116
*
114-
* @param int $bullet_point_id bullet point id
115-
* @patam string $email email
117+
* Does the actual sending to the provided email
116118
*
119+
* @param int $bullet_point_id
120+
* bullet point id
117121
*/
118-
function os2web_print_send_to_friend_send_to_friend($bullet_point_id){
119-
$bullet_point = node_load($bullet_point_id);
120-
$subject = 'Dagsorden Punkt: ' . $bullet_point->title;
121-
122-
$name = check_plain(trim($_POST['name']));
123-
$message = check_plain(trim($_POST['message']));
124-
$to_email = check_plain($_POST['email']);
125-
126-
$body = "Hej \n\n" . $name ." har sendt dig et dagsordenspunkt. \n\n";
127-
$body .= "Med beskeden:\n". $message ."\n\n";
128-
129-
$body .= os2web_print_send_to_friend_print_bullet_point($bullet_point_id);
130-
131-
$from = variable_get('system_mail');
132-
$message = array(
133-
'id' => 'send_to_friend_',
134-
'to' => $to_email,
135-
'subject' => $subject,
136-
'body' => array($body),
137-
'headers' => array(
138-
'From' => $from,
139-
'Sender' => $from,
140-
'Return-Path' => $from,
141-
'Content-Type' => 'text/plain; charset=UTF-8;',
142-
'Content-Transfer-Encoding' => '8Bit',
143-
),
144-
);
145-
$system = drupal_mail_system("os2web_print_send_to_friend", "");
146-
147-
// The format function must be called before calling the mail function.
148-
$message = $system->format($message);
149-
150-
151-
$system->mail($message);
122+
function os2web_print_send_to_friend_send_to_friend($bullet_point_id) {
123+
$bullet_point = node_load($bullet_point_id);
124+
$subject = 'Dagsorden Punkt: ' . $bullet_point->title;
125+
126+
$body = "Hej \n\n" . $_POST['name'] . " har sendt dig et dagsordenspunkt. \n\n";
127+
$body .= "Med beskeden:\n" . trim($_POST['message']) . "\n\n";
128+
129+
$body .= os2web_print_send_to_friend_print_bullet_point($bullet_point_id);
130+
131+
$from = variable_get('system_mail');
132+
$message = array(
133+
'id' => 'send_to_friend_',
134+
'to' => $_POST['email'],
135+
'subject' => $subject,
136+
'body' => array($body),
137+
'headers' => array(
138+
'From' => $from,
139+
'Sender' => $from,
140+
'Return-Path' => $from,
141+
'Content-Type' => 'text/plain; charset=UTF-8;',
142+
'Content-Transfer-Encoding' => '8Bit',
143+
),
144+
);
145+
$system = drupal_mail_system("os2web_print_send_to_friend", "");
146+
147+
// The format function must be called before calling the mail function.
148+
$message = $system->format($message);
149+
150+
151+
$system->mail($message);
152152
}

0 commit comments

Comments
 (0)