Beispiel #1
0
 /**
  * Checks whether corresponding step of wizard is complete
  * @param string $action
  */
 protected function _step_ready($action)
 {
     // step #1: xml selction - has no prerequisites
     if ('index' == $action) {
         return true;
     }
     if ('element' == $action) {
         return true;
     }
     $this->data['update_previous'] = $update_previous = new PMXE_Export_Record();
     $update_previous->getById(PMXE_Plugin::$session->update_previous);
     if (!$update_previous->isEmpty()) {
         $update_previous->fix_template_options();
     }
     if ('options' == $action) {
         return true;
     }
     if (!PMXE_Plugin::$session->has_session()) {
         wp_redirect_or_javascript($this->baseUrl);
         die;
     }
     if ('process' == $action) {
         return true;
     }
 }
Beispiel #2
0
 /**
  * Checks whether corresponding step of wizard is complete
  * @param string $action
  */
 protected function _step_ready($action)
 {
     // step #1: xml selction - has no prerequisites
     if ('index' == $action) {
         return true;
     }
     // step #2: element selection
     $this->data['dom'] = $dom = new DOMDocument('1.0', PMXI_Plugin::$session->encoding);
     $this->data['update_previous'] = $update_previous = new PMXI_Import_Record();
     $old = libxml_use_internal_errors(true);
     $xml = $this->get_xml();
     if (empty($xml) and in_array($action, array('process'))) {
         !empty(PMXI_Plugin::$session->update_previous) and $update_previous->getById(PMXI_Plugin::$session->update_previous);
         return true;
     }
     if (!PMXI_Plugin::$session->has_session() or !empty(PMXI_Plugin::$session->update_previous) and $update_previous->getById(PMXI_Plugin::$session->update_previous)->isEmpty() or !@$dom->loadXML($xml)) {
         if (!PMXI_Plugin::is_ajax()) {
             $this->errors->add('form-validation', __('WP All Import lost track of where you are.<br/><br/>Maybe you cleared your cookies or maybe it is just a temporary issue on your or your web host\'s end.<br/>If you can\'t do an import without seeing this error, change your session settings on the All Import -> Settings page.', 'wp_all_import_plugin'));
             wp_redirect_or_javascript($this->baseUrl);
             die;
         }
     }
     libxml_use_internal_errors($old);
     if ('element' == $action) {
         return true;
     }
     if ('evaluate' == $action) {
         return true;
     }
     if ('evaluate_variations' == $action) {
         return true;
     }
     // step #3: template
     $xpath = new DOMXPath($dom);
     $this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath);
     if ('preview' == $action or 'tag' == $action or 'preview_images' == $action or 'preview_taxonomies' == $action or 'preview_images' == $action) {
         return true;
     }
     if (!PMXI_Plugin::$session->get('xpath', false) or empty($elements) or !$elements->length) {
         $this->errors->add('form-validation', __('There are no elements to import based on your XPath.<br/><br/>If you are in Step 2, you probably specified filtering options that don’t match any elements present in your file.<br/>If you are seeing this error elsewhere, it means that while the XPath expression for your initial import matched some elements in your file previously, there are now zero elements in the file that match this expression.<br/>You can edit the XPath for your import by going to the Manage Imports -> Import Settings page.', 'wp_all_import_plugin'));
         wp_redirect_or_javascript(add_query_arg('action', 'element', $this->baseUrl));
         die;
     }
     if ('template' == $action or 'preview' == $action or 'tag' == $action) {
         return true;
     }
     // step #4: options
     if (empty(PMXI_Plugin::$session->options)) {
         wp_redirect_or_javascript(add_query_arg('action', 'template', $this->baseUrl));
         die;
     }
     if ('options' == $action) {
         return true;
     }
     if (empty(PMXI_Plugin::$session->options)) {
         wp_redirect(add_query_arg('action', 'options', $this->baseUrl));
         die;
     }
 }
Beispiel #3
0
 /**
  * Checks whether corresponding step of wizard is complete
  * @param string $action
  */
 protected function _step_ready($action)
 {
     // step #1: xml selction - has no prerequisites
     if ('index' == $action) {
         return true;
     }
     // step #2: element selection
     $this->data['dom'] = $dom = new DOMDocument('1.0', PMXI_Plugin::$session->data['pmxi_import']['encoding']);
     $this->data['update_previous'] = $update_previous = new PMXI_Import_Record();
     $old = libxml_use_internal_errors(true);
     $xml = $this->get_xml();
     if (empty($xml) and in_array($action, array('process'))) {
         !empty(PMXI_Plugin::$session->data['pmxi_import']['update_previous']) and $update_previous->getById(PMXI_Plugin::$session->data['pmxi_import']['update_previous']);
         return true;
     }
     if (empty(PMXI_Plugin::$session->data['pmxi_import']) or !empty(PMXI_Plugin::$session->data['pmxi_import']['update_previous']) and $update_previous->getById(PMXI_Plugin::$session->data['pmxi_import']['update_previous'])->isEmpty() or !@$dom->loadXML($xml)) {
         if (!PMXI_Plugin::is_ajax()) {
             $this->errors->add('form-validation', __('Can not create DOM object for provided feed.', 'pmxi_plugin'));
             wp_redirect_or_javascript($this->baseUrl);
             die;
         }
     }
     libxml_use_internal_errors($old);
     if ('element' == $action) {
         return true;
     }
     if ('evaluate' == $action) {
         return true;
     }
     if ('evaluate_variations' == $action) {
         return true;
     }
     // step #3: template
     $xpath = new DOMXPath($dom);
     $this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->data['pmxi_import']['xpath']);
     if ('preview' == $action or 'tag' == $action) {
         return true;
     }
     if (empty(PMXI_Plugin::$session->data['pmxi_import']['xpath']) or empty($elements) or !$elements->length) {
         $this->errors->add('form-validation', __('No matching elements found.', 'pmxi_plugin'));
         wp_redirect_or_javascript(add_query_arg('action', 'element', $this->baseUrl));
         die;
     }
     if ('template' == $action or 'preview' == $action or 'tag' == $action) {
         return true;
     }
     // step #4: options
     if (empty(PMXI_Plugin::$session->data['pmxi_import']['template']) or empty(PMXI_Plugin::$session->data['pmxi_import']['template']['title']) or empty(PMXI_Plugin::$session->data['pmxi_import']['template']['content'])) {
         wp_redirect_or_javascript(add_query_arg('action', 'template', $this->baseUrl));
         die;
     }
     if ('options' == $action) {
         return true;
     }
     if (empty(PMXI_Plugin::$session->data['pmxi_import']['options'])) {
         wp_redirect(add_query_arg('action', 'options', $this->baseUrl));
         die;
     }
 }