/**
  * @param DleCategory $objDleCategory The DB ORM object to process
  */
 protected function process_object($objDleCategory)
 {
     // wp: term_taxonomy_id, term_id, description, parent
     // dl: id,               id,      descr,       parentid
     $wpTerms = $objDleCategory->LoadWpTerms();
     if (!$wpTerms) {
         throw QCallerException(QApplication::Translate("Failed to find the WpTerm object for DleCategory."));
     }
     $wpTermsParent = null;
     if ($objDleCategory->ParentidObject) {
         $wpTermsParent = $objDleCategory->ParentidObject->LoadWpTerms();
     }
     $intWpTermsParentId = 0;
     if ($wpTermsParent) {
         $intWpTermsParentId = $wpTermsParent->TermId;
     }
     // check if already copied
     if (!WpTermTaxonomy::QueryCount(QQ::AndCondition(QQ::Equal(QQN::WpTermTaxonomy()->TermId, $wpTerms->TermId), QQ::Equal(QQN::WpTermTaxonomy()->Parent, $intWpTermsParentId)))) {
         $objWpTermTaxonomy = new WpTermTaxonomy();
         $objWpTermTaxonomy->Initialize();
         // set defaults
         $objWpTermTaxonomy->TermId = $wpTerms->TermId;
         $objWpTermTaxonomy->Description = $objDleCategory->Descr;
         $objWpTermTaxonomy->Parent = $intWpTermsParentId;
         $objWpTermTaxonomy->Taxonomy = "category";
         $objWpTermTaxonomy->Count = 0;
         $objWpTermTaxonomy->Save();
         $this->intTermTaxonomyCount++;
     }
 }
 /**
  * @param DleTags $objDleTags The DB ORM object to process
  */
 protected function process_object($objDleTags)
 {
     $objWpTerms = WpTerms::LoadBySlug($objDleTags->Tag);
     if (!$objWpTerms) {
         // It does not work. even with an appropriate setlocale call and with ISO-8859-1//TRANSLIT too
         //				$strSlug = iconv(QApplication::$EncodingType, 'US-ASCII//TRANSLIT', $objDleTags->Tag);
         $strSlug = encodestring($objDleTags->Tag);
         $objWpTerms = WpTerms::LoadBySlug($strSlug);
         if (!$objWpTerms) {
             // This tag was not copied yet.
             $objWpTerms = new WpTerms();
             $objWpTerms->Initialize();
             // set defaults
             $objWpTerms->Name = $objDleTags->Tag;
             // DLE does not has url-compartible tag name version. it uses the urlencoded from cp1251 one.
             // We do a translit enstead.
             $objWpTerms->Slug = $strSlug;
             $objWpTerms->TermGroup = 0;
             $objWpTerms->Save();
             $this->intTermCount++;
         }
     }
     // check if already copied
     $objWpTermTaxonomy = WpTermTaxonomy::LoadByTermIdTaxonomy($objWpTerms->TermId, "post_tag");
     if (!$objWpTermTaxonomy) {
         $objWpTermTaxonomy = new WpTermTaxonomy();
         $objWpTermTaxonomy->Initialize();
         // set defaults
         $objWpTermTaxonomy->TermId = $objWpTerms->TermId;
         $objWpTermTaxonomy->Description = $objWpTerms->Name;
         $objWpTermTaxonomy->Parent = 0;
         $objWpTermTaxonomy->Taxonomy = "post_tag";
         $objWpTermTaxonomy->Count = 0;
         $objWpTermTaxonomy->Save();
         $this->intTermTaxonomyCount++;
     }
     $objWpPosts = $objDleTags->News->LoadWpPosts();
     if (!$objWpPosts) {
         return;
     }
     $objWpTermRelationships = WpTermRelationships::LoadByObjectIdTermTaxonomyId($objWpPosts->Id, $objWpTermTaxonomy->TermTaxonomyId);
     // check if already copied
     if (!$objWpTermRelationships) {
         $objWpTermRelationships = new WpTermRelationships();
         $objWpTermRelationships->Initialize();
         // set defaults
         $objWpTermRelationships->ObjectId = $objWpPosts->Id;
         $objWpTermRelationships->TermTaxonomyId = $objWpTermTaxonomy->TermTaxonomyId;
         $objWpTermRelationships->TermOrder = 0;
         $objWpTermRelationships->Save();
         $this->intTermRelationshipsCount++;
     }
 }
 /**
  * @param WpTermTaxonomy $objWpTermTaxonomy The DB ORM object to process
  */
 protected function process_object($objWpTermTaxonomy)
 {
     $objWpTermTaxonomy->Count = WpTermRelationships::CountByTermTaxonomyId($objWpTermTaxonomy->TermTaxonomyId);
     $objWpTermTaxonomy->Save();
     $this->intTermTaxonomyCount++;
 }