aboutsummaryrefslogtreecommitdiff
path: root/mod/twitter_api
diff options
context:
space:
mode:
Diffstat (limited to 'mod/twitter_api')
-rw-r--r--mod/twitter_api/languages/en.php2
-rw-r--r--mod/twitter_api/lib/twitter_api.php19
-rw-r--r--mod/twitter_api/manifest.xml6
-rw-r--r--mod/twitter_api/start.php8
-rw-r--r--mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php3
-rw-r--r--mod/twitter_api/views/default/plugins/twitter_api/settings.php (renamed from mod/twitter_api/views/default/settings/twitter_api/edit.php)6
-rw-r--r--mod/twitter_api/views/default/plugins/twitter_api/usersettings.php (renamed from mod/twitter_api/views/default/usersettings/twitter_api/edit.php)16
7 files changed, 33 insertions, 27 deletions
diff --git a/mod/twitter_api/languages/en.php b/mod/twitter_api/languages/en.php
index 9d8554a9e..f4b3c7f94 100644
--- a/mod/twitter_api/languages/en.php
+++ b/mod/twitter_api/languages/en.php
@@ -21,6 +21,8 @@ $english = array(
'twitter_api:usersettings:authorized' => "You have authorized %s to access your Twitter account: @%s.",
'twitter_api:usersettings:revoke' => 'Click <a href="%s">here</a> to revoke access.',
+ 'twitter_api:usersettings:site_not_configured' => 'An administrator must first configure Twitter before it can be used.',
+
'twitter_api:revoke:success' => 'Twitter access has been revoked.',
'twitter_api:login' => 'Allow existing users who have connected their Twitter account to sign in with Twitter?',
diff --git a/mod/twitter_api/lib/twitter_api.php b/mod/twitter_api/lib/twitter_api.php
index b14b84f2d..355123992 100644
--- a/mod/twitter_api/lib/twitter_api.php
+++ b/mod/twitter_api/lib/twitter_api.php
@@ -184,29 +184,22 @@ function twitter_api_create_user($twitter) {
function twitter_api_update_user_avatar($user, $file_location) {
// twitter's images have a few suffixes:
// _normal
- // _resonably_small
+ // _reasonably_small
// _mini
// the twitter app here returns _normal. We want standard, so remove the suffix.
// @todo Should probably check that it's an image file.
$file_location = str_replace('_normal.jpg', '.jpg', $file_location);
- $sizes = array(
- 'topbar' => array(16, 16, TRUE),
- 'tiny' => array(25, 25, TRUE),
- 'small' => array(40, 40, TRUE),
- 'medium' => array(100, 100, TRUE),
- 'large' => array(200, 200, FALSE),
- 'master' => array(550, 550, FALSE),
- );
+ $icon_sizes = elgg_get_config('icon_sizes');
$filehandler = new ElggFile();
$filehandler->owner_guid = $user->getGUID();
- foreach ($sizes as $size => $dimensions) {
+ foreach ($icon_sizes as $size => $dimensions) {
$image = get_resized_image_from_existing_file(
$file_location,
- $dimensions[0],
- $dimensions[1],
- $dimensions[2]
+ $dimensions['w'],
+ $dimensions['h'],
+ $dimensions['square']
);
$filehandler->setFilename("profile/$user->guid$size.jpg");
diff --git a/mod/twitter_api/manifest.xml b/mod/twitter_api/manifest.xml
index 38b1dc9a7..86bba4b50 100644
--- a/mod/twitter_api/manifest.xml
+++ b/mod/twitter_api/manifest.xml
@@ -8,10 +8,10 @@
<category>bundled</category>
<website>http://www.elgg.org/</website>
<copyright>See COPYRIGHT.txt</copyright>
- <license>GNU Public License version 2</license>
+ <license>GNU General Public License version 2</license>
<requires>
- <type>elgg_version</type>
- <version>2010040201</version>
+ <type>elgg_release</type>
+ <version>1.8</version>
</requires>
<requires>
<type>plugin</type>
diff --git a/mod/twitter_api/start.php b/mod/twitter_api/start.php
index b17643c8c..08bce5479 100644
--- a/mod/twitter_api/start.php
+++ b/mod/twitter_api/start.php
@@ -45,6 +45,7 @@ function twitter_api_init() {
* Handles old pg/twitterservice/ handler
*
* @param array $page
+ * @return bool
*/
function twitter_api_pagehandler_deprecated($page) {
$url = elgg_get_site_url() . 'pg/twitter_api/authorize';
@@ -59,10 +60,11 @@ function twitter_api_pagehandler_deprecated($page) {
* Serves pages for twitter.
*
* @param array $page
+ * @return void
*/
function twitter_api_pagehandler($page) {
if (!isset($page[0])) {
- forward();
+ return false;
}
switch ($page[0]) {
@@ -91,9 +93,9 @@ function twitter_api_pagehandler($page) {
include "$pages/interstitial.php";
break;
default:
- forward();
- break;
+ return false;
}
+ return true;
}
/**
diff --git a/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
index fdeafd46d..cad2be345 100644
--- a/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
+++ b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php
@@ -55,7 +55,8 @@ echo elgg_view('input/submit', array(
));
echo elgg_view('output/url', array(
- 'class' => 'right',
+ 'class' => 'float-alt',
'text' => elgg_echo('twitter_api:interstitial:no_thanks'),
'href' => '/',
+ 'is_trusted' => true,
)); \ No newline at end of file
diff --git a/mod/twitter_api/views/default/settings/twitter_api/edit.php b/mod/twitter_api/views/default/plugins/twitter_api/settings.php
index 4e52a5c9d..0b9afd4cf 100644
--- a/mod/twitter_api/views/default/settings/twitter_api/edit.php
+++ b/mod/twitter_api/views/default/plugins/twitter_api/settings.php
@@ -9,14 +9,14 @@ $consumer_key_string = elgg_echo('twitter_api:consumer_key');
$consumer_key_view = elgg_view('input/text', array(
'name' => 'params[consumer_key]',
'value' => $vars['entity']->consumer_key,
- 'class' => 'text_input',
+ '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' => 'text_input twitter-secret',
+ 'class' => 'elgg-input-thin',
));
$sign_on_with_twitter_string = elgg_echo('twitter_api:login');
@@ -40,7 +40,7 @@ $new_users_with_twitter_view = elgg_view('input/dropdown', array(
));
$settings = <<<__HTML
-<div class="elgg-instructs mtm"><p>$instructions</p></div>
+<div class="elgg-content-thin mtm"><p>$instructions</p></div>
<div><label>$consumer_key_string</label><br /> $consumer_key_view</div>
<div><label>$consumer_secret_string</label><br /> $consumer_secret_view</div>
<div>$sign_on_with_twitter_string $sign_on_with_twitter_view</div>
diff --git a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php
index acb8d9af5..edcea2f0d 100644
--- a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php
+++ b/mod/twitter_api/views/default/plugins/twitter_api/usersettings.php
@@ -5,9 +5,17 @@
$user = elgg_get_logged_in_user_entity();
$user_guid = $user->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');
+$twitter_name = elgg_get_plugin_user_setting('twitter_name', $user_guid, 'twitter_api');
+$access_key = elgg_get_plugin_user_setting('access_key', $user_guid, 'twitter_api');
+$access_secret = elgg_get_plugin_user_setting('access_secret', $user_guid, 'twitter_api');
+
+$site_key = elgg_get_plugin_setting('consumer_key', 'twitter_api');
+$site_secret = elgg_get_plugin_setting('consumer_secret', 'twitter_api');
+
+if (!($site_key && $site_secret)) {
+ echo '<div>' . elgg_echo('twitter_api:usersettings:site_not_configured') . '</div>';
+ return true;
+}
$site_name = elgg_get_site_entity()->name;
echo '<div>' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '</div>';
@@ -21,7 +29,7 @@ if (!$access_key || !$access_secret) {
// let them disassociate their account.
if ($user->email) {
$url = elgg_get_site_url() . "twitter_api/revoke";
- echo '<div class="twitter_anywhere">' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>';
+ echo '<div>' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>';
echo '<div>' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '</div>';
} else {
echo elgg_echo('twitter_api:usersettings:cannot_revoke', array(elgg_normalize_url('twitter_api/interstitial')));