removed a bunch of functions which were deprecated in 2005/2006

This commit is contained in:
Anika Henke 2013-02-18 01:08:40 +00:00
parent eda319e666
commit c33b315b06
7 changed files with 16 additions and 308 deletions

View File

@ -49,6 +49,7 @@ class DokuWiki_Sniffs_PHP_DeprecatedFunctionsSniff extends Generic_Sniffs_PHP_Fo
'search_fulltext' => 'Fulltext Indexer',
'search_regex' => 'Fulltext Indexer',
'tpl_getFavicon' => 'tpl_getMediaFile',
'p_cached_xhtml' => 'p_cached_output',
);
/**

View File

@ -1174,27 +1174,6 @@ function getGoogleQuery() {
return $q;
}
/**
* Try to set correct locale
*
* @deprecated No longer used
* @author Andreas Gohr <andi@splitbrain.org>
*/
function setCorrectLocale() {
global $conf;
global $lang;
$enc = strtoupper($lang['encoding']);
foreach($lang['locales'] as $loc) {
//try locale
if(@setlocale(LC_ALL, $loc)) return;
//try loceale with encoding
if(@setlocale(LC_ALL, "$loc.$enc")) return;
}
//still here? try to set from environment
@setlocale(LC_ALL, "");
}
/**
* Return the human readable size of a file
*

View File

@ -529,25 +529,6 @@ function io_rename($from,$to){
return true;
}
/**
* Runs an external command and returns its output as string
*
* @author Harry Brueckner <harry_b@eml.cc>
* @author Andreas Gohr <andi@splitbrain.org>
* @deprecated
*/
function io_runcmd($cmd){
$fh = popen($cmd, "r");
if(!$fh) return false;
$ret = '';
while (!feof($fh)) {
$ret .= fread($fh, 8192);
}
pclose($fh);
return $ret;
}
/**
* Runs an external command with input and output pipes.
* Returns the exit code from the process.

View File

@ -85,67 +85,6 @@ function p_wiki_xhtml($id, $rev='', $excuse=true){
return $ret;
}
/**
* Returns starting summary for a page (e.g. the first few
* paragraphs), marked up in XHTML.
*
* If $excuse is true an explanation is returned if the file
* wasn't found
*
* @param string $id wiki page id
* @param string $title populated with page title from heading or page id
* @param string $rev revision string
* @param bool $excuse if an excuse shall be renderer when no content is found
* @return string xhtml code
* @deprecated
* @author Harry Fuecks <hfuecks@gmail.com>
*/
function p_wiki_xhtml_summary($id, &$title, $rev='', $excuse=true){
$file = wikiFN($id,$rev);
$ret = '';
$ins = null;
//ensure $id is in global $ID (needed for parsing)
global $ID;
$keep = $ID;
$ID = $id;
if($rev){
if(@file_exists($file)){
//no caching on old revisions
$ins = p_get_instructions(io_readWikiPage($file,$id,$rev));
}elseif($excuse){
$ret = p_locale_xhtml('norev');
//restore ID (just in case)
$ID = $keep;
return $ret;
}
}else{
if(@file_exists($file)){
// The XHTML for a summary is not cached so use the instruction cache
$ins = p_cached_instructions($file);
}elseif($excuse){
$ret = p_locale_xhtml('newpage');
//restore ID (just in case)
$ID = $keep;
return $ret;
}
}
$ret = p_render('xhtmlsummary',$ins,$info);
if ( $info['sum_pagetitle'] ) {
$title = $info['sum_pagetitle'];
} else {
$title = $id;
}
$ID = $keep;
return $ret;
}
/**
* Returns the specified local text in parsed format
*
@ -157,23 +96,6 @@ function p_locale_xhtml($id){
return $html;
}
/**
* *** DEPRECATED ***
*
* use p_cached_output()
*
* Returns the given file parsed to XHTML
*
* Uses and creates a cachefile
*
* @deprecated
* @author Andreas Gohr <andi@splitbrain.org>
* @todo rewrite to use mode instead of hardcoded XHTML
*/
function p_cached_xhtml($file){
return p_cached_output($file);
}
/**
* Returns the given file parsed into the requested output format
*

View File

@ -258,11 +258,4 @@ class DokuWiki_Plugin {
function isSingleton() {
return true;
}
// deprecated functions
function plugin_localFN($id) { return $this->localFN($id); }
function plugin_locale_xhtml($id) { return $this->locale_xhtml($id); }
function plugin_email($e, $n='', $c='', $m='') { return $this->email($e, $n, $c, $m); }
function plugin_link($l, $t='', $c='', $to='', $m='') { return $this->external_link($l, $t, $c, $to, $m); }
function plugin_render($t, $f='xhtml') { return $this->render($t, $f); }
}

View File

@ -61,15 +61,6 @@ function search(&$data,$base,$func,$opts,$dir='',$lvl=1,$sort='natural'){
}
}
/**
* Wrapper around call_user_func_array.
*
* @deprecated
*/
function search_callback($func,&$data,$base,$file,$type,$lvl,$opts){
return call_user_func_array($func, array(&$data,$base,$file,$type,$lvl,$opts));
}
/**
* The following functions are userfunctions to use with the search
* function above. This function is called for every found file or
@ -283,125 +274,25 @@ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){
}
/**
* Search for backlinks to a given page
* Reference search
* This fuction searches for existing references to a given media file
* and returns an array with the found pages. It doesn't pay any
* attention to ACL permissions to find every reference. The caller
* must check if the user has the appropriate rights to see the found
* page and eventually have to prevent the result from displaying.
*
* $opts['ns'] namespace of the page
* $opts['name'] name of the page without namespace
* @param array $data Reference to the result data structure
* @param string $base Base usually $conf['datadir']
* @param string $file current file or directory relative to $base
* @param char $type Type either 'd' for directory or 'f' for file
* @param int $lvl Current recursion depht
* @param mixed $opts option array as given to search()
*
* $opts['query'] is the demanded media file name
*
* @author Andreas Gohr <andi@splitbrain.org>
* @deprecated Replaced by ft_backlinks()
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*/
function search_backlinks(&$data,$base,$file,$type,$lvl,$opts){
//we do nothing with directories
if($type == 'd') return true;
//only search txt files
if(substr($file,-4) != '.txt') return true;
//absolute search id
$sid = cleanID($opts['ns'].':'.$opts['name']);
//current id and namespace
$cid = pathID($file);
$cns = getNS($cid);
//check ACL
if(auth_quickaclcheck($cid) < AUTH_READ){
return false;
}
//fetch instructions
$instructions = p_cached_instructions($base.$file,true);
if(is_null($instructions)) return false;
global $conf;
//check all links for match
foreach($instructions as $ins){
if($ins[0] == 'internallink' || ($conf['camelcase'] && $ins[0] == 'camelcaselink') ){
$mid = $ins[1][0];
resolve_pageid($cns,$mid,$exists); //exists is not used
if($mid == $sid){
//we have a match - finish
$data[]['id'] = $cid;
break;
}
}
}
return false;
}
/**
* Fulltextsearch
*
* $opts['query'] is the search query
*
* @author Andreas Gohr <andi@splitbrain.org>
* @deprecated - fulltext indexer is used instead
*/
function search_fulltext(&$data,$base,$file,$type,$lvl,$opts){
//we do nothing with directories
if($type == 'd') return true;
//only search txt files
if(substr($file,-4) != '.txt') return true;
//check ACL
$id = pathID($file);
if(auth_quickaclcheck($id) < AUTH_READ){
return false;
}
//create regexp from queries
$poswords = array();
$negwords = array();
$qpreg = preg_split('/\s+/',$opts['query']);
foreach($qpreg as $word){
switch(substr($word,0,1)){
case '-':
if(strlen($word) > 1){ // catch single '-'
array_push($negwords,preg_quote(substr($word,1),'#'));
}
break;
case '+':
if(strlen($word) > 1){ // catch single '+'
array_push($poswords,preg_quote(substr($word,1),'#'));
}
break;
default:
array_push($poswords,preg_quote($word,'#'));
break;
}
}
// a search without any posword is useless
if (!count($poswords)) return true;
$reg = '^(?=.*?'.join(')(?=.*?',$poswords).')';
$reg .= count($negwords) ? '((?!'.join('|',$negwords).').)*$' : '.*$';
search_regex($data,$base,$file,$reg,$poswords);
return true;
}
/**
* Reference search
* This fuction searches for existing references to a given media file
* and returns an array with the found pages. It doesn't pay any
* attention to ACL permissions to find every reference. The caller
* must check if the user has the appropriate rights to see the found
* page and eventually have to prevent the result from displaying.
*
* @param array $data Reference to the result data structure
* @param string $base Base usually $conf['datadir']
* @param string $file current file or directory relative to $base
* @param char $type Type either 'd' for directory or 'f' for file
* @param int $lvl Current recursion depht
* @param mixed $opts option array as given to search()
*
* $opts['query'] is the demanded media file name
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*/
function search_reference(&$data,$base,$file,$type,$lvl,$opts){
global $conf;
@ -423,57 +314,6 @@ function search_reference(&$data,$base,$file,$type,$lvl,$opts){
/* ------------- helper functions below -------------- */
/**
* fulltext search helper
* searches a text file with a given regular expression
* no ACL checks are performed. This have to be done by
* the caller if necessary.
*
* @param array $data reference to array for results
* @param string $base base directory
* @param string $file file name to search in
* @param string $reg regular expression to search for
* @param array $words words that should be marked in the results
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*
* @deprecated - fulltext indexer is used instead
*/
function search_regex(&$data,$base,$file,$reg,$words){
//get text
$text = io_readfile($base.'/'.$file);
//lowercase text (u modifier does not help with case)
$lctext = utf8_strtolower($text);
//do the fulltext search
$matches = array();
if($cnt = preg_match_all('#'.$reg.'#usi',$lctext,$matches)){
//this is not the best way for snippet generation but the fastest I could find
$q = $words[0]; //use first word for snippet creation
$p = utf8_strpos($lctext,$q);
$f = $p - 100;
$l = utf8_strlen($q) + 200;
if($f < 0) $f = 0;
$snippet = '<span class="search_sep"> ... </span>'.
htmlspecialchars(utf8_substr($text,$f,$l)).
'<span class="search_sep"> ... </span>';
$mark = '('.join('|', $words).')';
$snippet = preg_replace('#'.$mark.'#si','<strong class="search_hit">\\1</strong>',$snippet);
$data[] = array(
'id' => pathID($file),
'count' => preg_match_all('#'.$mark.'#usi',$lctext,$matches),
'poswords' => join(' ',$words),
'snippet' => $snippet,
);
}
return true;
}
/**
* fulltext sort
*

View File

@ -70,14 +70,6 @@ $config['varname'] = 'conf'; // name of the config variable, sans $
// this value can be overriden when calling save_settings() method
$config['heading'] = 'Dokuwiki\'s Main Configuration File - Local Settings';
/* DEPRECATED
// ---------------[ setting files ]--------------------------------------
// these values can be string expressions, they will be eval'd before use
$file['local'] = "DOKU_CONF.'local.php'"; // mandatory (file doesn't have to exist)
$file['default'] = "DOKU_CONF.'dokuwiki.php'"; // optional
$file['protected'] = "DOKU_CONF.'local.protected.php'"; // optional
*/
// test value (FIXME, remove before publishing)
//$meta['test'] = array('multichoice','_choices' => array(''));