Browse Source

use new core functionalities where possible and deprecated old fallbacks

master
Anika Henke 12 years ago
parent
commit
8dc924f7fe
  1. 4
      conf/default.php
  2. 4
      conf/metadata.php
  3. 2
      lang/en/lang.php
  4. 4
      lang/en/settings.php
  5. 16
      main.php
  6. 46
      tpl_functions.php

4
conf/default.php

@ -4,8 +4,8 @@
* *
*/ */
$conf['tagline'] = 'This is the tagline - explaining what this site is about.';
$conf['discussionPage'] = 'discussion:@ID@'; $conf['discussionPage'] = 'discussion:@ID@';
$conf['userPage'] = 'user:@USER@:'; $conf['userPage'] = 'user:@USER@:';
$conf['sidebarID'] = 'sidebar';
$conf['hideTools'] = 0; $conf['hideTools'] = 0;
$conf['tagline'] = 'This is the tagline - explaining what this site is about.';
$conf['sidebarID'] = 'sidebar';

4
conf/metadata.php

@ -4,8 +4,8 @@
* *
*/ */
$meta['tagline'] = array('string');
$meta['discussionPage'] = array('string'); $meta['discussionPage'] = array('string');
$meta['userPage'] = array('string'); $meta['userPage'] = array('string');
$meta['sidebarID'] = array('string');
$meta['hideTools'] = array('onoff'); $meta['hideTools'] = array('onoff');
$meta['tagline'] = array('string');
$meta['sidebarID'] = array('string');

2
lang/en/lang.php

@ -8,7 +8,7 @@ $lang['discussion'] = 'Discussion';
$lang['back_to_article'] = 'Back to article'; $lang['back_to_article'] = 'Back to article';
$lang['userpage'] = 'User page'; $lang['userpage'] = 'User page';
/* accessibility headlines */
/* accessibility headlines (deprecated and superseded by core since Adora Belle) */
$lang['user_tools'] = 'User Tools'; $lang['user_tools'] = 'User Tools';
$lang['site_tools'] = 'Site Tools'; $lang['site_tools'] = 'Site Tools';
$lang['page_tools'] = 'Page Tools'; $lang['page_tools'] = 'Page Tools';

4
lang/en/settings.php

@ -4,8 +4,8 @@
* *
*/ */
$lang['tagline'] = 'Tagline';
$lang['discussionPage'] = 'Discussion page (leave empty to disable discussions)'; $lang['discussionPage'] = 'Discussion page (leave empty to disable discussions)';
$lang['userPage'] = 'User page (leave empty to disable user pages)'; $lang['userPage'] = 'User page (leave empty to disable user pages)';
$lang['sidebarID'] = 'page name of page included in sidebar';
$lang['hideTools'] = 'Hide tools when not logged in?'; $lang['hideTools'] = 'Hide tools when not logged in?';
$lang['tagline'] = 'Tagline (<strong>deprecated</strong>, use core &quot;tagline&quot; setting since Adora Belle)';
$lang['sidebarID'] = 'page name of page included in sidebar (<strong>deprecated</strong>, use core &quot;sidebar&quot; setting since Adora Belle)';

16
main.php

@ -47,12 +47,12 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<?php /* how to insert logo instead (if no CSS image replacement technique is used): <?php /* how to insert logo instead (if no CSS image replacement technique is used):
upload your logo into the data/media folder (root of the media manager) and replace 'logo.png' accordingly: upload your logo into the data/media folder (root of the media manager) and replace 'logo.png' accordingly:
tpl_link(wl(),'<img src="'.ml('logo.png').'" alt="'.$conf['title'].'" />','id="dokuwiki__top" accesskey="h" title="[H]"') */ ?> tpl_link(wl(),'<img src="'.ml('logo.png').'" alt="'.$conf['title'].'" />','id="dokuwiki__top" accesskey="h" title="[H]"') */ ?>
<?php if (tpl_getConf('tagline')): ?>
<p class="claim"><?php echo tpl_getConf('tagline') ?></p>
<?php if ($conf['tagline']): ?>
<p class="claim"><?php echo $conf['tagline'] ?></p>
<?php endif ?> <?php endif ?>
<ul class="a11y"> <ul class="a11y">
<li><a href="#dokuwiki__content"><?php echo tpl_getLang('skip_to_content') ?></a></li>
<li><a href="#dokuwiki__content"><?php echo $lang['skip_to_content'] ?></a></li>
</ul> </ul>
<div class="clearer"></div> <div class="clearer"></div>
</div> </div>
@ -61,7 +61,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<!-- USER TOOLS --> <!-- USER TOOLS -->
<?php if ($conf['useacl'] && $showTools): ?> <?php if ($conf['useacl'] && $showTools): ?>
<div id="dokuwiki__usertools"> <div id="dokuwiki__usertools">
<h3 class="a11y"><?php echo tpl_getLang('user_tools') ?></h3>
<h3 class="a11y"><?php echo $lang['user_tools'] ?></h3>
<ul> <ul>
<?php /* the optional second parameter of tpl_action() switches between a link and a button, <?php /* the optional second parameter of tpl_action() switches between a link and a button,
e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */ e.g. a button inside a <li> would be: tpl_action('edit', 0, 'li') */
@ -73,7 +73,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
tpl_action('admin', 1, 'li'); tpl_action('admin', 1, 'li');
_tpl_action('userpage', 1, 'li'); _tpl_action('userpage', 1, 'li');
tpl_action('profile', 1, 'li'); tpl_action('profile', 1, 'li');
_tpl_action('register', 1, 'li'); /* DW versions > 2011-02-20 can use the core function tpl_action('register', 1, 'li') */
tpl_action('register', 1, 'li'); /* DW versions < 2011-02-20 need to use _tpl_action('register', 1, 'li') */
tpl_action('login', 1, 'li'); tpl_action('login', 1, 'li');
?> ?>
</ul> </ul>
@ -82,7 +82,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<!-- SITE TOOLS --> <!-- SITE TOOLS -->
<div id="dokuwiki__sitetools"> <div id="dokuwiki__sitetools">
<h3 class="a11y"><?php echo tpl_getLang('site_tools') ?></h3>
<h3 class="a11y"><?php echo $lang['site_tools'] ?></h3>
<?php tpl_searchform() ?> <?php tpl_searchform() ?>
<ul> <ul>
<?php <?php
@ -113,7 +113,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<!-- ********** ASIDE ********** --> <!-- ********** ASIDE ********** -->
<div id="dokuwiki__aside"><div class="pad include"> <div id="dokuwiki__aside"><div class="pad include">
<?php tpl_include_page(tpl_getConf('sidebarID')) /* includes the given wiki page */ ?>
<?php tpl_sidebar() /* includes the nearest sidebar page */ ?>
<div class="clearer"></div> <div class="clearer"></div>
</div></div><!-- /aside --> </div></div><!-- /aside -->
@ -139,7 +139,7 @@ $showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && $_SERVER
<!-- PAGE ACTIONS --> <!-- PAGE ACTIONS -->
<?php if ($showTools): ?> <?php if ($showTools): ?>
<div id="dokuwiki__pagetools"> <div id="dokuwiki__pagetools">
<h3 class="a11y"><?php echo tpl_getLang('page_tools') ?></h3>
<h3 class="a11y"><?php echo $lang['page_tools'] ?></h3>
<ul> <ul>
<?php <?php
tpl_action('edit', 1, 'li'); tpl_action('edit', 1, 'li');

