<commit_before><?php /*

**************************************************************************

Plugin Name:  QuickLogin
Plugin URI:   https://github.com/danielpunkass/QuickLogin
Version:      1.0
Description:  Adds a keyboard shortcut to your blog for easily logging in.
Author:       <NAME>, Red Sweater Software
Author URI:   http://www.red-sweater.com/blog/

**************************************************************************/

// If you want to use another keystroke besides ESC, set it here
$triggerKeyCode = 27;

// We depend upon get-current-user type functions, which are not defined by default
// until AFTER the plugin is given a chance to override.
require_once(ABSPATH . WPINC . '/pluggable.php');

// We depend upon jQuery that is bundled with WordPress, for easy keystroke detection
wp_enqueue_script("jquery"); 

function insertQuickLoginTrigger() {

	// When the user "logs in" we send them to the appropriate login page URL, redirecting to current URL
	$loginPageURL = wp_login_url(get_permalink());
	global $triggerKeyCode;
	
	echo <<<TRIGGEREND
	<script type="text/javascript">
	<!-- QuickLogin by Red Sweater Software

	var triggerKeyCode = $triggerKeyCode;

	jQuery(document).keyup(function(e) {
		if (e.keyCode == triggerKeyCode) {
			promptForWordPressLogin();
		}
	});

	function promptForWordPressLogin() {
		document.location.href="$loginPageURL";
	}

	-->
	</script>
TRIGGEREND;
}

$isLoggedIn = is_user_logged_in();

if ($isLoggedIn == False) {
	add_action('wp_head', 'insertQuickLoginTrigger');
}

?><commit_msg>Rewrite to avoid fatal errors and prevent jquery from always loading<commit_after><?php /*

**************************************************************************

Plugin Name:  QuickLogin
Plugin URI:   https://github.com/danielpunkass/QuickLogin
Version:      1.0
Description:  Adds a keyboard shortcut to your blog for easily logging in.
Author:       <NAME>, Red Sweater Software
Author URI:   http://www.red-sweater.com/blog/

**************************************************************************/

function enqueueQuickLoginScripts() {

	if( is_user_logged_in() ) {
		return;
	}
	
	// We depend upon jQuery that is bundled with WordPress, for easy keystroke detection
	wp_enqueue_script("jquery"); 
}
add_action('init', 'enqueueQuickLoginScripts');

function insertQuickLoginTrigger() {

	if( is_user_logged_in() ) {
		return;
	}
	
	// If you want to use another keystroke besides ESC, set it here
	$triggerKeyCode = 27;

	// When the user "logs in" we send them to the appropriate login page URL, redirecting to current URL
	$loginPageURL = wp_login_url(get_permalink());
	
	echo <<<TRIGGEREND
	<script type="text/javascript">
	//QuickLogin by Red Sweater Software

	var triggerKeyCode = $triggerKeyCode;

	jQuery(document).keyup(function(e) {
		if (e.keyCode == triggerKeyCode) {
			promptForWordPressLogin();
		}
	});

	function promptForWordPressLogin() {
		document.location.href="$loginPageURL";
	}

	</script>
TRIGGEREND;
}
add_action('wp_head', 'insertQuickLoginTrigger');

?>
{'fraction_non_alphanumeric': 0.19718309859154928, 'fraction_numerical': 0.0026203734032099572, 'mean_word_length': 4.953216374269005, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 12, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1917737', 'n_tokens_mistral': 943, 'n_tokens_neox': 869, 'n_words': 258}