diff options
author | Hubzilla <hubzilla@hz.macgirvin.com> | 2017-01-20 15:42:15 -0800 |
---|---|---|
committer | Hubzilla <hubzilla@hz.macgirvin.com> | 2017-01-20 15:42:15 -0800 |
commit | bb233a98727a787f1ad77714564e437544192fce (patch) | |
tree | c05d3998ebb0e8960359858c6f315976558f6be1 /Zotlabs | |
parent | 9acd3ebd42733cc089cf2192451617e0b05a0fbc (diff) | |
download | volse-hubzilla-bb233a98727a787f1ad77714564e437544192fce.tar.gz volse-hubzilla-bb233a98727a787f1ad77714564e437544192fce.tar.bz2 volse-hubzilla-bb233a98727a787f1ad77714564e437544192fce.zip |
add bbcode language conditionals to wiki
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/NativeWikiPage.php | 50 | ||||
-rw-r--r-- | Zotlabs/Module/Wiki.php | 8 |
2 files changed, 33 insertions, 25 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index aa1510da8..0c3698519 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -539,30 +539,36 @@ class NativeWikiPage { */ static public function bbcode($s) { - $s = str_replace(array('[baseurl]', '[sitename]'), array(z_root(), get_config('system', 'sitename')), $s); + $s = str_replace(array('[baseurl]', '[sitename]'), array(z_root(), get_config('system', 'sitename')), $s); - $observer = \App::get_observer(); - if ($observer) { - $s1 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">'; - $s2 = '</span>'; - $obsBaseURL = $observer['xchan_connurl']; - $obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL); - $s = str_replace('[observer.baseurl]', $obsBaseURL, $s); - $s = str_replace('[observer.url]', $observer['xchan_url'], $s); - $s = str_replace('[observer.name]', $s1 . $observer['xchan_name'] . $s2, $s); - $s = str_replace('[observer.address]', $s1 . $observer['xchan_addr'] . $s2, $s); - $s = str_replace('[observer.webname]', substr($observer['xchan_addr'], 0, strpos($observer['xchan_addr'], '@')), $s); - $s = str_replace('[observer.photo]', '', $s); - } else { - $s = str_replace('[observer.baseurl]', '', $s); - $s = str_replace('[observer.url]', '', $s); - $s = str_replace('[observer.name]', '', $s); - $s = str_replace('[observer.address]', '', $s); - $s = str_replace('[observer.webname]', '', $s); - $s = str_replace('[observer.photo]', '', $s); - } + $s = preg_replace_callback("/\[observer\.language\=(.*?)\](.*?)\[\/observer\]/ism",'oblanguage_callback', $s); + + $s = preg_replace_callback("/\[observer\.language\!\=(.*?)\](.*?)\[\/observer\]/ism",'oblanguage_necallback', $s); + + + $observer = \App::get_observer(); + if ($observer) { + $s1 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">'; + $s2 = '</span>'; + $obsBaseURL = $observer['xchan_connurl']; + $obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL); + $s = str_replace('[observer.baseurl]', $obsBaseURL, $s); + $s = str_replace('[observer.url]', $observer['xchan_url'], $s); + $s = str_replace('[observer.name]', $s1 . $observer['xchan_name'] . $s2, $s); + $s = str_replace('[observer.address]', $s1 . $observer['xchan_addr'] . $s2, $s); + $s = str_replace('[observer.webname]', substr($observer['xchan_addr'], 0, strpos($observer['xchan_addr'], '@')), $s); + $s = str_replace('[observer.photo]', '', $s); + } + else { + $s = str_replace('[observer.baseurl]', '', $s); + $s = str_replace('[observer.url]', '', $s); + $s = str_replace('[observer.name]', '', $s); + $s = str_replace('[observer.address]', '', $s); + $s = str_replace('[observer.webname]', '', $s); + $s = str_replace('[observer.photo]', '', $s); + } - return $s; + return $s; } static public function get_file_ext($arr) { diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 20a5eb35f..746ad9b4f 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -4,6 +4,11 @@ namespace Zotlabs\Module; use \Zotlabs\Lib as Zlib; +require_once('include/acl_selectors.php'); +require_once('include/conversation.php'); +require_once('include/bbcode.php'); + + class Wiki extends \Zotlabs\Web\Controller { private $wiki = null; @@ -39,9 +44,6 @@ class Wiki extends \Zotlabs\Web\Controller { return; } - require_once('include/acl_selectors.php'); - require_once('include/conversation.php'); - require_once('include/bbcode.php'); // TODO: Combine the interface configuration into a unified object // Something like $interface = array('new_page_button' => false, 'new_wiki_button' => false, ...) |