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
7471724c
Commit
7471724c
authored
Jul 11, 2013
by
Son Nguyen
Committed by
Gerrit Code Review
Jul 11, 2013
Browse files
Merge "Check if rss feed is not empty and an array first (Bug #1191605)"
parents
d1a1413a
dccd7655
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/blocktype/externalfeed/lib.php
View file @
7471724c
...
@@ -75,13 +75,13 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
...
@@ -75,13 +75,13 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
}
}
// only keep the number of entries the user asked for
// only keep the number of entries the user asked for
if
(
count
(
$data
->
content
))
{
if
(
count
(
$data
->
content
)
&&
!
empty
(
$data
->
content
)
&&
is_array
(
$data
->
content
)
)
{
$chunks
=
array_chunk
(
$data
->
content
,
isset
(
$configdata
[
'count'
])
?
$configdata
[
'count'
]
:
10
);
$chunks
=
array_chunk
(
$data
->
content
,
isset
(
$configdata
[
'count'
])
?
$configdata
[
'count'
]
:
10
);
$data
->
content
=
$chunks
[
0
];
$data
->
content
=
$chunks
[
0
];
}
foreach
(
$data
->
content
as
$k
=>
$c
)
{
foreach
(
$data
->
content
as
$k
=>
$c
)
{
$data
->
content
[
$k
]
->
link
=
sanitize_url
(
$c
->
link
);
$data
->
content
[
$k
]
->
link
=
sanitize_url
(
$c
->
link
);
}
}
}
// Attempt to fix relative URLs in the feeds
// Attempt to fix relative URLs in the feeds
...
@@ -91,12 +91,14 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
...
@@ -91,12 +91,14 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
'src="'
.
$data
->
image
[
'link'
]
.
'$1"'
,
'src="'
.
$data
->
image
[
'link'
]
.
'$1"'
,
$data
->
description
$data
->
description
);
);
foreach
(
$data
->
content
as
&
$entry
)
{
if
(
!
empty
(
$data
->
content
)
&&
is_array
(
$data
->
content
))
{
$entry
->
description
=
preg_replace
(
foreach
(
$data
->
content
as
&
$entry
)
{
'/src="(\/[^"]+)"/'
,
$entry
->
description
=
preg_replace
(
'src="'
.
$data
->
image
[
'link'
]
.
'$1"'
,
'/src="(\/[^"]+)"/'
,
$entry
->
description
'src="'
.
$data
->
image
[
'link'
]
.
'$1"'
,
);
$entry
->
description
);
}
}
}
}
}
...
...
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