Ejemplo n.º 1
0
function bar(str $k)
{
    $tmp = 54;
    try {
        $y = $k->__toString();
        $tmp = 2;
    } catch (Exception $x) {
        var_dump($tmp);
    }
    var_dump($tmp);
}
Ejemplo n.º 2
0
 public function __destruct()
 {
     flush();
     if (!is_dir(ROOT . 'task')) {
         return false;
     }
     if (AJAX) {
         return false;
     }
     //ajax操作的时候不做计划任务
     if (defined('CLOSETASK')) {
         return false;
     }
     extract($this->info);
     /** 分时计划任务 **/
     $file = new file();
     $db = new db();
     $str = new str();
     $time = time();
     $today = $str->formatDate($time, 'Ymd');
     for ($i_task = 1; $i_task <= 6; $i_task++) {
         if ($time - intval(kc_config('task.update' . $i_task)) > 3600 * $i_task) {
             $tasks = $file->getDir('task/' . $i_task . '/', 'php');
             if (!empty($tasks)) {
                 foreach ($tasks as $k => $v) {
                     require ROOT . $k;
                 }
             }
             unset($tasks);
             $db->update('%s_config', array('value' => $time), "class='task' and name='update{$i_task}'");
         }
     }
     //开始执行每日计划任务
     if (kc_config('task.day') != $today) {
         $tasks = $file->getDir('task/day/', 'php');
         if (!empty($tasks)) {
             foreach ($tasks as $k => $v) {
                 require ROOT . $k;
             }
         }
         unset($tasks);
         $db->update('%s_config', array('value' => $today), "class='task' and name='day'");
     }
     //刷新即可执行
     $tasks = $file->getDir('task/0/', 'php');
     if (!empty($tasks)) {
         foreach ($tasks as $k => $v) {
             require ROOT . $k;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Return the plural of the input string if quantity is larger than one.
  *
  * NOTE: This function will not handle any special cases.
  *
  * @see     http://www.oxforddictionaries.com/words/plurals-of-nouns
  *
  * @param   string   $singular  Singular noun
  * @param   integer  $quantity  Quantity
  * @param   string   $plural    Plural form
  *
  * @return  string
  */
 public static function plural($singular, $quantity = 2, $plural = null)
 {
     if ($quantity <= 1 || empty($singular)) {
         return $singular;
     }
     if (!is_null($plural)) {
         return $plural;
     }
     $last = str::lower($singular[str::length($singular) - 1]);
     $lastTwo = str::lower(substr($singular, 0, -2));
     if ('y' === $last) {
         return substr($singular, 0, -1) . 'ies';
     } else {
         if ('f' === $last || 'fe' === $lastTwo) {
             return $singular . 'ves';
         } else {
             if (in_array($last, array('s', 'x', 'z'))) {
                 return substr($singular, 0, -1) . 'es';
             } else {
                 if (in_array($lastTwo, array('ch', 'sh'))) {
                     return substr($singular, 0, -2) . 'es';
                 } else {
                     return $singular . 's';
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 public function update($data = array())
 {
     if (!panel()->user()->isAdmin() and !$this->isCurrent()) {
         throw new Exception(l('users.form.error.update.rights'));
     }
     // users which are not an admin cannot change their role
     if (!panel()->user()->isAdmin()) {
         unset($data['role']);
     }
     if (str::length(a::get($data, 'password')) > 0) {
         if (a::get($data, 'password') !== a::get($data, 'passwordconfirmation')) {
             throw new Exception(l('users.form.error.password.confirm'));
         }
     } else {
         unset($data['password']);
     }
     unset($data['passwordconfirmation']);
     if ($this->isLastAdmin() and a::get($data, 'role') !== 'admin') {
         // check the number of left admins to not convert the last one
         throw new Exception(l('user.error.lastadmin'));
     }
     parent::update($data);
     // flush the cache in case if the user data is
     // used somewhere on the site (i.e. for profiles)
     kirby()->cache()->flush();
     kirby()->trigger('panel.user.update', $this);
     return $this;
 }
Ejemplo n.º 5
0
 public function login($welcome = null)
 {
     if ($user = panel()->site()->user()) {
         go(panel()->urls()->index());
     }
     $message = l('login.error');
     $error = false;
     $form = panel()->form('login');
     $form->cancel = false;
     $form->save = l('login.button');
     $form->centered = true;
     if (r::is('post') and get('_csfr') and csfr(get('_csfr'))) {
         $data = $form->serialize();
         $user = site()->user(str::lower($data['username']));
         if (!$user) {
             $error = true;
         } else {
             if (!$user->hasPanelAccess()) {
                 $error = true;
             } else {
                 if (!$user->login(get('password'))) {
                     $error = true;
                 } else {
                     go(panel()->urls()->index());
                 }
             }
         }
     }
     if ($username = s::get('username')) {
         $form->fields->username->value = html($username, false);
     }
     return layout('login', array('meta' => new Snippet('meta'), 'welcome' => $welcome ? l('login.welcome') : '', 'form' => $form, 'error' => $error ? $message : false));
 }
Ejemplo n.º 6
0
function truncateString($text, $length)
{
    ob_start();
    $short = \str::short($text, $length);
    ob_end_clean();
    return $short;
}
Ejemplo n.º 7
0
 function crawl()
 {
     $path = url::strip_query($this->raw);
     $path = (array) str::split($path, '/');
     if (a::first($path) == 'index.php') {
         array_shift($path);
     }
     // parse params
     foreach ($path as $p) {
         if (str::contains($p, ':')) {
             $parts = explode(':', $p);
             if (count($parts) < 2) {
                 continue;
             }
             $this->params->{$parts}[0] = $parts[1];
         } else {
             $this->path->_[] = $p;
         }
     }
     // get the extension from the last part of the path
     $this->extension = f::extension($this->path->last());
     if ($this->extension != false) {
         // remove the last part of the path
         $last = array_pop($this->path->_);
         $this->path->_[] = f::name($last);
     }
     return $this->path;
 }
Ejemplo n.º 8
0
 /**
  * Gets a value from the _SERVER array
  * 
  * <code>
  * 
  * server::get('document_root');
  * // sample output: /var/www/kirby
  * 
  * server::get();
  * // returns the whole server array
  *
  * </code>   
  *
  * @param  mixed    $key The key to look for. Pass false or null to return the entire server array. 
  * @param  mixed    $default Optional default value, which should be returned if no element has been found
  * @return mixed
  */
 public static function get($key = false, $default = null)
 {
     if (empty($key)) {
         return $_SERVER;
     }
     return a::get($_SERVER, str::upper($key), $default);
 }
Ejemplo n.º 9
0
 public function __construct($config = array())
 {
     // Set the config
     $this->config = $config;
     // Set a filename, if we don't have one
     if (str::e($this->config['filename'])) {
         $this->config['filename'] = date("Y-m-d_g-ia");
     }
     // Build driver class
     $driver = "Export_Driver_" . trim(strtoupper($config['driver']));
     // Load the driver
     if (!Eight::auto_load($driver)) {
         throw new Export_Exception('export.driver_not_supported', $config['driver']);
     }
     // Initialize the driver
     $this->driver = new $driver($this->config);
     // Validate the driver
     if (!$this->driver instanceof Export_Driver) {
         throw new Export_Exception('export.driver_not_supported', 'Export drivers must use the Export_Driver interface.');
     }
     // Set the columns
     if (!arr::e($this->config['columns'])) {
         $this->driver->set_columns($this->config['columns']);
     }
 }
Ejemplo n.º 10
0
 /**
  * Adds a new route
  *
  * @param object $route
  * @return object
  */
 public function register($pattern, $params = array(), $optional = array())
 {
     if (is_array($pattern)) {
         foreach ($pattern as $v) {
             $this->register($v['pattern'], $v);
         }
         return $this;
     }
     $defaults = array('pattern' => $pattern, 'https' => false, 'ajax' => false, 'filter' => null, 'method' => 'GET', 'arguments' => array());
     $route = new Obj(array_merge($defaults, $params, $optional));
     // convert single methods or methods separated by | to arrays
     if (is_string($route->method)) {
         if (strpos($route->method, '|') !== false) {
             $route->method = str::split($route->method, '|');
         } else {
             if ($route->method == 'ALL') {
                 $route->method = array_keys($this->routes);
             } else {
                 $route->method = array($route->method);
             }
         }
     }
     foreach ($route->method as $method) {
         $this->routes[strtoupper($method)][$route->pattern] = $route;
     }
     return $route;
 }
Ejemplo n.º 11
0
 public function update($username)
 {
     $user = $this->user($username);
     if (!$user) {
         return response::error(l('users.edit.error.missing'));
     } else {
         if (!site()->user()->isAdmin() and !$user->isCurrent()) {
             return response::error('You are not allowed to edit this user');
         }
         $form = $this->form($user);
         $data = $form->toArray();
         if (str::length($data['password']) > 0) {
             if ($data['password'] !== $data['passwordconfirmation']) {
                 return response::error(l('users.form.error.password.confirm'));
             }
         } else {
             unset($data['password']);
         }
         unset($data['passwordconfirmation']);
         if ($user->update($data)) {
             return response::success('success');
         } else {
             return response::error(l('users.form.error.update'));
         }
     }
 }
Ejemplo n.º 12
0
/**
 * Gets the value of an environment variable. Supports boolean, empty and null.
 *
 * @param  string  $key
 * @param  mixed   $default
 * @return mixed
 */
function env($key, $default = null)
{
    $value = getenv($key);
    if ($value === false) {
        return $default;
    }
    switch (strtolower($value)) {
        case 'true':
        case '(true)':
            return true;
        case 'false':
        case '(false)':
            return false;
        case 'empty':
        case '(empty)':
            return '';
        case 'null':
        case '(null)':
            return;
    }
    if (\str::startsWith($value, '"') && \str::endsWith($value, '"')) {
        return substr($value, 1, -1);
    }
    return $value;
}
Ejemplo n.º 13
0
function create_post($page, $blueprint, $title, $data)
{
    // Where we'll put the content.
    $PATH = get_content_path($page);
    $SLUG = str::slug($title);
    $dir = $PATH . DS . $SLUG;
    $dir_matches = glob($PATH . DS . "*" . $SLUG . "*");
    // If the directory already exists don't override it,
    // append a number to it, no matter its visibility.
    // 1-directory
    // directory_1
    // 8-directory_2
    if (count($dir_matches) > 0) {
        $dir .= "_" . count($dir_matches);
        $title .= "_" . count($dir_matches);
    }
    // Pass $title into the $data array for easiest manipulation.
    $data["title"] = $title;
    // Create the directory with read&write permissions.
    mkdir($dir, 0777, true);
    // Filename with (almost) multilingual support.
    // Peraphs you'll want to create different files for each
    // languages code.
    $filename = $blueprint . ".fr.txt";
    // Write the file.
    $file = fopen($dir . DS . $filename, 'w');
    if (flock($file, LOCK_EX)) {
        fwrite($file, parse_data(get_blueprint($blueprint), $data));
        flock($file, LOCK_EX);
    }
    fclose($file);
}
Ejemplo n.º 14
0
function tagcloud($parent, $options = array())
{
    global $site;
    // default values
    $defaults = array('limit' => false, 'field' => 'tags', 'children' => 'visible', 'baseurl' => $parent->url(), 'param' => 'tag', 'sort' => 'name', 'sortdir' => 'asc');
    // merge defaults and options
    $options = array_merge($defaults, $options);
    switch ($options['children']) {
        case 'invisible':
            $children = $parent->children()->invisible();
            break;
        case 'visible':
            $children = $parent->children()->visible();
            break;
        default:
            $children = $parent->children();
            break;
    }
    $cloud = array();
    foreach ($children as $p) {
        $tags = str::split($p->{$options}['field']());
        foreach ($tags as $t) {
            if (isset($cloud[$t])) {
                $cloud[$t]->results++;
            } else {
                $cloud[$t] = new obj(array('results' => 1, 'name' => $t, 'url' => $options['baseurl'] . '/' . $options['param'] . ':' . $t, 'isActive' => param($options['param']) == $t ? true : false));
            }
        }
    }
    $cloud = a::sort($cloud, $options['sort'], $options['sortdir']);
    if ($options['limit']) {
        $cloud = array_slice($cloud, 0, $options['limit']);
    }
    return $cloud;
}
Ejemplo n.º 15
0
 public function add($data)
 {
     $data['id'] = str::random(32);
     $this->data[$data['id']] = $data;
     $this->save();
     return $data['id'];
 }
 public function parseFileAttributes()
 {
     $source = $this->data[self::ARRAY_ATTR][self::PARA_IMG_SOURCE];
     $source = is_object($source) ? $source : $this->imageExt->getPage()->file($source);
     if ($source) {
         $this->data[self::ARRAY_ATTR][self::PARA_IMG_SOURCE] = $source->filename();
         $this->data[self::ARRAY_ATTR][self::PARA_IMG_SOURCE_MODIFIED] = $source->modified();
         $this->data[self::ARRAY_ATTR][self::PARA_IMG_EXTENSION] = $source->extension();
         $this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_FILENAME] = \str::template($this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_FILENAME], array('extension' => $source->extension(), 'name' => $source->name(), 'filename' => $source->filename(), 'safeName' => \f::safeName($source->name()), 'safeFilename' => \f::safeName($source->name()) . '.' . $this->data[self::ARRAY_ATTR][self::PARA_IMG_EXTENSION], 'width' => $this->data[self::ARRAY_ATTR][self::PARA_IMG_WIDTH], 'height' => $this->data[self::ARRAY_ATTR][self::PARA_IMG_HEIGHT], 'hash' => md5($source->root() . $this->settingsIdentifier())));
         $this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_URL] = $this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_URL] . '/' . $this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_FILENAME];
         $this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_ROOT] = $this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_ROOT] . DS . $this->data[self::ARRAY_ATTR][self::PARA_IMG_OUTPUT_FILENAME];
         if ($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_ID] !== false && !empty($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_ID])) {
             $this->data[self::ARRAY_ATTR][self::PARA_LINK_URL] = $source->url();
         }
         if (is_string($this->data[self::ARRAY_ATTR][self::PARA_IMG_ALT]) && WebHelper::startsWith($this->data[self::ARRAY_ATTR][self::PARA_IMG_ALT], '{file-') && WebHelper::endsWith($this->data[self::ARRAY_ATTR][self::PARA_IMG_ALT], '}')) {
             $field = substr($this->data[self::ARRAY_ATTR][self::PARA_IMG_ALT], 6, strlen($this->data[self::ARRAY_ATTR][self::PARA_IMG_ALT]) - 7);
             $this->data[self::ARRAY_ATTR][self::PARA_IMG_ALT] = $source->{$field}()->toString();
         }
         if (is_string($this->data[self::ARRAY_ATTR][self::PARA_IMG_TITLE]) && WebHelper::startsWith($this->data[self::ARRAY_ATTR][self::PARA_IMG_TITLE], '{file-') && WebHelper::endsWith($this->data[self::ARRAY_ATTR][self::PARA_IMG_TITLE], '}')) {
             $field = substr($this->data[self::ARRAY_ATTR][self::PARA_IMG_TITLE], 6, strlen($this->data[self::ARRAY_ATTR][self::PARA_IMG_TITLE]) - 7);
             $this->data[self::ARRAY_ATTR][self::PARA_IMG_TITLE] = $source->{$field}()->toString();
         }
         if (is_string($this->data[self::ARRAY_ATTR][self::PARA_LINK_TITLE]) && WebHelper::startsWith($this->data[self::ARRAY_ATTR][self::PARA_LINK_TITLE], '{file-') && WebHelper::endsWith($this->data[self::ARRAY_ATTR][self::PARA_LINK_TITLE], '}')) {
             $field = substr($this->data[self::ARRAY_ATTR][self::PARA_LINK_TITLE], 6, strlen($this->data[self::ARRAY_ATTR][self::PARA_LINK_TITLE]) - 7);
             $this->data[self::ARRAY_ATTR][self::PARA_LINK_TITLE] = $source->{$field}()->toString();
         }
     }
 }
