]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - includes/functions-deprecated.php
Another $int over $in since it's about int
[Github/YOURLS.git] / includes / functions-deprecated.php
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 /**
11  * Return word or words if more than one
12  *
13  */
14 function yourls_plural( $word, $count=1 ) {
15         yourls_deprecated_function( __FUNCTION__, '1.6', 'yourls_n' );
16         return $word . ($count > 1 ? 's' : '');
17 }
18
19 /**
20  * Return list of all shorturls associated to the same long URL. Returns NULL or array of keywords.
21  *
22  */
23 function yourls_get_duplicate_keywords( $longurl ) {
24         yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_get_longurl_keywords' );
25         if( !yourls_allow_duplicate_longurls() )
26                 return NULL;
27         return yourls_apply_filter( 'get_duplicate_keywords', yourls_get_longurl_keywords ( $longurl ), $longurl );
28 }
29
30 /**
31  * Make sure a integer is safe
32  * 
33  * Note: this function is dumb and dumbly named since it does not intval(). DO NOT USE.
34  *
35  */
36 function yourls_intval( $int ) {
37         yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_sanitize_int' );
38         return yourls_escape( $int );
39 }
40
41 /**
42  * Get remote content via a GET request using best transport available
43  *
44  */
45 function yourls_get_remote_content( $url,  $maxlen = 4096, $timeout = 5 ) {
46         yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_http_get_body' );
47         return yourls_http_get_body( $url );
48 }
49
50 /**
51  * Alias for yourls_apply_filter because I never remember if it's _filter or _filters
52  *
53  * At first I thought it made semantically more sense but thinking about it, I was wrong. It's one filter.
54  * There may be several function hooked into it, but it still the same one filter.
55  *
56  * @since 1.6
57  * @deprecated 1.7.1
58  *
59  * @param string $hook the name of the YOURLS element or action
60  * @param mixed $value the value of the element before filtering
61  * @return mixed
62  */
63 function yourls_apply_filters( $hook, $value = '' ) {
64         yourls_deprecated_function( __FUNCTION__, '1.7.1', 'yourls_apply_filter' );
65         return yourls_apply_filter( $hook, $value );
66 }
67
68 /**
69  * Check if we'll need interface display function (ie not API or redirection)
70  *
71  */
72 function yourls_has_interface() {
73         yourls_deprecated_function( __FUNCTION__, '1.7.1' );
74         if( yourls_is_API() or yourls_is_GO() )
75                 return false;
76         return true;
77 }
78
79 /**
80  * Check if a proxy is defined for HTTP requests
81  *
82  * @uses YOURLS_PROXY
83  * @since 1.7
84  * @deprecated 1.7.1
85  * @return bool true if a proxy is defined, false otherwise
86  */
87 function yourls_http_proxy_is_defined() {
88         yourls_deprecated_function( __FUNCTION__, '1.7.1', 'yourls_http_get_proxy' );
89         return yourls_apply_filter( 'http_proxy_is_defined', defined( 'YOURLS_PROXY' ) );
90 }
91
92 /**
93  * Displays translated string with gettext context
94  *
95  * This function has been renamed yourls_xe() for consistency with other *e() functions
96  *
97  * @see yourls_x()
98  * @since 1.6
99  * @deprecated 1.7.1
100  *
101  * @param string $text Text to translate
102  * @param string $context Context information for the translators
103  * @param string $domain Optional. Domain to retrieve the translated text
104  * @return string Translated context string without pipe
105  */
106 function yourls_ex( $text, $context, $domain = 'default' ) {
107         yourls_deprecated_function( __FUNCTION__, '1.7.1', 'yourls_xe' );
108         echo yourls_xe( $text, $context, $domain );
109 }
110