Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Dave Masse authored

Showing 2 changed files with 17 additions and 6 deletions. Show diff stats Hide diff stats

  1. +1 1  display_admin.php
  2. +16 5 index.php
2  display_admin.php
@@ -101,7 +101,7 @@
101 101
102 102 <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>
103 103
104   - <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>
  104 + <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>
105 105
106 106 <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>
107 107
21 index.php
@@ -402,8 +402,8 @@ function display_admin() {
402 402 '<IfModule mod_rewrite.c>',
403 403 'RewriteEngine On',
404 404 'RewriteBase /',
405   - 'RewriteCond %{REQUEST_URI} ^/?webcam-archive.jpg',
406   - 'RewriteRule (.*) ' . $script_dir . '/embed.php [L]',
  405 + 'RewriteCond %{REQUEST_URI} ^/?webcam-archive.jpg$',
  406 + 'RewriteRule .* ' . $script_dir . '/embed.php [L]',
407 407 '</IfModule>'
408 408 );
409 409
@@ -737,14 +737,25 @@ function generate_help() {
737 737 $upload_dir = $upload_dir['basedir'];
738 738 $upload_dir = str_replace(ABSPATH, '', $upload_dir);
739 739
  740 + $script_dir = dirname(__FILE__);
  741 + $script_dir = str_replace(ABSPATH, '', $script_dir);
  742 +
740 743 $help_text .= '
741   - <h3>nginx login code</h3>
  744 + <p>Add the following to your nginx site configuration to enable the following features:</p>
742 745
743   - <p>Add the following to your nginx site configuration:</p>
  746 + <h3>nginx login code</h3>
744 747
745 748 <code>
746 749 if ($request_uri ~ "^/?' . $upload_dir . '/' . self::upload_dir . '/") {<br />
747   - &nbsp;&nbsp;rewrite ^(.*)$ /index.php?' . self::filename_key . '=$1 last;<br />
  750 + &nbsp;&nbsp;rewrite (.*) /index.php?' . self::filename_key . '=$1 last;<br />
  751 + }
  752 + </code>
  753 +
  754 + <h3>nginx embed code</h3>
  755 +
  756 + <code>
  757 + if ($request_uri ~ "^/?webcam-archive.jpg$") {<br />
  758 + &nbsp;&nbsp;rewrite .* /' . $script_dir . '/embed.php last;<br />
748 759 }
749 760 </code>
750 761 ';

0 comments on commit bb30193

Please sign in to comment.
Something went wrong with that request. Please try again.