@@ -10,83 +10,83 @@ discard block |
||
10 | 10 | * Themes the add link. |
11 | 11 | */ |
12 | 12 | function theme_content_profile_display_add_link($element) { |
13 | - $type = $element['#content_type']; |
|
14 | - $uid = $element['#admin'] ? 'uid='. intval($element['#uid']) .'&' : ''; |
|
15 | - $text = t($element['#admin'] ? "Create the user's @profile_node." : "Create your @profile_node.", array('@profile_node' => node_get_types('name', $type))); |
|
16 | - return l($text, content_profile_get_add_path($type, $element['#uid']), array('query' => $uid . drupal_get_destination(), 'html' => TRUE)); |
|
13 | + $type = $element['#content_type']; |
|
14 | + $uid = $element['#admin'] ? 'uid='. intval($element['#uid']) .'&' : ''; |
|
15 | + $text = t($element['#admin'] ? "Create the user's @profile_node." : "Create your @profile_node.", array('@profile_node' => node_get_types('name', $type))); |
|
16 | + return l($text, content_profile_get_add_path($type, $element['#uid']), array('query' => $uid . drupal_get_destination(), 'html' => TRUE)); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Theme function for the content_profile display as link |
21 | 21 | */ |
22 | 22 | function theme_content_profile_display_link($element) { |
23 | - if ($node = content_profile_load($element['#content_type'], $element['#uid'])) { |
|
23 | + if ($node = content_profile_load($element['#content_type'], $element['#uid'])) { |
|
24 | 24 | if (node_access('view', $node)) { |
25 | - $output = l(node_get_types('name', $node->type), 'node/'. $node->nid); |
|
26 | - if ($element['#edit_link'] && node_access('update', $node)) { |
|
25 | + $output = l(node_get_types('name', $node->type), 'node/'. $node->nid); |
|
26 | + if ($element['#edit_link'] && node_access('update', $node)) { |
|
27 | 27 | $output .= ' '. l('['. t('edit') .']', content_profile_get_edit_path($node), array('query' => drupal_get_destination())); |
28 | - } |
|
29 | - return $output; |
|
28 | + } |
|
29 | + return $output; |
|
30 | + } |
|
30 | 31 | } |
31 | - } |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Implementation of content_profile_preprocess_HOOK() |
36 | 36 | */ |
37 | 37 | function content_profile_preprocess_content_profile_display_view(&$variables) { |
38 | - $element = $variables['element']; |
|
39 | - $node = content_profile_load($element['#content_type'], $element['#uid']); |
|
40 | - $variables['node'] = &$node; |
|
41 | - $variables['uid'] = $element['#uid']; |
|
42 | - $variables['type'] = $element['#content_type']; |
|
38 | + $element = $variables['element']; |
|
39 | + $node = content_profile_load($element['#content_type'], $element['#uid']); |
|
40 | + $variables['node'] = &$node; |
|
41 | + $variables['uid'] = $element['#uid']; |
|
42 | + $variables['type'] = $element['#content_type']; |
|
43 | 43 | |
44 | - $path = drupal_get_path('module', 'content_profile') .'/content_profile.css'; |
|
45 | - drupal_add_css($path, 'module', 'all', FALSE); |
|
44 | + $path = drupal_get_path('module', 'content_profile') .'/content_profile.css'; |
|
45 | + drupal_add_css($path, 'module', 'all', FALSE); |
|
46 | 46 | |
47 | - $variables['title'] = check_plain(node_get_types('name', $node->type)); |
|
47 | + $variables['title'] = check_plain(node_get_types('name', $node->type)); |
|
48 | 48 | |
49 | - $tabs = array(); |
|
50 | - if ($element['#edit_link']) { |
|
49 | + $tabs = array(); |
|
50 | + if ($element['#edit_link']) { |
|
51 | 51 | $tabs[] = theme('content_profile_display_tab_view', $node); |
52 | 52 | $tabs[] = theme('content_profile_display_tab_edit', $node); |
53 | - } |
|
54 | - if (count($tabs) > 0) { |
|
53 | + } |
|
54 | + if (count($tabs) > 0) { |
|
55 | 55 | $variables['tabs'] = $tabs; |
56 | - } |
|
57 | - $variables['content'] = node_view($node, ($element['#style'] == 'teaser'), TRUE, TRUE); |
|
56 | + } |
|
57 | + $variables['content'] = node_view($node, ($element['#style'] == 'teaser'), TRUE, TRUE); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Themes the view tab |
62 | 62 | */ |
63 | 63 | function theme_content_profile_display_tab_view($node) { |
64 | - return l(t('View'), 'node/'. $node->nid); |
|
64 | + return l(t('View'), 'node/'. $node->nid); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Themes the edit tab |
69 | 69 | */ |
70 | 70 | function theme_content_profile_display_tab_edit($node) { |
71 | - if (node_access('update', $node)) { |
|
71 | + if (node_access('update', $node)) { |
|
72 | 72 | return l(t('Edit'), content_profile_get_edit_path($node), array('query' => drupal_get_destination())); |
73 | - } |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Gets the edit path for a content_profile |
78 | 78 | */ |
79 | 79 | function content_profile_get_edit_path($node) { |
80 | - $handler = variable_get('content_profile_path_handler', 'content_profile_default_path_handler'); |
|
81 | - return $handler('edit', $node, $node->uid); |
|
80 | + $handler = variable_get('content_profile_path_handler', 'content_profile_default_path_handler'); |
|
81 | + return $handler('edit', $node, $node->uid); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Gets the add path for a content_profile of the active user |
86 | 86 | */ |
87 | 87 | function content_profile_get_add_path($type, $uid) { |
88 | - $handler = variable_get('content_profile_path_handler', 'content_profile_default_path_handler'); |
|
89 | - return $handler('add', $type, $uid); |
|
88 | + $handler = variable_get('content_profile_path_handler', 'content_profile_default_path_handler'); |
|
89 | + return $handler('add', $type, $uid); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | * @param $uid the uid of the profile's owner. |
98 | 98 | */ |
99 | 99 | function content_profile_default_path_handler($action, $arg, $uid) { |
100 | - $type = $action == 'add' ? $arg : $arg->type; |
|
101 | - if (content_profile_get_settings($type, 'edit_tab') == 'top') { |
|
100 | + $type = $action == 'add' ? $arg : $arg->type; |
|
101 | + if (content_profile_get_settings($type, 'edit_tab') == 'top') { |
|
102 | 102 | return 'user/'. $uid . '/profile/'. $type; |
103 | - } |
|
104 | - elseif (content_profile_get_settings($type, 'edit_tab') == 'sub') { |
|
103 | + } |
|
104 | + elseif (content_profile_get_settings($type, 'edit_tab') == 'sub') { |
|
105 | 105 | return 'user/'. $uid . '/edit/'. $type; |
106 | - } |
|
107 | - elseif ($action == 'add') { |
|
106 | + } |
|
107 | + elseif ($action == 'add') { |
|
108 | 108 | return 'node/add/'. str_replace('_', '-', $arg); |
109 | - } |
|
110 | - else { |
|
109 | + } |
|
110 | + else { |
|
111 | 111 | return 'node/'. $arg->nid .'/edit'; |
112 | - } |
|
112 | + } |
|
113 | 113 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 |
@@ -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 |
@@ -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 | /** |
@@ -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 |