'post',
'type' => 'age',
'time' => '6',
'unit' => 'month',
);
}
$return = '
';
$return .= '| ';
$return .= '';
$return .= '';
$return .= '';
$return .= '';
$return .= ' | ';
$return .= '
';
return $return;
}
}
if ( !function_exists( 'build_advanced_comment_control_add_new_post_rule_row_ajax' ) ) {
/**
* AJAX Wrapper
*
* @since 1.0.0
*/
function build_advanced_comment_control_add_new_post_rule_row_ajax() {
die( build_advanced_comment_control_post_rule_row( array(), $_REQUEST['key'] ) );
}
add_action( 'wp_ajax_advanced-comment-control-add-new-post-rule-row', 'build_advanced_comment_control_add_new_post_rule_row_ajax' );
}
if ( !function_exists( 'build_advanced_comment_control_update_type_rules_post_rule_ajax' ) ) {
/**
* AJAX Wrapper
*
* @since 1.0.0
*/
function build_advanced_comment_control_update_type_rules_post_rule_ajax() {
$return = '';
if ( !empty( $_REQUEST['type'] ) && isset( $_REQUEST['key'] )) {
switch ( $_REQUEST['type'] ) {
case 'age':
$return = advanced_comment_control_age_rules_post_rule( array(), $_REQUEST['key'] );
break;
case 'limit':
$return = advanced_comment_control_limit_rules_post_rule( array(), $_REQUEST['key'] );
break;
}
}
die( $return );
}
add_action( 'wp_ajax_advanced-comment-control-change-type-rule-post-rule-row', 'build_advanced_comment_control_update_type_rules_post_rule_ajax' );
}
if ( !function_exists( 'advanced_comment_control_age_rules_post_rule' ) ) {
function advanced_comment_control_age_rules_post_rule( $rule=array(), $row_key ) {
if ( empty( $rule ) ) {
$rule = array(
'time' => '6',
'unit' => 'month',
);
}
$return = '';
$return .= ' ';
$return .= ' ';
return $return;
}
}
if ( !function_exists( 'advanced_comment_control_limit_rules_post_rule' ) ) {
function advanced_comment_control_limit_rules_post_rule( $rule=array(), $row_key ) {
if ( empty( $rule ) ) {
$rule = array(
'limit' => '100',
);
}
$return = '';
$return .= ' ';
$return .= __( 'comment(s)', 'advanced-comment-control' );
return $return;
}
}
if ( !function_exists( 'build_advanced_comment_control_role_rule_row' ) ) {
function build_advanced_comment_control_role_rule_row( $role_rule=array(), $row_key ) {
if ( empty( $role_rule ) ) {
$role_rule = array(
'role' => 'administrator',
'type' => 'always',
'post_type' => 'post',
);
}
$return = '';
$return .= '| ';
$return .= '';
$return .= '';
$return .= '';
$return .= '';
$return .= ' | ';
$return .= '
';
return $return;
}
}
if ( !function_exists( 'build_advanced_comment_control_add_new_role_rule_row_ajax' ) ) {
/**
* AJAX Wrapper
*
* @since 1.0.0
*/
function build_advanced_comment_control_add_new_role_rule_row_ajax() {
die( build_advanced_comment_control_role_rule_row( array(), $_REQUEST['key'] ) );
}
add_action( 'wp_ajax_advanced-comment-control-add-new-role-rule-row', 'build_advanced_comment_control_add_new_role_rule_row_ajax' );
}
if ( !function_exists( 'wp_print_r' ) ) {
/**
* Helper function used for printing out debug information
*
* HT: Glenn Ansley @ iThemes.com
*
* @since 0.0.1
*
* @param int $args Arguments to pass to print_r
* @param bool $die TRUE to die else FALSE (default TRUE)
*/
function wp_print_r( $args, $die = true ) {
$echo = '' . print_r( $args, true ) . '
';
if ( $die ) die( $echo );
else echo $echo;
}
}