contrib modules security updates
This commit is contained in:
@@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_feeds_processor_targets_alter().
|
||||
*
|
||||
* @see FeedsNodeProcessor::getMappingTargets().
|
||||
* Implements hook_feeds_processor_targets().
|
||||
*/
|
||||
function path_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
|
||||
function path_feeds_processor_targets($entity_type, $bundle_name) {
|
||||
$targets = array();
|
||||
|
||||
switch ($entity_type) {
|
||||
case 'node':
|
||||
case 'taxonomy_term':
|
||||
@@ -19,28 +19,27 @@ function path_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_nam
|
||||
'name' => t('Path alias'),
|
||||
'description' => t('URL path alias of the node.'),
|
||||
'callback' => 'path_feeds_set_target',
|
||||
'summary_callback' => 'path_feeds_summary_callback',
|
||||
'form_callback' => 'path_feeds_form_callback',
|
||||
'summary_callbacks' => array('path_feeds_summary_callback'),
|
||||
'form_callbacks' => array('path_feeds_form_callback'),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return $targets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for mapping. Here is where the actual mapping happens.
|
||||
*
|
||||
* When the callback is invoked, $target contains the name of the field the
|
||||
* user has decided to map to and $value contains the value of the feed item
|
||||
* element the user has picked as a source.
|
||||
* Callback for mapping path aliases.
|
||||
*/
|
||||
function path_feeds_set_target($source, $entity, $target, $value, $mapping) {
|
||||
if (empty($value)) {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
// Path alias cannot be multi-valued, so use the first value.
|
||||
if (is_array($value)) {
|
||||
$value = $value[0];
|
||||
function path_feeds_set_target(FeedsSource $source, $entity, $target, array $values, array $mapping) {
|
||||
$alias = FALSE;
|
||||
// Path alias cannot be multi-valued, so use the first non-empty value.
|
||||
foreach ($values as $value) {
|
||||
$value = ltrim(trim($value), '/');
|
||||
if (strlen($value)) {
|
||||
$alias = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$entity->path = array();
|
||||
@@ -58,37 +57,17 @@ function path_feeds_set_target($source, $entity, $target, $value, $mapping) {
|
||||
}
|
||||
}
|
||||
|
||||
$entity->path['pathauto'] = FALSE;
|
||||
// Allow pathauto to set the path alias if the option is set, and this value
|
||||
// is empty.
|
||||
if (!empty($mapping['pathauto_override']) && !$value) {
|
||||
$entity->path['pathauto'] = TRUE;
|
||||
}
|
||||
else {
|
||||
$entity->path['alias'] = ltrim($value, '/');
|
||||
}
|
||||
// Allow pathauto to set the path alias if the option is set, and the value is
|
||||
// empty.
|
||||
$entity->path['pathauto'] = !empty($mapping['pathauto_override']) && $alias === FALSE;
|
||||
|
||||
$entity->path['alias'] = (string) $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mapping configuration summary for path.module.
|
||||
*
|
||||
* @param $mapping
|
||||
* Associative array of the mapping settings.
|
||||
* @param $target
|
||||
* Array of target settings, as defined by the processor or
|
||||
* hook_feeds_processor_targets_alter().
|
||||
* @param $form
|
||||
* The whole mapping form.
|
||||
* @param $form_state
|
||||
* The form state of the mapping form.
|
||||
*
|
||||
* @return
|
||||
* Returns, as a string that may contain HTML, the summary to display while
|
||||
* the full form isn't visible.
|
||||
* If the return value is empty, no summary and no option to view the form
|
||||
* will be displayed.
|
||||
*/
|
||||
function path_feeds_summary_callback($mapping, $target, $form, $form_state) {
|
||||
function path_feeds_summary_callback(array $mapping, $target, array $form, array $form_state) {
|
||||
if (!module_exists('pathauto')) {
|
||||
return;
|
||||
}
|
||||
@@ -104,12 +83,8 @@ function path_feeds_summary_callback($mapping, $target, $form, $form_state) {
|
||||
|
||||
/**
|
||||
* Settings form callback.
|
||||
*
|
||||
* @return
|
||||
* The per mapping configuration form. Once the form is saved, $mapping will
|
||||
* be populated with the form values.
|
||||
*/
|
||||
function path_feeds_form_callback($mapping, $target, $form, $form_state) {
|
||||
function path_feeds_form_callback(array $mapping, $target, array $form, array $form_state) {
|
||||
return array(
|
||||
'pathauto_override' => array(
|
||||
'#type' => 'checkbox',
|
||||
|
||||
Reference in New Issue
Block a user