PluginProbe ʕ •ᴥ•ʔ
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN / 3.15.3
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN v3.15.3
4.1.0 4.0.3 4.0.2 2.8.1 2.9.1 3.0.0 3.0.1 3.0.2 3.1.1 3.10.1 3.10.2 3.10.3 3.11.1 3.12.3 3.12.4 3.12.5 3.12.6 3.13.0 3.13.1 3.13.2 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.15.2 3.15.3 3.15.4 3.15.5 3.16.2 3.16.4 3.16.5 3.16.6 3.17.0 3.17.1 3.18.0 3.18.1 3.2.0.1 3.2.1 3.2.2.1 3.2.4 3.20.0 3.21.1 3.22.1 3.22.3 3.23.0 3.23.1 3.23.2 3.23.3 3.23.4 3.24.0 3.24.0-beta.2 3.3.0 3.3.1 3.3.2 3.4.1 3.4.2 3.6.1 3.6.3 3.7.0 3.7.1 3.7.2 3.7.3 3.8.2 3.8.3 3.8.4 3.8.5 3.8.7 3.8.8 3.9.0 3.9.1 3.9.11 3.9.2 3.9.4 3.9.5 3.9.8 3.9.9 trunk 1.0.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.5.3 1.6.5.4 1.7 1.7.1 1.7.1.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.6.2 2.0.6.3 2.0.6.5 2.0.7 2.0.7.1 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.2 2.3 2.3.1 2.4 2.4.2 2.4.3 2.4.4 2.4.5 2.5.2 2.5.3 2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.7.4 2.7.4.1 2.7.5 2.7.6 2.7.8 2.7.8.1 2.7.9.1 2.8.0 2.8.0.1
wp-smushit / app / pages / class-nextgen.php
wp-smushit / app / pages Last commit date
class-bulk.php 2 years ago class-cdn.php 2 years ago class-dashboard.php 2 years ago class-directory.php 2 years ago class-integrations.php 2 years ago class-lazy.php 2 years ago class-nextgen.php 2 years ago class-settings.php 2 years ago class-tutorials.php 2 years ago class-upgrade.php 2 years ago class-webp.php 2 years ago
class-nextgen.php
143 lines
1 <?php
2 /**
3 * NextGen admin view: Nextgen class
4 *
5 * @package Smush\App\Pages
6 */
7
8 namespace Smush\App\Pages;
9
10 use Smush\App\Abstract_Page;
11 use Smush\App\Admin;
12 use WP_Smush;
13
14 if ( ! defined( 'WPINC' ) ) {
15 die;
16 }
17
18 /**
19 * Class Nextgen
20 */
21 class Nextgen extends Abstract_Page {
22
23 /**
24 * Function triggered when the page is loaded before render any content.
25 */
26 public function on_load() {
27 // Localize variables for NextGen Manage gallery page.
28 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
29 }
30
31 /**
32 * Render inner content.
33 */
34 public function render_inner_content() {
35 $this->view( 'smush-nextgen-page' );
36 }
37
38 /**
39 * Register meta boxes.
40 */
41 public function register_meta_boxes() {
42 $this->add_meta_box(
43 'summary',
44 null,
45 array( $this, 'dashboard_summary_metabox' ),
46 null,
47 null,
48 'summary',
49 array(
50 'box_class' => 'sui-box sui-summary sui-summary-smush-metabox sui-summary-smush-nextgen',
51 'box_content_class' => false,
52 )
53 );
54
55 $this->add_meta_box(
56 'bulk',
57 __( 'Bulk Smush', 'wp-smushit' ),
58 array( $this, 'bulk_metabox' ),
59 array( $this, 'bulk_header_metabox' ),
60 null,
61 'bulk',
62 array(
63 'box_class' => 'sui-box bulk-smush-wrapper',
64 )
65 );
66 }
67
68 /**
69 * Enqueue Scripts on Manage Gallery page
70 */
71 public function enqueue() {
72 $current_screen = get_current_screen();
73 if ( ! empty( $current_screen ) && in_array( $current_screen->base, Admin::$plugin_pages, true ) ) {
74 WP_Smush::get_instance()->core()->nextgen->ng_admin->localize();
75 }
76 }
77
78
79 /**
80 * NextGen summary meta box.
81 */
82 public function dashboard_summary_metabox() {
83 $ng_stats = WP_Smush::get_instance()->core()->nextgen->ng_stats;
84 $global_stats = $ng_stats->get_global_stats();
85 $lossy_enabled = $this->settings->get( 'lossy' );
86
87 $this->view(
88 'nextgen/summary-meta-box',
89 array(
90 'lossy_enabled' => $lossy_enabled,
91 'image_count' => $ng_stats->get_array_value( $global_stats, 'count_images' ),
92 'smushed_image_count' => $ng_stats->get_array_value( $global_stats, 'count_smushed' ),
93 'super_smushed_count' => $ng_stats->get_array_value( $global_stats, 'count_supersmushed' ),
94 'stats_human' => $ng_stats->get_array_value( $global_stats, 'human_bytes' ),
95 'stats_percent' => $ng_stats->get_array_value( $global_stats, 'savings_percent'),
96 'total_count' => $ng_stats->get_array_value( $global_stats, 'count_total' ),
97 'percent_grade' => $ng_stats->get_array_value( $global_stats, 'percent_grade' ),
98 'percent_metric' => $ng_stats->get_array_value( $global_stats, 'percent_metric' ),
99 'percent_optimized' => $ng_stats->get_array_value( $global_stats, 'percent_optimized' ),
100 )
101 );
102 }
103
104 /**
105 * NextGen bulk Smush header meta box.
106 */
107 public function bulk_header_metabox() {
108 $this->view(
109 'nextgen/meta-box-header',
110 array(
111 'title' => __( 'Bulk Smush', 'wp-smushit' ),
112 )
113 );
114 }
115
116 /**
117 * NextGen bulk Smush meta box.
118 */
119 public function bulk_metabox() {
120 $ng_stats = WP_Smush::get_instance()->core()->nextgen->ng_stats;
121 $global_stats = $ng_stats->get_global_stats();
122
123 $url = add_query_arg(
124 array(
125 'page' => 'smush#wp-smush-settings-box',
126 ),
127 admin_url( 'upload.php' )
128 );
129
130 $this->view(
131 'nextgen/meta-box',
132 array(
133 'total_images_to_smush' => $ng_stats->get_array_value( $global_stats, 'remaining_count' ),
134 'unsmushed_count' => $ng_stats->get_array_value( $global_stats, 'count_unsmushed'),
135 'resmush_count' => $ng_stats->get_array_value( $global_stats, 'count_resmush'),
136 'total_count' => $ng_stats->get_array_value( $global_stats, 'count_total'),
137 'url' => $url,
138 )
139 );
140 }
141
142 }
143