Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed imagify pricing modal layout issue #924

Merged
merged 18 commits into from
Dec 20, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 41 additions & 8 deletions inc/classes/class-imagify-views.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@

// JS templates in footer.
add_action( 'admin_print_footer_scripts', [ $this, 'print_js_templates' ] );
add_action( 'admin_footer', [ $this, 'print_modal_payment' ] );
add_action( 'admin_footer', [ $this, 'maybe_print_modal_payment' ] );
add_action( 'imagify_print_modal_payment', [ $this, 'print_modal_payment' ] );
}


Expand Down Expand Up @@ -634,16 +635,48 @@
}
}

/**
* Check if menu is present
*
* @return bool
*/
private function admin_menu_is_present(): bool {

Check warning on line 643 in inc/classes/class-imagify-views.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

inc/classes/class-imagify-views.php#L643

Avoid unused private methods such as 'admin_menu_is_present'.
Khadreal marked this conversation as resolved.
Show resolved Hide resolved
global $wp_admin_bar;

$imagify_menu_id = 'imagify';

return $wp_admin_bar && $wp_admin_bar->get_node( $imagify_menu_id );
}

/**
* Start print the payment modal process.
*/
public function maybe_print_modal_payment() {
$user = new User();
$print_modal = false;
if ( $user->is_free() && $user->get_percent_unconsumed_quota() > 20 ) {
$print_modal = true;
}

do_action( 'imagify_print_modal_payment', $print_modal );
}

/**
* Print the payment modal.
*
* @param bool $print
*
* @return void
*/
public function print_modal_payment() {
$this->print_template(
'modal-payment',
[
'attachments_number' => $this->get_attachments_number_modal(),
]
);
public function print_modal_payment( $print ) {
if ( $print ) {
$this->print_template(
'modal-payment',
[
'attachments_number' => $this->get_attachments_number_modal(),
]
);
}
}

/**
Expand Down
Loading