Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Advanced Order Numbers for WooCommerce
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WooCommerce
Advanced Order Numbers for WooCommerce
Commits
6e53cb95
Commit
6e53cb95
authored
9 years ago
by
Reinhold Kainhofer
Browse files
Options
Downloads
Patches
Plain Diff
Fix callbacks with PHP 5.3
parent
e64ecb94
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
library/ordernumber_helper.php
+8
-9
8 additions, 9 deletions
library/ordernumber_helper.php
readme.txt
+1
-1
1 addition, 1 deletion
readme.txt
with
10 additions
and
11 deletions
Makefile
+
1
−
1
View file @
6e53cb95
BASE
=
ordernumbers
BASE
=
ordernumbers
PLATTFORM
=
woocommerce
PLATTFORM
=
woocommerce
VENDOR
=
opentools
VENDOR
=
opentools
VERSION
=
1.3.
3
VERSION
=
1.3.
4
DIR
=
$(
shell
pwd
)
DIR
=
$(
shell
pwd
)
SVNDIR
=
wordpress-plugin-svn
SVNDIR
=
wordpress-plugin-svn
...
...
This diff is collapsed.
Click to expand it.
library/ordernumber_helper.php
+
8
−
9
View file @
6e53cb95
...
@@ -16,7 +16,7 @@ function trl($string) {
...
@@ -16,7 +16,7 @@ function trl($string) {
class
OrdernumberHelper
{
class
OrdernumberHelper
{
static
$_version
=
"0.1"
;
static
$_version
=
"0.1"
;
protected
$
_
callbacks
=
array
();
protected
$callbacks
=
array
();
public
$_styles
=
array
(
public
$_styles
=
array
(
'counter-table-class'
=>
"table-striped"
,
'counter-table-class'
=>
"table-striped"
,
'counter-table-style'
=>
""
,
'counter-table-style'
=>
""
,
...
@@ -103,7 +103,7 @@ class OrdernumberHelper {
...
@@ -103,7 +103,7 @@ class OrdernumberHelper {
public
function
__
(
$string
)
{
public
function
__
(
$string
)
{
if
(
isset
(
$this
->
callbacks
[
"translate"
]))
{
if
(
isset
(
$this
->
callbacks
[
"translate"
]))
{
return
$this
->
callbacks
[
"
translate
"
](
$string
);
return
call_user_func_array
(
$this
->
callbacks
[
'
translate
'
],
func_get_args
()
);
}
else
{
}
else
{
return
$string
;
return
$string
;
}
}
...
@@ -142,7 +142,7 @@ class OrdernumberHelper {
...
@@ -142,7 +142,7 @@ class OrdernumberHelper {
public
function
urlPath
(
$type
,
$file
)
{
public
function
urlPath
(
$type
,
$file
)
{
if
(
isset
(
$this
->
callbacks
[
'urlPath'
]))
{
if
(
isset
(
$this
->
callbacks
[
'urlPath'
]))
{
return
$this
->
callbacks
[
'urlPath'
]
(
$type
,
$file
);
return
call_user_func_array
(
$this
->
callbacks
[
'urlPath'
]
,
func_get_args
()
);
}
else
{
}
else
{
throw
new
Exception
(
'No callback defined for urlPath(type, file)!'
);
throw
new
Exception
(
'No callback defined for urlPath(type, file)!'
);
}
}
...
@@ -150,13 +150,13 @@ class OrdernumberHelper {
...
@@ -150,13 +150,13 @@ class OrdernumberHelper {
protected
function
replacementsCallback
(
$func
,
&
$reps
,
$details
,
$nrtype
)
{
protected
function
replacementsCallback
(
$func
,
&
$reps
,
$details
,
$nrtype
)
{
if
(
isset
(
$this
->
callbacks
[
$func
]))
{
if
(
isset
(
$this
->
callbacks
[
$func
]))
{
return
$this
->
callbacks
[
$func
]
(
$reps
,
$details
,
$nrtype
);
return
call_user_func_array
(
$this
->
callbacks
[
$func
]
,
array
(
&
$reps
,
$details
,
$nrtype
)
)
;
}
}
}
}
protected
function
getCounter
(
$type
,
$countername
,
$default
)
{
protected
function
getCounter
(
$type
,
$countername
,
$default
)
{
if
(
isset
(
$this
->
callbacks
[
'getCounter'
]))
{
if
(
isset
(
$this
->
callbacks
[
'getCounter'
]))
{
return
$this
->
callbacks
[
'getCounter'
]
(
$type
,
$countername
,
$default
);
return
call_user_func_array
(
$this
->
callbacks
[
'getCounter'
]
,
func_get_args
()
);
}
else
{
}
else
{
throw
new
Exception
(
'No callback defined for getCounter(type, countername, default)!'
);
throw
new
Exception
(
'No callback defined for getCounter(type, countername, default)!'
);
}
}
...
@@ -164,15 +164,15 @@ class OrdernumberHelper {
...
@@ -164,15 +164,15 @@ class OrdernumberHelper {
protected
function
setCounter
(
$type
,
$countername
,
$value
)
{
protected
function
setCounter
(
$type
,
$countername
,
$value
)
{
if
(
isset
(
$this
->
callbacks
[
'getCounter'
]))
{
if
(
isset
(
$this
->
callbacks
[
'getCounter'
]))
{
return
$this
->
callbacks
[
'
g
etCounter'
]
(
$type
,
$countername
,
$value
);
return
call_user_func_array
(
$this
->
callbacks
[
'
s
etCounter'
]
,
func_get_args
()
);
}
else
{
}
else
{
throw
new
Exception
(
'No callback defined for setCounter(type, countername, value)!'
);
throw
new
Exception
(
'No callback defined for setCounter(type, countername, value)!'
);
}
}
}
}
public
function
getAllCounters
(
$type
)
{
public
function
getAllCounters
(
$type
)
{
if
(
isset
(
$this
->
callbacks
[
'getCounter'
]))
{
if
(
isset
(
$this
->
callbacks
[
'get
All
Counter
s
'
]))
{
return
$this
->
callbacks
[
'getCounter'
]
(
$type
);
return
call_user_func_array
(
$this
->
callbacks
[
'get
All
Counter
s
'
]
,
func_get_args
()
);
}
else
{
}
else
{
throw
new
Exception
(
'No callback defined for getAllCounters(type)!'
);
throw
new
Exception
(
'No callback defined for getAllCounters(type)!'
);
}
}
...
@@ -403,7 +403,6 @@ class OrdernumberHelper {
...
@@ -403,7 +403,6 @@ class OrdernumberHelper {
$format
=
$this
->
doReplacements
(
$format
,
$reps
);
$format
=
$this
->
doReplacements
(
$format
,
$reps
);
$ctrsettings
=
$this
->
extractCounterSettings
(
$format
,
$type
,
$ctrsettings
);
$ctrsettings
=
$this
->
extractCounterSettings
(
$format
,
$type
,
$ctrsettings
);
// JFactory::getApplication()->enqueueMessage("<pre>Replacements for $type:".print_r($reps,1)."</pre>", 'error');
// Increment the counter only if the format contains a placeholder for it!
// Increment the counter only if the format contains a placeholder for it!
if
(
strpos
(
$ctrsettings
[
"${type}_format"
],
"#"
)
!==
false
)
{
if
(
strpos
(
$ctrsettings
[
"${type}_format"
],
"#"
)
!==
false
)
{
$countername
=
$ctrsettings
[
"${type}_counter"
];
$countername
=
$ctrsettings
[
"${type}_counter"
];
...
...
This diff is collapsed.
Click to expand it.
readme.txt
+
1
−
1
View file @
6e53cb95
...
@@ -4,7 +4,7 @@ Contributors: opentools
...
@@ -4,7 +4,7 @@ Contributors: opentools
Tags: WooCommerce, Order numbers, orders
Tags: WooCommerce, Order numbers, orders
Requires at least: 4.0
Requires at least: 4.0
Tested up to: 4.5
Tested up to: 4.5
Stable tag: 1.3.
3
Stable tag: 1.3.
4
License: GPLv3 or later
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl.html
License URI: http://www.gnu.org/licenses/gpl.html
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment