<commit_before><?php
/*
Plugin Name: Warp User Profile extension
Plugin URI: http://people.warp.es/~koke/wp-plugins/warp-userprofile
Description: Shows a directory of authors and their personal info
Version: 0.1
Author: <NAME>
Author URI: http://koke.amedias.org/
*/

/*  Copyright 2008  <NAME>  <<EMAIL>>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

define(warp_userprofile_version,'0.1');

/**
* Warp User Profile extension
*/
class Warp_UserProfile
{
	function init()
	{
		// Register actions and filters here
		add_action('edit_user_profile', array('Warp_UserProfile', 'show_extra_fields'));
		add_action('show_user_profile', array('Warp_UserProfile', 'show_extra_fields'));
		add_action('profile_update', array('Warp_UserProfile', 'save_extra_fields'));
		add_action('personal_options_update', array('Warp_UserProfile', 'save_extra_fields'));
		add_filter('query_vars', array('Warp_UserProfile', 'query_vars'));
		add_filter('generate_rewrite_rules', array('Warp_UserProfile', 'register_rewrite_rules'));
		add_action('template_redirect', array('Warp_UserProfile', 'show_profiles'));
		add_action('admin_print_scripts', array('Warp_UserProfile', 'admin_js'));
		add_action('admin_menu', array('Warp_UserProfile', 'add_option_pages'));
		register_activation_hook(__FILE__, array('Warp_UserProfile', 'register_version'));
	}
	
	function register_version()
	{		
		add_option('warp_userprofile_version', warp_userprofile_version);
		update_option('warp_userprofile_version', warp_userprofile_version);
		add_option("warp_userprofile_page");
	}
	
	function register_rewrite_rules($wp_rewrite)
	{
		$plink = Warp_UserProfile::get_plink();
		$userprofile_rules = array(
			// 'people/?' => 'wp-content/plugins/warp-userprofile/people.php'
			"$plink([^/]+)/?" => 'index.php?showprofiles=1&person=' . $wp_rewrite->preg_index(1),
			"$plink?" => 'index.php?showprofiles=1',
			);
		$wp_rewrite->rules = array_merge($userprofile_rules, $wp_rewrite->rules);
	}
	
	function add_option_pages()
	{
		add_options_page(__('Profiles', 'warp_userprofile'), __('Profiles', 'warp_userprofile'), 8, 'warp-userprofile', array('Warp_UserProfile', 'options_page'));
	}
	
	function query_vars($vars)
	{
		$vars[] = "showprofiles";
		$vars[] = "person";
		return $vars;
	}
	
	function admin_js()
	{
		wp_enqueue_script("editor");
	}
	
	function show_profiles()
	{
		global $wp_rewrite, $wp_query;
		
		if (get_query_var("showprofiles")) {
			if (get_query_var("person")) {
				$user = get_userdatabylogin(get_query_var('person'));
				if (get_usermeta($user->ID, 'warp_up_public') == 1) {
					require 'person.php';
				} else {
					$wp_query->is_404 = true;
					return;
				}
			} else {
				require 'people.php';
			}
			exit;
		}
	}
	<commit_msg>Hack rewrite to make Wordpress think it's on a page<commit_after><?php
/*
Plugin Name: Warp User Profile extension
Plugin URI: http://people.warp.es/~koke/wp-plugins/warp-userprofile
Description: Shows a directory of authors and their personal info
Version: 0.1
Author: <NAME>
Author URI: http://koke.amedias.org/
*/

/*  Copyright 2008  <NAME>  <<EMAIL>>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

define(warp_userprofile_version,'0.1');

/**
* Warp User Profile extension
*/
class Warp_UserProfile
{
	function init()
	{
		// Register actions and filters here
		add_action('edit_user_profile', array('Warp_UserProfile', 'show_extra_fields'));
		add_action('show_user_profile', array('Warp_UserProfile', 'show_extra_fields'));
		add_action('profile_update', array('Warp_UserProfile', 'save_extra_fields'));
		add_action('personal_options_update', array('Warp_UserProfile', 'save_extra_fields'));
		add_filter('query_vars', array('Warp_UserProfile', 'query_vars'));
		add_filter('generate_rewrite_rules', array('Warp_UserProfile', 'register_rewrite_rules'));
		add_action('template_redirect', array('Warp_UserProfile', 'show_profiles'));
		add_action('admin_print_scripts', array('Warp_UserProfile', 'admin_js'));
		add_action('admin_menu', array('Warp_UserProfile', 'add_option_pages'));
		register_activation_hook(__FILE__, array('Warp_UserProfile', 'register_version'));
	}
	
	function register_version()
	{		
		add_option('warp_userprofile_version', warp_userprofile_version);
		update_option('warp_userprofile_version', warp_userprofile_version);
		add_option("warp_userprofile_page");
	}
	
	function register_rewrite_rules($wp_rewrite)
	{
		$plink = Warp_UserProfile::get_plink();
		$userprofile_rules = array(
			// 'people/?' => 'wp-content/plugins/warp-userprofile/people.php'
			"$plink([^/]+)/?" => 'index.php?showprofiles=1&person=' . $wp_rewrite->preg_index(1) . '&page_id=' . get_option('warp_userprofile_page'),
			"$plink?" => 'index.php?showprofiles=1' . '&page_id=' . get_option('warp_userprofile_page'),
			);
		$wp_rewrite->rules = array_merge($userprofile_rules, $wp_rewrite->rules);
	}
	
	function add_option_pages()
	{
		add_options_page(__('Profiles', 'warp_userprofile'), __('Profiles', 'warp_userprofile'), 8, 'warp-userprofile', array('Warp_UserProfile', 'options_page'));
	}
	
	function query_vars($vars)
	{
		$vars[] = "showprofiles";
		$vars[] = "person";
		$vars[] = "page_id";
		return $vars;
	}
	
	function admin_js()
	{
		wp_enqueue_script("editor");
	}
	
	function show_profiles()
	{
		global $wp_rewrite, $wp_query;
		
		if (get_query_var("showprofiles")) {
			if (get_query_var("person")) {
				$user = get_userdatabylogin(get_query_var('person'));
				if (get_usermeta($user->ID, 'warp_up_public') == 1) {
					require 'person.php';
				} else {
					$wp_query->is_404 = true;
					return;
				}
			} else {
				require 'people.php';
			}
			exit;
		}
	}
	
{'fraction_non_alphanumeric': 0.1328180907399456, 'fraction_numerical': 0.0080148847860312, 'mean_word_length': 5.0924149956408025, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, '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': '195272', 'n_tokens_mistral': 2483, 'n_tokens_neox': 2266, 'n_words': 529}