plugin updates

This commit is contained in:
Tony Volpe
2024-11-15 13:53:04 -05:00
parent 1293d604ca
commit 0238f0c4ca
2009 changed files with 163492 additions and 89543 deletions

View File

@@ -825,6 +825,8 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
update_imagify_option( 'api_key', $api_key );
delete_transient( 'imagify_user_cache' );
wp_send_json_success();
}
@@ -980,7 +982,7 @@ class Imagify_Admin_Ajax_Post extends Imagify_Admin_Ajax_Post_Deprecated {
} elseif ( $user->get_percent_unconsumed_quota <= 20 ) {
$user->best_plan_title = __( 'Oops, It\'s almost over!', 'imagify' );
} else {
$user->best_plan_title = __( 'You\'re new to Imagify?', 'imagify' );
$user->best_plan_title = __( 'Unlock Imagify\'s full potential', 'imagify' );
}
wp_send_json_success( $user );

View File

@@ -276,14 +276,14 @@ class Imagify_Assets extends Imagify_Assets_Deprecated {
* Loaded in the bulk optimization page.
*/
if ( imagify_is_screen( 'bulk' ) ) {
$this->enqueue_assets( [ 'pricing-modal', 'bulk' ] );
$this->enqueue_assets( 'bulk' );
}
/*
* Loaded in the settings page.
*/
if ( imagify_is_screen( 'imagify-settings' ) ) {
$this->enqueue_assets( [ 'sweetalert', 'notices', 'twentytwenty', 'pricing-modal', 'options' ] );
$this->enqueue_assets( [ 'sweetalert', 'notices', 'twentytwenty', 'options' ] );
}
/*
@@ -293,6 +293,8 @@ class Imagify_Assets extends Imagify_Assets_Deprecated {
$this->enqueue_assets( [ 'files-list', 'twentytwenty' ] );
}
$this->enqueue_assets( 'pricing-modal' );
/**
* Triggered after Imagify CSS and JS have been enqueued.
*

View File

@@ -36,11 +36,11 @@ class Imagify_Options extends Imagify_Abstract_Options {
'resize_larger_w' => 0,
'display_nextgen' => 0,
'display_nextgen_method' => 'picture',
'display_webp' => 0,
'display_webp_method' => 'picture',
'display_webp' => 0,
'display_webp_method' => 'picture',
'cdn_url' => '',
'disallowed-sizes' => [],
'admin_bar_menu' => 0,
'admin_bar_menu' => 1,
'partner_links' => 0,
'convert_to_avif' => 0,
'convert_to_webp' => 0,

View File

@@ -359,6 +359,8 @@ class Imagify_Settings {
return;
}
delete_transient( 'imagify_user_cache' );
// Handle API key validation cache and notices.
if ( Imagify_Requirements::is_api_key_valid( true ) ) {
Notices::dismiss_notice( 'wrong-api-key' );

View File

@@ -1,6 +1,7 @@
<?php
use Imagify\User\User;
use Imagify\Dependencies\WPMedia\PluginFamily\Model\PluginFamily;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
@@ -120,16 +121,12 @@ class Imagify_Views {
add_action( 'network_admin_menu', [ $this, 'add_network_menus' ] );
}
// Action links in plugins list.
$basename = plugin_basename( IMAGIFY_FILE );
add_filter( 'plugin_action_links_' . $basename, [ $this, 'plugin_action_links' ] );
add_filter( 'network_admin_plugin_action_links_' . $basename, [ $this, 'plugin_action_links' ] );
// Save the "per page" option value from the files list screen.
add_filter( 'set-screen-option', [ 'Imagify_Files_List_Table', 'save_screen_options' ], 10, 3 );
// JS templates in footer.
add_action( 'admin_print_footer_scripts', [ $this, 'print_js_templates' ] );
add_action( 'admin_footer', [ $this, 'print_modal_payment' ] );
}
@@ -208,27 +205,6 @@ class Imagify_Views {
}
}
/** ----------------------------------------------------------------------------------------- */
/** PLUGIN ACTION LINKS ===================================================================== */
/** ----------------------------------------------------------------------------------------- */
/**
* Add links to the plugin row in the plugins list.
*
* @since 1.7
*
* @param array $actions An array of action links.
* @return array
*/
public function plugin_action_links( $actions ) {
array_unshift( $actions, sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( imagify_get_external_url( 'documentation' ) ), __( 'Documentation', 'imagify' ) ) );
array_unshift( $actions, sprintf( '<a href="%s">%s</a>', esc_url( get_imagify_admin_url( 'bulk-optimization' ) ), __( 'Bulk Optimization', 'imagify' ) ) );
array_unshift( $actions, sprintf( '<a href="%s">%s</a>', esc_url( get_imagify_admin_url() ), __( 'Settings', 'imagify' ) ) );
return $actions;
}
/** ----------------------------------------------------------------------------------------- */
/** MAIN PAGE TEMPLATES ===================================================================== */
/** ----------------------------------------------------------------------------------------- */
@@ -239,7 +215,14 @@ class Imagify_Views {
* @since 1.7
*/
public function display_settings_page() {
$this->print_template( 'page-settings' );
$plugin_family = new PluginFamily();
$plugins_array = $plugin_family->get_filtered_plugins( 'imagify/imagify' );
$data = [
'plugin_family' => $plugins_array['uncategorized'],
];
$this->print_template( 'page-settings', $data );
}
/**
@@ -651,6 +634,36 @@ class Imagify_Views {
}
}
/**
* Print the payment modal.
*/
public function print_modal_payment() {
$this->print_template(
'modal-payment',
[
'attachments_number' => $this->get_attachments_number_modal(),
]
);
}
/**
* Get the number of attachments to display in the payment modal.
*
* @return int
*/
private function get_attachments_number_modal() {
$transient = get_transient( 'imagify_attachments_number_modal' );
if ( false !== $transient ) {
return $transient;
}
$attachments_number = imagify_count_attachments() + Imagify_Files_Stats::count_all_files();
set_transient( 'imagify_attachments_number_modal', $attachments_number, 1 * DAY_IN_SECONDS );
return $attachments_number;
}
/** ----------------------------------------------------------------------------------------- */
/** TOOLS =================================================================================== */

View File

@@ -86,6 +86,10 @@ class Imagify {
* @return object
*/
public function get_user() {
if ( empty( $this->api_key ) ) {
return new WP_Error( 'api_key_missing', __( 'API key required.', 'imagify' ) );
}
global $wp_current_filter;
if ( isset( static::$user ) ) {