| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | +// phpcs:set WordPress.Security.ValidatedSanitizedInput customSanitizingFunctions[] ph_clean | |
| 3 | +// ph_clean() recursively sanitizes text; presence, shape and unslashing checks remain separate. | |
| 4 | + | |
| 2 | 5 | /** |
| 3 | 6 | * PropertyHive Admin Functions |
| 4 | 7 | * |
| 5 | 8 | * @author PropertyHive |
| @@ -14,11 +17,10 @@ | ||
| 14 | 17 | * Get all PropertyHive screen ids |
| 15 | 18 | * |
| 16 | 19 | * @return array |
| 17 | 20 | */ |
| 21 | +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper ph_get_screen_ids; the established callable name is part of the plugin/extension API and must remain stable. | |
| 18 | 22 | function ph_get_screen_ids() { |
| 19 | - $ph_screen_id = sanitize_title( __( 'PropertyHive', 'propertyhive' ) ); | |
| 20 | - | |
| 21 | 23 | return apply_filters( 'propertyhive_screen_ids', array( |
| 22 | 24 | 'edit-property', |
| 23 | 25 | 'property', |
| 24 | 26 | 'edit-contact', |
| @@ -52,8 +54,9 @@ | ||
| 52 | 54 | * @param string $page_content (default: '') Content for the new page |
| 53 | 55 | * @param int $post_parent (default: 0) Parent for the new page |
| 54 | 56 | * @return int page ID |
| 55 | 57 | */ |
| 58 | +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper ph_create_page; the established callable name is part of the plugin/extension API and must remain stable. | |
| 56 | 59 | function ph_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { |
| 57 | 60 | global $wpdb; |
| 58 | 61 | |
| 59 | 62 | /*$option_value = get_option( $option ); |
| @@ -302,25 +305,34 @@ | ||
| 302 | 305 | |
| 303 | 306 | return false; |
| 304 | 307 | } |
| 305 | 308 | |
| 306 | -function propertyhive_human_time_difference($timestamp) | |
| 309 | +function propertyhive_human_time_difference( $timestamp ) | |
| 307 | 310 | { |
| 308 | - $now = time() ; | |
| 311 | + $now = time(); | |
| 309 | 312 | |
| 310 | - if ( ! $timestamp ) | |
| 311 | - { | |
| 312 | - return __( 'never', 'propertyhive' ); | |
| 313 | - } | |
| 314 | - if ( $now - $timestamp > 0 ) | |
| 315 | - { | |
| 316 | - return sprintf( __( '%s ago', 'propertyhive' ), human_time_diff( $timestamp, $now ) ); | |
| 317 | - } | |
| 318 | - else if ( $now - $timestamp < 0 ) | |
| 319 | - { | |
| 320 | - return sprintf( __( 'in %s', 'propertyhive' ), human_time_diff( $timestamp, $now ) ); | |
| 321 | - } | |
| 322 | - else | |
| 323 | - { | |
| 324 | - return __( 'now', 'propertyhive' ); | |
| 325 | - } | |
| 326 | -} | |
| 313 | + if ( !$timestamp ) | |
| 314 | + { | |
| 315 | + return __( 'never', 'propertyhive' ); | |
| 316 | + } | |
| 317 | + | |
| 318 | + if ( $now - $timestamp > 0 ) | |
| 319 | + { | |
| 320 | + return sprintf( | |
| 321 | + /* translators: %s: human-readable time difference (e.g. "5 minutes") */ | |
| 322 | + __( '%s ago', 'propertyhive' ), | |
| 323 | + human_time_diff( $timestamp, $now ) | |
| 324 | + ); | |
| 325 | + } | |
| 326 | + elseif ( $now - $timestamp < 0 ) | |
| 327 | + { | |
| 328 | + return sprintf( | |
| 329 | + /* translators: %s: human-readable time difference (e.g. "5 minutes") */ | |
| 330 | + __( 'in %s', 'propertyhive' ), | |
| 331 | + human_time_diff( $timestamp, $now ) | |
| 332 | + ); | |
| 333 | + } | |
| 334 | + else | |
| 335 | + { | |
| 336 | + return __( 'now', 'propertyhive' ); | |
| 337 | + } | |
| 338 | +} | |