Update and rename socialhub.utl.php to socialtools.php

This commit is contained in:
Namhyeon Go 2019-04-15 13:38:48 +09:00 committed by GitHub
parent 3acbddba3b
commit 13d7d49279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,13 @@
<?php <?php
/** /**
* @file socialhub.utl.php * @file socialtools.php
* @date 2018-09-27 * @date 2018-09-27
* @author Go Namhyeon <gnh1201@gmail.com> * @author Go Namhyeon <gnh1201@gmail.com>
* @brief SocialHub Utilities (refactoring from SocioRouter Utilities) * @brief SocialTools (refactoring from SocioRouter)
*/ */
if(!check_function_exists("socialhub_send_message")) { if(!check_function_exists("social_send_message")) {
function socialhub_send_message($provider, $adapter, $message, $options=array()) { function social_send_message($provider, $adapter, $message, $options=array()) {
$response = false; $response = false;
$status = array( $status = array(
"message" => $message "message" => $message
@ -48,8 +48,8 @@ if(!check_function_exists("socialhub_send_message")) {
} }
} }
if(!check_function_exists("socialhub_parse_object_id")) { if(!check_function_exists("social_parse_object_id")) {
function socialhub_parse_object_id($provider, $response) { function social_parse_object_id($provider, $response) {
$object_id = false; $object_id = false;
switch($provider) { switch($provider) {
@ -69,19 +69,19 @@ if(!check_function_exists("socialhub_parse_object_id")) {
} }
} }
if(!check_function_exists("socialhub_get_object")) { if(!check_function_exists("social_get_object")) {
function socialhub_get_object($provider, $adapter, $object_id) { function social_get_object($provider, $adapter, $object_id) {
$result = false; $result = false;
$access_token = $adapter->getAccessToken(); $access_token = $adapter->getAccessToken();
switch($provider) { switch($provider) {
case "facebook": case "facebook":
$result = array( $result = array(
"post" => socialhub_get_object_facebook($provider, $adapter, $object_id, "post"), "post" => social_get_object_facebook($provider, $adapter, $object_id, "post"),
"likes" => socialhub_get_object_facebook($provider, $adapter, $object_id, "likes"), "likes" => social_get_object_facebook($provider, $adapter, $object_id, "likes"),
"comments" => socialhub_get_object_facebook($provider, $adapter, $object_id, "comments"), "comments" => social_get_object_facebook($provider, $adapter, $object_id, "comments"),
"sharedposts" => socialhub_get_object_facebook($provider, $adapter, $object_id, "sharedposts"), "sharedposts" => social_get_object_facebook($provider, $adapter, $object_id, "sharedposts"),
"reactions" => socialhub_get_object_facebook($provider, $adapter, $object_id, "reactions"), "reactions" => social_get_object_facebook($provider, $adapter, $object_id, "reactions"),
); );
break; break;
} }
@ -90,8 +90,8 @@ if(!check_function_exists("socialhub_get_object")) {
} }
} }
if(!check_function_exists("socialhub_get_object_facebook")) { if(!check_function_exists("social_get_object_facebook")) {
function socialhub_get_object_facebook($adapter, $object_id, $type="post") { function social_get_object_facebook($adapter, $object_id, $type="post") {
$result = false; $result = false;
$response = false; $response = false;