<?php gatekeeper(); $service = get_input("service"); if (socialink_is_supported_network($service)) { $network_string = elgg_echo("socialink:network:" . $service); if (socialink_is_available_network($service)) { if (call_user_func("socialink_" . $service . "_is_connected")) { if (call_user_func("socialink_" . $service . "_remove_connection")) { system_message(elgg_echo("socialink:actions:remove:success", array($network_string))); } else { register_error(elgg_echo("socialink:actions:remove:error:remove", array($network_string))); } } else { register_error(elgg_echo("socialink:actions:remove:error:connected", array($network_string))); } } else { register_error(elgg_echo("socialink:actions:remove:error:unavailable", array($network_string))); } } else { register_error(elgg_echo("socialink:actions:remove:error:unknown_service")); } forward(REFERER);
<?php $message = get_input("message"); $network = get_input("network"); $max_length = 140; if ($user_guid = elgg_get_logged_in_user_guid()) { if (!empty($message) && !empty($network)) { if (socialink_is_supported_network($network)) { if (strlen($message) < $max_length) { // post to the network call_user_func("socialink_" . $network . "_post_message", $message, $user_guid); } } } } exit;
/** * Get an array of the supported network fields * * result is in format * settings_name => network_name * * @param string $network the social network to get the fields for * * @return bool|array */ function socialink_get_network_fields($network) { $result = false; if (!empty($network) && socialink_is_supported_network($network)) { $fields = array("twitter" => array("name" => "name", "location" => "location", "url" => "url", "description" => "description", "screen_name" => "screen_name", "profile_url" => "socialink_profile_url"), "linkedin" => array("firstname" => "firstName", "lastname" => "lastName", "email" => "emailAddress", "name" => "socialink_name", "profile_url" => "publicProfileUrl", "location" => "location->name", "industry" => "industry"), "facebook" => array("name" => "getName", "firstname" => "getFirstName", "lastname" => "getLastName", "profile_url" => "getLink", "email" => "getEmail", "location" => "getLocation()->getCity", "gender" => "getGender")); if (array_key_exists($network, $fields)) { $result = $fields[$network]; } } return $result; }