Completed
Pull Request — master (#138)
by
unknown
05:40
created

helpers.php ➔ get_the_github_view_link()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
/**
3
 * Theme helper functions.
4
 *
5
 * @package WordPress_GitHub_SYnc
6
 */
7
8
/**
9
 * Returns the HTML markup to view the current post on GitHub.
10
 *
11
 * @return string
12
 */
13
function get_the_github_view_link() {
14 1
	return '<a href="' . get_the_github_view_url() . '">' . apply_filters( 'wpghs_view_link_text', 'View this post on GitHub.' ) . '</a>';
15
}
16
17
/**
18
 * Returns the URL to view the current post on GitHub.
19
 *
20
 * @return string
21
 */
22
function get_the_github_view_url() {
23 2
	$wpghs_post = new WordPress_GitHub_Sync_Post( get_the_ID(), WordPress_GitHub_Sync::$instance->api() );
24
25 2
	return $wpghs_post->github_view_url();
26
}
27
28
/**
29
 * Returns the HTML markup to edit the current post on GitHub.
30
 *
31
 * @return string
32
 */
33
function get_the_github_edit_link() {
34 1
	return '<a href="' . get_the_github_edit_url() . '">' . apply_filters( 'wpghs_edit_link_text', 'Edit this post on GitHub.' ) . '</a>';
35
}
36
37
/**
38
 * Returns the URL to edit the current post on GitHub.
39
 *
40
 * @return string
41
 */
42
function get_the_github_edit_url() {
43 2
	$wpghs_post = new WordPress_GitHub_Sync_Post( get_the_ID(), WordPress_GitHub_Sync::$instance->api() );
44
45 2
	return $wpghs_post->github_edit_url();
46
}
47