PluginProbe ʕ •ᴥ•ʔ
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN / 3.9.9
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN v3.9.9
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-cdn.php
wp-smushit / app / pages Last commit date
class-bulk.php 4 years ago class-cdn.php 4 years ago class-dashboard.php 4 years ago class-directory.php 4 years ago class-integrations.php 4 years ago class-lazy.php 4 years ago class-nextgen.php 4 years ago class-settings.php 4 years ago class-tools.php 4 years ago class-tutorials.php 4 years ago class-upgrade.php 4 years ago class-webp.php 4 years ago
class-cdn.php
141 lines
1 <?php
2 /**
3 * CDN page.
4 *
5 * @package Smush\App\Pages
6 */
7
8 namespace Smush\App\Pages;
9
10 use Smush\App\Abstract_Summary_Page;
11 use Smush\App\Interface_Page;
12 use WP_Smush;
13
14 if ( ! defined( 'WPINC' ) ) {
15 die;
16 }
17
18 /**
19 * Class CDN
20 */
21 class CDN extends Abstract_Summary_Page implements Interface_Page {
22 /**
23 * Register meta boxes.
24 */
25 public function register_meta_boxes() {
26 parent::register_meta_boxes();
27
28 if ( ! WP_Smush::is_pro() ) {
29 $this->add_meta_box(
30 'cdn/upsell',
31 __( 'CDN', 'wp-smushit' )
32 );
33
34 return;
35 }
36
37 if ( ! $this->settings->get( 'cdn' ) ) {
38 $this->add_meta_box(
39 'cdn/disabled',
40 __( 'CDN', 'wp-smushit' ),
41 null,
42 array( $this, 'header_meta_box' )
43 );
44
45 return;
46 }
47
48 $this->add_meta_box(
49 'cdn',
50 __( 'CDN', 'wp-smushit' ),
51 array( $this, 'cdn_meta_box' ),
52 array( $this, 'header_meta_box' ),
53 array( $this, 'common_meta_box_footer' )
54 );
55 }
56
57 /**
58 * Common footer meta box.
59 *
60 * @since 3.2.0
61 */
62 public function common_meta_box_footer() {
63 $this->view( 'meta-box-footer', array(), 'common' );
64 }
65
66 /**
67 * Header CDN with notification.
68 *
69 * @since 3.9.6
70 */
71 public function header_meta_box() {
72 $this->view( 'cdn/meta-box-header' );
73 }
74
75 /**
76 * CDN meta box.
77 *
78 * @since 3.0
79 */
80 public function cdn_meta_box() {
81 $status = WP_Smush::get_instance()->core()->mod->cdn->status();
82
83 // Available values: warning (inactive), success (active) or error (expired).
84 $status_msg = array(
85 'enabled' => __(
86 'Your media is currently being served from the WPMU DEV CDN. Bulk and Directory smush features are treated separately and will continue to run independently.',
87 'wp-smushit'
88 ),
89 'disabled' => __( 'CDN is not yet active. Configure your settings below and click Activate.', 'wp-smushit' ),
90 'activating' => __(
91 'Your settings have been saved and changes are now propagating to the CDN. Changes can take up to 30
92 minutes to take effect but your images will continue to be served in the mean time, please be patient.',
93 'wp-smushit'
94 ),
95 'upgrade' => sprintf(
96 __(
97 /* translators: %1$s - starting a tag, %2$s - closing a tag */
98 "You're almost through your CDN bandwidth limit. Please contact your administrator to upgrade your Smush CDN plan to ensure you don't lose this service. %1\$sUpgrade now%2\$s",
99 'wp-smushit'
100 ),
101 '<a href="https://wpmudev.com/hub/account/" target="_blank">',
102 '</a>'
103 ),
104 'overcap' => sprintf(
105 __(
106 /* translators: %1$s - starting a tag, %2$s - closing a tag */
107 "You've gone through your CDN bandwidth limit, so we’ve stopped serving your images via the CDN. Contact your administrator to upgrade your Smush CDN plan to reactivate this service. %1\$sUpgrade now%2\$s",
108 'wp-smushit'
109 ),
110 '<a href="https://wpmudev.com/hub/account/" target="_blank">',
111 '</a>'
112 ),
113 );
114
115 $status_color = array(
116 'enabled' => 'success',
117 'disabled' => 'error',
118 'activating' => 'warning',
119 'upgrade' => 'warning',
120 'overcap' => 'error',
121 );
122
123 // Disable CDN on staging.
124 if ( isset( $_SERVER['WPMUDEV_HOSTING_ENV'] ) && 'staging' === $_SERVER['WPMUDEV_HOSTING_ENV'] ) {
125 $status_msg['disabled'] = __( 'Your Staging environment’s media is currently being served from your local server. If you move your Staging files into Production, your Production environment’s media will automatically be served from the Smush CDN.', 'wp-smushit' );
126 $status_color['disabled'] = 'warning';
127 }
128
129 $this->view(
130 'cdn/meta-box',
131 array(
132 'cdn_group' => $this->settings->get_cdn_fields(),
133 'settings' => $this->settings->get(),
134 'status_msg' => $status_msg[ $status ],
135 'class' => $status_color[ $status ],
136 'status' => $status,
137 )
138 );
139 }
140 }
141