Skip to content
Permalink
Browse files

use getConf() to access configuration options / added en language files

  • Loading branch information...
samuelet authored and lupo49 committed Aug 6, 2011
1 parent f9cac3c commit 92fe4375986a10950d21c8cda0f226da24f0bb9a
Showing with 52 additions and 32 deletions.
  1. +11 −0 conf/default.php
  2. +11 −0 conf/metadata.php
  3. +11 −0 lang/en/settings.php
  4. +19 −32 syntax.php
@@ -0,0 +1,11 @@
<?php
$conf['numerical_index'] = '0-9';
$conf['articles_deletion'] = '';
$conf['articles_moving'] = 1;
$conf['empty_msg'] = 'No index for <b>{{ns}}</b>';
$conf['title_tpl'] = '===== Index =====';
$conf['begin_letter_tpl'] = '==== {{letter}} ====';
$conf['entry_tpl'] = ' * [[{{link}}|{{name}}]]';
$conf['end_letter_tpl'] = '';
$conf['hidepages'] = '';
$conf['metadata_title'] = 0;
@@ -0,0 +1,11 @@
<?php
$meta['numerical_index'] = array('string');
$meta['articles_deletion'] = array('string');
$meta['articles_moving'] = array('multichoice', '_choices' => array('0', '1' ,'2'));
$meta['empty_msg'] = array('string');
$meta['title_tpl'] = array('string');
$meta['begin_letter_tpl'] = array('string');
$meta['entry_tpl'] = array('string');
$meta['end_letter_tpl'] = array('string');
$meta['hidepages'] = array('string');
$meta['metadata_title'] = array('onoff');
@@ -0,0 +1,11 @@
<?php
$lang['numerical_index'] = 'Text display in block letter title for the page title beginning with a numerical value.';
$lang['articles_deletion'] = "List of article treated by the plugin. Each article is separated with a '|'. Example: <strong>^the +|^a +|^an +</strong>";
$lang['articles_moving'] = 'Management of the articles when the article_deletion option is active:<ul><li>0 : No change</li><li>1 : The article is move to the end of the page name inside brackets</li><li>2 or more : The article is deleted</li></ul>';
$lang['empty_msg'] = 'Message shown in your page when the index is empty.<br>Note : {{ns}} is an alias for the requested namespace.';
$lang['title_tpl'] = 'Template (in dokuwiki syntax) for the index title.';
$lang['begin_letter_tpl'] = "Template (in dokuwiki syntax) at the beginning of each letter's blok.<br>Note : the {{letter}} pattern is mandatory. It's an alias for the current letter.";
$lang['entry_tpl'] = "Template (in dokuwiki syntax) for each letter's entry.<br>Note : the {{link}} and {{name}} patterns are mandatory.They are aliases for the page link and the page name.";
$lang['end_letter_tpl'] = "Template (in dokuwiki syntax) at the end of each letter's block.";
$lang['hidepages'] = "Name of pages not displayed in the index. Each page name is separated with a '|'.";
$lang['metadata_title'] = "Use first heading for pagenames";
@@ -7,22 +7,9 @@
* last modified: 2006-06-14 12:00:00
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Hubert Molière <hubert.moliere@alternet.fr>
*/
/**
* Configuration additionnelle sp�cifique au plugin
*
* - $conf['plugin']['alphaindex']['numerical_index']
* - $conf['plugin']['alphaindex']['articles_deletion']
* - $conf['plugin']['alphaindex']['articles_moving']
* - $conf['plugin']['alphaindex']['empty_msg']
* - $conf['plugin']['alphaindex']['title_tpl']
* - $conf['plugin']['alphaindex']['begin_letter_tpl']
* - $conf['plugin']['alphaindex']['entry_tpl']
* - $conf['plugin']['alphaindex']['end_letter_tpl']
* - $conf['plugin']['alphaindex']['hidepages']
* - $conf['plugin']['alphaindex']['metadata_title'] (true/false)
*
* Modified by Nicolas H. <prog@a-et-n.com>
* Modified by Jonesy <jonesy@oryma.org>
* Modified by Samuele Tognini <samuele@netsons.org>
*/
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
@@ -94,12 +81,12 @@ function handle($match, $state, $pos, &$handler){
*/
function render($mode, &$renderer, $data) {
global $conf;
if($mode == 'xhtml'){
$alpha_data = $this->_alpha_index($data, $renderer);
if ((!@$n)) {
if (isset ($conf['plugin']['']['empty_msg'])) {
$n = $conf['plugin_alphaindex']['empty_msg'];
if ($this->getConf('empty_msg')) {
$n = $this->getConf('empty_msg');
} else {
$n = 'No index for <b>{{ns}}</b>';
}
@@ -145,40 +132,40 @@ function _alpha_index($myns, &$renderer) {
// Articles deletion configuration
$articlesDeletionPatterns = array();
if(isset($conf['plugin']['alphaindex']['articles_deletion'])) {
$articlesDeletionPatterns = explode('|', $conf['plugin']['alphaindex']['articles_deletion']);
if($this->getConf('articles_deletion')) {
$articlesDeletionPatterns = explode('|', $this->getConf('articles_deletion'));
$articlesDeletion = true;
} else {
$articlesDeletion = false;
}
// Hide pages configuration
$hidepages = array();
if(isset($conf['plugin']['alphaindex']['hidepages'])) {
$hidepages = explode('|', $conf['plugin']['alphaindex']['hidepages']);
if($this->getConf('hidepages')) {
$hidepages = explode('|', $this->getConf('hidepages'));
}
// template configuration
if(isset($conf['plugin']['alphaindex']['title_tpl'])) {
$titleTpl = $conf['plugin']['alphaindex']['title_tpl'];
if($this->getConf('title_tpl')) {
$titleTpl = $this->getConf('title_tpl');
} else {
$titleTpl = '===== Index =====';
}
if(isset($conf['plugin']['alphaindex']['begin_letter_tpl'])) {
$beginLetterTpl = $conf['plugin']['alphaindex']['begin_letter_tpl'];
if($this->getConf('begin_letter_tpl')) {
$beginLetterTpl = $this->getConf('begin_letter_tpl');
} else {
$beginLetterTpl = '==== {{letter}} ====';
}
if(isset($conf['plugin']['alphaindex']['entry_tpl'])) {
$entryTpl = $conf['plugin']['alphaindex']['entry_tpl'];
if($this->getConf('entry_tpl')) {
$entryTpl = $this->getConf('entry_tpl');
} else {
$entryTpl = ' * [[{{link}}|{{name}}]]';
}
if(isset($conf['plugin']['alphaindex']['end_letter_tpl'])) {
$endLetterTpl = $conf['plugin']['alphaindex']['end_letter_tpl'];
if($this->getConf('end_letter_tpl')) {
$endLetterTpl = $this->getConf('end_letter_tpl');
} else {
$endLetterTpl = '';
}
@@ -238,7 +225,7 @@ function _alpha_index($myns, &$renderer) {
}
// Fix for useheading - Decide if the heading is used or the pagename
if(isset($conf['plugin']['alphaindex']['metadata_title'])) {
if($this->getConf('metadata_title')) {
$tmp = p_get_metadata($data[$cpt]['id']);
if(isset($tmp['title'])) $pageName = $tmp['title'];
}

0 comments on commit 92fe437

Please sign in to comment.
You can’t perform that action at this time.