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


PHP smarty_core_rmdir函数代码示例

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


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

示例1: smarty_core_rmdir

function smarty_core_rmdir($params, &$smarty)
{
    if (!isset($params['level'])) {
        $params['level'] = 1;
    }
    if (!isset($params['exp_time'])) {
        $params['exp_time'] = null;
    }
    if ($_handle = opendir($params['dirname'])) {
        while (false !== ($_entry = readdir($_handle))) {
            if ($_entry != '.' && $_entry != '..') {
                if (is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) {
                    $_params = array('dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry, 'level' => $params['level'] + 1, 'exp_time' => $params['exp_time']);
                    smarty_core_rmdir($_params, $smarty);
                } else {
                    $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
                }
            }
        }
        closedir($_handle);
    }
    if ($params['level']) {
        return rmdir($params['dirname']);
    }
    return (bool) $_handle;
}
开发者ID:holin,项目名称:sstour,代码行数:26,代码来源:core.rmdir.php

示例2: smarty_core_rm_auto

function smarty_core_rm_auto($params, &$smarty)
{
    if (!@is_dir($params['auto_base']))
      return false;

    if(!isset($params['auto_id']) && !isset($params['auto_source'])) {
        $_params = array(
            'dirname' => $params['auto_base'],
            'level' => 0,
            'exp_time' => $params['exp_time']
        );
        MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.rmdir.php');
        $_res = smarty_core_rmdir($_params, $smarty);
    } else {
        $_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']);

        if(isset($params['auto_source'])) {
            if (isset($params['extensions'])) {
                $_res = false;
                foreach ((array)$params['extensions'] as $_extension)
                    $_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']);
            } else {
                $_res = $smarty->_unlink($_tname, $params['exp_time']);
            }
        } elseif ($smarty->use_sub_dirs) {
            $_params = array(
                'dirname' => $_tname,
                'level' => 1,
                'exp_time' => $params['exp_time']
            );
            MyOOS_CoreApi::requireOnce('lib/smarty/libs/internals/core.rmdir.php');
            $_res = smarty_core_rmdir($_params, $smarty);
        } else {
            // remove matching file names
            $_handle = opendir($params['auto_base']);
            $_res = true;
            while (false !== ($_filename = readdir($_handle))) {
                if($_filename == '.' || $_filename == '..') {
                    continue;
                } elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) {
                    $_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']);
                }
            }
        }
    }

    return $_res;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:48,代码来源:core.rm_auto.php

示例3: smarty_core_rm_auto

function smarty_core_rm_auto($params, &$smarty)
{
    if (!@is_dir($params['auto_base'])) {
        return false;
    }
    if (!isset($params['auto_id']) && !isset($params['auto_source'])) {
        $_params = array('dirname' => $params['auto_base'], 'level' => 0, 'exp_time' => $params['exp_time']);
        require_once SMARTY_CORE_DIR . 'core.rmdir.php';
        $_res = smarty_core_rmdir($_params, $smarty);
    } else {
        $_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']);
        if (isset($params['auto_source'])) {
            if (isset($params['extensions'])) {
                $_res = false;
                foreach ((array) $params['extensions'] as $_extension) {
                    $_res |= $smarty->_unlink($_tname . $_extension, $params['exp_time']);
                }
            } else {
                $_res = $smarty->_unlink($_tname, $params['exp_time']);
            }
        } elseif ($smarty->use_sub_dirs) {
            $_params = array('dirname' => $_tname, 'level' => 1, 'exp_time' => $params['exp_time']);
            require_once SMARTY_CORE_DIR . 'core.rmdir.php';
            $_res = smarty_core_rmdir($_params, $smarty);
        } else {
            // remove matching file names
            $_handle = opendir($params['auto_base']);
            $_res = true;
            while (false !== ($_filename = readdir($_handle))) {
                if ($_filename == '.' || $_filename == '..') {
                    continue;
                } elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) {
                    $_res &= (bool) $smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']);
                }
            }
            // Fixed by PrestaShop
            if ($_handle !== false) {
                closedir($_handle);
            }
        }
    }
    return $_res;
}
开发者ID:greench,项目名称:prestashop,代码行数:43,代码来源:core.rm_auto.php


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