aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Notes.php
blob: be4ec64a6449c415a557cfda0d166f251abe6303 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

/**
 *   * Name: Notes
 *   * Description: A simple notes widget, requires the Notes App
 *   * Author: Mike Macgirvin
 *   * Author: Mario Vavti
 *   * Maintainer: Mario Vavti
 */

namespace Zotlabs\Widget;

use App;
use Zotlabs\Lib\Apps;

class Notes {

	function widget($arr) {
		if(!local_channel()) {
			return EMPTY_STR;
		}

		if (App::$profile_uid !== local_channel()) {
			return EMPTY_STR;
		}

		if(!Apps::system_app_installed(local_channel(), 'Notes')) {
			return EMPTY_STR;
		}

		$text = get_pconfig(local_channel(),'notes','text');

		$tpl = get_markup_template('notes.tpl');

		$o = replace_macros($tpl, array(
			'$text' => $text,
			'$html' => bbcode($text, ['tryoembed' => false]),
			'$app' => ((isset($arr['app'])) ? true : false),
			'$hidden' => ((isset($arr['hidden'])) ? true : false),
			'$strings' => [
				'title' => t('Notes'),
				'read' => t('Read mode'),
				'edit' => t('Edit mode'),
				'editing' => t('Editing'),
				'saving' => t('Saving'),
				'saved' => t('Saved'),
				'dots' => '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>'
			]
		));

		return $o;
	}
}