mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-27 06:26:17 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f71c3a4196 | ||
|
|
255a2fc7bc | ||
|
|
b77876b30a | ||
|
|
1830dc45d4 | ||
|
|
6be1f9b984 | ||
|
|
175196d6c2 | ||
|
|
2b5af601d5 | ||
|
|
d01eb2ac1e | ||
|
|
c5a4a490e1 | ||
|
|
908a49824f | ||
|
|
c67189248e | ||
|
|
91b80b70e2 | ||
|
|
8667dae74b | ||
|
|
eecae93161 | ||
|
|
814c6e4730 | ||
|
|
b69619d386 | ||
|
|
1963319a55 | ||
|
|
f5d473780d |
@@ -1 +1,3 @@
|
||||
vendor/
|
||||
coverage/
|
||||
composer.lock
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 600
|
||||
+23
-2
@@ -1,13 +1,34 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3.3
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- nightly
|
||||
- hhvm
|
||||
|
||||
# run build against nightly but allow them to fail
|
||||
matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
- php: hhvm
|
||||
|
||||
# faster builds on new travis setup not using sudo
|
||||
sudo: false
|
||||
|
||||
install:
|
||||
- composer self-update
|
||||
|
||||
before_script:
|
||||
- composer self-update
|
||||
- composer install --prefer-dist --no-interaction
|
||||
|
||||
script:
|
||||
- phpunit --coverage-text
|
||||
- phpunit --coverage-clover=coverage.clover
|
||||
|
||||
after_script:
|
||||
- |
|
||||
wget https://scrutinizer-ci.com/ocular.phar
|
||||
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# Readability
|
||||
|
||||
[](https://travis-ci.org/j0k3r/php-readability)
|
||||
[](https://scrutinizer-ci.com/g/j0k3r/php-readability/?branch=master)
|
||||
|
||||
This is an extract of the Readability class from the [full-text-rss](https://github.com/Dither/full-text-rss) fork. It kind be defined as a better version of the original [php-readability](http://code.fivefilters.org/php-readability).
|
||||
This is an extract of the Readability class from the [full-text-rss](https://github.com/Dither/full-text-rss) fork. It kind be defined as a better version of the original [php-readability](https://bitbucket.org/fivefilters/php-readability/overview).
|
||||
|
||||
## Differences
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
"role": "Developer (original JS version)"
|
||||
}],
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"php": ">=5.3.3",
|
||||
"ext-tidy": ">=1.2"
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
+4
-1
@@ -19,11 +19,14 @@
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./src/TubeLink/</directory>
|
||||
<directory>./src/</directory>
|
||||
<exclude>
|
||||
<directory>./tests</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<logging>
|
||||
<log type="coverage-html" target="coverage" title="Readability" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
|
||||
</logging>
|
||||
</phpunit>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Readability;
|
||||
|
||||
/**
|
||||
* JavaScript-like HTML DOM Element
|
||||
* JavaScript-like HTML DOM Element.
|
||||
*
|
||||
* This class extends PHP's DOMElement to allow
|
||||
* users to get and set the innerHTML property of
|
||||
@@ -31,12 +31,14 @@ namespace Readability;
|
||||
* echo $doc->saveXML();
|
||||
*
|
||||
* @author Keyvan Minoukadeh - http://www.keyvan.net - keyvan@keyvan.net
|
||||
*
|
||||
* @see http://fivefilters.org (the project this was written for)
|
||||
*/
|
||||
class JSLikeHTMLElement extends \DOMElement
|
||||
{
|
||||
/**
|
||||
* Used for setting innerHTML like it's done in JavaScript:
|
||||
* Used for setting innerHTML like it's done in JavaScript:.
|
||||
*
|
||||
* @code
|
||||
* $div->innerHTML = '<h2>Chapter 2</h2><p>The story begins...</p>';
|
||||
* @endcode
|
||||
@@ -45,12 +47,14 @@ class JSLikeHTMLElement extends \DOMElement
|
||||
{
|
||||
if ($name == 'innerHTML') {
|
||||
// first, empty the element
|
||||
for ($x=$this->childNodes->length-1; $x>=0; $x--) {
|
||||
for ($x = $this->childNodes->length - 1; $x >= 0; --$x) {
|
||||
$this->removeChild($this->childNodes->item($x));
|
||||
}
|
||||
|
||||
// $value holds our new inner HTML
|
||||
if ($value != '') {
|
||||
$f = $this->ownerDocument->createDocumentFragment();
|
||||
|
||||
// appendXML() expects well-formed markup (XHTML)
|
||||
$result = @$f->appendXML($value); // @ to suppress PHP warnings
|
||||
if ($result) {
|
||||
@@ -61,12 +65,14 @@ class JSLikeHTMLElement extends \DOMElement
|
||||
// $value is probably ill-formed
|
||||
$f = new \DOMDocument();
|
||||
$value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');
|
||||
|
||||
// Using <htmlfragment> will generate a warning, but so will bad HTML
|
||||
// (and by this point, bad HTML is what we've got).
|
||||
// We use it (and suppress the warning) because an HTML fragment will
|
||||
// be wrapped around <html><body> tags which we don't really want to keep.
|
||||
// Note: despite the warning, if loadHTML succeeds it will return true.
|
||||
$result = @$f->loadHTML('<htmlfragment>'.$value.'</htmlfragment>');
|
||||
|
||||
if ($result) {
|
||||
$import = $f->getElementsByTagName('htmlfragment')->item(0);
|
||||
foreach ($import->childNodes as $child) {
|
||||
@@ -86,7 +92,8 @@ class JSLikeHTMLElement extends \DOMElement
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for getting innerHTML like it's done in JavaScript:
|
||||
* Used for getting innerHTML like it's done in JavaScript:.
|
||||
*
|
||||
* @code
|
||||
* $string = $div->innerHTML;
|
||||
* @endcode
|
||||
@@ -105,7 +112,7 @@ class JSLikeHTMLElement extends \DOMElement
|
||||
$trace = debug_backtrace();
|
||||
trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_NOTICE);
|
||||
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
|
||||
+290
-145
File diff suppressed because it is too large
Load Diff
+137
-3
@@ -3,7 +3,6 @@
|
||||
namespace Tests\Readability;
|
||||
|
||||
use Readability\Readability;
|
||||
use Readability\JSLikeHTMLElement;
|
||||
|
||||
class ReadabilityTested extends Readability
|
||||
{
|
||||
@@ -49,6 +48,8 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertFalse($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('Sorry, Readability was unable to parse this page for content.', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
@@ -59,7 +60,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is the awesome content :)', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
@@ -70,7 +73,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is the awesome content :)', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
@@ -82,7 +87,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is the awesome content :)', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
@@ -95,7 +102,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('readabilityFootnoteLink', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('readabilityLink-3', $readability->getContent()->innerHTML);
|
||||
@@ -103,16 +112,18 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testStandardClean()
|
||||
{
|
||||
$readability = new ReadabilityTested('<div><h2>Title</h2>'.str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7).'<a href="#nofollow" rel="nofollow">will be removed</a></div>', 'http://0.0.0.0');
|
||||
$readability = new ReadabilityTested('<div><h2>Title</h2>'.str_repeat('<p>This is an awesome text with some links, here there are: <a href="http://0.0.0.0/test.html">the awesome</a></p>', 7).'<a href="#nofollow" rel="nofollow">will NOT be removed</a></div>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$readability->lightClean = false;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('will be removed', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('will NOT be removed', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('<h2>', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
@@ -124,7 +135,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<div readability=', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('nofollow', $readability->getContent()->innerHTML);
|
||||
}
|
||||
@@ -137,7 +150,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('nofollow', $readability->getContent()->innerHTML);
|
||||
}
|
||||
@@ -150,7 +165,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('<aside>', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('<footer/>', $readability->getContent()->innerHTML);
|
||||
@@ -164,7 +181,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text should be removed', $readability->getContent()->innerHTML);
|
||||
}
|
||||
@@ -177,7 +196,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="tr"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
@@ -189,7 +210,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
}
|
||||
@@ -202,7 +225,69 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEmpty($readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
public function testTitle()
|
||||
{
|
||||
$readability = new ReadabilityTested('<title>this is my title</title><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('this is my title', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
public function testTitleWithDash()
|
||||
{
|
||||
$readability = new ReadabilityTested('<title> title2 - title3 </title><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('title2 - title3', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
public function testTitleWithDoubleDot()
|
||||
{
|
||||
$readability = new ReadabilityTested('<title> title2 : title3 </title><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('title2 : title3', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
}
|
||||
|
||||
public function testTitleTooShortUseH1()
|
||||
{
|
||||
$readability = new ReadabilityTested('<title>too short</title><h1>this is my h1 title !</h1><article class="awesomecontent">'.str_repeat('<p>This is an awesome text with some links, here there are the awesome</p>', 7).'<p></p></article>', 'http://0.0.0.0');
|
||||
$readability->debug = true;
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('alt="article"', $readability->getContent()->innerHTML);
|
||||
$this->assertEquals('this is my h1 title !', $readability->getTitle()->innerHTML);
|
||||
$this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->innerHTML);
|
||||
$this->assertNotContains('This text is also an awesome text and you should know that', $readability->getContent()->innerHTML);
|
||||
}
|
||||
@@ -217,4 +302,53 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||
// $this->assertEquals('/0\.0\.0\.0/', $readability->getDomainRegexp());
|
||||
// $this->assertInstanceOf('DomDocument', $readability->dom);
|
||||
// }
|
||||
|
||||
// dummy function to be used to the next test
|
||||
public function error2Exception($code, $string, $file, $line, $context)
|
||||
{
|
||||
throw new \Exception($string, $code);
|
||||
}
|
||||
|
||||
public function testAutoClosingIframeNotThrowingException()
|
||||
{
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
ini_set('display_errors', true);
|
||||
set_error_handler(array($this, 'error2Exception'), E_ALL | E_STRICT);
|
||||
|
||||
$data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru-RU" prefix="og: http://ogp.me/ns#">
|
||||
|
||||
<head profile="http://gmpg.org/xfn/11">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
</head>
|
||||
<body class="single single-post postid-22030 single-format-standard">
|
||||
<div id="wrapper">
|
||||
<div id="content">
|
||||
<div class="post-22030 post type-post status-publish format-standard has-post-thumbnail hentry category-video category-reviews tag-193" id="post-22030">
|
||||
<h1>3D Touch — будущее мобильных игр</h1>
|
||||
<div class="postdate">Автор: <strong>Сергей Пак</strong> | Просмотров: 1363 | Опубликовано: 14 сентября 2015 </div>
|
||||
<div class="entry">
|
||||
<p>Компания Apple представила новую технологию 3D Touch, которая является прямым потомком более ранней версии Force Touch — последняя, напомним, используется сейчас в трекпадах Macbook Pro и Macbook 2015. Теперь управлять устройством стало в разы проще, и Force Touch открывает перед пользователями новые возможности, но при этом 3D Touch — это про другое. Дело в том, что теперь и на мобильных устройствах интерфейс будет постепенно меняться, кардинальные перемены ждут мобильный гейминг, потому что здесь разработчики действительно могут разгуляться.<span id="more-22030"></span></p>
|
||||
<p><iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>
|
||||
<p>Итак, просто представьте себе, что iPhone 6S — это, по большому счету, отличная игровая приставка, которую вы носите с собой, а еще она может выдавать невероятной красоты картинку. Но проблема заключается, пожалуй, в том, что управлять персонажем в играх довольно трудно — он неповоротлив, обладает заторможенной реакцией, а игровой клиент зачастую требует перегруза интерфейса для того, чтобы обеспечить максимально большое количество возможностей. Благодаря трехуровневому нажатию можно избавиться от лишних кнопок и обеспечить более качественный обзор местности, и при этом пользователь будет закрывать пальцами минимальное пространство.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
$readability = new ReadabilityTested($data, 'http://iosgames.ru/?p=22030');
|
||||
$readability->debug = true;
|
||||
|
||||
$res = $readability->init();
|
||||
|
||||
$this->assertTrue($res);
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent());
|
||||
$this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle());
|
||||
$this->assertContains('<iframe src="https://www.youtube.com/embed/PUep6xNeKjA" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>', $readability->getContent()->innerHTML);
|
||||
$this->assertContains('3D Touch', $readability->getTitle()->innerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user