Skip to content

Commit

Permalink
Merge pull request #1 from sosite/patch-1
Browse files Browse the repository at this point in the history
add disable shortcode attr and filter, add submit id
  • Loading branch information
PayLane committed Mar 11, 2015
2 parents 89bcb4b + 21d0449 commit 201e5ed
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions paylane/wp_paylane_plugin/wp_paylane_plugin.php
Expand Up @@ -256,7 +256,12 @@ function wp_paylane_plugin_options_validate_notification_email($input)
*/
function wp_paylane_plugin_shortcodes($attributes)
{
return wp_paylane_plugin_display();
$attributes = shortcode_atts(
array(
'disabled' => ''
), $attributes, 'paylane_plugin' );

return wp_paylane_plugin_display($attributes);
}

/**
Expand Down Expand Up @@ -499,7 +504,7 @@ function wp_paylane_plugin_check_postback_status()
*
* @return string html code
*/
function wp_paylane_plugin_display()
function wp_paylane_plugin_display($attributes)
{
$output = "";

Expand All @@ -523,6 +528,22 @@ function wp_paylane_plugin_display()
$transaction_description = get_option('wp_paylane_plugin_transaction_description');
$button_text = get_option('wp_paylane_plugin_button_text');
$shash = sha1($hash_salt . "|" . $my_merchant_transaction_id . "|" . $my_amount . "|" . $my_currency_code . "|S");

$disabled = $attributes['disabled'];
$enabled_filter = apply_filters('wp_paylane_enabled_pay_button', -1);
if(is_bool($enabled_filter)) {
if (!$enabled_filter) {
$disabled = 'disabled';
} else {
$disabled = '';
}
}

if ($disabled === 'disabled') {
$disabled = 'disabled="disabled"';
} else {
$disabled = '';
}

$was_redirected = false;
$is_successful = false;
Expand Down Expand Up @@ -561,9 +582,9 @@ function wp_paylane_plugin_display()
<input type=\"hidden\" name=\"transaction_description\" value=\"" . htmlspecialchars($transaction_description) . "\"/>
<input type=\"hidden\" name=\"language\" value=\"en\"/>
<input type=\"hidden\" name=\"hash\" value=\"$shash\"/>
<input type=\"submit\" value=\"$button_text\"/>
<input type=\"submit\" class=\"wp_paylane_pay_button\" value=\"$button_text\" $disabled />
</form></div><br/>";

return $output;
}
?>
?>

0 comments on commit 201e5ed

Please sign in to comment.