46
tpl_functions.php

@ -64,7 +64,7 @@ function _tpl_userpage($userPage,$title,$link=0,$wrapper=0) {
/** /**
* Create link/button to register page * Create link/button to register page
* DW versions > 2011-02-20 can use the core function tpl_action('register')
* @deprecated DW versions > 2011-02-20 can use the core function tpl_action('register')
* *
* @author Anika Henke <anika@selfthinker.org> * @author Anika Henke <anika@selfthinker.org>
*/ */
@ -103,15 +103,22 @@ function _tpl_action($type,$link=0,$wrapper=0) {
_tpl_userpage(tpl_getConf('userPage'), tpl_getLang('userpage'), $link, $wrapper); _tpl_userpage(tpl_getConf('userPage'), tpl_getLang('userpage'), $link, $wrapper);
} }
break; break;
case 'register':
case 'register': // deprecated
_tpl_register($link, $wrapper); _tpl_register($link, $wrapper);
break; break;
} }
} }
/* deprecated functions for backwards compatibility
********************************************************************/
/** /**
* Returns icon from data/media root directory if it exists, otherwise * Returns icon from data/media root directory if it exists, otherwise
* the one in the template's image directory. * the one in the template's image directory.
* @deprecated superseded by core tpl_getFavicon()
* *
* @param bool $abs - if to use absolute URL * @param bool $abs - if to use absolute URL
* @param string $fileName - file name of icon * @param string $fileName - file name of icon
@ -138,6 +145,7 @@ if (!function_exists('tpl_getFavicon')) {
/** /**
* Returns <link> tag for various icon types (favicon|mobile|generic) * Returns <link> tag for various icon types (favicon|mobile|generic)
* @deprecated superseded by core tpl_favicon()
* *
* @param array $types - list of icon types to display (favicon|mobile|generic) * @param array $types - list of icon types to display (favicon|mobile|generic)
* @author Anika Henke <anika@selfthinker.org> * @author Anika Henke <anika@selfthinker.org>
@ -175,6 +183,7 @@ if (!function_exists('tpl_favicon')) {
/** /**
* Include additional html file from conf directory if it exists, otherwise use * Include additional html file from conf directory if it exists, otherwise use
* file in the template's root directory. * file in the template's root directory.
* @deprecated superseded by core tpl_includeFile()
* *
* @author Anika Henke <anika@selfthinker.org> * @author Anika Henke <anika@selfthinker.org>
*/ */
@ -194,3 +203,36 @@ if (!function_exists('tpl_includeFile')) {
_tpl_include($fn); _tpl_include($fn);
} }
} }
/* if newer settings exist in the core, use them, otherwise fall back to template settings */
if (!isset($conf['tagline'])) {
$conf['tagline'] = tpl_getConf('tagline');
}
if (!isset($conf['sidebar'])) {
$conf['sidebar'] = tpl_getConf('sidebarID');
}
if (!function_exists('tpl_sidebar')) {
function tpl_sidebar() {
/* includes the given wiki page; not exactly the same as in the core */
tpl_include_page($conf['sidebar']);
}
}
/* these $lang strings are now in the core */
if (!isset($lang['user_tools'])) {
$lang['user_tools'] = tpl_getLang('user_tools');
}
if (!isset($lang['site_tools'])) {
$lang['site_tools'] = tpl_getLang('site_tools');
}
if (!isset($lang['page_tools'])) {
$lang['page_tools'] = tpl_getLang('page_tools');
}
if (!isset($lang['skip_to_content'])) {
$lang['skip_to_content'] = tpl_getLang('skip_to_content');
}
Loading…
Cancel
Save