From 1c86f4e22e48b7c04a309af8d4fcfca6c86e6f37 Mon Sep 17 00:00:00 2001 From: ozh Date: Mon, 30 Dec 2013 17:53:10 +0100 Subject: [PATCH] Cleaning: deprecated stuff in their own file Having all deprecated functions in one place will make it easier to check whether some are still in use, see 57f69f08c ... --- includes/functions-compat.php | 4 +++ includes/functions-deprecated.php | 50 +++++++++++++++++++++++++++++++ includes/functions-formatting.php | 20 ------------- includes/functions-install.php | 4 +-- includes/functions.php | 21 ------------- 5 files changed, 56 insertions(+), 43 deletions(-) create mode 100644 includes/functions-deprecated.php diff --git a/includes/functions-compat.php b/includes/functions-compat.php index 77b79e2..cda6f8e 100644 --- a/includes/functions-compat.php +++ b/includes/functions-compat.php @@ -1,4 +1,8 @@ 1 ? 's' : ''); +} + +/** + * Return list of all shorturls associated to the same long URL. Returns NULL or array of keywords. + * + */ +function yourls_get_duplicate_keywords( $longurl ) { + yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_get_longurl_keywords' ); + if( !yourls_allow_duplicate_longurls() ) + return NULL; + return yourls_apply_filter( 'get_duplicate_keywords', yourls_get_longurl_keywords ( $longurl ), $longurl ); +} + +/** + * Check if we'll need interface display function (ie not API or redirection) + * + */ +function yourls_has_interface() { + yourls_deprecated_function( __FUNCTION__, '1.7' ); + if( yourls_is_API() or yourls_is_GO() ) + return false; + return true; +} + +/** + * Make sure a integer is safe + * + * Note: this function is dumb and dumbly named since it does not intval(). DO NOT USE. + * + */ +function yourls_intval( $in ) { + yourls_deprecated_function( __FUNCTION__, '1.7', 'yourls_sanitize_int' ); + return yourls_escape( $in ); +} diff --git a/includes/functions-formatting.php b/includes/functions-formatting.php index 1678c2b..e66493f 100644 --- a/includes/functions-formatting.php +++ b/includes/functions-formatting.php @@ -119,17 +119,6 @@ function yourls_sanitize_int( $in ) { return ( substr( preg_replace( '/[^0-9]/', '', strval( $in ) ), 0, 20 ) ); } -/** - * Make sure a integer is safe - * - * Note: this is not checking for integers, since integers on 32bits system are way too limited - * TODO: find a way to validate as integer - * - */ -function yourls_intval( $in ) { - return yourls_escape( $in ); -} - /** * Escape a string * @@ -168,15 +157,6 @@ function yourls_sanitize_date_for_sql( $date ) { return date( 'Y-m-d', strtotime( $date ) ); } -/** - * Return word or words if more than one - * - */ -function yourls_plural( $word, $count=1 ) { - yourls_deprecated_function( __FUNCTION__, '1.6', 'yourls_n' ); - return $word . ($count > 1 ? 's' : ''); -} - /** * Return trimmed string * diff --git a/includes/functions-install.php b/includes/functions-install.php index a8db1e2..2abb55e 100644 --- a/includes/functions-install.php +++ b/includes/functions-install.php @@ -40,11 +40,11 @@ function yourls_get_database_version() { } /** - * Check if PHP > 4.3 + * Check if PHP > 5.2 * */ function yourls_check_php_version() { - return ( version_compare( '4.3', phpversion() ) <= 0 ); + return ( version_compare( '5.2', phpversion() ) <= 0 ); } /** diff --git a/includes/functions.php b/includes/functions.php index 00ec3b0..4a4c1bd 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1294,17 +1294,6 @@ function yourls_allow_duplicate_longurls() { return ( defined( 'YOURLS_UNIQUE_URLS' ) && YOURLS_UNIQUE_URLS == false ); } -/** - * @deprecated Return list of all shorturls associated to the same long URL. Returns NULL or array of keywords. - * - */ -function yourls_get_duplicate_keywords( $longurl ) { - yourls_deprecated_function( __FUNCTION__, 1.7, 'yourls_get_longurl_keywords' ); - if( !yourls_allow_duplicate_longurls() ) - return NULL; - return yourls_apply_filter( 'get_duplicate_keywords', yourls_get_longurl_keywords ( $longurl ), $longurl ); -} - /** * Return array of keywords that redirect to the submitted long URL * @@ -1724,16 +1713,6 @@ function yourls_is_infos() { return false; } -/** - * Check if we'll need interface display function (ie not API or redirection) - * - */ -function yourls_has_interface() { - if( yourls_is_API() or yourls_is_GO() ) - return false; - return true; -} - /** * Check if we're in the admin area. Returns bool * -- 2.45.0