From 65158f8d0796108ef5534a91b6ee34bf55d29223 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 17 Sep 2011 11:27:12 -0400 Subject: Fixes #2990 updated the bundled plugins to use the new plugin/user settings structure --- .../views/default/plugins/twitter_api/settings.php | 50 ++++++++++++++++++++++ .../default/plugins/twitter_api/usersettings.php | 29 +++++++++++++ .../views/default/settings/twitter_api/edit.php | 50 ---------------------- .../default/usersettings/twitter_api/edit.php | 29 ------------- 4 files changed, 79 insertions(+), 79 deletions(-) create mode 100644 mod/twitter_api/views/default/plugins/twitter_api/settings.php create mode 100644 mod/twitter_api/views/default/plugins/twitter_api/usersettings.php delete mode 100644 mod/twitter_api/views/default/settings/twitter_api/edit.php delete mode 100644 mod/twitter_api/views/default/usersettings/twitter_api/edit.php (limited to 'mod/twitter_api/views/default') diff --git a/mod/twitter_api/views/default/plugins/twitter_api/settings.php b/mod/twitter_api/views/default/plugins/twitter_api/settings.php new file mode 100644 index 000000000..0b9afd4cf --- /dev/null +++ b/mod/twitter_api/views/default/plugins/twitter_api/settings.php @@ -0,0 +1,50 @@ + 'params[consumer_key]', + 'value' => $vars['entity']->consumer_key, + 'class' => 'elgg-input-thin', +)); + +$consumer_secret_string = elgg_echo('twitter_api:consumer_secret'); +$consumer_secret_view = elgg_view('input/text', array( + 'name' => 'params[consumer_secret]', + 'value' => $vars['entity']->consumer_secret, + 'class' => 'elgg-input-thin', +)); + +$sign_on_with_twitter_string = elgg_echo('twitter_api:login'); +$sign_on_with_twitter_view = elgg_view('input/dropdown', array( + 'name' => 'params[sign_on]', + 'options_values' => array( + 'yes' => elgg_echo('option:yes'), + 'no' => elgg_echo('option:no'), + ), + 'value' => $vars['entity']->sign_on ? $vars['entity']->sign_on : 'no', +)); + +$new_users_with_twitter = elgg_echo('twitter_api:new_users'); +$new_users_with_twitter_view = elgg_view('input/dropdown', array( + 'name' => 'params[new_users]', + 'options_values' => array( + 'yes' => elgg_echo('option:yes'), + 'no' => elgg_echo('option:no'), + ), + 'value' => $vars['entity']->new_users ? $vars['entity']->new_users : 'no', +)); + +$settings = <<<__HTML +

$instructions

+

$consumer_key_view
+

$consumer_secret_view
+
$sign_on_with_twitter_string $sign_on_with_twitter_view
+
$new_users_with_twitter $new_users_with_twitter_view
+__HTML; + +echo $settings; diff --git a/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php new file mode 100644 index 000000000..acb8d9af5 --- /dev/null +++ b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php @@ -0,0 +1,29 @@ +getGUID(); +$twitter_name = get_plugin_usersetting('twitter_name', $user_guid, 'twitter_api'); +$access_key = get_plugin_usersetting('access_key', $user_guid, 'twitter_api'); +$access_secret = get_plugin_usersetting('access_secret', $user_guid, 'twitter_api'); + +$site_name = elgg_get_site_entity()->name; +echo '
' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '
'; + +if (!$access_key || !$access_secret) { + // send user off to validate account + $request_link = twitter_api_get_authorize_url(null, false); + echo '
' . elgg_echo('twitter_api:usersettings:request', array($request_link, $site_name)) . '
'; +} else { + // if this user logged in through twitter and never set up an email address, don't + // let them disassociate their account. + if ($user->email) { + $url = elgg_get_site_url() . "twitter_api/revoke"; + echo '
' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '
'; + echo '
' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '
'; + } else { + echo elgg_echo('twitter_api:usersettings:cannot_revoke', array(elgg_normalize_url('twitter_api/interstitial'))); + } +} diff --git a/mod/twitter_api/views/default/settings/twitter_api/edit.php b/mod/twitter_api/views/default/settings/twitter_api/edit.php deleted file mode 100644 index 0b9afd4cf..000000000 --- a/mod/twitter_api/views/default/settings/twitter_api/edit.php +++ /dev/null @@ -1,50 +0,0 @@ - 'params[consumer_key]', - 'value' => $vars['entity']->consumer_key, - 'class' => 'elgg-input-thin', -)); - -$consumer_secret_string = elgg_echo('twitter_api:consumer_secret'); -$consumer_secret_view = elgg_view('input/text', array( - 'name' => 'params[consumer_secret]', - 'value' => $vars['entity']->consumer_secret, - 'class' => 'elgg-input-thin', -)); - -$sign_on_with_twitter_string = elgg_echo('twitter_api:login'); -$sign_on_with_twitter_view = elgg_view('input/dropdown', array( - 'name' => 'params[sign_on]', - 'options_values' => array( - 'yes' => elgg_echo('option:yes'), - 'no' => elgg_echo('option:no'), - ), - 'value' => $vars['entity']->sign_on ? $vars['entity']->sign_on : 'no', -)); - -$new_users_with_twitter = elgg_echo('twitter_api:new_users'); -$new_users_with_twitter_view = elgg_view('input/dropdown', array( - 'name' => 'params[new_users]', - 'options_values' => array( - 'yes' => elgg_echo('option:yes'), - 'no' => elgg_echo('option:no'), - ), - 'value' => $vars['entity']->new_users ? $vars['entity']->new_users : 'no', -)); - -$settings = <<<__HTML -

$instructions

-

$consumer_key_view
-

$consumer_secret_view
-
$sign_on_with_twitter_string $sign_on_with_twitter_view
-
$new_users_with_twitter $new_users_with_twitter_view
-__HTML; - -echo $settings; diff --git a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php b/mod/twitter_api/views/default/usersettings/twitter_api/edit.php deleted file mode 100644 index acb8d9af5..000000000 --- a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php +++ /dev/null @@ -1,29 +0,0 @@ -getGUID(); -$twitter_name = get_plugin_usersetting('twitter_name', $user_guid, 'twitter_api'); -$access_key = get_plugin_usersetting('access_key', $user_guid, 'twitter_api'); -$access_secret = get_plugin_usersetting('access_secret', $user_guid, 'twitter_api'); - -$site_name = elgg_get_site_entity()->name; -echo '
' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '
'; - -if (!$access_key || !$access_secret) { - // send user off to validate account - $request_link = twitter_api_get_authorize_url(null, false); - echo '
' . elgg_echo('twitter_api:usersettings:request', array($request_link, $site_name)) . '
'; -} else { - // if this user logged in through twitter and never set up an email address, don't - // let them disassociate their account. - if ($user->email) { - $url = elgg_get_site_url() . "twitter_api/revoke"; - echo '
' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '
'; - echo '
' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '
'; - } else { - echo elgg_echo('twitter_api:usersettings:cannot_revoke', array(elgg_normalize_url('twitter_api/interstitial'))); - } -} -- cgit v1.2.3