mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-31 13:25:32 +08:00
79 lines
2.2 KiB
PHP
79 lines
2.2 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2012-2026 ShopeX (https://www.shopex.cn)
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
|
|
class taoexlib_storager{
|
|
|
|
function taoexlib_storager(){
|
|
$this->base_url = kernel::base_url('full').'/';
|
|
if(!defined(IE_FILE_STORAGER))define('IE_FILE_STORAGER','filesystem');
|
|
$this->class_name = 'taoexlib_storage_'.IE_FILE_STORAGER;
|
|
$this->worker = new $this->class_name;
|
|
/*if(defined('HOST_MIRRORS')){
|
|
$host_mirrors = preg_split('/[,\s]+/',constant('HOST_MIRRORS'));
|
|
if(is_array($host_mirrors) && isset($host_mirrors[0])){
|
|
$this->host_mirrors = &$host_mirrors;
|
|
$this->host_mirrors_count = count($host_mirrors)-1;
|
|
}
|
|
}*/
|
|
}
|
|
|
|
function &parse($ident){
|
|
$ret = array();
|
|
if(!$ident){
|
|
return false;
|
|
}elseif(list($ret['url'],$ret['id'],$ret['storager']) = explode('|',$ident)){
|
|
return $ret;
|
|
}else{
|
|
$ret['url'] = &$ident;
|
|
return $ret;
|
|
}
|
|
}
|
|
|
|
function save($content,$ext_name='csv'){
|
|
if($id = $this->worker->save($content,$url,$ext_name)){
|
|
return $url.'|'.$id.'|'.$this->class_name;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function add($key,$content){
|
|
$tmp_content = $this->worker->get($key);
|
|
|
|
if( $tmp_content ){
|
|
$content = $tmp_content . $content;
|
|
}
|
|
|
|
return $this->worker->set($key, $content);
|
|
}
|
|
|
|
function test_get($key){
|
|
return $this->worker->test_get($key);
|
|
}
|
|
|
|
function remove($key){
|
|
return $this->worker->remove($key);
|
|
}
|
|
|
|
function get($key){
|
|
return $this->worker->get($key);
|
|
}
|
|
|
|
}
|
|
|