Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F32065409
lesoir.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
lesoir.php
View Options
<?php
//Page analysis for www.lesoir.be
class
LeSoirPage
extends
Page
{
function
analyse
(
$skipSpecificProcessing
=
false
)
{
parent
::
analyse
();
//Hardcoded known info
$this
->
site
=
"[[Le Soir]]"
;
//Allows to skip the analyis for ArchivesLeSoirPage
if
(
$skipSpecificProcessing
)
{
return
;
}
//Gets metadata
$meta
=
$this
->
between
(
'<div class="meta">'
,
'</div>'
);
$authors
=
trim
(
self
::
grab
(
$meta
,
'<strong>'
,
'</strong>'
));
$date
=
self
::
grab
(
$meta
,
'class="prettydate">'
,
','
);
//Processes metadata
$this
->
processAuthors
(
$authors
);
if
(
$date
)
{
$this
->
processDate
(
$date
);
}
}
protected
function
processDate
(
$date
)
{
$dateFragments
=
explode
(
' '
,
$date
);
if
(
count
(
$dateFragments
)
==
4
)
{
array_shift
(
$dateFragments
);
//drops day name
}
list
(
$this
->
dd
,
$this
->
mm
,
$this
->
yyyy
)
=
$dateFragments
;
}
protected
function
processAuthors
(
$authors
)
{
if
(
$authors
==
"Rédaction en ligne"
)
{
$this
->
skipAuthor
=
true
;
return
;
}
require_once
(
'helpers/namecase.php'
);
//Some Le Soir articles use firstname name, others name,firstname.
//When there are several authors, ' ;' is the separator.
//Authors are in uppercase, so we need to clean case.
$authors
=
explode
(
'; '
,
$authors
);
$start
=
true
;
foreach
(
$authors
as
$author
)
{
if
(
strpos
(
$author
,
','
)
!==
false
)
{
$name
=
explode
(
','
,
$author
,
2
);
$author
=
$name
[
1
]
.
' '
.
$name
[
0
];
}
$author
=
name_case
(
$author
);
if
(
$start
)
{
$this
->
author
=
name_case
(
$author
);
$start
=
false
;
}
else
{
$this
->
coauthors
[]
=
name_case
(
$author
);
}
}
}
/**
* Gets page title
*/
function
get_title
()
{
if
(!
$title
=
$this
->
meta_tags
[
'og:title'
])
{
$title
=
parent
::
get_title
();
}
return
$title
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Jun 8, 09:17 (13 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3773742
Default Alt Text
lesoir.php (2 KB)
Attached To
Mode
rSTG Source templates generator
Attached
Detach File
Event Timeline
Log In to Comment