@@ -18,37 +18,37 @@ discard block |
||
18 | 18 | <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> |
19 | 19 | |
20 | 20 | <form method="post" action="options.php"> |
21 | - <?php settings_fields( 'imgix_settings_group' ); ?> |
|
21 | + <?php settings_fields('imgix_settings_group'); ?> |
|
22 | 22 | |
23 | 23 | <table class="form-table"> |
24 | 24 | |
25 | 25 | <tbody> |
26 | 26 | |
27 | 27 | <tr> |
28 | - <th><label class="description" for="imgix_settings[cdn_link]"><?php esc_html_e( 'imgix Source', 'imgix_domain' ); ?></th> |
|
29 | - <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> |
|
28 | + <th><label class="description" for="imgix_settings[cdn_link]"><?php esc_html_e('imgix Source', 'imgix_domain'); ?></th> |
|
29 | + <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> |
|
30 | 30 | </tr> |
31 | 31 | |
32 | 32 | <tr> |
33 | - <th><label class="description" for="imgix_settings[auto_format]"><?php esc_html_e( 'Auto Format Images', 'auto_format' ); ?></label></th> |
|
34 | - <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> |
|
33 | + <th><label class="description" for="imgix_settings[auto_format]"><?php esc_html_e('Auto Format Images', 'auto_format'); ?></label></th> |
|
34 | + <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> |
|
35 | 35 | </tr> |
36 | 36 | |
37 | 37 | <tr> |
38 | - <th><label class="description" for="imgix_settings[auto_enhance]"><?php esc_html_e( 'Auto Enhance Images', 'auto_enhance' ); ?></label></th> |
|
39 | - <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> |
|
38 | + <th><label class="description" for="imgix_settings[auto_enhance]"><?php esc_html_e('Auto Enhance Images', 'auto_enhance'); ?></label></th> |
|
39 | + <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> |
|
40 | 40 | </tr> |
41 | 41 | |
42 | 42 | <tr> |
43 | - <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> |
|
44 | - <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> |
|
43 | + <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> |
|
44 | + <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> |
|
45 | 45 | </tr> |
46 | 46 | |
47 | 47 | </tbody> |
48 | 48 | </table> |
49 | 49 | |
50 | 50 | <p class="submit"> |
51 | - <input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Options', 'imgix_domain' ); ?>" /> |
|
51 | + <input type="submit" class="button-primary" value="<?php esc_html_e('Save Options', 'imgix_domain'); ?>" /> |
|
52 | 52 | </p> |
53 | 53 | </form> |
54 | 54 | |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | * Adds link to options page in Admin > Settings menu. |
64 | 64 | */ |
65 | 65 | function imgix_add_options_link() { |
66 | - add_options_page( 'imgix', 'imgix', 'manage_options', 'imgix-options', 'imgix_options_page' ); |
|
66 | + add_options_page('imgix', 'imgix', 'manage_options', 'imgix-options', 'imgix_options_page'); |
|
67 | 67 | } |
68 | -add_action( 'admin_menu', 'imgix_add_options_link' ); |
|
68 | +add_action('admin_menu', 'imgix_add_options_link'); |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Creates our settings in the options table. |
72 | 72 | */ |
73 | 73 | function imgix_register_settings() { |
74 | - register_setting( 'imgix_settings_group', 'imgix_settings' ); |
|
74 | + register_setting('imgix_settings_group', 'imgix_settings'); |
|
75 | 75 | } |
76 | 76 | |
77 | -add_action( 'admin_init', 'imgix_register_settings' ); |
|
77 | +add_action('admin_init', 'imgix_register_settings'); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package imgix |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! function_exists( 'wp_parse_url' ) ) { |
|
8 | +if ( ! function_exists('wp_parse_url')) { |
|
9 | 9 | /** |
10 | 10 | * A wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7 |
11 | 11 | * |
@@ -23,30 +23,30 @@ discard block |
||
23 | 23 | * @return bool|array False on failure; Array of URL components on success; |
24 | 24 | * See parse_url()'s return values. |
25 | 25 | */ |
26 | - function wp_parse_url( $url ) { |
|
27 | - $parts = @parse_url( $url ); |
|
28 | - if ( ! $parts ) { |
|
26 | + function wp_parse_url($url) { |
|
27 | + $parts = @parse_url($url); |
|
28 | + if ( ! $parts) { |
|
29 | 29 | // < PHP 5.4.7 compat, trouble with relative paths including a scheme break in the path |
30 | - if ( '/' == $url[0] && false !== strpos( $url, '://' ) ) { |
|
30 | + if ('/' == $url[0] && false !== strpos($url, '://')) { |
|
31 | 31 | // Since we know it's a relative path, prefix with a scheme/host placeholder and try again |
32 | - if ( ! $parts = @parse_url( 'placeholder://placeholder' . $url ) ) { |
|
32 | + if ( ! $parts = @parse_url('placeholder://placeholder' . $url)) { |
|
33 | 33 | return $parts; |
34 | 34 | } |
35 | 35 | // Remove the placeholder values |
36 | - unset( $parts['scheme'], $parts['host'] ); |
|
36 | + unset($parts['scheme'], $parts['host']); |
|
37 | 37 | } else { |
38 | 38 | return $parts; |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | 42 | // < PHP 5.4.7 compat, doesn't detect schemeless URL's host field |
43 | - if ( '//' == substr( $url, 0, 2 ) && ! isset( $parts['host'] ) ) { |
|
44 | - $path_parts = explode( '/', substr( $parts['path'], 2 ), 2 ); |
|
43 | + if ('//' == substr($url, 0, 2) && ! isset($parts['host'])) { |
|
44 | + $path_parts = explode('/', substr($parts['path'], 2), 2); |
|
45 | 45 | $parts['host'] = $path_parts[0]; |
46 | - if ( isset( $path_parts[1] ) ) { |
|
46 | + if (isset($path_parts[1])) { |
|
47 | 47 | $parts['path'] = '/' . $path_parts[1]; |
48 | 48 | } else { |
49 | - unset( $parts['path'] ); |
|
49 | + unset($parts['path']); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -if ( ! function_exists( 'http_build_url' ) ) { |
|
57 | +if ( ! function_exists('http_build_url')) { |
|
58 | 58 | /** |
59 | 59 | * This is a simplified version of http_build_url if pecl_http is missing |
60 | 60 | * |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - function http_build_url( $parsed_url ) { |
|
66 | - $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : ''; |
|
67 | - $host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : ''; |
|
68 | - $port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : ''; |
|
69 | - $user = isset( $parsed_url['user'] ) ? $parsed_url['user'] : ''; |
|
70 | - $pass = isset( $parsed_url['pass'] ) ? ':' . $parsed_url['pass'] : ''; |
|
71 | - $pass = ( $user || $pass ) ? "$pass@" : ''; |
|
72 | - $path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : ''; |
|
73 | - $query = isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : ''; |
|
74 | - $fragment = isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : ''; |
|
65 | + function http_build_url($parsed_url) { |
|
66 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
67 | + $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
|
68 | + $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
69 | + $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; |
|
70 | + $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; |
|
71 | + $pass = ($user || $pass) ? "$pass@" : ''; |
|
72 | + $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; |
|
73 | + $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
74 | + $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
75 | 75 | |
76 | 76 | return "$scheme$user$pass$host$port$path$query$fragment"; |
77 | 77 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return string Content with retina-enriched image tags. |
15 | 15 | */ |
16 | -function imgix_add_retina( $content ) { |
|
16 | +function imgix_add_retina($content) { |
|
17 | 17 | $pattern = '/<img((?![^>]+srcset )([^>]*)'; |
18 | 18 | $pattern .= 'src=[\'"]([^\'"]*imgix.net[^\'"]*\?[^\'"]*w=[^\'"]*)[\'"]([^>]*)*?)>/i'; |
19 | 19 | $repl = '<img$2src="$3" srcset="${3}, ${3}&dpr=2 2x, ${3}&dpr=3 3x,"$4>'; |
20 | - $content = preg_replace( $pattern, $repl, $content ); |
|
20 | + $content = preg_replace($pattern, $repl, $content); |
|
21 | 21 | |
22 | - return preg_replace( $pattern, $repl, $content ); |
|
22 | + return preg_replace($pattern, $repl, $content); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | // For now, only "auto" is supported. |
36 | 36 | |
37 | 37 | $auto = []; |
38 | - if ( ! empty( $imgix_options['auto_format'] ) ) { |
|
39 | - array_push( $auto, 'format' ); |
|
38 | + if ( ! empty($imgix_options['auto_format'])) { |
|
39 | + array_push($auto, 'format'); |
|
40 | 40 | } |
41 | 41 | |
42 | - if ( ! empty( $imgix_options['auto_enhance'] ) ) { |
|
43 | - array_push( $auto, 'enhance' ); |
|
42 | + if ( ! empty($imgix_options['auto_enhance'])) { |
|
43 | + array_push($auto, 'enhance'); |
|
44 | 44 | } |
45 | 45 | |
46 | - if ( ! empty( $auto ) ) { |
|
47 | - $params['auto'] = implode( ',', $auto ); |
|
46 | + if ( ! empty($auto)) { |
|
47 | + $params['auto'] = implode(',', $auto); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $params; |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return array with filename and size arguments. |
60 | 60 | */ |
61 | -function convert_filename_to_size_args( $filename ) { |
|
61 | +function convert_filename_to_size_args($filename) { |
|
62 | 62 | $arguments = []; |
63 | 63 | |
64 | - $filename = preg_replace_callback( '/-(?<width>\d+)x(?<height>\d+)(?<extension>\.\w{3,4}$)/', function ( $match ) use ( &$arguments ) { |
|
64 | + $filename = preg_replace_callback('/-(?<width>\d+)x(?<height>\d+)(?<extension>\.\w{3,4}$)/', function($match) use (&$arguments) { |
|
65 | 65 | $arguments = [ |
66 | 66 | 'w' => $match['width'], |
67 | 67 | 'h' => $match['height'] |
68 | 68 | ]; |
69 | 69 | |
70 | 70 | return $match['extension']; |
71 | - }, $filename ); |
|
71 | + }, $filename); |
|
72 | 72 | |
73 | - return [ $filename, $arguments ]; |
|
73 | + return [$filename, $arguments]; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string |
82 | 82 | */ |
83 | -function imgix_file_url( $url ) { |
|
83 | +function imgix_file_url($url) { |
|
84 | 84 | |
85 | 85 | global $imgix_options; |
86 | 86 | |
87 | - if ( empty ( $imgix_options['cdn_link'] ) ) { |
|
87 | + if (empty ($imgix_options['cdn_link'])) { |
|
88 | 88 | return $url; |
89 | 89 | } |
90 | 90 | |
91 | - $file = pathinfo( $url ); |
|
91 | + $file = pathinfo($url); |
|
92 | 92 | |
93 | - if ( in_array( $file['extension'], [ 'jpg', 'gif', 'png', 'jpeg' ] ) ) { |
|
94 | - return str_replace( trailingslashit( home_url( '/' ) ), trailingslashit( $imgix_options['cdn_link'] ), $url ); |
|
93 | + if (in_array($file['extension'], ['jpg', 'gif', 'png', 'jpeg'])) { |
|
94 | + return str_replace(trailingslashit(home_url('/')), trailingslashit($imgix_options['cdn_link']), $url); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $url; |
98 | 98 | } |
99 | 99 | |
100 | -add_filter( 'wp_get_attachment_url', 'imgix_file_url' ); |
|
101 | -add_filter( 'imgix/add-image-url', 'imgix_file_url' ); |
|
100 | +add_filter('wp_get_attachment_url', 'imgix_file_url'); |
|
101 | +add_filter('imgix/add-image-url', 'imgix_file_url'); |
|
102 | 102 | |
103 | 103 | /** |
104 | 104 | * Modify image urls in srcset to use imgix host. |
@@ -107,15 +107,15 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return array $sources |
109 | 109 | */ |
110 | -function imgix_cdn_srcset( $sources ) { |
|
111 | - foreach ( $sources as $source ) { |
|
112 | - $sources[ $source['value'] ]['url'] = apply_filters( 'imgix/add-image-url', $sources[ $source['value'] ]['url'] ); |
|
110 | +function imgix_cdn_srcset($sources) { |
|
111 | + foreach ($sources as $source) { |
|
112 | + $sources[$source['value']]['url'] = apply_filters('imgix/add-image-url', $sources[$source['value']]['url']); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $sources; |
116 | 116 | } |
117 | 117 | |
118 | -add_filter( 'wp_calculate_image_srcset', 'imgix_cdn_srcset', 10 ); |
|
118 | +add_filter('wp_calculate_image_srcset', 'imgix_cdn_srcset', 10); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Modify image urls in content to use imgix host. |
@@ -124,75 +124,75 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return string |
126 | 126 | */ |
127 | -function imgix_replace_non_wp_images( $content ) { |
|
127 | +function imgix_replace_non_wp_images($content) { |
|
128 | 128 | global $imgix_options; |
129 | 129 | |
130 | - if ( ! empty( $imgix_options['cdn_link'] ) ) { |
|
130 | + if ( ! empty($imgix_options['cdn_link'])) { |
|
131 | 131 | |
132 | - $content = preg_replace_callback( '/(?<=\shref="|\ssrc="|\shref=\'|\ssrc=\').*(?=\'|")/', function ( $match ) use ( $imgix_options ) { |
|
132 | + $content = preg_replace_callback('/(?<=\shref="|\ssrc="|\shref=\'|\ssrc=\').*(?=\'|")/', function($match) use ($imgix_options) { |
|
133 | 133 | $url = $match[0]; |
134 | 134 | |
135 | - $pathinfo = pathinfo( $url ); |
|
135 | + $pathinfo = pathinfo($url); |
|
136 | 136 | |
137 | - if ( in_array( $pathinfo['extension'], [ 'jpg', 'gif', 'png', 'jpeg' ], true ) ) { |
|
138 | - $file_url = parse_url( $url ); |
|
139 | - if ( $file_url['host'] === parse_url( home_url( '/' ), PHP_URL_HOST ) ) { |
|
140 | - $cdn = parse_url( $imgix_options['cdn_link'] ); |
|
141 | - foreach ( [ 'scheme', 'host', 'port' ] as $url_part ) { |
|
142 | - if ( isset( $cdn[ $url_part ] ) ) { |
|
143 | - $file_url[ $url_part ] = $cdn[ $url_part ]; |
|
137 | + if (in_array($pathinfo['extension'], ['jpg', 'gif', 'png', 'jpeg'], true)) { |
|
138 | + $file_url = parse_url($url); |
|
139 | + if ($file_url['host'] === parse_url(home_url('/'), PHP_URL_HOST)) { |
|
140 | + $cdn = parse_url($imgix_options['cdn_link']); |
|
141 | + foreach (['scheme', 'host', 'port'] as $url_part) { |
|
142 | + if (isset($cdn[$url_part])) { |
|
143 | + $file_url[$url_part] = $cdn[$url_part]; |
|
144 | 144 | } else { |
145 | - unset( $file_url[ $url_part ] ); |
|
145 | + unset($file_url[$url_part]); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - list( $filename, $arguments ) = convert_filename_to_size_args( $pathinfo['basename'] ); |
|
149 | + list($filename, $arguments) = convert_filename_to_size_args($pathinfo['basename']); |
|
150 | 150 | |
151 | - $arguments = array_merge( $arguments, imgix_get_global_params() ); |
|
151 | + $arguments = array_merge($arguments, imgix_get_global_params()); |
|
152 | 152 | |
153 | - $file_url['path'] = trailingslashit( dirname( $file_url['path'] ) ) . $filename; |
|
153 | + $file_url['path'] = trailingslashit(dirname($file_url['path'])) . $filename; |
|
154 | 154 | |
155 | - if ( ! empty( $arguments ) ) { |
|
156 | - $file_url['query'] = empty( $file_url['query'] ) ? build_query( $arguments ) : $file_url['query'] . '&' . build_query( $arguments ); |
|
155 | + if ( ! empty($arguments)) { |
|
156 | + $file_url['query'] = empty($file_url['query']) ? build_query($arguments) : $file_url['query'] . '&' . build_query($arguments); |
|
157 | 157 | } |
158 | 158 | |
159 | - $url = http_build_url( $file_url ); |
|
159 | + $url = http_build_url($file_url); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | |
164 | - return esc_url_raw( $url ); |
|
165 | - }, $content ); |
|
164 | + return esc_url_raw($url); |
|
165 | + }, $content); |
|
166 | 166 | |
167 | 167 | } |
168 | 168 | |
169 | 169 | return $content; |
170 | 170 | } |
171 | 171 | |
172 | -add_filter( 'the_content', 'imgix_replace_non_wp_images' ); |
|
172 | +add_filter('the_content', 'imgix_replace_non_wp_images'); |
|
173 | 173 | |
174 | 174 | function imgix_wp_head() { |
175 | 175 | global $imgix_options; |
176 | 176 | |
177 | - if ( isset( $imgix_options['cdn_link'] ) && $imgix_options['cdn_link'] ) { |
|
178 | - printf( "<link rel='dns-prefetch' href='%s'/>", |
|
179 | - esc_url( preg_replace( '/^https?:/', '', untrailingslashit( $imgix_options['cdn_link'] ) ) ) |
|
177 | + if (isset($imgix_options['cdn_link']) && $imgix_options['cdn_link']) { |
|
178 | + printf("<link rel='dns-prefetch' href='%s'/>", |
|
179 | + esc_url(preg_replace('/^https?:/', '', untrailingslashit($imgix_options['cdn_link']))) |
|
180 | 180 | ); |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | -add_action( 'wp_head', 'imgix_wp_head', 1 ); |
|
184 | +add_action('wp_head', 'imgix_wp_head', 1); |
|
185 | 185 | |
186 | -if ( isset( $imgix_options['add_dpi2_srcset'] ) && $imgix_options['add_dpi2_srcset'] ) { |
|
186 | +if (isset($imgix_options['add_dpi2_srcset']) && $imgix_options['add_dpi2_srcset']) { |
|
187 | 187 | function imgix_buffer_start() { |
188 | - ob_start( 'imgix_add_retina' ); |
|
188 | + ob_start('imgix_add_retina'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | function imgix_buffer_end() { |
192 | 192 | ob_end_flush(); |
193 | 193 | } |
194 | 194 | |
195 | - add_action( 'after_setup_theme', 'imgix_buffer_start' ); |
|
196 | - add_action( 'shutdown', 'imgix_buffer_end' ); |
|
197 | - add_filter( 'the_content', 'imgix_add_retina' ); |
|
195 | + add_action('after_setup_theme', 'imgix_buffer_start'); |
|
196 | + add_action('shutdown', 'imgix_buffer_end'); |
|
197 | + add_filter('the_content', 'imgix_add_retina'); |
|
198 | 198 | } |
@@ -16,26 +16,26 @@ |
||
16 | 16 | * Author URI: http://github.com/imgix-wordpress |
17 | 17 | */ |
18 | 18 | |
19 | -define('IMGIX_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
19 | +define('IMGIX_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
20 | 20 | |
21 | -$imgix_options = get_option( 'imgix_settings' ); |
|
21 | +$imgix_options = get_option('imgix_settings'); |
|
22 | 22 | |
23 | -include( 'includes/compability.php' ); |
|
24 | -include( 'includes/do-functions.php' ); |
|
25 | -include( 'includes/options-page.php' ); |
|
23 | +include('includes/compability.php'); |
|
24 | +include('includes/do-functions.php'); |
|
25 | +include('includes/options-page.php'); |
|
26 | 26 | |
27 | -function imgix_plugin_admin_action_links( $links, $file ) { |
|
27 | +function imgix_plugin_admin_action_links($links, $file) { |
|
28 | 28 | static $my_plugin; |
29 | 29 | |
30 | - if ( ! $my_plugin ) { |
|
31 | - $my_plugin = plugin_basename( __FILE__ ); |
|
30 | + if ( ! $my_plugin) { |
|
31 | + $my_plugin = plugin_basename(__FILE__); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( $file === $my_plugin ) { |
|
34 | + if ($file === $my_plugin) { |
|
35 | 35 | $settings_link = '<a href="options-general.php?page=imgix-options">Settings</a>'; |
36 | - array_unshift( $links, $settings_link ); |
|
36 | + array_unshift($links, $settings_link); |
|
37 | 37 | } |
38 | 38 | return $links; |
39 | 39 | } |
40 | 40 | |
41 | -add_filter( 'plugin_action_links', 'imgix_plugin_admin_action_links', 10, 2 ); |
|
41 | +add_filter('plugin_action_links', 'imgix_plugin_admin_action_links', 10, 2); |