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


PHP files::getExtension方法代码示例

本文整理汇总了PHP中files::getExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP files::getExtension方法的具体用法?PHP files::getExtension怎么用?PHP files::getExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在files的用法示例。


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

示例1: dc_admin_icon_url

function dc_admin_icon_url($img)
{
    global $core;
    $core->auth->user_prefs->addWorkspace('interface');
    $user_ui_iconset = @$core->auth->user_prefs->interface->iconset;
    if ($user_ui_iconset && $img) {
        $icon = false;
        if (preg_match('/^images\\/menu\\/(.+)$/', $img, $m) || preg_match('/^index\\.php\\?pf=(.+)$/', $img, $m)) {
            if ($m[1]) {
                $icon = path::real(dirname(__FILE__) . '/../../admin/images/iconset/' . $user_ui_iconset . '/' . $m[1], false);
                if ($icon !== false) {
                    $allow_types = array('png', 'jpg', 'jpeg', 'gif');
                    if (is_file($icon) && is_readable($icon) && in_array(files::getExtension($icon), $allow_types)) {
                        return DC_ADMIN_URL . 'images/iconset/' . $user_ui_iconset . '/' . $m[1];
                    }
                }
            }
        }
    }
    return $img;
}
开发者ID:nikrou,项目名称:dotclear,代码行数:21,代码来源:prepend.php

