nrelate may need to communicate with you when we release new features or have a problem accessing your website. Check the box, below, to send nrelate the admin email address (under "General Settings"). We promise not to overwhelm you with email.
';
$javascript = <<< JAVA_SCRIPT
jQuery(document).ready(function(){
var nrel_excluded_cats_changed = false;
jQuery('#nrelate-exclude-cats :checkbox').change(function(){
var me= jQuery(this);
if (!nrel_excluded_cats_changed) {
if (confirm("Any changes to this section will cause a site reindex. Are you sure you want to continue?\u000AIf Yes, press OK and then SAVE CHANGES."))
{
nrel_excluded_cats_changed = true;
}
else
{
me.attr('checked', !me.is(':checked'));
}
}
if ( nrel_excluded_cats_changed ) {
me.parent().siblings('.children').find(':checkbox').attr('checked', me.is(':checked'));
if ( me.closest('#nrelate-exclude-cats').find(':checkbox').size() == me.closest('#nrelate-exclude-cats').find(':checkbox:checked').size() ) {
alert("WARNING: You have marked all your categories for exclusion. Nothing will show up in nrelate. Please uncheck at least one category.");
}
}
});
});
JAVA_SCRIPT;
echo "";
}
// Walker class to customize Checkbox List input names
class nrelate_Walker_Category_Checklist extends Walker {
var $tree_type = 'category';
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
function start_lvl(&$output, $depth, $args) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
" . '';
}
}
/*
* Executes when nrelate_admin_options changes so it can call nrelate_reindex()
* if one of the changes requires complete site re-indexation
*/
function nrelate_check_options_change($new_value) {
$old_value = (array) get_option('nrelate_admin_options');
$reindex = false;
if( @$new_value['admin_exclude_categories'] !== @$old_value['admin_exclude_categories'] ) {
$reindex = true;
}
if( @$new_value['admin_custom_field'] !== @$old_value['admin_custom_field'] ) {
$reindex = true;
}
if ( $reindex ) {
nrelate_reindex();
}
return $new_value;
}
add_filter('pre_update_option_nrelate_admin_options', 'nrelate_check_options_change');
/****************************************************************
******************** Build the Admin Page **********************
*****************************************************************/
function nrelate_admin_do_page() { ?>
".$connectionstatus."";
} ?>
$wp_root_nr,
'EMAIL'=>$nr_user_email,
'RSSMODE'=>$rss_mode,
'RSSURL'=>$rssurl,
'KEY'=>get_option('nrelate_key'),
'CUSTOM'=>$custom_field,
'EMAILOPT'=>$send_email
);
$url = 'http://api.nrelate.com/common_wp/'.NRELATE_LATEST_ADMIN_VERSION.'/processWPadmin.php';
$request=new WP_Http;
$result=$request->request($url,array('method'=>'POST','body'=>$body,'blocking'=>false));
}
// Validate user data for some/all of our input fields
function admin_options_validate($input) {
// Like escape all text fields
$input['admin_validate_ad'] = like_escape($input['admin_validate_ad']);
// Add slashes to all text fields
$input['admin_validate_ad'] = esc_sql($input['admin_validate_ad']);
/**
* Make sure that unchecked checkboxes are stored as empty strings
*
* nrelate_admin_options doesn't have a "defaults" global array
* so let's keep an array of checkbox settings here, the only place
* it's required by now
*/
$empty_settings_array = array(
'admin_email_address' => ''
);
$input = wp_parse_args( $input, $empty_settings_array );
return $input; // return validated input
}
?>