Settings saved.' ) ); } $autorank = autorank_get_settings(); if ( $autorank['use_db'] && ( $post_count_plus = bb_get_option( 'post_count_plus' ) ) && !empty( $post_count_plus['custom_titles'] ) && isset( $_GET['action'] ) && $_GET['action'] == 'post_count_plus_import' ) { autorank_admin_import_post_count_plus(); return; } $options = autorank_admin_get_options( $autorank ); if ( !$autorank['use_db'] ) { bb_admin_notice( sprintf( __( 'In %1$s, there is a line of code that says %2$s. Please change it to %3$s in order to enable this settings panel.', 'autorank' ), '' . esc_html( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'autorank.php' ) . '', '\'use_db\' => false,', '\'use_db\' => true,' ), 'error' ); bb_delete_option( 'autorank' ); } if ( $autorank['use_db'] && empty( $autorank['post_count_plus_imported'] ) && ( $post_count_plus = bb_get_option( 'post_count_plus' ) ) && !empty( $post_count_plus['custom_titles'] ) ) { bb_admin_notice( sprintf( __( 'Were you using Post Count Plus? I can import your ranks from Post Count Plus.', 'autorank' ), bb_get_uri( 'bb-admin/admin-base.php', array( 'plugin' => 'autorank_admin', 'action' => 'post_count_plus_import' ), BB_URI_CONTEXT_BB_ADMIN ) ) ); } ?>

