PluginProbe
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity / 1.18.0
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity v1.18.0
3.3.9 3.3.8 trunk 1.0 1.1.0 1.10.0 1.11.0 1.11.1 1.12.0 1.13.0 1.14.0 1.15.0 1.16.0 1.17.0 1.17.1 1.18.0 1.19.0 1.2.0 1.20.0 1.20.1 1.3.0 1.3.1 1.4.0 1.5.0 1.6.0 All 67 releases
logtivity / Helpers / Helpers.php

Helpers.php in Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity 1.18.0, at Helpers/Helpers.php

82 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 *
5 * Dump and Die variable or whatever
6 *
7 * @param $dump
8 *
9 */
10 function logtivity_dd($dump) {
11 echo "<pre>";
12 var_export($dump);
13 echo "</pre>";
14 die();
15 }
16
17 /**
18 * Load a view and pass variables into it
19 *
20 * To ouput a view you would want to echo it
21 *
22 * @param string $fileName excluding file extension
23 * @param array $vars
24 * @return string
25 */
26 function logtivity_view($fileName, $vars = array()) {
27
28 foreach ($vars as $key => $value) {
29
30 ${$key} = $value;
31
32 }
33
34 ob_start();
35
36 include( dirname(__FILE__) . '/../views/' . str_replace('.', '/', $fileName) . '.php');
37
38 return ob_get_clean();
39 }
40
41 /**
42 * Get Site API Key
43 *
44 * @return string
45 */
46 function logtivity_get_api_key() {
47 return sanitize_text_field(
48 (new Logtivity_Options)->getOption('logtivity_site_api_key')
49 );
50 }
51
52 function logtivity_get_the_title($post_id) {
53 $wptexturize = remove_filter( 'the_title', 'wptexturize' );
54
55 $title = get_the_title($post_id);
56
57 if ( $wptexturize ) {
58 add_filter( 'the_title', 'wptexturize' );
59 }
60
61 return $title;
62 }
63
64 function logtivity_get_api_url()
65 {
66 if (defined('LOGTIVITY_API_URL')) {
67 return LOGTIVITY_API_URL;
68 }
69
70 return 'https://api.logtivity.io';
71 }
72
73 function logtivity_has_site_url_changed()
74 {
75 $hash = (new Logtivity_Options)->urlHash();
76
77 if (!$hash) {
78 return false;
79 }
80
81 return $hash !== md5(home_url());
82 }