Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nhymxu committed Dec 12, 2017
2 parents b74b4ee + 4884976 commit 0a17e15
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
38 changes: 34 additions & 4 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ public function admin_page_callback_settings() {

echo '<h1>Cập nhật thành công</h1><br>';
}
$option = get_option('nhymxu_at_coupon', ['uid' => '', 'utmsource' => '']);
$option = get_option('nhymxu_at_coupon', ['uid' => '', 'accesskey' => '', 'utmsource' => '']);
$uid = (isset($option['uid'])) ? $option['uid'] : '';
if( defined('NHYMXU_MARS_VERSION') && $uid == '' ) {
$uid = get_option('accesstrade_userid');
$option['uid'] = $uid;
update_option('nhymxu_at_coupon', $option);
}
?>
<script type="text/javascript">
function nhymxu_force_update_coupons() {
Expand Down Expand Up @@ -235,7 +241,7 @@ function nhymxu_force_update_merchants() {
<div>
<h2>Cài đặt ACCESSTRADE Coupon</h2>
<br>
<?php if( !isset($option['uid'], $option['accesskey']) ): ?>
<?php if( !isset($option['uid'], $option['accesskey']) || $option['uid'] == '' || $option['accesskey'] == '' ): ?>
<h3>Bạn cần nhập ACCESSTRADE ID và Access Key để plugin hoạt động tốt.</h3>
<br>
<?php endif; ?>
Expand All @@ -244,7 +250,7 @@ function nhymxu_force_update_merchants() {
<table>
<tr>
<td>ACCESSTRADE ID*:</td>
<td><input type="text" name="nhymxu_at_coupon_uid" value="<?=(isset($option['uid'])) ? $option['uid'] : '';?>"></td>
<td><input type="text" name="nhymxu_at_coupon_uid" value="<?=$uid;?>" <?=( defined('NHYMXU_MARS_VERSION') ) ? 'disabled' : '';?>></td>
</tr>
<tr>
<td></td>
Expand Down Expand Up @@ -359,6 +365,10 @@ public function admin_page_callback_addnew() {
display: inline-block;
min-width: 250px;
}
#nhymxu_coupon_notice {
margin-top: 20px;
margin-bottom: 20px;
}
</style>
<script type="text/javascript">
/*
Expand Down Expand Up @@ -406,7 +416,27 @@ function nhymxu_coupon_exec( action_type ) {
if( input['save'].length > 5 ) {
nhymxu_insert_log('Mức giảm giá phải dưới 6 kí tự.');
return false;
}
}

if( input['title'].length > 100 ) {
nhymxu_insert_log('Tiêu đề phải dưới 100 kí tự.');
return false;
}

if( input['note'].length > 100 ) {
nhymxu_insert_log('Ghi chú phải dưới 100 kí tự.');
return false;
}

if( input['url'].indexOf('http://') < 0 && input['url'].indexOf('https://') < 0 ) {
nhymxu_insert_log('Link phải bắt đầu bằng http:// hoặc https://');
return false;
}

if( input['url'].indexOf('pub.accesstrade.vn') > 0 || input['url'].indexOf('fast.accesstrade.com.vn') > 0 ) {
nhymxu_insert_log('Không được điền deeplink AccessTrade ở đây.');
return false;
}

function exec_after_success() {
if( action_type === 0 ) {
Expand Down
4 changes: 2 additions & 2 deletions nhymxu-at-coupon-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
Plugin URI: http://github.com/nhymxu/accesstrade-coupon-pro
Description: Pro version for ACCESSTRADE coupon
Author: Dũng Nguyễn (nhymxu)
Version: 0.1.0
Version: 0.1.1
Author URI: http://dungnt.net
*/

defined( 'ABSPATH' ) || die;
define('NHYMXU_AT_COUPON_PRO_VER', "0.1.0");
define('NHYMXU_AT_COUPON_PRO_VER', "0.1.1");

date_default_timezone_set('Asia/Ho_Chi_Minh');

Expand Down

0 comments on commit 0a17e15

Please sign in to comment.