./doku.php ./inc/actions.php ./inc/html.php ./inc/parser/xhtml.php
//Add for anchor)./doku.php: [...] //import variables $QUERY = trim($_REQUEST['id']); $ID = getID(); $NS = getNS($ID); $REV = $_REQUEST['rev']; $ACT = $_REQUEST['do']; $IDX = $_REQUEST['idx']; $DATE = $_REQUEST['date']; $RANGE = $_REQUEST['lines']; $HIGH = $_REQUEST['s']; //Add for anchor $ANCHOR=$_REQUEST['anchor']; //End add if(empty($HIGH)) $HIGH = getGoogleQuery(); [...]
./inc/actions.php: [...] function act_save($act){ global $ID; global $DATE; global $PRE; global $TEXT; global $SUF; global $SUM; //Add for anchor global $ANCHOR; //End add //spam check if(checkwordblock()) return 'wordblock'; //conflict check //FIXME use INFO if($DATE != 0 && @filemtime(wikiFN($ID)) > $DATE ) return 'conflict'; //save it saveWikiText($ID,con($PRE,$TEXT,$SUF,1),$SUM,$_REQUEST['minor']); //use pretty mode for con //unlock it unlock($ID); //delete draft act_draftdel($act); //show it session_write_close(); //Add for anchor //header("Location: ".wl($ID,'',true)); if ($ANCHOR) header("Location: ".wl($ID,'',true)."#$ANCHOR"); else header("Location: ".wl($ID,'',true)); //End add exit(); } [...]
./inc/html.php: [...] function html_secedit_button($matches){ global $ID; global $INFO; $section = $matches[2]; $name = $matches[1]; //Add for anchor $anchor = $matches[3]; //End add $secedit = ''; $secedit .= '<div class="secedit">'; //Add for anchor //$secedit .= html_btn('secedit',$ID,'', // array('do' => 'edit', // 'lines' => "$section", // 'rev' => $INFO['lastmod']), // 'post', $name); $secedit .= html_btn('secedit',$ID,'', array('do' => 'edit', 'lines' => "$section", 'rev' => $INFO['lastmod'], 'anchor' => $anchor), 'post', $name); //End add $secedit .= '</div>'; return $secedit; } [...] function html_secedit($text,$show=true){ global $INFO; if($INFO['writable'] && $show && !$INFO['rev']){ //Add for anchor //$text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#', $text2 = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] \#(.*?) -->#', 'html_secedit_button', $text); if ($text2==$text) $text2 = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#', 'html_secedit_button', $text); $text=&$text2; //End add }else{ //Add for anchor //$text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text); $text2 = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] \#(.*?) -->#','',$text); if ($text2==$text) $text2 = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text); $text=&$text2; //End add } return $text; } [...] function html_edit($text=null,$include='edit'){ //FIXME: include needed? global $ID; global $REV; global $DATE; global $RANGE; global $PRE; global $SUF; global $INFO; global $SUM; global $lang; global $conf; //Add for anchor global $ANCHOR; //End add [...] $form = new Doku_Form('dw__editform'); $form->addHidden('id', $ID); $form->addHidden('rev', $REV); $form->addHidden('date', $DATE); $form->addHidden('prefix', $PRE); $form->addHidden('suffix', $SUF); $form->addHidden('changecheck', $check); //Add for anchor $form->addHidden('anchor', $ANCHOR); //End add [...]
./inc/parser/xhtml.php: [...] var $_counter = array(); // used as global counter, introduced for table classes //Add for anchor var $HID=""; //End add [...] function header($text, $level, $pos) { //Add for anchor global $HID; //End add $hid = $this->_headerToLink($text,true); //Add for anchor $HID=$hid; //End add //only add items within configured levels $this->toc_additem($hid, $text, $level); // write the header $this->doc .= DOKU_LF.'<h'.$level.'><a name="'.$hid.'" id="'.$hid.'">'; $this->doc .= $this->_xmlEntities($text); $this->doc .= "</a></h$level>".DOKU_LF; } [...] function section_edit($start, $end, $level, $name) { global $conf; //Add for anchor global $HID; //End add if ($start!=-1 && $level<=$conf['maxseclevel']) { $name = str_replace('"', '', $name); //Add for anchor //$this->doc .= '<!-- SECTION "'.$name.'" ['.$start.'-'.(($end===0)?'':$end).'] -->'; $this->doc .= '<!-- SECTION "'.$name.'" ['.$start.'-'.(($end===0)?'':$end).'] #'.$HID.' -->'; //End add } } [...]