This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Make the following code better *in the simplest possible way* | |
// Assume $result is a resource identifier returned from a call to mysql_query with a select query as an argument in which you don't expect any results to be returned | |
if(mysql_num_results($result) > 0) | |
$error = true; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SoftDestroy | |
# accepts a method or proc to execute as a soft deletion routine | |
# replaces existing destroy method with new soft destroy | |
def soft_destroy_method(&block) | |
if block_given? | |
self.class_eval do | |
def destroy_with_forgiveness | |
block.call(self) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validate_forms() { | |
global $wpdb, $current_user, $user_ID; | |
$any_bad_inputs = false; | |
$bad_input_message = ''; | |
if(is_numeric($_POST['card_number']) === false) { | |
$_SESSION['wpsc_gateway_error_messages']['card_number'] = __('Please enter a valid card number.', 'wpsc'); | |
} | |
NewerOlder