Skip to content

Commit

Permalink
Merge pull request #157 from codersaiful/3.0.5.0
Browse files Browse the repository at this point in the history
3.0.5.0
  • Loading branch information
codersaiful authored Nov 28, 2021
2 parents 3fff6c9 + 01d84b1 commit a35837c
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 213 deletions.
25 changes: 25 additions & 0 deletions admin/action-hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,31 @@ function wpt_configure_basic_part( $settings,$current_config_value,$field_name )
</td>
</tr>



<tr>
<th>
<label class="wpt_label wpt_user_rating_notice" for="wpt_table_head_enable"><?php esc_html_e( 'Disable Rating Notice', 'wpt_pro' );?></label>
</th>
<td>
<label class="switch">
<input name="data[disable_rating_notice]" type="checkbox" id="wpt_user_rating_notice" <?php echo isset( $current_config_value['disable_rating_notice'] ) ? 'checked="checked"' : ''; ?>>
<div class="slider round"><!--ADDED HTML -->
<span class="on">On</span><span class="off">Off</span><!--END-->
</div>
</label>
<?php if( isset( $current_config_value['disable_rating_notice'] ) ){

wpt_admin_notice_html_markup( 'wpt-notice wpt-user-rating-notice', false );
}else{ ?>
<p><?php echo esc_html( 'To disable permanently user notice for all page.', 'wpt_pro' ); ?></p>
<?php } ?>
</td>
</tr>




<tr>
<th><label class="wpt_label" for="wpt_table_custom_add_to_cart"><?php esc_html_e( 'Add to Cart Icon', 'wpt_pro' ); ?></label></th>
<td>
Expand Down
28 changes: 27 additions & 1 deletion admin/functions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
<?php


function wpt_admin_notice_html_markup( $wrapper_class = "notice notice-success is-dismissible wpt-notice wpt-user-rating-notice", $other_links = true ){
?>
<div class="<?php echo esc_attr( $wrapper_class ); ?>">
<p>
<?php
// var_dump(date('s:h d M, Y', get_option( 'wpt_user_rating_notice' )));
// var_dump(date('s:h d M, Y', time()));
?>
Hey, we noticed you've been using <strong>Product Table for WooCommerce(wooproducttable)</strong> for a long time - that's awesome.<br>
Could you please do us a <strong>BIG Favor</strong> and give it a rating on WordPress.org to help us spread the word and boost our motivation?
</p>
<p>
<strong>Saiful Islam</strong><br>
Author of Woo Product Table<br>
<strong>CEO</strong> of CodeAstrology
</p>
<p class="do-rating-area">
<a class="" data-response='rating' href="https://wordpress.org/support/plugin/woo-product-table/reviews/#new-post" target="_blank"><strong>Yes, you deserve it</strong></a>
<?php if($other_links){ ?>
<br>
<a data-response='rating-later'>No, May be later</a><br>
<a data-response='rating-already'>I already did</a>
<?php } ?>
</p>
</div>
<?php
}

