FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
readability.php/src/Configuration.php at master · fivefilters/readability.php · GitHub
fivefilters
/
readability.php
Public
forked from
andreskrey/readability.php
Notifications
You must be signed in to change notification settings
Fork
39
Star
329
Code
Issues
0
Pull requests
0
Discussions
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
readability.php
/
src
/
Configuration.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
77 lines (73 loc) · 3.73 KB
Breadcrumbs
readability.php
/
src
/
Configuration.php
Copy path
File metadata and controls
77 lines (73 loc) · 3.73 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
declare
(strict_types=
1
);
namespace
fivefilters
\
Readability
;
/**
* Options for Readability.
*
* Defaults match the option defaults of Readability.js v0.6.0.
*/
final
class
Configuration
{
public
function
__construct
(
/** Whether to output debug messages via error_log() (JS: debug). */
public
readonly
bool
$
debug
=
false
,
/**
* PHP-specific: an optional PSR-3 logger. When set, Readability's debug
* messages are sent to it (independently of the debug flag, which only
* governs error_log()). Reinstated from readability.php 3.x.
*/
public
readonly
?
\
Psr
\
Log
\
LoggerInterface
$
logger
=
null
,
/** The maximum number of elements to parse; 0 means no limit (JS: maxElemsToParse). */
public
readonly
int
$
maxElemsToParse
=
0
,
/** The number of top candidates to consider when analysing how tight the competition is among candidates (JS: nbTopCandidates). */
public
readonly
int
$
nbTopCandidates
=
5
,
/** The number of characters an article must have in order to return a result (JS: charThreshold). */
public
readonly
int
$
charThreshold
=
500
,
/** Classes to preserve on HTML elements when keepClasses is false (JS: classesToPreserve). @var list<string> */
public
readonly
array
$
classesToPreserve
= [],
/** Whether to preserve all classes on HTML elements (JS: keepClasses). */
public
readonly
bool
$
keepClasses
=
false
,
/** Whether to skip JSON-LD metadata extraction (JS: disableJSONLD). */
public
readonly
bool
$
disableJSONLD
=
false
,
/** PCRE pattern for video URLs allowed to remain embedded; null uses the built-in default (JS: allowedVideoRegex). */
public
readonly
?
string
$
allowedVideoRegex
=
null
,
/** Number added to the base link density threshold during shadiness checks (JS: linkDensityModifier). */
public
readonly
float
$
linkDensityModifier
=
0.0
,
/**
* PHP-specific: unlike a browser there is no live document with a base URI,
* so relative URL fixing is opt-in and needs the document's URL supplied.
*/
public
readonly
bool
$
fixRelativeURLs
=
false
,
public
readonly
?
string
$
originalURL
=
null
,
/**
* PHP-specific: keep an inline byline (e.g. a "By Jane Doe" element) in
* the article content instead of removing it. The byline is still
* extracted into Article::$byline either way. Readability.js always
* removes it; readability.php 3.x kept it unless articleByline was set.
*/
public
readonly
bool
$
keepInlineByline
=
false
,
/**
* PHP-specific: extract only the title and metadata, skipping content
* extraction entirely. parse() then skips every stage that mutates
* the document (noscript image unwrapping, script removal, document
* prep, and the article grab itself), so a passed-in
* \Dom\HTMLDocument is guaranteed to be left unmodified. The
* returned Article has the content-derived properties set to null
* (hasContent() returns false), as when no content is found.
*/
public
readonly
bool
$
metadataOnly
=
false
,
/** Internal flag toggles carried over from the previous major version (always on in JS). */
public
readonly
bool
$
stripUnlikelyCandidates
=
true
,
public
readonly
bool
$
weightClasses
=
true
,
public
readonly
bool
$
cleanConditionally
=
true
,
) {
}
/**
* Build a Configuration from an options array keyed by property name,
* e.g. ['fixRelativeURLs' => true, 'originalURL' => 'https://example.com/'].
*/
public
static
function
fromArray
(
array
$
options
):
self
{
return
new
self
(...
$
options
);
}
}
Back
|
FazBrowse Home
|
New Git URL