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; }
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); }
/** 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; } }