<commit_before><?php

ClassBlogs::require_cb_file( 'Admin.php' );
ClassBlogs::require_cb_file( 'BasePlugin.php' );
ClassBlogs::require_cb_file( 'Utils.php' );
ClassBlogs::require_cb_file( 'WordPress.php' );

/**
 * A plugin that allows a student to blog using a pseudonym.
 *
 * This provides an admin page available to any students that allows them to
 * change their blog URL, their username and their display name in order to
 * blog under a pen name.  If they choose to change their username, their blog's
 * URL is also updated to match the change, provided that it doesn't conflict
 * with an existing user or blog.
 *
 * @package ClassBlogs_Plugins
 * @subpackage StudentPseudonym
 * @since 0.1
 */
class ClassBlogs_Plugins_StudentPseudonym extends ClassBlogs_BasePlugin
{
	/** Registers hooks to add the student pseudonym admin page. */
	public function __construct()
	{
		parent::__construct();
		add_action( 'plugins_loaded', array( $this, '_register_hooks' ) );
	}

	/**
	 * Register hooks to show the admin page when on a student blog.
	 *
	 * @access private
	 * @since 0.3
	 */
	public function _register_hooks()
	{
		if ( ClassBlogs_Utils::on_student_blog_admin() ) {
			add_action( 'admin_menu', array( $this, '_add_admin_page' ) );
		}
	}

	/**
	 * Adds the pseudonym admin page.
	 *
	 * @access private
	 * @since 0.1
	 */
	public function _add_admin_page( $admin )
	{
		add_users_page(
			__( 'Use A Pseudonym', 'classblogs' ),
			__( 'Use A Pseudonym', 'classblogs' ),
			'manage_options',
			$this->get_uid(),
			array( $this, '_admin_page' ) );
	}

	/**
	 * Handles the logic to display the pseudonym admin page to a student.
	 *
	 * @access private
	 * @since 0.1
	 */
	public function _admin_page()
	{
		// Get information on the user and their blog URL<commit_msg>Student pseudonym now only available in multisite<commit_after><?php

ClassBlogs::require_cb_file( 'Admin.php' );
ClassBlogs::require_cb_file( 'BasePlugin.php' );
ClassBlogs::require_cb_file( 'Utils.php' );
ClassBlogs::require_cb_file( 'WordPress.php' );

/**
 * A plugin that allows a student to blog using a pseudonym.
 *
 * This provides an admin page available to any students that allows them to
 * change their blog URL, their username and their display name in order to
 * blog under a pen name.  If they choose to change their username, their blog's
 * URL is also updated to match the change, provided that it doesn't conflict
 * with an existing user or blog.
 *
 * @package ClassBlogs_Plugins
 * @subpackage StudentPseudonym
 * @since 0.1
 */
class ClassBlogs_Plugins_StudentPseudonym extends ClassBlogs_BasePlugin
{
	/** Registers hooks to add the student pseudonym admin page. */
	public function __construct()
	{
		parent::__construct();
		add_action( 'plugins_loaded', array( $this, '_register_hooks' ) );
	}

	/**
	 * Register hooks to show the admin page when on a student blog.
	 *
	 * The pseudonym page will be only available when running in multisite mode.
	 *
	 * @access private
	 * @since 0.3
	 */
	public function _register_hooks()
	{
		if ( ClassBlogs_Utils::is_multisite() && ClassBlogs_Utils::on_student_blog_admin() ) {
			add_action( 'admin_menu', array( $this, '_add_admin_page' ) );
		}
	}

	/**
	 * Adds the pseudonym admin page.
	 *
	 * @access private
	 * @since 0.1
	 */
	public function _add_admin_page( $admin )
	{
		add_users_page(
			__( 'Use A Pseudonym', 'classblogs' ),
			__( 'Use A Pseudonym', 'classblogs' ),
			'manage_options',
			$this->get_uid(),
			array( $this, '_admin_page' ) );
	}

	/**
	 * Handles the logic to display the pseudonym admin page to a student.
	 *
	 * @access private
	 * @since 0.1
	 */
	public function _admin_page()
	{
		// Get information on the user and their blog URL
{'fraction_non_alphanumeric': 0.10959271168274384, 'fraction_numerical': 0.004287245444801715, 'mean_word_length': 3.873368146214099, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5825540', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1163, 'n_words': 394}