]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/3rdparty/config.php
[add] page which lists entries for a tag
[github/wallabag/wallabag.git] / inc / 3rdparty / config.php
CommitLineData
42c80841
NL
1<?php\r
2/* Full-Text RSS config */\r
3\r
4// ......IMPORTANT......................................\r
5// .....................................................\r
6// Please do not change this file (config.php) directly.\r
7// Save a copy as custom_config.php and make your\r
8// changes to that instead. It will automatically\r
9// override anything in config.php. Because config.php\r
10// always gets loaded anyway, you can simply specify\r
11// options you'd like to override in custom_config.php.\r
12// .....................................................\r
13\r
14// Create config object\r
15if (!isset($options)) $options = new stdClass();\r
16\r
17// Enable service\r
18// ----------------------\r
19// Set this to false if you want to disable the service.\r
20// If set to false, no feed is produced and users will \r
21// be told that the service is disabled.\r
22$options->enabled = true;\r
23\r
24// Debug mode\r
25// ----------------------\r
26// Enable or disable debugging. When enabled debugging works by passing\r
27// &debug to the makefulltextfeed.php querystring.\r
28// Valid values:\r
29// true or 'user' (default) - let user decide\r
30// 'admin' - debug works only for logged in admin users\r
31// false - disabled\r
32$options->debug = true;\r
33\r
34// Default entries (without access key)\r
35// ----------------------\r
36// The number of feed items to process when no API key is supplied\r
37// and no &max=x value is supplied in the querystring.\r
38$options->default_entries = 5;\r
39\r
40// Max entries (without access key)\r
41// ----------------------\r
42// The maximum number of feed items to process when no access key is supplied.\r
43// This limits the user-supplied &max=x value. For example, if the user\r
44// asks for 20 items to be processed (&max=20), if max_entries is set to \r
45// 10, only 10 will be processed.\r
46$options->max_entries = 10;\r
47\r
48// Rewrite relative URLs\r
49// ----------------------\r
50// With this enabled relative URLs found in the extracted content\r
51// block are automatically rewritten as absolute URLs.\r
52$options->rewrite_relative_urls = true;\r
53\r
54// Exclude items if extraction fails\r
55// ---------------------------------\r
56// Excludes items from the resulting feed\r
57// if we cannot extract any content from the\r
58// item URL.\r
59// Possible values...\r
60// Enable: true\r
61// Disable: false (default)\r
62// User decides: 'user' (this option will appear on the form)\r
63$options->exclude_items_on_fail = 'user';\r
64\r
65// Enable multi-page support\r
66// -------------------------\r
67// If enabled, we will try to follow next page links on multi-page articles.\r
68// Currently this only happens for sites where next_page_link has been defined \r
69// in a site config file.\r
70$options->multipage = true;\r
71\r
72// Enable caching\r
73// ----------------------\r
74// Enable this if you'd like to cache results\r
75// for 10 minutes. Cache files are written to disk (in cache/ subfolders\r
76// - which must be writable).\r
77// Initially it's best to keep this disabled to make sure everything works\r
78// as expected. If you have APC enabled, please also see smart_cache in the\r
79// advanced section.\r
80$options->caching = false;\r
81\r
82// Cache directory\r
83// ----------------------\r
84// Only used if caching is true\r
85$options->cache_dir = dirname(__FILE__).'/cache';\r
86\r
87// Message to prepend (without access key)\r
88// ----------------------\r
89// HTML to insert at the beginning of each feed item when no access key is supplied.\r
90// Substitution tags:\r
91// {url} - Feed item URL\r
92// {effective-url} - Feed item URL after we've followed all redirects\r
93$options->message_to_prepend = '';\r
94\r
95// Message to append (without access key)\r
96// ----------------------\r
97// HTML to insert at the end of each feed item when no access key is supplied.\r
98// Substitution tags:\r
99// {url} - Feed item URL\r
100// {effective-url} - Feed item URL after we've followed all redirects\r
101$options->message_to_append = '';\r
102\r
103// Error message when content extraction fails (without access key)\r
104// ----------------------\r
105$options->error_message = '[unable to retrieve full-text content]';\r
106\r
107// Keep enclosure in feed items\r
108// If enabled, we will try to preserve enclosures if present.\r
109// ----------------------\r
110$options->keep_enclosures = true;\r
111\r
112// Detect language\r
113// ---------------\r
114// Should we try and find/guess the language of the article being processed?\r
115// Values will be placed inside the <dc:language> element inside each <item> element\r
116// Possible values:\r
117// * Ignore language: 0\r
118// * Use article/feed metadata (e.g. HTML lang attribute): 1 (default)\r
119// * As above, but guess if not present: 2\r
120// * Always guess: 3\r
121// * User decides: 'user' (value of 0-3 can be passed in querystring: e.g. &l=2)\r
122$options->detect_language = 1;\r
123\r
124// Registration key\r
125// ---------------\r
126// The registration key is optional. It is not required to use Full-Text RSS, \r
127// and does not affect the normal operation of Full-Text RSS. It is currently \r
128// only used on admin pages which help you update site patterns with the \r
129// latest version offered by FiveFilters.org. For these admin-related \r
130// tasks to complete, we will require a valid registration key.\r
131// If you would like one, you can purchase the latest version of Full-Text RSS\r
132// at http://fivefilters.org/content-only/\r
133// Your registration key will automatically be sent in the confirmation email.\r
134// Once you have it, simply copy and paste it here.\r
135$options->registration_key = '';\r
136\r
137/////////////////////////////////////////////////\r
138/// RESTRICT ACCESS /////////////////////////////\r
139/////////////////////////////////////////////////\r
140\r
141// Admin credentials\r
142// ----------------------\r
143// Certain pages/actions, e.g. updating site patterns with our online tool, will require admin credentials.\r
144// To use these pages, enter a password here and you'll be prompted for it when you try to access those pages.\r
145// If no password or username is set, pages requiring admin privelages will be inaccessible. \r
146// The default username is 'admin'.\r
147// If overriding with an environment variable, separate username and password with a colon, e.g.:\r
148// ftr_admin_credentials: admin:my-secret-password\r
149// Example: $options->admin_credentials = array('username'=>'admin', 'password'=>'my-secret-password');\r
150$options->admin_credentials = array('username'=>'admin', 'password'=>'admin');\r
151\r
152// URLs to allow\r
153// ----------------------\r
154// List of URLs (or parts of a URL) which the service will accept.\r
155// If the list is empty, all URLs (except those specified in the blocked list below)\r
156// will be permitted.\r
157// Empty: array();\r
158// Non-empty example: array('example.com', 'anothersite.org');\r
159$options->allowed_urls = array();\r
160\r
161// URLs to block\r
162// ----------------------\r
163// List of URLs (or parts of a URL) which the service will not accept.\r
164// Note: this list is ignored if allowed_urls is not empty\r
165$options->blocked_urls = array();\r
166\r
167// Key holder(s) only?\r
168// ----------------------\r
169// Set this to true if you want to restrict access only to\r
170// those with a key (see below to specify key(s)).\r
171// If set to true, no feed is produced unless a valid\r
172// key is provided.\r
173$options->key_required = false;\r
174\r
175// Favour item titles in feed\r
176// ----------------------\r
177// By default, when processing feeds, we assume item titles in the feed\r
178// have not been truncated. So after processing web pages, the extracted titles\r
179// are not used in the generated feed. If you prefer to have extracted titles in \r
180// the feed you can either set this to false, in which case we will always favour \r
181// extracted titles. Alternatively, if set to 'user' (default) we'll use the \r
182// extracted title if you pass '&use_extracted_title' in the querystring.\r
183// Possible values:\r
184// * Favour feed titles: true \r
185// * Favour extracted titles: false\r
186// * Favour feed titles with user override: 'user' (default)\r
187// Note: this has no effect when the input URL is to a web page - in these cases\r
188// we always use the extracted title in the generated feed.\r
189$options->favour_feed_titles = 'user';\r
190\r
191// Access keys (password protected access)\r
192// ------------------------------------\r
193// NOTE: You do not need an API key from fivefilters.org to run your own \r
194// copy of the code. This is here if you'd like to restrict access to\r
195// _your_ copy.\r
196// Keys let you group users - those with a key and those without - and\r
197// restrict access to the service to those without a key.\r
198// If you want everyone to access the service in the same way, you can\r
199// leave the array below empty and ignore the access key options further down.\r
200// The options further down let you control how the service should behave \r
201// in each mode.\r
202// Note: Explicitly including the index number (1 and 2 in the examples below) \r
203// is highly recommended (when generating feeds, we encode the key and \r
204// refer to it by index number and hash).\r
205$options->api_keys = array();\r
206// Example:\r
207// $options->api_keys[1] = 'secret-key-1';\r
208// $options->api_keys[2] = 'secret-key-2';\r
209\r
210// Default entries (with access key)\r
211// ----------------------\r
212// The number of feed items to process when a valid access key is supplied.\r
213$options->default_entries_with_key = 5;\r
214\r
215// Max entries (with access key)\r
216// ----------------------\r
217// The maximum number of feed items to process when a valid access key is supplied.\r
218$options->max_entries_with_key = 10;\r
219\r
220/////////////////////////////////////////////////\r
221/// ADVANCED OPTIONS ////////////////////////////\r
222/////////////////////////////////////////////////\r
223\r
224// Enable XSS filter?\r
225// ----------------------\r
226// We have not enabled this by default because we assume the majority of\r
227// our users do not display the HTML retrieved by Full-Text RSS\r
228// in a web page without further processing. If you subscribe to our generated\r
229// feeds in your news reader application, it should, if it's good software, already\r
230// filter the resulting HTML for XSS attacks, making it redundant for\r
231// Full-Text RSS do the same. Similarly with frameworks/CMS which display\r
232// feed content - the content should be treated like any other user-submitted content.\r
233// \r
234// If you are writing an application yourself which is processing feeds generated by\r
235// Full-Text RSS, you can either filter the HTML yourself to remove potential XSS attacks\r
236// or enable this option. This might be useful if you are processing our generated\r
237// feeds with JavaScript on the client side - although there's client side xss\r
238// filtering available too, e.g. https://code.google.com/p/google-caja/wiki/JsHtmlSanitizer\r
239// \r
240// If enabled, we'll pass retrieved HTML content through htmLawed with\r
241// safe flag on and style attributes denied, see\r
242// http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm#s3.6\r
243// Note: if enabled this will also remove certain elements you may want to preserve, such as iframes.\r
244//\r
245// Valid values:\r
246// true - enabled, all content will be filtered\r
247// 'user' (default) - user must pass &xss in makefulltextfeed.php querystring to enable\r
248// false - disabled\r
249$options->xss_filter = 'user';\r
250\r
251// Allowed parsers\r
252// ----------------------\r
253// Full-Text RSS attempts to use PHP's libxml extension to process HTML.\r
254// While fast, on some sites it may not always produce good results. \r
255// For these sites, you can specify an alternative HTML parser: \r
256// parser: html5lib\r
257// The html5lib parser is bundled with Full-Text RSS.\r
258// see http://code.google.com/p/html5lib/\r
259//\r
260// To disable HTML parsing with html5lib, you can remove it from this list.\r
261// By default we allow both: libxml and html5lib.\r
262$options->allowed_parsers = array('libxml', 'html5lib');\r
263//$options->allowed_parsers = array('libxml'); //disable html5lib - forcing libxml in all cases\r
264\r
265// Enable Cross-Origin Resource Sharing (CORS)\r
266// ----------------------\r
267// If enabled we'll send the following HTTP header\r
268// Access-Control-Allow-Origin: *\r
269// see http://en.wikipedia.org/wiki/Cross-origin_resource_sharing\r
270$options->cors = false;\r
271\r
272// Use APC user cache?\r
273// ----------------------\r
274// If enabled we will store site config files (when requested \r
275// for the first time) in APC's user cache. Keys prefixed with 'sc.'\r
276// This improves performance by reducing disk access.\r
277// Note: this has no effect if APC is unavailable on your server.\r
278$options->apc = true;\r
279\r
280// Smart cache (experimental)\r
281// ----------------------\r
282// With this option enabled we will not cache to disk immediately.\r
283// We will store the cache key in APC and if it's requested again\r
284// we will cache results to disk. Keys prefixed with 'cache.'\r
285// This improves performance by reducing disk access.\r
286// Note: this has no effect if APC is disabled or unavailable on your server,\r
287// or if you have caching disabled.\r
288$options->smart_cache = true;\r
289\r
290// Fingerprints\r
291// ----------------------\r
292// key is fingerprint (fragment to find in HTML)\r
293// value is host name to use for site config lookup if fingerprint matches\r
294$options->fingerprints = array(\r
295 // Posterous\r
296 '<meta name="generator" content="Posterous"' => array('hostname'=>'fingerprint.posterous.com', 'head'=>true),\r
297 // Blogger\r
298 '<meta content=\'blogger\' name=\'generator\'' => array('hostname'=>'fingerprint.blogspot.com', 'head'=>true),\r
299 '<meta name="generator" content="Blogger"' => array('hostname'=>'fingerprint.blogspot.com', 'head'=>true),\r
300 // WordPress (hosted)\r
301 // '<meta name="generator" content="WordPress.com"' => array('hostname'=>'fingerprint.wordpress.com', 'head'=>true),\r
302 // WordPress (self-hosted and hosted)\r
303 '<meta name="generator" content="WordPress' => array('hostname'=>'fingerprint.wordpress.com', 'head'=>true)\r
304);\r
305\r
306// User Agent strings - mapping domain names\r
307// ----------------------\r
308// e.g. $options->user_agents = array('example.org' => 'PHP/5.2');\r
309$options->user_agents = array( 'lifehacker.com' => 'PHP/5.2',\r
310 'gawker.com' => 'PHP/5.2',\r
311 'deadspin.com' => 'PHP/5.2',\r
312 'kotaku.com' => 'PHP/5.2',\r
313 'jezebel.com' => 'PHP/5.2',\r
314 'io9.com' => 'PHP/5.2',\r
315 'jalopnik.com' => 'PHP/5.2',\r
316 'gizmodo.com' => 'PHP/5.2',\r
317 '.wikipedia.org' => 'Mozilla/5.2',\r
318 '.fok.nl' => 'Googlebot/2.1',\r
319 'getpocket.com' => 'PHP/5.2'\r
320 );\r
321\r
322// URL Rewriting\r
323// ----------------------\r
324// Currently allows simple string replace of URLs.\r
325// Useful for rewriting certain URLs to point to a single page\r
326// or HTML view. Although using the single_page_link site config\r
327// instruction is the preferred way to do this, sometimes, as\r
328// with Google Docs URLs, it's not possible.\r
329// Note: this might move to the site config file at some point.\r
330$options->rewrite_url = array(\r
331 // Rewrite public Google Docs URLs to point to HTML view:\r
332 // if a URL contains docs.google.com, replace /Doc? with /View?\r
333 'docs.google.com' => array('/Doc?' => '/View?'),\r
334 'tnr.com' => array('tnr.com/article/' => 'tnr.com/print/article/'),\r
335 '.m.wikipedia.org' => array('.m.wikipedia.org' => '.wikipedia.org'),\r
336 'm.vanityfair.com' => array('m.vanityfair.com' => 'www.vanityfair.com')\r
337);\r
338\r
339// Content-Type exceptions\r
340// -----------------------\r
341// Here you can define different actions based\r
342// on the Content-Type header returned by server.\r
343// MIME type as key, action as value.\r
344// Valid actions:\r
345// * 'exclude' - exclude this item from the result\r
346// * 'link' - create HTML link to the item\r
347$options->content_type_exc = array( \r
348 'application/pdf' => array('action'=>'link', 'name'=>'PDF'),\r
349 'image' => array('action'=>'link', 'name'=>'Image'),\r
350 'audio' => array('action'=>'link', 'name'=>'Audio'),\r
351 'video' => array('action'=>'link', 'name'=>'Video')\r
352 );\r
353\r
354// Cache directory level\r
355// ----------------------\r
356// Spread cache files over different directories (only used if caching is enabled).\r
357// Used to prevent large number of files in one directory.\r
358// This corresponds to Zend_Cache's hashed_directory_level\r
359// see http://framework.zend.com/manual/en/zend.cache.backends.html\r
360// It's best not to change this if you're unsure.\r
361$options->cache_directory_level = 0;\r
362\r
363// Cache cleanup\r
364// -------------\r
365// 0 = script will not clean cache (rename cachecleanup.php and use it for scheduled (e.g. cron) cache cleanup)\r
366// 1 = clean cache everytime the script runs (not recommended)\r
367// 100 = clean cache roughly once every 100 script runs\r
368// x = clean cache roughly once every x script runs\r
369// ...you get the idea :)\r
370$options->cache_cleanup = 100;\r
371\r
372/////////////////////////////////////////////////\r
373/// DO NOT CHANGE ANYTHING BELOW THIS ///////////\r
374/////////////////////////////////////////////////\r
375\r
376if (!defined('_FF_FTR_VERSION')) define('_FF_FTR_VERSION', '3.1');\r
377\r
378if (basename(__FILE__) == 'config.php') {\r
379 if (file_exists(dirname(__FILE__).'/custom_config.php')) {\r
380 require_once dirname(__FILE__).'/custom_config.php';\r
381 }\r
382 \r
383 // check for environment variables - often used on cloud platforms\r
384 // environment variables should be prefixed with 'ftr_', e.g.\r
385 // ftr_max_entries: 1\r
386 // will set the max_entries value to 1.\r
387 foreach ($options as $_key=>&$_val) {\r
388 $_key = "ftr_$_key";\r
389 if (($_env = getenv($_key)) !== false) {\r
390 if (is_array($_val)) {\r
391 if ($_key === 'ftr_admin_credentials') {\r
392 $_val = array_combine(array('username', 'password'), array_map('trim', explode(':', $_env, 2)));\r
393 if ($_val === false) $_val = array('username'=>'admin', 'password'=>'');\r
394 }\r
395 } elseif ($_env === 'true' || $_env === 'false') {\r
396 $_val = ($_env === 'true');\r
397 } elseif (is_numeric($_env)) {\r
398 $_val = (int)$_env;\r
399 } else { // string\r
400 $_val = $_env;\r
401 }\r
402 }\r
403 }\r
404 unset($_key, $_val, $_env);\r
405}