/**
  * Create the new handler object, loading configuration array
  *
  * @param array $config
  */
 public function __construct(array $config = array())
 {
     if (!isset($config['match']) || !is_string($config['match'])) {
         require_once 'Spizer/Handler/Exception.php';
         throw new Spizer_Handler_Exception('The string to match was not passed in the configuration array');
     }
     parent::__construct($config);
 }
示例#2
0
 /**
  * Create the new handler object, loading configuration array
  *
  * @param array $config
  */
 public function __construct(array $config = array())
 {
     if (!isset($config['query'])) {
         require_once 'Spizer/Handler/Exception.php';
         throw new Spizer_Handler_Exception('The XPath query was not passed in the configuration array');
     }
     parent::__construct($config);
 }
示例#3
0
 public function __construct($config = array())
 {
     if (!isset($config['save_dir'])) {
         require_once 'Kumo/Handler/Exception.php';
         throw new Kumo_Handler_Exception('not setting save_path');
     }
     parent::__construct($config);
 }
 public function __construct(array $config = array())
 {
     if (!is_string($config['queueAdapter'])) {
         require_once 'Kumo/Handler/Exception.php';
         throw new Kumo_Handler_Exception('queueAdapter must String');
     }
     if (!is_array($config['queueOptions'])) {
         require_once 'Kumo/Handler/Exception.php';
         throw new Kumo_Handler_Exception('queueOptions must array');
     }
     parent::__construct($config);
 }
示例#5
0
 public function __construct(array $config = array())
 {
     parent::__construct($config);
     $this->_callonce = isset($config['call-once']) ? true : false;
     $process = new Diggin_Scraper_Process();
     $process->setExpression($config['expression']);
     $process->setName('kumo');
     $process->setArrayFlag(isset($config['arrayflag']) ? (bool) $config['arrayflag'] : true);
     $process->setType(isset($config['type']) ? $config['type'] : 'TEXT');
     // use only first filter
     if (isset($config['filters'])) {
         if (($match = $config['filters']['matchpattern']) && ($replace = $config['filters']['replacement'])) {
             require_once 'Zend/Filter/PregReplace.php';
             $pregreplace = new Zend_Filter_PregReplace();
             $pregreplace->setMatchPattern($match);
             $pregreplace->setReplacement($replace);
             $process->setFilters(array($pregreplace));
         }
     }
     $this->scraper = new Diggin_Scraper();
     $this->scraper->process($process);
 }
示例#6
0
 /**
  * Add another handler object to the generic handlers stack
  *
  * @param  Spizer_Handler_Abstract $handler
  * @return Spizer_Engine
  */
 public function addHandler(Spizer_Handler_Abstract $handler)
 {
     $handler->setEngine($this);
     $this->_handlers[] = $handler;
     return $this;
 }