|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* Renders options page |
|
5
|
|
|
* |
|
6
|
|
|
* @package imgix |
|
7
|
|
|
*/ |
|
8
|
|
|
function imgix_options_page() { |
|
9
|
|
|
|
|
10
|
|
|
global $imgix_options; |
|
11
|
|
|
|
|
12
|
|
|
?> |
|
13
|
|
|
<div class="wrap"> |
|
14
|
|
|
|
|
15
|
|
|
<h1><img src="https://assets.imgix.net/imgix-logo-web-2014.pdf?page=2&fm=png&w=200&h=200" alt="imgix Logo"></h1> |
|
16
|
|
|
|
|
17
|
|
|
<p><strong>Need help getting started?</strong> It's easy! Check out our <a href="https://github.com/imgix-wordpress/imgix-wordpress#getting-started" target="_blank">instructions.</a></p> |
|
18
|
|
|
|
|
19
|
|
|
<form method="post" action="options.php"> |
|
20
|
|
|
<?php settings_fields( 'imgix_settings_group' ); ?> |
|
21
|
|
|
|
|
22
|
|
|
<table class="form-table"> |
|
23
|
|
|
|
|
24
|
|
|
<tbody> |
|
25
|
|
|
|
|
26
|
|
|
<tr> |
|
27
|
|
|
<th><label class="description" for="imgix_settings[cdn_link]"><?php esc_html_e( 'imgix Source', 'imgix_domain' ); ?></th> |
|
28
|
|
|
<td><input id="imgix_settings[cdn_link]" type="url" name="imgix_settings[cdn_link]" placeholder="https://yourcompany.imgix.net" value="<?php echo isset( $imgix_options['cdn_link'] ) ? esc_url( $imgix_options['cdn_link'] ) : ''; ?>" class="regular-text code" /></td> |
|
29
|
|
|
</tr> |
|
30
|
|
|
|
|
31
|
|
|
<tr> |
|
32
|
|
|
<th><label class="description" for="imgix_settings[auto_format]"><?php esc_html_e( '<a href="http://blog.imgix.com/post/90838796454/webp-jpeg-xr-progressive-jpg-support-w-auto" target="_blank">Auto Format</a> Images', 'auto_format' ); ?></label></th> |
|
33
|
|
|
<td><input id="imgix_settings[auto_format]" type="checkbox" name="imgix_settings[auto_format]" value="1" <?php echo isset( $imgix_options['auto_format'] ) && '1' === $imgix_options['auto_format'] ? 'checked="checked"' : ''; ?> /></td> |
|
34
|
|
|
</tr> |
|
35
|
|
|
|
|
36
|
|
|
<tr> |
|
37
|
|
|
<th><label class="description" for="imgix_settings[auto_enhance]"><?php esc_html_e( '<a href="http://blog.imgix.com/post/85095931364/autoenhance" target="_blank">Auto Enhance</a> Images', 'auto_enhance' ); ?></label></th> |
|
38
|
|
|
<td><input id="imgix_settings[auto_enhance]" type="checkbox" name="imgix_settings[auto_enhance]" value="1" <?php echo isset( $imgix_options['auto_enhance'] ) && '1' === $imgix_options['auto_enhance'] ? 'checked="checked"' : ''; ?> /></td> |
|
39
|
|
|
</tr> |
|
40
|
|
|
|
|
41
|
|
|
<tr> |
|
42
|
|
|
<th><label class="description" for="imgix_settings[add_dpi2_srcset]"><?php esc_html_e( 'Automatically add retina images using srcset', 'add_dpi2_srcset' ); ?></label></th> |
|
43
|
|
|
<td><input id="imgix_settings[add_dpi2_srcset]" type="checkbox" name="imgix_settings[add_dpi2_srcset]" value="1" <?php echo isset( $imgix_options['add_dpi2_srcset'] ) && '1' === $imgix_options['add_dpi2_srcset'] ? 'checked="checked"' : ''; ?> /></td> |
|
44
|
|
|
</tr> |
|
45
|
|
|
|
|
46
|
|
|
</tbody> |
|
47
|
|
|
</table> |
|
48
|
|
|
|
|
49
|
|
|
<p class="submit"> |
|
50
|
|
|
<input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Options', 'imgix_domain' ); ?>" /> |
|
51
|
|
|
</p> |
|
52
|
|
|
</form> |
|
53
|
|
|
|
|
54
|
|
|
<p class="description"> |
|
55
|
|
|
This plugin is powered by <a href="http://www.imgix.com" target="_blank">imgix</a>. You can find and contribute to the code on <a href="https://github.com/imgix-wordpress/imgix-wordpress" target="_blank">GitHub</a>. |
|
56
|
|
|
</p> |
|
57
|
|
|
</div> |
|
58
|
|
|
<?php |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Adds link to options page in Admin > Settings menu. |
|
63
|
|
|
*/ |
|
64
|
|
|
function imgix_add_options_link() { |
|
65
|
|
|
add_options_page( 'imgix', 'imgix', 'manage_options', 'imgix-options', 'imgix_options_page' ); |
|
66
|
|
|
} |
|
67
|
|
|
add_action( 'admin_menu', 'imgix_add_options_link' ); |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Creates our settings in the options table. |
|
71
|
|
|
*/ |
|
72
|
|
|
function imgix_register_settings() { |
|
73
|
|
|
register_setting( 'imgix_settings_group', 'imgix_settings' ); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
add_action( 'admin_init', 'imgix_register_settings' ); |
|
77
|
|
|
|