Ejemplo n.º 1
0
 /**
  *
  */
 public function load($keys = null, $reset = true)
 {
     if (!is_array($keys)) {
         // Load by primary key.
         $keys = array($this->_tbl_key => $keys);
     } else {
         // Return false for videos link
         StreamFactory::load('libraries.video');
         $videoLib = new StreamVideo();
         $videos = $videoLib->getURL($keys['link']);
         if (in_array($keys['link'], $videos)) {
             return false;
         }
         // Return false for slidehshare links
         StreamFactory::load('libraries.slideshare');
         $ssLib = new StreamSlideshare();
         $slideShares = $ssLib->getURL($keys['link']);
         if (in_array($keys['link'], $slideShares)) {
             return false;
         }
     }
     $result = parent::load($keys, $reset);
     $this->_params = new JParameter($this->params);
     if (!$result && isset($keys['link'])) {
         $this->link = $keys['link'];
     }
     if (empty($this->params)) {
         $this->params = StreamLinks::grab($this->link);
         if ($this->params) {
             $date = new JDate();
             $this->timestamp = $date->format('Y-m-d h:i:s');
             $this->store(true);
         }
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  *
  */
 private function _filterSlideShare(&$stream)
 {
     StreamFactory::load('libraries.slideshare');
     $rawData = json_decode($stream->raw);
     $ssLib = new StreamSlideshare();
     $slideShares = $ssLib->getURL($stream->message);
     $rawData->slideshare = array();
     //print_r($videos); exit;
     if ($slideShares) {
         // Youtube link found
         foreach ($slideShares as $slideShareLink) {
             $ss = JTable::getInstance('Slideshare', 'StreamTable');
             $ss->load(array('source' => $slideShareLink));
             $ss->store();
             $rawData->slideshare[] = $ss->id;
         }
     }
     $stream->raw = json_encode($rawData);
 }