Ejemplo n.º 17
0
 public function fields($fields = null)
 {
     if (is_null($fields)) {
         return $this->fields;
     }
     // get the site object
     $site = panel()->site();
     // check if untranslatable fields should be deactivated
     $translated = $site->multilang() && !$site->language()->default();
     foreach ($fields as $name => $field) {
         $name = str_replace('-', '_', str::lower($name));
         $field['name'] = $name;
         $field['default'] = a::get($field, 'default', null);
         $field['value'] = a::get($this->values(), $name, $field['default']);
         // Pass through parent field name (structureField)
         $field['parentField'] = $this->parentField;
         // Check for untranslatable fields
         if ($translated and isset($field['translate']) and $field['translate'] === false) {
             $field['readonly'] = true;
             $field['disabled'] = true;
         }
         $this->fields->append($name, static::field($field['type'], $field));
     }
     return $this;
 }
Ejemplo n.º 18
0
 public function create($uid, $template, $content = array())
 {
     if (empty($template)) {
         throw new Exception(l('pages.add.error.template'));
     }
     $uid = empty($uid) ? str::random(32) : $uid;
     $blueprint = new Blueprint($template);
     $data = array();
     foreach ($blueprint->fields(null) as $key => $field) {
         $data[$key] = $field->default();
     }
     $data = array_merge($data, $content);
     // create the new page and convert it to a page model
     $page = new Page($this->page, parent::create($uid, $template, $data)->dirname());
     if (!$page) {
         throw new Exception(l('pages.add.error.create'));
     }
     kirby()->trigger('panel.page.create', $page);
     // subpage builder
     foreach ((array) $page->blueprint()->pages()->build() as $build) {
         $missing = a::missing($build, array('title', 'template', 'uid'));
         if (!empty($missing)) {
             continue;
         }
         $subpage = $page->children()->create($build['uid'], $build['template'], array('title' => $build['title']));
         if (isset($build['num'])) {
             $subpage->sort($build['num']);
         }
     }
     return $page;
 }
