Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F18126566
formula1.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
988 B
Referenced Files
None
Subscribers
None
formula1.php
View Options
<?php
/**
* Represents a page from the http://www.formula1.com/ site.
*/
class
Formula1Page
extends
Page
{
/**
* Analyses the page and extracts metadata
*/
function
analyse
()
{
parent
::
analyse
();
$this
->
skipAuthor
=
true
;
$this
->
title
=
$this
->
getTitle
();
$this
->
yyyy
=
$this
->
getYear
();
$this
->
skipMD
=
true
;
$this
->
site
=
"Formula 1"
;
}
function
getTitle
()
{
$title
=
$this
->
between
(
'<h2>'
,
'</h2>'
);
$title
=
str_replace
(
'<sup>®</sup>'
,
''
,
$title
);
$title
=
preg_replace
(
'@
\s
+@'
,
' '
,
$title
);
return
trim
(
$title
);
}
function
getYear
()
{
$candidateSources
=
[
$this
->
url
,
$this
->
title
];
foreach
(
$candidateSources
as
$candidateSource
)
{
if
(
preg_match
(
"@
\b
(20[0-9][0-9])
\b
@"
,
$candidateSource
,
$matches
))
{
return
$matches
[
1
];
}
}
return
null
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Dec 19, 22:17 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3267526
Default Alt Text
formula1.php (988 B)
Attached To
Mode
rSTG Source templates generator
Attached
Detach File
Event Timeline
Log In to Comment