Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Format Class
- */
- class Format{
- public function formatDate($date){
- return date('F j, Y, g:i a', strtotime($date));
- }
- public function textShorten($text, $limit = 400){
- $text = $text. " ";
- $text = substr($text, 0, $limit);
- $text = substr($text, 0, strrpos($text, ' '));
- $text = $text.".....";
- return $text;
- }
- public function validation($data){
- $data = trim($data);
- $data = stripcslashes($data);
- $data = htmlspecialchars($data);
- return $data;
- }
- public function title(){
- $path = $_SERVER['SCRIPT_FILENAME']; //Çalışmakta olan PHP dosyasının tam yol tanımlamasını verir (C:/wamp/www/deneme/index.php gibi).
- $title = basename($path, '.php'); //Meselen: Yukaridaki urlden yalniz index kelimesini donderir
- //$title = str_replace('_', ' ', $title);
- if ($title == 'index') {
- $title = 'home';
- }elseif ($title == 'contact') {
- $title = 'contact';
- }
- return $title = ucfirst($title); //ucfirst komutu bir kelimenin ilk harfini büyük harfe dönüştürmeye yarar.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement