/**
  * @param DleComments $objDleComments The DB ORM object to process
  */
 protected function process_object($objDleComments)
 {
     $objWpComments0 = $objDleComments->LoadWpComments();
     // check if already copied
     if ($objWpComments0) {
         return;
     }
     $objWpPosts = $objDleComments->LoadWpPosts();
     if (!$objWpPosts) {
         return;
     }
     $objWpComments = new WpComments();
     $objWpComments->Initialize();
     // set defaults
     $objWpComments->CommentPostID = $objWpPosts->Id;
     $objWpComments->CommentAuthor = $objDleComments->Autor;
     $objWpComments->CommentAuthorEmail = $objDleComments->Email;
     $objWpComments->CommentAuthorUrl = "";
     $objWpComments->CommentAuthorIP = $objDleComments->Ip;
     $objWpComments->CommentDate = $objDleComments->Date;
     $objWpComments->CommentDateGmt = $objDleComments->Date;
     $objWpComments->CommentContent = str_replace('\\»', '»', str_replace('\\"', '"', $objDleComments->Text));
     $objWpComments->CommentKarma = 0;
     $objWpComments->CommentApproved = 1;
     $objWpComments->CommentAgent = "";
     $objWpComments->CommentType = "comment";
     $objWpComments->CommentParent = 0;
     $objWpComments->UserId = 0;
     $objWpUsers = $objDleComments->LoadWpUsers();
     if ($objWpUsers) {
         $objWpComments->UserId = $objWpUsers->Id;
     }
     $objWpComments->Save();
     $this->intCommentsCount++;
 }
Esempio n. 2
0
 /**
  * @return WpComments|null The Worpress comment for this DLE comment.
  */
 public function LoadWpComments()
 {
     $objWpPosts = $this->LoadWpPosts();
     if (!$objWpPosts) {
         return null;
     }
     $objWpUsers = $this->LoadWpUsers();
     $conUsersCondition = QQ::Equal(QQN::WpComments()->CommentAuthorEmail, $this->Email);
     if ($objWpUsers) {
         $conUsersCondition = QQ::Equal(QQN::WpComments()->UserId, $objWpUsers->Id);
     }
     return WpComments::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpComments()->CommentPostID, $objWpPosts->Id), $conUsersCondition, QQ::Equal(QQN::WpComments()->CommentDate, $this->Date), QQ::Equal(QQN::WpComments()->CommentContent, str_replace('\\"', '"', $this->Text))), QQ::Clause(QQ::OrderBy(QQN::WpComments()->CommentID), QQ::LimitInfo(1)));
 }
 /**
  * @param WpPosts $objWpPosts The DB ORM object to process
  */
 protected function process_object($objWpPosts)
 {
     $objWpPosts->CommentCount = WpComments::CountByCommentPostID($objWpPosts->Id);
     $objWpPosts->Save();
     $this->intPostsCount++;
 }
Esempio n. 4
0
 /**
  * Counts all associated WpCommentsesAsUser
  * @return int
  */
 public function CountWpCommentsesAsUser()
 {
     if (is_null($this->intId)) {
         return 0;
     }
     return WpComments::CountByUserId($this->intId);
 }
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objCommentPostIDObject) {
         $objObject->objCommentPostIDObject = WpPosts::GetSoapObjectFromObject($objObject->objCommentPostIDObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCommentPostID = null;
         }
     }
     if ($objObject->dttCommentDate) {
         $objObject->dttCommentDate = $objObject->dttCommentDate->qFormat(QDateTime::FormatSoap);
     }
     if ($objObject->dttCommentDateGmt) {
         $objObject->dttCommentDateGmt = $objObject->dttCommentDateGmt->qFormat(QDateTime::FormatSoap);
     }
     if ($objObject->objCommentParentObject) {
         $objObject->objCommentParentObject = WpComments::GetSoapObjectFromObject($objObject->objCommentParentObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCommentParent = null;
         }
     }
     if ($objObject->objUser) {
         $objObject->objUser = WpUsers::GetSoapObjectFromObject($objObject->objUser, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intUserId = null;
         }
     }
     return $objObject;
 }
Esempio n. 6
0
 /**
  * Counts all associated WpCommentsesAsCommentPost
  * @return int
  */
 public function CountWpCommentsesAsCommentPost()
 {
     if (is_null($this->intId)) {
         return 0;
     }
     return WpComments::CountByCommentPostID($this->intId);
 }