Skip to content
Snippets Groups Projects
Commit ce6b3827 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Version 1.4: Fix randomString (forgot to move to callback class)

parent 1a6682c0
Branches
Tags V1.4
No related merge requests found
BASE=ordernumber
PLUGINTYPE=vmshopper
VERSION=1.3
VERSION=1.4
PLUGINFILES=$(BASE).php $(BASE).xml index.html
# TRANSDIR=../../../administrator/language/
......
......@@ -20,6 +20,16 @@ class ReplacementCallback {
$this->orderDetails = $orderDetails;
}
/* Return a random "string" of the given length taken from the given alphabet */
static function randomString($alphabet, $len) {
$alen = strlen($alphabet);
$r = "";
for ($n=0; $n<$len; $n++) {
$r .= $alphabet[mt_rand(0, $alen-1)];
}
return $r;
}
function replace ($match) {
$varname = strtolower($match[1]);
switch ($varname) {
......@@ -93,16 +103,6 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
// We don't need this function, but the parent class declares it abstract, so we need to overload
function plgVmOnUpdateOrderBEShopper($_orderID) {}
/* Return a random "string" of the given length taken from the given alphabet */
static function randomString($alphabet, $len) {
$alen = strlen($alphabet);
$r = "";
for ($n=0; $n<$len; $n++) {
$r .= $alphabet[mt_rand(0, $alen-1)];
}
return $r;
}
/* Replace the format variables, match[1] is the variable name, match[2] and match[3] are only used for random fields */
function replace_fields ($fmt, $orderDetails) {
......
......@@ -7,9 +7,9 @@
<authorUrl>http://www.kainhofer.com/</authorUrl>
<copyright>Copyright (C) 2012 Reinhold Kainhofer. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license>
<version>1.3.0</version>
<version>1.4.0</version>
<releaseDate>2012-11-13</releaseDate>
<releaseType>Major update</releaseType>
<releaseType>Minor update</releaseType>
<downloadUrl>http://www.kainhofer.com/virtuemart-2-extensions/</downloadUrl>
<description>VMSHOPPER_ORDERNUMBER_DESC</description>
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment