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

@@ -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 =================================================================================== */