HEX
Server: Apache/2.4.59 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2
System: Linux panel.ctvbarranquilla.com 5.15.0-102-generic #112-Ubuntu SMP Tue Mar 5 16:50:32 UTC 2024 x86_64
User: bastidas (1002)
PHP: 8.2.18
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen
Upload Files
File: /home/bastidas/web/bastidas.tv/public_html/wp-content/plugins/unbounce/UBUtil.php
<?php

class UBUtil
{

    public static function array_select_by_key($input, $keep)
    {
        return array_intersect_key($input, array_flip($keep));
    }

    public static function array_fetch($array, $index, $default = null)
    {
        return isset($array[$index]) ? $array[$index] : $default;
    }

    public static function time_ago($timestamp)
    {
        $now = new DateTime('now');
        $from = new DateTime();
        $from->setTimestamp($timestamp);
        $diff = date_diff($now, $from);

        if ($diff->y > 0) {
            $message = $diff->y . ' year'. ($diff->y > 1 ? 's' : '');
        } elseif ($diff->m > 0) {
            $message = $diff->m . ' month'. ($diff->m > 1 ? 's' : '');
        } elseif ($diff->d > 0) {
            $message = $diff->d . ' day' . ($diff->d > 1 ? 's' : '');
        } elseif ($diff->h > 0) {
            $message = $diff->h . ' hour' . ($diff->h > 1 ? 's' : '');
        } elseif ($diff->i > 0) {
            $message = $diff->i . ' minute' . ($diff->i > 1 ? 's' : '');
        } elseif ($diff->s > 0) {
            $message = $diff->s . ' second' . ($diff->s > 1? 's' : '');
        } else {
            $message = 'a moment';
        }

        return $message . ' ago';
    }

    public static function clear_flash()
    {
        foreach ($_COOKIE as $cookie_name => $value) {
            if (strpos($cookie_name, 'ub-flash-') === 0) {
                setcookie($cookie_name, '', time() - 60);
            }
        }
    }

    public static function get_flash($cookie_name, $default = null)
    {
        return UBUtil::array_fetch($_COOKIE, "ub-flash-{$cookie_name}", $default);
    }

    public static function set_flash($cookie_name, $value)
    {
        setcookie("ub-flash-{$cookie_name}", $value, time() + 60);
    }

    public static function get_lock()
    {
        global $wpdb;

        try {
            $lock = $wpdb->get_var('select coalesce(get_lock("' . UBConfig::UB_LOCK_NAME . '",0), 0);');

            return (bool) $lock;
        } catch (Exception $e) {
            // ensure backward compatibility on failure
            return true;
        }
    }

    public static function release_lock()
    {
        global $wpdb;

        try {
            $release = $wpdb->get_var('select coalesce(release_lock("' . UBConfig::UB_LOCK_NAME . '"), 0);');

            return (bool) $release;
        } catch (Exception $e) {
            // ensure backward compatibility on failure
            return true;
        }
    }

  /**
   * Checks if the current page is a preview page (from on GET parameters).
   *
   * This is needed because Wordpress's is_preview() is only true for pages that
   * are already published.
   *
   * This should return true when:
   *   - previewing posts
   *   - previewing pages
   *   - previewing drafts (of posts & pages)
   */
    public static function is_wordpress_preview($get_params)
    {
        return isset($get_params['preview'])
        && (isset($get_params['p']) || isset($get_params['page_id']) || isset($get_params['preview_id']));
    }
}