@@ -173,23 +173,34 @@ function nginx_general_options_page()
173173 $ redis_hostname = ( empty ( $ rt_wp_nginx_helper ->options ['redis_hostname ' ] ) ) ? '127.0.0.1 ' : $ rt_wp_nginx_helper ->options ['redis_hostname ' ];
174174 $ redis_port = ( empty ( $ rt_wp_nginx_helper ->options ['redis_port ' ] ) ) ? '6379 ' : $ rt_wp_nginx_helper ->options ['redis_port ' ];
175175 $ redis_prefix = ( empty ( $ rt_wp_nginx_helper ->options ['redis_prefix ' ] ) ) ? 'nginx-cache: ' : $ rt_wp_nginx_helper ->options ['redis_prefix ' ];
176+
177+ $ redis_hostname = defined ('RT_WP_NGINX_HELPER_REDIS_HOSTNAME ' ) ? RT_WP_NGINX_HELPER_REDIS_HOSTNAME : $ redis_hostname ;
178+ $ redis_port = defined ('RT_WP_NGINX_HELPER_REDIS_PORT ' ) ? RT_WP_NGINX_HELPER_REDIS_PORT : $ redis_port ;
179+ $ redis_prefix = defined ('RT_WP_NGINX_HELPER_REDIS_PREFIX ' ) ? RT_WP_NGINX_HELPER_REDIS_PREFIX : $ redis_prefix ;
180+
181+ $ redis_hostname_readonly = defined ('RT_WP_NGINX_HELPER_REDIS_HOSTNAME ' ) ? 'readonly="readonly" ' : '' ;
182+ $ redis_port_readonly = defined ('RT_WP_NGINX_HELPER_REDIS_PORT ' ) ? 'readonly="readonly" ' : '' ;
183+ $ redis_prefix_readonly = defined ('RT_WP_NGINX_HELPER_REDIS_PREFIX ' ) ? 'readonly="readonly" ' : '' ;
176184 ?>
177185 <tr>
178186 <th><label for="redis_hostname"><?php _e ( 'Hostname ' , 'nginx-helper ' ); ?> </label></th>
179187 <td>
180- <input id="redis_hostname" class="medium-text" type="text" name="redis_hostname" value="<?php echo $ redis_hostname ; ?> " />
188+ <input id="redis_hostname" class="medium-text" type="text" name="redis_hostname" value="<?php echo $ redis_hostname ; ?> " <?php echo $ redis_hostname_readonly ; ?> />
189+ <?php if ($ redis_hostname_readonly ) echo '<p class="description">Overridden by global define</p> ' ; ?>
181190 </td>
182191 </tr>
183192 <tr>
184193 <th><label for="redis_port"><?php _e ( 'Port ' , 'nginx-helper ' ); ?> </label></th>
185194 <td>
186- <input id="redis_port" class="medium-text" type="text" name="redis_port" value="<?php echo $ redis_port ; ?> " />
195+ <input id="redis_port" class="medium-text" type="text" name="redis_port" value="<?php echo $ redis_port ; ?> " <?php echo $ redis_port_readonly ; ?> />
196+ <?php if ($ redis_port_readonly ) echo '<p class="description">Overridden by global define</p> ' ; ?>
187197 </td>
188198 </tr>
189199 <tr>
190200 <th><label for="redis_prefix"><?php _e ( 'Prefix ' , 'nginx-helper ' ); ?> </label></th>
191201 <td>
192- <input id="redis_prefix" class="medium-text" type="text" name="redis_prefix" value="<?php echo $ redis_prefix ; ?> " />
202+ <input id="redis_prefix" class="medium-text" type="text" name="redis_prefix" value="<?php echo $ redis_prefix ; ?> " <?php echo $ redis_prefix_readonly ; ?> />
203+ <?php if ($ redis_prefix_readonly ) echo '<p class="description">Overridden by global define</p> ' ; ?>
193204 </td>
194205 </tr>
195206 </table>
0 commit comments