tabs = apply_filters(
'smush_setting_tabs',
array(
'general' => __( 'General', 'wp-smushit' ),
'configs' => __( 'Configs', 'wp-smushit' ),
'permissions' => __( 'Permissions', 'wp-smushit' ),
'data' => __( 'Data & Settings', 'wp-smushit' ),
'accessibility' => __( 'Accessibility', 'wp-smushit' ),
)
);
// Disabled on all subsites.
if ( ! is_multisite() || ! is_network_admin() ) {
unset( $this->tabs['permissions'] );
}
add_action( 'smush_setting_column_right_inside', array( $this, 'usage_settings' ), 25, 2 );
add_action( 'wp_smush_render_general_setting_rows', array( $this, 'render_tracking_settings' ), 40 );
add_action( 'wp_smush_render_general_setting_rows', array( $this, 'render_image_resize_detection_settings' ), 10 );
add_action( 'smush_setting_column_right_inside', array( $this, 'detection_settings' ), 25, 2 );
add_action( 'wp_smush_render_general_setting_rows', array( $this, 'render_translations_settings' ), 20 );
}
/**
* Enqueue scripts.
*
* @since 3.9.0
*
* @param string $hook Hook from where the call is made.
*/
public function enqueue_scripts( $hook ) {
// Scripts for Configs.
$this->enqueue_configs_scripts();
}
/**
* Register meta boxes.
*/
public function register_meta_boxes() {
$this->add_meta_box(
'settings/general',
__( 'General', 'wp-smushit' ),
array( $this, 'general_meta_box' ),
null,
array( $this, 'common_meta_box_footer' ),
'general'
);
if ( is_multisite() && is_network_admin() ) {
$this->add_meta_box(
'settings/permissions',
__( 'Permissions', 'wp-smushit' ),
array( $this, 'permissions_meta_box' ),
null,
array( $this, 'common_meta_box_footer' ),
'permissions'
);
}
$this->add_meta_box(
'settings/data',
__( 'Data & Settings', 'wp-smushit' ),
array( $this, 'data_meta_box' ),
null,
array( $this, 'common_meta_box_footer' ),
'data'
);
$this->add_meta_box(
'settings/accessibility',
__( 'Accessibility', 'wp-smushit' ),
array( $this, 'accessibility_meta_box' ),
null,
array( $this, 'common_meta_box_footer' ),
'accessibility'
);
if ( 'data' === $this->get_current_tab() ) {
$this->modals['reset-settings'] = array();
}
}
/**
* Display a description in Settings - Usage Tracking.
*
* @since 3.1.0
*
* @param string $name Setting name.
*/
public function usage_settings( $name ) {
// Add only to full size settings.
if ( 'usage' !== $name ) {
return;
}
?>
settings->get( 'detection' );
$is_lazyload_enabled = $this->settings->is_lazyload_active();
$is_auto_resize_enabled = $this->settings->is_auto_resizing_active();
$notice_css_class = '';
if ( $is_lazyload_enabled && $is_auto_resize_enabled ) {
$notice_message = esc_html(
$this->whitelabel->whitelabel_string(
__( 'Images served via the Automatic Resizing feature will be skipped.', 'wp-smushit' )
)
);
} else {
$notice_css_class = 'sui-notice-info';
$notice_message = sprintf(
/* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */
esc_html__(
'Incorrect image size highlighting is active. %1$sView the frontend%2$s of your website to see if any images aren\'t the correct size for their containers.',
'wp-smushit'
),
'',
''
);
}
?>