This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Date comparer | |
| * | |
| * @param string $date: current date | |
| * @param string $date2: target date | |
| * @param bool $diff: date diff or past time condition | |
| * @return bool|array | |
| */ | |
| public function dateCompare($current, $expire, $diff = false) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once dirname(__DIR__) . '/libs/phpmailer/Exception.php'; | |
| require_once dirname(__DIR__) . '/libs/phpmailer/PHPMailer.php'; | |
| require_once dirname(__DIR__) . '/libs/phpmailer/SMTP.php'; | |
| class Mail | |
| { | |
| /** | |
| * Mail sender with PHPMailer library | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function pagination($total, $page, $limit, $query) | |
| { | |
| $total = !is_numeric($total) ? 0 : (int) $total; | |
| $page = !is_numeric($page) ? 1 : (int) $page; | |
| $limit = !is_numeric($limit) ? 25 : (int) $limit; | |
| $total = (int) $total; | |
| // query limit start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // folder path and | |
| // limits of selected files, *.* = all files | |
| $folder = 'upload/profiles/2018-11/*.*'; | |
| // searched extensions | |
| $ext_array = ['gif','jpg','jpeg','png']; | |
| // get all files | |
| $files = glob($folder); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /*--------------------- CKEditor ----------------- START */ | |
| // CKEditor content prepare to database add process | |
| public function CKEditorContentPrepare($content) | |
| { | |
| $content = trim($content); | |
| $content = stripslashes($content); | |
| $content = htmlspecialchars($content); | |
| return $content; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Disk | |
| { | |
| /** | |
| * Returns detailed disk usage info | |
| * | |
| * @param string $dir target directory (default is root dir) | |
| * @see http://php.net/manual/tr/function.disk-total-space.php | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // url based folder parser | |
| public function folderParser(){ | |
| // get current protocol | |
| $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http"; | |
| // build current full url | |
| $requesturl = "{$protocol}://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; | |
| // parse request url with protocol | |
| preg_match("/(https?:\/\/)(www.)?([a-z-_]+\.)?([a-z-_]+)(\.[a-z]{0,10})(\/)(.+)/", $requesturl, $allMatchs); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ProductsListView.ItemsSource = null; | |
| const string connSTring = "Data Source=example.db; Version=3;"; | |
| using (var conn = new SQLiteConnection(connSTring)) | |
| { | |
| conn.Open(); | |
| using (var comm = new SQLiteCommand(conn)) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Reversing class | |
| /// </summary> | |
| public static class ReversingClass | |
| { | |
| /// <summary> | |
| /// String.Format reverser | |
| /// </summary> | |
| /// <param name="string">string value</param> | |
| /// <param name="template">format template</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void CreateFileaAndWrite() | |
| { | |
| // get path | |
| string filepath = @"textfile.txt"; | |
| // open or create file | |
| FileStream streamfile = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.Write); | |
| // create stream writer | |
| StreamWriter streamwrite = new StreamWriter(streamfile); | |
| // add some lines | |
| streamwrite.WriteLine("Forbidden speak in this line."); |