This repository has been archived by the owner on Aug 29, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.php
77 lines (54 loc) · 1.86 KB
/
extension.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
// Sea of Clouds - Twitter Widget Extension for Bolt, by Bob den Otter
namespace SeaOfCloudsWidget;
use Bolt\Extensions\Snippets\Location as SnippetLocation;
class Extension extends \Bolt\BaseExtension
{
/**
* Info block for Sea of Clouds - Twitter Widget Extension.
*/
function info()
{
$data = array(
'name' => "Tweet! - Twitter Widget",
'description' => "Tweetwidget is a twitter widget, based on the 'Sea of Clouds' Tweet! script.",
'keywords' => "twitter, widget, sidebar",
'author' => "Bob den Otter",
'link' => "http://bolt.cm",
'version' => "0.1",
'required_bolt_version' => "1.1.0",
'highest_bolt_version' => "1.1.1",
'type' => "Widget",
'first_releasedate' => "2013-03-10",
'latest_releasedate' => "2013-03-10",
'dependencies' => "",
'priority' => 10
);
return $data;
}
/**
* Initialize Sea of Clouds - Twitter Widget. Called during bootstrap phase.
*/
function initialize()
{
// Make sure jQuery is included
$this->addJquery();
// Add javascript file
$this->addJavascript("assets/jquery.tweet.js");
// Add CSS file
$this->addCSS("assets/" . $this->config['style_filename']);
// Initialize the Twig function
$this->addTwigFunction('tweetwidget', 'tweetwidget');
}
/**
* Twig function {{ tweetwidget() }} in Sea of Clouds - Twitter Widget extension.
*/
function tweetwidget()
{
$this->app['twig.loader.filesystem']->addPath(__DIR__);
$formhtml = $this->app['twig']->render("assets/" . $this->config['template'], array(
"config" => $this->config
));
return new \Twig_Markup($formhtml, 'UTF-8');
}
}