protected function init()
 {
     $transport = ucfirst($this->getRequest()->post('blog_import_transport', '', waRequest::TYPE_STRING_TRIM));
     $class = "blogImportPlugin{$transport}Transport";
     if ($transport && class_exists($class)) {
         $plugin_namespace = $this->getApp() . '_import';
         $namespace = $plugin_namespace . '_' . strtolower($transport);
         $this->initPlugin();
         if ($post = $this->getRequest()->post($plugin_namespace)) {
             $this->plugin->setup($post);
             if ($this->plugin->validateSettings($this->errors)) {
                 $this->plugin->saveSettings();
             } else {
                 throw new waException(_wp('Invalid replace settings'));
             }
         }
         $settings = $this->plugin->getSettings();
         $blog_model = new blogBlogModel();
         if ($settings['blog'] && ($blog = $blog_model->getById($settings['blog']))) {
             $settings['blog_status'] = $blog['status'];
         } else {
             throw new waException(_wp("Target blog not found"));
         }
         $author_has_rights = false;
         try {
             if ($settings['contact']) {
                 $author_has_rights = blogHelper::checkRights($settings['blog'], $settings['contact']);
             }
         } catch (waRightsException $ex) {
             //do nothing
         }
         if (!$author_has_rights) {
             throw new waException(_wp("Author not found or has insufficient rights"));
         }
         $this->data['transport'] = new $class($settings);
         $this->data['blog'] = $this->plugin->getSettingValue('blog');
         $this->getTransport();
         $this->transport->setup($this->getRequest()->post($namespace, array()));
         if (!$this->transport->validate(true, $this->errors)) {
             throw new waException(_wp('Invalid settings'));
         }
         //$this->data['runtime_settings'] =$this->transport->get
         $this->data['posts'] = $this->transport->getPosts();
         $this->data['current'] = 0;
         $this->data['count'] = count($this->data['posts']);
     } else {
         throw new waException(sprintf(_wp("Transport type %s not found"), $transport));
     }
 }
 public function setup($runtime_settings = array())
 {
     parent::setup($runtime_settings);
     $this->lastsync = date('Y-m-d H:i:s', 0);
     $this->post_model = new blogPostModel();
     $this->get_challenge();
 }
 public function setup($runtime_settings = array())
 {
     parent::setup($runtime_settings);
     $options = $this->xmlrpc("wp.getOptions ", 1, $this->option('login'), $this->option('password'), 'software_version');
     if ($options && isset($options['software_version'])) {
         $this->version = $options['software_version']['value'];
         $this->log("WordPress version:\t{$this->version}", self::LOG_INFO);
     }
 }
 public function setup($runtime_settings = array())
 {
     if (!extension_loaded('curl')) {
         throw new waException(_wp('PHP extension curl required'));
     }
     parent::setup($runtime_settings);
     $url = $this->setUrl($this->option('url', $this->xmlrpc_url), $this->xmlrpc_path);
     $this->log("Begin import from {$url['host']}", self::LOG_INFO);
 }