Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feeds
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
feeds
Commits
dd9ef226
Commit
dd9ef226
authored
14 years ago
by
Alex Barth
Browse files
Options
Downloads
Patches
Plain Diff
Consolidate loadMappers() after latest commit. Update comments.
parent
eba294d4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plugins/FeedsNodeProcessor.inc
+0
-20
0 additions, 20 deletions
plugins/FeedsNodeProcessor.inc
plugins/FeedsProcessor.inc
+33
-5
33 additions, 5 deletions
plugins/FeedsProcessor.inc
plugins/FeedsUserProcessor.inc
+1
-20
1 addition, 20 deletions
plugins/FeedsUserProcessor.inc
with
34 additions
and
45 deletions
plugins/FeedsNodeProcessor.inc
+
0
−
20
View file @
dd9ef226
...
@@ -294,26 +294,6 @@ class FeedsNodeProcessor extends FeedsProcessor {
...
@@ -294,26 +294,6 @@ class FeedsNodeProcessor extends FeedsProcessor {
return
0
;
return
0
;
}
}
/**
* Loads on-behalf implementations from mappers/
*/
protected
static
function
loadMappers
()
{
static
$loaded
=
FALSE
;
if
(
!
$loaded
)
{
$path
=
drupal_get_path
(
'module'
,
'feeds'
)
.
'/mappers'
;
$files
=
drupal_system_listing
(
'.*\.inc$'
,
$path
,
'name'
,
0
);
foreach
(
$files
as
$file
)
{
if
(
strstr
(
$file
->
filename
,
'/mappers/'
))
{
require_once
(
"./
$file->filename
"
);
}
}
// Rebuild cache.
module_implements
(
''
,
FALSE
,
TRUE
);
}
$loaded
=
TRUE
;
}
/**
/**
* Create MD5 hash of $item array.
* Create MD5 hash of $item array.
* @return Always returns a hash, even with empty, NULL, FALSE:
* @return Always returns a hash, even with empty, NULL, FALSE:
...
...
This diff is collapsed.
Click to expand it.
plugins/FeedsProcessor.inc
+
33
−
5
View file @
dd9ef226
...
@@ -62,10 +62,12 @@ abstract class FeedsProcessor extends FeedsPlugin {
...
@@ -62,10 +62,12 @@ abstract class FeedsProcessor extends FeedsPlugin {
}
}
/**
/**
* Execute mapping on an item. This method encapsulates the central mapping
* Execute mapping on an item.
* functionality. When an item is processed, it is passed through map() where
*
* the properties of $source_item are mapped onto $target_item following
* This method encapsulates the central mapping functionality. When an item is
* the processor's mapping configuration.
* processed, it is passed through map() where the properties of $source_item
* are mapped onto $target_item following the processor's mapping
* configuration.
*
*
* For each mapping FeedsParser::getSourceElement() is executed to retrieve
* For each mapping FeedsParser::getSourceElement() is executed to retrieve
* the source element, then FeedsProcessor::setTargetElement() is invoked
* the source element, then FeedsProcessor::setTargetElement() is invoked
...
@@ -76,9 +78,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
...
@@ -76,9 +78,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
*
*
* @ingroup mappingapi
* @ingroup mappingapi
*
*
* @see hook_feeds_data_processor_targets_alter()
* @see hook_feeds_node_processor_targets_alter()
* @see hook_feeds_node_processor_targets_alter()
* @see hook_feeds_term_processor_targets_alter()
* @see hook_feeds_term_processor_targets_alter()
* @see hook_feeds_
data
_processor_targets_alter()
* @see hook_feeds_
user
_processor_targets_alter()
*/
*/
protected
function
map
(
$source_item
,
$target_item
=
NULL
)
{
protected
function
map
(
$source_item
,
$target_item
=
NULL
)
{
...
@@ -245,4 +248,29 @@ abstract class FeedsProcessor extends FeedsPlugin {
...
@@ -245,4 +248,29 @@ abstract class FeedsProcessor extends FeedsPlugin {
}
}
return
$targets
;
return
$targets
;
}
}
/**
* Loads on-behalf implementations from mappers/ directory.
*
* FeedsProcessor::map() does not load from mappers/ as only node and user
* processor ship with on-behalf implementations.
*
* @see FeedsNodeProcessor::map()
* @see FeedsUserProcessor::map()
*/
protected
static
function
loadMappers
()
{
static
$loaded
=
FALSE
;
if
(
!
$loaded
)
{
$path
=
drupal_get_path
(
'module'
,
'feeds'
)
.
'/mappers'
;
$files
=
drupal_system_listing
(
'.*\.inc$'
,
$path
,
'name'
,
0
);
foreach
(
$files
as
$file
)
{
if
(
strstr
(
$file
->
filename
,
'/mappers/'
))
{
require_once
(
"./
$file->filename
"
);
}
}
// Rebuild cache.
module_implements
(
''
,
FALSE
,
TRUE
);
}
$loaded
=
TRUE
;
}
}
}
This diff is collapsed.
Click to expand it.
plugins/FeedsUserProcessor.inc
+
1
−
20
View file @
dd9ef226
...
@@ -93,26 +93,6 @@ class FeedsUserProcessor extends FeedsProcessor {
...
@@ -93,26 +93,6 @@ class FeedsUserProcessor extends FeedsProcessor {
throw
new
Exception
(
t
(
'User processor does not support deleting users.'
));
throw
new
Exception
(
t
(
'User processor does not support deleting users.'
));
}
}
/**
* Loads on-behalf implementations from mappers/
*/
protected
static
function
loadMappers
()
{
static
$loaded
=
FALSE
;
if
(
!
$loaded
)
{
$path
=
drupal_get_path
(
'module'
,
'feeds'
)
.
'/mappers'
;
$files
=
drupal_system_listing
(
'.*\.inc$'
,
$path
,
'name'
,
0
);
foreach
(
$files
as
$file
)
{
if
(
strstr
(
$file
->
filename
,
'/mappers/'
))
{
require_once
(
"./
$file->filename
"
);
}
}
// Rebuild cache.
module_implements
(
''
,
FALSE
,
TRUE
);
}
$loaded
=
TRUE
;
}
/**
/**
* Execute mapping on an item.
* Execute mapping on an item.
*/
*/
...
@@ -124,6 +104,7 @@ class FeedsUserProcessor extends FeedsProcessor {
...
@@ -124,6 +104,7 @@ class FeedsUserProcessor extends FeedsProcessor {
$target_account
->
status
=
$this
->
config
[
'status'
];
$target_account
->
status
=
$this
->
config
[
'status'
];
// Have parent class do the iterating.
// Have parent class do the iterating.
self
::
loadMappers
();
return
parent
::
map
(
$source_item
,
$target_account
);
return
parent
::
map
(
$source_item
,
$target_account
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment