当前位置: 首页>>代码示例>>PHP>>正文


PHP sectionID函数代码示例

本文整理汇总了PHP中sectionID函数的典型用法代码示例。如果您正苦于以下问题:PHP sectionID函数的具体用法?PHP sectionID怎么用?PHP sectionID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sectionID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

    /**
     * Handle syntax matches
     *
     * @param string       $match   The current match
     * @param int          $state   The match state
     * @param int          $pos     The position of the match
     * @param Doku_Handler $handler The hanlder object
     * @return array The instructions of the plugin
     */
    function handle($match, $state, $pos, &$handler) {

        $match = substr($match, 2, -2); // strip markup
        list($match, $flags) = explode('&', $match, 2);

        // break the pattern up into its parts 
        list($mode, $page, $sect) = preg_split('/>|#/u', $match, 3); 
        $check = false;
        if (isset($sect)) $sect = sectionID($sect, $check);
        $level = NULL;
        return array($mode, $page, $sect, explode('&', $flags), $level, $pos);
    }
开发者ID:neutrinog,项目名称:Door43,代码行数:21,代码来源:include.php

示例2: jump_to_section

 /**
  * Jump after save to the section containing this table
  *
  * @param Doku_Event $event
  */
 function jump_to_section($event)
 {
     global $INPUT;
     if (!$INPUT->has('edittable_data')) {
         return;
     }
     global $PRE;
     if (preg_match_all('/^\\s*={2,}([^=\\n]+)/m', $PRE, $match, PREG_SET_ORDER)) {
         $check = false;
         //Byref
         $match = array_pop($match);
         $event->data['fragment'] = sectionID($match[1], $check);
     }
 }
开发者ID:hefanbo,项目名称:edittable,代码行数:19,代码来源:sectionjump.php

示例3: _get_section

    /** 
     * Get a section including its subsections 
     *
     * @author Michael Klier <chi@chimeric.de>
     */ 
    function _get_section(&$ins, $sect) {
        $num = count($ins);
        $offset = false;
        $lvl    = false;
        $end    = false;
        $endpos = null; // end position in the input text, needed for section edit buttons

        $check = array(); // used for sectionID() in order to get the same ids as the xhtml renderer

        for($i=0; $i<$num; $i++) {
            if ($ins[$i][0] == 'header') { 

                // found the right header 
                if (sectionID($ins[$i][1][0], $check) == $sect) {
                    $offset = $i;
                    $lvl    = $ins[$i][1][1]; 
                } elseif ($offset && $lvl && ($ins[$i][1][1] <= $lvl)) {
                    $end = $i - $offset;
                    $endpos = $ins[$i][1][2]; // the position directly after the found section, needed for the section edit button
                    break;
                }
            }
        }
        $offset = $offset ? $offset : 0;
        $end = $end ? $end : ($num - 1);
        if(is_array($ins)) {
            $ins = array_slice($ins, $offset, $end);
            // store the end position in the include_closelastsecedit instruction so it can generate a matching button
            $ins[] = array('plugin', array('include_closelastsecedit', array($endpos)));
        }
    } 
开发者ID:neutrinog,项目名称:Door43,代码行数:36,代码来源:helper.php

示例4: _headerToLink

 /**
  * Creates a linkid from a headline
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  * @param string  $title   The headline title
  * @param boolean $create  Create a new unique ID?
  * @return string
  */
 function _headerToLink($title, $create = false)
 {
     if ($create) {
         return sectionID($title, $this->headers);
     } else {
         $check = false;
         return sectionID($title, $check);
     }
 }
开发者ID:sawachan,项目名称:dokuwiki,代码行数:17,代码来源:xhtml.php

示例5: act_redirect

/**
 * Do a redirect after receiving post data
 *
 * Tries to add the section id as hash mark after section editing
 */
