$filename = null;
- foreach ($paths as $path) {
+ if (Event::handle('StartDocFileForTitle', array($title, &$paths, &$filename))) {
- $def = $path.'/'.$title;
+ foreach ($paths as $path) {
- if (!file_exists($def)) {
- $def = null;
- }
+ $def = $path.'/'.$title;
- $lang = glob($path.'/'.$title.'.*');
+ if (!file_exists($def)) {
+ $def = null;
+ }
- if ($lang === false) {
- $lang = array();
- }
+ $lang = glob($path.'/'.$title.'.*');
- if (!empty($lang) || !empty($def)) {
- $filename = self::negotiateLanguage($lang, $def);
- break;
+ if ($lang === false) {
+ $lang = array();
+ }
+
+ if (!empty($lang) || !empty($def)) {
+ $filename = self::negotiateLanguage($lang, $def);
+ break;
+ }
}
+
+ Event::handle('EndDocFileForTitle', array($title, $paths, &$filename));
}
if (empty($filename)) {
}
}
- function toHTML()
+ function toHTML($args=null)
{
+ if (is_null($args)) {
+ $args = array();
+ }
+
if (empty($this->contents)) {
$this->contents = file_get_contents($this->filename);
}
- return common_markup_to_html($this->contents);
+ return common_markup_to_html($this->contents, $args);
}
static function defaultPaths()
$paths = array(INSTALLDIR.'/local/doc-src/',
INSTALLDIR.'/doc-src/');
- $site = StatusNet::currentSite();
+ $site = GNUsocial::currentSite();
if (!empty($site)) {
array_unshift($paths, INSTALLDIR.'/local/doc-src/'.$site.'/');
return $paths;
}
+ static function mailPaths()
+ {
+ $paths = array(INSTALLDIR.'/local/mail-src/',
+ INSTALLDIR.'/mail-src/');
+
+ $site = GNUsocial::currentSite();
+
+ if (!empty($site)) {
+ array_unshift($paths, INSTALLDIR.'/local/mail-src/'.$site.'/');
+ }
+
+ return $paths;
+ }
+
static function negotiateLanguage($filenames, $defaultFilename=null)
{
// XXX: do this better