From 81b4a381d9ddc71ed8a53c074ea10910882d3156 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 8 Nov 2009 22:26:13 +0100 Subject: * check usage of 'people' in UI and change it to 'users' or something else in most places * change some contractions to full text in UI messages --- actions/all.php | 2 +- actions/foaf.php | 4 ++-- actions/groups.php | 7 ++++--- actions/imsettings.php | 2 +- actions/invite.php | 10 +++++----- actions/noticesearch.php | 2 +- actions/opensearch.php | 2 +- actions/peoplesearch.php | 2 +- actions/peopletag.php | 2 +- actions/profilesettings.php | 4 ++-- actions/register.php | 10 +++++----- actions/replies.php | 4 ++-- actions/subscribers.php | 8 ++++---- actions/subscriptions.php | 10 +++++----- actions/tagother.php | 2 +- 15 files changed, 36 insertions(+), 35 deletions(-) (limited to 'actions') diff --git a/actions/all.php b/actions/all.php index 61cedce74..b0fd8ee77 100644 --- a/actions/all.php +++ b/actions/all.php @@ -129,7 +129,7 @@ class AllAction extends ProfileAction if (common_logged_in()) { $current_user = common_current_user(); if ($this->user->id === $current_user->id) { - $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.'); + $message .= _('Try subscribing to more users, [join a group](%%action.groups%%) or post something yourself.'); } else { $message .= sprintf(_('You can try to [nudge %s](../%s) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname); } diff --git a/actions/foaf.php b/actions/foaf.php index 356393304..dd2747069 100644 --- a/actions/foaf.php +++ b/actions/foaf.php @@ -136,7 +136,7 @@ class FoafAction extends Action $person = $this->showMicrobloggingAccount($this->profile, common_root_url(), $this->user->uri, false); - // Get people who subscribe to user + // Get users who subscribe to user $sub = new Subscription(); $sub->subscribed = $this->profile->id; @@ -250,7 +250,7 @@ class FoafAction extends Action if ($isSubscriber) { $this->element('sioc:follows', array('rdf:resource'=>$this->user->uri . '#acct')); } else { - // Get people user is subscribed to + // Get users user is subscribed to $sub = new Subscription(); $sub->subscriber = $profile->id; $sub->whereAdd('subscriber != subscribed'); diff --git a/actions/groups.php b/actions/groups.php index 10a1d5964..c713d0a98 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -88,11 +88,12 @@ class GroupsAction extends Action { $notice = sprintf(_('%%%%site.name%%%% groups let you find and talk with ' . - 'people of similar interests. After you join a group ' . + 'users of similar interests. After you join a group ' . 'you can send messages to all other members using the ' . - 'syntax "!groupname". Don\'t see a group you like? Try ' . + 'syntax "!groupname". Are you not seeing any groups ' . + 'you like? Try ' . '[searching for one](%%%%action.groupsearch%%%%) or ' . - '[start your own!](%%%%action.newgroup%%%%)')); + '[start your own](%%%%action.newgroup%%%%)!')); $this->elementStart('div', 'instructions'); $this->raw(common_markup_to_html($notice)); $this->elementEnd('div'); diff --git a/actions/imsettings.php b/actions/imsettings.php index f57933b43..b76679f34 100644 --- a/actions/imsettings.php +++ b/actions/imsettings.php @@ -151,7 +151,7 @@ class ImsettingsAction extends ConnectSettingsAction $this->elementStart('li'); $this->checkbox('jabberreplies', _('Send me replies through Jabber/GTalk '. - 'from people I\'m not subscribed to.'), + 'from users I am not subscribed to.'), $user->jabberreplies); $this->elementEnd('li'); $this->elementStart('li'); diff --git a/actions/invite.php b/actions/invite.php index 3015202e9..8a0ac8a1b 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -133,7 +133,7 @@ class InviteAction extends CurrentUserDesignAction $this->elementEnd('ul'); } if ($this->subbed) { - $this->element('p', null, _('These people are already users and you were automatically subscribed to them:')); + $this->element('p', null, _('These are already users and you were automatically subscribed to them:')); $this->elementStart('ul'); foreach ($this->subbed as $other) { $this->element('li', null, sprintf(_('%s (%s)'), $other->nickname, $other->email)); @@ -141,7 +141,7 @@ class InviteAction extends CurrentUserDesignAction $this->elementEnd('ul'); } if ($this->sent) { - $this->element('p', null, _('Invitation(s) sent to the following people:')); + $this->element('p', null, _('Invitation(s) sent to the following e-mail addresses:')); $this->elementStart('ul'); foreach ($this->sent as $other) { $this->element('li', null, $other); @@ -226,9 +226,9 @@ class InviteAction extends CurrentUserDesignAction $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename); $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n". - "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n". - "You can also share news about yourself, your thoughts, or your life online with people who know about you. ". - "It's also great for meeting new people who share your interests.\n\n". + "%2\$s is a micro-blogging service that lets you keep up-to-date with those you know and those who interest you.\n\n". + "You can also share news about yourself, your thoughts, or your life online with users who know about you. ". + "It is also great for meeting others who share your interests.\n\n". "%1\$s said:\n\n%4\$s\n\n". "You can see %1\$s's profile page on %2\$s here:\n\n". "%5\$s\n\n". diff --git a/actions/noticesearch.php b/actions/noticesearch.php index 79cf572cc..fe86c8cd3 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/searchaction.php'; * @author Robin Millette * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ - * @todo common parent for people and content search? + * @todo common parent for user and content search? */ class NoticesearchAction extends SearchAction { diff --git a/actions/opensearch.php b/actions/opensearch.php index d5e6698f3..b2186f0e9 100644 --- a/actions/opensearch.php +++ b/actions/opensearch.php @@ -61,7 +61,7 @@ class OpensearchAction extends Action $short_name = ''; if ($type == 'people') { $type = 'peoplesearch'; - $short_name = _('People Search'); + $short_name = _('User Search'); } else { $type = 'noticesearch'; $short_name = _('Notice Search'); diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index 38135ecbd..63a5c88f3 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -49,7 +49,7 @@ class PeoplesearchAction extends SearchAction { function getInstructions() { - return _('Search for people on %%site.name%% by their name, location, or interests. ' . + return _('Search for users on %%site.name%% by their name, location, or interests. ' . 'Separate the terms by spaces; they must be 3 characters or more.'); } diff --git a/actions/peopletag.php b/actions/peopletag.php index 6dbbc9261..dbce417df 100644 --- a/actions/peopletag.php +++ b/actions/peopletag.php @@ -67,7 +67,7 @@ class PeopletagAction extends Action $this->tag = $this->trimmed('tag'); if (!common_valid_profile_tag($this->tag)) { - $this->clientError(sprintf(_('Not a valid people tag: %s'), + $this->clientError(sprintf(_('Not a valid user tag: %s'), $this->tag)); return; } diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 0a0cc5997..6a1c07f9d 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -68,8 +68,8 @@ class ProfilesettingsAction extends AccountSettingsAction function getInstructions() { - return _('You can update your personal profile info here '. - 'so people know more about you.'); + return _('You can update your personal profile info here ' . + 'so readers know more about you.'); } function showScripts() diff --git a/actions/register.php b/actions/register.php index 57f8e7bdf..584ad3ead 100644 --- a/actions/register.php +++ b/actions/register.php @@ -82,14 +82,14 @@ class RegisterAction extends Action } if (common_config('site', 'inviteonly') && empty($this->code)) { - $this->clientError(_('Sorry, only invited people can register.')); + $this->clientError(_('Sorry. Only those invited can register.')); return false; } if (!empty($this->code)) { $this->invite = Invitation::staticGet('code', $this->code); if (empty($this->invite)) { - $this->clientError(_('Sorry, invalid invitation code.')); + $this->clientError(_('Sorry. This is an invalid invitation code.')); return false; } // Store this in case we need it @@ -186,7 +186,7 @@ class RegisterAction extends Action } if (common_config('site', 'inviteonly') && !($code && $invite)) { - $this->clientError(_('Sorry, only invited people can register.')); + $this->clientError(_('Sorry. Only those invited can register.')); return; } @@ -401,7 +401,7 @@ class RegisterAction extends Action } if (common_config('site', 'inviteonly') && !($code && $invite)) { - $this->clientError(_('Sorry, only invited people can register.')); + $this->clientError(_('Sorry. Only those invited can register.')); return; } @@ -542,7 +542,7 @@ class RegisterAction extends Action '(%%%%action.imsettings%%%%) '. 'so you can send notices '. 'through instant messages.' . "\n" . - '* [Search for people](%%%%action.peoplesearch%%%%) '. + '* [Search for users](%%%%action.peoplesearch%%%%) '. 'that you may know or '. 'that share your interests. ' . "\n" . '* Update your [profile settings]'. diff --git a/actions/replies.php b/actions/replies.php index a13b5a227..2829a7335 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -195,12 +195,12 @@ class RepliesAction extends OwnerDesignAction function showEmptyListMessage() { - $message = sprintf(_('This is the timeline showing replies to %s but %s hasn\'t received a notice to his attention yet.'), $this->user->nickname, $this->user->nickname) . ' '; + $message = sprintf(_('This is the timeline showing replies to %s but %s has not received a notice to his attention yet.'), $this->user->nickname, $this->user->nickname) . ' '; if (common_logged_in()) { $current_user = common_current_user(); if ($this->user->id === $current_user->id) { - $message .= _('You can engage other users in a conversation, subscribe to more people or [join groups](%%action.groups%%).'); + $message .= _('You can engage other users in a conversation, subscribe to more users or [join groups](%%action.groups%%).'); } else { $message .= sprintf(_('You can try to [nudge %s](../%s) or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname); } diff --git a/actions/subscribers.php b/actions/subscribers.php index df9ec9961..1f584e2c1 100644 --- a/actions/subscribers.php +++ b/actions/subscribers.php @@ -60,12 +60,12 @@ class SubscribersAction extends GalleryAction $user =& common_current_user(); if ($user && ($user->id == $this->profile->id)) { $this->element('p', null, - _('These are the people who listen to '. + _('These are the users who have subscribed to '. 'your notices.')); } else { $this->element('p', null, - sprintf(_('These are the people who '. - 'listen to %s\'s notices.'), + sprintf(_('These are the users who '. + 'have subscribed to %s\'s notices.'), $this->profile->nickname)); } } @@ -105,7 +105,7 @@ class SubscribersAction extends GalleryAction if (common_logged_in()) { $current_user = common_current_user(); if ($this->user->id === $current_user->id) { - $message = _('You have no subscribers. Try subscribing to people you know and they might return the favor'); + $message = _('You have no subscribers. Try subscribing to users you know and they might return the favor'); } else { $message = sprintf(_('%s has no subscribers. Want to be the first?'), $this->user->nickname); } diff --git a/actions/subscriptions.php b/actions/subscriptions.php index cc7b38ee4..4f65e9bf1 100644 --- a/actions/subscriptions.php +++ b/actions/subscriptions.php @@ -62,12 +62,12 @@ class SubscriptionsAction extends GalleryAction $user =& common_current_user(); if ($user && ($user->id == $this->profile->id)) { $this->element('p', null, - _('These are the people whose notices '. - 'you listen to.')); + _('These are the users whose notices '. + 'you have subscribed to.')); } else { $this->element('p', null, - sprintf(_('These are the people whose '. - 'notices %s listens to.'), + sprintf(_('These are the users whose '. + 'notices %s has subscribed to.'), $this->profile->nickname)); } } @@ -118,7 +118,7 @@ class SubscriptionsAction extends GalleryAction if (common_logged_in()) { $current_user = common_current_user(); if ($this->user->id === $current_user->id) { - $message = _('You\'re not listening to anyone\'s notices right now, try subscribing to people you know. Try [people search](%%action.peoplesearch%%), look for members in groups you\'re interested in and in our [featured users](%%action.featured%%). If you\'re a [Twitter user](%%action.twittersettings%%), you can automatically subscribe to people you already follow there.'); + $message = _('You have not subscribed to anyone\'s notices right now. Try subscribing to users you know. Try [user search](%%action.peoplesearch%%), look for members in groups you\'re interested in and in our [featured users](%%action.featured%%). If you are a [Twitter user](%%action.twittersettings%%), you can automatically subscribe to users you already follow there.'); } else { $message = sprintf(_('%s is not listening to anyone.'), $this->user->nickname); } diff --git a/actions/tagother.php b/actions/tagother.php index c3f43be8b..80fa9cc95 100644 --- a/actions/tagother.php +++ b/actions/tagother.php @@ -190,7 +190,7 @@ class TagotherAction extends Action !Subscription::pkeyGet(array('subscriber' => $this->profile->id, 'subscribed' => $user->id))) { - $this->clientError(_('You can only tag people you are subscribed to or who are subscribed to you.')); + $this->clientError(_('You can only tag users you are subscribed to or who are subscribed to you.')); return; } -- cgit v1.2.3-54-g00ecf From 6483fbd8fa4c7bc8da83a9a2e334db9d9a19a77b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 8 Nov 2009 22:34:52 +0100 Subject: More precise field label --- actions/smssettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/smssettings.php b/actions/smssettings.php index 672abcef8..9fa7f62fb 100644 --- a/actions/smssettings.php +++ b/actions/smssettings.php @@ -101,7 +101,7 @@ class SmssettingsAction extends ConnectSettingsAction common_local_url('smssettings'))); $this->elementStart('fieldset', array('id' => 'settings_sms_address')); - $this->element('legend', null, _('Address')); + $this->element('legend', null, _('SMS address')); $this->hidden('token', common_session_token()); if ($user->sms) { -- cgit v1.2.3-54-g00ecf From 1872d07602f50b4991d0da26aca3a5d775338e47 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 8 Nov 2009 22:37:09 +0100 Subject: More specifics on 'address' --- actions/imsettings.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actions') diff --git a/actions/imsettings.php b/actions/imsettings.php index b76679f34..49c7b2a0e 100644 --- a/actions/imsettings.php +++ b/actions/imsettings.php @@ -69,7 +69,7 @@ class ImsettingsAction extends ConnectSettingsAction { return _('You can send and receive notices through '. 'Jabber/GTalk [instant messages](%%doc.im%%). '. - 'Configure your address and settings below.'); + 'Configure your instant messages address and settings below.'); } /** @@ -97,7 +97,7 @@ class ImsettingsAction extends ConnectSettingsAction 'action' => common_local_url('imsettings'))); $this->elementStart('fieldset', array('id' => 'settings_im_address')); - $this->element('legend', null, _('Address')); + $this->element('legend', null, _('IM address')); $this->hidden('token', common_session_token()); if ($user->jabber) { @@ -111,7 +111,7 @@ class ImsettingsAction extends ConnectSettingsAction if ($confirm) { $this->element('p', 'form_unconfirmed', $confirm->address); $this->element('p', 'form_note', - sprintf(_('Awaiting confirmation on this address. '. + sprintf(_('Awaiting confirmation on this IM address. '. 'Check your Jabber/GTalk account for a '. 'message with further instructions. '. '(Did you add %s to your buddy list?)'), -- cgit v1.2.3-54-g00ecf From 43132eb55ee68f45ad776c8b95db5c8d130411da Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 8 Nov 2009 22:45:18 +0100 Subject: Several updates to UI messages --- actions/recoverpassword.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actions') diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php index 9776c1fb4..dcff35f6e 100644 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php @@ -149,13 +149,13 @@ class RecoverpasswordAction extends Action $this->elementStart('div', 'instructions'); if ($this->mode == 'recover') { $this->element('p', null, - _('If you\'ve forgotten or lost your' . + _('If you have forgotten or lost your' . ' password, you can get a new one sent to' . ' the email address you have stored' . ' in your account.')); } else if ($this->mode == 'reset') { $this->element('p', null, - _('You\'ve been identified. Enter a' . + _('You have been identified. Enter a' . ' new password below. ')); } $this->elementEnd('div'); @@ -185,10 +185,10 @@ class RecoverpasswordAction extends Action 'class' => 'form_settings', 'action' => common_local_url('recoverpassword'))); $this->elementStart('fieldset'); - $this->element('legend', null, _('Password recover')); + $this->element('legend', null, _('Password recovery')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); - $this->input('nicknameoremail', _('Nickname or email'), + $this->input('nicknameoremail', _('Nickname or email address'), $this->trimmed('nicknameoremail'), _('Your nickname on this server, ' . 'or your registered email address.')); -- cgit v1.2.3-54-g00ecf From b7e2e3fd2b7e36f75c810a599334c2ca8abcca55 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 8 Nov 2009 17:04:46 -0500 Subject: Restructure theme.php to define a class Theme For various reasons, it's nicer to have a class for theme-file paths and such. So, I've rewritten the code for determining the locations of theme files to be more OOPy. I changed all the uses of the two functions in the module (theme_file and theme_path) to use Theme::file and Theme::path respectively. I've also removed the code in common.php that require's the module; using a class means we can autoload it instead. --- actions/opensearch.php | 2 +- classes/Avatar.php | 2 +- classes/User_group.php | 2 +- lib/action.php | 16 ++--- lib/common.php | 1 - lib/htmloutputter.php | 4 +- lib/noticesection.php | 2 +- lib/theme.php | 164 +++++++++++++++++++++++++++++++++++++------------ 8 files changed, 138 insertions(+), 55 deletions(-) (limited to 'actions') diff --git a/actions/opensearch.php b/actions/opensearch.php index d5e6698f3..861b53d7d 100644 --- a/actions/opensearch.php +++ b/actions/opensearch.php @@ -75,7 +75,7 @@ class OpensearchAction extends Action $this->element('Url', array('type' => 'text/html', 'method' => 'get', 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---'))))); $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico')); - $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), theme_path('logo.png')); + $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), Theme::path('logo.png')); $this->element('AdultContent', null, 'false'); $this->element('Language', null, common_language()); $this->element('OutputEncoding', null, 'UTF-8'); diff --git a/classes/Avatar.php b/classes/Avatar.php index 64f105179..cc7a6b647 100644 --- a/classes/Avatar.php +++ b/classes/Avatar.php @@ -102,6 +102,6 @@ class Avatar extends Memcached_DataObject static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', AVATAR_STREAM_SIZE => 'stream', AVATAR_MINI_SIZE => 'mini'); - return theme_path('default-avatar-'.$sizenames[$size].'.png'); + return Theme::path('default-avatar-'.$sizenames[$size].'.png'); } } diff --git a/classes/User_group.php b/classes/User_group.php index 310ecff1e..b92638f7a 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -34,7 +34,7 @@ class User_group extends Memcached_DataObject static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile', AVATAR_STREAM_SIZE => 'stream', AVATAR_MINI_SIZE => 'mini'); - return theme_path('default-avatar-'.$sizenames[$size].'.png'); + return Theme::path('default-avatar-'.$sizenames[$size].'.png'); } function homeUrl() diff --git a/lib/action.php b/lib/action.php index 78ca9137a..80f398fbd 100644 --- a/lib/action.php +++ b/lib/action.php @@ -168,7 +168,7 @@ class Action extends HTMLOutputter // lawsuit { if (is_readable(INSTALLDIR . '/theme/' . common_config('site', 'theme') . '/favicon.ico')) { $this->element('link', array('rel' => 'shortcut icon', - 'href' => theme_path('favicon.ico'))); + 'href' => Theme::path('favicon.ico'))); } else { $this->element('link', array('rel' => 'shortcut icon', 'href' => common_path('favicon.ico'))); @@ -177,7 +177,7 @@ class Action extends HTMLOutputter // lawsuit if (common_config('site', 'mobile')) { if (is_readable(INSTALLDIR . '/theme/' . common_config('site', 'theme') . '/apple-touch-icon.png')) { $this->element('link', array('rel' => 'apple-touch-icon', - 'href' => theme_path('apple-touch-icon.png'))); + 'href' => Theme::path('apple-touch-icon.png'))); } else { $this->element('link', array('rel' => 'apple-touch-icon', 'href' => common_path('apple-touch-icon.png'))); @@ -210,16 +210,16 @@ class Action extends HTMLOutputter // lawsuit if (Event::handle('StartShowUAStyles', array($this))) { $this->comment('[if IE]>comment('[if lte IE '.$ver.']>comment('[if IE]>elementStart('a', array('class' => 'url home bookmark', 'href' => common_local_url('public'))); - if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) { + if (common_config('site', 'logo') || file_exists(Theme::file('logo.png'))) { $this->element('img', array('class' => 'logo photo', - 'src' => (common_config('site', 'logo')) ? common_config('site', 'logo') : theme_path('logo.png'), + 'src' => (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png'), 'alt' => common_config('site', 'name'))); } $this->element('span', array('class' => 'fn org'), common_config('site', 'name')); diff --git a/lib/common.php b/lib/common.php index 68bdbf229..6aac46807 100644 --- a/lib/common.php +++ b/lib/common.php @@ -227,7 +227,6 @@ require_once 'markdown.php'; require_once INSTALLDIR.'/lib/util.php'; require_once INSTALLDIR.'/lib/action.php'; -require_once INSTALLDIR.'/lib/theme.php'; require_once INSTALLDIR.'/lib/mail.php'; require_once INSTALLDIR.'/lib/subs.php'; require_once INSTALLDIR.'/lib/Shorturl_api.php'; diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index ce83295fb..c2ec83c28 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -375,8 +375,8 @@ class HTMLOutputter extends XMLOutputter $url = parse_url($src); if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment)) { - if(file_exists(theme_file($src,$theme))){ - $src = theme_path($src, $theme) . '?version=' . STATUSNET_VERSION; + if(file_exists(Theme::file($src,$theme))){ + $src = Theme::path($src, $theme) . '?version=' . STATUSNET_VERSION; }else{ $src = common_path($src); } diff --git a/lib/noticesection.php b/lib/noticesection.php index b223932ef..24465f8ba 100644 --- a/lib/noticesection.php +++ b/lib/noticesection.php @@ -114,7 +114,7 @@ class NoticeSection extends Section $att_class = 'attachments'; } - $clip = theme_path('images/icons/clip.png', 'base'); + $clip = Theme::path('images/icons/clip.png', 'base'); $this->out->elementStart('a', array('class' => $att_class, 'style' => "font-style: italic;", 'href' => $href, 'title' => "# of attachments: $count")); $this->out->raw(" ($count "); $this->out->element('img', array('style' => 'display: inline', 'align' => 'top', 'width' => 20, 'height' => 20, 'src' => $clip, 'alt' => 'alt')); diff --git a/lib/theme.php b/lib/theme.php index 08e3e8538..c658058ff 100644 --- a/lib/theme.php +++ b/lib/theme.php @@ -23,7 +23,7 @@ * @package StatusNet * @author Evan Prodromou * @author Sarven Capadisli - * @copyright 2008 StatusNet, Inc. + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -33,62 +33,146 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { } /** - * Gets the full path of a file in a theme dir based on its relative name + * Class for querying and manipulating a theme * - * @param string $relative relative path within the theme directory - * @param string $theme name of the theme; defaults to current theme + * Themes are directories with some expected sub-directories and files + * in them. They're found in either local/theme (for locally-installed themes) + * or theme/ subdir of installation dir. * - * @return string File path to the theme file + * This used to be a couple of functions, but for various reasons it's nice + * to have a class instead. + * + * @category Output + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ */ -function theme_file($relative, $theme=null) +class Theme { - if (empty($theme)) { - $theme = common_config('site', 'theme'); - } - $dir = common_config('theme', 'dir'); - if (empty($dir)) { - $dir = INSTALLDIR.'/theme'; - } - return $dir.'/'.$theme.'/'.$relative; -} + var $dir = null; + var $path = null; -/** - * Gets the full URL of a file in a theme dir based on its relative name - * - * @param string $relative relative path within the theme directory - * @param string $theme name of the theme; defaults to current theme - * - * @return string URL of the file - */ + /** + * Constructor + * + * Determines the proper directory and path for this theme. + * + * @param string $name Name of the theme; defaults to config value + */ -function theme_path($relative, $theme=null) -{ - if (empty($theme)) { - $theme = common_config('site', 'theme'); - } + function __construct($name=null) + { + if (empty($name)) { + $name = common_config('site', 'theme'); + } + + // Check to see if it's in the local dir + + $localroot = INSTALLDIR.'/local/theme'; + + $fulldir = $localroot.'/'.$name; + + if (file_exists($fulldir) && is_dir($fulldir)) { + $this->dir = $fulldir; + $this->path = common_path('local/theme/'.$name.'/'); + return; + } + + // Check to see if it's in the distribution dir - $path = common_config('theme', 'path'); + $instroot = common_config('theme', 'dir'); - if (empty($path)) { - $path = common_config('site', 'path') . '/theme/'; + if (empty($instroot)) { + $instroot = INSTALLDIR.'/theme'; + } + + $fulldir = $instroot.'/'.$name; + + if (file_exists($fulldir) && is_dir($fulldir)) { + + $this->dir = $fulldir; + + $path = common_config('theme', 'path'); + + if (empty($path)) { + $path = common_config('site', 'path') . '/theme/'; + } + + if ($path[strlen($path)-1] != '/') { + $path .= '/'; + } + + if ($path[0] != '/') { + $path = '/'.$path; + } + + $server = common_config('theme', 'server'); + + if (empty($server)) { + $server = common_config('site', 'server'); + } + + // XXX: protocol + + $this->path = 'http://'.$server.$path.$name; + } } - if ($path[strlen($path)-1] != '/') { - $path .= '/'; + /** + * Gets the full local filename of a file in this theme. + * + * @param string $relative relative name, like 'logo.png' + * + * @return string full pathname, like /var/www/mublog/theme/default/logo.png + */ + + function getFile($relative) + { + return $this->dir.'/'.$relative; } - if ($path[0] != '/') { - $path = '/'.$path; + /** + * Gets the full HTTP url of a file in this theme + * + * @param string $relative relative name, like 'logo.png' + * + * @return string full URL, like 'http://example.com/theme/default/logo.png' + */ + + function getPath($relative) + { + return $this->path.'/'.$relative; } - $server = common_config('theme', 'server'); + /** + * Gets the full path of a file in a theme dir based on its relative name + * + * @param string $relative relative path within the theme directory + * @param string $name name of the theme; defaults to current theme + * + * @return string File path to the theme file + */ - if (empty($server)) { - $server = common_config('site', 'server'); + static function file($relative, $name=null) + { + $theme = new Theme($name); + return $theme->getFile($relative); } - // XXX: protocol + /** + * Gets the full URL of a file in a theme dir based on its relative name + * + * @param string $relative relative path within the theme directory + * @param string $name name of the theme; defaults to current theme + * + * @return string URL of the file + */ - return 'http://'.$server.$path.$theme.'/'.$relative; + static function path($relative, $name=null) + { + $theme = new Theme($name); + return $theme->getPath($relative); + } } -- cgit v1.2.3-54-g00ecf