162 lines
7.1 KiB
PHP
162 lines
7.1 KiB
PHP
<?php
|
|
|
|
// encryption classes
|
|
include_once("encryption/message-content.php");
|
|
include_once("encryption/message-content-signed.php");
|
|
include_once("encryption/encrypted-content.php");
|
|
include_once("encryption/secured-content.php");
|
|
|
|
global $id_setting, $config, $id_version;
|
|
$home = get_option("id_medical_home");
|
|
$config = array();
|
|
$config['id_medical_home'] = $home;
|
|
$config['id_version'] = $id_version;
|
|
|
|
|
|
$id_setting = array(
|
|
array( 'name' => 'SFDC Environment', 'option_name' => 'select-environment', 'type' => 'select-environment', 'description' => '', 'default' => ''),
|
|
//array( 'name' => 'API', 'option_name' => 'id_api_salesforce', 'type' => 'input', 'description' => '', 'default' => ''),
|
|
array( 'name' => 'Version', 'option_name' => 'id_version', 'type' => 'input', 'description' => '', 'default' => ''),
|
|
array( 'name' => 'API', 'option_name' => 'select-api', 'type' => 'select-api', 'description' => '', 'default' => ''),
|
|
array( 'name' => 'Brand ID', 'option_name' => 'id_brand', 'type' => 'select-brand', 'description' => '', 'default' => ''),
|
|
array( 'name' => 'Call to Action Tel ', 'option_name' => 'cta_tel', 'type' => 'select-phone', 'description' => 'Telephone', 'default' => '1.800.800.2537')
|
|
);
|
|
|
|
|
|
add_action( 'wp_enqueue_scripts', 'load_css' );
|
|
|
|
function load_css() {
|
|
$plugin_url = plugin_dir_url( __FILE__ );
|
|
wp_enqueue_style( 'style', $plugin_url . 'style.css' );
|
|
}
|
|
|
|
add_action('admin_menu', 'campaign_menu_page');
|
|
|
|
function campaign_menu_page() {
|
|
$themename = "Campaign Tracking";
|
|
$shortname = "campaign_tracking";
|
|
$menu_slug="edit_posts";
|
|
add_object_page($themename, $themename, $menu_slug, $shortname,'id_main_admin');
|
|
}
|
|
|
|
function id_main_admin(){
|
|
$i=0;
|
|
global $themename, $shortname,$id_setting;
|
|
|
|
$themename = "Campaign Tracking";
|
|
$save=false;
|
|
if ( 'save' == $_POST['action'] ) {
|
|
$save=true;
|
|
foreach($id_setting as $id_single) {
|
|
update_option( sanitize_text_field($id_single['option_name']), sanitize_text_field($_POST[$id_single['option_name']]) );
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
if ( $save ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' Settings save..</strong></p></div>';
|
|
?>
|
|
<div id="main_admin">
|
|
<?php $admin_header = "<h1>".$themename." </h1>";
|
|
echo $admin_header;
|
|
?>
|
|
<form method="post">
|
|
<table>
|
|
<?php
|
|
$i=0;
|
|
foreach($id_setting as $id_single) {?><tr><?php
|
|
switch($id_single['type'])
|
|
{
|
|
case 'input':
|
|
{
|
|
?>
|
|
<td><?=$id_single['name'] ?></td>
|
|
<td><input type="text" name="<?=$id_single['option_name'];?>" id="<?=$id_single['option_name'];?>" value="<?php if ( get_option( $id_single['option_name'] ) != "") { echo stripslashes(get_option( $id_single['option_name'] ) ); } ?>" />
|
|
<?php if(strpos($id_single['option_name'], 'color')){echo '<div style ="width:20px; height: 20px; margin-top: -25px;margin-left: 170px;position: absolute; background-color:'.get_option($id_single['option_name']).';" class="choosen_color"></div>';}?>
|
|
</td>
|
|
|
|
<td><p class="description"><?=$id_single['description']?></p></td>
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
case 'select-environment':
|
|
{
|
|
?>
|
|
<td><?=$id_single['name'] ?></td>
|
|
<td>
|
|
<?php $selectEnv = get_option('select-environment'); ?>
|
|
<select name="select-environment">
|
|
<option value="full" <?php if($selectEnv=="full") echo 'selected="selected"'; ?>>Full</option>
|
|
<option value="production" <?php if($selectEnv=="production") echo 'selected="selected"'; ?>>Production</option>
|
|
</select>
|
|
</td>
|
|
|
|
<td><p class="description"><?=$id_single['description']?></p></td>
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
|
|
case 'select-api':
|
|
{
|
|
?>
|
|
|
|
|
|
<td><?=$id_single['name'] ?></td>
|
|
|
|
<?php
|
|
$sfdcEnv = get_option('select-environment');
|
|
if ($sfdcEnv == 'full') {
|
|
update_option( 'id_api_salesforce', 'https://connectamerica--full.sandbox.my.salesforce-sites.com/RestServices/services/apexrest/' );
|
|
} else {
|
|
update_option( 'id_api_salesforce', 'https://connectamerica.my.salesforce-sites.com/RestServices/services/apexrest/' );
|
|
}
|
|
|
|
?>
|
|
<td>
|
|
<?php echo get_option('id_api_salesforce'); ?>
|
|
</td>
|
|
|
|
<td><p class="description"><?=$id_single['description']?></p></td>
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
case 'select-phone':
|
|
{
|
|
update_option('telephone_num', '800-800-2537');
|
|
$phoneNumber = get_option('telephone_num',true);
|
|
?>
|
|
<td><?=$id_single['name']?></td>
|
|
<td><?php echo $phoneNumber;?></td>
|
|
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
case 'select-brand':
|
|
{
|
|
update_option('id_brand', 'Medicalalert');
|
|
$brand = get_option('id_brand',true);
|
|
?>
|
|
<td><?=$id_single['name']?></td>
|
|
<td><?php echo $brand;?></td>
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
}
|
|
$i++;?></tr><?php
|
|
}
|
|
?>
|
|
</table>
|
|
<div id="inputs">
|
|
<input type="submit" value="save options" class="button-primary" />
|
|
<input type="hidden" name="action" value="save" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include_once "admin-cron.php"; ?>
|
|
<?php }
|