diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/action.php | 16 | ||||
-rw-r--r-- | lib/common.php | 1 | ||||
-rw-r--r-- | lib/theme.php | 29 |
3 files changed, 37 insertions, 9 deletions
diff --git a/lib/action.php b/lib/action.php index f2027e0f1..ecd1978f2 100644 --- a/lib/action.php +++ b/lib/action.php @@ -194,37 +194,37 @@ class Action extends HTMLOutputter // lawsuit if (Event::handle('StartShowLaconicaStyles', array($this))) { $this->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', - 'href' => theme_path('css/display.css', 'base') . '?version=' . LACONICA_VERSION, + 'href' => theme_path('base/css/display.css') . '?version=' . LACONICA_VERSION, 'media' => 'screen, projection, tv')); $this->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', - 'href' => theme_path('css/display.css', null) . '?version=' . LACONICA_VERSION, + 'href' => skin_path('css/display.css') . '?version=' . LACONICA_VERSION, 'media' => 'screen, projection, tv')); if (common_config('site', 'mobile')) { $this->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', - 'href' => theme_path('css/mobile.css', 'base') . '?version=' . LACONICA_VERSION, + 'href' => theme_path('base/css/mobile.css') . '?version=' . LACONICA_VERSION, // TODO: "handheld" CSS for other mobile devices 'media' => 'only screen and (max-device-width: 480px)')); // Mobile WebKit } $this->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', - 'href' => theme_path('css/print.css', 'base') . '?version=' . LACONICA_VERSION, + 'href' => theme_path('base/css/print.css') . '?version=' . LACONICA_VERSION, 'media' => 'print')); Event::handle('EndShowLaconicaStyles', array($this)); } if (Event::handle('StartShowUAStyles', array($this))) { $this->comment('[if IE]><link rel="stylesheet" type="text/css" '. - 'href="'.theme_path('css/ie.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]'); + 'href="'.theme_path('base/css/ie.css').'?version='.LACONICA_VERSION.'" /><![endif]'); foreach (array(6,7) as $ver) { - if (file_exists(theme_file('css/ie'.$ver.'.css', 'base'))) { + if (file_exists(theme_file('base/css/ie'.$ver.'.css'))) { // Yes, IE people should be put in jail. $this->comment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '. - 'href="'.theme_path('css/ie'.$ver.'.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]'); + 'href="'.theme_path('base/css/ie'.$ver.'.css').'?version='.LACONICA_VERSION.'" /><![endif]'); } } $this->comment('[if IE]><link rel="stylesheet" type="text/css" '. - 'href="'.theme_path('css/ie.css', null).'?version='.LACONICA_VERSION.'" /><![endif]'); + 'href="'.skin_path('css/ie.css').'?version='.LACONICA_VERSION.'" /><![endif]'); Event::handle('EndShowUAStyles', array($this)); } Event::handle('EndShowStyles', array($this)); diff --git a/lib/common.php b/lib/common.php index b3882d207..dd2570e75 100644 --- a/lib/common.php +++ b/lib/common.php @@ -71,6 +71,7 @@ $config = array('name' => 'Just another Laconica microblog', 'server' => $_server, 'theme' => 'default', + 'skin' => 'default', 'path' => $_path, 'logfile' => null, 'logo' => null, diff --git a/lib/theme.php b/lib/theme.php index 95030affe..bef660cbf 100644 --- a/lib/theme.php +++ b/lib/theme.php @@ -69,4 +69,31 @@ function theme_path($relative, $theme=null) } else { return common_path('theme/'.$theme.'/'.$relative); } -}
\ No newline at end of file +} + +/** + * Gets the full URL of a file in a skin dir based on its relative name + * + * @param string $relative relative path within the theme, skin directory + * @param string $theme name of the theme; defaults to current theme + * @param string $skin name of the skin; defaults to current theme + * + * @return string URL of the file + */ + +function skin_path($relative, $theme=null, $skin=null) +{ + if (!$theme) { + $theme = common_config('site', 'theme'); + } + if (!$skin) { + $skin = common_config('site', 'skin'); + } + $server = common_config('theme', 'server'); + if ($server) { + return 'http://'.$server.'/'.$theme.'/skin/'.$skin.'/'.$relative; + } else { + return common_path('theme/'.$theme.'/skin/'.$skin.'/'.$relative); + } +} + |