Ejemplo n.º 19
0
 /**
  * @param string $id
  * @param PageAbstract $product
  */
 public function __construct($id, PageAbstract $product, $quantity)
 {
     $variant = false;
     // Break cart ID into uri, variant, and option (:: is used as a delimiter)
     $id_array = explode('::', $id);
     // Set variant and option
     $variantName = $id_array[1];
     $variants = $product->variants()->yaml();
     foreach ($variants as $key => $array) {
         if (str::slug($array['name']) === $variantName) {
             $variant = $variants[$key];
         }
     }
     $this->id = $id;
     $this->sku = $variant['sku'];
     $this->uri = $product->uri();
     $this->name = $product->title()->value;
     $this->variant = str::slug($variant['name']);
     $this->option = $id_array[2];
     $this->amount = $variant['price'];
     $this->sale_amount = salePrice($variant);
     $this->weight = $variant['weight'];
     $this->quantity = $quantity;
     $this->noshipping = $product->noshipping()->value;
     $this->notax = $product->notax()->value;
 }
Ejemplo n.º 20
0
 /**
  * Constructor
  *
  * @param mixed $source
  * @param array $params
  */
 public function __construct($source, $params = array())
 {
     $this->source = $this->result = is_a($source, 'Media') ? $source : new Media($source);
     $this->options = array_merge(static::$defaults, $this->params($params));
     $this->destination = new Obj();
     $this->destination->filename = str::template($this->options['filename'], array('extension' => $this->source->extension(), 'name' => $this->source->name(), 'filename' => $this->source->filename(), 'safeName' => f::safeName($this->source->name()), 'safeFilename' => f::safeName($this->source->name()) . '.' . $this->extension(), 'width' => $this->options['width'], 'height' => $this->options['height'], 'hash' => md5($this->source->root() . $this->settingsIdentifier())));
     $this->destination->url = $this->options['url'] . '/' . $this->destination->filename;
     $this->destination->root = $this->options['root'] . DS . $this->destination->filename;
     // don't create the thumbnail if it's not necessary
     if ($this->isObsolete()) {
         return;
     }
     // don't create the thumbnail if it exists
     if (!$this->isThere()) {
         // check for a valid image
         if (!$this->source->exists() or $this->source->type() != 'image') {
             throw new Error('The given image is invalid', static::ERROR_INVALID_IMAGE);
         }
         // check for a valid driver
         if (!array_key_exists($this->options['driver'], static::$drivers)) {
             throw new Error('Invalid thumbnail driver', static::ERROR_INVALID_DRIVER);
         }
         // create the thumbnail
         $this->create();
         // check if creating the thumbnail failed
         if (!file_exists($this->destination->root)) {
             return;
         }
     }
     // create the result object
     $this->result = new Media($this->destination->root, $this->destination->url);
 }
