' . 'Settings' . '';
return $links;
}
/**
* Adds a link to the adaptive images settings in the plugins listing page for convenience.
*
* @author Nevma (info@nevma.gr)
*
* @param array $links The plugin links array in the plugins listing page.
*
* @return void
*/
function adaptive_images_admin_add_row_meta ( $links, $file ) {
if ( $file != adaptive_images_plugin_get_name() ) {
return $links;
}
$links[] = '' . 'Plugin page' . '';
$links[] = '' . 'Plugin support page' . '';
return $links;
}
/**
* Adds the plugin settings page to the admin area.
*
* @author Nevma (info@nevma.gr)
*
* @return void
*/
function adaptive_images_admin_add_options_page () {
// Adds the plugin's options page as a submenu of the admin settings.
$hook_name = add_options_page(
'Adaptive Images', // page title
'Adaptive Images', // menu title
'manage_options', // capability
'adaptive-images', // menu slug
'adaptive_images_admin_options_page_print' // print function callback
);
// Adds the action which adds the plugin admin actions.
add_action( 'admin_head-' . $hook_name, 'adaptive_images_admin_settings_actions' );
}
/**
* Registers the plugin settings.
*
* @author Nevma (info@nevma.gr)
*
* @return void
*/
function adaptive_images_admin_register_settings () {
// Registers the plugin settings field.
register_setting(
'adaptive-images-settings', // option group
'adaptive-images', // option name
'adaptive_images_admin_settings_sanitize' // function validator callback
);
// Adds the plugin main settings section.
add_settings_section(
'adaptive-images-settings', // id
'', // title
'', // print function callback
'adaptive-images' // plugin page
);
// Adds the adaptive images resolutions field.
add_settings_field(
'resolutions', // id
'Resolutions', // title
'adaptive_images_admin_resolutions_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images landscape field.
add_settings_field(
'orientation', // id
'Bigger dimension', // title
'adaptive_images_admin_landscape_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images hidpi field.
add_settings_field(
'hidpi', // id
'HiDPI support', // title
'adaptive_images_admin_hidpi_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images CDN support field.
add_settings_field(
'cdn-support', // id
'CDN support', // title
'adaptive_images_admin_cdn_support_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images cache directory field.
add_settings_field(
'cache-directory', // id
'Cache directory', // title
'adaptive_images_admin_cache_directory_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images watched directories field.
add_settings_field(
'watched-directories', // id
'Watched directories', // title
'adaptive_images_admin_watched_directories_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images JPEG quality field.
add_settings_field(
'jpeg-quality', // id
'JPEG quality', // title
'adaptive_images_admin_jpeg_quality_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images sharpen field.
add_settings_field(
'sharpen-images', // id
'Sharpen images', // title
'adaptive_images_admin_sharpen_images_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images watch cache (for stale images) field.
add_settings_field(
'watch-cache', // id
'Watch cache', // title
'adaptive_images_admin_watch_cache_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
// Adds the adaptive images browser cache duration field.
add_settings_field(
'browser-cache', // id
'Browser cache', // title
'adaptive_images_admin_browser_cache_field_print', // print function callback
'adaptive-images', // plugin page
'adaptive-images-settings' // section
);
}
/**
* Prints the resolutions settings field.
*
* @author Nevma (info@nevma.gr)
*
* @return void
*/
function adaptive_images_admin_resolutions_field_print () {
$options = get_option( 'adaptive-images' );
adaptive_images_plugin_check_empty_setting( $options, 'resolutions' ); ?>
A comma separated list of device widths.
Directory inside /wp-content to store the image cache.
Current path on server:
.
Directories to watch for images to resize for mobile devices. Has to be relative paths inside your WordPress installation.
Compression level of JPEG images, 100 means best quality but biggest file size.
Usuallly a 60 to 70 JPEG compression level works fine for the human eye and achieves very small file sizes.
How long should browsers be instructed to cache images.
Unless you have a very special need and/or you know what you are doing, set this to as high a value as you can.
|
Calculate total cache size.
Calculate size (might take some time) |
Cleanup the image cache.
Cleanup cache (might take some time) |
|
Print debug information.
Print debug info (this is quite quick) |
Print diagnostic information.
Print diagnostics (this is quite quick) |
Thank you so much for trying out the "Adaptive Images for WordPress" plugin.
Please, do not hesitate to report any problems and send us your suggestions at the plugin support page.
We will really appreciate it!
Many-many thanks,
Nevma, the development team!
🌟🌟🌟🌟🌟
We do appreciate an honest review and rating!
👍👍👍👍👍
State that the plugin actually works by clicking here!
Adaptive Images v.
Total files deleted from the adaptive images cache: ' . $result['files'] . '
' . 'Total directories deleted from the adaptive images cache: ' . $result['dirs'] . '
' . '' . 'Total size deleted from the adaptive images cache: ' . adaptive_images_plugin_file_size_human( $result['size'] ) . '
', 'updated' ); } // Calculate image cache size action. if ( $_GET['action'] == 'calculate-cache-size' && wp_verify_nonce( $_GET['_wpnonce'], 'adaptive-images-calculate-cache-size' ) ) { $cache_path = adaptive_images_plugin_get_cahe_directory_path(); $cache_size = adaptive_images_plugin_dir_size( $cache_path ); add_settings_error( 'adaptive-images-settings', 'adaptive-images-settings-error', 'Calculate cache sizeTotal files in the adaptive images cache: ' . $cache_size['files'] . '
' . 'Total directories in the adaptive images cache: ' . $cache_size['dirs'] . '
' . '' . 'Total size of the adaptive images cache: ' . adaptive_images_plugin_file_size_human( $cache_size['size'] ) . '
', 'updated' ); } // Print plugin info action. if ( $_GET['action'] == 'print-debug-info' && wp_verify_nonce( $_GET['_wpnonce'], 'adaptive-images-print-debug-info' ) ) { add_settings_error( 'adaptive-images-settings', 'adaptive-images-settings-error', 'Debug infoThe settings have been saved in the database.
'; // Add the adaptive images .htaccess rewrite block. $result = adaptive_images_actions_update_htaccess( $data ); if ( is_wp_error( $result ) ) { $error_data = $result->get_error_data(); $htaccess = $error_data['htaccess']; $permissions = adaptive_images_plugin_file_permissions( $htaccess ); $message .= '' .
$result->get_error_message() . ' ' .
'This probably means a filesystem error or a permissions problem: ' .
'' . $htaccess . ' => ' . $permissions . '.' .
'
' . 'Consider adding this code to your .htaccess file manually: ' . '
' . ''; } else { $message .= '' . htmlspecialchars( trim( $error_data['rewrite'] ) ) . '
' .
'The .htaccess file was successfully updated: ' .
'' . adaptive_images_plugin_get_htaccess_file_path() . '.' .
'
' .
$result->get_error_message() . ' ' .
'This probably means a filesystem error or a permissions problem.' .
'' . $file . ' => ' . $permissions . '.
'.
'
' . 'The plugin will still be able to function but with its default settings until this problem is resolved.' . '
'; } else { $message .= '' .
'The user settings PHP file was successfully updated: ' . '' . adaptive_images_plugin_get_user_settings_file_path() . '.' .
'
' . 'If you are using NginX, you probably need such a bit of code in your configuration file:' . '
' . '' .
adaptive_images_actions_nginx_get_block() .
'';
// Inform user accordingly.
add_settings_error(
'adaptive-images-settings',
'adaptive-images-settings-error',
$message,
'updated'
);
return $data;
}
?>