Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add quick embed documentation for site owner, clean up rewrite rules,…

… and add sample nginx rewrite rule for embedding.
  • Loading branch information...
commit bb30193285bf80196fd25191753d16892c93173b 1 parent 48c4aec
@davemasse authored
Showing with 17 additions and 6 deletions.
  1. +1 −1  display_admin.php
  2. +16 −5 index.php
View
2  display_admin.php
@@ -101,7 +101,7 @@
<p><label for="require_login"><input type="checkbox" name="require_login" id="require_login" value="1" <?php echo ($require_login ? 'checked="checked"' : ''); ?> /> <?php _e('Require login in order to view webcam pages and images?'); ?></label> <?php _e('(Using nginx? See the help tab for details.)'); ?></p>
- <p><label for="allow_embed"><input type="checkbox" name="allow_embed" id="allow_embed" value="1" <?php echo ($allow_embed ? 'checked="checked"' : ''); ?> /> <?php echo _e('Allow embedding of the latest webcam image by other sites?'); ?></label></p>
+ <p><label for="allow_embed"><input type="checkbox" name="allow_embed" id="allow_embed" value="1" <?php echo ($allow_embed ? 'checked="checked"' : ''); ?> /> <?php echo _e('Allow embedding of the latest webcam image by other sites? If enabled, let other sites embed your webcam image using ' . get_bloginfo('wpurl') . '/webcam-archive.jpg?id=N, where N is one of the size IDs listed above.'); ?></label></p>
<p><label for="use_css"><input type="checkbox" name="use_css" id="use_css" value="1" <?php echo ($use_css ? 'checked="checked"' : ''); ?> /> <?php _e('Use the CSS provided with this plugin?'); ?></label></p>
View
21 index.php
@@ -402,8 +402,8 @@ function display_admin() {
'<IfModule mod_rewrite.c>',
'RewriteEngine On',
'RewriteBase /',
- 'RewriteCond %{REQUEST_URI} ^/?webcam-archive.jpg',
- 'RewriteRule (.*) ' . $script_dir . '/embed.php [L]',
+ 'RewriteCond %{REQUEST_URI} ^/?webcam-archive.jpg$',
+ 'RewriteRule .* ' . $script_dir . '/embed.php [L]',
'</IfModule>'
);
@@ -737,14 +737,25 @@ function generate_help() {
$upload_dir = $upload_dir['basedir'];
$upload_dir = str_replace(ABSPATH, '', $upload_dir);
+ $script_dir = dirname(__FILE__);
+ $script_dir = str_replace(ABSPATH, '', $script_dir);
+
$help_text .= '
- <h3>nginx login code</h3>
+ <p>Add the following to your nginx site configuration to enable the following features:</p>
- <p>Add the following to your nginx site configuration:</p>
+ <h3>nginx login code</h3>
<code>
if ($request_uri ~ "^/?' . $upload_dir . '/' . self::upload_dir . '/") {<br />
- &nbsp;&nbsp;rewrite ^(.*)$ /index.php?' . self::filename_key . '=$1 last;<br />
+ &nbsp;&nbsp;rewrite (.*) /index.php?' . self::filename_key . '=$1 last;<br />
+ }
+ </code>
+
+ <h3>nginx embed code</h3>
+
+ <code>
+ if ($request_uri ~ "^/?webcam-archive.jpg$") {<br />
+ &nbsp;&nbsp;rewrite .* /' . $script_dir . '/embed.php last;<br />
}
</code>
';
Please sign in to comment.
Something went wrong with that request. Please try again.