function act_redirect($id, $preact)
{
    global $PRE;
    global $TEXT;
    global $MSG;
    //are there any undisplayed messages? keep them in session for display
    //on the next page
    if (isset($MSG) && count($MSG)) {
        //reopen session, store data and close session again
        @session_start();
        $_SESSION[DOKU_COOKIE]['msg'] = $MSG;
        session_write_close();
    }
    $opts = array('id' => $id, 'preact' => $preact);
    //get section name when coming from section edit
    if ($PRE && preg_match('/^\\s*==+([^=\\n]+)/', $TEXT, $match)) {
        $check = false;
        //Byref
        $opts['fragment'] = sectionID($match[0], $check);
    }
    trigger_event('ACTION_SHOW_REDIRECT', $opts, 'act_redirect_execute');
}
开发者ID:JeromeS,项目名称:dokuwiki,代码行数:27,代码来源:actions.php

示例6: _formatLink

 /**
  * reformat links if needed
  */
 function _formatLink($link)
 {
     // for internal links contains the title the pageid
     if (in_array($link['title'], $this->actioninstance->getExportedPages())) {
         list(, $hash) = explode('#', $link['url'], 2);
         $check = false;
         $pid = sectionID($link['title'], $check);
         $link['url'] = "#" . $pid . '__' . $hash;
     }
     // prefix interwiki links with interwiki icon
     if ($link['name'][0] != '<' && preg_match('/\\binterwiki iw_(.\\w+)\\b/', $link['class'], $m)) {
         if (file_exists(DOKU_INC . 'lib/images/interwiki/' . $m[1] . '.png')) {
             $img = DOKU_BASE . 'lib/images/interwiki/' . $m[1] . '.png';
         } elseif (file_exists(DOKU_INC . 'lib/images/interwiki/' . $m[1] . '.gif')) {
             $img = DOKU_BASE . 'lib/images/interwiki/' . $m[1] . '.gif';
         } else {
             $img = DOKU_BASE . 'lib/images/interwiki.png';
         }
         $link['name'] = '<img src="' . $img . '" width="16" height="16" style="vertical-align: center" class="' . $link['class'] . '" />' . $link['name'];
     }
     return parent::_formatLink($link);
 }
开发者ID:a-gundy,项目名称:dokuwiki-plugin-dw2pdf,代码行数:25,代码来源:renderer.php

示例7: act_redirect

/**
 * Do a redirect after receiving post data
 *
 * Tries to add the section id as hash mark after section editing
 */
function act_redirect($id, $preact)
{
    global $PRE;
    global $TEXT;
    $opts = array('id' => $id, 'preact' => $preact);
    //get section name when coming from section edit
    if ($PRE && preg_match('/^\\s*==+([^=\\n]+)/', $TEXT, $match)) {
        $check = false;
        //Byref
        $opts['fragment'] = sectionID($match[0], $check);
    }
    trigger_event('ACTION_SHOW_REDIRECT', $opts, 'act_redirect_execute');
}
开发者ID:stretchyboy,项目名称:dokuwiki,代码行数:18,代码来源:actions.php

