Created
September 12, 2019 15:06
-
-
Save wpmudev-sls/b77ca90447253cbb29b4ee7be8039388 to your computer and use it in GitHub Desktop.
[Hustle] - Add form support to pop-up main content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: [Hustle] - Add form support to pop-up main content | |
* Plugin URI: https://premium.wpmudev.org/ | |
* Description: Extend existing functionality of Hustle to allow form elements in main content (as of 4.0.2) | |
* Author: Alessandro Kaounas @ WPMUDEV | |
* Author URI: https://premium.wpmudev.org/ | |
* License: GPLv2 or later | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
if ( ! class_exists( 'WPMUDEV_Hustle_Form_Elements' ) ) { | |
class WPMUDEV_Hustle_Form_Elements { | |
private static $_instance = null; | |
public static function get_instance() { | |
if( is_null( self::$_instance ) ){ | |
self::$_instance = new WPMUDEV_Hustle_Form_Elements(); | |
} | |
return self::$_instance; | |
} | |
private function __construct() { | |
$this->init(); | |
} | |
private function init(){ | |
add_filter( 'hustle_module_main_content_allowed_html', array( $this, 'wpmudev_hustle_module_main_content_allowed_html' ), 10, 2 ); | |
} | |
public function wpmudev_hustle_module_main_content_allowed_html( $html, $module ) { | |
$html['form'] = array( | |
'id' => array(), | |
'action' => array(), | |
'method' => array(), | |
'accept-charset' => array(), | |
); | |
return $html; | |
} | |
} | |
if ( ! function_exists( 'WPMUDEV_Hustle_Form_Elements' ) ) { | |
function WPMUDEV_Hustle_Form_Elements() { | |
return WPMUDEV_Hustle_Form_Elements::get_instance(); | |
}; | |
add_action( 'plugins_loaded', 'WPMUDEV_Hustle_Form_Elements', 99 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment