You are here

function _node_expire_date_db_to_str in Node expire 8

Same name and namespace in other branches
  1. 7 node_expire.nodeapi.inc \_node_expire_date_db_to_str()

Convert timestamp int to date string.

Parameters

int $date_in: Timestamp (int) date representation for DB: not set, timestamp int.

object $ntype: Node expire configuration for particular node type.

Return value

string String date representation for UI: date string or ''.

2 calls to _node_expire_date_db_to_str()
_node_expire_form_alter_nodeform in ./node_expire.nodeapi.inc
Implements hook_form_alter().
_node_expire_node_load in ./node_expire.nodeapi.inc
Implements hook_node_load().

File

./node_expire.nodeapi.inc, line 376
Node API integration.

Code

function _node_expire_date_db_to_str($date_in, $ntype) {
  $date_inner = $date_in;
  if (empty($date_inner) || !_node_expire_is_valid_time_stamp($date_inner)) {
    if (isset($ntype) && !empty($ntype->default) && strtotime($ntype->default)) {
      $date_out = $ntype->default;
    }
    else {
      $date_out = '';
    }
  }
  elseif ($date_inner >= NODE_EXPIRE_NO_EXPIRE) {
    $date_out = '';
  }
  else {
    $date_out = date(NODE_EXPIRE_FORMAT, $date_inner);
  }
  return $date_out;
}