Skip to content

Commit 9b45de0

Browse files
author
Suresh Chand
committed
Noscript Added
1 parent 2caf4bf commit 9b45de0

File tree

10 files changed

+101
-19
lines changed

10 files changed

+101
-19
lines changed

.DS_Store

6 KB
Binary file not shown.

chp-adsblocker-detector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: CHP Ads Block Detector
55
* Plugin URI: https://chpadblock.com
66
* Description: CHP Ads Block Detector plugin is developed in order to detect most of the AdBlock extensions installed on the browser and show a popup to disable the extension. This plugin restricts the user to access the page unless the user will disable the extension for your website.
7-
* Version: 4.0
7+
* Version: 4.0.1
88
* Requires at least: 5.2
99
* Requires PHP: 7.2
1010
* Tested up to: 6.4.1

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scthakuri12a/chp-ads-block-detector",
3-
"version": "4.0",
3+
"version": "4.0.1",
44
"description": "Block Ads Blocker Extensions and Increase your revenue by using Ads Blocker Detector Plugin",
55
"homepage": "https://wordpress.org/plugins/chp-ads-block-detector/",
66
"type": "project",

includes/functions.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ function defaults(){
6060
'hidemobile' => false,
6161
'branding' => 'yes',
6262
"minify" => true,
63-
"header" => false
63+
"header" => false,
64+
"noscript" => true
6465
);
6566
}
6667

@@ -134,4 +135,20 @@ function minify_html_code($buffer){
134135
$buffer = str_replace( array( 'http://', 'https://' ), '//', $buffer );
135136

136137
return $buffer;
138+
}
139+
140+
function getBrandingCode($enable=true){
141+
if( filter_var($enable, FILTER_VALIDATE_BOOLEAN) ){
142+
143+
$rclass = \CHPADB\Includes\adbClass('scripts');
144+
145+
$brandingURLArray = array("https://chpadblock.com/", "https://toolkitspro.com");
146+
$brandingURLAlt = array("Best Wordpress Adblock Detecting Plugin | CHP Adblock", "100% Free SEO Tools - Tool Kits PRO");
147+
$random = array_rand($brandingURLArray);
148+
$brandingURL = $brandingURLArray[$random];
149+
$brandingText = $brandingURLAlt[$random];
150+
return sprintf('<div class="%s"><a id="%s" href="%s" target="_blank" rel="noopener noreferrer"><span class="%s" style="color: rgb(9, 13, 22);">Powered By</span> <div class="%s"><img src="%sassets/img/d.svg" alt="%s" /></div></a></div>', $rclass->rclass("chp_branding"), $rclass->rclass("chp_branding"), $brandingURL, $rclass->rclass("powered_by"), $rclass->rclass("chp_brading_svg"), CHP_ADSB_URL, $brandingText);
151+
}
152+
153+
return false;
137154
}

includes/scripts.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
class scripts extends \CHPADB\adb{
1919

2020
private $minify = true;
21+
private $settings;
2122

2223

2324
/**
@@ -82,7 +83,7 @@ public function minify($content){
8283
return $content;
8384
}
8485

85-
private function rclass($class){
86+
public function rclass($class){
8687
return \CHPADB\Includes\adbClass("randomClass")->generate_class($class);
8788
}
8889

@@ -106,10 +107,13 @@ public function css( ){
106107
}
107108

108109
public function js(){
109-
110+
global $wp;
110111
//Check Whether plugin is active
111112
if( filter_var( @$this->settings->enable, FILTER_VALIDATE_BOOLEAN ) ){
112113

114+
$branding = apply_filters('adb/branding', @$this->settings->branding);
115+
$brandingcode = getBrandingCode($branding);
116+
113117
$iconAlernativeFile = CHP_ADSB_URL . 'assets/img/icon.png';
114118
$iconAlernativeFile = apply_filters( 'adb/change/icon', $iconAlernativeFile );
115119
$iconAlernativeAlt = apply_filters( 'adb/change/icon/alt', 'Ads Blocker Image Powered by Code Help Pro' );
@@ -125,6 +129,13 @@ public function js(){
125129
$content = ob_get_clean();
126130
echo \CHPADB\Includes\minify_html_code($content);
127131
}
132+
133+
/** Add Noscript tag */
134+
if( filter_var( @$this->settings->noscript, FILTER_VALIDATE_BOOLEAN ) ){
135+
ob_start();
136+
require_once CHP_ADSB_DIR . 'view/noscript.php';;
137+
echo ob_get_clean();
138+
}
128139
}
129140
}
130141

readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ This section describes how to install the plugin and get it working.
108108

109109
**CHANGELOG**
110110

111+
> ### v4.0.1 (017/01/2024)
112+
>
113+
> - Security Update
114+
> - Noscript supported added since brave browser has block script supports
115+
111116
> ### v4.0 (04/12/2023)
112117
>
113118
> - Security Update

