Completed
Pull Request — master (#2282)
by ྅༻ Ǭɀħ
01:46
created

includes/functions-deprecated.php (2 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Deprecated functions from past YOURLS versions. Don't use them, as they may be
4
 * removed in a later version. Use the newer alternatives instead.
5
 *
6
 * Note to devs: when deprecating a function, move it here. Then check all the places
7
 * in core that might be using it, including core plugins.
8
 */
9
10
// @codeCoverageIgnoreStart
11
12
/**
13
 * Return word or words if more than one
14
 *
15
 */
16
function yourls_plural( $word, $count=1 ) {
17
	yourls_deprecated_function( __FUNCTION__, '1.6', 'yourls_n' );
18
	return $word . ($count > 1 ? 's' : '');
19
}
20
21
/**
22
 * Return list of all shorturls associated to the same long URL. Returns NULL or array of keywords.
23
 *
24
 */
25
function yourls_get_duplicate_keywords( $longurl ) {
26
	yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_get_longurl_keywords' );
27
	if( !yourls_allow_duplicate_longurls() )
28
		return NULL;
29
	return yourls_apply_filter( 'get_duplicate_keywords', yourls_get_longurl_keywords ( $longurl ), $longurl );
30
}
31
32
/**
33
 * Make sure a integer is safe
34
 *
35
 * Note: this function is dumb and dumbly named since it does not intval(). DO NOT USE.
36
 *
37
 */
38
function yourls_intval( $int ) {
39
	yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_sanitize_int' );
40
	return yourls_escape( $int );
41
}
42
43
/**
44
 * Get remote content via a GET request using best transport available
45
 *
46
 */
47
function yourls_get_remote_content( $url,  $maxlen = 4096, $timeout = 5 ) {
0 ignored issues
show
The parameter $maxlen is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $timeout is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
	yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_http_get_body' );
49
	return yourls_http_get_body( $url );
50
}
51
52
/**
53
 * Alias for yourls_apply_filter because I never remember if it's _filter or _filters
54
 *
55
 * At first I thought it made semantically more sense but thinking about it, I was wrong. It's one filter.
56
 * There may be several function hooked into it, but it still the same one filter.
57
 *
58
 * @since 1.6
59
 * @deprecated 1.7.1
60
 *
61
 * @param string $hook the name of the YOURLS element or action
62
 * @param mixed $value the value of the element before filtering
63
 * @return mixed
64
 */
65
function yourls_apply_filters( $hook, $value = '' ) {
66
	yourls_deprecated_function( __FUNCTION__, '1.7.1', 'yourls_apply_filter' );
67
	return yourls_apply_filter( $hook, $value );
68
}
69
70
/**
71
 * Check if we'll need interface display function (ie not API or redirection)
72
 *
73
 */
74
function yourls_has_interface() {
75
	yourls_deprecated_function( __FUNCTION__, '1.7.1' );
76
	if( yourls_is_API() or yourls_is_GO() )
77
		return false;
78
	return true;
79
}
80
81
/**
82
 * Check if a proxy is defined for HTTP requests
83
 *
84
 * @uses YOURLS_PROXY
85
 * @since 1.7
86
 * @deprecated 1.7.1
87
 * @return bool true if a proxy is defined, false otherwise
88
 */
89
function yourls_http_proxy_is_defined() {
90
	yourls_deprecated_function( __FUNCTION__, '1.7.1', 'yourls_http_get_proxy' );
91
	return yourls_apply_filter( 'http_proxy_is_defined', defined( 'YOURLS_PROXY' ) );
92
}
93
94
/**
95
 * Displays translated string with gettext context
96
 *
97
 * This function has been renamed yourls_xe() for consistency with other *e() functions
98
 *
99
 * @see yourls_x()
100
 * @since 1.6
101
 * @deprecated 1.7.1
102
 *
103
 * @param string $text Text to translate
104
 * @param string $context Context information for the translators
105
 * @param string $domain Optional. Domain to retrieve the translated text
106
 * @return string Translated context string without pipe
107
 */
108
function yourls_ex( $text, $context, $domain = 'default' ) {
109
	yourls_deprecated_function( __FUNCTION__, '1.7.1', 'yourls_xe' );
110
	echo yourls_xe( $text, $context, $domain );
111
}
112
113
// @codeCoverageIgnoreEnd
114