Example #1
0
<?php

/*
Plugin Name: Private Blog
Plugin URI: http://www.volcanicpixels.com/password-protect-wordpress-plugin/
Description: Private Blog is a wordpress plugin which allows you to password protect all of your wordpress blog including all posts and feeds with a single password.
Version: 5.0.5
Author: Daniel Chatfield
Author URI: http://www.danielchatfield.com
License: GPLv2
*/
error_reporting(0);
include dirname(__FILE__) . "/lava/lava.php";
$pluginName = "Private Blog";
$pluginVersion = "5.0.5";
$thePlugin = lava::newPlugin(__FILE__, $pluginName, $pluginVersion);
$pluginSlug = $thePlugin->_slug();
/**
 *
 * Define the plugin settings:
 *	Enabled
 *	Multiple Passwords
 *	Passwords
 *	Login Duration
 *	Add logout button
 */
// To change maximum passwords change the value of the variable below
global $maxPasswords;
$maxPasswords = 10;
$thePlugin->_settings()->addSetting("enabled")->setName(__("Enable Password Protection", $pluginSlug))->setType("checkbox")->setDefault("on")->setHelp(__("When enabled visitors to your site will need to login to access it.", $pluginSlug))->addSetting("use_template_hook")->setName(__("Enable this ONLY if the login page never appears (RSS feeds will not be public)", $pluginSlug))->setType("checkbox")->setDefault("off")->addSetting("multiple_passwords")->setName(__("Enable multiple passwords", $pluginSlug))->setType("checkbox")->setDefault("off")->setHelp(sprintf(__("When enabled, upto %s different passwords can be set.", $pluginSlug), 10))->addTag("is-premium");
for ($i = 1; $i <= $maxPasswords; $i++) {