Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56961313
formula1.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
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, Nov 13, 20:09 (1 d, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4247657
Default Alt Text
formula1.php (988 B)
Attached To
Mode
rSTG Source templates generator
Attached
Detach File
Event Timeline
Log In to Comment