$args ) { if ( !$autorank['use_db'] ) $bb_hardcoded['autorank_' . $option] = $autorank[$option]; bb_option_form_element( 'autorank_' . $option, $args ); } if ( bb_forums() ) { while ( bb_forum() ) { if ( !$autorank['use_db'] ) $bb_hardcoded['autorank_post_modifier_forum'][get_forum_id()] = true; bb_option_form_element( 'autorank_post_modifier_forum[' . get_forum_id() . ']', array( 'title' => sprintf( __( '"%s" forum multiplier', 'autorank' ), get_forum_name() ), 'value' => isset( $autorank['post_modifier_forum'][get_forum_id()] ) ? $autorank['post_modifier_forum'][get_forum_id()] : 1, 'class' => 'short' ) ); } } ?>
$rank ) { ?>
/> value="" placeholder="" /> />
?
$multiplier ) { if ( is_numeric( $multiplier ) && ( (double) $multiplier ) != 1 && get_forum_id( $id ) ) $autorank['post_modifier_forum'][$id] = (double) $multiplier; } } if ( isset( $_POST['autorank_rank_titles'] ) && isset( $_POST['autorank_rank_colors'] ) && isset( $_POST['autorank_rank_scores'] ) ) { $autorank['ranks'] = array(); for ( $i = 0; $i < count( $_POST['autorank_rank_titles'] ); $i++ ) { if ( trim( $_POST['autorank_rank_titles'][$i] ) == '' ) { continue; } if ( trim( $_POST['autorank_rank_colors'][$i] ) == '' ) { $autorank['ranks'][(double) $_POST['autorank_rank_scores'][$i]] = trim( $_POST['autorank_rank_titles'][$i] ); } else { $autorank['ranks'][(double) $_POST['autorank_rank_scores'][$i]] = array( trim( $_POST['autorank_rank_titles'][$i] ), trim( $_POST['autorank_rank_colors'][$i] ) ); } } } $GLOBALS['autorank'] = $autorank; bb_update_option( 'autorank', $autorank ); autorank_recount(); $goback = add_query_arg( 'updated', 'true', wp_get_referer() ); bb_safe_redirect( $goback ); exit; } if ( $_POST['action'] == 'post_count_plus_import' ) { bb_check_admin_referer( 'autorank-post-count-plus-import' ); $autorank = autorank_get_settings(); $autorank['ranks'] = array(); foreach ( $_POST['autorank_ranks'] as $score => $rank ) { $autorank['ranks'][(double) $score] = $rank; } $autorank['post_count_plus_imported'] = true; bb_update_option( 'autorank', $autorank ); $GLOBALS['autorank'] = $autorank; autorank_recount(); $goback = remove_query_arg( 'action', add_query_arg( 'updated', 'true', wp_get_referer() ) ); bb_safe_redirect( $goback ); exit; } } else { if ( $_GET['action'] != 'post_count_plus_import' ) { wp_enqueue_script( 'jquery' ); } } } add_action( 'autorank_admin_pre_head', 'autorank_admin_parse' ); function autorank_admin_get_options( $autorank ) { return array( 'show_score' => array( 'title' => __( 'Show scores next to posts', 'autorank' ), 'type' => 'select', 'value' => $autorank['show_score'], 'options' => array( true => __( 'Yes', 'autorank' ), false => __( 'No', 'autorank' ) ) ), 'show_stats' => array( 'title' => sprintf( __( 'Show scores on the statistics page', 'autorank' ), bb_get_uri( 'statistics.php' ) ), 'type' => 'select', 'value' => $autorank['show_stats'], 'options' => array( true => __( 'Yes', 'autorank' ), false => __( 'No', 'autorank' ) ) ), 'show_rank' => array( 'title' => __( 'Show ranks next to posts', 'autorank' ), 'type' => 'select', 'value' => $autorank['show_rank'], 'options' => array( true => __( 'Yes', 'autorank' ), false => __( 'No', 'autorank' ) ) ), 'rank_replaces_title' => array( 'title' => __( 'Change "Member" to the user\'s rank', 'autorank' ), 'type' => 'select', 'value' => $autorank['rank_replaces_title'], 'options' => array( true => __( 'Yes', 'autorank' ), false => __( 'No', 'autorank' ) ) ), 'rank_before_name' => array( 'title' => __( 'Put ranks before names instead of below them', 'autorank' ), 'type' => 'select', 'value' => $autorank['rank_before_name'], 'options' => array( true => __( 'Yes', 'autorank' ), false => __( 'No', 'autorank' ) ) ), 'show_rank_page' => array( 'title' => __( 'Show users the list of ranks', 'autorank' ), 'type' => 'select', 'value' => $autorank['show_rank_page'], 'options' => array( true => __( 'Yes', 'autorank' ), false => __( 'No', 'autorank' ) ) ), 'post_default_score' => array( 'title' => __( 'Base score', 'autorank' ), 'value' => $autorank['post_default_score'], 'class' => 'short' ), 'post_modifier_first' => array( 'title' => __( 'New topic bonus', 'autorank' ), 'value' => $autorank['post_modifier_first'], 'class' => 'short' ), 'post_modifier_word' => array( 'title' => __( 'Word bonus', 'autorank' ), 'value' => $autorank['post_modifier_word'], 'class' => 'short' ), 'post_modifier_char' => array( 'title' => __( 'Letter bonus', 'autorank' ), 'value' => $autorank['post_modifier_char'], 'class' => 'short' ), 'text_score' => array( 'title' => __( '"Score:" text', 'autorank' ), 'value' => $autorank['text_score'], 'note' => __( 'Shown next to a user\'s score.', 'autorank' ), 'class' => 'long' ), 'text_reqscore' => array( 'title' => __( '"Required score:" text', 'autorank' ), 'value' => $autorank['text_reqscore'], 'note' => __( 'Shown when a user\'s rank is hovered over.', 'autorank' ), 'class' => 'long' ), ); } function autorank_admin_import_post_count_plus() { $autorank = autorank_get_settings(); $post_count_plus = bb_get_option( 'post_count_plus' ); $average_post_score = autorank_get_average_post_score(); $ranks = array(); for ( $i = 0; $i < count( $post_count_plus['custom_titles'] ); $i += 5 ) { if ( !$post_count_plus['custom_titles'][$i + 5] ) continue; // Skip blank ranks if ( $post_count_plus['custom_titles'][$i + 6] == 0 && ( $post_count_plus['custom_titles'][$i + 7] || $post_count_plus['custom_titles'][$i + 8] ) ) continue; // Skip role/age-based ranks $ranks[$post_count_plus['custom_titles'][$i + 6]] = array( $post_count_plus['custom_titles'][$i + 5], $post_count_plus['custom_titles'][$i + 9] ); } if ( $autorank['ranks'] ) bb_admin_notice( __( 'Warning: You already have AutoRank ranks defined. If you accept these ranks, they will be replaced.', 'autorank' ), 'error' ); ?>



$rank ) { ?>
' . esc_html( $rank[1] ) . ''; } else { echo ''; _e( 'Default', 'autorank' ); echo ''; } ?>