Skip to content

Commit

Permalink
more yoast compat
Browse files Browse the repository at this point in the history
  • Loading branch information
tobeyadr committed Nov 18, 2024
1 parent 6b97f97 commit c339383
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 31 deletions.
6 changes: 3 additions & 3 deletions holler-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: HollerBox
* Plugin URI: https://hollerwp.com
* Description: Powerful Popups & Lead Generation for Small Businesses & Agencies using WordPress
* Version: 2.3.7
* Version: 2.3.8
* Author: Groundhogg Inc.
* Author URI: https://groundhogg.io
* Text Domain: holler-box
Expand All @@ -19,7 +19,7 @@
exit;
}

define( 'HOLLERBOX_VERSION', '2.3.7' );
define( 'HOLLERBOX_VERSION', '2.3.8' );

if ( ! class_exists( 'Holler_Box' ) ) {

Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct() {
$this->load_textdomain();
$this->hooks();

new Holler_Admin();
Holler_Admin::instance();
new Holler_Api();
new Holler_Frontend();
new Holler_Telemetry();
Expand Down
71 changes: 45 additions & 26 deletions includes/class-holler-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Holler_Admin {
* Get active instance
*
* @access public
* @return self self::$instance The one true Holler_Admin
* @since 0.2.0
* @return self self::$instance The one true Holler_Admin
*/
public static function instance() {
if ( ! self::$instance ) {
Expand All @@ -50,16 +50,19 @@ public function __construct() {
* Run action and filter hooks
*
* @access private
* @since 0.2.0
* @return void
*
*
* @since 0.2.0
*/
private function hooks() {

// Thou shall not pass Yoast!
$this->disable_yoast_seo_on_edit_screen();

add_filter( 'replace_editor', [ $this, 'replace_editor' ], 99, 2 );

add_action( 'admin_action_hollerbox_export', [ $this, 'export_popup' ] );
add_action( 'admin_action_hollerbox_export', [ $this, 'export_popup' ] );
add_action( 'admin_action_hollerbox_duplicate', [ $this, 'duplicate_popup' ] );

add_action( 'admin_menu', [ $this, 'register_admin_pages' ] );
Expand Down Expand Up @@ -164,20 +167,20 @@ public function admin_user( $user ) {
}, $converted );

?>
<h2><?php _e( 'HollerBox' ) ?></h2>
<table class="form-table">
<tr>
<th><?php _e( 'Closed popups', 'holler-box' ); ?></th>
<td><?php echo implode( ', ', $closed ) ?></td>
</tr>
<tr>
<th><?php _e( 'Converted popups', 'holler-box' ); ?></th>
<td><?php echo implode( ', ', $converted ) ?></td>
</tr>
</table>
<p>
<a href="<?php echo esc_url( wp_nonce_url( $_SERVER['REQUEST_URI'], self::CLEAR_CACHE_NONCE, 'holler_clear_cache_single_user' ) ) ?>"
class="button button-secondary"><?php _e( 'Clear user cache' ); ?></a></p>
<h2><?php _e( 'HollerBox' ) ?></h2>
<table class="form-table">
<tr>
<th><?php _e( 'Closed popups', 'holler-box' ); ?></th>
<td><?php echo implode( ', ', $closed ) ?></td>
</tr>
<tr>
<th><?php _e( 'Converted popups', 'holler-box' ); ?></th>
<td><?php echo implode( ', ', $converted ) ?></td>
</tr>
</table>
<p>
<a href="<?php echo esc_url( wp_nonce_url( $_SERVER['REQUEST_URI'], self::CLEAR_CACHE_NONCE, 'holler_clear_cache_single_user' ) ) ?>"
class="button button-secondary"><?php _e( 'Clear user cache' ); ?></a></p>
<?php


Expand Down Expand Up @@ -299,7 +302,7 @@ public function register_admin_pages() {
*/
public function settings_page() {
?>
<div id="holler-app"></div><?php
<div id="holler-app"></div><?php
}

/**
Expand All @@ -310,7 +313,7 @@ public function settings_page() {
public function reports_page() {

?>
<div id="holler-app"></div><?php
<div id="holler-app"></div><?php
}

/**
Expand All @@ -326,7 +329,7 @@ public function builder_scripts() {

$groundhogg_installed = defined( 'GROUNDHOGG_VERSION' );

if ( $groundhogg_installed && function_exists( 'Groundhogg\enqueue_filter_assets' ) ){
if ( $groundhogg_installed && function_exists( 'Groundhogg\enqueue_filter_assets' ) ) {
\Groundhogg\enqueue_filter_assets();
}

Expand Down Expand Up @@ -440,20 +443,36 @@ public function replace_editor( $bool, $post ) {
}

/**
* Ensure we only output the stuff we need once.
* Yoast is being bad, so lets fix that.
*
* @return void
*/
public function maybe_render_builder() {
public function disable_yoast_seo_on_edit_screen() {

// only output once
if ( has_action( 'in_admin_footer', [ $this, 'builder_scripts' ] ) ){
if ( ! class_exists( 'WPSEO_Post_Type' ) ){
return;
}

$this->render_builder();
if ( WPSEO_Post_Type::has_metabox_enabled( 'hollerbox' ) ){
WPSEO_Options::set( 'display-metabox-pt-hollerbox', false );
}
}

/**
* Ensure we only output the stuff we need once.
*
* @return void
*/
public function maybe_render_builder() {

// only output once
if ( has_action( 'in_admin_footer', [ $this, 'builder_scripts' ] ) ) {
return;
}

$this->render_builder();
}

/**
* Output HTML to for the builder
*
Expand All @@ -470,7 +489,7 @@ public function render_builder() {

?>
<div id="holler-app"></div>
<?php
<?php
}

/**
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Contributors: trainingbusinesspros, groundhogg
Tags: popups, optin, popup, email, marketing
Requires at least: 5.0
Tested up to: 6.5
Stable tag: 2.3.7
Tested up to: 6.7
Stable tag: 2.3.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -231,6 +231,9 @@ You can purchase a premium plan for access to support and our premium extensions

== Changelog ==

= 2.3.8 (2024-11-18) =
* FIXED Conflict with Yoast SEO Premium.

= 2.3.7 (2024-05-13) =
* TWEAKED When the notification popups are closed they remain in the closed state on subsequent pages.
* TWEAKED Replacements will now also work in the email subject line and not just the content.
Expand Down

0 comments on commit c339383

Please sign in to comment.