01bd83f6 by Kevin Burton

removed the CAN SPAM link in notifications - to be added in CBV Settings System

1 parent 78755781
<?php
namespace Tz\WordPress\Tools\Notifications\Settings;
error_reporting(E_ALL^E_DEPRECATED);
//error_reporting(E_ALL^E_DEPRECATED);
use Tz\WordPress\Tools;
use Tz\Common;
......@@ -9,13 +9,21 @@ use Tz\WordPress\Tools\Notifications\Validation;
const CAPABILITY = "manage_notifications";
const MANAGE_SYSTEM_NOTIFICATIONS = "create_system_notifications";
const SETTING_NS = 'canspam_settings';
const ADMIN_PAGE = "canspam_admin";
call_user_func(function() {
$role = get_role('administrator');
$role->add_cap(CAPABILITY);
$role->add_cap(MANAGE_SYSTEM_NOTIFICATIONS);
//$role->remove_cap(SUB_ADMIN_CAPABILITY);
Vars::$settings = new Tools\WP_Option(SETTING_NS);
Tools\add_actions(__NAMESPACE__ . '\Actions');
});
function display_page() {
......@@ -244,20 +252,7 @@ function fixFilesArray(&$files)
function notification_settings() {
global $wpdb;
$validation = new Notifications\Validation;
$validation->set_rules('company','Company','required|trim');
$validation->set_rules('address','Address','required|trim');
$validation->set_rules('city','City','required|trim');
$validation->set_rules('province','Province','required|trim');
$validation->set_rules('postal','POstal Code','required|trim');
$validation->set_rules('std_message','Standard Message','required|trim');
$validation->set_rules('opt_message','OPT-OUT Message','required|trim');
if ($validation->run() == TRUE) {
} else {
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'settings.php');
}
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'settings.php');
......@@ -396,14 +391,20 @@ class Actions {
public static function admin_menu() {
add_menu_page('Notifications','Notifications',CAPABILITY,'notifications',__NAMESPACE__ . '\display_page' );
add_submenu_page('notifications','New Notification', 'New Notification',CAPABILITY,'notifications-create-new',__NAMESPACE__ . '\create_notification');
add_submenu_page('notifications','CAN-SPAM Settings', 'CAN-SPAM Settings',CAPABILITY,'notifications-settings',__NAMESPACE__ . '\notification_settings');
//add_options_page('CAN-SPAM Settings', 'CAN-SPAM Settings', CAPABILITY, ADMIN_PAGE, __NAMESPACE__ . '\notification_settings');
//add_submenu_page('notifications','CAN-SPAM Settings', 'CAN-SPAM Settings',CAPABILITY,'notifications-settings',__NAMESPACE__ . '\notification_settings');
}
public function admin_init() {
register_setting(Notifications\OPTION_NAME, Notifications\OPTION_NAME);
// register_setting(Notifications\OPTION_NAME, Notifications\OPTION_NAME);
register_setting(SETTING_NS, SETTING_NS);
}
}
class Vars {
public static $settings;
}
?>
\ No newline at end of file
......
<?php
use Tz\WordPress\Tools\Notifications\Settings;
use Tz\WordPress\Tools\Notifications;
use Tz\WordPress\Tools;
namespace Tz\WordPress\Tools\Notifications\Settings;
?>
<link type="text/css" href="<?php echo Tools\url('assets/css/smoothness/jquery-ui-1.8.4.custom.css', __FILE__)?>" rel="stylesheet" />
<script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery-1.4.2.min.js', __FILE__)?>"></script>
<script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery-ui-1.8.4.custom.min.js', __FILE__)?>"></script>
<script type="text/javascript" src="<?php echo Tools\url('assets/scripts/datetimepicker.js', __FILE__)?>"></script>
<link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__)?>" />
<div id="" class="wrap">
<h2>Notifications - Settings</h2>
<p>In order to comply with the CAN-SPAM act, each outgoing email must include the following:</p>
<form enctype="multipart/form-data" method="post" action="options.php">
<input type="hidden" name="_POSTED_" value="yes" />
<form method="post" action="options.php">
<?php settings_fields(SETTING_NS); ?>
<table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
<thead>
<tr>
......@@ -31,20 +21,24 @@ use Tz\WordPress\Tools;
<tbody>
<tr>
<td width="150">Company Name:</td>
<td><input type="text" name="company" class="wide-input-field" /></td>
<?php $wp_option = SETTING_NS . '[company]'; ?>
<td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['company'];?>" /></td>
</tr>
<tr>
<td width="150">Address:</td>
<td><input type="text" name="address" class="wide-input-field" /></td>
<?php $wp_option = SETTING_NS . '[address]'; ?>
<td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['address'];?>" /></td>
</tr>
<tr>
<td width="150">City:</td>
<td><input type="text" name="city" class="wide-input-field" /></td>
<?php $wp_option = SETTING_NS . '[city]'; ?>
<td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['city'];?>" /></td>
</tr>
<tr>
<td width="150">Province:</td>
<td>
<select name="province" class="wide-input-field" >
<?php $wp_option = SETTING_NS . '[province]'; ?>
<select name="<?php echo $wp_option; ?>" class="wide-input-field" >
<option value="Ontario">Ontario</option>
<option value="Quebec">Quebec</option>
<option value="Nova Scotia">Nova Scotia</option>
......@@ -60,7 +54,8 @@ use Tz\WordPress\Tools;
</tr>
<tr>
<td width="150">Postal Code:</td>
<td><input type="text" name="postal" /></td>
<?php $wp_option = SETTING_NS . '[postal]'; ?>
<td><input type="text" id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" value="<?php echo Vars::$settings['postal'];?>" /></td>
</tr>
</body>
</table>
......@@ -74,12 +69,14 @@ use Tz\WordPress\Tools;
</thead>
<tbody>
<tr>
<td width="150">Standard Message:</td>
<td><textarea name="std_message" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';">This email was sent to ({email}) because you have agreed to receive periodic emails from us. To ensure that you continue receiving our emails, please add us to your address book or safe list.</textarea></td>
<td width="150">Standard Message:</td><!-- -->
<?php $wp_option = SETTING_NS . '[std_message]'; ?>
<td><textarea id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';"><?php echo Vars::$settings['std_message'];?></textarea></td>
</tr>
<tr>
<td width="150">OPT-OUT Message::</td>
<td><textarea name="opt_message" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';" >If you do not wish to further receive emails from us, you can change your notification settings in your profile.</textarea></td>
<td width="150">OPT-OUT Message:</td><!-- -->
<?php $wp_option = SETTING_NS . '[opt_message]'; ?>
<td><textarea id="<?php echo $wp_option; ?>" name="<?php echo $wp_option; ?>" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';" ><?php echo Vars::$settings['opt_message'];?></textarea></td>
</tr>
</body>
</table>
......