PHP Class Changyan_Synchronizer

ファイルを表示 Open project: zblogcn/zblogphp Class Usage Examples

Public Methods

Method Description
buildURL ( $dataArray, $baseURL ) build GET URL by data array and base url
findCommentInDB ( $aComment, $postID )
getContents_curl ( $aUrl ) execute GET function using cURL, return JSON
getInstance ( ) return the single instance of this class
sync2Changyan ( $isSetup = false ) #region 'Synchronize to Changyan'
sync2Wordpress ( )

Private Methods

Method Description
__clone ( )
__construct ( )
cmtAscend ( $x, $y ) This is a comparation function used by usort in function insertComments()
cmtDescend ( $x, $y ) This is a comparation function used by usort in function insertComments()
getCommentList_curl ( $appID, $aPostID ) return Array
getOption ( $option ) #endregion
insertComments ( $cmts, $postID ) : integer get comment information object generated by changyan server
isCommentExits ( $post_id, $comment_author, $comment_content, $date_gmt ) to check if this comment is in the wpdb
postContents_curl ( $aUrl, $aCommentsArray, $headerPart = [] ) execute POST function using cURL and return JSON array containing comment_ids in Changyan
setOption ( $option, $value )

Method Details

buildURL() public method

build GET URL by data array and base url
public buildURL ( $dataArray, $baseURL )

findCommentInDB() public method

public findCommentInDB ( $aComment, $postID )

getContents_curl() public method

execute GET function using cURL, return JSON
public getContents_curl ( $aUrl )

getInstance() public static method

return the single instance of this class
public static getInstance ( )

sync2Changyan() public method

#region 'Synchronize to Changyan'
public sync2Changyan ( $isSetup = false )

sync2Wordpress() public method

public sync2Wordpress ( )