# logtivity/1.20.1/Helpers/Helpers.php

Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity, version 1.20.1. 82 lines.

- Page: https://pluginprobe.com/plugins/logtivity/1.20.1/code/Helpers/Helpers.php
- Raw: https://pluginprobe.com/plugins/logtivity/1.20.1/raw/Helpers/Helpers.php
- Modified: 2022-06-17T21:57:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/logtivity/1.20.1/code/Helpers/Helpers.php#L10-L20`.

```php
<?php

/**
 *
 * Dump and Die variable or whatever
 *
 * @param $dump
 *
 */
function logtivity_dd($dump) {
	echo "<pre>";
	var_export($dump);
	echo "</pre>";
	die();
}

/**
 * Load a view and pass variables into it
 *
 * To ouput a view you would want to echo it
 * 
 * @param  string $fileName excluding file extension
 * @param  array  $vars
 * @return string
 */
function logtivity_view($fileName, $vars = array()) {

    foreach ($vars as $key => $value) {
        
        ${$key} = $value;

    }

    ob_start();

    include( dirname(__FILE__) . '/../views/' . str_replace('.', '/', $fileName) . '.php');

    return ob_get_clean();
}

/**
 * Get Site API Key
 * 
 * @return string
 */
function logtivity_get_api_key() {
    return sanitize_text_field(
        (new Logtivity_Options)->getOption('logtivity_site_api_key')
    );
}

function logtivity_get_the_title($post_id) {
    $wptexturize = remove_filter( 'the_title', 'wptexturize' );
    
    $title = get_the_title($post_id);

    if ( $wptexturize ) {
        add_filter( 'the_title', 'wptexturize' );
    }

    return $title;
}

function logtivity_get_api_url()
{
    if (defined('LOGTIVITY_API_URL')) {
        return LOGTIVITY_API_URL;
    }

    return 'https://api.logtivity.io';
}

function logtivity_has_site_url_changed()
{
    $hash = (new Logtivity_Options)->urlHash();

    if (!$hash) {
        return false;
    }

    return $hash !== md5(home_url());
}
```
