Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

Commit

Permalink
ny fil utils.php
Browse files Browse the repository at this point in the history
  • Loading branch information
dmattke committed Nov 22, 2016
1 parent 3cd751d commit 5b95fa6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
14 changes: 7 additions & 7 deletions GFDibsHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,13 @@ public static function addPaymentDetails($form, $lead){
<tbody>
<tr>
<td><?php echo date('d.m.y h:i', strtotime($Transaction->date_created) ); ?></td>
<td ><?php echo $Transaction->transaction_id; ?></td>
<td ><?php echo $Transaction->ticket; ?></td>
<td ><?php echo $Transaction->payment_type; ?></td>
<td><?php echo ( ($Transaction->completed) ? __('yes', DIBS_LANG) : __('no', DIBS_LANG) ); ?></td>
<td><?php echo ($Transaction->amount/100); ?> <?php echo get_option('rg_gforms_currency');?></td>
<td><?php echo ( ($Transaction->paytype) ? $Transaction->paytype : '' ); ?></td>
<td><?php echo ( ($Transaction->test) ? __('yes', DIBS_LANG) : __('no', DIBS_LANG) ); ?></td>
<td><?php echo _is($Transaction, 'transaction_id'); ?></td>
<td><?php echo _is($Transaction, 'ticket'); ?></td>
<td><?php echo _is($Transaction, 'payment_type'); ?></td>
<td><?php echo ( (_is($Transaction, 'completed') ) ? __('yes', DIBS_LANG) : __('no', DIBS_LANG) ); ?></td>
<td><?php echo ( _is($Transaction, 'amount')/100); ?> <?php echo get_option('rg_gforms_currency');?></td>
<td><?php echo _is($Transaction, 'paytype'); ?></td>
<td><?php echo ( ( _is($Transaction, 'test') ) ? __('yes', DIBS_LANG) : __('no', DIBS_LANG) ); ?></td>
</tr>
</tbody>
</table>
Expand Down
1 change: 1 addition & 0 deletions gravityformsdibs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Author URI: http://mediebruket.no
*/

require_once 'utils/utils.php';
require_once 'GFDibsDao.php';
require_once 'GFDibsAddOn.php';
require_once 'GFDibsHook.php';
Expand Down
30 changes: 30 additions & 0 deletions utils/utils.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
if ( !function_exists('_is') ){
function _is($object, $attribute, $fallback = null ){
$value = $fallback;
if ( is_object($object) ){
if ( isset($object->$attribute) ){
$value = $object->$attribute;
}
}
else if ( is_array($object) ){

if ( isset($object[$attribute]) && is_array($object[$attribute]) && count($object[$attribute]) == 1 && isset($object[$attribute][0]) ){
$value = $object[$attribute][0];
}
elseif ( isset($object[$attribute]) ){
$value = $object[$attribute];
}
}


if ( is_string($value) ){
return trim($value);
}
else{
// _log($value);
return $value;
}

}
}

0 comments on commit 5b95fa6

Please sign in to comment.