@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | * Provide handler to replace reference with title. |
7 | 7 | */ |
8 | 8 | class content_handler_argument_reference extends content_handler_argument_numeric { |
9 | - /** |
|
10 | - * Override the behavior of title(). |
|
11 | - */ |
|
12 | - function title_query() { |
|
9 | + /** |
|
10 | + * Override the behavior of title(). |
|
11 | + */ |
|
12 | + function title_query() { |
|
13 | 13 | $titles = array(); |
14 | 14 | $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d')); |
15 | 15 | |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | |
19 | 19 | $result = db_query("SELECT $this->name_field AS title FROM {". $table['table'] ."} WHERE ". $table['field'] ." IN ($placeholders)", $this->value); |
20 | 20 | while ($row = db_fetch_object($result)) { |
21 | - $titles[] = check_plain($row->title); |
|
21 | + $titles[] = check_plain($row->title); |
|
22 | 22 | } |
23 | 23 | return $titles; |
24 | - } |
|
24 | + } |
|
25 | 25 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $table_data = views_fetch_data($this->name_table); |
17 | 17 | $table = array_shift($table_data['table']['join']); |
18 | 18 | |
19 | - $result = db_query("SELECT $this->name_field AS title FROM {". $table['table'] ."} WHERE ". $table['field'] ." IN ($placeholders)", $this->value); |
|
19 | + $result = db_query("SELECT $this->name_field AS title FROM {".$table['table']."} WHERE ".$table['field']." IN ($placeholders)", $this->value); |
|
20 | 20 | while ($row = db_fetch_object($result)) { |
21 | 21 | $titles[] = check_plain($row->title); |
22 | 22 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * Handler for 'content_php_array_autocomplete' style. |
7 | 7 | */ |
8 | 8 | class content_plugin_style_php_array_ac extends views_plugin_style { |
9 | - function render() { |
|
9 | + function render() { |
|
10 | 10 | $results = array(); |
11 | 11 | |
12 | 12 | // Group the rows according to the grouping field, if specified. |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | // Could be useful for select widget, though. |
21 | 21 | $this->view->row_index = 0; |
22 | 22 | foreach ($sets as $title => $records) { |
23 | - foreach ($records as $label => $row) { |
|
23 | + foreach ($records as $label => $row) { |
|
24 | 24 | $results[$row->{$base_field}] = array( |
25 | - 'title' => $row->{$title_field_alias}, |
|
26 | - 'rendered' => $this->row_plugin->render($row), |
|
25 | + 'title' => $row->{$title_field_alias}, |
|
26 | + 'rendered' => $this->row_plugin->render($row), |
|
27 | 27 | ); |
28 | 28 | $this->view->row_index++; |
29 | - } |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | unset($this->view->row_index); |
32 | 32 | return $results; |
33 | - } |
|
33 | + } |
|
34 | 34 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_argument_string extends views_handler_argument_string { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | 16 | $this->additional_fields = $this->definition['additional fields']; |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -7,12 +7,12 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_argument_numeric extends views_handler_argument_numeric { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | 16 | $this->additional_fields = $this->definition['additional fields']; |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_filter_string extends views_handler_filter_string { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | $this->content_field = content_fields($this->definition['content_field_name']); |
15 | 15 | $this->additional_fields = $this->definition['additional fields']; |
16 | - } |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -7,68 +7,68 @@ |
||
7 | 7 | * values by allowing the views administrator to select deltas. |
8 | 8 | */ |
9 | 9 | class content_handler_sort extends views_handler_sort { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | 16 | $this->additional_fields = $this->definition['additional fields']; |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - function option_definition() { |
|
19 | + function option_definition() { |
|
20 | 20 | $options = parent::option_definition(); |
21 | 21 | $options['delta'] = array('default' => -1); |
22 | 22 | |
23 | 23 | return $options; |
24 | - } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Add a delta selector for multiple fields. |
|
28 | - */ |
|
29 | - function options_form(&$form, &$form_state) { |
|
26 | + /** |
|
27 | + * Add a delta selector for multiple fields. |
|
28 | + */ |
|
29 | + function options_form(&$form, &$form_state) { |
|
30 | 30 | $field = $this->content_field; |
31 | 31 | parent::options_form($form, $form_state); |
32 | 32 | |
33 | 33 | // Only add the form gadget if the field is multiple. |
34 | 34 | if ($field['multiple']) { |
35 | - $max_delta = $field['multiple']; |
|
36 | - // 1 means unlimited. |
|
37 | - if ($max_delta == 1) { |
|
35 | + $max_delta = $field['multiple']; |
|
36 | + // 1 means unlimited. |
|
37 | + if ($max_delta == 1) { |
|
38 | 38 | $max_delta = 10; |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - $options = array('-1' => t('All')); |
|
42 | - for ($i = 0; $i < $max_delta; $i++) { |
|
41 | + $options = array('-1' => t('All')); |
|
42 | + for ($i = 0; $i < $max_delta; $i++) { |
|
43 | 43 | $options[$i] = $i + 1; |
44 | - } |
|
45 | - $form['delta'] = array( |
|
44 | + } |
|
45 | + $form['delta'] = array( |
|
46 | 46 | '#type' => 'select', |
47 | 47 | '#options' => $options, |
48 | 48 | '#default_value' => $this->options['delta'], |
49 | 49 | '#title' => t('Delta'), |
50 | 50 | '#description' => t('The delta allows you to select which item in a multiple value field will be used for sorting. Select "1" to use the first item, "2" for the second item, and so on. If you select "All", each item in the field will create a new row, which may appear to cause duplicates.'), |
51 | - ); |
|
51 | + ); |
|
52 | + } |
|
52 | 53 | } |
53 | - } |
|
54 | 54 | |
55 | - function ensure_my_table() { |
|
55 | + function ensure_my_table() { |
|
56 | 56 | if (!isset($this->table_alias)) { |
57 | - $join = $this->get_join(); |
|
58 | - if (!isset($join->extra)) { |
|
57 | + $join = $this->get_join(); |
|
58 | + if (!isset($join->extra)) { |
|
59 | 59 | $join->extra = array(); |
60 | - } |
|
61 | - $delta = isset($this->options['delta']) ? $this->options['delta'] : -1; |
|
62 | - if ($delta != -1) { |
|
60 | + } |
|
61 | + $delta = isset($this->options['delta']) ? $this->options['delta'] : -1; |
|
62 | + if ($delta != -1) { |
|
63 | 63 | $join->extra[] = array( |
64 | - 'field' => 'delta', |
|
65 | - 'value' => $delta, |
|
66 | - 'numeric' => TRUE, |
|
64 | + 'field' => 'delta', |
|
65 | + 'value' => $delta, |
|
66 | + 'numeric' => TRUE, |
|
67 | 67 | ); |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - $this->table_alias = $this->query->ensure_table($this->table, $this->relationship, $join); |
|
70 | + $this->table_alias = $this->query->ensure_table($this->table, $this->relationship, $join); |
|
71 | 71 | } |
72 | 72 | return $this->table_alias; |
73 | - } |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -7,36 +7,36 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_filter_many_to_one extends views_handler_filter_many_to_one { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | $this->content_field = content_fields($this->definition['content_field_name']); |
15 | 15 | $this->additional_fields = $this->definition['additional fields']; |
16 | 16 | $field = $this->content_field; |
17 | 17 | $this->value_title = $field['widget']['label']; |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - function get_value_options() { |
|
20 | + function get_value_options() { |
|
21 | 21 | $this->value_options = $this->allowed_values(); |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | - // Get allowed values from hook_allowed_values(), if any, |
|
25 | - // or from content_allowed_values(); |
|
26 | - function allowed_values() { |
|
24 | + // Get allowed values from hook_allowed_values(), if any, |
|
25 | + // or from content_allowed_values(); |
|
26 | + function allowed_values() { |
|
27 | 27 | $field = $this->content_field; |
28 | 28 | $function = $field['module'] .'_allowed_values'; |
29 | 29 | if ($this->value_form_type == 'select') { |
30 | - // Select elements accept multidimensional arrays to support optgroups. |
|
31 | - $options = function_exists($function) ? $function($field) : content_allowed_values($field, FALSE); |
|
32 | - // For selects, HTML should be filtered out and entities left unencoded. |
|
33 | - // See content_allowed_values / content_filter_xss / filter_xss. |
|
34 | - content_allowed_values_filter_html($options); |
|
30 | + // Select elements accept multidimensional arrays to support optgroups. |
|
31 | + $options = function_exists($function) ? $function($field) : content_allowed_values($field, FALSE); |
|
32 | + // For selects, HTML should be filtered out and entities left unencoded. |
|
33 | + // See content_allowed_values / content_filter_xss / filter_xss. |
|
34 | + content_allowed_values_filter_html($options); |
|
35 | 35 | } |
36 | 36 | else { |
37 | - $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
|
37 | + $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
|
38 | 38 | } |
39 | 39 | return (array) $options; |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // or from content_allowed_values(); |
26 | 26 | function allowed_values() { |
27 | 27 | $field = $this->content_field; |
28 | - $function = $field['module'] .'_allowed_values'; |
|
28 | + $function = $field['module'].'_allowed_values'; |
|
29 | 29 | if ($this->value_form_type == 'select') { |
30 | 30 | // Select elements accept multidimensional arrays to support optgroups. |
31 | 31 | $options = function_exists($function) ? $function($field) : content_allowed_values($field, FALSE); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | else { |
37 | 37 | $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
38 | 38 | } |
39 | - return (array) $options; |
|
39 | + return (array)$options; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -32,8 +32,7 @@ |
||
32 | 32 | // For selects, HTML should be filtered out and entities left unencoded. |
33 | 33 | // See content_allowed_values / content_filter_xss / filter_xss. |
34 | 34 | content_allowed_values_filter_html($options); |
35 | - } |
|
36 | - else { |
|
35 | + } else { |
|
37 | 36 | $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
38 | 37 | } |
39 | 38 | return (array) $options; |
@@ -7,12 +7,12 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_argument extends views_handler_argument { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | 16 | $this->additional_fields = $this->definition['additional fields']; |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -6,43 +6,43 @@ |
||
6 | 6 | * Handler for 'content_handler_argument_many_to_one' style. |
7 | 7 | */ |
8 | 8 | class content_handler_argument_many_to_one extends views_handler_argument_many_to_one { |
9 | - var $content_field; |
|
9 | + var $content_field; |
|
10 | 10 | |
11 | - function construct() { |
|
11 | + function construct() { |
|
12 | 12 | parent::construct(); |
13 | 13 | |
14 | 14 | $this->content_field = content_fields($this->definition['content_field_name']); |
15 | 15 | $this->additional_fields = $this->definition['additional fields']; |
16 | - } |
|
16 | + } |
|
17 | 17 | |
18 | - function summary_name($data) { |
|
18 | + function summary_name($data) { |
|
19 | 19 | $options = $this->allowed_values(); |
20 | 20 | $value = $data->{$this->name_alias}; |
21 | 21 | if (isset($options[$value])) { |
22 | - $value = $options[$value]; |
|
22 | + $value = $options[$value]; |
|
23 | 23 | } |
24 | 24 | else { |
25 | - $value = parent::summary_name($data); |
|
25 | + $value = parent::summary_name($data); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | return $value; |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | - function title_query() { |
|
31 | + function title_query() { |
|
32 | 32 | $options = $this->allowed_values(); |
33 | 33 | $values = $this->value; |
34 | 34 | foreach ($values as $key => $value) { |
35 | - if (isset($options[$value])) { |
|
35 | + if (isset($options[$value])) { |
|
36 | 36 | $values[$key] = $options[$value]; |
37 | - } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | return $values; |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - function allowed_values() { |
|
42 | + function allowed_values() { |
|
43 | 43 | $field = $this->content_field; |
44 | 44 | $function = $field['module'] .'_allowed_values'; |
45 | 45 | $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
46 | 46 | return (array) $options; |
47 | - } |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -41,8 +41,8 @@ |
||
41 | 41 | |
42 | 42 | function allowed_values() { |
43 | 43 | $field = $this->content_field; |
44 | - $function = $field['module'] .'_allowed_values'; |
|
44 | + $function = $field['module'].'_allowed_values'; |
|
45 | 45 | $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
46 | - return (array) $options; |
|
46 | + return (array)$options; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -20,8 +20,7 @@ |
||
20 | 20 | $value = $data->{$this->name_alias}; |
21 | 21 | if (isset($options[$value])) { |
22 | 22 | $value = $options[$value]; |
23 | - } |
|
24 | - else { |
|
23 | + } else { |
|
25 | 24 | $value = parent::summary_name($data); |
26 | 25 | } |
27 | 26 |