Completed
Push — master ( e47c17...035b95 )
by
unknown
04:49
created

deprecated.php ➔ gce_date_unix()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 11
nc 2
nop 1
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Deprecated functions
4
 *
5
 * Functions that are kept for backward support but should not be used anymore.
6
 *
7
 * @package SimpleCalendar/Deprecated
8
 * @deprecated
9
 */
10
11
if ( ! defined( 'ABSPATH' ) ) {
12
	exit;
13
}
14
15
/**
16
 * Print a calendar.
17
 * @deprecated Use simcal_print_calendar()
18
 */
19
function gce_print_calendar( $feed_ids, $display, $args  ) {
20
21
	$id = 0;
22
23
	if ( is_numeric( $feed_ids ) ) {
24
		$id = intval( $feed_ids );
25
	} elseif ( is_array( $feed_ids ) ) {
26
		$id = isset( $feed_ids[0] ) ? intval( $feed_ids[0] ) : '';
27
	}
28
29
	if ( $id > 0 ) {
30
		simcal_print_calendar( $id );
31
	}
32
}
33
34
/**
35
 * Convert date from mm/dd/yyyy to unix timestamp.
36
 * @deprecated Assumes a US-only time format.
37
 */
38
function gce_date_unix( $date = '' ) {
39
	if ( empty( $date ) ) {
40
		$current_time = current_time( 'timestamp' );
41
		$timestamp = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
42
	} else {
43
		$date = explode( '/', $date );
44
		$month = $date[0];
45
		$day   = $date[1];
46
		$year  = $date[2];
47
		$timestamp = mktime( 0, 0, 0, $month, $day, $year );
48
	}
49
	return $timestamp;
50
}
51