if( !function_exists( 'wpt_admin_body_class' ) ){
/**
Expand Down
42 changes: 15 additions & 27 deletions admin/notice/notice-loader.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
<?php

//update_option('wpt_user_rating_notice',0);//get_option( 'wpt_user_rating_notice' )
add_action( 'admin_notices', 'wpt_admin_notice_user_rating_rq' );
function wpt_admin_notice_user_rating_rq(){

if( ! wpt_admin_notice_display() ){
return;
}
?>
<div class="notice notice-success is-dismissible wpt-notice wpt-user-rating-notice">
<p>
<?php
// var_dump(date('s:h d M, Y', get_option( 'wpt_user_rating_notice' )));
// var_dump(date('s:h d M, Y', time()));
?>
Hey, we noticed you've been using <strong>Product Table for WooCommerce(wooproducttable)</strong> for a long time - that's awesome.<br>
Could you please do us a <strong>BIG Favor</strong> and give it a rating on WordPress.org to help us spread the word and boost our motivation?
</p>
<p>
<strong>Saiful Islam</strong><br>
Author of Woo Product Table<br>
<strong>CEO</strong> of CodeAstrology
</p>
<p class="do-rating-area">
<a class="" data-response='rating' href="https://wordpress.org/support/plugin/woo-product-table/reviews/#new-post" target="_blank"><strong>Yes, you deserve it</strong></a><br>
<a data-response='rating-later'>No, May be later</a><br>
<a data-response='rating-already'>I already did</a>

</p>
</div>
<?php
$config = get_option( 'wpt_configure_options' );//disable_rating_notice
if( isset( $config['disable_rating_notice'] ) && $config['disable_rating_notice'] == 'on' ){
return;
}

echo wpt_admin_notice_html_markup();
}

/**
Expand All @@ -40,19 +23,24 @@ function wpt_admin_notice_user_rating_rq(){
* @by Saiful Islam
*/
function wpt_admin_notice_display( $day = 40){
$bool = true;
$limit_time_sec = $day * 24 * 60 * 60;

$today = time();
$last_close_day = get_option( 'wpt_user_rating_notice' );
if( empty( $last_close_day ) ){
return true;
$bool = true;
}
if( ! is_numeric( $last_close_day ) ){
$last_close_day = 2*24*60*60;
}

$diff = $today - $last_close_day;
// var_dump($limit_time_sec,$diff);
if( $diff < $limit_time_sec){
return false;
$bool = false;
}
return true;
return apply_filters( 'wpto_user_rating_notice', $bool, $last_close_day );
}

/**
Expand Down
101 changes: 0 additions & 101 deletions admin/notice/notice-loader_1.php

This file was deleted.

79 changes: 0 additions & 79 deletions admin/notice/notice-loader_backup.php

This file was deleted.

20 changes: 18 additions & 2 deletions admin/notice/offeres/offer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

let wrapper_class = '.wpt-special-offer';
loadOfferContent();

$(document.body).on('click','h1.wp-heading-inline',function(){
loadContentByAjax();
});

function loadOfferContent(){
let offer_json = getCookie('wpt_offer_latest');
if( offer_json !== '' ){

offer_json = JSON.parse(offer_json);
console.log(offer_json);
jsonToHtmlMarkup(offer_json);

}else if(navigator.onLine){
Expand Down Expand Up @@ -46,6 +49,7 @@
return;
}
let offer = result.offer,
target_function = offer.target_function,
image_url = offer.image_url,
target_link = offer.target_link,
target_html = offer.target_html,
Expand All @@ -70,8 +74,20 @@

let html = `<div class="wpt-special-offer">` + image_link_html + target_html + `</div>`;

if( !target_function ){
target_function = 'prepend'
}

if( target_function === 'prepend' ){
$(location_selector).prepend(html);
}else if(target_function === 'append'){
$(location_selector).append(html);
}else if(target_function === 'html'){
$(location_selector).html(html);
}else{
$(location_selector).prepend(html);
}

$(location_selector).prepend(html);
$(wrapper_class).css(wrapper_css);

if(image_css){
Expand Down
3 changes: 2 additions & 1 deletion admin/notice/offeres/offer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"offer": {
"status": true,
"target_function": "prepend",
"target_link": "https://codecanyon.net/item/woo-product-table-pro/20676867",
"image_url": "https://raw.githubusercontent.com/codersaiful/woo-product-table/3.0.4.2/admin/notice/offeres/images/Black-Friday.png",
"display_to": "#wpbody-content",
"display_wrapper": ".wpt_admin_body",
"target_html": false,
"wrapper_css":{
"color":"green",
"background-color":"#240202"
"background-color":"#ff1b1b"
},
"image_css":{
"height":"210px",
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ You can easily show specific category products. While creating new table click o

== Changelog ==

= 3.0.5 =
* New filter added for user rating option `add_filter('wpto_user_rating_notice','__return_false');`
* User Rating notice disable option in Configure Page. [Dashboard->Product Table -> Configure -> Disable Rating Notice]

= 3.0.4 =
* custom field display issue for variable product

Expand Down
Loading

0 comments on commit a35837c

Please sign in to comment.