diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/language.php | 81 | ||||
-rw-r--r-- | lib/subs.php | 34 | ||||
-rw-r--r-- | lib/twitterapi.php | 2 |
3 files changed, 48 insertions, 69 deletions
diff --git a/lib/language.php b/lib/language.php index 1d00cc31e..a73b73f28 100644 --- a/lib/language.php +++ b/lib/language.php @@ -99,54 +99,35 @@ function get_nice_language_list() * * @return array mapping of language codes to language info */ - -function get_all_languages() -{ - return - array('en-us' => array('q' => 1, 'lang' => 'en_US', - 'name' => 'English (US)', 'direction' => 'ltr'), - 'en-nz' => array('q' => 1, 'lang' => 'en_NZ', - 'name' => 'English (NZ)', 'direction' => 'ltr'), - 'en-gb' => array('q' => 1, 'lang' => 'en_GB', - 'name' => 'English (British)', 'direction' => 'ltr'), - 'en' => array('q' => 1, 'lang' => 'en', - 'name' => 'English', 'direction' => 'ltr'), - 'da' => array('q' => 0.1, 'lang' => 'da_DK', - 'name' => 'Danish', 'direction' => 'ltr'), - 'nl' => array('q' => 1, 'lang' => 'nl_NL', - 'name' => 'Dutch', 'direction' => 'ltr'), - 'eo' => array('q' => 0.1, 'lang' => 'eo', - 'name' => 'Esperanto', 'direction' => 'ltr'), - 'fr-fr' => array('q' => 0.9, 'lang' => 'fr_FR', - 'name' => 'French', 'direction' => 'ltr'), - 'de' => array('q' => 1, 'lang' => 'de_DE', - 'name' => 'German', 'direction' => 'ltr'), - 'it' => array('q' => 1, 'lang' => 'it_IT', - 'name' => 'Italian', 'direction' => 'ltr'), - 'ko' => array('q' => 0.1, 'lang' => 'ko', - 'name' => 'Korean', 'direction' => 'ltr'), - 'nb' => array('q' => 1, 'lang' => 'nb_NO', - 'name' => 'Norwegian (bokmal)', 'direction' => 'ltr'), - 'pt' => array('q' => 0.2, 'lang' => 'pt', - 'name' => 'Portuguese', 'direction' => 'ltr'), - 'pt-br' => array('q' => 1, 'lang' => 'pt_BR', - 'name' => 'Portuguese Brazil', 'direction' => 'ltr'), - 'es' => array('q' => 1, 'lang' => 'es', - 'name' => 'Spanish', 'direction' => 'ltr'), - 'tr' => array('q' => 1, 'lang' => 'tr_TR', - 'name' => 'Turkish', 'direction' => 'ltr'), - 'uk' => array('q' => 1, 'lang' => 'uk_UA', - 'name' => 'Ukrainian', 'direction' => 'ltr'), - 'pl' => array('q' => 1, 'lang' => 'pl_PL', - 'name' => 'Polish', 'direction' => 'ltr'), - 'mk' => array('q' => 1, 'lang' => 'mk_MK', - 'name' => 'Macedonian', 'direction' => 'ltr'), - 'jp' => array('q' => 0.1, 'lang' => 'ja_JP', - 'name' => 'Japanese', 'direction' => 'ltr'), - 'cs' => array('q' => 1, 'lang' => 'cs_CZ', - 'name' => 'Czech', 'direction' => 'ltr'), - 'ca' => array('q' => 1, 'lang' => 'ca_ES', - 'name' => 'Catalan', 'direction' => 'ltr'), - ); +function get_all_languages() { + return array( + 'bg' => array('q' => 0.8, 'lang' => 'bg_BG', 'name' => 'Bulgarian', 'direction' => 'ltr'), + 'ca' => array('q' => 0.5, 'lang' => 'ca_ES', 'name' => 'Catalan', 'direction' => 'ltr'), + 'cs' => array('q' => 0.5, 'lang' => 'cs_CZ', 'name' => 'Czech', 'direction' => 'ltr'), + 'de' => array('q' => 0.5, 'lang' => 'de_DE', 'name' => 'German', 'direction' => 'ltr'), + 'el' => array('q' => 0.1, 'lang' => 'el', 'name' => 'Greek', 'direction' => 'ltr'), + 'en-us' => array('q' => 1, 'lang' => 'en_US', 'name' => 'English (US)', 'direction' => 'ltr'), + 'en-gb' => array('q' => 0.3, 'lang' => 'en_GB', 'name' => 'English (British)', 'direction' => 'ltr'), + 'en' => array('q' => 1, 'lang' => 'en', 'name' => 'English', 'direction' => 'ltr'), + 'es' => array('q' => 0.5, 'lang' => 'es', 'name' => 'Spanish', 'direction' => 'ltr'), + 'fr-fr' => array('q' => 0.2, 'lang' => 'fr_FR', 'name' => 'French', 'direction' => 'ltr'), + 'he' => array('q' => 0.5, 'lang' => 'he_IL', 'name' => 'Hebrew', 'direction' => 'ltr'), + 'it' => array('q' => 0.9, 'lang' => 'it_IT', 'name' => 'Italian', 'direction' => 'rtl'), + 'jp' => array('q' => 0.5, 'lang' => 'ja_JP', 'name' => 'Japanese', 'direction' => 'ltr'), +# 'ko' => array('q' => 0, 'lang' => 'ko', 'name' => 'Korean', 'direction' => 'ltr'), + 'mk' => array('q' => 0.5, 'lang' => 'mk_MK', 'name' => 'Macedonian', 'direction' => 'ltr'), + 'nb' => array('q' => 0.1, 'lang' => 'nb_NO', 'name' => 'Norwegian (bokmal)', 'direction' => 'ltr'), + 'nl' => array('q' => 0.5, 'lang' => 'nl_NL', 'name' => 'Dutch', 'direction' => 'ltr'), + 'pl' => array('q' => 0.5, 'lang' => 'pl_PL', 'name' => 'Polish', 'direction' => 'ltr'), +# 'pt' => array('q' => 0, 'lang' => 'pt', 'name' => 'Portuguese', 'direction' => 'ltr'), + 'pt-br' => array('q' => 0.7, 'lang' => 'pt_BR', 'name' => 'Portuguese Brazil', 'direction' => 'ltr'), + 'ru' => array('q' => 0.1, 'lang' => 'ru_RU', 'name' => 'Russian', 'direction' => 'ltr'), + 'sv' => array('q' => 0.9, 'lang' => 'sv_SE', 'name' => 'Swedish', 'direction' => 'ltr'), + 'te' => array('q' => 0.3, 'lang' => 'te_IN', 'name' => 'Telugu', 'direction' => 'ltr'), + 'tr' => array('q' => 0.5, 'lang' => 'tr_TR', 'name' => 'Turkish', 'direction' => 'ltr'), + 'uk' => array('q' => 0.7, 'lang' => 'uk_UA', 'name' => 'Ukrainian', 'direction' => 'ltr'), + 'vi' => array('q' => 0.7, 'lang' => 'vi_VN', 'name' => 'Vietnamese', 'direction' => 'ltr'), + 'zh-cn' => array('q' => 0.9, 'lang' => 'zh_CN', 'name' => 'Chinese (Simplified)', 'direction' => 'ltr'), + 'zh-hant' => array('q' => 0.2, 'lang' => 'zh_hant', 'name' => 'Chinese (Taiwanese)', 'direction' => 'ltr'), + ); } - diff --git a/lib/subs.php b/lib/subs.php index 6fa1dcad3..0e7b9ded5 100644 --- a/lib/subs.php +++ b/lib/subs.php @@ -60,23 +60,22 @@ function subs_subscribe_to($user, $other) subs_notify($other, $user); - if (common_config('memcached', 'enabled')) { - $cache = new Memcache(); - if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) { - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); - } - } + $cache = common_memcache(); + + if ($cache) { + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); + } + if ($other->autosubscribe && !$other->isSubscribed($user) && !$user->hasBlocked($other)) { if (!$other->subscribeTo($user)) { return _('Could not subscribe other to you.'); } - if (common_config('memcached', 'enabled')) { - $cache = new Memcache(); - if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) { - $cache->delete(common_cache_key('user:notices_with_friends:' . $other->id)); - } - } + $cache = common_memcache(); + + if ($cache) { + $cache->delete(common_cache_key('user:notices_with_friends:' . $other->id)); + } subs_notify($user, $other); } @@ -134,12 +133,11 @@ function subs_unsubscribe_to($user, $other) if (!$sub->delete()) return _('Couldn\'t delete subscription.'); - if (common_config('memcached', 'enabled')) { - $cache = new Memcache(); - if ($cache->connect(common_config('memcached', 'server'), common_config('memcached', 'port'))) { - $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); - } - } + $cache = common_memcache(); + + if ($cache) { + $cache->delete(common_cache_key('user:notices_with_friends:' . $user->id)); + } return true; } diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 50bcb06fe..3d2c74feb 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -690,4 +690,4 @@ class TwitterapiAction extends Action } -}
\ No newline at end of file +} |