]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - includes/functions-deprecated.php
Merge pull request #1523 from YOURLS/http-lib
[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  * Check if we'll need interface display function (ie not API or redirection)
32  *
33  */
34 function yourls_has_interface() {
35         yourls_deprecated_function( __FUNCTION__, '1.7' );
36         if( yourls_is_API() or yourls_is_GO() )
37                 return false;
38         return true;
39 }
40
41 /**
42  * Make sure a integer is safe
43  * 
44  * Note: this function is dumb and dumbly named since it does not intval(). DO NOT USE.
45  *
46  */
47 function yourls_intval( $in ) {
48         yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_sanitize_int' );
49         return yourls_escape( $in );
50 }
51
52 /**
53  * Get remote content via a GET request using best transport available
54  *
55  */
56 function yourls_get_remote_content( $url,  $maxlen = 4096, $timeout = 5 ) {
57         yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_http_get_body' );
58         return yourls_http_get_body( $url );
59 }
60