@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * theme_content_profile_pageroute_empty generates a message, if there is no content profile for the user. |
14 | 14 | */ |
15 | 15 | function theme_content_profile_pageroute_empty($type_name) { |
16 | - return '<div class="content-profile-empty">'. |
|
16 | + return '<div class="content-profile-empty">'. |
|
17 | 17 | t('You have not created a @type yet. Go ahead and create one!', array('@type' => $type_name)) .'</div>'; |
18 | 18 | } |
19 | 19 | |
@@ -22,58 +22,58 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class ContentProfilePageEditProfile extends PageroutePageEdit { |
24 | 24 | |
25 | - public function getForm(&$form, &$form_state, &$args) { |
|
25 | + public function getForm(&$form, &$form_state, &$args) { |
|
26 | 26 | $args['hide_pageroute_buttons'] = FALSE; |
27 | 27 | $args['default_target'] = PAGEROUTE_CURRENT; |
28 | 28 | $page = &$form_state['page']; |
29 | 29 | |
30 | 30 | if (isset($form_state['node']) && $form_state['node']['type'] == $this->options['content-type']) { |
31 | - $node = $form_state['node']; |
|
31 | + $node = $form_state['node']; |
|
32 | 32 | } |
33 | 33 | else { |
34 | - if (isset($page)) { |
|
34 | + if (isset($page)) { |
|
35 | 35 | $node = node_load(array( |
36 | - 'type' => $this->options['content-type'], |
|
37 | - 'uid' => pageroute_page_get_uid($page), |
|
36 | + 'type' => $this->options['content-type'], |
|
37 | + 'uid' => pageroute_page_get_uid($page), |
|
38 | 38 | )); |
39 | - } |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | if (empty($node)) { |
42 | - PageroutePageAdd::setNodeAddForm($form, $form_state, $page); |
|
42 | + PageroutePageAdd::setNodeAddForm($form, $form_state, $page); |
|
43 | 43 | } |
44 | 44 | else { |
45 | - $this->setNodeEditForm($form, $form_state, $page, $args, $node); |
|
45 | + $this->setNodeEditForm($form, $form_state, $page, $args, $node); |
|
46 | 46 | } |
47 | 47 | parent::unsetForm($form); |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function getAdminForm($page, &$form) { |
|
50 | + public function getAdminForm($page, &$form) { |
|
51 | 51 | |
52 | 52 | $form['options']['content-type'] = array( |
53 | - '#type' => 'select', |
|
54 | - '#title' => t('Profile content type'), |
|
55 | - '#options' => content_profile_get_types('names'), |
|
56 | - '#default_value' => $page->options['content-type'], |
|
57 | - '#weight' => 2, |
|
58 | - '#description' => t('Select a content profile type.'), |
|
53 | + '#type' => 'select', |
|
54 | + '#title' => t('Profile content type'), |
|
55 | + '#options' => content_profile_get_types('names'), |
|
56 | + '#default_value' => $page->options['content-type'], |
|
57 | + '#weight' => 2, |
|
58 | + '#description' => t('Select a content profile type.'), |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | PageroutePage::nodeUi($page, $form, TRUE); |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | - public static function help() { |
|
64 | + public static function help() { |
|
65 | 65 | return t('A page of this type will present a content profile node editing form of a configurable content-profile-type. It will edit the node with the id taken from the first argument of the pageroute. Furthermore this type can be configured to show a node adding form if the content profile is not existing. So you can build a pageroute that manages the creation and editing of content profiles.'); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public static function info() { |
|
68 | + public static function info() { |
|
69 | 69 | return array('name' => t('Content profile editing form')); |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - public function setUp() {} |
|
72 | + public function setUp() {} |
|
73 | 73 | |
74 | - public static function getDefaultSubmitHandler($form) { |
|
74 | + public static function getDefaultSubmitHandler($form) { |
|
75 | 75 | return 'node_form_submit'; |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -81,50 +81,50 @@ discard block |
||
81 | 81 | * ContentProfilePageViewProfile displays a content profile. |
82 | 82 | */ |
83 | 83 | class ContentProfilePageViewProfile extends PageroutePageView { |
84 | - /* |
|
84 | + /* |
|
85 | 85 | * Returns the page display for the configured node |
86 | 86 | */ |
87 | - public function getForm(&$form, &$form_state, &$args) { |
|
87 | + public function getForm(&$form, &$form_state, &$args) { |
|
88 | 88 | $page = &$form_state['page']; |
89 | 89 | |
90 | 90 | $args['hide_pageroute_buttons'] = FALSE; |
91 | 91 | $args['default_target'] = PAGEROUTE_CURRENT; |
92 | 92 | |
93 | 93 | $node = node_load(array( |
94 | - 'type' => $page->options['content-type'], |
|
95 | - 'uid' => pageroute_page_get_uid($page), |
|
94 | + 'type' => $page->options['content-type'], |
|
95 | + 'uid' => pageroute_page_get_uid($page), |
|
96 | 96 | )); |
97 | 97 | |
98 | 98 | if ($node->nid && node_access('view', $node)) { |
99 | - if (empty($this->title)) { |
|
99 | + if (empty($this->title)) { |
|
100 | 100 | drupal_set_title(check_plain($node->title)); |
101 | - } |
|
102 | - node_tag_new($node->nid); |
|
103 | - $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
|
101 | + } |
|
102 | + node_tag_new($node->nid); |
|
103 | + $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
|
104 | 104 | } |
105 | 105 | else { |
106 | - $type_name = node_get_types('name', $page->options['content-type']); |
|
107 | - $form += array('pageroute-view' => array('#value' => theme('content_profile_pageroute_empty', $type_name))); |
|
106 | + $type_name = node_get_types('name', $page->options['content-type']); |
|
107 | + $form += array('pageroute-view' => array('#value' => theme('content_profile_pageroute_empty', $type_name))); |
|
108 | + } |
|
108 | 109 | } |
109 | - } |
|
110 | 110 | |
111 | - public function getAdminForm($page, &$form) { |
|
111 | + public function getAdminForm($page, &$form) { |
|
112 | 112 | $form['options']['content-type'] = array( |
113 | - '#type' => 'select', |
|
114 | - '#title' => t('Profile content type'), |
|
115 | - '#options' => content_profile_get_types('names'), |
|
116 | - '#required' => TRUE, |
|
117 | - '#default_value' => $page->options['content-type'], |
|
118 | - '#weight' => 2, |
|
119 | - '#description' => t('You can only use content types marked as \'content profile\''), |
|
113 | + '#type' => 'select', |
|
114 | + '#title' => t('Profile content type'), |
|
115 | + '#options' => content_profile_get_types('names'), |
|
116 | + '#required' => TRUE, |
|
117 | + '#default_value' => $page->options['content-type'], |
|
118 | + '#weight' => 2, |
|
119 | + '#description' => t('You can only use content types marked as \'content profile\''), |
|
120 | 120 | ); |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - public static function help() { |
|
123 | + public static function help() { |
|
124 | 124 | return t('The lonely node display page can be used to view this lonely node. This might be useful for displaying the lonely node aftercreation or update. There will be a (themeable) message if there is no node that can be displayed.'); |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | - public static function info() { |
|
127 | + public static function info() { |
|
128 | 128 | return array('name' => t('Content profile display')); |
129 | - } |
|
129 | + } |
|
130 | 130 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | * Pageroute intergration classes |
7 | 7 | */ |
8 | 8 | |
9 | -include_once(drupal_get_path('module', 'pageroute') . '/pageroute.page_edit.inc'); |
|
10 | -include_once(drupal_get_path('module', 'pageroute') . '/pageroute.page_view.inc'); |
|
9 | +include_once(drupal_get_path('module', 'pageroute').'/pageroute.page_edit.inc'); |
|
10 | +include_once(drupal_get_path('module', 'pageroute').'/pageroute.page_view.inc'); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * theme_content_profile_pageroute_empty generates a message, if there is no content profile for the user. |
14 | 14 | */ |
15 | 15 | function theme_content_profile_pageroute_empty($type_name) { |
16 | 16 | return '<div class="content-profile-empty">'. |
17 | - t('You have not created a @type yet. Go ahead and create one!', array('@type' => $type_name)) .'</div>'; |
|
17 | + t('You have not created a @type yet. Go ahead and create one!', array('@type' => $type_name)).'</div>'; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | if (isset($form_state['node']) && $form_state['node']['type'] == $this->options['content-type']) { |
31 | 31 | $node = $form_state['node']; |
32 | - } |
|
33 | - else { |
|
32 | + } else { |
|
34 | 33 | if (isset($page)) { |
35 | 34 | $node = node_load(array( |
36 | 35 | 'type' => $this->options['content-type'], |
@@ -40,8 +39,7 @@ discard block |
||
40 | 39 | } |
41 | 40 | if (empty($node)) { |
42 | 41 | PageroutePageAdd::setNodeAddForm($form, $form_state, $page); |
43 | - } |
|
44 | - else { |
|
42 | + } else { |
|
45 | 43 | $this->setNodeEditForm($form, $form_state, $page, $args, $node); |
46 | 44 | } |
47 | 45 | parent::unsetForm($form); |
@@ -101,8 +99,7 @@ discard block |
||
101 | 99 | } |
102 | 100 | node_tag_new($node->nid); |
103 | 101 | $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
104 | - } |
|
105 | - else { |
|
102 | + } else { |
|
106 | 103 | $type_name = node_get_types('name', $page->options['content-type']); |
107 | 104 | $form += array('pageroute-view' => array('#value' => theme('content_profile_pageroute_empty', $type_name))); |
108 | 105 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | class ContentProfilePageEditProfile extends PageroutePageEdit { |
24 | 24 | |
25 | 25 | public function getForm(&$form, &$form_state, &$args) { |
26 | - $args['hide_pageroute_buttons'] = FALSE; |
|
26 | + $args['hide_pageroute_buttons'] = false; |
|
27 | 27 | $args['default_target'] = PAGEROUTE_CURRENT; |
28 | 28 | $page = &$form_state['page']; |
29 | 29 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | '#description' => t('Select a content profile type.'), |
59 | 59 | ); |
60 | 60 | |
61 | - PageroutePage::nodeUi($page, $form, TRUE); |
|
61 | + PageroutePage::nodeUi($page, $form, true); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public static function help() { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function getForm(&$form, &$form_state, &$args) { |
88 | 88 | $page = &$form_state['page']; |
89 | 89 | |
90 | - $args['hide_pageroute_buttons'] = FALSE; |
|
90 | + $args['hide_pageroute_buttons'] = false; |
|
91 | 91 | $args['default_target'] = PAGEROUTE_CURRENT; |
92 | 92 | |
93 | 93 | $node = node_load(array( |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | drupal_set_title(check_plain($node->title)); |
101 | 101 | } |
102 | 102 | node_tag_new($node->nid); |
103 | - $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
|
103 | + $form += array('pageroute-view' => array('#value' => node_view($node, false, true, false))); |
|
104 | 104 | } |
105 | 105 | else { |
106 | 106 | $type_name = node_get_types('name', $page->options['content-type']); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | '#type' => 'select', |
114 | 114 | '#title' => t('Profile content type'), |
115 | 115 | '#options' => content_profile_get_types('names'), |
116 | - '#required' => TRUE, |
|
116 | + '#required' => true, |
|
117 | 117 | '#default_value' => $page->options['content-type'], |
118 | 118 | '#weight' => 2, |
119 | 119 | '#description' => t('You can only use content types marked as \'content profile\''), |
@@ -8,29 +8,29 @@ |
||
8 | 8 | * System settings form page callback. |
9 | 9 | */ |
10 | 10 | function mobile_menu_toggle_form() { |
11 | - $form = array(); |
|
11 | + $form = array(); |
|
12 | 12 | |
13 | - $form['mobile_menu_menu'] = array( |
|
13 | + $form['mobile_menu_menu'] = array( |
|
14 | 14 | '#title' => t('Menu selection'), |
15 | 15 | '#description' => t('Which menu should the toggle open?'), |
16 | 16 | '#type' => 'select', |
17 | 17 | '#options' => menu_get_menus(), |
18 | 18 | '#default_value' => variable_get('mobile_menu_menu', 'main-menu'), |
19 | - ); |
|
19 | + ); |
|
20 | 20 | |
21 | - $form['mobile_menu_block'] = array( |
|
21 | + $form['mobile_menu_block'] = array( |
|
22 | 22 | '#title' => t('Menu loaded in block?'), |
23 | 23 | '#description' => t('Will this menu be loaded via a block? Check this box if you are loading your menu on the page via context or blocks.'), |
24 | 24 | '#type' => 'checkbox', |
25 | 25 | '#default_value' => variable_get('mobile_menu_block', FALSE), |
26 | - ); |
|
26 | + ); |
|
27 | 27 | |
28 | - $form['mobile_menu_css'] = array( |
|
28 | + $form['mobile_menu_css'] = array( |
|
29 | 29 | '#title' => t('(optional) CSS Selector'), |
30 | 30 | '#description' => t('Enter an optional CSS selector. If this option is used the menu selected above will be ignored'), |
31 | 31 | '#type' => 'textfield', |
32 | 32 | '#default_value' => variable_get('mobile_menu_css', ''), |
33 | - ); |
|
33 | + ); |
|
34 | 34 | |
35 | - return system_settings_form($form); |
|
35 | + return system_settings_form($form); |
|
36 | 36 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | '#title' => t('Menu loaded in block?'), |
23 | 23 | '#description' => t('Will this menu be loaded via a block? Check this box if you are loading your menu on the page via context or blocks.'), |
24 | 24 | '#type' => 'checkbox', |
25 | - '#default_value' => variable_get('mobile_menu_block', FALSE), |
|
25 | + '#default_value' => variable_get('mobile_menu_block', false), |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | $form['mobile_menu_css'] = array( |
@@ -8,69 +8,69 @@ |
||
8 | 8 | * Implements hook_menu(). |
9 | 9 | */ |
10 | 10 | function mobile_menu_toggle_menu() { |
11 | - $items = array(); |
|
11 | + $items = array(); |
|
12 | 12 | |
13 | - $items['admin/settings/mobile-menu-toggle'] = array( |
|
13 | + $items['admin/settings/mobile-menu-toggle'] = array( |
|
14 | 14 | 'title' => 'Mobile Menu Toggle', |
15 | 15 | 'description' => t('Select menu and zones for mobile menu toggle'), |
16 | 16 | 'page callback' => 'drupal_get_form', |
17 | 17 | 'page arguments' => array('mobile_menu_toggle_form'), |
18 | 18 | 'access arguments' => array('administer menu'), |
19 | 19 | 'file' => 'mobile_menu_toggle.admin.inc', |
20 | - ); |
|
20 | + ); |
|
21 | 21 | |
22 | - return $items; |
|
22 | + return $items; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Implements hook_init(). |
27 | 27 | */ |
28 | 28 | function mobile_menu_toggle_init() { |
29 | - // Set JS settings based on menu selected. |
|
30 | - $menu_default = check_plain(variable_get('mobile_menu_menu', 'main-menu')); |
|
31 | - $css_class = check_plain(variable_get('mobile_menu_css', '')); |
|
32 | - $menu_block = variable_get('mobile_menu_block', FALSE); |
|
33 | - $js_settings['mobile_menu_toggle'] = array( |
|
29 | + // Set JS settings based on menu selected. |
|
30 | + $menu_default = check_plain(variable_get('mobile_menu_menu', 'main-menu')); |
|
31 | + $css_class = check_plain(variable_get('mobile_menu_css', '')); |
|
32 | + $menu_block = variable_get('mobile_menu_block', FALSE); |
|
33 | + $js_settings['mobile_menu_toggle'] = array( |
|
34 | 34 | 'default_menu' => $menu_default, |
35 | 35 | 'css_class' => '#' . $menu_default, |
36 | - ); |
|
36 | + ); |
|
37 | 37 | |
38 | - // Add #block-menu as a prefix to class if the menu will be loaded via block. |
|
39 | - if ($menu_block) { |
|
38 | + // Add #block-menu as a prefix to class if the menu will be loaded via block. |
|
39 | + if ($menu_block) { |
|
40 | 40 | $js_settings['mobile_menu_toggle']['css_class'] = '#block-menu-' . $menu_default; |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - if (!empty($css_class)) { |
|
43 | + if (!empty($css_class)) { |
|
44 | 44 | $js_settings['mobile_menu_toggle']['css_class'] = $css_class; |
45 | - } |
|
46 | - drupal_add_js($js_settings, 'setting'); |
|
45 | + } |
|
46 | + drupal_add_js($js_settings, 'setting'); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
50 | 50 | function mobile_menu_toggle_block($op = 'list', $delta = 0, $edit = array()) { |
51 | - if ($op == 'list') { |
|
51 | + if ($op == 'list') { |
|
52 | 52 | $blocks[0]['info'] = t('Mobile Menu Toggle'); |
53 | 53 | return $blocks; |
54 | - } |
|
55 | - elseif ($op == 'view') { |
|
54 | + } |
|
55 | + elseif ($op == 'view') { |
|
56 | 56 | $block = array(); |
57 | 57 | switch ($delta) { |
58 | - case 0: |
|
58 | + case 0: |
|
59 | 59 | drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
60 | 60 | $block['content'] = theme('mobile_menu_toggle'); |
61 | 61 | break; |
62 | 62 | } |
63 | 63 | return $block; |
64 | - } |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Implements hook_theme(). |
69 | 69 | */ |
70 | 70 | function mobile_menu_toggle_theme($existing, $type, $theme, $path) { |
71 | - return array( |
|
71 | + return array( |
|
72 | 72 | 'mobile_menu_toggle' => array( |
73 | - 'template' => 'mobile_menu_toggle', |
|
73 | + 'template' => 'mobile_menu_toggle', |
|
74 | 74 | ), |
75 | - ); |
|
75 | + ); |
|
76 | 76 | } |
@@ -55,10 +55,10 @@ |
||
55 | 55 | elseif ($op == 'view') { |
56 | 56 | $block = array(); |
57 | 57 | switch ($delta) { |
58 | - case 0: |
|
59 | - drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
|
60 | - $block['content'] = theme('mobile_menu_toggle'); |
|
61 | - break; |
|
58 | + case 0: |
|
59 | + drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
|
60 | + $block['content'] = theme('mobile_menu_toggle'); |
|
61 | + break; |
|
62 | 62 | } |
63 | 63 | return $block; |
64 | 64 | } |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | $menu_block = variable_get('mobile_menu_block', FALSE); |
33 | 33 | $js_settings['mobile_menu_toggle'] = array( |
34 | 34 | 'default_menu' => $menu_default, |
35 | - 'css_class' => '#' . $menu_default, |
|
35 | + 'css_class' => '#'.$menu_default, |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | // Add #block-menu as a prefix to class if the menu will be loaded via block. |
39 | 39 | if ($menu_block) { |
40 | - $js_settings['mobile_menu_toggle']['css_class'] = '#block-menu-' . $menu_default; |
|
40 | + $js_settings['mobile_menu_toggle']['css_class'] = '#block-menu-'.$menu_default; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!empty($css_class)) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $block = array(); |
57 | 57 | switch ($delta) { |
58 | 58 | case 0: |
59 | - drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
|
59 | + drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle').'/mobile_menu_toggle.js'); |
|
60 | 60 | $block['content'] = theme('mobile_menu_toggle'); |
61 | 61 | break; |
62 | 62 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | if ($op == 'list') { |
52 | 52 | $blocks[0]['info'] = t('Mobile Menu Toggle'); |
53 | 53 | return $blocks; |
54 | - } |
|
55 | - elseif ($op == 'view') { |
|
54 | + } elseif ($op == 'view') { |
|
56 | 55 | $block = array(); |
57 | 56 | switch ($delta) { |
58 | 57 | case 0: |
@@ -29,7 +29,7 @@ |
||
29 | 29 | // Set JS settings based on menu selected. |
30 | 30 | $menu_default = check_plain(variable_get('mobile_menu_menu', 'main-menu')); |
31 | 31 | $css_class = check_plain(variable_get('mobile_menu_css', '')); |
32 | - $menu_block = variable_get('mobile_menu_block', FALSE); |
|
32 | + $menu_block = variable_get('mobile_menu_block', false); |
|
33 | 33 | $js_settings['mobile_menu_toggle'] = array( |
34 | 34 | 'default_menu' => $menu_default, |
35 | 35 | 'css_class' => '#' . $menu_default, |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | $variables = user_mail_tokens($params['recipient'], $language); |
107 | 107 | $variables = array_merge($variables, _pm_email_notify_token($params['recipient'], $params['message'], $language)); |
108 | 108 | switch ($key) { |
109 | - case 'notice': |
|
110 | - $message['subject'] = t(variable_get('pm_email_notify_subject', 'New private message at !site.'), $variables, $language->language); |
|
111 | - $message['body'] = t(variable_get('pm_email_notify_body', _pm_email_notify_default_body()), $variables, $language->language); |
|
112 | - break; |
|
109 | + case 'notice': |
|
110 | + $message['subject'] = t(variable_get('pm_email_notify_subject', 'New private message at !site.'), $variables, $language->language); |
|
111 | + $message['body'] = t(variable_get('pm_email_notify_body', _pm_email_notify_default_body()), $variables, $language->language); |
|
112 | + break; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -151,42 +151,42 @@ discard block |
||
151 | 151 | */ |
152 | 152 | function pm_email_notify_user($op, &$edit, &$account, $category = NULL) { |
153 | 153 | switch ($op) { |
154 | - case 'form': |
|
155 | - if ($category == 'account' && privatemsg_user_access('read privatemsg', $account)) { |
|
156 | - $form['enable_pm_mail'] = array( |
|
157 | - '#type' => 'fieldset', |
|
158 | - '#title' => t('Privatemsg e-mail notification'), |
|
159 | - '#collapsible' => TRUE, |
|
160 | - '#collapsed' => FALSE, |
|
161 | - '#weight' => 10, |
|
162 | - ); |
|
163 | - $form['enable_pm_mail']['pm_send_notifications'] = array( |
|
164 | - '#type' => 'checkbox', |
|
165 | - '#title' => t('Receive email notification for incoming private messages'), |
|
166 | - '#default_value' => _pm_email_notify_is_enabled($account->uid), |
|
167 | - ); |
|
168 | - } |
|
169 | - return $form; |
|
154 | + case 'form': |
|
155 | + if ($category == 'account' && privatemsg_user_access('read privatemsg', $account)) { |
|
156 | + $form['enable_pm_mail'] = array( |
|
157 | + '#type' => 'fieldset', |
|
158 | + '#title' => t('Privatemsg e-mail notification'), |
|
159 | + '#collapsible' => TRUE, |
|
160 | + '#collapsed' => FALSE, |
|
161 | + '#weight' => 10, |
|
162 | + ); |
|
163 | + $form['enable_pm_mail']['pm_send_notifications'] = array( |
|
164 | + '#type' => 'checkbox', |
|
165 | + '#title' => t('Receive email notification for incoming private messages'), |
|
166 | + '#default_value' => _pm_email_notify_is_enabled($account->uid), |
|
167 | + ); |
|
168 | + } |
|
169 | + return $form; |
|
170 | 170 | |
171 | - case 'submit': |
|
172 | - if (isset($edit['pm_send_notifications']) && privatemsg_user_access('read privatemsg', $account)) { |
|
173 | - $pm_email_enabled = $edit['pm_send_notifications']; |
|
174 | - unset($edit['pm_send_notifications']); |
|
175 | - // Update database entry with user preference. |
|
176 | - $exists = db_result(db_query("SELECT 1 FROM {pm_email_notify} WHERE user_id = %d", $account->uid)); |
|
177 | - if ($exists) { |
|
178 | - // If there is an existing entry, update. |
|
179 | - db_query("UPDATE {pm_email_notify} SET email_notify_is_enabled = %d WHERE user_id = %d", $pm_email_enabled, $account->uid); |
|
180 | - } |
|
181 | - else { |
|
182 | - // If not, create a new one. |
|
183 | - db_query("INSERT INTO {pm_email_notify} (email_notify_is_enabled, user_id) VALUES (%d, %d)", $pm_email_enabled, $account->uid); |
|
184 | - } |
|
185 | - } |
|
186 | - break; |
|
171 | + case 'submit': |
|
172 | + if (isset($edit['pm_send_notifications']) && privatemsg_user_access('read privatemsg', $account)) { |
|
173 | + $pm_email_enabled = $edit['pm_send_notifications']; |
|
174 | + unset($edit['pm_send_notifications']); |
|
175 | + // Update database entry with user preference. |
|
176 | + $exists = db_result(db_query("SELECT 1 FROM {pm_email_notify} WHERE user_id = %d", $account->uid)); |
|
177 | + if ($exists) { |
|
178 | + // If there is an existing entry, update. |
|
179 | + db_query("UPDATE {pm_email_notify} SET email_notify_is_enabled = %d WHERE user_id = %d", $pm_email_enabled, $account->uid); |
|
180 | + } |
|
181 | + else { |
|
182 | + // If not, create a new one. |
|
183 | + db_query("INSERT INTO {pm_email_notify} (email_notify_is_enabled, user_id) VALUES (%d, %d)", $pm_email_enabled, $account->uid); |
|
184 | + } |
|
185 | + } |
|
186 | + break; |
|
187 | 187 | |
188 | - case 'delete': |
|
189 | - db_query("DELETE FROM {pm_email_notify} WHERE user_id = %d", $account->uid); |
|
190 | - break; |
|
188 | + case 'delete': |
|
189 | + db_query("DELETE FROM {pm_email_notify} WHERE user_id = %d", $account->uid); |
|
190 | + break; |
|
191 | 191 | } |
192 | 192 | } |
@@ -177,8 +177,7 @@ |
||
177 | 177 | if ($exists) { |
178 | 178 | // If there is an existing entry, update. |
179 | 179 | db_query("UPDATE {pm_email_notify} SET email_notify_is_enabled = %d WHERE user_id = %d", $pm_email_enabled, $account->uid); |
180 | - } |
|
181 | - else { |
|
180 | + } else { |
|
182 | 181 | // If not, create a new one. |
183 | 182 | db_query("INSERT INTO {pm_email_notify} (email_notify_is_enabled, user_id) VALUES (%d, %d)", $pm_email_enabled, $account->uid); |
184 | 183 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Implements hook_menu(). |
10 | 10 | */ |
11 | 11 | function pm_email_notify_menu() { |
12 | - $items['admin/settings/messages/notify'] = array( |
|
12 | + $items['admin/settings/messages/notify'] = array( |
|
13 | 13 | 'title' => 'E-mail notify', |
14 | 14 | 'description' => 'E-mail notification settings', |
15 | 15 | 'page callback' => 'drupal_get_form', |
@@ -17,47 +17,47 @@ discard block |
||
17 | 17 | 'access arguments' => array('administer privatemsg settings'), |
18 | 18 | 'type' => MENU_LOCAL_TASK, |
19 | 19 | 'weight' => 10, |
20 | - ); |
|
21 | - return $items; |
|
20 | + ); |
|
21 | + return $items; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Menu callback for administration settings. |
26 | 26 | */ |
27 | 27 | function pm_email_notify_admin_settings_form() { |
28 | - $form['pm_email'] = array( |
|
28 | + $form['pm_email'] = array( |
|
29 | 29 | '#type' => 'fieldset', |
30 | 30 | '#title' => t('Privatemsg e-mail notification'), |
31 | 31 | '#collapsible' => FALSE, |
32 | 32 | '#collapsed' => FALSE, |
33 | - ); |
|
34 | - $form['pm_email']['pm_email_notify_default'] = array( |
|
33 | + ); |
|
34 | + $form['pm_email']['pm_email_notify_default'] = array( |
|
35 | 35 | '#type' => 'checkbox', |
36 | 36 | '#title' => t('Notify users of new private messages by default'), |
37 | 37 | '#default_value' => variable_get('pm_email_notify_default', TRUE), |
38 | 38 | '#weight' => 0, |
39 | - ); |
|
39 | + ); |
|
40 | 40 | |
41 | - $form['pm_email']['pm_email_notify_desc'] = array( |
|
41 | + $form['pm_email']['pm_email_notify_desc'] = array( |
|
42 | 42 | '#type' => 'item', |
43 | 43 | '#value' => t('Customize the email messages sent to users upon receipt of a new private message. <br />Available variables are: !author, !author_uid, !pm_subject, !pm_body, !thread, !site, !login_url, !uri, !uri_brief, !message (URL), !settings (URL), !boincuser_name, and !author_boincuser_name.'), |
44 | 44 | '#weight' => 1, |
45 | - ); |
|
45 | + ); |
|
46 | 46 | |
47 | - $form['pm_email']['pm_email_notify_subject'] = array( |
|
47 | + $form['pm_email']['pm_email_notify_subject'] = array( |
|
48 | 48 | '#type' => 'textfield', |
49 | 49 | '#title' => t('Subject of notification messages'), |
50 | 50 | '#default_value' => variable_get('pm_email_notify_subject', 'New private message at !site.'), |
51 | 51 | '#weight' => 2, |
52 | - ); |
|
52 | + ); |
|
53 | 53 | |
54 | - $form['pm_email']['pm_email_notify_body'] = array( |
|
54 | + $form['pm_email']['pm_email_notify_body'] = array( |
|
55 | 55 | '#type' => 'textarea', |
56 | 56 | '#title' => t('Body of notification messages'), |
57 | 57 | '#default_value' => variable_get('pm_email_notify_body', _pm_email_notify_default_body()), |
58 | 58 | '#weight' => 3, |
59 | - ); |
|
60 | - return system_settings_form($form); |
|
59 | + ); |
|
60 | + return system_settings_form($form); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -70,47 +70,47 @@ discard block |
||
70 | 70 | * User uid |
71 | 71 | */ |
72 | 72 | function _pm_email_notify_is_enabled($uid) { |
73 | - static $notifications = array(); |
|
74 | - // Cache the result set in case this method is executed in batched operation which will perform many unnecessary repeated selects for the same user |
|
75 | - if ( !isset($notifications[$uid]) ) { |
|
73 | + static $notifications = array(); |
|
74 | + // Cache the result set in case this method is executed in batched operation which will perform many unnecessary repeated selects for the same user |
|
75 | + if ( !isset($notifications[$uid]) ) { |
|
76 | 76 | $mail_notification = db_result(db_query('SELECT email_notify_is_enabled FROM {pm_email_notify} WHERE user_id = %d', $uid)); |
77 | 77 | if ($mail_notification === FALSE) { |
78 | - // db_result() returns FALSE if result was not found. |
|
79 | - $mail_notification = variable_get('pm_email_notify_default', TRUE); |
|
78 | + // db_result() returns FALSE if result was not found. |
|
79 | + $mail_notification = variable_get('pm_email_notify_default', TRUE); |
|
80 | 80 | } |
81 | 81 | $notifications[$uid] = $mail_notification; |
82 | - } |
|
83 | - return $notifications[$uid]; |
|
82 | + } |
|
83 | + return $notifications[$uid]; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Implements hook_privatemsg_message_insert(). |
88 | 88 | */ |
89 | 89 | function pm_email_notify_privatemsg_message_insert($message) { |
90 | - foreach ($message['recipients'] as $recipient) { |
|
90 | + foreach ($message['recipients'] as $recipient) { |
|
91 | 91 | // check if recipient enabled email notifications |
92 | 92 | if (_pm_email_notify_is_enabled($recipient->uid)) { |
93 | - // send them a new pm notification email if they did |
|
94 | - $params['recipient'] = $recipient; |
|
95 | - $params['message'] = $message; |
|
96 | - drupal_mail('pm_email_notify', 'notice', $recipient->mail, user_preferred_language($recipient), $params); |
|
93 | + // send them a new pm notification email if they did |
|
94 | + $params['recipient'] = $recipient; |
|
95 | + $params['message'] = $message; |
|
96 | + drupal_mail('pm_email_notify', 'notice', $recipient->mail, user_preferred_language($recipient), $params); |
|
97 | + } |
|
97 | 98 | } |
98 | - } |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Implements hook_mail(). |
103 | 103 | */ |
104 | 104 | function pm_email_notify_mail($key, &$message, $params) { |
105 | - $language = $message['language']; |
|
106 | - $variables = user_mail_tokens($params['recipient'], $language); |
|
107 | - $variables = array_merge($variables, _pm_email_notify_token($params['recipient'], $params['message'], $language)); |
|
108 | - switch ($key) { |
|
105 | + $language = $message['language']; |
|
106 | + $variables = user_mail_tokens($params['recipient'], $language); |
|
107 | + $variables = array_merge($variables, _pm_email_notify_token($params['recipient'], $params['message'], $language)); |
|
108 | + switch ($key) { |
|
109 | 109 | case 'notice': |
110 | 110 | $message['subject'] = t(variable_get('pm_email_notify_subject', 'New private message at !site.'), $variables, $language->language); |
111 | - $message['body'] = t(variable_get('pm_email_notify_body', _pm_email_notify_default_body()), $variables, $language->language); |
|
112 | - break; |
|
113 | - } |
|
111 | + $message['body'] = t(variable_get('pm_email_notify_body', _pm_email_notify_default_body()), $variables, $language->language); |
|
112 | + break; |
|
113 | + } |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * Array of mappings from token names to values (for use with strtr()). |
124 | 124 | */ |
125 | 125 | function _pm_email_notify_token($recipient, $message, $language) { |
126 | - $tokens = array( |
|
126 | + $tokens = array( |
|
127 | 127 | '!author_uid' => $message['author']->uid, |
128 | 128 | '!author' => $message['author']->name, |
129 | 129 | '!pm_subject' => trim(drupal_html_to_text(check_plain($message['subject']))), |
@@ -134,16 +134,16 @@ discard block |
||
134 | 134 | '!settings' => url('user/' . $recipient->uid . '/edit', array('absolute' => TRUE, 'language' => $language)), |
135 | 135 | '!boincuser_name' => $recipient->boincuser_name, |
136 | 136 | '!author_boincuser_name' => user_load($message['author']->uid)->boincuser_name, |
137 | - ); |
|
137 | + ); |
|
138 | 138 | |
139 | - return $tokens; |
|
139 | + return $tokens; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | 143 | * Returns default email notification body. |
144 | 144 | */ |
145 | 145 | function _pm_email_notify_default_body() { |
146 | - return "Hi !username,\n\nThis is an automatic reminder from the site !site. You have received a new private message from !author.\n\nTo read your message, follow this link:\n!message\n\nIf you don't want to receive these emails again, change your preferences here:\n!settings"; |
|
146 | + return "Hi !username,\n\nThis is an automatic reminder from the site !site. You have received a new private message from !author.\n\nTo read your message, follow this link:\n!message\n\nIf you don't want to receive these emails again, change your preferences here:\n!settings"; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -152,43 +152,43 @@ discard block |
||
152 | 152 | * Display settings form and store its information. |
153 | 153 | */ |
154 | 154 | function pm_email_notify_user($op, &$edit, &$account, $category = NULL) { |
155 | - switch ($op) { |
|
155 | + switch ($op) { |
|
156 | 156 | case 'form': |
157 | 157 | if ($category == 'account' && privatemsg_user_access('read privatemsg', $account)) { |
158 | 158 | $form['enable_pm_mail'] = array( |
159 | - '#type' => 'fieldset', |
|
160 | - '#title' => t('Privatemsg e-mail notification'), |
|
161 | - '#collapsible' => TRUE, |
|
162 | - '#collapsed' => FALSE, |
|
163 | - '#weight' => 10, |
|
159 | + '#type' => 'fieldset', |
|
160 | + '#title' => t('Privatemsg e-mail notification'), |
|
161 | + '#collapsible' => TRUE, |
|
162 | + '#collapsed' => FALSE, |
|
163 | + '#weight' => 10, |
|
164 | 164 | ); |
165 | 165 | $form['enable_pm_mail']['pm_send_notifications'] = array( |
166 | - '#type' => 'checkbox', |
|
167 | - '#title' => t('Receive email notification for incoming private messages'), |
|
168 | - '#default_value' => _pm_email_notify_is_enabled($account->uid), |
|
166 | + '#type' => 'checkbox', |
|
167 | + '#title' => t('Receive email notification for incoming private messages'), |
|
168 | + '#default_value' => _pm_email_notify_is_enabled($account->uid), |
|
169 | 169 | ); |
170 | - } |
|
171 | - return $form; |
|
170 | + } |
|
171 | + return $form; |
|
172 | 172 | |
173 | - case 'submit': |
|
173 | + case 'submit': |
|
174 | 174 | if (isset($edit['pm_send_notifications']) && privatemsg_user_access('read privatemsg', $account)) { |
175 | 175 | $pm_email_enabled = $edit['pm_send_notifications']; |
176 | 176 | unset($edit['pm_send_notifications']); |
177 | 177 | // Update database entry with user preference. |
178 | 178 | $exists = db_result(db_query("SELECT 1 FROM {pm_email_notify} WHERE user_id = %d", $account->uid)); |
179 | 179 | if ($exists) { |
180 | - // If there is an existing entry, update. |
|
181 | - db_query("UPDATE {pm_email_notify} SET email_notify_is_enabled = %d WHERE user_id = %d", $pm_email_enabled, $account->uid); |
|
180 | + // If there is an existing entry, update. |
|
181 | + db_query("UPDATE {pm_email_notify} SET email_notify_is_enabled = %d WHERE user_id = %d", $pm_email_enabled, $account->uid); |
|
182 | 182 | } |
183 | 183 | else { |
184 | - // If not, create a new one. |
|
185 | - db_query("INSERT INTO {pm_email_notify} (email_notify_is_enabled, user_id) VALUES (%d, %d)", $pm_email_enabled, $account->uid); |
|
184 | + // If not, create a new one. |
|
185 | + db_query("INSERT INTO {pm_email_notify} (email_notify_is_enabled, user_id) VALUES (%d, %d)", $pm_email_enabled, $account->uid); |
|
186 | + } |
|
186 | 187 | } |
187 | - } |
|
188 | - break; |
|
188 | + break; |
|
189 | 189 | |
190 | - case 'delete': |
|
190 | + case 'delete': |
|
191 | 191 | db_query("DELETE FROM {pm_email_notify} WHERE user_id = %d", $account->uid); |
192 | - break; |
|
193 | - } |
|
192 | + break; |
|
193 | + } |
|
194 | 194 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | function _pm_email_notify_is_enabled($uid) { |
73 | 73 | static $notifications = array(); |
74 | 74 | // Cache the result set in case this method is executed in batched operation which will perform many unnecessary repeated selects for the same user |
75 | - if ( !isset($notifications[$uid]) ) { |
|
75 | + if (!isset($notifications[$uid])) { |
|
76 | 76 | $mail_notification = db_result(db_query('SELECT email_notify_is_enabled FROM {pm_email_notify} WHERE user_id = %d', $uid)); |
77 | 77 | if ($mail_notification === FALSE) { |
78 | 78 | // db_result() returns FALSE if result was not found. |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | '!pm_body' => trim(drupal_html_to_text(check_markup($message['body'], $message['format'], FALSE))), |
131 | 131 | '!thread' => $message['thread_id'], |
132 | 132 | '!user_uid' => $recipient->uid, |
133 | - '!message' => url('messages/view/' . $message['thread_id'], array('absolute' => TRUE, 'language' => $language)), |
|
134 | - '!settings' => url('user/' . $recipient->uid . '/edit', array('absolute' => TRUE, 'language' => $language)), |
|
133 | + '!message' => url('messages/view/'.$message['thread_id'], array('absolute' => TRUE, 'language' => $language)), |
|
134 | + '!settings' => url('user/'.$recipient->uid.'/edit', array('absolute' => TRUE, 'language' => $language)), |
|
135 | 135 | '!boincuser_name' => $recipient->boincuser_name, |
136 | 136 | '!author_boincuser_name' => user_load($message['author']->uid)->boincuser_name, |
137 | 137 | ); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | $form['pm_email'] = array( |
29 | 29 | '#type' => 'fieldset', |
30 | 30 | '#title' => t('Privatemsg e-mail notification'), |
31 | - '#collapsible' => FALSE, |
|
32 | - '#collapsed' => FALSE, |
|
31 | + '#collapsible' => false, |
|
32 | + '#collapsed' => false, |
|
33 | 33 | ); |
34 | 34 | $form['pm_email']['pm_email_notify_default'] = array( |
35 | 35 | '#type' => 'checkbox', |
36 | 36 | '#title' => t('Notify users of new private messages by default'), |
37 | - '#default_value' => variable_get('pm_email_notify_default', TRUE), |
|
37 | + '#default_value' => variable_get('pm_email_notify_default', true), |
|
38 | 38 | '#weight' => 0, |
39 | 39 | ); |
40 | 40 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | // Cache the result set in case this method is executed in batched operation which will perform many unnecessary repeated selects for the same user |
75 | 75 | if ( !isset($notifications[$uid]) ) { |
76 | 76 | $mail_notification = db_result(db_query('SELECT email_notify_is_enabled FROM {pm_email_notify} WHERE user_id = %d', $uid)); |
77 | - if ($mail_notification === FALSE) { |
|
77 | + if ($mail_notification === false) { |
|
78 | 78 | // db_result() returns FALSE if result was not found. |
79 | - $mail_notification = variable_get('pm_email_notify_default', TRUE); |
|
79 | + $mail_notification = variable_get('pm_email_notify_default', true); |
|
80 | 80 | } |
81 | 81 | $notifications[$uid] = $mail_notification; |
82 | 82 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | '!author_uid' => $message['author']->uid, |
128 | 128 | '!author' => $message['author']->name, |
129 | 129 | '!pm_subject' => trim(drupal_html_to_text(check_plain($message['subject']))), |
130 | - '!pm_body' => trim(drupal_html_to_text(check_markup($message['body'], $message['format'], FALSE))), |
|
130 | + '!pm_body' => trim(drupal_html_to_text(check_markup($message['body'], $message['format'], false))), |
|
131 | 131 | '!thread' => $message['thread_id'], |
132 | 132 | '!user_uid' => $recipient->uid, |
133 | - '!message' => url('messages/view/' . $message['thread_id'], array('absolute' => TRUE, 'language' => $language)), |
|
134 | - '!settings' => url('user/' . $recipient->uid . '/edit', array('absolute' => TRUE, 'language' => $language)), |
|
133 | + '!message' => url('messages/view/' . $message['thread_id'], array('absolute' => true, 'language' => $language)), |
|
134 | + '!settings' => url('user/' . $recipient->uid . '/edit', array('absolute' => true, 'language' => $language)), |
|
135 | 135 | '!boincuser_name' => $recipient->boincuser_name, |
136 | 136 | '!author_boincuser_name' => user_load($message['author']->uid)->boincuser_name, |
137 | 137 | ); |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | * |
152 | 152 | * Display settings form and store its information. |
153 | 153 | */ |
154 | -function pm_email_notify_user($op, &$edit, &$account, $category = NULL) { |
|
154 | +function pm_email_notify_user($op, &$edit, &$account, $category = null) { |
|
155 | 155 | switch ($op) { |
156 | 156 | case 'form': |
157 | 157 | if ($category == 'account' && privatemsg_user_access('read privatemsg', $account)) { |
158 | 158 | $form['enable_pm_mail'] = array( |
159 | 159 | '#type' => 'fieldset', |
160 | 160 | '#title' => t('Privatemsg e-mail notification'), |
161 | - '#collapsible' => TRUE, |
|
162 | - '#collapsed' => FALSE, |
|
161 | + '#collapsible' => true, |
|
162 | + '#collapsed' => false, |
|
163 | 163 | '#weight' => 10, |
164 | 164 | ); |
165 | 165 | $form['enable_pm_mail']['pm_send_notifications'] = array( |
@@ -9,45 +9,45 @@ |
||
9 | 9 | * Implements hook_preprocess_author_pane(). |
10 | 10 | */ |
11 | 11 | function privatemsg_preprocess_author_pane(&$variables) { |
12 | - global $user; |
|
13 | - $account = $variables['account']; |
|
14 | - $account_id = $account->uid; |
|
15 | - $account_name = $account->name; |
|
12 | + global $user; |
|
13 | + $account = $variables['account']; |
|
14 | + $account_id = $account->uid; |
|
15 | + $account_name = $account->name; |
|
16 | 16 | |
17 | - if (function_exists('author_pane_api') && author_pane_api() == "2") { |
|
17 | + if (function_exists('author_pane_api') && author_pane_api() == "2") { |
|
18 | 18 | // Author Pane 2.x |
19 | 19 | |
20 | 20 | // Check if this preprocess needs to be run given who's calling it. |
21 | 21 | if (!author_pane_run_preprocess('privatemsg', $variables['caller'])) { |
22 | - return; |
|
22 | + return; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $url = privatemsg_get_link($account); |
26 | 26 | if (!empty($url)) { |
27 | - $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
27 | + $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
28 | 28 | |
29 | - // Early versions of the template used this variable so fill it for |
|
30 | - // backwards compatability. |
|
31 | - $variables['privatemsg_link'] = $variables['privatemsg']; |
|
29 | + // Early versions of the template used this variable so fill it for |
|
30 | + // backwards compatability. |
|
31 | + $variables['privatemsg_link'] = $variables['privatemsg']; |
|
32 | 32 | } |
33 | - } |
|
34 | - else { |
|
33 | + } |
|
34 | + else { |
|
35 | 35 | // Author Pane 1.x |
36 | 36 | |
37 | 37 | $image_path = $variables['image_path']; |
38 | 38 | |
39 | 39 | // Send private message |
40 | 40 | if ($url = privatemsg_get_link($account)) { |
41 | - $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE); |
|
42 | - $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE)); |
|
43 | - $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); |
|
41 | + $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE); |
|
42 | + $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE)); |
|
43 | + $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); |
|
44 | + } |
|
44 | 45 | } |
45 | - } |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Implementation of hook_author_pane_allow_preprocess_disable(). |
50 | 50 | */ |
51 | 51 | function privatemsg_author_pane_allow_preprocess_disable() { |
52 | - return array('privatemsg' => 'Privatemsg'); |
|
52 | + return array('privatemsg' => 'Privatemsg'); |
|
53 | 53 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | $url = privatemsg_get_link($account); |
26 | 26 | if (!empty($url)) { |
27 | - $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
27 | + $variables['privatemsg'] = l('<span>'.t('Send PM').'</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
28 | 28 | |
29 | 29 | // Early versions of the template used this variable so fill it for |
30 | 30 | // backwards compatability. |
@@ -30,8 +30,7 @@ |
||
30 | 30 | // backwards compatability. |
31 | 31 | $variables['privatemsg_link'] = $variables['privatemsg']; |
32 | 32 | } |
33 | - } |
|
34 | - else { |
|
33 | + } else { |
|
35 | 34 | // Author Pane 1.x |
36 | 35 | |
37 | 36 | $image_path = $variables['image_path']; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $url = privatemsg_get_link($account); |
26 | 26 | if (!empty($url)) { |
27 | - $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
27 | + $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => true)); |
|
28 | 28 | |
29 | 29 | // Early versions of the template used this variable so fill it for |
30 | 30 | // backwards compatability. |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | // Send private message |
40 | 40 | if ($url = privatemsg_get_link($account)) { |
41 | - $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE); |
|
42 | - $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE)); |
|
43 | - $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); |
|
41 | + $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), null, true); |
|
42 | + $variables['privatemsg'] = l($img, $url, array('absolute' => true, 'html' => true)); |
|
43 | + $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => true)); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -10,62 +10,62 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class views_handler_field_privatemsg_link extends views_handler_field { |
12 | 12 | |
13 | - /** |
|
14 | - * Add uid as a additional field. |
|
15 | - */ |
|
16 | - function construct() { |
|
13 | + /** |
|
14 | + * Add uid as a additional field. |
|
15 | + */ |
|
16 | + function construct() { |
|
17 | 17 | parent::construct(); |
18 | 18 | $this->additional_fields['uid'] = 'uid'; |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * Define our additional configuration setting. |
|
23 | - */ |
|
24 | - function option_definition() { |
|
21 | + /** |
|
22 | + * Define our additional configuration setting. |
|
23 | + */ |
|
24 | + function option_definition() { |
|
25 | 25 | $options = parent::option_definition(); |
26 | 26 | $options['text'] = array('default' => '', 'translatable' => TRUE); |
27 | 27 | $options['subject'] = array('default' => '', 'translatable' => TRUE); |
28 | 28 | $options['return'] = array('default' => TRUE, 'translatable' => FALSE); |
29 | 29 | return $options; |
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Define the configuration form for our textfield. |
|
34 | - */ |
|
35 | - function options_form(&$form, &$form_state) { |
|
36 | - $form['label'] = array( |
|
37 | - '#type' => 'textfield', |
|
38 | - '#title' => t('Label'), |
|
39 | - '#default_value' => isset($this->options['label']) ? $this->options['label'] : '', |
|
40 | - '#description' => t('The label for this field that will be displayed to end users if the style requires it.'), |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Define the configuration form for our textfield. |
|
34 | + */ |
|
35 | + function options_form(&$form, &$form_state) { |
|
36 | + $form['label'] = array( |
|
37 | + '#type' => 'textfield', |
|
38 | + '#title' => t('Label'), |
|
39 | + '#default_value' => isset($this->options['label']) ? $this->options['label'] : '', |
|
40 | + '#description' => t('The label for this field that will be displayed to end users if the style requires it.'), |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | $form['text'] = array( |
44 | - '#type' => 'textfield', |
|
45 | - '#title' => t('Text to display'), |
|
46 | - '#default_value' => $this->options['text'], |
|
47 | - '#description' => t('Define the text to use for the link title. You can use replacement tokens to insert any existing field output.'), |
|
44 | + '#type' => 'textfield', |
|
45 | + '#title' => t('Text to display'), |
|
46 | + '#default_value' => $this->options['text'], |
|
47 | + '#description' => t('Define the text to use for the link title. You can use replacement tokens to insert any existing field output.'), |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | $form['subject'] = array( |
51 | - '#type' => 'textfield', |
|
52 | - '#title' => t('Pre-filled subject'), |
|
53 | - '#default_value' => $this->options['subject'], |
|
54 | - '#description' => t('Define the subject that will be pre-filled in the send message form. You can use replacement tokens to insert any existing field output.'), |
|
51 | + '#type' => 'textfield', |
|
52 | + '#title' => t('Pre-filled subject'), |
|
53 | + '#default_value' => $this->options['subject'], |
|
54 | + '#description' => t('Define the subject that will be pre-filled in the send message form. You can use replacement tokens to insert any existing field output.'), |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 | // Get a list of the available fields and arguments for token replacement. |
58 | 58 | $options = array(); |
59 | 59 | foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) { |
60 | - $options[t('Fields')]["[$field]"] = $handler->ui_name(); |
|
61 | - // We only use fields up to (and including) this one. |
|
62 | - if ($field == $this->options['id']) { |
|
60 | + $options[t('Fields')]["[$field]"] = $handler->ui_name(); |
|
61 | + // We only use fields up to (and including) this one. |
|
62 | + if ($field == $this->options['id']) { |
|
63 | 63 | break; |
64 | - } |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | $count = 0; // This lets us prepare the key as we want it printed. |
67 | 67 | foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
68 | - $options[t('Arguments')]['%' . ++$count] = $handler->ui_name(); |
|
68 | + $options[t('Arguments')]['%' . ++$count] = $handler->ui_name(); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -73,81 +73,81 @@ discard block |
||
73 | 73 | $output = t('<p>You must add some additional fields to this display before using this field. These fields may be marked as <em>Exclude from display</em> if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>'); |
74 | 74 | // We have some options, so make a list. |
75 | 75 | if (!empty($options)) { |
76 | - $output = t('<p>The following substitution patterns are available for this display. Use the pattern shown on the left to display the value indicated on the right. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>'); |
|
77 | - foreach (array_keys($options) as $type) { |
|
76 | + $output = t('<p>The following substitution patterns are available for this display. Use the pattern shown on the left to display the value indicated on the right. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>'); |
|
77 | + foreach (array_keys($options) as $type) { |
|
78 | 78 | if (!empty($options[$type])) { |
79 | - $items = array(); |
|
80 | - $title = t(ucwords($type)); |
|
81 | - foreach ($options[$type] as $key => $value) { |
|
79 | + $items = array(); |
|
80 | + $title = t(ucwords($type)); |
|
81 | + foreach ($options[$type] as $key => $value) { |
|
82 | 82 | $items[] = $key .' == '. $value; |
83 | - } |
|
84 | - $output .= theme('item_list', $items, $title); |
|
83 | + } |
|
84 | + $output .= theme('item_list', $items, $title); |
|
85 | + } |
|
85 | 86 | } |
86 | - } |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $form['help'] = array( |
90 | - '#type' => 'markup', |
|
91 | - '#id' => 'views-tokens-help', |
|
92 | - '#value' => '<div><fieldset id="views-tokens-help"><legend>' . t('Replacement patterns') . '</legend>' . $output . '</fieldset></div>', |
|
90 | + '#type' => 'markup', |
|
91 | + '#id' => 'views-tokens-help', |
|
92 | + '#value' => '<div><fieldset id="views-tokens-help"><legend>' . t('Replacement patterns') . '</legend>' . $output . '</fieldset></div>', |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | $form['return'] = array( |
96 | - '#type' => 'checkbox', |
|
97 | - '#title' => t('Return to view after message was sent.'), |
|
98 | - '#default_value' => $this->options['return'], |
|
99 | - '#description' => t('Should the user be redirected back to the current view when the message was sent.'), |
|
96 | + '#type' => 'checkbox', |
|
97 | + '#title' => t('Return to view after message was sent.'), |
|
98 | + '#default_value' => $this->options['return'], |
|
99 | + '#description' => t('Should the user be redirected back to the current view when the message was sent.'), |
|
100 | 100 | ); |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Renders our field, displays a link if the user is allowed to. |
|
105 | - */ |
|
106 | - function render($values) { |
|
103 | + /** |
|
104 | + * Renders our field, displays a link if the user is allowed to. |
|
105 | + */ |
|
106 | + function render($values) { |
|
107 | 107 | if (isset($values->uid)) { |
108 | - $uid = $values->uid; |
|
108 | + $uid = $values->uid; |
|
109 | 109 | } |
110 | 110 | elseif (isset($values->users_uid)) { |
111 | - $uid = $values->users_uid; |
|
111 | + $uid = $values->users_uid; |
|
112 | 112 | } |
113 | 113 | else { |
114 | - return ''; |
|
114 | + return ''; |
|
115 | 115 | } |
116 | 116 | $text = t('Write private message'); |
117 | 117 | if (!empty($this->options['text'])) { |
118 | - $tokens = $this->get_render_tokens($this); |
|
119 | - $text = strip_tags(strtr($this->options['text'], $tokens)); |
|
118 | + $tokens = $this->get_render_tokens($this); |
|
119 | + $text = strip_tags(strtr($this->options['text'], $tokens)); |
|
120 | 120 | } |
121 | 121 | $subject = NULL; |
122 | 122 | if (!empty($this->options['subject'])) { |
123 | - $tokens = $this->get_render_tokens($this); |
|
124 | - $subject = strip_tags(strtr($this->options['subject'], $tokens)); |
|
123 | + $tokens = $this->get_render_tokens($this); |
|
124 | + $subject = strip_tags(strtr($this->options['subject'], $tokens)); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $options = array(); |
128 | 128 | if ($this->options['return']) { |
129 | - $options['query'] = drupal_get_destination(); |
|
129 | + $options['query'] = drupal_get_destination(); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $data = ''; |
133 | 133 | if (($recipient = user_load($uid)) && ($url = privatemsg_get_link(array($recipient), NULL, $subject))) { |
134 | - $data = l($text, $url, $options); |
|
134 | + $data = l($text, $url, $options); |
|
135 | 135 | } |
136 | 136 | return $data; |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Only display the column for users with the appropriate permission. |
|
141 | - */ |
|
142 | - function access() { |
|
139 | + /** |
|
140 | + * Only display the column for users with the appropriate permission. |
|
141 | + */ |
|
142 | + function access() { |
|
143 | 143 | return privatemsg_user_access('write privatemsg'); |
144 | - } |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * Just do some basic checks, don't add "privatemsg_link" as field. |
|
148 | - */ |
|
149 | - function query() { |
|
146 | + /** |
|
147 | + * Just do some basic checks, don't add "privatemsg_link" as field. |
|
148 | + */ |
|
149 | + function query() { |
|
150 | 150 | $this->ensure_my_table(); |
151 | 151 | $this->add_additional_fields(); |
152 | - } |
|
152 | + } |
|
153 | 153 | } |
154 | 154 | \ No newline at end of file |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | $count = 0; // This lets us prepare the key as we want it printed. |
67 | 67 | foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
68 | - $options[t('Arguments')]['%' . ++$count] = $handler->ui_name(); |
|
68 | + $options[t('Arguments')]['%'.++$count] = $handler->ui_name(); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $items = array(); |
80 | 80 | $title = t(ucwords($type)); |
81 | 81 | foreach ($options[$type] as $key => $value) { |
82 | - $items[] = $key .' == '. $value; |
|
82 | + $items[] = $key.' == '.$value; |
|
83 | 83 | } |
84 | 84 | $output .= theme('item_list', $items, $title); |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $form['help'] = array( |
90 | 90 | '#type' => 'markup', |
91 | 91 | '#id' => 'views-tokens-help', |
92 | - '#value' => '<div><fieldset id="views-tokens-help"><legend>' . t('Replacement patterns') . '</legend>' . $output . '</fieldset></div>', |
|
92 | + '#value' => '<div><fieldset id="views-tokens-help"><legend>'.t('Replacement patterns').'</legend>'.$output.'</fieldset></div>', |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | $form['return'] = array( |
@@ -106,11 +106,9 @@ |
||
106 | 106 | function render($values) { |
107 | 107 | if (isset($values->uid)) { |
108 | 108 | $uid = $values->uid; |
109 | - } |
|
110 | - elseif (isset($values->users_uid)) { |
|
109 | + } elseif (isset($values->users_uid)) { |
|
111 | 110 | $uid = $values->users_uid; |
112 | - } |
|
113 | - else { |
|
111 | + } else { |
|
114 | 112 | return ''; |
115 | 113 | } |
116 | 114 | $text = t('Write private message'); |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function option_definition() { |
25 | 25 | $options = parent::option_definition(); |
26 | - $options['text'] = array('default' => '', 'translatable' => TRUE); |
|
27 | - $options['subject'] = array('default' => '', 'translatable' => TRUE); |
|
28 | - $options['return'] = array('default' => TRUE, 'translatable' => FALSE); |
|
26 | + $options['text'] = array('default' => '', 'translatable' => true); |
|
27 | + $options['subject'] = array('default' => '', 'translatable' => true); |
|
28 | + $options['return'] = array('default' => true, 'translatable' => false); |
|
29 | 29 | return $options; |
30 | 30 | } |
31 | 31 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $tokens = $this->get_render_tokens($this); |
119 | 119 | $text = strip_tags(strtr($this->options['text'], $tokens)); |
120 | 120 | } |
121 | - $subject = NULL; |
|
121 | + $subject = null; |
|
122 | 122 | if (!empty($this->options['subject'])) { |
123 | 123 | $tokens = $this->get_render_tokens($this); |
124 | 124 | $subject = strip_tags(strtr($this->options['subject'], $tokens)); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | $data = ''; |
133 | - if (($recipient = user_load($uid)) && ($url = privatemsg_get_link(array($recipient), NULL, $subject))) { |
|
133 | + if (($recipient = user_load($uid)) && ($url = privatemsg_get_link(array($recipient), null, $subject))) { |
|
134 | 134 | $data = l($text, $url, $options); |
135 | 135 | } |
136 | 136 | return $data; |
@@ -5,16 +5,16 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | function privatemsg_views_data() { |
8 | - $data['users']['privatemsg_link'] = array( |
|
8 | + $data['users']['privatemsg_link'] = array( |
|
9 | 9 | 'group' => t('Privatemsg'), |
10 | 10 | 'title' => t('Send message'), |
11 | 11 | 'field' => array( |
12 | - 'title' => t('Send Privatemsg link'), |
|
13 | - 'help' => t('Displays a link to send a private message to a user.'), |
|
14 | - 'handler' => 'views_handler_field_privatemsg_link', |
|
12 | + 'title' => t('Send Privatemsg link'), |
|
13 | + 'help' => t('Displays a link to send a private message to a user.'), |
|
14 | + 'handler' => 'views_handler_field_privatemsg_link', |
|
15 | 15 | ), |
16 | - ); |
|
17 | - return $data; |
|
16 | + ); |
|
17 | + return $data; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | * Implementation of hook_views_handlers(). |
23 | 23 | */ |
24 | 24 | function privatemsg_views_handlers() { |
25 | - return array( |
|
25 | + return array( |
|
26 | 26 | 'info' => array( |
27 | - 'path' => drupal_get_path('module', 'privatemsg') . '/views', |
|
27 | + 'path' => drupal_get_path('module', 'privatemsg') . '/views', |
|
28 | 28 | ), |
29 | 29 | 'handlers' => array( |
30 | - // field handlers |
|
31 | - 'views_handler_field_privatemsg_link' => array( |
|
30 | + // field handlers |
|
31 | + 'views_handler_field_privatemsg_link' => array( |
|
32 | 32 | 'parent' => 'views_handler_field', |
33 | - ), |
|
33 | + ), |
|
34 | 34 | ), |
35 | - ); |
|
35 | + ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | function privatemsg_views_handlers() { |
25 | 25 | return array( |
26 | 26 | 'info' => array( |
27 | - 'path' => drupal_get_path('module', 'privatemsg') . '/views', |
|
27 | + 'path' => drupal_get_path('module', 'privatemsg').'/views', |
|
28 | 28 | ), |
29 | 29 | 'handlers' => array( |
30 | 30 | // field handlers |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | * Names that are already in the list and are excluded |
123 | 123 | */ |
124 | 124 | function hook_privatemsg_sql_autocomplete_alter(&$fragments, $search, $names) { |
125 | - global $user; |
|
126 | - // Extend the query that searches for usernames |
|
125 | + global $user; |
|
126 | + // Extend the query that searches for usernames |
|
127 | 127 | |
128 | - // $fragments is explained in the api documentation in detail |
|
128 | + // $fragments is explained in the api documentation in detail |
|
129 | 129 | |
130 | - // The query is already set up, it's searching for usernames which start with |
|
131 | - // $search and are not $names (may be empty) |
|
132 | - // the main table is {user} a |
|
130 | + // The query is already set up, it's searching for usernames which start with |
|
131 | + // $search and are not $names (may be empty) |
|
132 | + // the main table is {user} a |
|
133 | 133 | |
134 | - // for example, add a join on a table where the user connections are stored |
|
135 | - // and specify that only users connected with the current user should be |
|
136 | - // loaded. |
|
137 | - $fragments['inner_join'] = 'INNER JOIN {my_table} m ON (m.user1 = u.uid AND m.user2 = %d)'; |
|
138 | - $fragments['query_args'][] = $user->uid; |
|
134 | + // for example, add a join on a table where the user connections are stored |
|
135 | + // and specify that only users connected with the current user should be |
|
136 | + // loaded. |
|
137 | + $fragments['inner_join'] = 'INNER JOIN {my_table} m ON (m.user1 = u.uid AND m.user2 = %d)'; |
|
138 | + $fragments['query_args'][] = $user->uid; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * Query fragments array. |
158 | 158 | * @param $pmid |
159 | 159 | * the id of the message. |
160 | - * @param $account |
|
160 | + * @param $account |
|
161 | 161 | * User object of account for which to load the message. |
162 | 162 | */ |
163 | 163 | function hook_privatemsg_sql_load_alter(&$fragments, $pmid, $account = NULL) { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * Message array |
275 | 275 | */ |
276 | 276 | function hook_privatemsg_message_load($message) { |
277 | - return array('my_key' => 'my_value'); |
|
277 | + return array('my_key' => 'my_value'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -302,17 +302,17 @@ discard block |
||
302 | 302 | * Message array |
303 | 303 | */ |
304 | 304 | function hook_privatemsg_message_validate($message, $form = FALSE) { |
305 | - global $_privatemsg_invalid_recipients; |
|
306 | - $_privatemsg_invalid_recipients = array(); |
|
305 | + global $_privatemsg_invalid_recipients; |
|
306 | + $_privatemsg_invalid_recipients = array(); |
|
307 | 307 | |
308 | - $errors = array(); |
|
308 | + $errors = array(); |
|
309 | 309 | |
310 | - foreach ($message['recipients'] as $recipient) { |
|
310 | + foreach ($message['recipients'] as $recipient) { |
|
311 | 311 | if ($recipient->name == 'blocked user') { |
312 | - $_privatemsg_invalid_recipients[] = $recipient->uid; |
|
313 | - $errors[] = t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipient->name)); |
|
312 | + $_privatemsg_invalid_recipients[] = $recipient->uid; |
|
313 | + $errors[] = t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipient->name)); |
|
314 | + } |
|
314 | 315 | } |
315 | - } |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -325,11 +325,11 @@ discard block |
||
325 | 325 | * Message array |
326 | 326 | */ |
327 | 327 | function hook_privatemsg_message_presave_alter(&$message) { |
328 | - // delete recipients which have been marked as invalid |
|
329 | - global $_privatemsg_invalid_recipients; |
|
330 | - foreach ($_privatemsg_invalid_recipients as $invalid) { |
|
328 | + // delete recipients which have been marked as invalid |
|
329 | + global $_privatemsg_invalid_recipients; |
|
330 | + foreach ($_privatemsg_invalid_recipients as $invalid) { |
|
331 | 331 | unset($message['recipients'][$invalid]); |
332 | - } |
|
332 | + } |
|
333 | 333 | } |
334 | 334 | /** |
335 | 335 | * Act on the $vars before a message is displayed. |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * Template variables |
342 | 342 | */ |
343 | 343 | function hook_privatemsg_message_view_alter(&$var) { |
344 | - // add a link to each message |
|
345 | - $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'. $vars['message']['mid']); |
|
344 | + // add a link to each message |
|
345 | + $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'. $vars['message']['mid']); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * Message array |
356 | 356 | */ |
357 | 357 | function hook_privatemsg_message_insert($message) { |
358 | - _mymodule_save_data($message['mid']); |
|
358 | + _mymodule_save_data($message['mid']); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
@@ -384,41 +384,41 @@ discard block |
||
384 | 384 | * message (The reason why the recipient has been blocked). |
385 | 385 | */ |
386 | 386 | function hook_privatemsg_block_message($author, $recipients) { |
387 | - $blocked = array(); |
|
388 | - // Loop through each recipient and ensure there is no rule blocking this |
|
389 | - // author from sending them private messages. Use a reference, so when |
|
390 | - // user_load() is needed here the array is updated, negating the need for |
|
391 | - // further calls to user_load() later in the code. |
|
392 | - foreach (array_keys($recipients) as $uid) { |
|
387 | + $blocked = array(); |
|
388 | + // Loop through each recipient and ensure there is no rule blocking this |
|
389 | + // author from sending them private messages. Use a reference, so when |
|
390 | + // user_load() is needed here the array is updated, negating the need for |
|
391 | + // further calls to user_load() later in the code. |
|
392 | + foreach (array_keys($recipients) as $uid) { |
|
393 | 393 | |
394 | 394 | // Ensure we have a recipient user object which includes roles. |
395 | 395 | if (!isset($recipients[$uid]->roles)) { |
396 | - $recipients[$uid] = user_load($uid); |
|
396 | + $recipients[$uid] = user_load($uid); |
|
397 | 397 | } |
398 | 398 | // Note: this is checked whether the author may send the message (see third |
399 | 399 | // parameter). Further below is a check whether the recipient may block it. |
400 | 400 | if (_pm_block_user_rule_exists($author, $recipients[$uid], PM_BLOCK_USER_DISALLOW_SENDING)) { |
401 | - $blocked[] = array( |
|
401 | + $blocked[] = array( |
|
402 | 402 | 'uid' => $uid, |
403 | 403 | 'message' => t('Sorry, private messaging rules forbid sending messages to !name.', array('!name' => $recipients[$uid]->name)), |
404 | - ); |
|
404 | + ); |
|
405 | + } |
|
405 | 406 | } |
406 | - } |
|
407 | 407 | |
408 | - $args = array_merge(array($author->uid), array_keys($recipients)); |
|
409 | - $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args); |
|
410 | - while ($row = db_fetch_array($result)) { |
|
408 | + $args = array_merge(array($author->uid), array_keys($recipients)); |
|
409 | + $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args); |
|
410 | + while ($row = db_fetch_array($result)) { |
|
411 | 411 | $recipient = $recipients[$row['recipient']]; |
412 | 412 | // If there's a rule disallowing blocking of this message, send it anyway. |
413 | 413 | if (_pm_block_user_rule_exists($author, $recipient, PM_BLOCK_USER_DISALLOW_BLOCKING)) { |
414 | - continue; |
|
414 | + continue; |
|
415 | 415 | } |
416 | 416 | $blocked[] = array( |
417 | - 'uid' => $row['recipient'], |
|
418 | - 'message' => t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipients[$row['recipient']]->name)) |
|
417 | + 'uid' => $row['recipient'], |
|
418 | + 'message' => t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipients[$row['recipient']]->name)) |
|
419 | 419 | ); |
420 | - } |
|
421 | - return $blocked; |
|
420 | + } |
|
421 | + return $blocked; |
|
422 | 422 | } |
423 | 423 | /** |
424 | 424 | * Add content to the view thread page. |
@@ -452,16 +452,16 @@ discard block |
||
452 | 452 | * @see privatemsg_list_submit() |
453 | 453 | */ |
454 | 454 | function hook_privatemsg_thread_operations() { |
455 | - return array( |
|
455 | + return array( |
|
456 | 456 | 'operation key' => array( |
457 | - 'label' => 'Label of the operation. Only use this if the operation |
|
457 | + 'label' => 'Label of the operation. Only use this if the operation |
|
458 | 458 | should be displayed automatically in the action form', |
459 | - 'callback' => 'privatemsg_thread_change_status', // Function callback that will be executed. |
|
460 | - 'callback arguments' => array('status' => PRIVATEMSG_READ), // Additional arguments to above function |
|
461 | - 'undo callback' => 'privatemsg_thread_change_status', // Provide a function which can "undo" the operation. Optional. |
|
462 | - 'undo callback arguments' => array('status' => PRIVATEMSG_UNREAD), // Additional arguments to above function. |
|
459 | + 'callback' => 'privatemsg_thread_change_status', // Function callback that will be executed. |
|
460 | + 'callback arguments' => array('status' => PRIVATEMSG_READ), // Additional arguments to above function |
|
461 | + 'undo callback' => 'privatemsg_thread_change_status', // Provide a function which can "undo" the operation. Optional. |
|
462 | + 'undo callback arguments' => array('status' => PRIVATEMSG_UNREAD), // Additional arguments to above function. |
|
463 | 463 | ), |
464 | - ); |
|
464 | + ); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | * up the string. |
475 | 475 | */ |
476 | 476 | function hook_privatemsg_name_lookup($string) { |
477 | - if ((int)$string > 0) { |
|
477 | + if ((int)$string > 0) { |
|
478 | 478 | // This is a possible uid, try to load a matching user. |
479 | 479 | if ($recipient = user_load(array('uid' => $string))) { |
480 | - return $recipient; |
|
480 | + return $recipient; |
|
481 | + } |
|
481 | 482 | } |
482 | - } |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function hook_privatemsg_message_view_alter(&$var) { |
344 | 344 | // add a link to each message |
345 | - $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'. $vars['message']['mid']); |
|
345 | + $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'.$vars['message']['mid']); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | } |
407 | 407 | |
408 | 408 | $args = array_merge(array($author->uid), array_keys($recipients)); |
409 | - $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args); |
|
409 | + $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('.db_placeholders($recipients).') GROUP BY recipient', $args); |
|
410 | 410 | while ($row = db_fetch_array($result)) { |
411 | 411 | $recipient = $recipients[$row['recipient']]; |
412 | 412 | // If there's a rule disallowing blocking of this message, send it anyway. |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | should be displayed automatically in the action form', |
459 | 459 | 'callback' => 'privatemsg_thread_change_status', // Function callback that will be executed. |
460 | 460 | 'callback arguments' => array('status' => PRIVATEMSG_READ), // Additional arguments to above function |
461 | - 'undo callback' => 'privatemsg_thread_change_status', // Provide a function which can "undo" the operation. Optional. |
|
461 | + 'undo callback' => 'privatemsg_thread_change_status', // Provide a function which can "undo" the operation. Optional. |
|
462 | 462 | 'undo callback arguments' => array('status' => PRIVATEMSG_UNREAD), // Additional arguments to above function. |
463 | 463 | ), |
464 | 464 | ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param $account |
161 | 161 | * User object of account for which to load the message. |
162 | 162 | */ |
163 | -function hook_privatemsg_sql_load_alter(&$fragments, $pmid, $account = NULL) { |
|
163 | +function hook_privatemsg_sql_load_alter(&$fragments, $pmid, $account = null) { |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param $load_all |
177 | 177 | * Deleted messages are only loaded if this is set to TRUE. |
178 | 178 | */ |
179 | -function hook_privatemsg_sql_messages_alter(&$fragments, $threads, $account = NULL, $load_all = FALSE) { |
|
179 | +function hook_privatemsg_sql_messages_alter(&$fragments, $threads, $account = null, $load_all = false) { |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @param $message |
302 | 302 | * Message array |
303 | 303 | */ |
304 | -function hook_privatemsg_message_validate($message, $form = FALSE) { |
|
304 | +function hook_privatemsg_message_validate($message, $form = false) { |
|
305 | 305 | global $_privatemsg_invalid_recipients; |
306 | 306 | $_privatemsg_invalid_recipients = array(); |
307 | 307 |
@@ -9,39 +9,39 @@ discard block |
||
9 | 9 | * Display a list of tags to administer them. |
10 | 10 | */ |
11 | 11 | function privatemsg_tags_admin() { |
12 | - drupal_set_title(t('Tags')); |
|
12 | + drupal_set_title(t('Tags')); |
|
13 | 13 | |
14 | - $header = array( |
|
14 | + $header = array( |
|
15 | 15 | 'tag' => array( |
16 | - 'data' => t('Tag'), |
|
17 | - 'field' => 'tag', |
|
18 | - 'class' => 'privatemsg-filter-header-tag', |
|
19 | - 'sort' => 'asc', |
|
20 | - '#weight' => -40, |
|
16 | + 'data' => t('Tag'), |
|
17 | + 'field' => 'tag', |
|
18 | + 'class' => 'privatemsg-filter-header-tag', |
|
19 | + 'sort' => 'asc', |
|
20 | + '#weight' => -40, |
|
21 | 21 | ), |
22 | 22 | 'usage' => array( |
23 | - 'data' => t('Usage'), |
|
24 | - 'field' => 'count', |
|
25 | - 'class' => 'privatemsg-filter-header-usage', |
|
26 | - '#weight' => -30, |
|
23 | + 'data' => t('Usage'), |
|
24 | + 'field' => 'count', |
|
25 | + 'class' => 'privatemsg-filter-header-usage', |
|
26 | + '#weight' => -30, |
|
27 | 27 | ), |
28 | 28 | 'public' => array( |
29 | - 'data' => t('Public'), |
|
30 | - 'field' => 'public', |
|
31 | - 'class' => 'privatemsg-filter-header-public', |
|
32 | - '#weight' => -20, |
|
29 | + 'data' => t('Public'), |
|
30 | + 'field' => 'public', |
|
31 | + 'class' => 'privatemsg-filter-header-public', |
|
32 | + '#weight' => -20, |
|
33 | 33 | ), |
34 | 34 | 'operations' => array( |
35 | - 'data' => t('Operations'), |
|
36 | - 'class' => 'privatemsg-filter-header-operations', |
|
37 | - '#weight' => -10, |
|
35 | + 'data' => t('Operations'), |
|
36 | + 'class' => 'privatemsg-filter-header-operations', |
|
37 | + '#weight' => -10, |
|
38 | 38 | ), |
39 | - ); |
|
40 | - $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter')); |
|
41 | - $result = pager_query($query['query'] . tablesort_sql($header), 100); |
|
39 | + ); |
|
40 | + $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter')); |
|
41 | + $result = pager_query($query['query'] . tablesort_sql($header), 100); |
|
42 | 42 | |
43 | - $rows = array(); |
|
44 | - while ($tag = db_fetch_array($result)) { |
|
43 | + $rows = array(); |
|
44 | + while ($tag = db_fetch_array($result)) { |
|
45 | 45 | $row = array(); |
46 | 46 | $row['tag'] = check_plain($tag['tag']); |
47 | 47 | $row['count'] = $tag['count']; |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | $row['operations'] .= ' ' . l(t('delete'), 'admin/settings/messages/tags/delete/' . $tag['tag_id']); |
51 | 51 | |
52 | 52 | $rows[] = $row; |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - if (empty($rows)) { |
|
55 | + if (empty($rows)) { |
|
56 | 56 | // Display a message if now tags are available. |
57 | 57 | $rows[] = array(array('data' => t('No tags available.'), 'colspan' => count($header))); |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | - return theme('table', $header, $rows) . theme('pager'); |
|
60 | + return theme('table', $header, $rows) . theme('pager'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -70,36 +70,36 @@ discard block |
||
70 | 70 | * new tag form. |
71 | 71 | */ |
72 | 72 | function privatemsg_tags_form(&$form_state, $tag_id = NULL) { |
73 | - $form = array(); |
|
73 | + $form = array(); |
|
74 | 74 | |
75 | - if ($tag_id) { |
|
75 | + if ($tag_id) { |
|
76 | 76 | $tag = db_fetch_array(db_query('SELECT * from {pm_tags} pmt WHERE pmt.tag_id = %d', $tag_id)); |
77 | 77 | $form['tag_id'] = array( |
78 | - '#value' => $tag_id, |
|
79 | - '#type' => 'value', |
|
78 | + '#value' => $tag_id, |
|
79 | + '#type' => 'value', |
|
80 | 80 | ); |
81 | 81 | drupal_set_title(t('Edit @tag', array('@tag' => $tag['tag']))); |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | - $form['tag'] = array( |
|
84 | + $form['tag'] = array( |
|
85 | 85 | '#title' => t('Name'), |
86 | 86 | '#type' => 'textfield', |
87 | 87 | '#default_value' => empty($tag_id) ? NULL : $tag['tag'], |
88 | - ); |
|
88 | + ); |
|
89 | 89 | |
90 | - $form['public'] = array( |
|
90 | + $form['public'] = array( |
|
91 | 91 | '#title' => t('Public'), |
92 | 92 | '#type' => 'checkbox', |
93 | 93 | '#default_value' => empty($tag_id) ? TRUE : $tag['public'], |
94 | 94 | '#description' => t('Public tags are visible for all users, private tags are only visible if they use them.'), |
95 | - ); |
|
95 | + ); |
|
96 | 96 | |
97 | - $form['submit'] = array( |
|
97 | + $form['submit'] = array( |
|
98 | 98 | '#value' => empty($tag_id) ? t('Create tag') : t('Save tag'), |
99 | 99 | '#type' => 'submit', |
100 | - ); |
|
100 | + ); |
|
101 | 101 | |
102 | - return $form; |
|
102 | + return $form; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -108,34 +108,34 @@ discard block |
||
108 | 108 | * Make sure that a tag name is unique. |
109 | 109 | */ |
110 | 110 | function privatemsg_tags_form_validate($form, &$form_state) { |
111 | - $tag_id = isset($form_state['values']['tag_id']) ? $form_state['values']['tag_id'] : 0; |
|
112 | - if ($tag_id) { |
|
111 | + $tag_id = isset($form_state['values']['tag_id']) ? $form_state['values']['tag_id'] : 0; |
|
112 | + if ($tag_id) { |
|
113 | 113 | // We are editing an existing tag, exclude the current tag from the search. |
114 | 114 | $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s' AND tag_id <> %d", $form_state['values']['tag'], $tag_id)); |
115 | - } |
|
116 | - else { |
|
115 | + } |
|
116 | + else { |
|
117 | 117 | $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s'", $form_state['values']['tag'])); |
118 | - } |
|
119 | - if ($exists) { |
|
118 | + } |
|
119 | + if ($exists) { |
|
120 | 120 | form_set_error('tag', t('Tag already exists, choose a different name.')); |
121 | - } |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Form submit handler for add/edit forms. |
126 | 126 | */ |
127 | 127 | function privatemsg_tags_form_submit($form, &$form_state) { |
128 | - if (!empty($form_state['values']['tag_id'])) { |
|
128 | + if (!empty($form_state['values']['tag_id'])) { |
|
129 | 129 | // Tag already exists, update the existing tag. |
130 | 130 | db_query("UPDATE {pm_tags} SET tag = '%s', public = %d WHERE tag_id = %d", $form_state['values']['tag'], $form_state['values']['public'], $form_state['values']['tag_id']); |
131 | 131 | drupal_set_message(t('Tag updated.')); |
132 | 132 | $form_state['redirect'] = 'admin/settings/messages/tags'; |
133 | - } |
|
134 | - else { |
|
133 | + } |
|
134 | + else { |
|
135 | 135 | // Tag does not yet exist, create a new one. |
136 | 136 | db_query("INSERT INTO {pm_tags} (tag, public) VALUES ('%s', %d)", $form_state['values']['tag'], $form_state['values']['public']); |
137 | 137 | drupal_set_message(t('Tag created.')); |
138 | - } |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -145,28 +145,28 @@ discard block |
||
145 | 145 | * Id of the tag that should be deleted. |
146 | 146 | */ |
147 | 147 | function privatemsg_filter_tags_delete(&$form_state, $tag_id) { |
148 | - $form['tag_id'] = array( |
|
148 | + $form['tag_id'] = array( |
|
149 | 149 | '#type' => 'value', |
150 | 150 | '#value' => $tag_id, |
151 | - ); |
|
152 | - return confirm_form($form, |
|
151 | + ); |
|
152 | + return confirm_form($form, |
|
153 | 153 | t('Are you sure you want to delete?'), |
154 | 154 | isset($_GET['destination']) ? $_GET['destination'] : 'admin/settings/messages/tags', |
155 | 155 | t('This action cannot be undone.'), |
156 | 156 | t('Delete'), |
157 | 157 | t('Cancel') |
158 | - ); |
|
158 | + ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Submit handler for the confirm delete form. |
163 | 163 | */ |
164 | 164 | function privatemsg_filter_tags_delete_submit($form, &$form_state) { |
165 | - if ($form_state['values']['confirm']) { |
|
165 | + if ($form_state['values']['confirm']) { |
|
166 | 166 | db_query('DELETE FROM {pm_tags} WHERE tag_id = %d', $form_state['values']['tag_id']); |
167 | 167 | db_query('DELETE FROM {pm_tags_index} WHERE tag_id = %d', $form_state['values']['tag_id']); |
168 | 168 | |
169 | 169 | drupal_set_message(t('Tag has been deleted')); |
170 | - } |
|
171 | - $form_state['redirect'] = 'admin/settings/messages/tags'; |
|
170 | + } |
|
171 | + $form_state['redirect'] = 'admin/settings/messages/tags'; |
|
172 | 172 | } |
173 | 173 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ), |
39 | 39 | ); |
40 | 40 | $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter')); |
41 | - $result = pager_query($query['query'] . tablesort_sql($header), 100); |
|
41 | + $result = pager_query($query['query'].tablesort_sql($header), 100); |
|
42 | 42 | |
43 | 43 | $rows = array(); |
44 | 44 | while ($tag = db_fetch_array($result)) { |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $row['tag'] = check_plain($tag['tag']); |
47 | 47 | $row['count'] = $tag['count']; |
48 | 48 | $row['public'] = $tag['public'] ? t('Yes') : '-'; |
49 | - $row['operations'] = l(t('edit'), 'admin/settings/messages/tags/edit/' . $tag['tag_id']); |
|
50 | - $row['operations'] .= ' ' . l(t('delete'), 'admin/settings/messages/tags/delete/' . $tag['tag_id']); |
|
49 | + $row['operations'] = l(t('edit'), 'admin/settings/messages/tags/edit/'.$tag['tag_id']); |
|
50 | + $row['operations'] .= ' '.l(t('delete'), 'admin/settings/messages/tags/delete/'.$tag['tag_id']); |
|
51 | 51 | |
52 | 52 | $rows[] = $row; |
53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $rows[] = array(array('data' => t('No tags available.'), 'colspan' => count($header))); |
58 | 58 | } |
59 | 59 | |
60 | - return theme('table', $header, $rows) . theme('pager'); |
|
60 | + return theme('table', $header, $rows).theme('pager'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -112,8 +112,7 @@ discard block |
||
112 | 112 | if ($tag_id) { |
113 | 113 | // We are editing an existing tag, exclude the current tag from the search. |
114 | 114 | $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s' AND tag_id <> %d", $form_state['values']['tag'], $tag_id)); |
115 | - } |
|
116 | - else { |
|
115 | + } else { |
|
117 | 116 | $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s'", $form_state['values']['tag'])); |
118 | 117 | } |
119 | 118 | if ($exists) { |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | db_query("UPDATE {pm_tags} SET tag = '%s', public = %d WHERE tag_id = %d", $form_state['values']['tag'], $form_state['values']['public'], $form_state['values']['tag_id']); |
131 | 130 | drupal_set_message(t('Tag updated.')); |
132 | 131 | $form_state['redirect'] = 'admin/settings/messages/tags'; |
133 | - } |
|
134 | - else { |
|
132 | + } else { |
|
135 | 133 | // Tag does not yet exist, create a new one. |
136 | 134 | db_query("INSERT INTO {pm_tags} (tag, public) VALUES ('%s', %d)", $form_state['values']['tag'], $form_state['values']['public']); |
137 | 135 | drupal_set_message(t('Tag created.')); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * Tag Id if an edit form should be displayed, NULL for a create |
70 | 70 | * new tag form. |
71 | 71 | */ |
72 | -function privatemsg_tags_form(&$form_state, $tag_id = NULL) { |
|
72 | +function privatemsg_tags_form(&$form_state, $tag_id = null) { |
|
73 | 73 | $form = array(); |
74 | 74 | |
75 | 75 | if ($tag_id) { |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | $form['tag'] = array( |
85 | 85 | '#title' => t('Name'), |
86 | 86 | '#type' => 'textfield', |
87 | - '#default_value' => empty($tag_id) ? NULL : $tag['tag'], |
|
87 | + '#default_value' => empty($tag_id) ? null : $tag['tag'], |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | $form['public'] = array( |
91 | 91 | '#title' => t('Public'), |
92 | 92 | '#type' => 'checkbox', |
93 | - '#default_value' => empty($tag_id) ? TRUE : $tag['public'], |
|
93 | + '#default_value' => empty($tag_id) ? true : $tag['public'], |
|
94 | 94 | '#description' => t('Public tags are visible for all users, private tags are only visible if they use them.'), |
95 | 95 | ); |
96 | 96 |