/** * @param DlePost $objDlePost The DB ORM object to process */ protected function process_object($objDlePost) { $objWpTermsArray = $objDlePost->LoadWpTermsArray(); if ($objWpTermsArray) { $this->intDleTermRelationshipsCount += count($objWpTermsArray); } else { return; } $objWpPosts = $objDlePost->LoadWpPosts(); if (!$objWpPosts) { return; } foreach ($objWpTermsArray as $objWpTerms) { $objWpTermTaxonomy = WpTermTaxonomy::LoadByTermIdTaxonomy($objWpTerms->TermId, "category"); if (!$objWpTermTaxonomy) { continue; } $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 DlePost $objDlePost The DB ORM object to process */ protected function process_object($objDlePost) { $objWpPosts = $objDlePost->LoadWpPosts(); if (!$objWpPosts) { return; } $objWpPvcTotalArray = WpPvcTotal::LoadArrayByPostnum($objWpPosts->Id); if ($objWpPvcTotalArray) { foreach ($objWpPvcTotalArray as $objWpPvcTotal) { $objWpPvcTotal->Postcount = $objDlePost->NewsRead; $objWpPvcTotal->Save(); } } else { $objWpPvcTotal = new WpPvcTotal(); $objWpPvcTotal->Initialize(); $objWpPvcTotal->Postnum = $objWpPosts->Id; $objWpPvcTotal->Postcount = $objDlePost->NewsRead; $objWpPvcTotal->Save(); } $this->intPvcTotalCount++; }
/** * @param DlePost $objDlePost The DB ORM object to process */ protected function process_object($objDlePost) { $objWpPosts = $objDlePost->LoadWpPosts(); // check if already copied if (!$objWpPosts) { $objWpUsers = $objDlePost->LoadWpUser(); if ($objWpUsers) { $objWpPosts = new WpPosts(); $objWpPosts->Initialize(); // set defaults $objWpPosts->PostAuthor = $objWpUsers->Id; $objWpPosts->PostDate = $objDlePost->Date; $objWpPosts->PostModified = $objDlePost->Date; $objWpPosts->PostDateGmt = $objDlePost->Date; $objWpPosts->PostModifiedGmt = $objDlePost->Date; $objWpPosts->PostContent = str_replace('\\»', '»', str_replace('\\"', '"', $objDlePost->FullStory)); $objWpPosts->PostContentFiltered = ""; $objWpPosts->PostParent = 0; $objWpPosts->PostTitle = $objDlePost->Title; $objWpPosts->PostExcerpt = str_replace('\\»', '»', str_replace('\\"', '"', $objDlePost->ShortStory)); $objWpPosts->CommentStatus = "open"; $objWpPosts->PingStatus = "open"; $objWpPosts->PostStatus = "publish"; $objWpPosts->PostPassword = ""; $objWpPosts->PostName = $objDlePost->AltName; $objWpPosts->ToPing = ""; $objWpPosts->Pinged = ""; $objWpPosts->Guid = ""; $objWpPosts->MenuOrder = 0; $objWpPosts->PostType = "post"; $objWpPosts->PostMimeType = ""; $objWpPosts->CommentCount = 0; $objWpPosts->Save(); $this->intPostCount++; } } }