Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
b543d6b4
Commit
b543d6b4
authored
Apr 08, 2010
by
Evan Goldenberg
Browse files
make the number of external feed items configurable (bug #547089)
Signed-off-by:
Evan Goldenberg
<
evang@catalyst.net.nz
>
parent
79fb1a92
Changes
2
Show whitespace changes
Inline
Side-by-side
htdocs/blocktype/externalfeed/lang/en.utf8/blocktype.externalfeed.php
View file @
b543d6b4
...
...
@@ -31,6 +31,8 @@ $string['title'] = 'External Feed';
$string
[
'description'
]
=
'Embed an external RSS or ATOM feed'
;
$string
[
'feedlocation'
]
=
'Feed location'
;
$string
[
'feedlocationdesc'
]
=
'URL of a valid RSS or ATOM feed'
;
$string
[
'itemstoshow'
]
=
'Items to show'
;
$string
[
'itemstoshowdescription'
]
=
'Between 1 and 20'
;
$string
[
'showfeeditemsinfull'
]
=
'Show feed items in full?'
;
$string
[
'showfeeditemsinfulldesc'
]
=
'Whether to show a summary of the feed items, or show the description for each one too'
;
$string
[
'invalidurl'
]
=
'That URL is invalid. You can only view feeds for http and https URLs.'
;
...
...
htdocs/blocktype/externalfeed/lib.php
View file @
b543d6b4
...
...
@@ -61,6 +61,10 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
$data
->
content
=
unserialize
(
$data
->
content
);
$data
->
image
=
unserialize
(
$data
->
image
);
// only keep the number of entries the user asked for
$chunks
=
array_chunk
(
$data
->
content
,
$configdata
[
'count'
]);
$data
->
content
=
$chunks
[
0
];
// Attempt to fix relative URLs in the feeds
if
(
!
empty
(
$data
->
image
[
'link'
]))
{
$data
->
description
=
preg_replace
(
...
...
@@ -125,6 +129,15 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
'maxlength'
=>
2048
,
// See install.xml for this plugin - MySQL can only safely handle up to 255 chars
),
),
'count'
=>
array
(
'type'
=>
'text'
,
'title'
=>
get_string
(
'itemstoshow'
,
'blocktype.externalfeed'
),
'description'
=>
get_string
(
'itemstoshowdescription'
,
'blocktype.externalfeed'
),
'defaultvalue'
=>
isset
(
$configdata
[
'count'
])
?
$configdata
[
'count'
]
:
10
,
'size'
=>
3
,
'minvalue'
=>
1
,
'maxvalue'
=>
20
,
),
'full'
=>
array
(
'type'
=>
'checkbox'
,
'title'
=>
get_string
(
'showfeeditemsinfull'
,
'blocktype.externalfeed'
),
...
...
@@ -308,7 +321,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
$data
->
content
=
array
();
foreach
(
$feed
as
$count
=>
$item
)
{
if
(
$count
==
1
0
)
{
if
(
$count
==
2
0
)
{
break
;
}
$description
=
$item
->
content
?
$item
->
content
:
(
$item
->
description
?
$item
->
description
:
(
$item
->
summary
?
$item
->
summary
:
null
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment