示例#1
0
文件: file.php 项目: just-paja/fudjan
 public static function from_tmp($path, $real_name)
 {
     $model = get_called_class();
     $suff = self::get_suffix_from_name($real_name);
     if ($suff) {
         $real_name = substr($real_name, 0, mb_strlen($real_name) - mb_strlen($suff));
     }
     $file = $model::from_path($path)->rename(\System\Url::gen_seoname($real_name) . ($suff ? '.' . $suff : ''));
     $file->keep = false;
     return $file;
 }
示例#2
0
 private function heading_render($label, $level = null)
 {
     $tag = $level > 6 ? 'strong' : 'h' . $level;
     $attrs = array("id" => \System\Url::gen_seoname($label), "content" => $label, "output" => false);
     return \System\Template\Tag::tag($tag, $attrs);
 }
示例#3
0
 /** Get generic seoname of instance
  * @return string
  */
 public function get_seoname()
 {
     if ($this->has_attr('name')) {
         return $this->id ? $this->name ? \System\Url::gen_seoname($this->name) . '-' . $this->id : $this->id : null;
     } else {
         return $this->id;
     }
 }