Ejemplo n.º 21
0
 public function getDay($date)
 {
     $Date = str::split($date, '-');
     // If day folder doesn't exists, create it
     $this->field()->check_day($this->model(), $date);
     // Go to day edit page
     go(purl($this->model(), 'year-' . $Date[0] . '/day-' . $date . '/edit/'));
 }
Ejemplo n.º 22
0
 public function valid()
 {
     if (isset($this->data[$this->primary_key]) && !str::e($this->data[$this->primary_key])) {
         $this->loaded = TRUE;
         return TRUE;
     }
     return $this->loaded;
 }
Ejemplo n.º 23
0
function inc_multiple($pathFromWebroot, $params = array())
{
    if (!str::endsWith($pathFromWebroot, '.php')) {
        $pathFromWebroot .= '.php';
    }
    $path = dirname(__FILE__) . '/' . ltrim($pathFromWebroot, '/');
    return include $path;
}
Ejemplo n.º 24
0
 /**
  * Constructor
  * 
  * @param array $data
  */
 public function __construct($data = array())
 {
     foreach ($data as $key => $val) {
         if (!is_string($key) || str::length($key) === 0) {
             continue;
         }
         $this->{$key} = $val;
     }
 }
Ejemplo n.º 25
0
 public function value()
 {
     $value = InputListField::value();
     if (is_array($value)) {
         return $value;
     } else {
         return str::split($value, ',');
     }
 }
