Create socialhub.utl.php

This commit is contained in:
Namhyeon Go 2018-09-27 05:16:48 +09:00 committed by GitHub
parent c55f0fb233
commit 90964e0a14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

49
helper/socialhub.utl.php Normal file
View File

@ -0,0 +1,49 @@
<?php
/**
* @file socialhub.utl.php
* @date 2018-09-27
* @author Go Namhyeon <gnh1201@gmail.com>
* @brief SocialHub Utilities (refactoring from SocioRouter Utilities)
*/
if(!function_exists("socialhub_send_message")) {
function socialhub_send_message($provider, $adapter, $message, $options=array()) {
$object_id = false;
$response = false;
$status = array(
"message" => $message
);
switch($provider) {
case "facebook":
$status['link'] = get_value_in_array("link", $options, "");
$status['picture'] = get_value_in_array("picture", $options, "");
$response = $adapter->setUserStatus($status);
break;
case "linkedin":
$status['content'] => array(
"title" => get_value_in_array("title", $options, "");
"description" => get_value_in_array("description", $options, "");
"submitted-url" => get_value_in_array("link", $options, "");
"submitted-image-url" => get_value_in_array("picture", $options, "");
);
$status['visibility'] => array(
"code" => "anyone",
);
$response = $adapter->setUserStatus($status);
break;
case "twitter":
$status['link'] = get_value_in_array("link", $options, "");
$status['picture'] = get_value_in_array("picture", $options, "");
$response = $adapter->setUserStatus($status);
break;
default:
set_error("Unknown provider");
show_errors();
}
}
}