Skip to content

Commit cf967cf

Browse files
authored
Merge pull request #4 from udx/develop-alexey
v1.2.2 Remove dependancy from udx/lib-utility package
2 parents f20bc55 + 5a208fc commit cf967cf

File tree

7 files changed

+61
-5
lines changed

7 files changed

+61
-5
lines changed

changes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### 1.2.2
2+
3+
* Remove dependency from `udx/lib-utility`.

gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Build Plugin.
33
*
44
* @author potanin@UD
5-
* @version 1.2.1
5+
* @version 1.2.2
66
* @param grunt
77
*/
88
module.exports = function( grunt ) {

lib/classes/class-admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function process_request () {
283283
$status = 'true';
284284
}
285285

286-
$redirect_url = \UsabilityDynamics\Utility::current_url( array( 'type' => urlencode( $type ), 'status' => urlencode( $status ) ), array( 'action', 'filepath', '_wpnonce' ) );
286+
$redirect_url = Utility::current_url( array( 'type' => urlencode( $type ), 'status' => urlencode( $status ) ), array( 'action', 'filepath', '_wpnonce' ) );
287287
wp_safe_redirect( $redirect_url );
288288
exit;
289289
}

lib/classes/class-bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Bootstrap extends Scaffold {
1818
/**
1919
*
2020
*/
21-
public static $version = '1.2.1';
21+
public static $version = '1.2.2';
2222

2323
/**
2424
*

lib/classes/class-licenses-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function column_product_version ( $item ) {
138138
public function column_product_status ( $item ) {
139139
$response = '';
140140
if ( 'active' == $item['product_status'] ) {
141-
$deactivate_url = wp_nonce_url(\UsabilityDynamics\Utility::current_url( array(
141+
$deactivate_url = wp_nonce_url(Utility::current_url( array(
142142
'action' => 'deactivate-product',
143143
'filepath' => urlencode( $item['product_file_path'] ),
144144
) ), 'bulk-licenses' );

lib/classes/class-utility.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Screen UI
4+
*
5+
* @namespace UsabilityDynamics
6+
*
7+
*/
8+
namespace UsabilityDynamics\UD_API {
9+
10+
if( !class_exists( 'UsabilityDynamics\UD_API\Utility' ) ) {
11+
12+
/**
13+
*
14+
* @author: peshkov@UD
15+
*/
16+
class Utility {
17+
18+
19+
/**
20+
* Returns current url
21+
*
22+
* @param mixed $args GET args which should be added to url
23+
* @param mixed $except_args GET args which will be removed from URL if they exist
24+
*
25+
* @return string
26+
* @author peshkov@UD
27+
*/
28+
static public function current_url( $args = array(), $except_args = array() ) {
29+
$url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ];
30+
31+
$args = wp_parse_args( $args );
32+
$except_args = wp_parse_args( $except_args );
33+
34+
if( !empty( $args ) ) {
35+
foreach( (array) $args as $k => $v ) {
36+
if( is_string( $v ) ) $url = add_query_arg( $k, $v, $url );
37+
}
38+
}
39+
40+
if( !empty( $except_args ) ) {
41+
foreach( (array) $except_args as $arg ) {
42+
if( is_string( $arg ) ) $url = remove_query_arg( $arg, $url );
43+
}
44+
}
45+
46+
return $url;
47+
}
48+
49+
}
50+
51+
}
52+
53+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lib-ud-api-client",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "UD Client for WooCommerce API Manager",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)