Lines Matching refs:ins

253                     $ins = array(
259 $ins = array(array('internallink', array(':'.$key,$title)));
262 $ins = array();
269 $ins = p_cached_instructions(wikiFN($page), false, $page);
272 $ins = array();
275 $this->_convert_instructions($ins, $lvl, $page, $sect, $flags, $root_id, $included_pages);
277 return $ins;
293 function _convert_instructions(&$ins, $lvl, $page, $sect, $flags, $root_id, $included_pages = array()) {
298 $this->_get_section($ins, $sect); // section required
302 $this->_get_firstsec($ins, $page, $flags); // only first section
306 $num = count($ins);
315 $this->adapt_links($ins, $page, $included_pages);
318 switch($ins[$i][0]) {
322 unset($ins[$i]);
327 $sect_title = $ins[$i][1][0];
338 if(!$lvl_max || ($ins[$i][1][1] < $lvl_max)) {
339 $lvl_max = $ins[$i][1][1];
344 unset($ins[$i]);
350 unset($ins[$i]);
353 $this->adapt_links($ins[$i][1][0], $page, $included_pages);
357 switch($ins[$i][1][0]) {
365 unset($ins[$i]);
370 $ins[$i][1][1][4] += $lvl;
379 $endpos = $ins[$i][1][1][0];
380 unset($ins[$i]);
402 if($ins[$idx][0] == 'header') {
403 if ($section_close_at === false && isset($ins[$idx+1]) && $ins[$idx+1][0] == 'section_open') {
410 unset ($ins[$idx]);
416 $lvl_new = (($ins[$idx][1][1] + $diff) > 5) ? 5 : ($ins[$idx][1][1] + $diff);
417 $ins[$idx][1][1] = $lvl_new;
420 if($ins[$idx][1][1] <= $conf['maxseclevel'])
425 $this->_permalink($ins[$idx], $page, $sect, $flags);
440 $lvl_new = (($ins[$idx][1][0] + $diff) > 5) ? 5 : ($ins[$idx][1][0] + $diff);
441 $ins[$idx][1][0] = $lvl_new;
457 array_push($ins, array('plugin', array('include_closelastsecedit', array($endpos))));
464 $this->_editbtn($ins, $page, $sect, $sect_title, ($flags['redirect'] ? $root_id : false), $include_secid);
469 $ins[] = $this->_footer($page, $sect, $sect_title, $flags, $footer_lvl, $root_id);
475 $ins[] = array('section_close', array());
476 array_unshift($ins, array('section_open', array($lvl)));
478 $section_close_idx = array_search($section_close_at, array_keys($ins));
480 $before_ins = array_slice($ins, 0, $section_close_idx);
481 $after_ins = array_slice($ins, $section_close_idx);
482 $ins = array_merge($before_ins, array(array('section_close', array())), $after_ins);
483 array_unshift($ins, array('section_open', array($lvl)));
489 array_unshift($ins, array('plugin', array('include_wrap', array('open', $page, $flags['redirect'], $include_secid))));
491 array_unshift($ins, array('entity', array($flags['beforeeach'])));
492 array_push($ins, array('plugin', array('include_wrap', array('close'))));
494 array_push($ins, array('entity', array($flags['aftereach'])));
498 array_unshift($ins, array('section_close', array()));
499 $ins[] = array('section_open', array($lvl));
520 function _editbtn(&$ins, $page, $sect, $sect_title, $root_id, $hid = '') {
525 $ins[] = $editbtn;
533 function _permalink(&$ins, $page, $sect, $flags) {
534 $ins[0] = 'plugin';
535 $ins[1] = array('include_header', array($ins[1][0], $ins[1][1], $ins[1][2], $page, $sect, $flags));
541 * @param array $ins The instructions that shall be adapted
545 private function adapt_links(&$ins, $page, $included_pages = null) {
546 $num = count($ins);
551 if (strpos($ins[$i][0], 'link') !== false && isset($ins[$i][1][1]) && is_array($ins[$i][1][1]) && $ins[$i][1][1]['type'] == 'internalmedia') {
553 $media_id = resolve_id($ns, $ins[$i][1][1]['src']);
556 $ins[$i][1][1]['src'] = $media_id;
558 switch($ins[$i][0]) {
563 $link_id = $ins[$i][1][0];
574 $ins[$i][1][0] = ($link_params != '') ? $link_id.'?'.$link_params : $link_id;
576 if ($ins[$i][0] == 'internallink' && !empty($included_pages)) {
579 $link_id = $ins[$i][1][0];
593 $ins[$i][0] = 'locallink';
594 $ins[$i][1][0] = $hash;
598 $ins[$i][0] = 'plugin';
599 $ins[$i][1] = array('include_locallink', array($included_pages[$link_id]['hid'], $ins[$i][1][1], $ins[$i][1][0]));
608 $ins[$i][0] = 'internallink';
609 $ins[$i][1][0] = ':'.$page.'#'.$ins[$i][1][0];
621 function _get_section(&$ins, $sect) {
622 $num = count($ins);
631 if ($ins[$i][0] == 'header') {
634 if (sectionID($ins[$i][1][0], $check) == $sect) {
636 $lvl = $ins[$i][1][1];
637 } elseif ($offset && $lvl && ($ins[$i][1][1] <= $lvl)) {
639 $endpos = $ins[$i][1][2]; // the position directly after the found section, needed for the section edit button
646 if(is_array($ins)) {
647 $ins = array_slice($ins, $offset, $end);
649 $ins[] = array('plugin', array('include_closelastsecedit', array($endpos)));
658 function _get_firstsec(&$ins, $page, $flags) {
659 $num = count($ins);
663 if($ins[$i][0] == 'section_close') {
666 if ($ins[$i][0] == 'header') {
673 $endpos = $ins[$i][1][2];
677 if(($first_sect) && ($ins[$i][0] == 'section_open')) {
678 $ins = array_slice($ins, 0, $first_sect);
680 $ins[] = array('plugin', array('include_readmore', array($page)));
682 $ins[] = array('section_close', array());
684 $ins[] = array('plugin', array('include_closelastsecedit', array($endpos)));