示例2: imageTest

 /**
  * Vérifie que la variable passée en paramètre est de type image
  * @param string $pImage nom de l'image
  * @param string $pName nom du label associé
  * @param string $pMessage message
  */
 function imageTest($pImage, $pName, $pMessage = "", $i = "")
 {
     $extension = files::getExtension($pImage);
     if (!($extension == 'jpg' || $extension == 'gif' || $extension == 'png')) {
         $this->add($pImage, $pName, $pMessage, $this->style, $i);
         $this->nbError++;
     }
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:14,代码来源:Error.class.php

示例3: sortFilesHelper

 protected function sortFilesHelper($a, $b)
 {
     if ($a == $b) {
         return 0;
     }
     $ext_a = files::getExtension($a);
     $ext_b = files::getExtension($b);
     return strcmp($ext_a . '.' . $a, $ext_b . '.' . $b);
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:9,代码来源:class.themeEditor.php

示例4: array

    http::head(404, 'Not Found');
    exit;
}
$allow_types = array('png', 'jpg', 'jpeg', 'gif', 'css', 'js', 'swf');
$pf = path::clean($_GET['pf']);
$paths = array_reverse(explode(PATH_SEPARATOR, DC_PLUGINS_ROOT));
# Adding admin/res folder here to load some stuff
$paths[] = dirname(__FILE__) . '/swf';
foreach ($paths as $m) {
    $PF = path::real($m . '/' . $pf);
    if ($PF !== false) {
        break;
    }
}
unset($paths);
if ($PF === false || !is_file($PF) || !is_readable($PF)) {
    header('Content-Type: text/plain');
    http::head(404, 'Not Found');
    exit;
}
if (!in_array(files::getExtension($PF), $allow_types)) {
    header('Content-Type: text/plain');
    http::head(404, 'Not Found');
    exit;
}
http::$cache_max_age = 7200;
http::cache(array_merge(array($PF), get_included_files()));
header('Content-Type: ' . files::getMimeType($PF));
header('Content-Length: ' . filesize($PF));
readfile($PF);
exit;
开发者ID:HackerMajor,项目名称:root,代码行数:31,代码来源:load_plugin_file.php

示例5: mediaItemLine

function mediaItemLine($f, $i, $query, $table = false)
{
    global $core, $page_url, $popup, $select, $post_id, $plugin_id, $page_url_params;
    $fname = $f->basename;
    $file = $query ? $f->relname : $f->basename;
    $class = $table ? '' : 'media-item media-col-' . $i % 2;
    if ($f->d) {
        // Folder
        $link = $core->adminurl->get('admin.media', array_merge($page_url_params, array('d' => html::sanitizeURL($f->relname))));
        if ($f->parent) {
            $fname = '..';
            $class .= ' media-folder-up';
        } else {
            $class .= ' media-folder';
        }
    } else {
        // Item
        $params = new ArrayObject(array('id' => $f->media_id, 'plugin_id' => $plugin_id, 'popup' => $popup, 'select' => $select, 'post_id' => $post_id));
        $core->callBehavior('adminMediaURLParams', $params);
        $params = (array) $params;
        $link = $core->adminurl->get('admin.media.item', $params);
    }
    $maxchars = 36;
    if (strlen($fname) > $maxchars) {
        $fname = substr($fname, 0, $maxchars - 4) . '...' . ($f->d ? '' : files::getExtension($fname));
    }
    $act = '';
    if (!$f->d) {
        if ($select > 0) {
            if ($select == 1) {
                // Single media selection button
                $act .= '<a href="' . $link . '"><img src="images/plus.png" alt="' . __('Select this file') . '" ' . 'title="' . __('Select this file') . '" /></a> ';
            } else {
                // Multiple media selection checkbox
                $act .= form::checkbox(array('medias[]', 'media_' . rawurlencode($file)), $file);
            }
        } else {
            // Item
            if ($post_id) {
                // Media attachment button
                $act .= '<a class="attach-media" title="' . __('Attach this file to entry') . '" href="' . $core->adminurl->get("admin.post.media", array('media_id' => $f->media_id, 'post_id' => $post_id, 'attach' => 1)) . '">' . '<img src="images/plus.png" alt="' . __('Attach this file to entry') . '"/>' . '</a>';
            }
            if ($popup) {
                // Media insertion button
                $act .= '<a href="' . $link . '"><img src="images/plus.png" alt="' . __('Insert this file into entry') . '" ' . 'title="' . __('Insert this file into entry') . '" /></a> ';
            }
        }
    }
    if ($f->del) {
        // Deletion button or checkbox
        if (!$popup && !$f->d) {
            if ($select < 2) {
                // Already set for multiple media selection
                $act .= form::checkbox(array('medias[]', 'media_' . rawurlencode($file)), $file);
            }
        } else {
            $act .= '<a class="media-remove" ' . 'href="' . html::escapeURL($page_url) . '&amp;plugin_id=' . $plugin_id . '&amp;d=' . rawurlencode($GLOBALS['d']) . '&amp;q=' . rawurlencode($GLOBALS['q']) . '&amp;remove=' . rawurlencode($file) . '">' . '<img src="images/trash.png" alt="' . __('Delete') . '" title="' . __('delete') . '" /></a>';
        }
    }
    // Render markup
    if (!$table) {
        $res = '<div class="' . $class . '"><p><a class="media-icon media-link" href="' . rawurldecode($link) . '">' . '<img src="' . $f->media_icon . '" alt="" />' . ($query ? $file : $fname) . '</a></p>';
        $lst = '';
        if (!$f->d) {
            $lst .= '<li>' . $f->media_title . '</li>' . '<li>' . $f->media_dtstr . ' - ' . files::size($f->size) . ' - ' . '<a href="' . $f->file_url . '">' . __('open') . '</a>' . '</li>';
        }
        $lst .= $act != '' ? '<li class="media-action">&nbsp;' . $act . '</li>' : '';
        // Show player if relevant
        $file_type = explode('/', $f->type);
        if ($file_type[0] == 'audio') {
            $lst .= '<li>' . dcMedia::audioPlayer($f->type, $f->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_mp3.swf')), null, $core->blog->settings->system->media_flash_fallback) . '</li>';
        }
        $res .= $lst != '' ? '<ul>' . $lst . '</ul>' : '';
        $res .= '</div>';
    } else {
        $res = '<tr class="' . $class . '">';
        $res .= '<td class="media-action">' . $act . '</td>';
        $res .= '<td class="maximal" scope="row"><a class="media-flag media-link" href="' . rawurldecode($link) . '">' . '<img src="' . $f->media_icon . '" alt="" />' . ($query ? $file : $fname) . '</a>' . '<br />' . ($f->d ? '' : $f->media_title) . '</td>';
        $res .= '<td class="nowrap count">' . ($f->d ? '' : $f->media_dtstr) . '</td>';
        $res .= '<td class="nowrap count">' . ($f->d ? '' : files::size($f->size) . ' - ' . '<a href="' . $f->file_url . '">' . __('open') . '</a>') . '</td>';
        $res .= '</tr>';
    }
    return $res;
}
开发者ID:nikrou,项目名称:dotclear,代码行数:84,代码来源:media.php


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