• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP extension函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fileSize

 public function fileSize(string $path, string $type = 'b', int $decimal = 2) : float
 {
     $size = 0;
     $extension = extension($path);
     if (!empty($extension)) {
         $size = ftp_size($this->connect, $path);
     } else {
         if ($this->files($path)) {
             foreach ($this->files($path) as $val) {
                 $size += ftp_size($this->connect, $path . "/" . $val);
             }
             $size += ftp_size($this->connect, $path);
         } else {
             $size += ftp_size($this->connect, $path);
         }
     }
     if ($type === "b") {
         return $size;
     }
     if ($type === "kb") {
         return round($size / 1024, $decimal);
     }
     if ($type === "mb") {
         return round($size / (1024 * 1024), $decimal);
     }
     if ($type === "gb") {
         return round($size / (1024 * 1024 * 1024), $decimal);
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:29,代码来源:Info.php


示例2: copyr

function copyr($source, $dest, $fileFilter = array())
{
    global $objZip;
    //*** Simple copy for a file.
    if (is_file($source)) {
        if (count($fileFilter) == 0 || in_array(extension($source), $fileFilter)) {
            $objZip->addFile($source, $dest);
            logExport($source);
            return true;
        } else {
            return false;
        }
    }
    if (!is_dir($source)) {
        return false;
    }
    //*** Loop through the folder
    $dir = dir($source);
    while (false !== ($entry = $dir->read())) {
        //*** Skip pointers
        if ($entry == "." || $entry == "..") {
            continue;
        }
        //*** Deep copy directories
        if ($dest !== "{$source}/{$entry}") {
            copyr("{$source}/{$entry}", "{$dest}/{$entry}", $fileFilter);
        }
    }
    logExport($source);
    //*** Clean up
    $dir->close();
    return true;
}
开发者ID:laiello,项目名称:punchcms,代码行数:33,代码来源:export2html.php


示例3: createThumb

function createThumb($from, $to, $maxWidth, $maxHeight)
{
    $extension = extension($from);
    switch ($extension) {
        case "jpg":
        case "jpeg":
            $source = imagecreatefromjpeg($from);
            break;
        case "png":
            $source = imagecreatefrompng($from);
            break;
        case "gif":
            $source = imagecreatefromgif($from);
            break;
    }
    list($width, $height) = getimagesize($from);
    $percent = $maxWidth / $width;
    $new_width = $maxWidth;
    $new_height = $height * $percent;
    if ($new_height > $maxHeight) {
        $percent = $maxHeight / $height;
        $new_height = $maxHeight;
        $new_width = $width * $percent;
    }
    if ($new_width > $width || $new_height > $height) {
        $new_width = $width;
        $new_height = $height;
    }
    $image_p = imagecreatetruecolor($new_width, $new_height);
    imagecopyresampled($image_p, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
    // Output
    imagejpeg($image_p, $to, 80);
    chmod($to, 0777);
}
开发者ID:newcron,项目名称:juebe-modelle,代码行数:34,代码来源:media.upload.php


示例4: zone_fork

 public function zone_fork($disposition_id, $disposition, $url, $theme, $page, $zone)
 {
     $url = str_replace(url(), '', $url);
     if (!$url || preg_match('#^index(?:\\.|/)#', $url)) {
         $url = '/';
     }
     if (extension($url) == 'html') {
         $url = substr($url, 0, -5) . '/*';
     }
     $url = explode('/', $url);
     if (!empty($url[0]) && ($module = $this->load->module($url[0])) && !empty($module->routes) && ($method = $module->get_method(array_slice($url, 1, -1), TRUE))) {
         $url = array($url[0], $method, '*');
     }
     $url = implode('/', $url);
     if ($page == '*' || !$this->db->select('1')->from('nf_dispositions')->where('page', $url)->row()) {
         foreach ($disposition as &$rows) {
             foreach ($rows->cols as &$col) {
                 foreach ($col->widgets as &$w) {
                     $widget = $this->db->select('widget', 'type', 'title', 'settings')->from('nf_widgets')->where('widget_id', $w->widget_id)->row();
                     $w->widget_id = $this->db->insert('nf_widgets', array('widget' => $widget['widget'], 'type' => $widget['type'], 'title' => $widget['title'], 'settings' => $widget['settings']));
                 }
             }
         }
         return Zone::display($this->db->insert('nf_dispositions', array('theme' => $theme, 'page' => $url, 'zone' => $zone, 'disposition' => serialize($disposition))), $disposition, $url, $zone, TRUE);
     } else {
         $this->model()->delete_disposition($disposition);
         $this->db->where('disposition_id', $disposition_id)->delete('nf_dispositions');
         $disposition = $this->db->select('disposition_id', 'disposition')->from('nf_dispositions')->where('theme', $theme)->where('page', '*')->where('zone', $zone)->row();
         return Zone::display($disposition['disposition_id'], unserialize($disposition['disposition']), '*', $zone, TRUE);
     }
 }
开发者ID:agreements,项目名称:neofrag-cms,代码行数:31,代码来源:ajax.php


示例5: getParams

 public function getParams()
 {
     foreach ($this->params as $key => $value) {
         $out[] = $key . '=' . $value;
     }
     // EXTENCION
     $out[] = 'f=' . extension($this->fileName);
     return join("&", $out);
 }
开发者ID:santikrass,项目名称:poliversal,代码行数:9,代码来源:class.PhpT.php


示例6: index

function index()
{
    global $db;
    global $body;
    global $languages;
    global $navigation;
    global $lang;
    $alanguages = array();
    if ($handle = opendir(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lang')) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && is_file(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . $file) && strtolower(extension($file)) == 'php') {
                $alanguages[] = substr($file, 0, -4);
            }
        }
        closedir($handle);
    }
    $languages = '';
    $no = 0;
    $activelanguages = '';
    foreach ($alanguages as $ti) {
        $default = '';
        $opacity = '';
        $titlemakedefault = 'title="Make language default"';
        $setdefault = 'onclick="javascript:language_makedefault(\'' . $ti . '\')"';
        if (strtolower($lang) == strtolower($ti)) {
            $default = ' (Default)';
            $opacity = '0.5;cursor:default;';
            $titlemakedefault = '';
            $setdefault = '';
        }
        ++$no;
        $activelanguages .= '<li class="ui-state-default" id="' . $no . '" d1="' . $ti . '"><span style="font-size:11px;float:left;margin-top:3px;margin-left:5px;" id="' . $ti . '_title">' . $ti . $default . '</span><span style="font-size:11px;float:right;margin-top:0px;margin-right:5px;"><a href="javascript:void(0)" ' . $setdefault . ' style="margin-right:5px;"><img src="images/default.png" ' . $titlemakedefault . ' style="opacity:' . $opacity . ';"></a><a href="?module=language&action=editlanguage&data=' . $ti . '" style="margin-right:5px"><img src="images/config.png" title="Edit Language"></a><a href="?module=language&action=exportlanguage&data=' . $ti . '&token=' . $_SESSION['token'] . '" target="_blank" style="margin-right:5px;"><img src="images/export.png" title="Download Language"></a><a href="javascript:void(0)" onclick="javascript:language_removelanguage(\'' . $ti . '\')"><img src="images/remove.png" title="Remove Language"></a></span><div style="clear:both"></div></li>';
    }
    $body = <<<EOD
\t{$navigation}
\t<div id="rightcontent" style="float:left;width:720px;border-left:1px dotted #ccc;padding-left:20px;">
\t\t<h2>Languages</h2>
\t\t<h3>To set the language, click on the star button next to the language.</h3>

\t\t<div>
\t\t\t<div id="centernav">
\t\t\t\t\t<div>
\t\t\t\t\t\t<ul id="modules_livelanguage">
\t\t\t\t\t\t\t{$activelanguages}
\t\t\t\t\t\t</ul>
\t\t\t\t\t</div>\t\t\t\t
\t\t\t\t</div>\t
\t\t\t</div>
\t\t</div>


\t<div style="clear:both"></div>
EOD;
    template();
}
开发者ID:quachvancam,项目名称:sugardating,代码行数:55,代码来源:language.m.php


示例7: _theme_installation

 public function _theme_installation()
 {
     $this->extension('json');
     if (!empty($_FILES['theme']) && extension($_FILES['theme']['name']) == 'zip') {
         if ($zip = zip_open($_FILES['theme']['tmp_name'])) {
             $theme_name = NULL;
             while ($zip_entry = zip_read($zip)) {
                 $entry_name = zip_entry_name($zip_entry);
                 $is_dir = substr($entry_name, -1) == '/';
                 if (is_null($theme_name) && $is_dir) {
                     $theme_name = substr($entry_name, 0, -1);
                 }
                 if ($theme_name && strpos($entry_name, $theme_name . '/') === 0) {
                     if ($is_dir) {
                         mkdir('./themes/' . $entry_name, 0777, TRUE);
                     } else {
                         if (zip_entry_open($zip, $zip_entry, 'r')) {
                             $content = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                             if ($entry_name == $theme_name . '/' . $theme_name . '.php' && file_exists('./themes/' . $entry_name)) {
                                 if (preg_match('/\\$version[ \\t]*?=[ \\t]*?([\'"])(.+?)\\1;/', $content, $match)) {
                                     $old_version = preg_replace('/[^\\d.]/', '', $this->load->theme($theme_name, FALSE)->version);
                                     $new_version = preg_replace('/[^\\d.]/', '', $match[2]);
                                     if ($cmp = version_compare($new_version, $old_version)) {
                                         $update = TRUE;
                                     } else {
                                         zip_entry_close($zip_entry);
                                         return json_encode(array('error' => $this($cmp == 0 ? 'already_installed_version' : 'not_newer_installed_version')));
                                     }
                                 }
                             }
                             file_put_contents('./themes/' . $entry_name, $content);
                             zip_entry_close($zip_entry);
                         }
                     }
                 }
             }
             zip_close($zip);
             if ($theme_name && ($theme = $this->load->theme($theme_name, FALSE))) {
                 if (empty($update)) {
                     $theme->uninstall()->install();
                 } else {
                     $this->db->insert('nf_settings_addons', array('name' => $theme_name, 'type' => 'theme', 'enable' => TRUE));
                 }
                 return json_encode(array('success' => TRUE));
             } else {
                 if ($theme_name) {
                     rmdir_all('./themes/' . $theme_name);
                 }
                 return json_encode(array('error' => $this('error_theme_install')));
             }
         }
     }
     return json_encode(array('error' => $this('zip_file_required')));
 }
开发者ID:agreements,项目名称:neofrag-cms,代码行数:54,代码来源:admin_ajax.php


示例8: _row

	public function _row($filepath, $filename) {
		$row = (object) array(
			'extension' => extension($filename),
			'name' => strtolower($filename),
			'random' => time() . '_' . substr(md5(unique_id()), 0, 10)
		);

		$row->filename = $row->random . '.' . $row->extension;
		$row->filepath = $filepath . $row->filename;

		return $row;
	}
开发者ID:nopticon,项目名称:rockr,代码行数:12,代码来源:upload.php


示例9: getFn

 private function getFn($method)
 {
     static $prefix;
     if (!$prefix) {
         if (extension('apcu')) {
             $prefix = 'apcu_';
         } elseif (extension('apc')) {
             $prefix = 'apc_';
         } else {
             throw new \Exception('Require APC or APCu extension!');
         }
     }
     return $prefix . $method;
 }
开发者ID:yeaha,项目名称:owl-orm,代码行数:14,代码来源:Apc.php


示例10: __construct

 public function __construct()
 {
     parent::__construct();
     $this->_configs['base_url'] = str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
     $this->_configs['request_url'] = $_SERVER['REQUEST_URI'] != $this->_configs['base_url'] ? substr($_SERVER['REQUEST_URI'], strlen($this->_configs['base_url'])) : 'index.html';
     $this->_configs['extension_url'] = extension($this->_configs['request_url'], $this->_configs['request_url']);
     $this->_configs['ajax_header'] = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
     $ext = extension($url = !empty($_GET['request_url']) ? $_GET['request_url'] : $this->_configs['request_url'], $url);
     $this->_configs['segments_url'] = explode('/', rtrim(substr($url, 0, -strlen($ext)), '.'));
     if ($this->_configs['segments_url'][0] == 'admin') {
         $this->_configs['admin_url'] = TRUE;
     }
     if (empty($this->_configs['admin_url']) && $this->_configs['segments_url'][0] == 'ajax' || !empty($this->_configs['admin_url']) && isset($this->_configs['segments_url'][1]) && $this->_configs['segments_url'][1] == 'ajax') {
         $this->_configs['ajax_url'] = TRUE;
     }
     if (is_null($configs = NeoFrag::loader()->db->select('site, lang, name, value, type')->from('nf_settings')->get())) {
         exit('Database is empty');
     }
     foreach ($configs as $setting) {
         if ($setting['type'] == 'array') {
             $value = unserialize(utf8_html_entity_decode($setting['value']));
         } else {
             if ($setting['type'] == 'list') {
                 $value = explode('|', $setting['value']);
             } else {
                 if ($setting['type'] == 'bool') {
                     $value = (bool) $setting['value'];
                 } else {
                     if ($setting['type'] == 'int') {
                         $value = (int) $setting['value'];
                     } else {
                         $value = $setting['value'];
                     }
                 }
             }
         }
         $this->_settings[$setting['site']][$setting['lang']][$setting['name']] = $value;
         if (empty($site) && $setting['name'] == 'nf_domains' && in_string($_SERVER['HTTP_HOST'], $setting['value'])) {
             $site = $value;
         }
     }
     $this->update('');
     $this->update('default');
     if (!empty($site)) {
         $this->update('default');
     }
 }
开发者ID:nsystem1,项目名称:neofrag-cms,代码行数:47,代码来源:config.php


示例11: use

 public function use(string $randomPageVariable, array $randomDataVariable = NULL, bool $randomObGetContentsVariable = false)
 {
     if (!empty(Properties::$parameters['usable'])) {
         $randomObGetContentsVariable = Properties::$parameters['usable'];
     }
     if (!empty(Properties::$parameters['data'])) {
         $randomDataVariable = Properties::$parameters['data'];
     }
     Properties::$parameters = [];
     $eol = EOL;
     $randomPageVariableExtension = extension($randomPageVariable);
     $randomPageVariableBaseUrl = baseUrl($randomPageVariable);
     $return = '';
     if (!is_file($randomPageVariable)) {
         throw new InvalidArgumentException('Error', 'fileParameter', '1.($randomPageVariable)');
     }
     if ($randomPageVariableExtension === 'js') {
         $return = '<script type="text/javascript" src="' . $randomPageVariableBaseUrl . '"></script>' . $eol;
     } elseif ($randomPageVariableExtension === 'css') {
         $return = '<link href="' . $randomPageVariableBaseUrl . '" rel="stylesheet" type="text/css" />' . $eol;
     } elseif (stristr('svg|woff|otf|ttf|' . implode('|', Config::get('ViewObjects', 'font')['differentFontExtensions']), $randomPageVariableExtension)) {
         $return = '<style type="text/css">@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}</style>' . $eol;
     } elseif ($randomPageVariableExtension === 'eot') {
         $return = '<style type="text/css"><!--[if IE]>@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}<![endif]--></style>' . $eol;
     } else {
         $randomPageVariable = suffix($randomPageVariable, '.php');
         if (is_file($randomPageVariable)) {
             if (is_array($randomDataVariable)) {
                 extract($randomDataVariable, EXTR_OVERWRITE, 'zn');
             }
             if ($randomObGetContentsVariable === false) {
                 require $randomPageVariable;
             } else {
                 ob_start();
                 require $randomPageVariable;
                 $randomSomethingFileContent = ob_get_contents();
                 ob_end_clean();
                 return $randomSomethingFileContent;
             }
         }
     }
     if ($randomObGetContentsVariable === false) {
         echo $return;
     } else {
         return $return;
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:47,代码来源:Something.php


示例12: upload

 public function upload($files, $dir = NULL, &$filename = NULL, $file_id = NULL, $var = NULL)
 {
     if (!file_exists($dir = './upload/' . ($dir ?: 'unknow'))) {
         if (!mkdir($dir, 0777, TRUE)) {
             return FALSE;
         }
     }
     do {
         $file = unique_id() . '.' . extension(basename($var ? $files['name'][$var] : $files['name']));
     } while (file_exists($filename = $dir . '/' . $file));
     if (move_uploaded_file($var ? $files['tmp_name'][$var] : $files['tmp_name'], $filename)) {
         if ($file_id) {
             $this->_unlink($file_id);
             $this->db->where('file_id', $file_id)->update('nf_files', array('user_id' => $this->user() ? $this->user('user_id') : NULL, 'path' => $filename, 'name' => $var ? $files['name'][$var] : $files['name']));
             return $file_id;
         } else {
             return $this->add($filename, $var ? $files['name'][$var] : $files['name']);
         }
     }
     return FALSE;
 }
开发者ID:agreements,项目名称:neofrag-cms,代码行数:21,代码来源:file.php


示例13: _page

 protected function _page($randomPageVariable, $randomDataVariable, $randomObGetContentsVariable = false, $randomPageDir = VIEWS_DIR)
 {
     if (!extension($randomPageVariable) || stristr($randomPageVariable, $this->templateWizardExtension)) {
         $randomPageVariable = suffix($randomPageVariable, '.php');
     }
     $randomPagePath = $randomPageDir . $randomPageVariable;
     if (is_file($randomPagePath)) {
         if (is_array($randomDataVariable)) {
             extract($randomDataVariable, EXTR_OVERWRITE, 'zn');
         }
         if ($randomObGetContentsVariable === false) {
             return require $randomPagePath;
         } else {
             ob_start();
             require $randomPagePath;
             $randomViewFileContent = ob_get_contents();
             ob_end_clean();
             return $randomViewFileContent;
         }
     } else {
         throw new FileNotFoundException('Error', 'fileNotFound', $randomPageVariable);
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:23,代码来源:View.php


示例14: upload

 public function upload($user_id, $field = 'userfile')
 {
     $user_id = (int) $user_id;
     $this->load->helper('file');
     $this->data = array();
     $this->errors = array();
     $this->load->library('upload');
     $this->upload = $this->ci->upload;
     $this->lang->load('upload');
     $file_selected = isset($_FILES[$field]) && isset($_FILES[$field]['name']) && $_FILES[$field]['name'] != '';
     if ($file_selected == '') {
         return $this;
     }
     // Ivan: The uploaded file may not be valid, but I have to delete the previous file at this point.
     $this->_delete($user_id);
     $file_name = clean_file_name($_FILES[$field]['name']);
     $file_name = md5($user_id) . '.' . strtolower(extension($file_name));
     $config['file_name'] = $file_name;
     $config['upload_path'] = $this->upload_path;
     $config['allowed_types'] = $this->allowed_types;
     $config['max_size'] = $this->max_size;
     $config['max_width'] = $this->max_width;
     $config['max_height'] = $this->max_height;
     $config['overwrite'] = true;
     $this->upload->initialize()->initialize($config, false);
     if (!$this->upload->do_upload($field)) {
         $this->errors = $this->upload->error_msg;
         return $this;
     }
     $this->data = $this->upload->data();
     if (!$this->data['is_image']) {
         $this->errors[] = $this->lang->line('ui_invalid_image_format');
         return $this;
     }
     $this->users->update($user_id, array('photo' => $this->data['file_name']));
     return $this;
 }
开发者ID:aslijiasheng,项目名称:ciFramework,代码行数:37,代码来源:User_photo_manager.php


示例15: use

 public function use(...$styles)
 {
     $str = '';
     $eol = EOL;
     $args = $this->_parameters($styles, 'styles');
     $lastParam = $args->lastParam;
     $arguments = $args->arguments;
     $links = $args->cdnLinks;
     foreach ($arguments as $style) {
         if (is_array($style)) {
             $style = '';
         }
         $styleFile = STYLES_DIR . suffix($style, ".css");
         if (!is_file($styleFile)) {
             $styleFile = EXTERNAL_STYLES_DIR . suffix($style, ".css");
         }
         if (!in_array("style_" . $style, Properties::$isImport)) {
             if (is_file($styleFile)) {
                 $str .= '<link href="' . baseUrl($styleFile) . '" rel="stylesheet" type="text/css" />' . $eol;
             } elseif (isUrl($style) && extension($style) === 'css') {
                 $str .= '<link href="' . $style . '" rel="stylesheet" type="text/css" />' . $eol;
             } elseif (isset($links[strtolower($style)])) {
                 $str .= '<link href="' . $links[strtolower($style)] . '" rel="stylesheet" type="text/css" />' . $eol;
             }
             Properties::$isImport[] = "style_" . $style;
         }
     }
     if (!empty($str)) {
         if ($lastParam === true) {
             return $str;
         } else {
             echo $str;
         }
     } else {
         return false;
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:37,代码来源:Style.php


示例16: use

 public function use(...$scripts)
 {
     $str = '';
     $eol = EOL;
     $args = $this->_parameters($scripts, 'scripts');
     $lastParam = $args->lastParam;
     $arguments = $args->arguments;
     $links = $args->cdnLinks;
     foreach ($arguments as $script) {
         if (is_array($script)) {
             $script = '';
         }
         $scriptFile = SCRIPTS_DIR . suffix($script, ".js");
         if (!is_file($scriptFile)) {
             $scriptFile = EXTERNAL_SCRIPTS_DIR . suffix($script, ".js");
         }
         if (!in_array("script_" . $script, Properties::$isImport)) {
             if (is_file($scriptFile)) {
                 $str .= '<script type="text/javascript" src="' . baseUrl($scriptFile) . '"></script>' . $eol;
             } elseif (isUrl($script) && extension($script) === 'js') {
                 $str .= '<script type="text/javascript" src="' . $script . '"></script>' . $eol;
             } elseif (isset($links[strtolower($script)])) {
                 $str .= '<script type="text/javascript" src="' . $links[strtolower($script)] . '"></script>' . $eol;
             }
             Properties::$isImport[] = "script_" . $script;
         }
     }
     if (!empty($str)) {
         if ($lastParam === true) {
             return $str;
         } else {
             echo $str;
         }
     } else {
         return false;
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:37,代码来源:Script.php


示例17: asset

function asset($file_path)
{
    if (file_exists($file_path)) {
        $content = file_get_contents($file_path);
        $date = filemtime($file_path);
    }
    if (!isset($content)) {
        foreach (NeoFrag::loader()->paths['assets'] as $path) {
            if (!file_exists($path = $path . '/' . $file_path)) {
                continue;
            }
            $content = file_get_contents($path);
            $date = filemtime($path);
            break;
        }
    }
    if (isset($content)) {
        if (in_array($ext = extension($file_path), array('css', 'js'))) {
            $data = array('lang' => NeoFrag::loader()->config->lang);
            $content = NeoFrag::loader()->template->parse($content, $data);
        }
        ob_end_clean();
        header('Last-Modified: ' . date('r', $date));
        header('Etag: ' . ($etag = md5($content)));
        header('Content-Type: ' . get_mime_by_extension($ext));
        if ($ext == 'zip') {
            header('Content-Disposition: attachment; filename="' . basename($file_path) . '"');
        }
        if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $date || isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
            header('HTTP/1.1 304 Not Modified');
        } else {
            header('HTTP/1.1 200 OK');
            echo $content;
        }
        exit;
    }
}
开发者ID:agreements,项目名称:neofrag-cms,代码行数:37,代码来源:assets.php


示例18: start

 public function start($fileName = 'upload', $rootDir = UPLOADS_DIR)
 {
     if (isset($this->settings['source'])) {
         $fileName = $this->settings['source'];
     }
     if (isset($this->settings['target'])) {
         $rootDir = $this->settings['target'];
     }
     if (!is_string($fileName)) {
         return Error::set(lang('Error', 'stringParameter', 'fileName'));
     }
     if (!is_string($rootDir)) {
         $rootDir = UPLOADS_DIR;
     }
     // Dosya yükleme ayarları yapılmamışsa
     // Varsayılan ayarları kullanması için.
     if ($this->settingStatus === false) {
         $this->settings();
     }
     $this->file = $fileName;
     $root = $rootDir;
     if (!isset($_FILES[$fileName]['name'])) {
         $this->manuelError = 4;
         return false;
     }
     $name = $_FILES[$fileName]['name'];
     $encryption = '';
     if (isset($this->settings['prefix'])) {
         $encryption = $this->settings['prefix'];
     }
     if (isset($this->settings['extensions'])) {
         $extensions = explode("|", $this->settings['extensions']);
     }
     $source = $_FILES[$fileName]['tmp_name'];
     // Çoklu yükleme yapılıyorsa.
     if (is_array($name)) {
         if (empty($name[0])) {
             $this->manuelError = 4;
             return false;
         }
         for ($index = 0; $index < count($name); $index++) {
             $src = $source[$index];
             $nm = $name[$index];
             if ($this->settings['encryption']) {
                 if (!isset($this->settings['prefix'])) {
                     $encryption = substr(Encode::type(uniqid(rand()), $this->settings['encryption']), 0, $this->settings['encodeLength']) . '-';
                 }
             }
             if ($this->settings['convertName'] === true) {
                 $nm = Convert::urlWord($nm);
             }
             $target = $root . '/' . $encryption . $nm;
             if (isset($this->settings['extensions']) && !in_array(extension($nm), $extensions)) {
                 $this->extensionControl = lang('Upload', 'extensionError');
             } elseif (isset($this->settings['maxsize']) && $this->settings['maxsize'] < filesize($src)) {
                 $this->manuelError = 10;
             } else {
                 if (!is_file($rootDir)) {
                     move_uploaded_file($src, $target);
                 } else {
                     $this->manuelError = 9;
                 }
             }
         }
     } else {
         if ($this->settings['encryption']) {
             if (!isset($this->settings['prefix'])) {
                 $encryption = substr(Encode::type(uniqid(rand()), $this->settings['encryption']), 0, $this->settings['encodeLength']) . '-';
             }
         }
         if ($this->settings['convertName'] === true) {
             $name = Convert::urlWord($name);
         }
         if (empty($_FILES[$fileName]['name'])) {
             $this->manuelError = 4;
             return false;
         }
         if (isset($this->settings['maxsize']) && $this->settings['maxsize'] < filesize($source)) {
             $this->manuelError = 10;
             return false;
         }
         $target = $root . '/' . $encryption . $name;
         $this->encodeName = $encryption . $name;
         if (isset($this->settings['extensions']) && !in_array(extension($name), $extensions)) {
             $this->extensionControl = lang('Upload', 'extensionError');
         } else {
             if (!is_file($rootDir)) {
                 move_uploaded_file($source, $target);
             } else {
                 $this->manuelError = 9;
             }
         }
     }
 }
开发者ID:erdidoqan,项目名称:znframework,代码行数:94,代码来源:Upload.php


示例19: action

function action($file)
{
    global $directory, $page, $show_file_or_dir, $lang, $total_files, $_extensions;
    if ($file == 'Match_not_found') {
        return '--';
    }
    if ($file == '..') {
        return '--';
    }
    $html = '<a data-toggle="tooltip" title="' . $lang[1] . '" onclick="SetRemoveModalattr(' . "'" . $directory . '/' . $file . '&dir=' . $directory . '&page=' . $page . "'" . '); return false;" href="#"><span class="RemoveIcon"></span></a> ';
    if ($show_file_or_dir) {
        if (is_dir($directory . '/' . $file)) {
            $count = FilterScanDir($directory . '/' . $file);
            //$count=FilterScanDir($directory.'/'.$file)['count'];
            $count = $count['count'];
            $html .= '<a data-toggle="tooltip" title="' . $lang[18] . '"  onclick="SetShowFileModalattr(' . "'" . $directory . '/' . $file . '/&perpage=' . $count . "&#directory'" . '); return false;"  href="#"><span class="OFolderIcon"></span></a> ';
            unset($count);
        } elseif (in_array(extension($file), $_extensions[2])) {
            $html .= '<a data-toggle="tooltip" title="' . $lang[3] . '" onclick="SetShowFileModalattr(' . "'" . $directory . '/' . $file . "'" . '); return false;" href="#"><span class="ImageIcon"></span></a> ';
        } elseif (in_array(extension($file), array("zip", "rar", "7z", "gzip", "tar", "wim", "xz"))) {
            $html .= '<a data-toggle="tooltip" title="' . $lang[41] . '" onclick="SetZipFileModalattr(' . "'" . $directory . '/' . $file . '&dir=' . $directory . '&page=' . $page . "'" . '); return false;" href="#"><span class="ZipIcon"></span></a> ';
        } else {
            $html .= '<a data-toggle="tooltip" title="' . $lang[3] . '" onclick="SetShowFileModalattr(' . "'" . $directory . '/' . $file . "'" . '); return false;" href="#"><span class="ShowIcon"></span></a> ';
        }
    }
    $html .= '<a data-toggle="tooltip" title="' . $lang[40] . '" onclick="SetCopyFileModalattr(' . "'" . $directory . '/' . $file . '&dir=' . $directory . '&page=' . $page . "'" . '); return false;" href="#"><span class="CopyIcon"></span></a>';
    $html .= '<a data-toggle="tooltip" title="' . $lang[20] . '" onclick="SetRenameModalattr(' . "'" . $directory . '/' . $file . '&dir=' . $directory . '&page=' . $page . "'" . '); return false;" href="#"><span class="RenameIcon"></span></a>';
    return $html;
}
开发者ID:onexite,项目名称:File-Manager,代码行数:29,代码来源:index.php


示例20: file_type_icon

 function file_type_icon($path = null)
 {
     static $_icons;
     if (!isset($_icons)) {
         if (file_exists(APPPATH . 'config/file_type_icons.php')) {
             include APPPATH . 'config/file_type_icons.php';
         }
         if (file_exists(APPPATH . 'config/' . ENVIRONMENT . '/file_type_icons.php')) {
             include APPPATH . 'config/' . ENVIRONMENT . '/file_type_icons.php';
         }
         if (empty($icons) or !is_array($icons)) {
             $icons = array();
         }
         $_icons = array();
         if (!empty($icons)) {
             foreach ($icons as $key => $icon) {
                 if (is_array($icon)) {
                     foreach ($icon as $i) {
                         $_icons[(string) $i] = $key;
                     }
                 } else {
                     $_icons[(string) $icon] = $key;
                 }
             }
         }
     }
     if ($path === null) {
         return $_icons;
     }
     $ext = extension($path);
     if (isset($_icons[$ext])) {
         return $_icons[$ext];
     }
     return null;
 }
开发者ID:Balamir,项目名称:starter-public-edition-3,代码行数:35,代码来源:MY_file_helper.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP extensionEnabled函数代码示例发布时间:2022-05-15
下一篇:
PHP extend_view函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap