3 * Laconica, the distributed open-source microblogging tool
5 * Utilities for theme files and paths
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Evan Prodromou <evan@controlyourself.ca>
25 * @author Sarven Capadisli <csarven@controlyourself.ca>
26 * @copyright 2008 Control Yourself, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://laconi.ca/
31 if (!defined('LACONICA')) {
36 * Gets the full path of a file in a theme dir based on its relative name
38 * @param string $relative relative path within the theme directory
39 * @param string $theme name of the theme; defaults to current theme
41 * @return string File path to the theme file
44 function theme_file($relative, $theme=null)
47 $theme = common_config('site', 'theme');
49 return INSTALLDIR.'/theme/'.$theme.'/'.$relative;
53 * Gets the full URL of a file in a theme dir based on its relative name
55 * @param string $relative relative path within the theme directory
56 * @param string $theme name of the theme; defaults to current theme
58 * @return string URL of the file
61 function theme_path($relative, $theme=null)
64 $theme = common_config('site', 'theme');
66 $server = common_config('theme', 'server');
68 return 'http://'.$server.'/'.$theme.'/'.$relative;
70 return common_path('theme/'.$theme.'/'.$relative);
75 * Gets the full URL of a file in a skin dir based on its relative name
77 * @param string $relative relative path within the theme, skin directory
78 * @param string $theme name of the theme; defaults to current theme
79 * @param string $skin name of the skin; defaults to current theme
81 * @return string URL of the file
84 function skin_path($relative, $theme=null, $skin=null)
87 $theme = common_config('site', 'theme');
90 $skin = common_config('site', 'skin');
92 $server = common_config('theme', 'server');
94 return 'http://'.$server.'/'.$theme.'/skin/'.$skin.'/'.$relative;
96 return common_path('theme/'.$theme.'/skin/'.$skin.'/'.$relative);