readme.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: sureshchand12a
33
Tags: adsense, adblock, anti-adblock, chpadblock, chp, chp-adblock, adblock-plus, ublock-origin
44
Requires at least: 5.2
5-
Tested up to: 6.2
6-
Stable tag: 3.9.8
5+
Tested up to: 6.4.1
6+
Stable tag: 4.0.1
77
Requires PHP: 7.2
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -136,6 +136,10 @@ Yes, For this you have to purchase the premium version of Ads Block Detector. An
136136

137137
== Changelog ==
138138

139+
= 4.0.1 =
140+
* ☞ Security Update
141+
* ☞ Noscript supported added since brave browser has block script supports
142+
139143
= 4.0 =
140144
* ☞ Security Update
141145
* ☞ Compatible with WP 6.4.1

view/footer_part.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@
77
*/
88
$debug = apply_filters('adb/debug/js', false);
99
$onPageFullyLoaded = apply_filters('adb/onpageload', true);
10-
11-
$branding = apply_filters('adb/branding', @$this->settings->branding);
12-
13-
$brandingcode = '';
14-
if( filter_var($branding, FILTER_VALIDATE_BOOLEAN) ){
15-
$brandingURLArray = array("https://chpadblock.com/", "https://toolkitspro.com");
16-
$brandingURLAlt = array("Best Wordpress Adblock Detecting Plugin | CHP Adblock", "100% Free SEO Tools - Tool Kits PRO");
17-
$random = array_rand($brandingURLArray);
18-
$brandingURL = $brandingURLArray[$random];
19-
$brandingText = $brandingURLAlt[$random];
20-
$brandingcode = sprintf('<div class="%s"><a id="%s" href="%s" target="_blank" rel="noopener noreferrer"><span class="%s" style="color: rgb(9, 13, 22);">Powered By</span> <div class="%s"><img src="%sassets/img/d.svg" alt="%s" /></div></a></div>', $this->rclass("chp_branding"), $this->rclass("chp_branding"), $brandingURL, $this->rclass("powered_by"), $this->rclass("chp_brading_svg"), CHP_ADSB_URL, $brandingText);
21-
}
2210
?>
2311

2412
<div id="<?php echo esc_attr($this->rclass("modal")); ?>" class="<?php echo esc_attr($this->rclass("modal")); ?>">

view/noscript.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<noscript>
2+
<div class="<?php echo esc_attr($this->rclass("modal")); ?> <?php echo esc_attr($this->rclass("show")); ?>">
3+
<div class="<?php echo esc_attr($this->rclass("content")); ?> <?php echo esc_attr($this->rclass('fadeInDown')); ?>">
4+
<div class="<?php echo esc_attr($this->rclass("body")); ?>" id="<?php echo esc_attr($this->rclass("body")); ?>">
5+
<div class="<?php echo esc_attr($this->rclass("theme")); ?> theme1">
6+
<div class="<?php echo esc_attr($this->rclass("body")); ?>">
7+
8+
<div class="<?php echo esc_attr($this->rclass("wrapper")); ?>">
9+
<?php
10+
/**
11+
* Get icon html
12+
*
13+
* @since 5.1.0
14+
*/
15+
echo wp_kses($iconCode, array(
16+
"img" => array(
17+
"src" => array(),
18+
"alt" => array(),
19+
"class" => array()
20+
)
21+
));
22+
?>
23+
</div>
24+
25+
<h4 class="adblock_title"><?php echo esc_html(@$this->settings->title); ?></h4>
26+
<div class="adblock_subtitle"><?php echo wp_kses_post(@$this->settings->content); ?></div>
27+
28+
29+
<div class="<?php esc_attr($this->rclass("action")); ?>">
30+
<?php if( wp_validate_boolean( @$this->settings->btn1_show ) ): ?>
31+
<a class="<?php echo esc_attr($this->rclass("action-btn-ok")); ?>" href="<?php echo add_query_arg( $wp->query_vars, home_url( $wp->request ) ); ?>"><?php echo esc_attr(@$this->settings->btn1_text); ?></a>
32+
<?php endif; ?>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</div>
38+
39+
<?php echo $brandingcode; ?>
40+
</div>
41+
<noscript>

view/settings.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ class="hamrocsit_adb_nav-tab pro"><?php esc_attr_e('Check Pro Version', 'chp-ads
4444
</label>
4545
</td>
4646
</tr>
47+
48+
<tr>
49+
<td>
50+
<?php esc_attr_e('Enable Noscript', 'chp-adsblocker-detector'); ?>
51+
</td>
52+
<td>
53+
<label class="checkbox_container">
54+
<input type="checkbox"
55+
<?php echo filter_var(@$settings->noscript, FILTER_VALIDATE_BOOLEAN) ? 'checked' : null; ?>
56+
name="noscript" class="chpabd_form_settings include">
57+
<span class="checkmark"></span>
58+
</label>
59+
</td>
60+
</tr>
61+
62+
4763
<tr>
4864
<td>
4965
<?php esc_attr_e('Title', 'chp-adsblocker-detector'); ?>

0 commit comments

Comments
 (0)