[VkBridge] Several improvements (#1802)
* Improved post author computation * Show repost sources * Handle second copy quote * Fixed incorrect image uri's
This commit is contained in:
parent
2ddd357a62
commit
59bbc9d2e7
1 changed files with 22 additions and 9 deletions
|
@ -232,11 +232,16 @@ class VkBridge extends BridgeAbstract
|
||||||
$div->outertext = '';
|
$div->outertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// get sign
|
// get sign / post author
|
||||||
$post_author = $pageName;
|
$post_author = $pageName;
|
||||||
foreach($post->find('a.wall_signed_by') as $a) {
|
$author_selectors = array('a.wall_signed_by', 'a.author');
|
||||||
|
foreach($author_selectors as $author_selector) {
|
||||||
|
$a = $post->find($author_selector, 0);
|
||||||
|
if (is_object($a)) {
|
||||||
$post_author = $a->innertext;
|
$post_author = $a->innertext;
|
||||||
$a->outertext = '';
|
$a->outertext = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix links and get post hashtags
|
// fix links and get post hashtags
|
||||||
|
@ -274,16 +279,24 @@ class VkBridge extends BridgeAbstract
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($post->find('div.copy_quote', 0))) {
|
$copy_quote = $post->find('div.copy_quote', 0);
|
||||||
|
if (is_object($copy_quote)) {
|
||||||
if ($this->getInput('hide_reposts') === true) {
|
if ($this->getInput('hide_reposts') === true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$copy_quote = $post->find('div.copy_quote', 0);
|
|
||||||
if ($copy_post_header = $copy_quote->find('div.copy_post_header', 0)) {
|
if ($copy_post_header = $copy_quote->find('div.copy_post_header', 0)) {
|
||||||
$copy_post_header->outertext = '';
|
$copy_post_header->outertext = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$second_copy_quote = $copy_quote->find('div.published_sec_quote', 0);
|
||||||
|
if (is_object($second_copy_quote)) {
|
||||||
|
$second_copy_quote_author = $second_copy_quote->find('a.copy_author', 0)->outertext;
|
||||||
|
$second_copy_quote_content = $second_copy_quote->find('div.copy_post_date', 0)->outertext;
|
||||||
|
$second_copy_quote->outertext = "<br>Reposted ($second_copy_quote_author): $second_copy_quote_content";
|
||||||
|
}
|
||||||
|
$copy_quote_author = $copy_quote->find('a.copy_author', 0)->outertext;
|
||||||
$copy_quote_content = $copy_quote->innertext;
|
$copy_quote_content = $copy_quote->innertext;
|
||||||
$copy_quote->outertext = "<br>Reposted: <br>$copy_quote_content";
|
$copy_quote->outertext = "<br>Reposted ($copy_quote_author): <br>$copy_quote_content";
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
|
@ -333,7 +346,7 @@ class VkBridge extends BridgeAbstract
|
||||||
$data = json_decode($arg, true);
|
$data = json_decode($arg, true);
|
||||||
if ($data == null) return;
|
if ($data == null) return;
|
||||||
|
|
||||||
$thumb = $data['temp']['base'] . $data['temp']['x_'][0] . '.jpg';
|
$thumb = $data['temp']['base'] . $data['temp']['x_'][0];
|
||||||
$original = '';
|
$original = '';
|
||||||
foreach(array('y_', 'z_', 'w_') as $key) {
|
foreach(array('y_', 'z_', 'w_') as $key) {
|
||||||
if (!isset($data['temp'][$key])) continue;
|
if (!isset($data['temp'][$key])) continue;
|
||||||
|
@ -343,7 +356,7 @@ class VkBridge extends BridgeAbstract
|
||||||
} else {
|
} else {
|
||||||
$base = $data['temp']['base'];
|
$base = $data['temp']['base'];
|
||||||
}
|
}
|
||||||
$original = $base . $data['temp'][$key][0] . '.jpg';
|
$original = $base . $data['temp'][$key][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($original) {
|
if ($original) {
|
||||||
|
|
Loading…
Reference in a new issue