示例8: _parse_headers

 function _parse_headers($id)
 {
     $data = file_get_contents(wikiFN($id));
     //$data = preg_replace("#^\s*~~NEWSFEED.*?~~\s+#","",$data);
     $segs = $this->header;
     $ar = preg_split("/(={" . $segs . ",}.*?={" . $segs . ",})\\s*\n/", $data, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     if (count($ar) == 0) {
         return false;
     }
     array_shift($ar);
     //removes ~~NEWSFEED.*?~~ and any text above first header
     $feed_data = array();
     for ($i = 0, $j = 0; $i < count($ar); $i += 2, $j++) {
         $feed_data[$j]['title'] = str_replace('=', "", $ar[$i]);
         $feed_data[$j]['item'] = $this->render($ar[$i + 1]);
         $check = false;
         $feed_data[$j]['name'] = sectionID($ar[$i], $check);
     }
     $md_5 = md5($id);
     $metafile = metaFN('newsfeed:' . $md_5, '.gz');
     $this->_writeFile($metafile, $feed_data, true);
     return $md_5;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:23,代码来源:helper.php

示例9: _showData

 /**
  * Output the data in a table
  *
  * @param array $data
  * @param Doku_Renderer_xhtml $R
  */
 function _showData($data, &$R)
 {
     global $ID;
     $ret = '';
     if (method_exists($R, 'startSectionEdit')) {
         $data['classes'] .= ' ' . $R->startSectionEdit($data['pos'], 'plugin_data');
     }
     $ret .= '<div class="inline dataplugin_entry ' . $data['classes'] . '"><dl>';
     $class_names = array();
     foreach ($data['data'] as $key => $val) {
         if ($val == '' || !count($val)) {
             continue;
         }
         $type = $data['cols'][$key]['type'];
         if (is_array($type)) {
             $type = $type['type'];
         }
         if ($type === 'hidden') {
             continue;
         }
         $class_name = hsc(sectionID($key, $class_names));
         $ret .= '<dt class="' . $class_name . '">' . hsc($data['cols'][$key]['title']) . '<span class="sep">: </span></dt>';
         $ret .= '<dd class="' . $class_name . '">';
         if (is_array($val)) {
             $cnt = count($val);
             for ($i = 0; $i < $cnt; $i++) {
                 switch ($type) {
                     case 'pageid':
                         $type = 'title';
                     case 'wiki':
                         $val[$i] = $ID . '|' . $val[$i];
                         break;
                 }
                 $ret .= $this->dthlp->_formatData($data['cols'][$key], $val[$i], $R);
                 if ($i < $cnt - 1) {
                     $ret .= '<span class="sep">, </span>';
                 }
             }
         } else {
             switch ($type) {
                 case 'pageid':
                     $type = 'title';
                 case 'wiki':
                     $val = $ID . '|' . $val;
                     break;
             }
             $ret .= $this->dthlp->_formatData($data['cols'][$key], $val, $R);
         }
         $ret .= '</dd>';
     }
     $ret .= '</dl></div>';
     $R->doc .= $ret;
     if (method_exists($R, 'finishSectionEdit')) {
         $R->finishSectionEdit($data['len'] + $data['pos']);
     }
 }
开发者ID:endoanaconda,项目名称:dokuwiki-plugin-data,代码行数:62,代码来源:entry.php

示例10: getMapID

 function getMapID($elem, &$check)
 {
     $meta = p_get_metadata($elem['id'], 'context', true);
     $mapID = explode('|', empty($meta['id']) ? sectionID($elem['name'], $check) : $meta['id']);
     array_walk($mapID, array($this, 'mapIDWithAnchor'), $elem['anchor']);
     return $mapID;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:7,代码来源:toc.php

示例11: render

    /**
     * Create output
     */
    function render($mode, &$renderer, $input)
    {
        global $conf;
        list($instr, $data) = $input;
        if ($mode == 'xhtml' || $mode == 'metadata') {
            if (!is_array($this->header[$mode])) {
                $this->header[$mode] = array();
            }
            switch ($instr) {
                case 'imageflow__start':
                    $this->sectionID[] = sectionID("imageflow_container_", $this->header[$mode]);
                    $scID = $this->sectionID[sizeof($this->sectionID) - 1];
                    if ($mode == 'xhtml') {
                        $renderer->doc .= <<<OUTPUT
\t<div class="imageflow_wrapper" id="{$scID}">
\t\t<noscript>
\t\t\t<div class="hasscript">
OUTPUT;
                    }
                    if ($data === null) {
                        break;
                    }
                    $retData = array();
                    list($id, $width) = explode('?', $data, 2);
                    $dir = str_replace(':', '/', cleanID($id));
                    search($retData, $conf['mediadir'], 'search_media', null, $dir);
                    foreach ($retData as $item) {
                        if (!$item['isimg']) {
                            continue;
                        }
                        $imgData = array('src' => $item['id']);
                        if (empty($width)) {
                            $width = 300;
                        }
                        $imgData['params'] = array('w' => intval($width));
                        $imgData['id'] = sectionID(noNS($item['id']), $this->header[$mode]);
                        $imgData['isImage'] = true;
                        $this->_image($imgData, $renderer, $mode);
                    }
                    break;
                case 'image':
                    $this->_image($data, $renderer, $mode);
                    break;
                case 'imageflow__end':
                    if (sizeOf($sectionID) > 0) {
                        array_pop($sectionID);
                    }
                    if ($mode == 'xhtml') {
                        $renderer->doc .= <<<OUTPUT
\t\t\t</div>
\t\t</noscript>
\t</div>
OUTPUT;
                    }
                    break;
            }
            return true;
        }
        return false;
    }
开发者ID:godhelpjun,项目名称:dokuwiki-plugin-imageflow,代码行数:63,代码来源:imageflow.php

示例12: _get_section

 /** 
  * Get a section including its subsections 
  *
  * @author Michael Klier <chi@chimeric.de>
  */
 function _get_section(&$ins, $sect)
 {
     $num = count($ins);
     $offset = false;
     $lvl = false;
     $end = false;
     $check = array();
     // used for sectionID() in order to get the same ids as the xhtml renderer
     for ($i = 0; $i < $num; $i++) {
         if ($ins[$i][0] == 'header') {
             // found the right header
             if (sectionID($ins[$i][1][0], $check) == $sect) {
                 $offset = $i;
                 $lvl = $ins[$i][1][1];
             } elseif ($offset && $lvl && $ins[$i][1][1] <= $lvl) {
                 $end = $i - $offset;
                 break;
             }
         }
     }
     $offset = $offset ? $offset : 0;
     $end = $end ? $end : $num - 1;
     if (is_array($ins)) {
         $ins = array_slice($ins, $offset, $end);
     }
 }
开发者ID:houshuang,项目名称:folders2web,代码行数:31,代码来源:helper.php

示例13: _convert_link

 function _convert_link(&$renderer, &$instr, $id)
 {
     global $ID;
     $exists = false;
     resolve_pageid(getNS($id), $instr[1][0], $exists);
     list($pageID, $pageReference) = explode("#", $instr[1][0], 2);
     if (in_array($pageID, $this->includedPages)) {
         // Crate new internal Links
         $check = null;
         // Either get existing reference or create from first heading. If still not there take the alternate ID
         $pageNameLink = empty($pageReference) ? sectionID($pageID, $check) : $pageReference;
         $instr[1][0] = $ID . "#" . $pageNameLink;
     } else {
         // Convert external Links to plain Text
         $instr = array("cdata", array($instr[1][1]), $instr[2]);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:17,代码来源:toc.php

示例14: render

 /**
  * Handles the actual output creation.
  *
  * @param   string        $format output format being rendered
  * @param   Doku_Renderer $R      the current renderer object
  * @param   array         $data   data created by handler()
  * @return  boolean               rendered correctly? (however, returned value is not used at the moment)
  */
 function render($format, Doku_Renderer $R, $data)
 {
     if ($format != 'xhtml' && $format != 'odt') {
         return false;
     }
     /** @var Doku_Renderer_xhtml $R */
     if (is_null($data)) {
         return false;
     }
     if (!$this->dthlp->ready()) {
         return false;
     }
     $sqlite = $this->dthlp->_getDB();
     if (!$sqlite) {
         return false;
     }
     $R->info['cache'] = false;
     //reset counters
     $this->sums = array();
     if ($this->hasRequestFilter() or isset($_REQUEST['dataofs'])) {
         $this->updateSQLwithQuery($data);
         // handles request params
     }
     $this->dthlp->_replacePlaceholdersInSQL($data);
     // run query
     $clist = array_keys($data['cols']);
     $res = $sqlite->query($data['sql']);
     $rows = $sqlite->res2arr($res);
     $cnt = count($rows);
     if ($cnt === 0) {
         $this->nullList($data, $clist, $R);
         return true;
     }
     if ($data['limit'] && $cnt > $data['limit']) {
         $rows = array_slice($rows, 0, $data['limit']);
     }
     //build classnames per column
     $classes = array();
     $class_names_cache = array();
     $offset = 0;
     if ($data['rownumbers']) {
         $offset = 1;
         //rownumbers are in first column
         $classes[] = $data['align'][0] . 'align rownumbers';
     }
     foreach ($clist as $index => $col) {
         $class = $data['align'][$index + $offset] . 'align';
         $class .= ' ' . hsc(sectionID($col, $class_names_cache));
         $classes[] = $class;
     }
     //start table/list
     $this->preList($clist, $data, $R);
     foreach ($rows as $rownum => $row) {
         // build data rows
         $this->before_item($R);
         if ($data['rownumbers']) {
             $this->before_val('class="' . $classes[0] . '"', $R);
             $R->doc .= $rownum + 1;
             $this->after_val($R);
         }
         foreach (array_values($row) as $num => $cval) {
             $num_rn = $num + $offset;
             $this->beforeVal($data, $num_rn, 'class="' . $classes[$num_rn] . '"', $R);
             $R->doc .= $this->dthlp->_formatData($data['cols'][$clist[$num]], $cval, $R);
             $this->afterVal($data, $num_rn, $R);
             // clean currency symbols
             $nval = str_replace('$€₤', '', $cval);
             $nval = str_replace('/ [A-Z]{0,3}$/', '', $nval);
             $nval = str_replace(',', '.', $nval);
             $nval = trim($nval);
             // summarize
             if ($data['summarize'] && is_numeric($nval)) {
                 if (!isset($this->sums[$num])) {
                     $this->sums[$num] = 0;
                 }
                 $this->sums[$num] += $nval;
             }
         }
         $this->after_item($R);
     }
     $this->postList($data, $cnt, $R);
     return true;
 }
开发者ID:RnBConsulting,项目名称:dokuwiki-plugin-data,代码行数:91,代码来源:table.php

示例15: getTOC

 /**
  * Generates a two-level table of contents for the config plugin.
  *
  * @author Ben Coburn <btcoburn@silicodon.net>
  *
  * @return array
  */
 function getTOC()
 {
     if (is_null($this->_config)) {
         $this->_config = new configuration($this->_file);
     }
     $this->setupLocale(true);
     $allow_debug = $GLOBALS['conf']['allowdebug'];
     // avoid global $conf; here.
     // gather toc data
     $has_undefined = false;
     $toc = array('conf' => array(), 'plugin' => array(), 'template' => null);
     foreach ($this->_config->setting as $setting) {
         if (is_a($setting, 'setting_fieldset')) {
             if (substr($setting->_key, 0, 10) == 'plugin' . CM_KEYMARKER) {
                 $toc['plugin'][] = $setting;
             } else {
                 if (substr($setting->_key, 0, 7) == 'tpl' . CM_KEYMARKER) {
                     $toc['template'] = $setting;
                 } else {
                     $toc['conf'][] = $setting;
                 }
             }
         } else {
             if (!$has_undefined && is_a($setting, 'setting_undefined')) {
                 $has_undefined = true;
             }
         }
     }
     // build toc
     $t = array();
     $check = false;
     $title = $this->getLang('_configuration_manager');
     $t[] = html_mktocitem(sectionID($title, $check), $title, 1);
     $t[] = html_mktocitem('dokuwiki_settings', $this->getLang('_header_dokuwiki'), 1);
     /** @var setting $setting */
     foreach ($toc['conf'] as $setting) {
         $name = $setting->prompt($this);
         $t[] = html_mktocitem($setting->_key, $name, 2);
     }
     if (!empty($toc['plugin'])) {
         $t[] = html_mktocitem('plugin_settings', $this->getLang('_header_plugin'), 1);
     }
     foreach ($toc['plugin'] as $setting) {
         $name = $setting->prompt($this);
         $t[] = html_mktocitem($setting->_key, $name, 2);
     }
     if (isset($toc['template'])) {
         $t[] = html_mktocitem('template_settings', $this->getLang('_header_template'), 1);
         $setting = $toc['template'];
         $name = $setting->prompt($this);
         $t[] = html_mktocitem($setting->_key, $name, 2);
     }
     if ($has_undefined && $allow_debug) {
         $t[] = html_mktocitem('undefined_settings', $this->getLang('_header_undefined'), 1);
     }
     return $t;
 }
开发者ID:boycaught,项目名称:dokuwiki,代码行数:64,代码来源:admin.php


注:本文中的sectionID函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。