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-integrations.php
93 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Integrations page. |
| 4 | * |
| 5 | * @package Smush\App\Pages |
| 6 | */ |
| 7 | |
| 8 | namespace Smush\App\Pages; |
| 9 | |
| 10 | use Smush\App\Abstract_Page; |
| 11 | use Smush\App\Interface_Page; |
| 12 | use Smush\Core\Settings; |
| 13 | use WP_Smush; |
| 14 | |
| 15 | if ( ! defined( 'WPINC' ) ) { |
| 16 | die; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Class Integrations |
| 21 | */ |
| 22 | class Integrations extends Abstract_Page implements Interface_Page { |
| 23 | /** |
| 24 | * Function triggered when the page is loaded before render any content. |
| 25 | */ |
| 26 | public function on_load() { |
| 27 | add_action( 'smush_setting_column_right_inside', array( $this, 'settings_desc' ), 10, 2 ); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Register meta boxes. |
| 32 | */ |
| 33 | public function register_meta_boxes() { |
| 34 | $class = WP_Smush::is_pro() ? 'smush-integrations-wrapper wp-smush-pro' : 'smush-integrations-wrapper'; |
| 35 | |
| 36 | $this->add_meta_box( |
| 37 | 'integrations', |
| 38 | __( 'Integrations', 'wp-smushit' ), |
| 39 | array( $this, 'integrations_meta_box' ), |
| 40 | null, |
| 41 | array( $this, 'common_meta_box_footer' ), |
| 42 | 'main', |
| 43 | array( |
| 44 | 'box_class' => "sui-box {$class}", |
| 45 | 'box_content_class' => 'sui-box-body sui-upsell-items', |
| 46 | ) |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Common footer meta box. |
| 52 | * |
| 53 | * @since 3.2.0 |
| 54 | */ |
| 55 | public function common_meta_box_footer() { |
| 56 | $this->view( 'meta-box-footer', array(), 'common' ); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Integrations meta box. |
| 61 | * |
| 62 | * Free and pro version settings are shown in same section. For free users, pro settings won't be shown. |
| 63 | * To print full size smush, resize and backup in group, we hook at `smush_setting_column_right_end`. |
| 64 | */ |
| 65 | public function integrations_meta_box() { |
| 66 | $this->view( |
| 67 | 'integrations/meta-box', |
| 68 | array( |
| 69 | 'basic_features' => Settings::$basic_features, |
| 70 | 'is_pro' => WP_Smush::is_pro(), |
| 71 | 'integration_group' => $this->settings->get_integrations_fields(), |
| 72 | 'settings' => $this->settings->get(), |
| 73 | ) |
| 74 | ); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Show additional descriptions for settings. |
| 79 | * |
| 80 | * @param string $setting_key Setting key. |
| 81 | */ |
| 82 | public function settings_desc( $setting_key = '' ) { |
| 83 | if ( empty( $setting_key ) || 's3' !== $setting_key ) { |
| 84 | return; |
| 85 | } |
| 86 | ?> |
| 87 | <span class="sui-description sui-toggle-description" id="s3-desc"> |
| 88 | <?php esc_html_e( 'Note: For this process to happen automatically you need automatic smushing enabled.', 'wp-smushit' ); ?> |
| 89 | </span> |
| 90 | <?php |
| 91 | } |
| 92 | } |
| 93 |