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,7 +1,4 @@
<?php
// $Id: content_taxonomy.module,v 1.2.2.15.2.33 2009/08/19 12:45:58 mh86 Exp $
/**
* @file
* Defines a field type for referencing a taxonomy term.
@ -63,20 +60,20 @@ function content_taxonomy_field_settings($op, $field) {
switch ($op) {
case 'form':
$form = array();
$form['save_term_node'] = array(
'#type' => 'checkbox',
'#type' => 'checkbox',
'#title' => t('Save values additionally to the core taxonomy system (into the \'term_node\' table).'),
'#default_value' => is_numeric($field['save_term_node']) ? $field['save_term_node'] : 0,
'#description' => t('If this option is set, saving of terms is additionally handled by the taxonomy module. So saved terms from Content Taxonomy fields will appear as any other terms saved by the core taxonomy module. Set this option if you are using any other taxonomy application, like tagadelic. Otherwise terms are only saved in the cck tables and can only be accessed via the node or a view'),
'#description' => t('If this option is set, saving of terms is additionally handled by the taxonomy module. So saved terms from Content Taxonomy fields will appear as any other terms saved by the core taxonomy module. Set this option if you are using any other taxonomy application, like tagadelic. Otherwise terms are only saved in the cck tables and can only be accessed via the node or a view'),
);
$options_voc = array();
foreach (taxonomy_get_vocabularies() as $voc) {
_content_taxonomy_localize_vocabulary($voc);
$options_voc[$voc->vid] = $voc->name;
}
$form['vid'] = array(
'#title' => t('Vocabulary'),
'#type' => 'select',
@ -84,13 +81,13 @@ function content_taxonomy_field_settings($op, $field) {
'#options' => $options_voc,
'#description' => t('Terms of the selected vocabulary get exposed to the field'),
);
$form['hierarchical_vocabulary'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings for hierarchical vocabularies'),
'#collapsible' => TRUE,
);
$form['hierarchical_vocabulary']['parent'] = array(
'#title' => t('Parent Term'),
'#type' => 'select',
@ -118,22 +115,22 @@ function content_taxonomy_field_settings($op, $field) {
'#default_value' => is_numeric($field['depth']) ? $field['depth'] : '',
'#description' => t('By setting a numeric value, the depth of the hierarchy shown can be limited. Leave this field blank to show the whole hierarchy.'),
);
return $form;
return $form;
case 'save':
return array('save_term_node', 'vid', 'parent', 'parent_php_code', 'depth');
case 'database columns':
return array(
'value' => array('type' => 'int', 'not null' => FALSE, 'sortable' => FALSE),
);
case 'views data':
$data = content_views_field_views_data($field);
$table_alias = content_views_tablename($field);
// Add a relation to the taxonomy term table.
$data[$table_alias][$field['field_name'] .'_value']['relationship'] = array(
'handler' => 'views_handler_relationship',
@ -152,7 +149,7 @@ function content_taxonomy_field_settings($op, $field) {
* Implementation of hook_field().
*/
function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
switch ($op) {
switch ($op) {
case 'presave':
if ($field['save_term_node']) {
static $_content_taxonomy_array_cleared;
@ -160,10 +157,10 @@ function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
_content_taxonomy_taxonomy_unset($node->taxonomy, array($field['vid']));
$_content_taxonomy_array_cleared[$node->nid][$field['vid']] = TRUE;
}
foreach ($items as $key => $entry) {
if ($entry['value']) {
if (is_object($node->taxonomy[$entry['value']])
if (is_object($node->taxonomy[$entry['value']])
|| (is_array($node->taxonomy) && in_array($entry['value'], $node->taxonomy))
|| (isset($entry['_remove']) && $entry['_remove'] == 1)) {
continue;
@ -182,7 +179,7 @@ function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
}
}
}
// the $node->taxonomy array should never be empty, because in this case the
// the $node->taxonomy array should never be empty, because in this case the
// taxonomy nodeapi doesn't call taxonomy_node_save which handles removing
// and inserting of terms
if (empty($node->taxonomy)) {
@ -251,16 +248,16 @@ function content_taxonomy_content_is_empty($item, $field) {
*/
function content_taxonomy_allowed_values($field) {
$options = array();
//for opt groups call different function
if (isset($field['widget']['group_parent']) && $field['widget']['group_parent'] > 0) {
return content_taxonomy_allowed_values_groups($field);
}
$depth = (is_numeric($field['depth'])) ? $field['depth'] : NULL;
$tree = taxonomy_get_tree($field['vid'], content_taxonomy_field_get_parent($field), -1, $depth);
if (is_array($tree)) {
foreach ($tree as $term) {
_content_taxonomy_localize_term($term);
@ -280,14 +277,14 @@ function content_taxonomy_allowed_values($field) {
return $options;
}
/**
/**
* Creating Opt Groups for content_taxonomy_options
*/
function content_taxonomy_allowed_values_groups($field) {
$options = array();
$parent = content_taxonomy_field_get_parent($field);
$group_parent = $field['widget']['group_parent'];
//if children in no group
$default_terms = taxonomy_get_children($parent, $field['vid']);
foreach ($default_terms as $default_term) {
@ -345,13 +342,13 @@ function content_taxonomy_form_alter(&$form, $form_state, $form_id) {
}
}
_content_taxonomy_taxonomy_unset($form['taxonomy'], $_content_taxonomy_vids);
//hide empty 'Vocabularies' fieldsets
$empty_fieldset = TRUE;
if (is_array($form['taxonomy'])) {
foreach ($form['taxonomy'] as $key => $value) {
if (is_array($value) && !empty($value)) {
$empty_fieldset = FALSE;
$empty_fieldset = FALSE;
break;
}
}
@ -423,7 +420,7 @@ function content_taxonomy_views_api() {
*/
function content_taxonomy_fields() {
static $ct_fields;
if (!is_array($ct_fields)) {
$ct_fields = array();
foreach (content_types() as $type_name => $type) {
@ -438,7 +435,7 @@ function content_taxonomy_fields() {
}
/**
/**
* Helper functions that returns all terms group by their vocabulary
*
* needed for some settings forms
@ -452,7 +449,7 @@ function _content_taxonomy_get_all_terms() {
_content_taxonomy_localize_term($term);
$options[$voc->name][$term->tid] = str_repeat('- ', $term->depth) . $term->name;
}
}
}
}
return $options;
}
@ -489,7 +486,7 @@ function _content_taxonomy_localize_vocabulary(&$vocabulary) {
/**
* carefully unsets node or node form taxonomy items
*
*
*
* @param $form the node or node form's taxonomy selections. nodes are objects and forms are arrays, so only the actual taxonomy value or property is passed
* @param $vids an array containing a list of vocabulary IDs whose terms should be unset
@ -533,7 +530,7 @@ function content_taxonomy_content_diff_values($node, $field, $items) {
foreach ($items as $item) {
if (isset($item['value']) && is_numeric($item['value'])) {
$term = taxonomy_get_term($item['value']);
$return[] = $term->name;
$return[] = $term->name;
}
}
return $return;