Skip to content

Commit

Permalink
backward compatibility for pro version
Browse files Browse the repository at this point in the history
  • Loading branch information
sapayth committed Nov 26, 2024
1 parent 87f577d commit ac5db7e
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 163 deletions.
2 changes: 1 addition & 1 deletion includes/Admin/Forms/Post/Templates/Form_Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function enqueue_scripts() {
wp_enqueue_style( $deps );
}

if ( defined( 'WPUF_PRO_VERSION' ) && version_compare( WPUF_PRO_VERSION, '4.0.12', '<' ) ) {
if ( defined( 'WPUF_PRO_VERSION' ) && version_compare( WPUF_PRO_VERSION, '4.0.13', '<' ) ) {
wp_enqueue_style( 'wpuf-form-builder' );
} else {
wp_enqueue_style( 'wpuf-admin-form-builder' );
Expand Down
15 changes: 15 additions & 0 deletions includes/Admin/Posting.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,27 @@ public function __construct() {
add_action( 'add_meta_boxes', [ $this, 'add_meta_box_post_lock'] );
// add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_script'] );
add_action( 'wpuf_load_post_forms', [ $this, 'enqueue_script' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'dequeue_assets' ] );
add_action( 'wpuf_load_registration_forms', [ $this, 'enqueue_script' ] );
add_action( 'save_post', [ $this, 'save_meta'], 100, 2 ); // save the custom fields
add_action( 'save_post', [ $this, 'form_selection_metabox_save' ], 1, 2 ); // save edit form id
add_action( 'save_post', [ $this, 'post_lock_metabox_save' ], 1, 2 ); // save post lock option
}

/**
* Dequeue assets
*
* @since WPUF_SINCE
*
* @return void
*/
public function dequeue_assets() {
wp_dequeue_style( 'wpuf-form-builder' );
if ( defined( 'WPUF_PRO_VERSION' ) && version_compare( WPUF_PRO_VERSION, '4.0.13', '<' ) ) {
wp_dequeue_style( 'wpuf-form-builder-pro' );
}
}

public static function init() {
if ( !self::$_instance ) {
self::$_instance = new self();
Expand Down
Loading

0 comments on commit ac5db7e

Please sign in to comment.