WS
|
Functions | |
if(!class_exists('simple_html_dom_node')) | sync_wechat_check_wx_url ($url) |
check the domain name More... | |
sync_wechat_get_html ($url, $timeout=30) | |
get the html from url More... | |
sync_wechat_insert_by_url ($url, $config=Null) | |
this function insert wechat article to the wp-database this function relies on global variable $wpdb and the php module $curl More... | |
sync_wechat_get_publish_date ($html) | |
sync_wechat_insert_by_html ($html, $config=Null) | |
insert $wpdb from html, called by sync_wechat_insert_by_url | |
sync_wechat_check_image_exists ($postId, $image_name) | |
get 1. attached image for $postId, 2. unattached image, and check whether image_name is within it More... | |
sync_wechat_get_image_extension_from_url ($url) | |
guess the image extension from the url More... | |
sync_wechat_get_image_name ($url, $prefix, $extension_=Null) | |
use file content hash to generate image name the image suffix is got from the imageFile. More... | |
sync_wechat_upload_image ($url, $postId, $image_name=Null) | |
download image from $url and update it for the post with id = $postId More... | |
sync_wechat_set_feature_image ($postId, $feature_image_url, $imageName=Null) | |
: set the thumbnail image for the specified post, called by sync_wechat_set_image | |
sync_wechat_set_image ($html, $postId, $config=Null) | |
extract image urls from html, and download it to local file system, update image url in postId->postContent More... | |
sync_wechat_insert_by_urls ($urls, $config) | |
insert url list into $wpdb, calling sync_wechat_insert_by_url | |
sync_wechat_resolve_bg_image (&$content, $postId) | |
resolve css background images, called by sync_wechat_download_image | |
sync_wechat_resolve_origin ($dom) | |
resolve article origin, called by sync_wechat_download_image | |
sync_wechat_process_video (&$dom) | |
resolve tencent video, add width, height, src attribute | |
sync_wechat_download_image ($postId, $dom, $config=Null) | |
download all images in $dom, called by sync_wechat_set_image | |
sync_wechat_check_image_exists | ( | $postId, | |
$image_name | |||
) |
get 1. attached image for $postId, 2. unattached image, and check whether image_name is within it
postId | post Id |
image_name | image_name to be checked |
if (!class_exists( 'simple_html_dom_node')) sync_wechat_check_wx_url | ( | $url | ) |
check the domain name
$url |
sync_wechat_get_html | ( | $url, | |
$timeout = 30 |
|||
) |
get the html from url
$url |
sync_wechat_get_image_extension_from_url | ( | $url | ) |
guess the image extension from the url
$url | image url |
sync_wechat_get_image_name | ( | $url, | |
$prefix, | |||
$extension_ = Null |
|||
) |
use file content hash to generate image name the image suffix is got from the imageFile.
$url | absolute url of the image file |
$prefix | prefix to prepend before the image name |
sync_wechat_insert_by_url | ( | $url, | |
$config = Null |
|||
) |
this function insert wechat article to the wp-database this function relies on global variable $wpdb and the php module $curl
$config | $config = { 'changeAuthor'[bool,default:false]:whether to keep the original author 'changePostTime'[bool,default:false]: whether to keep the original post time 'postStatus'[choice,default:publish]: article status 'postType'[choice,default:post]: article type 'keepStyle'[bool,default:false]: whether the css of the article is kept 'keepSource'[bool, default:true]: whether the original source info is kept 'postCate'[choice,default:not_classcified]: the classification to put the article 'setFeatureImage'[bool,default:true]: whether to set the feature image 'debug'[bool, default:true]: whether to turn on debug mode, debug mode will output more detailed information } |
$status = { 'status_code'[int]: if status_code = 0, error occurs 'err_msg'[str]: if no error, empty str }
sync_wechat_set_image | ( | $html, | |
$postId, | |||
$config = Null |
|||
) |
extract image urls from html, and download it to local file system, update image url in postId->postContent
$html | raw html text, $postId: post Id |
sync_wechat_upload_image | ( | $url, | |
$postId, | |||
$image_name = Null |
|||
) |
download image from $url and update it for the post with id = $postId
$url | wechat image original url |
$postId | post Id |