summaryrefslogtreecommitdiff
path: root/lib/omb.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-12-23 14:33:23 -0500
committerEvan Prodromou <evan@prodromou.name>2008-12-23 14:33:23 -0500
commit04ef1ba8eee7a9e2a565d7b4b747ef607665d562 (patch)
treed56ac33bd6bfb8f8641cc9f63b0f6af52b6edfb9 /lib/omb.php
parenteb2f9c98ac115ce67e9a740b200c832153ffa05c (diff)
change function headers to K&R style
Another huge change, for PEAR code standards compliance. Function headers have to be in K&R style (opening brace on its own line), instead of having the opening brace on the same line as the function and parameters. So, a little perl magic found all the function definitions and move the opening brace to the next line (properly indented... usually). darcs-hash:20081223193323-84dde-a28e36ecc66672c783c2842d12fc11043c13ab28.gz
Diffstat (limited to 'lib/omb.php')
-rw-r--r--lib/omb.php42
1 files changed, 28 insertions, 14 deletions
diff --git a/lib/omb.php b/lib/omb.php
index 8199b0679..c07bedab5 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -43,7 +43,8 @@ define('OAUTH_AUTH_HEADER', OAUTH_NAMESPACE.'parameters/auth-header');
define('OAUTH_POST_BODY', OAUTH_NAMESPACE.'parameters/post-body');
define('OAUTH_HMAC_SHA1', OAUTH_NAMESPACE.'signature/HMAC-SHA1');
-function omb_oauth_consumer() {
+function omb_oauth_consumer()
+{
static $con = null;
if (!$con) {
$con = new OAuthConsumer(common_root_url(), '');
@@ -51,7 +52,8 @@ function omb_oauth_consumer() {
return $con;
}
-function omb_oauth_server() {
+function omb_oauth_server()
+{
static $server = null;
if (!$server) {
$server = new OAuthServer(omb_oauth_datastore());
@@ -60,7 +62,8 @@ function omb_oauth_server() {
return $server;
}
-function omb_oauth_datastore() {
+function omb_oauth_datastore()
+{
static $store = null;
if (!$store) {
$store = new LaconicaOAuthDataStore();
@@ -68,7 +71,8 @@ function omb_oauth_datastore() {
return $store;
}
-function omb_hmac_sha1() {
+function omb_hmac_sha1()
+{
static $hmac_method = null;
if (!$hmac_method) {
$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
@@ -76,20 +80,24 @@ function omb_hmac_sha1() {
return $hmac_method;
}
-function omb_get_services($xrd, $type) {
+function omb_get_services($xrd, $type)
+{
return $xrd->services(array(omb_service_filter($type)));
}
-function omb_service_filter($type) {
+function omb_service_filter($type)
+{
return create_function('$s',
'return omb_match_service($s, \''.$type.'\');');
}
-function omb_match_service($service, $type) {
+function omb_match_service($service, $type)
+{
return in_array($type, $service->getTypes());
}
-function omb_service_uri($service) {
+function omb_service_uri($service)
+{
if (!$service) {
return null;
}
@@ -100,7 +108,8 @@ function omb_service_uri($service) {
return $uris[0];
}
-function omb_local_id($service) {
+function omb_local_id($service)
+{
if (!$service) {
return null;
}
@@ -112,7 +121,8 @@ function omb_local_id($service) {
return $service->parser->content($el);
}
-function omb_broadcast_remote_subscribers($notice) {
+function omb_broadcast_remote_subscribers($notice)
+{
# First, get remote users subscribed to this profile
$rp = new Remote_profile();
@@ -142,11 +152,13 @@ function omb_broadcast_remote_subscribers($notice) {
return true;
}
-function omb_post_notice($notice, $remote_profile, $subscription) {
+function omb_post_notice($notice, $remote_profile, $subscription)
+{
return omb_post_notice_keys($notice, $remote_profile->postnoticeurl, $subscription->token, $subscription->secret);
}
-function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
+function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret)
+{
common_debug('Posting notice ' . $notice->id . ' to ' . $postnoticeurl, __FILE__);
@@ -216,7 +228,8 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
}
}
-function omb_broadcast_profile($profile) {
+function omb_broadcast_profile($profile)
+{
# First, get remote users subscribed to this profile
# XXX: use a join here rather than looping through results
$sub = new Subscription();
@@ -236,7 +249,8 @@ function omb_broadcast_profile($profile) {
}
}
-function omb_update_profile($profile, $remote_profile, $subscription) {
+function omb_update_profile($profile, $remote_profile, $subscription)
+{
global $config; # for license URL
$user = User::staticGet($profile->id);
$con = omb_oauth_consumer();