Rss-Bridge/bridges/VineBridge.php
logmanoriginal a4b9611e66 [phpcs] Add missing rules
- Do not add spaces after opening or before closing parenthesis

  // Wrong
  if( !is_null($var) ) {
    ...
  }

  // Right
  if(!is_null($var)) {
    ...
  }

- Add space after closing parenthesis

  // Wrong
  if(true){
    ...
  }

  // Right
  if(true) {
    ...
  }

- Add body into new line
- Close body in new line

  // Wrong
  if(true) { ... }

  // Right
  if(true) {
    ...
  }

Notice: Spaces after keywords are not detected:

  // Wrong (not detected)
  // -> space after 'if' and missing space after 'else'
  if (true) {
    ...
  } else{
    ...
  }

  // Right
  if(true) {
    ...
  } else {
    ...
  }
2017-07-29 19:55:12 +02:00

40 lines
1 KiB
PHP

<?php
class VineBridge extends BridgeAbstract {
const MAINTAINER = 'ckiw';
const NAME = 'Vine bridge';
const URI = 'http://vine.co/';
const DESCRIPTION = 'Returns the latests vines from vine user page';
const PARAMETERS = array( array(
'u' => array(
'name' => 'User id',
'required' => true
)
));
public function collectData(){
$html = '';
$uri = self::URI . '/u/' . $this->getInput('u') . '?mode=list';
$html = getSimpleHTMLDOM($uri)
or returnServerError('No results for this query.');
foreach($html->find('.post') as $element) {
$a = $element->find('a', 0);
$a->href = str_replace('https://', 'http://', $a->href);
$time = strtotime(ltrim($element->find('p', 0)->plaintext, ' Uploaded at '));
$video = $element->find('video', 0);
$video->controls = 'true';
$element->find('h2', 0)->outertext = '';
$item = array();
$item['uri'] = $a->href;
$item['timestamp'] = $time;
$item['title'] = $a->plaintext;
$item['content'] = $element;
$this->items[] = $item;
}
}
}