Ejemplo n.º 26
0
 public function value()
 {
     $value = parent::value();
     if (is_array($value)) {
         return $value;
     } else {
         return str::split($value, ',');
     }
 }
Ejemplo n.º 27
0
 /**
  * Gets a value from the _SERVER array
  * 
  * <code>
  * 
  * server::get('document_root');
  * // sample output: /var/www/kirby
  * 
  * server::get();
  * // returns the whole server array
  *
  * </code>   
  *
  * @param  mixed    $key The key to look for. Pass false or null to return the entire server array. 
  * @param  mixed    $default Optional default value, which should be returned if no element has been found
  * @return mixed
  */
 public static function get($key = false, $default = null)
 {
     if (empty($key)) {
         return $_SERVER;
     }
     $key = str::upper($key);
     $value = a::get($_SERVER, $key, $default);
     return static::sanitize($key, $value);
 }
Ejemplo n.º 28
0
 public function to()
 {
     $source = $this->source();
     $name = f::name($source['name']);
     $extension = f::extension($source['name']);
     $safeName = f::safeName($name);
     $safeExtension = str_replace('jpeg', 'jpg', str::lower($extension));
     return str::template($this->options['to'], array('name' => $name, 'filename' => $source['name'], 'safeName' => $safeName, 'safeFilename' => $safeName . '.' . $safeExtension, 'extension' => $extension, 'safeExtension' => $safeExtension));
 }
Ejemplo n.º 29
0
 public function __construct()
 {
     $this->data = new Collection();
     foreach (range(0, 99) as $key => $item) {
         $this->data->set($key, str::random());
     }
     $this->url = 'http://getkirby.com';
     $this->pages = $this->data->paginate(10, array('url' => $this->url));
     $this->pagination = $this->pages->pagination();
 }
Ejemplo n.º 30
0
 public function testSize()
 {
     dir::make($this->tmpDir);
     f::write($this->tmpDir . DS . 'testfile-1.txt', str::random(5));
     f::write($this->tmpDir . DS . 'testfile-2.txt', str::random(5));
     f::write($this->tmpDir . DS . 'testfile-3.txt', str::random(5));
     $this->assertEquals(15, dir::size($this->tmpDir));
     $this->assertEquals('15 b', dir::niceSize($this->tmpDir));
     dir::remove($this->tmpDir);
 }