Example #1
0
 /**
  * @param $blueprint
  * @return array
  */
 protected function parseBlueprint($blueprint)
 {
     $callback = function (&$value) {
         if (is_string($value)) {
             $value = str_replace(':current', '*', $value);
         }
         if ($value[0] === ':') {
             # structure
             $structure = $this->getStructure($value);
             $value = $this->parseBlueprint($structure);
             return;
         }
         if (strpos($value, '|') === false) {
             return;
         }
         $parts = preg_split('/\\s?\\|\\s?/', $value);
         $selector = array_shift($parts);
         $value = Apist::filter($selector);
         foreach ($parts as $part) {
             $this->addCallbackToFilter($value, $part);
         }
     };
     if (!is_array($blueprint)) {
         $callback($blueprint);
     } else {
         array_walk_recursive($blueprint, $callback);
     }
     return $blueprint;
 }
Example #2
0
 public function ImageUrl($url)
 {
     // http://radikal.ru/F/s39.radikal.ru/i086/0909/e7/c510615b8119.jpg.html
     //  redirect -> http://f-picture.net/fp/80c5ae08a4564d288671f1f060ba8786
     $data = $this->get($url, ['image_url' => Apist::filter('div.f-content div img')->attr('src')]);
     return $data['image_url'];
 }
Example #3
0
 /**
  * Get the full description of the job
  *
  * @param int $id
  *
  * @return array
  */
 public function getItem($id)
 {
     return $this->get('/jobs/' . $id, ['requirements' => Apist::filter('.requirements')->html(), 'bonuses' => Apist::filter('.bonuses')->html(), 'skills' => Apist::filter('.tags .tag')->each(Apist::filter('*')->text()->trim()), 'instructions' => Apist::filter('.instructions .text')->html()]);
 }
Example #4
0
 public function non_array_blueprint()
 {
     return $this->get('/', Apist::filter('.page_head .title'));
 }