Example #1
0
">
			<label for="leyka_donation_amount" class="leyka-screen-reader-text mdl-textfield__label">Сумма</label>			
		</div>
		<div class="currency">
			<?php 
        echo $leyka_current_pm->get_currency_field();
        ?>
		</div>
		</div>
		<span id="leyka_donation_amount-error" class="leyka_donation_amount-error field-error mdl-textfield__error"></span>
	</div>
		
	<?php 
    }
    //if amount
    echo leyka_pf_get_hidden_fields();
    ?>
	<input name="leyka_payment_method" value="<?php 
    echo esc_attr($pm->full_id);
    ?>
" type="hidden" />
	<input name="leyka_ga_payment_method" value="<?php 
    echo esc_attr($pm->label);
    ?>
" type="hidden" />
			
	<!-- name -->
	<?php 
    if ($leyka_current_pm->is_field_supported('name')) {
        ?>
	<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label leyka-field name">
function leyka_currency_choice_action()
{
    check_ajax_referer('leyka_payment_form', '_leyka_ajax_nonce');
    if (empty($_POST['currency'])) {
        die('-1');
    }
    $curr_currency = trim($_POST['currency']);
    $pm_selected = trim($_POST['current_pm']);
    $currently_active_pmethods = leyka_get_pm_list(true, $curr_currency);
    $curr_pm_is_active = false;
    foreach ($currently_active_pmethods as $pm) {
        if ($pm->id == $pm_selected) {
            $curr_pm_is_active = true;
            $pm_selected = $pm;
            break;
        }
    }
    if (!$curr_pm_is_active) {
        $pm_selected = reset($currently_active_pmethods);
    }
    leyka_setup_current_pm($pm_selected, $curr_currency);
    echo leyka_pf_get_hidden_fields((int) $_POST['campaign']);
    ?>

    <!-- pm selector -->
    <div id="pm-selector" class="form-part">
        <ul class="leyka-pm-selector">
            <?php 
    foreach ($currently_active_pmethods as $pm) {
        ?>
                <li>
                    <label class="radio">
                        <input type="radio" name="leyka_payment_method" value="<?php 
        echo esc_attr($pm->full_id);
        ?>
" <?php 
        checked($pm_selected->id, $pm->id);
        ?>
 data-pm_id="<?php 
        echo esc_attr($pm->id);
        ?>
">
                        <?php 
        echo $pm->label;
        ?>
                    </label>
                </li>
            <?php 
    }
    ?>
        </ul>
    </div>

    <!-- changeable area -->
    <div id="leyka-pm-data" class="changeable-fields form-part">

        <div class="leyka-pm-fields">

            <div class='leyka-user-data'>
                <!-- field for GA -->
                <input type="hidden" name="leyka_ga_payment_method" value="<?php 
    echo esc_attr($curr_pm->label);
    ?>
" />
                <?php 
    echo leyka_pf_get_name_field();
    echo leyka_pf_get_email_field();
    echo leyka_pf_get_pm_fields();
    ?>
            </div>

            <?php 
    echo leyka_pf_get_agree_field();
    echo leyka_pf_get_submit_field();
    $icons = leyka_pf_get_pm_icons();
    if ($icons) {
        $list = array();
        foreach ($icons as $i) {
            $list[] = "<li>{$i}</li>";
        }
        echo "<ul class='leyka-pm-icons cf'>";
        echo implode('', $list);
        echo "</ul>";
    }
    ?>
        </div>
        <?php 
    echo "<div class='leyka-pm-desc'>" . apply_filters('leyka_the_content', leyka_pf_get_pm_description()) . "</div>";
    ?>

    </div>
    <?php 
    die;
}
    echo leyka_pf_get_pm_label();
    ?>
</div>
<div class="leyka-toggle-area">
<form class="leyka-pm-form" id="<?php 
    echo leyka_pf_get_form_id();
    ?>
" action="<?php 
    echo leyka_pf_get_form_action();
    ?>
" method="post">
	
	<div class="leyka-pm-fields">

    <?php 
    echo leyka_pf_get_amount_field() . leyka_pf_get_hidden_fields(empty($campaign) ? false : $campaign->id);
    ?>

	<input name="leyka_payment_method" value="<?php 
    echo esc_attr($pm->full_id);
    ?>
" type="hidden">
	<input name="leyka_ga_payment_method" value="<?php 
    echo esc_attr($pm->label);
    ?>
" type="hidden">
		<input type='hidden' name="leyka_needy_id" value="<?php 
    echo $needyId;
    ?>
" />
		<input type='hidden' name="leyka_needy_type" value="<?php