public static function header($name) { $name = Urlizer::urlizeTrim($name); header('X-' . $name . ': ' . static::get()); }
public function generateSlug($table, $column, $title, $dbal = 'default') { $slug = Urlizer::urlizeTrim($title); $dbal = AbstractApp::getDbal($dbal); $stmt = $dbal->prepare("SELECT count(*) c FROM {$table} WHERE {$column} = :slug"); $i = 0; do { if ($i) { $slug = UtilString::incrementString($slug, '-', 1); } ++$i; $stmt->bindValue('slug', $slug); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); } while ($row['c']); return $slug; }