Skip to content

Commit

Permalink
Noscript Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Suresh Chand committed Jan 17, 2024
1 parent 2caf4bf commit 9b45de0
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 19 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion chp-adsblocker-detector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: CHP Ads Block Detector
* Plugin URI: https://chpadblock.com
* 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.
* Version: 4.0
* Version: 4.0.1
* Requires at least: 5.2
* Requires PHP: 7.2
* Tested up to: 6.4.1
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scthakuri12a/chp-ads-block-detector",
"version": "4.0",
"version": "4.0.1",
"description": "Block Ads Blocker Extensions and Increase your revenue by using Ads Blocker Detector Plugin",
"homepage": "https://wordpress.org/plugins/chp-ads-block-detector/",
"type": "project",
Expand Down
19 changes: 18 additions & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function defaults(){
'hidemobile' => false,
'branding' => 'yes',
"minify" => true,
"header" => false
"header" => false,
"noscript" => true
);
}

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

return $buffer;
}

function getBrandingCode($enable=true){
if( filter_var($enable, FILTER_VALIDATE_BOOLEAN) ){

$rclass = \CHPADB\Includes\adbClass('scripts');

$brandingURLArray = array("https://chpadblock.com/", "https://toolkitspro.com");
$brandingURLAlt = array("Best Wordpress Adblock Detecting Plugin | CHP Adblock", "100% Free SEO Tools - Tool Kits PRO");
$random = array_rand($brandingURLArray);
$brandingURL = $brandingURLArray[$random];
$brandingText = $brandingURLAlt[$random];
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);
}

return false;
}
15 changes: 13 additions & 2 deletions includes/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class scripts extends \CHPADB\adb{

private $minify = true;
private $settings;


/**
Expand Down Expand Up @@ -82,7 +83,7 @@ public function minify($content){
return $content;
}

private function rclass($class){
public function rclass($class){
return \CHPADB\Includes\adbClass("randomClass")->generate_class($class);
}

Expand All @@ -106,10 +107,13 @@ public function css( ){
}

public function js(){

global $wp;
//Check Whether plugin is active
if( filter_var( @$this->settings->enable, FILTER_VALIDATE_BOOLEAN ) ){

$branding = apply_filters('adb/branding', @$this->settings->branding);
$brandingcode = getBrandingCode($branding);

$iconAlernativeFile = CHP_ADSB_URL . 'assets/img/icon.png';
$iconAlernativeFile = apply_filters( 'adb/change/icon', $iconAlernativeFile );
$iconAlernativeAlt = apply_filters( 'adb/change/icon/alt', 'Ads Blocker Image Powered by Code Help Pro' );
Expand All @@ -125,6 +129,13 @@ public function js(){
$content = ob_get_clean();
echo \CHPADB\Includes\minify_html_code($content);
}

/** Add Noscript tag */
if( filter_var( @$this->settings->noscript, FILTER_VALIDATE_BOOLEAN ) ){
ob_start();
require_once CHP_ADSB_DIR . 'view/noscript.php';;
echo ob_get_clean();
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ This section describes how to install the plugin and get it working.

**CHANGELOG**

> ### v4.0.1 (017/01/2024)
>
> - Security Update
> - Noscript supported added since brave browser has block script supports
> ### v4.0 (04/12/2023)
>
> - Security Update
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: sureshchand12a
Tags: adsense, adblock, anti-adblock, chpadblock, chp, chp-adblock, adblock-plus, ublock-origin
Requires at least: 5.2
Tested up to: 6.2
Stable tag: 3.9.8
Tested up to: 6.4.1
Stable tag: 4.0.1
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -136,6 +136,10 @@ Yes, For this you have to purchase the premium version of Ads Block Detector. An

== Changelog ==

= 4.0.1 =
* ☞ Security Update
* ☞ Noscript supported added since brave browser has block script supports

= 4.0 =
* ☞ Security Update
* ☞ Compatible with WP 6.4.1
Expand Down
12 changes: 0 additions & 12 deletions view/footer_part.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@
*/
$debug = apply_filters('adb/debug/js', false);
$onPageFullyLoaded = apply_filters('adb/onpageload', true);

$branding = apply_filters('adb/branding', @$this->settings->branding);

$brandingcode = '';
if( filter_var($branding, FILTER_VALIDATE_BOOLEAN) ){
$brandingURLArray = array("https://chpadblock.com/", "https://toolkitspro.com");
$brandingURLAlt = array("Best Wordpress Adblock Detecting Plugin | CHP Adblock", "100% Free SEO Tools - Tool Kits PRO");
$random = array_rand($brandingURLArray);
$brandingURL = $brandingURLArray[$random];
$brandingText = $brandingURLAlt[$random];
$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);
}
?>

<div id="<?php echo esc_attr($this->rclass("modal")); ?>" class="<?php echo esc_attr($this->rclass("modal")); ?>">
Expand Down
41 changes: 41 additions & 0 deletions view/noscript.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<noscript>
<div class="<?php echo esc_attr($this->rclass("modal")); ?> <?php echo esc_attr($this->rclass("show")); ?>">
<div class="<?php echo esc_attr($this->rclass("content")); ?> <?php echo esc_attr($this->rclass('fadeInDown')); ?>">
<div class="<?php echo esc_attr($this->rclass("body")); ?>" id="<?php echo esc_attr($this->rclass("body")); ?>">
<div class="<?php echo esc_attr($this->rclass("theme")); ?> theme1">
<div class="<?php echo esc_attr($this->rclass("body")); ?>">

<div class="<?php echo esc_attr($this->rclass("wrapper")); ?>">
<?php
/**
* Get icon html
*
* @since 5.1.0
*/
echo wp_kses($iconCode, array(
"img" => array(
"src" => array(),
"alt" => array(),
"class" => array()
)
));
?>
</div>

<h4 class="adblock_title"><?php echo esc_html(@$this->settings->title); ?></h4>
<div class="adblock_subtitle"><?php echo wp_kses_post(@$this->settings->content); ?></div>


<div class="<?php esc_attr($this->rclass("action")); ?>">
<?php if( wp_validate_boolean( @$this->settings->btn1_show ) ): ?>
<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>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>

<?php echo $brandingcode; ?>
</div>
<noscript>
16 changes: 16 additions & 0 deletions view/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ class="hamrocsit_adb_nav-tab pro"><?php esc_attr_e('Check Pro Version', 'chp-ads
</label>
</td>
</tr>

<tr>
<td>
<?php esc_attr_e('Enable Noscript', 'chp-adsblocker-detector'); ?>
</td>
<td>
<label class="checkbox_container">
<input type="checkbox"
<?php echo filter_var(@$settings->noscript, FILTER_VALIDATE_BOOLEAN) ? 'checked' : null; ?>
name="noscript" class="chpabd_form_settings include">
<span class="checkmark"></span>
</label>
</td>
</tr>


<tr>
<td>
<?php esc_attr_e('Title', 'chp-adsblocker-detector'); ?>
Expand Down

0 comments on commit 9b45de0

Please sign in to comment.