Esempio n. 1
0
 public function initialize()
 {
     $this->dadata = $this->modx->dadata;
     if (!is_object($this->dadata) or !$this->dadata instanceof dadata) {
         $corePath = $this->modx->getOption('dadata_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/dadata/');
         $this->dadata = $this->modx->getService('dadata', 'dadata', $corePath . 'model/dadata/', $this->properties);
     }
     $propKey = $this->getProperty('propkey');
     if (empty($propKey)) {
         return $this->dadata->lexicon('err_propkey_ns');
     }
     $properties = $this->dadata->getProperties($propKey);
     if (empty($properties)) {
         return $this->dadata->lexicon('err_properties_ns');
     }
     $this->setProperties($properties);
     $this->dadata->initialize($this->getProperty('ctx', $this->modx->context->key), $this->getProperties());
     return true;
 }
Esempio n. 2
0
 /**
  * @param array  $array
  * @param string $plPrefix
  * @param string $prefix
  * @param string $suffix
  * @param bool   $uncacheable
  *
  * @return array
  */
 public function makePlaceholders(array $array = array(), $plPrefix = '', $prefix = '', $suffix = '', $uncacheable = true)
 {
     return $this->dadata->makePlaceholders($array, $plPrefix, $prefix, $suffix, $uncacheable);
 }