<?php
/**
 * Copyright 2008 Chris Abernethy
 *
 * This file is part of Member Access.
 *
 * Member Access is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Member Access is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Member Access.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
?>
<div class="wrap">

    <h2><?php echo esc_html($this->get('heading')) ?></h2>

    <form method="post" action="">

        <?php wp_nonce_field($this->get('nonce_action')) ?>

        <table class="form-table">

            <tr valign="top">
                <th scope="row"><?php echo esc_html(__('Page Settings', 'member_access')) ?></th>
                <td>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_pages_private')?>" type="checkbox" value="1" <?php echo $this->get('pages_private') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('By default, only members can view pages', 'member_access')) ?></label>
                    <p><?php echo esc_html(__('If this option is enabled, only members will be able to view pages. This setting can be overridden for individual pages.', 'member_access')) ?></p>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_pages_redirect')?>" type="checkbox" value="1" <?php echo $this->get('pages_redirect') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Perform redirect for non-members', 'member_access')) ?></label><br/>
                    <p>
                        <?php echo esc_html(__('If a non-member accesses a page that is viewable only by members, should the user be redirected? If this option is enabled, the user will be redirected to the page chosen in the dropdown, otherwise, the standard "Not Found" page will be displayed.', 'member_access')) ?>
                    </p>
                    <p>
                        <select name="<?php echo esc_attr($this->get('plugin_label') . '_pages_redirect_page') ?>">
                            <option value="0"><?php echo esc_html(__('Wordpress Login Page', 'member_access')) ?></option>
                            <?php parent_dropdown($this->get('pages_redirect_page')) ?>
                        </select>
                    </p>
                    <p>
                        <?php echo esc_html(__('Note that if you select "Wordpress Login Page" from the dropdown, the user will be sent back to the originally requested page after logging in.', 'member_access')) ?>
                    </p>

                </td>
            </tr>

            <tr valign="top">
                <th scope="row"><?php echo esc_html(__('Post Settings', 'member_access')) ?></th>
                <td>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_posts_private')?>" type="checkbox" value="1" <?php echo $this->get('posts_private') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('By default, only members can view posts', 'member_access')) ?></label>
                    <p><?php echo esc_html(__('If this option is enabled, only members will be able to view posts. This setting can be overridden for individual posts.', 'member_access')) ?></p>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_posts_redirect')?>" type="checkbox" value="1" <?php echo $this->get('posts_redirect') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Perform redirect for non-members', 'member_access')) ?></label><br/>
                    <p>
                        <?php echo esc_html(__('If a non-member accesses a post that is viewable only by members, should the user be redirected? If this option is enabled, the user will be redirected to the page chosen in the dropdown, otherwise, the standard "Not Found" page will be displayed.', 'member_access')) ?>
                    </p>
                    <p>
                        <select name="<?php echo esc_attr($this->get('plugin_label') . '_posts_redirect_page') ?>">
                            <option value="0"><?php echo esc_html(__('Wordpress Login Page', 'member_access')) ?></option>
                            <?php parent_dropdown($this->get('posts_redirect_page')) ?>
                        </select>
                    </p>
                    <p>
                        <?php echo esc_html(__('Note that if you select "Wordpress Login Page" from the dropdown, the user will be sent back to the originally requested page after logging in.', 'member_access')) ?>
                    </p>

                </td>
            </tr>

            <tr valign="top">
                <th scope="row"><?php echo esc_html(__('Posts Page Settings', 'member_access')) ?></th>
                <td>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_postspage_excerpts')?>" type="checkbox" value="1" <?php echo $this->get('postspage_excerpts') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Posts page includes excerpts of content viewable only by members', 'member_access')) ?></label>
                    <p><?php echo esc_html(__('Your posts page is configured in Settings->Reading, and is either your home page when you elect to display your latest posts on the home page, or it is the static page that you designate as your posts page. Do you want your posts page to include excerpts of items that are viewable only by members? If this option is not enabled, these items will be omitted entirely from your posts page.', 'member_access')) ?></p>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_postspage_redirect')?>" type="checkbox" value="1" <?php echo $this->get('postspage_redirect') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Perform redirect if all available posts page items are viewable only by members', 'member_access')) ?></label><br/>
                    <p>
                        <?php echo esc_html(__('If a non-member accesses the posts page, all items are viewable only to members, and you have not opted to include excerpts of those items on the posts page pages, should the user be redirected? If this option is enabled, the user will be redirected to the page chosen in the dropdown, otherwise, the standard "Not Found" page will be displayed.', 'member_access')) ?>
                    </p>
                    <p>
                        <select name="<?php echo esc_attr($this->get('plugin_label') . '_postspage_redirect_page') ?>">
                            <option value="0"><?php echo esc_html(__('Wordpress Login Page', 'member_access')) ?></option>
                            <?php parent_dropdown($this->get('postspage_redirect_page')) ?>
                        </select>
                    </p>
                    <p>
                        <?php echo esc_html(__('Note that if you select "Wordpress Login Page" from the dropdown, the user will be sent back to the posts page after logging in.', 'member_access')) ?>
                    </p>

                </td>
            </tr>

            <tr valign="top">
                <th scope="row"><?php echo esc_html(__('Archive Settings', 'member_access')) ?></th>
                <td>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_archive_excerpts')?>" type="checkbox" value="1" <?php echo $this->get('archive_excerpts') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Archive pages include excerpts of content viewable only by members', 'member_access')) ?></label>
                    <p><?php echo esc_html(__('Do you want archive pages to include excerpts of items that are viewable only by members? If this option is not enabled, these items will be omitted entirely from archive pages.', 'member_access')) ?></p>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_archive_redirect')?>" type="checkbox" value="1" <?php echo $this->get('archive_redirect') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Perform redirect if all available archive items are viewable only by members', 'member_access')) ?></label><br/>
                    <p>
                        <?php echo esc_html(__('If a non-member accesses an archive page for which all items are viewable only to members, and you have not opted to include excerpts of those items on archive pages, should the user be redirected? If this option is enabled, the user will be redirected to the page chosen in the dropdown, otherwise, the standard "Not Found" page will be displayed.', 'member_access')) ?>
                    </p>
                    <p>
                        <select name="<?php echo esc_attr($this->get('plugin_label') . '_archive_redirect_page') ?>">
                            <option value="0"><?php echo esc_html(__('Wordpress Login Page', 'member_access')) ?></option>
                            <?php parent_dropdown($this->get('archive_redirect_page')) ?>
                        </select>
                    </p>
                    <p>
                        <?php echo esc_html(__('Note that if you select "Wordpress Login Page" from the dropdown, the user will be sent back to the originally requested page after logging in.', 'member_access')) ?>
                    </p>

                </td>
            </tr>

            <tr valign="top">
                <th scope="row"><?php echo esc_html(__('Search Settings', 'member_access')) ?></th>
                <td>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_search_excerpts')?>" type="checkbox" value="1" <?php echo $this->get('search_excerpts') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Search results include excerpts of content viewable only by members', 'member_access')) ?></label>
                    <p><?php echo esc_html(__('Do you want search results to include excerpts of items viewable only by members? If this option is not enabled, these items will be omitted entirely from search results.', 'member_access')) ?></p>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_search_redirect')?>" type="checkbox" value="1" <?php echo $this->get('search_redirect') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('Perform redirect if all search results are viewable only by members', 'member_access')) ?></label><br/>
                    <p>
                        <?php echo esc_html(__('If a non-member performs a search for which all results are viewable only to members, and you have not opted to include excerpts of those items in search results, should the user be redirected? If this option is enabled, the user will be redirected to the page chosen in the dropdown, otherwise, the standard "Not Found" page will be displayed.', 'member_access')) ?>
                    </p>
                    <p>
                        <select name="<?php echo esc_attr($this->get('plugin_label') . '_search_redirect_page') ?>">
                            <option value="0"><?php echo esc_html(__('Wordpress Login Page', 'member_access')) ?></option>
                            <?php parent_dropdown($this->get('search_redirect_page')) ?>
                        </select>
                    </p>
                    <p>
                        <?php echo esc_html(__('Note that if you select "Wordpress Login Page" from the dropdown, the user will be sent back to the original search result listing after logging in.', 'member_access')) ?>
                    </p>

                </td>
            </tr>

            <tr valign="top">
                <th scope="row"><?php echo esc_html(__('RSS Settings', 'member_access')) ?></th>
                <td>

                    <label class="selectit"><input name="<?php echo esc_attr($this->get('plugin_label') . '_rss_excerpts')?>" type="checkbox" value="1" <?php echo $this->get('rss_excerpts') ? 'checked="checked"' : ''?>/> <?php echo esc_html(__('RSS feeds include excerpts of content viewable only by members', 'member_access')) ?></label>
                    <p><?php echo esc_html(__('Do you want RSS feeds to include excerpts of items viewable only by members? If this option is not enabled, these items will be omitted entirely from RSS feeds.', 'member_access')) ?></p>

                </td>
            </tr>

        </table>

        <input type="hidden" name="action" value="update"/>

        <p class="submit">
            <input type="submit" name="<?php echo esc_attr($this->get('plugin_label') . '_submit') ?>" value="<?php echo esc_html(__('Save Changes', 'member_access')) ?>" />
            <input type="submit" name="<?php echo esc_attr($this->get('plugin_label') . '_clear_post_overrides') ?>" value="<?php echo esc_html(__('Clear Post Overrides', 'member_access')) ?>" />
            <input type="submit" name="<?php echo esc_attr($this->get('plugin_label') . '_clear_page_overrides') ?>" value="<?php echo esc_html(__('Clear Page Overrides', 'member_access')) ?>" />
        </p>

    </form>

</div>
