@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | * Implementation of hook_views_data_alter(). |
11 | 11 | */ |
12 | 12 | function content_profile_views_data_alter(&$data) { |
13 | - // node relationship for profiles |
|
14 | - $data['users']['content_profile_rel'] = array( |
|
13 | + // node relationship for profiles |
|
14 | + $data['users']['content_profile_rel'] = array( |
|
15 | 15 | 'group' => t('Node'), |
16 | 16 | 'title' => t('Content Profile'), |
17 | 17 | 'help' => t('Create a relationship to a content profile of the user.'), |
18 | 18 | 'relationship' => array( |
19 | - 'handler' => 'content_profile_views_handler_relationship', |
|
20 | - 'base' => 'node', |
|
21 | - 'base field' => 'uid', |
|
22 | - 'label' => t('Content Profile'), |
|
19 | + 'handler' => 'content_profile_views_handler_relationship', |
|
20 | + 'base' => 'node', |
|
21 | + 'base field' => 'uid', |
|
22 | + 'label' => t('Content Profile'), |
|
23 | 23 | ), |
24 | - ); |
|
24 | + ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | * Implementation of hook_views_handlers(). |
30 | 30 | */ |
31 | 31 | function content_profile_views_handlers() { |
32 | - return array( |
|
33 | - 'info' => array( |
|
32 | + return array( |
|
33 | + 'info' => array( |
|
34 | 34 | 'path' => drupal_get_path('module', 'content_profile') .'/views', |
35 | 35 | ), |
36 | - 'handlers' => array( |
|
36 | + 'handlers' => array( |
|
37 | 37 | 'content_profile_views_handler_relationship' => array( |
38 | - 'parent' => 'views_handler_relationship', |
|
39 | - ), |
|
38 | + 'parent' => 'views_handler_relationship', |
|
39 | + ), |
|
40 | 40 | ), |
41 | - ); |
|
41 | + ); |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -31,7 +31,7 @@ |
||
31 | 31 | function content_profile_views_handlers() { |
32 | 32 | return array( |
33 | 33 | 'info' => array( |
34 | - 'path' => drupal_get_path('module', 'content_profile') .'/views', |
|
34 | + 'path' => drupal_get_path('module', 'content_profile').'/views', |
|
35 | 35 | ), |
36 | 36 | 'handlers' => array( |
37 | 37 | 'content_profile_views_handler_relationship' => array( |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Implementation of specially named hook_ctools_relationships(). |
12 | 12 | */ |
13 | 13 | function content_profile_node_from_user_ctools_relationships() { |
14 | - $args['node_from_user'] = array( |
|
14 | + $args['node_from_user'] = array( |
|
15 | 15 | 'title' => t("Profile Node"), |
16 | 16 | 'keyword' => 'content_profile', |
17 | 17 | 'description' => t('Adds a Content Profile from user context'), |
@@ -19,49 +19,49 @@ discard block |
||
19 | 19 | 'context' => 'content_profile_node_from_user_ctools_context', |
20 | 20 | 'settings form' => 'content_profile_node_from_user_ctools_settings_form', |
21 | 21 | 'settings form validate' => 'content_profile_node_from_user_ctools_settings_form_validate', |
22 | - ); |
|
22 | + ); |
|
23 | 23 | |
24 | - return $args; |
|
24 | + return $args; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Return a new context based on an existing context. |
29 | 29 | */ |
30 | 30 | function content_profile_node_from_user_ctools_context($context, $conf) { |
31 | - // If unset it wants a generic, unfilled context, which is just NULL. |
|
32 | - if (empty($context->data) || !isset($context->data->uid)) { |
|
31 | + // If unset it wants a generic, unfilled context, which is just NULL. |
|
32 | + if (empty($context->data) || !isset($context->data->uid)) { |
|
33 | 33 | $new_context = ctools_context_create_empty('node', NULL); |
34 | - } |
|
35 | - else { |
|
34 | + } |
|
35 | + else { |
|
36 | 36 | // Load the node for the requested type |
37 | 37 | $uid = $context->data->uid; |
38 | 38 | $content_profile_node = content_profile_load($conf['type'], $uid); |
39 | 39 | |
40 | 40 | // Send it to ctools. |
41 | 41 | $new_context = ctools_context_create('node', $content_profile_node); |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - // Have content profile relationships limit CCK field availability. |
|
45 | - if (isset($new_context->restrictions['type'])) { |
|
44 | + // Have content profile relationships limit CCK field availability. |
|
45 | + if (isset($new_context->restrictions['type'])) { |
|
46 | 46 | $new_context->restrictions['type'][] = $conf['type']; |
47 | - } |
|
48 | - else { |
|
47 | + } |
|
48 | + else { |
|
49 | 49 | $new_context->restrictions['type'] = array($conf['type']); |
50 | - } |
|
51 | - return $new_context; |
|
50 | + } |
|
51 | + return $new_context; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Settings form for the relationship |
56 | 56 | */ |
57 | 57 | function content_profile_node_from_user_ctools_settings_form($conf) { |
58 | - $options = content_profile_get_types('names'); |
|
59 | - $form['type'] = array( |
|
58 | + $options = content_profile_get_types('names'); |
|
59 | + $form['type'] = array( |
|
60 | 60 | '#type' => 'select', |
61 | 61 | '#title' => t('Relationship type'), |
62 | 62 | '#options' => $options, |
63 | 63 | '#default_value' => $conf['type'] |
64 | - ); |
|
64 | + ); |
|
65 | 65 | |
66 | - return $form; |
|
66 | + return $form; |
|
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | // If unset it wants a generic, unfilled context, which is just NULL. |
32 | 32 | if (empty($context->data) || !isset($context->data->uid)) { |
33 | 33 | $new_context = ctools_context_create_empty('node', NULL); |
34 | - } |
|
35 | - else { |
|
34 | + } else { |
|
36 | 35 | // Load the node for the requested type |
37 | 36 | $uid = $context->data->uid; |
38 | 37 | $content_profile_node = content_profile_load($conf['type'], $uid); |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | // Have content profile relationships limit CCK field availability. |
45 | 44 | if (isset($new_context->restrictions['type'])) { |
46 | 45 | $new_context->restrictions['type'][] = $conf['type']; |
47 | - } |
|
48 | - else { |
|
46 | + } else { |
|
49 | 47 | $new_context->restrictions['type'] = array($conf['type']); |
50 | 48 | } |
51 | 49 | return $new_context; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | function content_profile_node_from_user_ctools_context($context, $conf) { |
31 | 31 | // If unset it wants a generic, unfilled context, which is just NULL. |
32 | 32 | if (empty($context->data) || !isset($context->data->uid)) { |
33 | - $new_context = ctools_context_create_empty('node', NULL); |
|
33 | + $new_context = ctools_context_create_empty('node', null); |
|
34 | 34 | } |
35 | 35 | else { |
36 | 36 | // Load the node for the requested type |
@@ -11,109 +11,109 @@ |
||
11 | 11 | */ |
12 | 12 | class content_profile_theme_variables { |
13 | 13 | |
14 | - var $uid; |
|
15 | - var $_cache = array(); |
|
14 | + var $uid; |
|
15 | + var $_cache = array(); |
|
16 | 16 | |
17 | - function content_profile_theme_variables($uid) { |
|
17 | + function content_profile_theme_variables($uid) { |
|
18 | 18 | $this->uid = $uid; |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * Gets the user id of the profiles owner. |
|
23 | - */ |
|
24 | - function get_uid() { |
|
21 | + /** |
|
22 | + * Gets the user id of the profiles owner. |
|
23 | + */ |
|
24 | + function get_uid() { |
|
25 | 25 | return $uid; |
26 | - } |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Gets all type names keyed with their machine readable names. |
|
30 | - */ |
|
31 | - function get_profile_types() { |
|
28 | + /** |
|
29 | + * Gets all type names keyed with their machine readable names. |
|
30 | + */ |
|
31 | + function get_profile_types() { |
|
32 | 32 | return content_profile_get_types('names'); |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Gets all template variables for the content profile of this type. |
|
37 | - * |
|
38 | - * @param $type |
|
39 | - * The type of the user's content profile |
|
40 | - * @param $teaser |
|
41 | - * Whether the value is to be generated for the teaser. |
|
42 | - * @param $page |
|
43 | - * Whether the value is to be generated for the page view. |
|
44 | - * |
|
45 | - * @return |
|
46 | - * An array of variables available for the profile node |
|
47 | - * or FALSE if there has been no profile created yet. |
|
48 | - */ |
|
49 | - function get_variables($type, $teaser = FALSE, $page = FALSE) { |
|
35 | + /** |
|
36 | + * Gets all template variables for the content profile of this type. |
|
37 | + * |
|
38 | + * @param $type |
|
39 | + * The type of the user's content profile |
|
40 | + * @param $teaser |
|
41 | + * Whether the value is to be generated for the teaser. |
|
42 | + * @param $page |
|
43 | + * Whether the value is to be generated for the page view. |
|
44 | + * |
|
45 | + * @return |
|
46 | + * An array of variables available for the profile node |
|
47 | + * or FALSE if there has been no profile created yet. |
|
48 | + */ |
|
49 | + function get_variables($type, $teaser = FALSE, $page = FALSE) { |
|
50 | 50 | if (!isset($this->_cache[$type][$teaser][$page])) { |
51 | - $this->_cache[$type][$teaser][$page] = FALSE; |
|
51 | + $this->_cache[$type][$teaser][$page] = FALSE; |
|
52 | 52 | |
53 | - if ($node = content_profile_load($type, $this->uid)) { |
|
53 | + if ($node = content_profile_load($type, $this->uid)) { |
|
54 | 54 | // Make sure the node is prepared for viewing |
55 | 55 | $node = node_build_content($node, $teaser, $page); |
56 | 56 | $vars = array('node' => $node, 'teaser' => $teaser, 'page' => $page); |
57 | 57 | |
58 | 58 | // Apply all node template preprocessors |
59 | 59 | foreach ($this->_get_node_preprocessors() as $function) { |
60 | - if (function_exists($function)) { |
|
60 | + if (function_exists($function)) { |
|
61 | 61 | $function($vars, 'node'); |
62 | - } |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | $this->_cache[$type][$teaser][$page] = $vars; |
65 | - } |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | return $this->_cache[$type][$teaser][$page]; |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Gets a single template variable for the content profile of this type. |
|
72 | - * |
|
73 | - * @param $type |
|
74 | - * The type of the user's content profile |
|
75 | - * @param $name |
|
76 | - * The name of the variable to get. |
|
77 | - * |
|
78 | - * @return |
|
79 | - * The variable or FALSE if there has been no profile created yet. |
|
80 | - */ |
|
81 | - function get_variable($type, $name) { |
|
70 | + /** |
|
71 | + * Gets a single template variable for the content profile of this type. |
|
72 | + * |
|
73 | + * @param $type |
|
74 | + * The type of the user's content profile |
|
75 | + * @param $name |
|
76 | + * The name of the variable to get. |
|
77 | + * |
|
78 | + * @return |
|
79 | + * The variable or FALSE if there has been no profile created yet. |
|
80 | + */ |
|
81 | + function get_variable($type, $name) { |
|
82 | 82 | if ($vars = $this->get_variables($type)) { |
83 | - return $vars[$name]; |
|
83 | + return $vars[$name]; |
|
84 | 84 | } |
85 | 85 | return FALSE; |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * Generate a display of the given node. |
|
91 | - * |
|
92 | - * @param $type |
|
93 | - * The type of the user's content profile |
|
94 | - * @param $teaser |
|
95 | - * Whether to display the teaser only or the full form. |
|
96 | - * @param $page |
|
97 | - * Whether the node is being displayed by itself as a page. |
|
98 | - * @param $links |
|
99 | - * Whether or not to display node links. Links are omitted for node previews. |
|
100 | - * |
|
101 | - * @return |
|
102 | - * An HTML representation of the themed node or FALSE if there has been no profile created yet. |
|
103 | - */ |
|
104 | - function get_view($type, $teaser = FALSE, $page = FALSE, $links = TRUE) { |
|
89 | + /** |
|
90 | + * Generate a display of the given node. |
|
91 | + * |
|
92 | + * @param $type |
|
93 | + * The type of the user's content profile |
|
94 | + * @param $teaser |
|
95 | + * Whether to display the teaser only or the full form. |
|
96 | + * @param $page |
|
97 | + * Whether the node is being displayed by itself as a page. |
|
98 | + * @param $links |
|
99 | + * Whether or not to display node links. Links are omitted for node previews. |
|
100 | + * |
|
101 | + * @return |
|
102 | + * An HTML representation of the themed node or FALSE if there has been no profile created yet. |
|
103 | + */ |
|
104 | + function get_view($type, $teaser = FALSE, $page = FALSE, $links = TRUE) { |
|
105 | 105 | if ($node = content_profile_load($type, $this->uid)) { |
106 | - return node_view($node, $teaser, $page, $links); |
|
106 | + return node_view($node, $teaser, $page, $links); |
|
107 | 107 | } |
108 | 108 | return FALSE; |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | 111 | |
112 | - function _get_node_preprocessors() { |
|
112 | + function _get_node_preprocessors() { |
|
113 | 113 | $hooks = theme_get_registry(); |
114 | 114 | $functions = $hooks['node']['preprocess functions']; |
115 | 115 | // We don't need 'template_preprocess' |
116 | 116 | unset($functions[0]); |
117 | 117 | return $functions; |
118 | - } |
|
118 | + } |
|
119 | 119 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * An array of variables available for the profile node |
47 | 47 | * or FALSE if there has been no profile created yet. |
48 | 48 | */ |
49 | - function get_variables($type, $teaser = FALSE, $page = FALSE) { |
|
49 | + function get_variables($type, $teaser = false, $page = false) { |
|
50 | 50 | if (!isset($this->_cache[$type][$teaser][$page])) { |
51 | - $this->_cache[$type][$teaser][$page] = FALSE; |
|
51 | + $this->_cache[$type][$teaser][$page] = false; |
|
52 | 52 | |
53 | 53 | if ($node = content_profile_load($type, $this->uid)) { |
54 | 54 | // Make sure the node is prepared for viewing |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | if ($vars = $this->get_variables($type)) { |
83 | 83 | return $vars[$name]; |
84 | 84 | } |
85 | - return FALSE; |
|
85 | + return false; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | * @return |
102 | 102 | * An HTML representation of the themed node or FALSE if there has been no profile created yet. |
103 | 103 | */ |
104 | - function get_view($type, $teaser = FALSE, $page = FALSE, $links = TRUE) { |
|
104 | + function get_view($type, $teaser = false, $page = false, $links = true) { |
|
105 | 105 | if ($node = content_profile_load($type, $this->uid)) { |
106 | 106 | return node_view($node, $teaser, $page, $links); |
107 | 107 | } |
108 | - return FALSE; |
|
108 | + return false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 |
@@ -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 | } |
@@ -13,29 +13,29 @@ discard block |
||
13 | 13 | $types = array_keys(content_profile_get_types('names')); |
14 | 14 | $type = array_shift($types); |
15 | 15 | $config = |
16 | -array ( |
|
16 | +array( |
|
17 | 17 | 'rules' => |
18 | - array ( |
|
18 | + array( |
|
19 | 19 | 'content_profile_rule_1' => |
20 | - array ( |
|
20 | + array( |
|
21 | 21 | '#type' => 'rule', |
22 | 22 | '#set' => 'event_user_login', |
23 | 23 | '#label' => 'Redirect to profile creation page, if users have no profile.', |
24 | 24 | '#active' => 0, |
25 | 25 | '#weight' => '0', |
26 | 26 | '#conditions' => |
27 | - array ( |
|
27 | + array( |
|
28 | 28 | 0 => |
29 | - array ( |
|
29 | + array( |
|
30 | 30 | '#negate' => 1, |
31 | 31 | '#weight' => 0, |
32 | 32 | '#info' => |
33 | - array ( |
|
33 | + array( |
|
34 | 34 | 'label' => 'Logged in user has his Profile created', |
35 | 35 | 'arguments' => |
36 | - array ( |
|
36 | + array( |
|
37 | 37 | 'user' => |
38 | - array ( |
|
38 | + array( |
|
39 | 39 | 'type' => 'user', |
40 | 40 | 'label' => 'User', |
41 | 41 | ), |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | ), |
45 | 45 | '#name' => 'content_profile_user_has_profile_condition', |
46 | 46 | '#settings' => |
47 | - array ( |
|
47 | + array( |
|
48 | 48 | 'type' => $type, |
49 | 49 | '#argument map' => |
50 | - array ( |
|
50 | + array( |
|
51 | 51 | 'account' => 'user', |
52 | 52 | ), |
53 | 53 | ), |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | '#actions' => |
58 | - array ( |
|
58 | + array( |
|
59 | 59 | 0 => |
60 | - array ( |
|
60 | + array( |
|
61 | 61 | '#type' => 'action', |
62 | 62 | '#settings' => |
63 | - array ( |
|
64 | - 'path' => 'node/add/'. str_replace('_', '-', $type), |
|
63 | + array( |
|
64 | + 'path' => 'node/add/'.str_replace('_', '-', $type), |
|
65 | 65 | 'query' => '', |
66 | 66 | 'fragment' => '', |
67 | 67 | 'force' => 1, |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | ), |
70 | 70 | '#name' => 'rules_action_drupal_goto', |
71 | 71 | '#info' => |
72 | - array ( |
|
72 | + array( |
|
73 | 73 | 'label' => 'Redirect to profile creation page', |
74 | 74 | 'label callback' => false, |
75 | 75 | 'module' => 'System', |
76 | 76 | 'eval input' => |
77 | - array ( |
|
77 | + array( |
|
78 | 78 | 0 => 'path', |
79 | 79 | 1 => 'query', |
80 | 80 | 2 => 'fragment', |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | '#weight' => 0, |
84 | 84 | ), |
85 | 85 | 1 => |
86 | - array ( |
|
86 | + array( |
|
87 | 87 | '#weight' => 0, |
88 | 88 | '#info' => |
89 | - array ( |
|
89 | + array( |
|
90 | 90 | 'label' => 'Show a message', |
91 | 91 | 'label callback' => false, |
92 | 92 | 'module' => 'System', |
93 | 93 | 'eval input' => |
94 | - array ( |
|
94 | + array( |
|
95 | 95 | 0 => 'message', |
96 | 96 | ), |
97 | 97 | ), |
98 | 98 | '#name' => 'rules_action_drupal_message', |
99 | 99 | '#settings' => |
100 | - array ( |
|
100 | + array( |
|
101 | 101 | 'message' => 'You haven\'t filled out your profile information yet. Please do so now!', |
102 | 102 | 'error' => 1, |
103 | 103 | ), |
@@ -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 | } |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | */ |
12 | 12 | function theme_content_profile_display_add_link($element) { |
13 | 13 | $type = $element['#content_type']; |
14 | - $uid = $element['#admin'] ? 'uid='. intval($element['#uid']) .'&' : ''; |
|
14 | + $uid = $element['#admin'] ? 'uid='.intval($element['#uid']).'&' : ''; |
|
15 | 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)); |
|
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 | /** |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | function theme_content_profile_display_link($element) { |
23 | 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); |
|
25 | + $output = l(node_get_types('name', $node->type), 'node/'.$node->nid); |
|
26 | 26 | if ($element['#edit_link'] && node_access('update', $node)) { |
27 | - $output .= ' '. l('['. t('edit') .']', content_profile_get_edit_path($node), array('query' => drupal_get_destination())); |
|
27 | + $output .= ' '.l('['.t('edit').']', content_profile_get_edit_path($node), array('query' => drupal_get_destination())); |
|
28 | 28 | } |
29 | 29 | return $output; |
30 | 30 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $variables['uid'] = $element['#uid']; |
42 | 42 | $variables['type'] = $element['#content_type']; |
43 | 43 | |
44 | - $path = drupal_get_path('module', 'content_profile') .'/content_profile.css'; |
|
44 | + $path = drupal_get_path('module', 'content_profile').'/content_profile.css'; |
|
45 | 45 | drupal_add_css($path, 'module', 'all', FALSE); |
46 | 46 | |
47 | 47 | $variables['title'] = check_plain(node_get_types('name', $node->type)); |
@@ -61,7 +61,7 @@ discard block |
||
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 | /** |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | function content_profile_default_path_handler($action, $arg, $uid) { |
100 | 100 | $type = $action == 'add' ? $arg : $arg->type; |
101 | 101 | if (content_profile_get_settings($type, 'edit_tab') == 'top') { |
102 | - return 'user/'. $uid . '/profile/'. $type; |
|
102 | + return 'user/'.$uid.'/profile/'.$type; |
|
103 | 103 | } |
104 | 104 | elseif (content_profile_get_settings($type, 'edit_tab') == 'sub') { |
105 | - return 'user/'. $uid . '/edit/'. $type; |
|
105 | + return 'user/'.$uid.'/edit/'.$type; |
|
106 | 106 | } |
107 | 107 | elseif ($action == 'add') { |
108 | - return 'node/add/'. str_replace('_', '-', $arg); |
|
108 | + return 'node/add/'.str_replace('_', '-', $arg); |
|
109 | 109 | } |
110 | 110 | else { |
111 | - return 'node/'. $arg->nid .'/edit'; |
|
111 | + return 'node/'.$arg->nid.'/edit'; |
|
112 | 112 | } |
113 | 113 | } |
@@ -100,14 +100,11 @@ |
||
100 | 100 | $type = $action == 'add' ? $arg : $arg->type; |
101 | 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 | + } elseif (content_profile_get_settings($type, 'edit_tab') == 'sub') { |
|
105 | 104 | return 'user/'. $uid . '/edit/'. $type; |
106 | - } |
|
107 | - elseif ($action == 'add') { |
|
105 | + } elseif ($action == 'add') { |
|
108 | 106 | return 'node/add/'. str_replace('_', '-', $arg); |
109 | - } |
|
110 | - else { |
|
107 | + } else { |
|
111 | 108 | return 'node/'. $arg->nid .'/edit'; |
112 | 109 | } |
113 | 110 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $type = $element['#content_type']; |
14 | 14 | $uid = $element['#admin'] ? 'uid='. intval($element['#uid']) .'&' : ''; |
15 | 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)); |
|
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 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $variables['type'] = $element['#content_type']; |
43 | 43 | |
44 | 44 | $path = drupal_get_path('module', 'content_profile') .'/content_profile.css'; |
45 | - drupal_add_css($path, 'module', 'all', FALSE); |
|
45 | + drupal_add_css($path, 'module', 'all', false); |
|
46 | 46 | |
47 | 47 | $variables['title'] = check_plain(node_get_types('name', $node->type)); |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if (count($tabs) > 0) { |
55 | 55 | $variables['tabs'] = $tabs; |
56 | 56 | } |
57 | - $variables['content'] = node_view($node, ($element['#style'] == 'teaser'), TRUE, TRUE); |
|
57 | + $variables['content'] = node_view($node, ($element['#style'] == 'teaser'), true, true); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * theme_content_profile_pageroute_empty generates a message, if there is no content profile for the user. |
14 | 14 | */ |
15 | 15 | function theme_content_profile_pageroute_empty($type_name) { |
16 | - return '<div class="content-profile-empty">'. |
|
16 | + return '<div class="content-profile-empty">'. |
|
17 | 17 | t('You have not created a @type yet. Go ahead and create one!', array('@type' => $type_name)) .'</div>'; |
18 | 18 | } |
19 | 19 | |
@@ -22,58 +22,58 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class ContentProfilePageEditProfile extends PageroutePageEdit { |
24 | 24 | |
25 | - public function getForm(&$form, &$form_state, &$args) { |
|
25 | + public function getForm(&$form, &$form_state, &$args) { |
|
26 | 26 | $args['hide_pageroute_buttons'] = FALSE; |
27 | 27 | $args['default_target'] = PAGEROUTE_CURRENT; |
28 | 28 | $page = &$form_state['page']; |
29 | 29 | |
30 | 30 | if (isset($form_state['node']) && $form_state['node']['type'] == $this->options['content-type']) { |
31 | - $node = $form_state['node']; |
|
31 | + $node = $form_state['node']; |
|
32 | 32 | } |
33 | 33 | else { |
34 | - if (isset($page)) { |
|
34 | + if (isset($page)) { |
|
35 | 35 | $node = node_load(array( |
36 | - 'type' => $this->options['content-type'], |
|
37 | - 'uid' => pageroute_page_get_uid($page), |
|
36 | + 'type' => $this->options['content-type'], |
|
37 | + 'uid' => pageroute_page_get_uid($page), |
|
38 | 38 | )); |
39 | - } |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | if (empty($node)) { |
42 | - PageroutePageAdd::setNodeAddForm($form, $form_state, $page); |
|
42 | + PageroutePageAdd::setNodeAddForm($form, $form_state, $page); |
|
43 | 43 | } |
44 | 44 | else { |
45 | - $this->setNodeEditForm($form, $form_state, $page, $args, $node); |
|
45 | + $this->setNodeEditForm($form, $form_state, $page, $args, $node); |
|
46 | 46 | } |
47 | 47 | parent::unsetForm($form); |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function getAdminForm($page, &$form) { |
|
50 | + public function getAdminForm($page, &$form) { |
|
51 | 51 | |
52 | 52 | $form['options']['content-type'] = array( |
53 | - '#type' => 'select', |
|
54 | - '#title' => t('Profile content type'), |
|
55 | - '#options' => content_profile_get_types('names'), |
|
56 | - '#default_value' => $page->options['content-type'], |
|
57 | - '#weight' => 2, |
|
58 | - '#description' => t('Select a content profile type.'), |
|
53 | + '#type' => 'select', |
|
54 | + '#title' => t('Profile content type'), |
|
55 | + '#options' => content_profile_get_types('names'), |
|
56 | + '#default_value' => $page->options['content-type'], |
|
57 | + '#weight' => 2, |
|
58 | + '#description' => t('Select a content profile type.'), |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | PageroutePage::nodeUi($page, $form, TRUE); |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | - public static function help() { |
|
64 | + public static function help() { |
|
65 | 65 | return t('A page of this type will present a content profile node editing form of a configurable content-profile-type. It will edit the node with the id taken from the first argument of the pageroute. Furthermore this type can be configured to show a node adding form if the content profile is not existing. So you can build a pageroute that manages the creation and editing of content profiles.'); |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public static function info() { |
|
68 | + public static function info() { |
|
69 | 69 | return array('name' => t('Content profile editing form')); |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - public function setUp() {} |
|
72 | + public function setUp() {} |
|
73 | 73 | |
74 | - public static function getDefaultSubmitHandler($form) { |
|
74 | + public static function getDefaultSubmitHandler($form) { |
|
75 | 75 | return 'node_form_submit'; |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -81,50 +81,50 @@ discard block |
||
81 | 81 | * ContentProfilePageViewProfile displays a content profile. |
82 | 82 | */ |
83 | 83 | class ContentProfilePageViewProfile extends PageroutePageView { |
84 | - /* |
|
84 | + /* |
|
85 | 85 | * Returns the page display for the configured node |
86 | 86 | */ |
87 | - public function getForm(&$form, &$form_state, &$args) { |
|
87 | + public function getForm(&$form, &$form_state, &$args) { |
|
88 | 88 | $page = &$form_state['page']; |
89 | 89 | |
90 | 90 | $args['hide_pageroute_buttons'] = FALSE; |
91 | 91 | $args['default_target'] = PAGEROUTE_CURRENT; |
92 | 92 | |
93 | 93 | $node = node_load(array( |
94 | - 'type' => $page->options['content-type'], |
|
95 | - 'uid' => pageroute_page_get_uid($page), |
|
94 | + 'type' => $page->options['content-type'], |
|
95 | + 'uid' => pageroute_page_get_uid($page), |
|
96 | 96 | )); |
97 | 97 | |
98 | 98 | if ($node->nid && node_access('view', $node)) { |
99 | - if (empty($this->title)) { |
|
99 | + if (empty($this->title)) { |
|
100 | 100 | drupal_set_title(check_plain($node->title)); |
101 | - } |
|
102 | - node_tag_new($node->nid); |
|
103 | - $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
|
101 | + } |
|
102 | + node_tag_new($node->nid); |
|
103 | + $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
|
104 | 104 | } |
105 | 105 | else { |
106 | - $type_name = node_get_types('name', $page->options['content-type']); |
|
107 | - $form += array('pageroute-view' => array('#value' => theme('content_profile_pageroute_empty', $type_name))); |
|
106 | + $type_name = node_get_types('name', $page->options['content-type']); |
|
107 | + $form += array('pageroute-view' => array('#value' => theme('content_profile_pageroute_empty', $type_name))); |
|
108 | + } |
|
108 | 109 | } |
109 | - } |
|
110 | 110 | |
111 | - public function getAdminForm($page, &$form) { |
|
111 | + public function getAdminForm($page, &$form) { |
|
112 | 112 | $form['options']['content-type'] = array( |
113 | - '#type' => 'select', |
|
114 | - '#title' => t('Profile content type'), |
|
115 | - '#options' => content_profile_get_types('names'), |
|
116 | - '#required' => TRUE, |
|
117 | - '#default_value' => $page->options['content-type'], |
|
118 | - '#weight' => 2, |
|
119 | - '#description' => t('You can only use content types marked as \'content profile\''), |
|
113 | + '#type' => 'select', |
|
114 | + '#title' => t('Profile content type'), |
|
115 | + '#options' => content_profile_get_types('names'), |
|
116 | + '#required' => TRUE, |
|
117 | + '#default_value' => $page->options['content-type'], |
|
118 | + '#weight' => 2, |
|
119 | + '#description' => t('You can only use content types marked as \'content profile\''), |
|
120 | 120 | ); |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - public static function help() { |
|
123 | + public static function help() { |
|
124 | 124 | return t('The lonely node display page can be used to view this lonely node. This might be useful for displaying the lonely node aftercreation or update. There will be a (themeable) message if there is no node that can be displayed.'); |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | - public static function info() { |
|
127 | + public static function info() { |
|
128 | 128 | return array('name' => t('Content profile display')); |
129 | - } |
|
129 | + } |
|
130 | 130 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | * Pageroute intergration classes |
7 | 7 | */ |
8 | 8 | |
9 | -include_once(drupal_get_path('module', 'pageroute') . '/pageroute.page_edit.inc'); |
|
10 | -include_once(drupal_get_path('module', 'pageroute') . '/pageroute.page_view.inc'); |
|
9 | +include_once(drupal_get_path('module', 'pageroute').'/pageroute.page_edit.inc'); |
|
10 | +include_once(drupal_get_path('module', 'pageroute').'/pageroute.page_view.inc'); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * theme_content_profile_pageroute_empty generates a message, if there is no content profile for the user. |
14 | 14 | */ |
15 | 15 | function theme_content_profile_pageroute_empty($type_name) { |
16 | 16 | return '<div class="content-profile-empty">'. |
17 | - t('You have not created a @type yet. Go ahead and create one!', array('@type' => $type_name)) .'</div>'; |
|
17 | + t('You have not created a @type yet. Go ahead and create one!', array('@type' => $type_name)).'</div>'; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | if (isset($form_state['node']) && $form_state['node']['type'] == $this->options['content-type']) { |
31 | 31 | $node = $form_state['node']; |
32 | - } |
|
33 | - else { |
|
32 | + } else { |
|
34 | 33 | if (isset($page)) { |
35 | 34 | $node = node_load(array( |
36 | 35 | 'type' => $this->options['content-type'], |
@@ -40,8 +39,7 @@ discard block |
||
40 | 39 | } |
41 | 40 | if (empty($node)) { |
42 | 41 | PageroutePageAdd::setNodeAddForm($form, $form_state, $page); |
43 | - } |
|
44 | - else { |
|
42 | + } else { |
|
45 | 43 | $this->setNodeEditForm($form, $form_state, $page, $args, $node); |
46 | 44 | } |
47 | 45 | parent::unsetForm($form); |
@@ -101,8 +99,7 @@ discard block |
||
101 | 99 | } |
102 | 100 | node_tag_new($node->nid); |
103 | 101 | $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
104 | - } |
|
105 | - else { |
|
102 | + } else { |
|
106 | 103 | $type_name = node_get_types('name', $page->options['content-type']); |
107 | 104 | $form += array('pageroute-view' => array('#value' => theme('content_profile_pageroute_empty', $type_name))); |
108 | 105 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | class ContentProfilePageEditProfile extends PageroutePageEdit { |
24 | 24 | |
25 | 25 | public function getForm(&$form, &$form_state, &$args) { |
26 | - $args['hide_pageroute_buttons'] = FALSE; |
|
26 | + $args['hide_pageroute_buttons'] = false; |
|
27 | 27 | $args['default_target'] = PAGEROUTE_CURRENT; |
28 | 28 | $page = &$form_state['page']; |
29 | 29 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | '#description' => t('Select a content profile type.'), |
59 | 59 | ); |
60 | 60 | |
61 | - PageroutePage::nodeUi($page, $form, TRUE); |
|
61 | + PageroutePage::nodeUi($page, $form, true); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public static function help() { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function getForm(&$form, &$form_state, &$args) { |
88 | 88 | $page = &$form_state['page']; |
89 | 89 | |
90 | - $args['hide_pageroute_buttons'] = FALSE; |
|
90 | + $args['hide_pageroute_buttons'] = false; |
|
91 | 91 | $args['default_target'] = PAGEROUTE_CURRENT; |
92 | 92 | |
93 | 93 | $node = node_load(array( |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | drupal_set_title(check_plain($node->title)); |
101 | 101 | } |
102 | 102 | node_tag_new($node->nid); |
103 | - $form += array('pageroute-view' => array('#value' => node_view($node, FALSE, TRUE, FALSE))); |
|
103 | + $form += array('pageroute-view' => array('#value' => node_view($node, false, true, false))); |
|
104 | 104 | } |
105 | 105 | else { |
106 | 106 | $type_name = node_get_types('name', $page->options['content-type']); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | '#type' => 'select', |
114 | 114 | '#title' => t('Profile content type'), |
115 | 115 | '#options' => content_profile_get_types('names'), |
116 | - '#required' => TRUE, |
|
116 | + '#required' => true, |
|
117 | 117 | '#default_value' => $page->options['content-type'], |
118 | 118 | '#weight' => 2, |
119 | 119 | '#description' => t('You can only use content types marked as \'content profile\''), |
@@ -8,29 +8,29 @@ |
||
8 | 8 | * System settings form page callback. |
9 | 9 | */ |
10 | 10 | function mobile_menu_toggle_form() { |
11 | - $form = array(); |
|
11 | + $form = array(); |
|
12 | 12 | |
13 | - $form['mobile_menu_menu'] = array( |
|
13 | + $form['mobile_menu_menu'] = array( |
|
14 | 14 | '#title' => t('Menu selection'), |
15 | 15 | '#description' => t('Which menu should the toggle open?'), |
16 | 16 | '#type' => 'select', |
17 | 17 | '#options' => menu_get_menus(), |
18 | 18 | '#default_value' => variable_get('mobile_menu_menu', 'main-menu'), |
19 | - ); |
|
19 | + ); |
|
20 | 20 | |
21 | - $form['mobile_menu_block'] = array( |
|
21 | + $form['mobile_menu_block'] = array( |
|
22 | 22 | '#title' => t('Menu loaded in block?'), |
23 | 23 | '#description' => t('Will this menu be loaded via a block? Check this box if you are loading your menu on the page via context or blocks.'), |
24 | 24 | '#type' => 'checkbox', |
25 | 25 | '#default_value' => variable_get('mobile_menu_block', FALSE), |
26 | - ); |
|
26 | + ); |
|
27 | 27 | |
28 | - $form['mobile_menu_css'] = array( |
|
28 | + $form['mobile_menu_css'] = array( |
|
29 | 29 | '#title' => t('(optional) CSS Selector'), |
30 | 30 | '#description' => t('Enter an optional CSS selector. If this option is used the menu selected above will be ignored'), |
31 | 31 | '#type' => 'textfield', |
32 | 32 | '#default_value' => variable_get('mobile_menu_css', ''), |
33 | - ); |
|
33 | + ); |
|
34 | 34 | |
35 | - return system_settings_form($form); |
|
35 | + return system_settings_form($form); |
|
36 | 36 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | '#title' => t('Menu loaded in block?'), |
23 | 23 | '#description' => t('Will this menu be loaded via a block? Check this box if you are loading your menu on the page via context or blocks.'), |
24 | 24 | '#type' => 'checkbox', |
25 | - '#default_value' => variable_get('mobile_menu_block', FALSE), |
|
25 | + '#default_value' => variable_get('mobile_menu_block', false), |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | $form['mobile_menu_css'] = array( |
@@ -8,69 +8,69 @@ |
||
8 | 8 | * Implements hook_menu(). |
9 | 9 | */ |
10 | 10 | function mobile_menu_toggle_menu() { |
11 | - $items = array(); |
|
11 | + $items = array(); |
|
12 | 12 | |
13 | - $items['admin/settings/mobile-menu-toggle'] = array( |
|
13 | + $items['admin/settings/mobile-menu-toggle'] = array( |
|
14 | 14 | 'title' => 'Mobile Menu Toggle', |
15 | 15 | 'description' => t('Select menu and zones for mobile menu toggle'), |
16 | 16 | 'page callback' => 'drupal_get_form', |
17 | 17 | 'page arguments' => array('mobile_menu_toggle_form'), |
18 | 18 | 'access arguments' => array('administer menu'), |
19 | 19 | 'file' => 'mobile_menu_toggle.admin.inc', |
20 | - ); |
|
20 | + ); |
|
21 | 21 | |
22 | - return $items; |
|
22 | + return $items; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Implements hook_init(). |
27 | 27 | */ |
28 | 28 | function mobile_menu_toggle_init() { |
29 | - // Set JS settings based on menu selected. |
|
30 | - $menu_default = check_plain(variable_get('mobile_menu_menu', 'main-menu')); |
|
31 | - $css_class = check_plain(variable_get('mobile_menu_css', '')); |
|
32 | - $menu_block = variable_get('mobile_menu_block', FALSE); |
|
33 | - $js_settings['mobile_menu_toggle'] = array( |
|
29 | + // Set JS settings based on menu selected. |
|
30 | + $menu_default = check_plain(variable_get('mobile_menu_menu', 'main-menu')); |
|
31 | + $css_class = check_plain(variable_get('mobile_menu_css', '')); |
|
32 | + $menu_block = variable_get('mobile_menu_block', FALSE); |
|
33 | + $js_settings['mobile_menu_toggle'] = array( |
|
34 | 34 | 'default_menu' => $menu_default, |
35 | 35 | 'css_class' => '#' . $menu_default, |
36 | - ); |
|
36 | + ); |
|
37 | 37 | |
38 | - // Add #block-menu as a prefix to class if the menu will be loaded via block. |
|
39 | - if ($menu_block) { |
|
38 | + // Add #block-menu as a prefix to class if the menu will be loaded via block. |
|
39 | + if ($menu_block) { |
|
40 | 40 | $js_settings['mobile_menu_toggle']['css_class'] = '#block-menu-' . $menu_default; |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - if (!empty($css_class)) { |
|
43 | + if (!empty($css_class)) { |
|
44 | 44 | $js_settings['mobile_menu_toggle']['css_class'] = $css_class; |
45 | - } |
|
46 | - drupal_add_js($js_settings, 'setting'); |
|
45 | + } |
|
46 | + drupal_add_js($js_settings, 'setting'); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
50 | 50 | function mobile_menu_toggle_block($op = 'list', $delta = 0, $edit = array()) { |
51 | - if ($op == 'list') { |
|
51 | + if ($op == 'list') { |
|
52 | 52 | $blocks[0]['info'] = t('Mobile Menu Toggle'); |
53 | 53 | return $blocks; |
54 | - } |
|
55 | - elseif ($op == 'view') { |
|
54 | + } |
|
55 | + elseif ($op == 'view') { |
|
56 | 56 | $block = array(); |
57 | 57 | switch ($delta) { |
58 | - case 0: |
|
58 | + case 0: |
|
59 | 59 | drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
60 | 60 | $block['content'] = theme('mobile_menu_toggle'); |
61 | 61 | break; |
62 | 62 | } |
63 | 63 | return $block; |
64 | - } |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Implements hook_theme(). |
69 | 69 | */ |
70 | 70 | function mobile_menu_toggle_theme($existing, $type, $theme, $path) { |
71 | - return array( |
|
71 | + return array( |
|
72 | 72 | 'mobile_menu_toggle' => array( |
73 | - 'template' => 'mobile_menu_toggle', |
|
73 | + 'template' => 'mobile_menu_toggle', |
|
74 | 74 | ), |
75 | - ); |
|
75 | + ); |
|
76 | 76 | } |
@@ -55,10 +55,10 @@ |
||
55 | 55 | elseif ($op == 'view') { |
56 | 56 | $block = array(); |
57 | 57 | switch ($delta) { |
58 | - case 0: |
|
59 | - drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
|
60 | - $block['content'] = theme('mobile_menu_toggle'); |
|
61 | - break; |
|
58 | + case 0: |
|
59 | + drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
|
60 | + $block['content'] = theme('mobile_menu_toggle'); |
|
61 | + break; |
|
62 | 62 | } |
63 | 63 | return $block; |
64 | 64 | } |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | $menu_block = variable_get('mobile_menu_block', FALSE); |
33 | 33 | $js_settings['mobile_menu_toggle'] = array( |
34 | 34 | 'default_menu' => $menu_default, |
35 | - 'css_class' => '#' . $menu_default, |
|
35 | + 'css_class' => '#'.$menu_default, |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | // Add #block-menu as a prefix to class if the menu will be loaded via block. |
39 | 39 | if ($menu_block) { |
40 | - $js_settings['mobile_menu_toggle']['css_class'] = '#block-menu-' . $menu_default; |
|
40 | + $js_settings['mobile_menu_toggle']['css_class'] = '#block-menu-'.$menu_default; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!empty($css_class)) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $block = array(); |
57 | 57 | switch ($delta) { |
58 | 58 | case 0: |
59 | - drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js'); |
|
59 | + drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle').'/mobile_menu_toggle.js'); |
|
60 | 60 | $block['content'] = theme('mobile_menu_toggle'); |
61 | 61 | break; |
62 | 62 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | if ($op == 'list') { |
52 | 52 | $blocks[0]['info'] = t('Mobile Menu Toggle'); |
53 | 53 | return $blocks; |
54 | - } |
|
55 | - elseif ($op == 'view') { |
|
54 | + } elseif ($op == 'view') { |
|
56 | 55 | $block = array(); |
57 | 56 | switch ($delta) { |
58 | 57 | case 0: |
@@ -29,7 +29,7 @@ |
||
29 | 29 | // Set JS settings based on menu selected. |
30 | 30 | $menu_default = check_plain(variable_get('mobile_menu_menu', 'main-menu')); |
31 | 31 | $css_class = check_plain(variable_get('mobile_menu_css', '')); |
32 | - $menu_block = variable_get('mobile_menu_block', FALSE); |
|
32 | + $menu_block = variable_get('mobile_menu_block', false); |
|
33 | 33 | $js_settings['mobile_menu_toggle'] = array( |
34 | 34 | 'default_menu' => $menu_default, |
35 | 35 | 'css_class' => '#' . $menu_default, |
@@ -9,45 +9,45 @@ |
||
9 | 9 | * Implements hook_preprocess_author_pane(). |
10 | 10 | */ |
11 | 11 | function privatemsg_preprocess_author_pane(&$variables) { |
12 | - global $user; |
|
13 | - $account = $variables['account']; |
|
14 | - $account_id = $account->uid; |
|
15 | - $account_name = $account->name; |
|
12 | + global $user; |
|
13 | + $account = $variables['account']; |
|
14 | + $account_id = $account->uid; |
|
15 | + $account_name = $account->name; |
|
16 | 16 | |
17 | - if (function_exists('author_pane_api') && author_pane_api() == "2") { |
|
17 | + if (function_exists('author_pane_api') && author_pane_api() == "2") { |
|
18 | 18 | // Author Pane 2.x |
19 | 19 | |
20 | 20 | // Check if this preprocess needs to be run given who's calling it. |
21 | 21 | if (!author_pane_run_preprocess('privatemsg', $variables['caller'])) { |
22 | - return; |
|
22 | + return; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $url = privatemsg_get_link($account); |
26 | 26 | if (!empty($url)) { |
27 | - $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
27 | + $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
28 | 28 | |
29 | - // Early versions of the template used this variable so fill it for |
|
30 | - // backwards compatability. |
|
31 | - $variables['privatemsg_link'] = $variables['privatemsg']; |
|
29 | + // Early versions of the template used this variable so fill it for |
|
30 | + // backwards compatability. |
|
31 | + $variables['privatemsg_link'] = $variables['privatemsg']; |
|
32 | 32 | } |
33 | - } |
|
34 | - else { |
|
33 | + } |
|
34 | + else { |
|
35 | 35 | // Author Pane 1.x |
36 | 36 | |
37 | 37 | $image_path = $variables['image_path']; |
38 | 38 | |
39 | 39 | // Send private message |
40 | 40 | if ($url = privatemsg_get_link($account)) { |
41 | - $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE); |
|
42 | - $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE)); |
|
43 | - $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); |
|
41 | + $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE); |
|
42 | + $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE)); |
|
43 | + $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); |
|
44 | + } |
|
44 | 45 | } |
45 | - } |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Implementation of hook_author_pane_allow_preprocess_disable(). |
50 | 50 | */ |
51 | 51 | function privatemsg_author_pane_allow_preprocess_disable() { |
52 | - return array('privatemsg' => 'Privatemsg'); |
|
52 | + return array('privatemsg' => 'Privatemsg'); |
|
53 | 53 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | $url = privatemsg_get_link($account); |
26 | 26 | if (!empty($url)) { |
27 | - $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
27 | + $variables['privatemsg'] = l('<span>'.t('Send PM').'</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
28 | 28 | |
29 | 29 | // Early versions of the template used this variable so fill it for |
30 | 30 | // backwards compatability. |
@@ -30,8 +30,7 @@ |
||
30 | 30 | // backwards compatability. |
31 | 31 | $variables['privatemsg_link'] = $variables['privatemsg']; |
32 | 32 | } |
33 | - } |
|
34 | - else { |
|
33 | + } else { |
|
35 | 34 | // Author Pane 1.x |
36 | 35 | |
37 | 36 | $image_path = $variables['image_path']; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $url = privatemsg_get_link($account); |
26 | 26 | if (!empty($url)) { |
27 | - $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE)); |
|
27 | + $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => true)); |
|
28 | 28 | |
29 | 29 | // Early versions of the template used this variable so fill it for |
30 | 30 | // backwards compatability. |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | // Send private message |
40 | 40 | if ($url = privatemsg_get_link($account)) { |
41 | - $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE); |
|
42 | - $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE)); |
|
43 | - $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE)); |
|
41 | + $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), null, true); |
|
42 | + $variables['privatemsg'] = l($img, $url, array('absolute' => true, 'html' => true)); |
|
43 | + $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => true)); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |