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


PHP idfilter函数代码示例

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


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

示例1: _hookjs

 /**
  * Hook js script into page headers.
  *
  * @author Samuele Tognini <samuele@netsons.org>
  */
 function _hookjs(&$event, $param)
 {
     global $ID;
     global $INFO;
     $jsmenu = DOKU_BASE . "lib/plugins/indexmenu/jsmenu/";
     if ($INFO['userinfo']['grps']) {
         $jsmenu .= $this->_notadmin() ? "usrmenu.js" : "admmenu.js";
     } else {
         $jsmenu .= "menu.js";
     }
     $event->data["script"][] = array("type" => "text/javascript", "charset" => "utf-8", "_data" => "", "src" => $jsmenu);
     $event->data["script"][] = array("type" => "text/javascript", "charset" => "utf-8", "_data" => "", "src" => DOKU_BASE . "lib/plugins/indexmenu/indexmenu.js");
     $event->data["script"][] = array("type" => "text/javascript", "charset" => "utf-8", "_data" => "var indexmenu_ID='" . idfilter($ID) . "'");
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:19,代码来源:action.php

示例2: html_btn

/**
 * Displays a button (using its own form)
 * If tooltip exists, the access key tooltip is replaced.
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function html_btn($name, $id, $akey, $params, $method = 'get', $tooltip = '', $label = false)
{
    global $conf;
    global $lang;
    if (!$label) {
        $label = $lang['btn_' . $name];
    }
    $ret = '';
    $tip = '';
    //filter id (without urlencoding)
    $id = idfilter($id, false);
    //make nice URLs even for buttons
    if ($conf['userewrite'] == 2) {
        $script = DOKU_BASE . DOKU_SCRIPT . '/' . $id;
    } elseif ($conf['userewrite']) {
        $script = DOKU_BASE . $id;
    } else {
        $script = DOKU_BASE . DOKU_SCRIPT;
        $params['id'] = $id;
    }
    $ret .= '<form class="button btn_' . $name . '" method="' . $method . '" action="' . $script . '"><div class="no">';
    if (is_array($params)) {
        reset($params);
        while (list($key, $val) = each($params)) {
            $ret .= '<input type="hidden" name="' . $key . '" ';
            $ret .= 'value="' . htmlspecialchars($val) . '" />';
        }
    }
    if ($tooltip != '') {
        $tip = htmlspecialchars($tooltip);
    } else {
        $tip = htmlspecialchars($label);
    }
    $ret .= '<input type="submit" value="' . hsc($label) . '" class="button" ';
    if ($akey) {
        $tip .= ' [' . strtoupper($akey) . ']';
        $ret .= 'accesskey="' . $akey . '" ';
    }
    $ret .= 'title="' . $tip . '" ';
    $ret .= '/>';
    $ret .= '</div></form>';
    return $ret;
}
开发者ID:nefercheprure,项目名称:dokuwiki,代码行数:49,代码来源:html.php

示例3: ml

/**
 * Build a link to a media file
 *
 * Will return a link to the detail page if $direct is false
 *
 * The $more parameter should always be given as array, the function then
 * will strip default parameters to produce even cleaner URLs
 *
 * @param string  $id     the media file id or URL
 * @param mixed   $more   string or array with additional parameters
 * @param bool    $direct link to detail page if false
 * @param string  $sep    URL parameter separator
 * @param bool    $abs    Create an absolute URL
 * @return string
 */
function ml($id = '', $more = '', $direct = true, $sep = '&amp;', $abs = false)
{
    global $conf;
    if (is_array($more)) {
        // strip defaults for shorter URLs
        if (isset($more['cache']) && $more['cache'] == 'cache') {
            unset($more['cache']);
        }
        if (!$more['w']) {
            unset($more['w']);
        }
        if (!$more['h']) {
            unset($more['h']);
        }
        if (isset($more['id']) && $direct) {
            unset($more['id']);
        }
        $more = buildURLparams($more, $sep);
    } else {
        $more = str_replace('cache=cache', '', $more);
        //skip default
        $more = str_replace(',,', ',', $more);
        $more = str_replace(',', $sep, $more);
    }
    if ($abs) {
        $xlink = DOKU_URL;
    } else {
        $xlink = DOKU_BASE;
    }
    // external URLs are always direct without rewriting
    if (preg_match('#^(https?|ftp)://#i', $id)) {
        $xlink .= 'lib/exe/fetch.php';
        // add hash:
        $xlink .= '?hash=' . substr(md5(auth_cookiesalt() . $id), 0, 6);
        if ($more) {
            $xlink .= $sep . $more;
            $xlink .= $sep . 'media=' . rawurlencode($id);
        } else {
            $xlink .= $sep . 'media=' . rawurlencode($id);
        }
        return $xlink;
    }
    $id = idfilter($id);
    // decide on scriptname
    if ($direct) {
        if ($conf['userewrite'] == 1) {
            $script = '_media';
        } else {
            $script = 'lib/exe/fetch.php';
        }
    } else {
        if ($conf['userewrite'] == 1) {
            $script = '_detail';
        } else {
            $script = 'lib/exe/detail.php';
        }
    }
    // build URL based on rewrite mode
    if ($conf['userewrite']) {
        $xlink .= $script . '/' . $id;
        if ($more) {
            $xlink .= '?' . $more;
        }
    } else {
        if ($more) {
            $xlink .= $script . '?' . $more;
            $xlink .= $sep . 'media=' . $id;
        } else {
            $xlink .= $script . '?media=' . $id;
        }
    }
    return $xlink;
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:88,代码来源:common.php

示例4: ml

/**
 * Build a link to a media file
 *
 * Will return a link to the detail page if $direct is false
 */
function ml($id = '', $more = '', $direct = true, $sep = '&amp;')
{
    global $conf;
    if (is_array($more)) {
        $more = buildURLparams($more, $sep);
    } else {
        $more = str_replace(',', $sep, $more);
    }
    $xlink = DOKU_BASE;
    // external URLs are always direct without rewriting
    if (preg_match('#^(https?|ftp)://#i', $id)) {
        $xlink .= 'lib/exe/fetch.php';
        if ($more) {
            $xlink .= '?' . $more;
            $xlink .= $sep . 'media=' . rawurlencode($id);
        } else {
            $xlink .= '?media=' . rawurlencode($id);
        }
        return $xlink;
    }
    $id = idfilter($id);
    // decide on scriptname
    if ($direct) {
        if ($conf['userewrite'] == 1) {
            $script = '_media';
        } else {
            $script = 'lib/exe/fetch.php';
        }
    } else {
        if ($conf['userewrite'] == 1) {
            $script = '_detail';
        } else {
            $script = 'lib/exe/detail.php';
        }
    }
    // build URL based on rewrite mode
    if ($conf['userewrite']) {
        $xlink .= $script . '/' . $id;
        if ($more) {
            $xlink .= '?' . $more;
        }
    } else {
        if ($more) {
            $xlink .= $script . '?' . $more;
            $xlink .= $sep . 'media=' . $id;
        } else {
            $xlink .= $script . '?media=' . $id;
        }
    }
    return $xlink;
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:56,代码来源:common.php

示例5: ml

/**
 * Build a link to a media file
 *
 * Will return a link to the detail page if $direct is false
 *
 * The $more parameter should always be given as array, the function then
 * will strip default parameters to produce even cleaner URLs
 *
 * @param string  $id     the media file id or URL
 * @param mixed   $more   string or array with additional parameters
 * @param bool    $direct link to detail page if false
 * @param string  $sep    URL parameter separator
 * @param bool    $abs    Create an absolute URL
 * @return string
 */
function ml($id = '', $more = '', $direct = true, $sep = '&amp;', $abs = false)
{
    global $conf;
    $isexternalimage = media_isexternal($id);
    if (!$isexternalimage) {
        $id = cleanID($id);
    }
    if (is_array($more)) {
        // add token for resized images
        if (!empty($more['w']) || !empty($more['h']) || $isexternalimage) {
            $more['tok'] = media_get_token($id, $more['w'], $more['h']);
        }
        // strip defaults for shorter URLs
        if (isset($more['cache']) && $more['cache'] == 'cache') {
            unset($more['cache']);
        }
        if (empty($more['w'])) {
            unset($more['w']);
        }
        if (empty($more['h'])) {
            unset($more['h']);
        }
        if (isset($more['id']) && $direct) {
            unset($more['id']);
        }
        if (isset($more['rev']) && !$more['rev']) {
            unset($more['rev']);
        }
        $more = buildURLparams($more, $sep);
    } else {
        $matches = array();
        if (preg_match_all('/\\b(w|h)=(\\d*)\\b/', $more, $matches, PREG_SET_ORDER) || $isexternalimage) {
            $resize = array('w' => 0, 'h' => 0);
            foreach ($matches as $match) {
                $resize[$match[1]] = $match[2];
            }
            $more .= $more === '' ? '' : $sep;
            $more .= 'tok=' . media_get_token($id, $resize['w'], $resize['h']);
        }
        $more = str_replace('cache=cache', '', $more);
        //skip default
        $more = str_replace(',,', ',', $more);
        $more = str_replace(',', $sep, $more);
    }
    if ($abs) {
        $xlink = DOKU_URL;
    } else {
        $xlink = DOKU_BASE;
    }
    // external URLs are always direct without rewriting
    if ($isexternalimage) {
        $xlink .= 'lib/exe/fetch.php';
        $xlink .= '?' . $more;
        $xlink .= $sep . 'media=' . rawurlencode($id);
        return $xlink;
    }
    $id = idfilter($id);
    // decide on scriptname
    if ($direct) {
        if ($conf['userewrite'] == 1) {
            $script = '_media';
        } else {
            $script = 'lib/exe/fetch.php';
        }
    } else {
        if ($conf['userewrite'] == 1) {
            $script = '_detail';
        } else {
            $script = 'lib/exe/detail.php';
        }
    }
    // build URL based on rewrite mode
    if ($conf['userewrite']) {
        $xlink .= $script . '/' . $id;
        if ($more) {
            $xlink .= '?' . $more;
        }
    } else {
        if ($more) {
            $xlink .= $script . '?' . $more;
            $xlink .= $sep . 'media=' . $id;
        } else {
            $xlink .= $script . '?media=' . $id;
        }
    }
//.........这里部分代码省略.........
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:101,代码来源:common.php

示例6: _jsnodes

 /**
  * Return array of javascript nodes and nodes to open.
  *
  * @author  Samuele Tognini <samuele@netsons.org>
  */
 function _jsnodes($data, $js_name, $noajax = 1)
 {
     if (empty($data)) {
         return false;
     }
     //Array of nodes to check
     $q = array('0');
     //Current open node
     $node = 0;
     $out = '';
     $extra = '';
     if ($noajax) {
         $jscmd = $js_name . ".add";
         $com = ";\n";
     } else {
         $jscmd = "new Array ";
         $com = ",";
     }
     foreach ($data as $i => $item) {
         $i++;
         //Remove already processed nodes (greater level = lower level)
         while ($item['level'] <= $data[end($q) - 1]['level']) {
             array_pop($q);
         }
         //till i found its father node
         if ($item['level'] == 1) {
             //root node
             $father = '0';
         } else {
             //Father node
             $father = end($q);
         }
         //add node and its options
         if ($item['type'] == 'd') {
             //Search the lowest open node of a tree branch in order to open it.
             if ($item['open']) {
                 $item['level'] < $data[$node]['level'] ? $node = $i : ($extra .= "{$i} ");
             }
             //insert node in last position
             array_push($q, $i);
         }
         $out .= $jscmd . "('" . idfilter($item['id']) . "',{$i}," . $father . ",'" . $item['title'] . "'";
         //hns
         $item['hns'] ? $out .= ",'" . idfilter($item['hns']) . "'" : ($out .= ",0");
         $item['type'] == 'd' || $item['type'] == 'l' ? $out .= ",1" : ($out .= ",0");
         //MAX option
         $item['type'] == 'l' ? $out .= ",1" : ($out .= ",0");
         $out .= ")" . $com;
     }
     $extra = rtrim($extra, ' ');
     return array($out, $extra);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:57,代码来源:indexmenu.php

示例7: bootstrap_media_nstree_item

/**
 * Userfunction for html_buildlist
 *
 * Prints a media namespace tree item
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function bootstrap_media_nstree_item($item)
{
    global $INPUT;
    $pos = strrpos($item['id'], ':');
    $label = substr($item['id'], $pos > 0 ? $pos + 1 : 0);
    if (!$item['label']) {
        $item['label'] = $label;
    }
    $class = 'level' . $item['level'];
    // TODO: only deliver an image if it actually has a subtree...
    if ($item['open']) {
        $class .= ' open';
        $icon = '<i class="glyphicon glyphicon-minus"></i> ';
        $alt = '−';
    } else {
        $class .= ' closed';
        $icon = '<i class="glyphicon glyphicon-plus"></i> ';
        $alt = '+';
    }
    $ret = '<li class="' . $class . '">';
    if (!($INPUT->str('do') == 'media')) {
        $ret .= '<a href="' . DOKU_BASE . 'lib/exe/mediamanager.php?ns=' . idfilter($item['id']) . '" class="idx_dir">';
    } else {
        $ret .= '<a href="' . media_managerURL(array('ns' => idfilter($item['id'], false), 'tab_files' => 'files')) . '>';
    }
    $ret .= $icon;
    $ret .= $item['label'];
    $ret .= '</a>';
    return $ret;
}
开发者ID:projectesIF,项目名称:Ateneu,代码行数:37,代码来源:tpl_functions.php

示例8: media_nstree_item

/**
 * Userfunction for html_buildlist
 *
 * Prints a media namespace tree item
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function media_nstree_item($item)
{
    global $INPUT;
    $pos = strrpos($item['id'], ':');
    $label = substr($item['id'], $pos > 0 ? $pos + 1 : 0);
    if (empty($item['label'])) {
        $item['label'] = $label;
    }
    $ret = '';
    if (!($INPUT->str('do') == 'media')) {
        $ret .= '<a href="' . DOKU_BASE . 'lib/exe/mediamanager.php?ns=' . idfilter($item['id']) . '" class="idx_dir">';
    } else {
        $ret .= '<a href="' . media_managerURL(array('ns' => idfilter($item['id'], false), 'tab_files' => 'files')) . '" class="idx_dir">';
    }
    $ret .= $item['label'];
    $ret .= '</a>';
    return $ret;
}
开发者ID:yjliugit,项目名称:dokuwiki,代码行数:25,代码来源:media.php

示例9: media_nstree_item

/**
 * Userfunction for html_buildlist
 *
 * Prints a media namespace tree item
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function media_nstree_item($item)
{
    $pos = strrpos($item['id'], ':');
    $label = substr($item['id'], $pos > 0 ? $pos + 1 : 0);
    if (!$item['label']) {
        $item['label'] = $label;
    }
    $ret = '';
    $ret .= '<a href="' . DOKU_BASE . 'lib/exe/mediamanager.php?ns=' . idfilter($item['id']) . '" class="idx_dir">';
    $ret .= $item['label'];
    $ret .= '</a>';
    return $ret;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:20,代码来源:media.php

示例10: wl

 /**
  * This builds a link to a wikipage - changed for internal use here
  *
  * It handles URL rewriting and adds additional parameter if
  * given in $more
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function wl($id = '', $more = '', $abs = false, $sep = '&amp;', $IDexists = true, $overrideRewrite = false, $hadBase = false)
 {
     global $conf;
     $this->debug->message("Starting to build WL-URL for '{$id}'", $more, 1);
     if (is_array($more)) {
         $intermediateMore = '';
         foreach ($more as $key => $value) {
             if (strlen($intermediateMore) > 0) {
                 $intermediateMore .= $sep;
             }
             if (!is_array($value)) {
                 $intermediateMore .= rawurlencode($key) . '=';
                 $intermediateMore .= rawurlencode($value);
                 continue;
             }
             foreach ($value as $val) {
                 if (strlen($intermediateMore) > 0) {
                     $intermediateMore .= $sep;
                 }
                 $intermediateMore .= rawurlencode($key) . '[]=';
                 $intermediateMore .= rawurlencode($val);
             }
         }
         $more = $intermediateMore;
     } else {
         $more = str_replace(',', $sep, $more);
     }
     $id = idfilter($id);
     if ($abs) {
         $xlink = DOKU_URL;
         if (!$IDexists && !$hadBase) {
             // If the file does not exist, we have to remove the base. This link my be one to an parallel BASE.
             $xlink = preg_replace('#' . DOKU_BASE . '$#', '', $xlink);
         }
     } else {
         if ($IDexists || $hadBase) {
             // if the ID does exist, we may add the base.
             $xlink = DOKU_BASE;
         } else {
             $xlink = "";
         }
     }
     // $this->debug->message("internal WL function Before Replacing: '$xlink'", array(DOKU_REL, DOKU_URL, DOKU_BASE, $xlink), 2);
     $xlink = preg_replace('#(?<!http:|https:)//+#', '/', ($abs ? '' : '/') . "{$xlink}/");
     // ensure slashes at beginning and ending, but strip doubles
     $this->debug->message("'{$xlink}'", array(DOKU_REL, DOKU_URL, DOKU_BASE, $xlink), 2);
     if ($overrideRewrite) {
         $this->debug->message("Override enabled.", null, 1);
         $id = strtr($id, ':', '/');
         $xlink .= $id;
         if ($more) {
             $xlink .= '?' . $more;
         }
     } else {
         if ($conf['userewrite'] == 2) {
             $xlink .= DOKU_SCRIPT . '/' . $id;
             if ($more) {
                 $xlink .= '?' . $more;
             }
         } elseif ($conf['userewrite']) {
             $xlink .= $id;
             if ($more) {
                 $xlink .= '?' . $more;
             }
         } elseif ($id) {
             $xlink .= DOKU_SCRIPT . '?id=' . $id;
             if ($more) {
                 $xlink .= $sep . $more;
             }
         } else {
             $xlink .= DOKU_SCRIPT;
             if ($more) {
                 $xlink .= '?' . $more;
             }
         }
     }
     $this->debug->message("internal WL function result: '{$xlink}'", null, 2);
     return $xlink;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:87,代码来源:functions.php


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