プラグインの研究:Absolute Privacyを読んでみる3:まずはフォームから

PHPのファイルを読むのって、効率の方法があるのだろうか。今回は、頭からではなく、フォームからやってみます。

管理画面のフォーム

管理画面内のタイトル

<div class="wrap">
			<div id="icon-plugins" class="icon32"></div>
			<h2>Absolute Privacy: Options Page</h2>

アイコンは背景表示ですね!

フォーム前半

  • ログイン必須にするか(members_enabled)
  • 非ログインユーザのリダイレクト先(redirect_page)
  • 一部のページだけを非ログインユーザに開放できるようになっているのでどのページかを選ぶ(allowed_pages)
  • 管理画面へのアクセスをブロックするか(admin_block)
  • RSSはどうするか(rss_control)

を選ぶフォームです。

<form method="post" action="">
<table class="widefat" cellspacing="0">

	<thead>
		<tr class="thead">
			<th scope="col" style="width: 100px;" colspan="2" class="" style="">General Settings</th>
			<th scope="col">Setting Description:</th>
		</tr>
	</thead>

	<tbody id="users" class="list:user user-list">
		<tr valign="top">
		   	<th style="width: 150px; padding-top: 2%;">Lockdown Website:</th>
			<td style="width: 50px; padding-top: 1.5%;">  <input type="checkbox" name="members_enabled" value="yes" <?php if ($options['members_enabled'] == "yes") echo " checked "; ?> /> Yes </td>
			<td>If checked users must be logged in to view your blog. They will be redirected to the page they were looking for after they login.</td>
		</tr>
		<tr>
			<th>Redirect Non-logged in Users To:</th>
			<td style="padding-top: 2.5%;"><input type="text" name="redirect_page" id="redirect_page" style="width: 28px;" value="<?php echo $options['redirect_page']; ?>" /></td>
			<td>By default, non-logged in users will be redirected to the login form. Alternatively, you can enter a page ID here that you want non-logged in users to be redirected to instead.</td>
		</tr>

		<tr>
			<th>Allowed Pages:</th>
			<td style="padding-top: 2.5%;"><input type="text" name="allowed_pages" id="allowed_pages" style="width: 58px;" value="<?php echo $options['allowed_pages']; ?>" /></td>
			<td>List page IDs separated by a comma (eg: 2,19,12). These pages will be accessible to non-logged in users.</td>
		</tr>

		<tr>
			<th style="padding-top: 1%;">Block Admin Access:</th>
			<td style="padding-top: 3%;"><input type="checkbox" name="admin_block" value="yes" <?php if ($options['admin_block'] == "yes") echo " checked "; ?> /> Yes</td>
			<td>This blocks subscribers from viewing any administrative pages, such as their profile page or the dashboard. If they try to access an administrative page they will be redirected to the homepage.</td>
		</tr>

		<tr>
			<th>RSS Control:</th>
			<td colspan="2">
				<input type="radio" name="rss_control" value="off" <?php if ($options['rss_control'] == "off") echo 'checked'; ?> /> RSS Disabled &nbsp; &nbsp;
				<input type="radio" name="rss_control" value="on" <?php if ($options['rss_control'] == "on") echo 'checked'; ?> /> RSS On &nbsp; &nbsp;
				<input type="radio" name="rss_control" value="headline" <?php if ($options['rss_control'] == "headline") echo 'checked'; ?> /> Limited to headlines &nbsp; &nbsp;
				<input type="radio" name="rss_control" value="excerpt" <?php if ($options['rss_control'] == "excerpt") echo 'checked'; ?> /> Limited to <input type="text" name="rss_characters" id="rss_characters" value="<?php echo $options['rss_characters']; ?>" style="width: 32px;" /> Characters
				<br />Viewing your website's RSS feed does not require the user to login. Thus your RSS feed is publicly accessible if it is enabled. You may disable or limit the RSS feed above.
			</td>
			
		</tr>
	</tbody>
	
</table>
	<div class="clear"></div>	
	<div class="submit"><input type="submit" name="update_options" value="Update"  style="font-weight:bold;" /> </div>

フォーム後半

  • 会員登録したときの「対応中ですよ」メール(pending_welcome_message)
  • 承認されましたよメール(account_approval_message)
  • 管理者への通知(admin_approval_message)

の設定。

<table class="widefat" cellspacing="0">

	<thead>
		<tr class="thead">
			<th scope="col" style="width: 100px;" colspan="2" class="" style="">Message Settings</th>
			<th scope="col"></th>
		</tr>
	</thead>

	<tbody id="users" class="list:user user-list">
		<tr valign="top">
		   	<th style="width: 150px; padding-top: 2%;">Pending Welcome Message: <br /><br /><span style="font-weight: lighter; font-size: 10px;">This message is sent to the user immediately after they register & prior to approval.</span></th>
			<td colspan="2"> 
				Email Subject:<br />
				<input type="text" name="pending_welcome_email_subject" id="pending_welcome_email_subject" value="<?php echo stripslashes($options['pending_welcome_email_subject']); ?>" style="width: 100%;" /><br />
				Email Message:<br />
				<textarea name="pending_welcome_message" id="pending_welcome_message" style="width: 100%;" rows="5"><?php echo stripslashes($options['pending_welcome_message']); ?></textarea>
			</td>
		</tr>
		
		<tr valign="top">
		   	<th style="width: 150px; padding-top: 2%;">Account Approval Message: <br /><br /><span style="font-weight: lighter; font-size: 10px;">This message is sent to the user immediately after their account has been approved.</span></th>
			<td colspan="2"> 
				Email Subject:<br />
				<input type="text" name="account_approval_email_subject" id="account_approval_email_subject" value="<?php echo stripslashes($options['account_approval_email_subject']); ?>" style="width: 100%;" /><br />
				Email Message:<br />
				<textarea name="account_approval_message" id="account_approval_message" style="width: 100%;" rows="5"><?php echo stripslashes($options['account_approval_message']); ?></textarea>
			</td>
		</tr>
		
		<tr valign="top">
		   	<th style="width: 150px; padding-top: 2%;">Admin Notification Message: <br /><br /><span style="font-weight: lighter; font-size: 10px;">This message is sent to the administrator after a new registration is waiting approval.</span></th>
			<td colspan="2">
				Email Subject:<br />
				<input type="text" name="admin_approval_email_subject" id="admin_approval_email_subject" value="<?php echo stripslashes($options['admin_approval_email_subject']); ?>" style="width: 100%;" /><br />
				Email Message:<br /> 
				<textarea name="admin_approval_message" id="admin_approval_message" style="width: 100%;" rows="5"><?php echo stripslashes($options['admin_approval_message']); ?></textarea>
			</td>
		</tr>
	</tbody>
	
</table>

その他


サポートなどの情報。

でした。
ここまでに出てきたname属性が、今後扱われていきます。

というわけで、フォームを先に整理してしまったほうが、楽に読めそうです。

続きます。

この記事が気に入ったら
フォローしてね!

よかったらシェアしてね!

著者について

コメント

コメント一覧 (1件)

コメントする

目次
閉じる