Skip to content

Commit

Permalink
change copyright info
Browse files Browse the repository at this point in the history
  • Loading branch information
PutraSudaryanto committed Jul 5, 2018
1 parent a4c2e8c commit a52862a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FileTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Putra Sudaryanto <[email protected]>
* @contact (+62)856-299-4114
* @copyright Copyright (c) 2018 Ommu Platform (opensource.ommu.co)
* @copyright Copyright (c) 2018 Ommu Platform (www.ommu.co)
* @created date 17 April 2018, 08:36 WIB
* @link https://github.com/ommu/yii-traits
*
Expand Down
2 changes: 1 addition & 1 deletion GridViewTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Putra Sudaryanto <[email protected]>
* @contact (+62)856-299-4114
* @copyright Copyright (c) 2018 Ommu Platform (opensource.ommu.co)
* @copyright Copyright (c) 2018 Ommu Platform (www.ommu.co)
* @created date 17 April 2018, 08:36 WIB
* @link https://github.com/ommu/yii-traits
*
Expand Down
31 changes: 29 additions & 2 deletions UtilityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Putra Sudaryanto <[email protected]>
* @contact (+62)856-299-4114
* @copyright Copyright (c) 2018 Ommu Platform (opensource.ommu.co)
* @copyright Copyright (c) 2018 Ommu Platform (www.ommu.co)
* @created date 12 May 2018, 22:47 WIB
* @link https://github.com/ommu/yii-traits
*
Expand Down Expand Up @@ -79,7 +79,7 @@ public function flashMessage($message, $class='success')
/**
* User salt codes
*/
public static function uniqueCode($length=32, $str=2)
public function uniqueCode($length=32, $str=2)
{
$chars = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
srand((double)microtime()*time());
Expand All @@ -95,4 +95,31 @@ public static function uniqueCode($length=32, $str=2)

return $salt;
}

/**
* get License
*/
public function getLicense($source='1234567890', $length=16, $char=4)
{
$mod = $length%$char;
if($mod == 0)
$sep = ($length/$char);
else
$sep = (int)($length/$char)+1;

$sourceLength = strlen($source);
$random = '';
for ($i = 0; $i < $length; $i++)
$random .= $source[rand(0, $sourceLength - 1)];

$license = '';
for ($i = 0; $i < $sep; $i++) {
if($i != $sep-1)
$license .= substr($random,($i*$char),$char).'-';
else
$license .= substr($random,($i*$char),$char);
}

return $license;
}
}

0 comments on commit a52862a

Please sign in to comment.