Removed obsolete $ in source files

This commit is contained in:
Manuel Cillero 2017-08-29 14:13:02 +02:00
parent a39c010e06
commit e5f2b64d98
146 changed files with 836 additions and 1081 deletions

View file

@ -1,6 +1,4 @@
<?php
// $Id: content_taxonomy_autocomplete.module,v 1.2.2.4.2.17 2009/08/19 09:42:30 mh86 Exp $
/**
* @file
* Defines a widget type for content_taxonomy with autocomplete
@ -69,16 +67,16 @@ function content_taxonomy_autocomplete_widget_settings($op, $widget) {
),
);
$form['autocomplete']['extra_parent'] = array(
'#type' => 'select',
'#title' => t('Extra Parent for new terms'),
'#options' => _content_taxonomy_get_all_terms(),
'#type' => 'select',
'#title' => t('Extra Parent for new terms'),
'#options' => _content_taxonomy_get_all_terms(),
'#default_value' => (isset($widget['extra_parent']) && is_numeric($widget['extra_parent'])) ? $widget['extra_parent'] : 0,
'#description' => t('This setting is only relevant if you have selected "Allow and insert new terms by the user into the vocabulary". If you select any term here, new terms will get children of the selected one, otherwise new terms get children of the parent term (root, if no parent selected) selected in the global settings.'),
);
$form['autocomplete']['maxlength'] = array(
'#type' => 'textfield',
'#title' => t('Maximum length of autocomplete'),
'#type' => 'textfield',
'#title' => t('Maximum length of autocomplete'),
'#default_value' => (isset($widget['maxlength']) && is_numeric($widget['maxlength'])) ? $widget['maxlength'] : 255,
'#element_validate' => array('_content_taxonomy_autocomplete_widget_settings_maxlength_validate'),
'#required' => TRUE,
@ -86,8 +84,8 @@ function content_taxonomy_autocomplete_widget_settings($op, $widget) {
);
if (module_exists('active_tags')) {
$form['autocomplete']['active_tags'] = array(
'#type' => 'checkbox',
'#title' => t('Use Active Tags style widget'),
'#type' => 'checkbox',
'#title' => t('Use Active Tags style widget'),
'#default_value' => isset($widget['active_tags']) ? $widget['active_tags'] : 0,
'#description' => t('Use the Active Tags module to improve the usability of this autocomplete widget.'),
);
@ -122,7 +120,7 @@ function content_taxonomy_autocomplete_elements() {
return array(
'content_taxonomy_autocomplete' => array(
'#input' => TRUE,
'#columns' => array('value'),
'#columns' => array('value'),
'#delta' => 0,
'#process' => array('content_taxonomy_autocomplete_process'),
'#autocomplete_path' => FALSE,
@ -173,7 +171,7 @@ function content_taxonomy_autocomplete_process($element, $edit, $form_state, $fo
$field_name = $element['#field_name'];
$field = $form['#field_info'][$field_name];
$field_key = $element['#columns'][0];
$element[$field_key] = array(
'#type' => 'textfield',
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : '',
@ -187,16 +185,16 @@ function content_taxonomy_autocomplete_process($element, $edit, $form_state, $fo
'#columns' => $element['#columns'],
'#maxlength' => !empty($field['widget']['maxlength']) ? $field['widget']['maxlength'] : 255,
);
if (empty($element[$field_key]['#element_validate'])) {
$element[$field_key]['#element_validate'] = array();
}
array_unshift($element[$field_key]['#element_validate'], 'content_taxonomy_autocomplete_validate');
if (module_exists('active_tags') && $field['widget']['active_tags']) {
active_tags_enable_widget('#' . $element['#id'] . '-value-wrapper');
}
return $element;
}
@ -209,16 +207,16 @@ function content_taxonomy_autocomplete_validate($element, &$form_state) {
$field_name = $element['#field_name'];
$field = content_fields($field_name, $element['#type_name']);
$field_key = $element['#columns'][0];
//if the element parents array contains the field key, we have to remove it
//because otherwise form_set_value won't work. (still the question why is it in)
if ($element['#parents'][count($element['#parents'])-1] == $field_key) {
array_pop($element['#parents']);
array_pop($element['#array_parents']);
}
$value = $element['#value'];
$extracted_ids = content_taxonomy_autocomplete_tags_get_tids($value, $field['vid'], content_taxonomy_field_get_parent($field), $field['widget']['extra_parent']);
if (!$field['multiple'] && count(content_taxonomy_autocomplete_split_tags($value, $field['vid'])) > 1) {
@ -234,7 +232,7 @@ function content_taxonomy_autocomplete_validate($element, &$form_state) {
return;
}
}
$values = content_taxonomy_autocomplete_form2data($extracted_ids, $field, $element);
form_set_value($element, $values, $form_state);
}
@ -249,9 +247,9 @@ function content_taxonomy_autocomplete_form2data($extracted_ids, $field, $elemen
if (is_array($extracted_ids['non_existing_terms'])) {
if ($field['widget']['extra_parent']) {
$new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], $field['widget']['extra_parent']);
}
}
else {
$new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], content_taxonomy_field_get_parent($field));
$new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], content_taxonomy_field_get_parent($field));
}
}
return content_transpose_array_rows_cols(array($element['#columns'][0] => array_merge($existing_tids, $new_tids)));
@ -261,7 +259,7 @@ function content_taxonomy_autocomplete_form2data($extracted_ids, $field, $elemen
/**
* Retrieve a pipe delimited string of autocomplete suggestions
*
*
* @param String Fieldname
* @param Integer TID of a parent (optional)
* @param BOOLEAN whether a multiple field or not
@ -274,13 +272,13 @@ function content_taxonomy_autocomplete_load($field_name, $string = '') {
$content_type_info = _content_type_info();
$vid = $content_type_info['fields'][$field_name]['vid'];
$tid = content_taxonomy_field_get_parent($content_type_info['fields'][$field_name]);
// If the menu system has splitted the search text because of slashes, glue it back.
if (func_num_args() > 2) {
$args = func_get_args();
$string .= '/'. implode('/', array_slice($args, 2));
}
// The user enters a comma-separated list of tags. We only autocomplete the last tag.
$array = drupal_explode_tags($string);
@ -289,17 +287,17 @@ function content_taxonomy_autocomplete_load($field_name, $string = '') {
$matches = array();
if ($last_string != '') {
if ($tid) {
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
LEFT JOIN {term_synonym} s ON t.tid = s.tid
INNER JOIN {term_hierarchy} h ON t.tid = h.tid
WHERE h.parent = %d
WHERE h.parent = %d
AND (LOWER(t.name) LIKE LOWER('%%%s%%') OR LOWER(s.name) LIKE LOWER('%%%s%%'))", 't', 'tid'),
$tid,$last_string,$last_string,0,10);
}
else {
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
LEFT JOIN {term_synonym} s ON t.tid = s.tid
WHERE t.vid = %d
WHERE t.vid = %d
AND (LOWER(t.name) LIKE LOWER('%%%s%%') OR LOWER(s.name) LIKE LOWER('%%%s%%'))", 't', 'tid'),
$vid, $last_string, $last_string, 0, 10);
}
@ -335,7 +333,7 @@ function content_taxonomy_autocomplete_tags_get_tids($typed_input, $vid, $parent
// formatting so to save the term into the DB as the user intends.
$typed_term = trim(str_replace('""', '"', preg_replace('/^"(.*)"$/', '\1', $typed_term)));
if ($typed_term == "") { continue; }
// See if the term exists in the chosen vocabulary
// and return the tid, otherwise, add a new record.
$possibilities = taxonomy_get_term_by_name($typed_term);
@ -348,7 +346,7 @@ function content_taxonomy_autocomplete_tags_get_tids($typed_input, $vid, $parent
$parents = taxonomy_get_parents($possibility->tid);
if (in_array($parent, array_keys($parents)) || in_array($extra_parent, array_keys($parents))) {
$result['existing_tids'][$possibility->tid] = $possibility->tid;
$typed_term_tid = $possibility->tid;
$typed_term_tid = $possibility->tid;
}
}
else {