Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feeds-3407034
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
feeds-3407034
Commits
6a616460
Commit
6a616460
authored
15 years ago
by
Alex Barth
Browse files
Options
Downloads
Patches
Plain Diff
Add replacement with correct case in name.
parent
c8933751
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/FeedsHTTPFetcher.inc
+85
-0
85 additions, 0 deletions
plugins/FeedsHTTPFetcher.inc
with
85 additions
and
0 deletions
plugins/FeedsHTTPFetcher.inc
0 → 100644
+
85
−
0
View file @
6a616460
<?php
// $Id$
/**
* @file
* Home of the FeedsHTTPFetcher.
* @todo: Use all caps for HTTP.
*/
/**
* Fetches data via HTTP.
*/
class
FeedsHTTPFetcher
extends
FeedsFetcher
{
/**
* Fetch a resource via http.
*
* @param $resource
* A resource description of type FeedsResource.
*
* @return
* A string from the requested location if successful, or FALSE if not.
*/
public
function
fetch
(
FeedsSource
$source
)
{
$source_config
=
$source
->
getConfigFor
(
$this
);
$url
=
$source_config
[
'source'
];
feeds_include_library
(
'http_request.inc'
,
'http_request'
);
if
(
$this
->
config
[
'auto_detect_feeds'
])
{
$result
=
http_request_get_common_syndication
(
$url
);
}
else
{
$result
=
http_request_get
(
$url
);
}
return
new
FeedsFetcherResult
(
$result
->
data
,
'text/xml'
);
}
/**
* Clear caches.
*/
public
function
clear
(
FeedsSource
$source
)
{
$source_config
=
$source
->
getConfigFor
(
$this
);
$url
=
$source_config
[
'source'
];
feeds_include_library
(
'http_request.inc'
,
'http_request'
);
http_request_clear_cache
(
$url
);
}
/**
* Expose source form.
*/
public
function
sourceForm
(
$source_config
)
{
$form
=
array
();
$form
[
'source'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'URL'
),
'#description'
=>
t
(
'Enter a feed URL.'
),
'#default_value'
=>
isset
(
$source_config
[
'source'
])
?
$source_config
[
'source'
]
:
''
,
'#required'
=>
TRUE
,
);
return
$form
;
}
/**
* Override parent::configDefaults().
*/
public
function
configDefaults
()
{
return
array
(
'auto_detect_feeds'
=>
FALSE
);
}
/**
* Configuration form.
*/
public
function
configForm
(
&
$form_state
)
{
$form
=
array
();
return
$form
;
// @todo:
$form
[
'auto_detect_feeds'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Auto detect feeds (not tested)'
),
'#description'
=>
t
(
'Auto detect RSS or Atom feeds in the downloaded document and use them instead of the given URL.'
),
'#default_value'
=>
$this
->
config
[
'auto_detect_feeds'
],
);
return
$form
;
}
}
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