Exemplo n.º 1
0
								<!-- Currency -->
								<div class="ib-edu-field">
									<div class="ib-edu-label"><label for="ib-edu-currency"><?php 
_e('Currency', 'ibeducator');
?>
</label></div>
									<div class="ib-edu-control">
										<select id="ib-edu-currency" name="currency">
											<option value=""><?php 
_e('Select Currency', 'ibeducator');
?>
</option>
											<?php 
$current_currency = empty($payment->currency) ? ib_edu_get_currency() : $payment->currency;
$currencies = ib_edu_get_currencies();
foreach ($currencies as $key => $value) {
    $selected = $key == $current_currency ? ' selected="selected"' : '';
    echo '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($value) . '</option>';
}
?>
										</select>
									</div>
								</div>
							</div>
						</div>

						<div id="payment-billing" class="postbox">
							<div class="handlediv"><br></div>
							<h3 class="hndle"><span><?php 
_e('Billing', 'ibeducator');
Exemplo n.º 2
0
 /**
  * Validate settings before saving.
  *
  * @param array $input
  * @return array
  */
 public function validate($input)
 {
     $clean = array();
     foreach ($input as $key => $value) {
         switch ($key) {
             case 'student_courses_page':
             case 'payment_page':
             case 'memberships_page':
             case 'user_membership_page':
             case 'user_payments_page':
                 $clean[$key] = intval($value);
                 break;
             case 'currency':
                 if (array_key_exists($input[$key], ib_edu_get_currencies())) {
                     $clean[$key] = $input[$key];
                 }
                 break;
             case 'currency_position':
                 if (in_array($value, array('before', 'after'))) {
                     $clean[$key] = $value;
                 }
                 break;
             case 'decimal_point':
             case 'thousands_sep':
                 $clean[$key] = preg_replace('/[^,. ]/', '', $value);
                 break;
             case 'location':
                 $clean[$key] = sanitize_text_field($value);
                 break;
             case 'payment_ip':
             case 'payment_lecturer':
                 $clean[$key] = 1 != $value ? 0 : 1;
                 break;
         }
     }
     return $clean;
 }