コード例 #1
0
ファイル: config.php プロジェクト: smagic39/miniflux
function get_reader_config()
{
    $config = new ReaderConfig();
    $config->setTimezone(get('timezone'));
    // Client
    $config->setClientTimeout(HTTP_TIMEOUT);
    $config->setClientUserAgent(HTTP_USER_AGENT);
    // Grabber
    $config->setGrabberRulesFolder(RULES_DIRECTORY);
    // Proxy
    $config->setProxyHostname(PROXY_HOSTNAME);
    $config->setProxyPort(PROXY_PORT);
    $config->setProxyUsername(PROXY_USERNAME);
    $config->setProxyPassword(PROXY_PASSWORD);
    // Filter
    $config->setFilterIframeWhitelist(get_iframe_whitelist());
    if ((bool) get('debug_mode')) {
        Logger::enable();
    }
    // Parser
    $config->setParserHashAlgo('crc32b');
    return $config;
}
コード例 #2
0
 public function testGetRulesFolders()
 {
     // No custom path
     $loader = new RuleLoader(new Config());
     $dirs = $loader->getRulesFolders();
     $this->assertNotEmpty($dirs);
     $this->assertCount(1, $dirs);
     $this->assertTrue(strpos($dirs[0], '/../Rules') !== false);
     // Custom path
     $config = new Config();
     $config->setGrabberRulesFolder('/foobar/rules');
     $loader = new RuleLoader($config);
     $dirs = $loader->getRulesFolders();
     $this->assertNotEmpty($dirs);
     $this->assertCount(2, $dirs);
     $this->assertTrue(strpos($dirs[0], '/../Rules') !== false);
     $this->assertEquals('/foobar/rules', $dirs[1]);
     // No custom path with empty config object
     $loader = new RuleLoader(new Config());
     $dirs = $loader->getRulesFolders();
     $this->assertNotEmpty($dirs);
     $this->assertCount(1, $dirs);
     $this->assertTrue(strpos($dirs[0], '/../Rules') !== false);
 }