| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
| 3 |
|
| 4 |
$settings = Imagify_Settings::get_instance(); |
| 5 |
$options = Imagify_Options::get_instance(); |
| 6 |
$option_name = $options->get_option_name(); |
| 7 |
$hidden_class = Imagify_Requirements::is_api_key_valid() ? '' : ' hidden'; |
| 8 |
$lang = imagify_get_current_lang_in( array( 'de', 'es', 'fr', 'it' ) ); |
| 9 |
|
| 10 |
/* Ads notice */ |
| 11 |
$plugins = get_plugins(); |
| 12 |
$notice = 'wp-rocket'; |
| 13 |
$user_id = get_current_user_id(); |
| 14 |
$notices = get_user_meta( $user_id, '_imagify_ignore_ads', true ); |
| 15 |
$notices = $notices && is_array( $notices ) ? array_flip( $notices ) : array(); |
| 16 |
$wrapper_class = isset( $notices[ $notice ] ) || isset( $plugins['wp-rocket/wp-rocket.php'] ) ? 'imagify-have-rocket' : 'imagify-dont-have-rocket'; |
| 17 |
?> |
| 18 |
<div class="wrap imagify-settings <?php echo $wrapper_class; ?> imagify-clearfix"> |
| 19 |
|
| 20 |
<div class="imagify-col imagify-main"> |
| 21 |
|
| 22 |
<?php $this->print_template( 'part-settings-header' ); ?> |
| 23 |
<div class="imagify-main-content"> |
| 24 |
<form action="<?php echo esc_url( $settings->get_form_action() ); ?>" id="imagify-settings" method="post"> |
| 25 |
|
| 26 |
<div class="imagify-settings-main-content<?php echo Imagify_Requirements::is_api_key_valid() ? '' : ' imagify-no-api-key'; ?>"> |
| 27 |
|
| 28 |
<?php settings_fields( $settings->get_settings_group() ); ?> |
| 29 |
<?php wp_nonce_field( 'imagify-signup', 'imagifysignupnonce', false ); ?> |
| 30 |
<?php wp_nonce_field( 'imagify-check-api-key', 'imagifycheckapikeynonce', false ); ?> |
| 31 |
|
| 32 |
<?php |
| 33 |
if ( ! Imagify_Requirements::is_api_key_valid() ) { |
| 34 |
$this->print_template( 'part-settings-account' ); |
| 35 |
$this->print_template( 'part-settings-footer' ); |
| 36 |
} |
| 37 |
?> |
| 38 |
|
| 39 |
<div class="imagify-col imagify-shared-with-account-col<?php echo $hidden_class; ?>"> |
| 40 |
<div class="imagify-settings-section"> |
| 41 |
|
| 42 |
<h2 class="imagify-options-title"><?php _e( 'General Settings', 'imagify' ); ?></h2> |
| 43 |
|
| 44 |
<p class="imagify-setting-line"> |
| 45 |
<?php |
| 46 |
$settings->field_checkbox( array( |
| 47 |
'option_name' => 'auto_optimize', |
| 48 |
'label' => __( 'Auto-Optimize images on upload', 'imagify' ), |
| 49 |
'info' => __( 'Automatically optimize every image you upload to WordPress.', 'imagify' ), |
| 50 |
) ); |
| 51 |
?> |
| 52 |
</p> |
| 53 |
|
| 54 |
<p class="imagify-setting-line"> |
| 55 |
<?php |
| 56 |
$settings->field_checkbox( array( |
| 57 |
'option_name' => 'backup', |
| 58 |
'label' => __( 'Backup original images', 'imagify' ), |
| 59 |
'info' => __( 'Keep your original images in a separate folder before optimization process.', 'imagify' ), |
| 60 |
) ); |
| 61 |
|
| 62 |
$backup_error_class = $options->get( 'backup' ) && ! Imagify_Requirements::attachments_backup_dir_is_writable() ? '' : ' hidden'; |
| 63 |
?> |
| 64 |
<br/><strong id="backup-dir-is-writable" class="imagify-error<?php echo $backup_error_class; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'imagify_check_backup_dir_is_writable' ) ); ?>"> |
| 65 |
<?php |
| 66 |
$backup_path = $this->filesystem->make_path_relative( get_imagify_backup_dir_path( true ) ); |
| 67 |
/* translators: %s is a file path. */ |
| 68 |
printf( __( 'The backup folder %s cannot be created or is not writable by the server, original images cannot be saved!', 'imagify' ), "<code>$backup_path</code>" ); |
| 69 |
?> |
| 70 |
</strong> |
| 71 |
</p> |
| 72 |
|
| 73 |
<p class="imagify-setting-line"> |
| 74 |
<?php |
| 75 |
$settings->field_checkbox( array( |
| 76 |
'option_name' => 'lossless', |
| 77 |
'label' => __( 'Lossless compression', 'imagify' ), |
| 78 |
'info' => __( 'By default, Imagify optimizes your images by using a smart compression to get the best compression rate with an optimal quality.', 'imagify' ) . '<br><br>' . __( 'If you are a photographer or focus on the quality of your images rather than the performance, you may be interested in this option to make sure not a single pixel looks different in the optimized image compared with the original.', 'imagify' ), |
| 79 |
) ); |
| 80 |
?> |
| 81 |
</p> |
| 82 |
</div> |
| 83 |
</div> |
| 84 |
|
| 85 |
<?php if ( Imagify_Requirements::is_api_key_valid() ) { ?> |
| 86 |
<div class="imagify-col imagify-account-info-col"> |
| 87 |
<?php $this->print_template( 'part-settings-account' ); ?> |
| 88 |
</div> |
| 89 |
<?php } ?> |
| 90 |
</div> |
| 91 |
|
| 92 |
<div class="imagify-settings-main-content<?php echo $hidden_class; ?>"> |
| 93 |
|
| 94 |
<div class="imagify-settings-section imagify-clear"> |
| 95 |
<h2 class="imagify-options-title"><?php _e( 'Optimization', 'imagify' ); ?></h2> |
| 96 |
<?php |
| 97 |
$this->print_template( 'part-settings-webp' ); |
| 98 |
$this->print_template( 'part-settings-library' ); |
| 99 |
$this->print_template( 'part-settings-custom-folders' ); |
| 100 |
?> |
| 101 |
</div> |
| 102 |
</div> |
| 103 |
|
| 104 |
<div class="imagify-settings-main-content imagify-pb0<?php echo $hidden_class; ?>"> |
| 105 |
<div class="imagify-settings-section imagify-clear"> |
| 106 |
<div> |
| 107 |
<h2 class="imagify-options-title"><?php _e( 'Display Options', 'imagify' ); ?></h2> |
| 108 |
|
| 109 |
<p class="imagify-options-subtitle"><?php _e( 'Show Toolbar Menu', 'imagify' ); ?></p> |
| 110 |
|
| 111 |
<div class="imagify-col"> |
| 112 |
<p> |
| 113 |
<?php |
| 114 |
$settings->field_checkbox( array( |
| 115 |
'option_name' => 'admin_bar_menu', |
| 116 |
'label' => __( 'I want this awesome quick access menu on my Toolbar.', 'imagify' ), |
| 117 |
) ); |
| 118 |
?> |
| 119 |
</p> |
| 120 |
</div> |
| 121 |
<div class="imagify-col"> |
| 122 |
<p> |
| 123 |
<img class="imagify-menu-bar-img" src="<?php echo esc_url( IMAGIFY_ASSETS_IMG_URL . 'imagify-menu-bar-' . $lang . '.jpg' ); ?>" width="273" height="239" alt=""> |
| 124 |
</p> |
| 125 |
</div> |
| 126 |
|
| 127 |
<?php |
| 128 |
/** |
| 129 |
* List of partners affected by this option. |
| 130 |
* For internal use only. |
| 131 |
* |
| 132 |
* @since 1.8.2 |
| 133 |
* @author Grégory Viguier |
| 134 |
* |
| 135 |
* @param array $partners An array of partner names. |
| 136 |
* @return array |
| 137 |
*/ |
| 138 |
$partners = apply_filters( 'imagify_deactivatable_partners', array() ); |
| 139 |
|
| 140 |
if ( $partners ) { |
| 141 |
?> |
| 142 |
<p class="imagify-options-subtitle" id="imagify-partners-label"> |
| 143 |
<?php esc_html_e( 'Partners', 'imagify' ); ?> |
| 144 |
|
| 145 |
<span class="imagify-info"> |
| 146 |
<span class="dashicons dashicons-info"></span> |
| 147 |
<a href="#imagify-partners-info" class="imagify-modal-trigger"><?php _e( 'More info?', 'imagify' ); ?></a> |
| 148 |
</span> |
| 149 |
</p> |
| 150 |
|
| 151 |
<p> |
| 152 |
<?php |
| 153 |
$settings->field_checkbox( array( |
| 154 |
'option_name' => 'partner_links', |
| 155 |
'label' => __( 'Display Partner Links', 'imagify' ), |
| 156 |
) ); |
| 157 |
?> |
| 158 |
</p> |
| 159 |
<?php |
| 160 |
} |
| 161 |
?> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
|
| 165 |
<?php |
| 166 |
if ( Imagify_Requirements::is_api_key_valid() ) { |
| 167 |
$this->print_template( 'part-settings-footer' ); |
| 168 |
} |
| 169 |
?> |
| 170 |
</div> |
| 171 |
</form> |
| 172 |
</div> |
| 173 |
</div> |
| 174 |
|
| 175 |
<?php |
| 176 |
$this->print_template( 'part-rocket-ad' ); |
| 177 |
$this->print_template( 'modal-settings-infos' ); |
| 178 |
$this->print_template( 'modal-settings-partners-infos' ); |
| 179 |
$this->print_template( 'modal-settings-visual-comparison' ); |
| 180 |
$this->print_template( 'modal-payment' ); |
| 181 |
?> |
| 182 |
|
| 183 |
</div> |
| 184 |
<?php |
| 185 |
|