@@ -10,103 +10,103 @@ |
||
10 | 10 | * no profile. |
11 | 11 | */ |
12 | 12 | function content_profile_rules_defaults() { |
13 | - $types = array_keys(content_profile_get_types('names')); |
|
14 | - $type = array_shift($types); |
|
15 | - $config = |
|
13 | + $types = array_keys(content_profile_get_types('names')); |
|
14 | + $type = array_shift($types); |
|
15 | + $config = |
|
16 | 16 | array ( |
17 | - 'rules' => |
|
18 | - array ( |
|
17 | + 'rules' => |
|
18 | + array ( |
|
19 | 19 | 'content_profile_rule_1' => |
20 | 20 | array ( |
21 | - '#type' => 'rule', |
|
22 | - '#set' => 'event_user_login', |
|
23 | - '#label' => 'Redirect to profile creation page, if users have no profile.', |
|
24 | - '#active' => 0, |
|
25 | - '#weight' => '0', |
|
26 | - '#conditions' => |
|
27 | - array ( |
|
21 | + '#type' => 'rule', |
|
22 | + '#set' => 'event_user_login', |
|
23 | + '#label' => 'Redirect to profile creation page, if users have no profile.', |
|
24 | + '#active' => 0, |
|
25 | + '#weight' => '0', |
|
26 | + '#conditions' => |
|
27 | + array ( |
|
28 | 28 | 0 => |
29 | 29 | array ( |
30 | - '#negate' => 1, |
|
31 | - '#weight' => 0, |
|
32 | - '#info' => |
|
33 | - array ( |
|
30 | + '#negate' => 1, |
|
31 | + '#weight' => 0, |
|
32 | + '#info' => |
|
33 | + array ( |
|
34 | 34 | 'label' => 'Logged in user has his Profile created', |
35 | 35 | 'arguments' => |
36 | 36 | array ( |
37 | - 'user' => |
|
38 | - array ( |
|
37 | + 'user' => |
|
38 | + array ( |
|
39 | 39 | 'type' => 'user', |
40 | 40 | 'label' => 'User', |
41 | - ), |
|
41 | + ), |
|
42 | 42 | ), |
43 | 43 | 'module' => 'Content Profile', |
44 | - ), |
|
45 | - '#name' => 'content_profile_user_has_profile_condition', |
|
46 | - '#settings' => |
|
47 | - array ( |
|
44 | + ), |
|
45 | + '#name' => 'content_profile_user_has_profile_condition', |
|
46 | + '#settings' => |
|
47 | + array ( |
|
48 | 48 | 'type' => $type, |
49 | 49 | '#argument map' => |
50 | 50 | array ( |
51 | - 'account' => 'user', |
|
51 | + 'account' => 'user', |
|
52 | 52 | ), |
53 | - ), |
|
54 | - '#type' => 'condition', |
|
53 | + ), |
|
54 | + '#type' => 'condition', |
|
55 | + ), |
|
55 | 56 | ), |
56 | - ), |
|
57 | - '#actions' => |
|
58 | - array ( |
|
57 | + '#actions' => |
|
58 | + array ( |
|
59 | 59 | 0 => |
60 | 60 | array ( |
61 | - '#type' => 'action', |
|
62 | - '#settings' => |
|
63 | - array ( |
|
61 | + '#type' => 'action', |
|
62 | + '#settings' => |
|
63 | + array ( |
|
64 | 64 | 'path' => 'node/add/'. str_replace('_', '-', $type), |
65 | 65 | 'query' => '', |
66 | 66 | 'fragment' => '', |
67 | 67 | 'force' => 1, |
68 | 68 | 'override' => 1, |
69 | - ), |
|
70 | - '#name' => 'rules_action_drupal_goto', |
|
71 | - '#info' => |
|
72 | - array ( |
|
69 | + ), |
|
70 | + '#name' => 'rules_action_drupal_goto', |
|
71 | + '#info' => |
|
72 | + array ( |
|
73 | 73 | 'label' => 'Redirect to profile creation page', |
74 | 74 | 'label callback' => false, |
75 | 75 | 'module' => 'System', |
76 | 76 | 'eval input' => |
77 | 77 | array ( |
78 | - 0 => 'path', |
|
79 | - 1 => 'query', |
|
80 | - 2 => 'fragment', |
|
78 | + 0 => 'path', |
|
79 | + 1 => 'query', |
|
80 | + 2 => 'fragment', |
|
81 | + ), |
|
81 | 82 | ), |
82 | - ), |
|
83 | - '#weight' => 0, |
|
83 | + '#weight' => 0, |
|
84 | 84 | ), |
85 | 85 | 1 => |
86 | 86 | array ( |
87 | - '#weight' => 0, |
|
88 | - '#info' => |
|
89 | - array ( |
|
87 | + '#weight' => 0, |
|
88 | + '#info' => |
|
89 | + array ( |
|
90 | 90 | 'label' => 'Show a message', |
91 | 91 | 'label callback' => false, |
92 | 92 | 'module' => 'System', |
93 | 93 | 'eval input' => |
94 | 94 | array ( |
95 | - 0 => 'message', |
|
95 | + 0 => 'message', |
|
96 | + ), |
|
96 | 97 | ), |
97 | - ), |
|
98 | - '#name' => 'rules_action_drupal_message', |
|
99 | - '#settings' => |
|
100 | - array ( |
|
98 | + '#name' => 'rules_action_drupal_message', |
|
99 | + '#settings' => |
|
100 | + array ( |
|
101 | 101 | 'message' => 'You haven\'t filled out your profile information yet. Please do so now!', |
102 | 102 | 'error' => 1, |
103 | - ), |
|
104 | - '#type' => 'action', |
|
103 | + ), |
|
104 | + '#type' => 'action', |
|
105 | 105 | ), |
106 | - ), |
|
106 | + ), |
|
107 | + ), |
|
107 | 108 | ), |
108 | - ), |
|
109 | 109 | ); |
110 | 110 | |
111 | - return $config; |
|
111 | + return $config; |
|
112 | 112 | } |
@@ -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,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) and !settings (URL).'), |
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']))), |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | '!user_uid' => $recipient->uid, |
133 | 133 | '!message' => url('messages/view/' . $message['thread_id'], array('absolute' => TRUE, 'language' => $language)), |
134 | 134 | '!settings' => url('user/' . $recipient->uid . '/edit', array('absolute' => TRUE, 'language' => $language)), |
135 | - ); |
|
135 | + ); |
|
136 | 136 | |
137 | - return $tokens; |
|
137 | + return $tokens; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Returns default email notification body. |
142 | 142 | */ |
143 | 143 | function _pm_email_notify_default_body() { |
144 | - 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"; |
|
144 | + 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"; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,43 +150,43 @@ discard block |
||
150 | 150 | * Display settings form and store its information. |
151 | 151 | */ |
152 | 152 | function pm_email_notify_user($op, &$edit, &$account, $category = NULL) { |
153 | - switch ($op) { |
|
153 | + switch ($op) { |
|
154 | 154 | case 'form': |
155 | 155 | if ($category == 'account' && privatemsg_user_access('read privatemsg', $account)) { |
156 | 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, |
|
157 | + '#type' => 'fieldset', |
|
158 | + '#title' => t('Privatemsg e-mail notification'), |
|
159 | + '#collapsible' => TRUE, |
|
160 | + '#collapsed' => FALSE, |
|
161 | + '#weight' => 10, |
|
162 | 162 | ); |
163 | 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), |
|
164 | + '#type' => 'checkbox', |
|
165 | + '#title' => t('Receive email notification for incoming private messages'), |
|
166 | + '#default_value' => _pm_email_notify_is_enabled($account->uid), |
|
167 | 167 | ); |
168 | - } |
|
169 | - return $form; |
|
168 | + } |
|
169 | + return $form; |
|
170 | 170 | |
171 | - case 'submit': |
|
171 | + case 'submit': |
|
172 | 172 | if (isset($edit['pm_send_notifications']) && privatemsg_user_access('read privatemsg', $account)) { |
173 | 173 | $pm_email_enabled = $edit['pm_send_notifications']; |
174 | 174 | unset($edit['pm_send_notifications']); |
175 | 175 | // Update database entry with user preference. |
176 | 176 | $exists = db_result(db_query("SELECT 1 FROM {pm_email_notify} WHERE user_id = %d", $account->uid)); |
177 | 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); |
|
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 | 180 | } |
181 | 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); |
|
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 | + } |
|
184 | 185 | } |
185 | - } |
|
186 | - break; |
|
186 | + break; |
|
187 | 187 | |
188 | - case 'delete': |
|
188 | + case 'delete': |
|
189 | 189 | db_query("DELETE FROM {pm_email_notify} WHERE user_id = %d", $account->uid); |
190 | - break; |
|
191 | - } |
|
190 | + break; |
|
191 | + } |
|
192 | 192 | } |
@@ -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 |