46 |
47 | An example for use of this plugin can be viewed [on my website](http://albrecht.me/#dribbble).
48 |
49 | ## Attributes for the shot-object
50 | * `$shot->id` The ID of the shot
51 | * `$shot->title` The title of the shot
52 | * `$shot->url` The (long) url of the shot
53 | * `$shot->short_url` The short-url of the shot
54 | * `$shot->image` The image-url of the shot
55 | * `$shot->likes` The number of likes on the shot
56 | * `$shot->views` The number of views on the shot
57 | * `$shot->rebounds` The number of rebounds of the shot
58 | * `$shot->comments` The number of comments on the shot
59 | * `$shot->created` The date/time the liked post was created
60 |
61 | ## Attributes for the player-object
62 | * `$player->id` The ID of the player
63 | * `$player->name` The name of the player
64 | * `$player->username` The username of the player
65 | * `$player->avatar_url` The avatar-url of the player
66 | * `$player->twitter` The Twitter handle of the player
67 | * `$player->location` The location of the player
68 | * `$player->followers` The number of followers of the player
69 | * `$player->following` The number of users the player is following
70 | * `$player->likes` The number of shots the player has liked
71 |
72 | ## Attributes for the like-object
73 | * `$like->id` The ID of the liked shot
74 | * `$like->title` The title of the liked shot
75 | * `$like->url` The (long) url of the liked shot
76 | * `$like->short_url` The short-url of the liked shot
77 | * `$like->image` The image-url of the liked shot
78 | * `$like->likes` The number of likes on the liked shot
79 | * `$like->views` The number of views on the liked shot
80 | * `$like->rebounds` The number of rebounds of liked the shot
81 | * `$like->comments` The number of comments on liked the shot
82 | * `$like->created` The date/time the liked post was created
83 | * `$like->player` A representation of the user that created the liked shot. (same attributes as the player-object)
84 |
85 | ## Requirements
86 | Your web server must have support for cURL [(installation instructions)](http://www.php.net/manual/en/curl.installation.php).
87 |
88 | ## Author & Copyright
89 | Copyright 2012, Simon Albrecht [http://albrecht.me/](http://albrecht.me).
90 | If you use this plugin, feel free to ping me [@s_albrecht](http://twitter.com/s_albrecht).
--------------------------------------------------------------------------------
/plugins/email/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/email/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "email",
3 | "readable": "Email",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Send mails via mail(), Amazon SES and Postmark",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/email/readme.mdown:
--------------------------------------------------------------------------------
1 | # Email Plugin
2 |
3 | ## What is it?
4 |
5 | It's a simple email sender plugin. You can use it everywhere in your code to send emails via PHP's mail(), [Amazon Simple Email Service](http://aws.amazon.com/ses/) or [Postmark](http://postmarkapp.com/)
6 |
7 | ## Installation
8 |
9 | Copy the email.php file to your site/plugins folder.
10 |
11 | ### Amazon SES configuration
12 |
13 | Go to your site/config/config.php and add the following rules:
14 |
15 | c::set('email.use', 'amazon');
16 | c::set('email.amazon.key', 'Your Amazon SES Key');
17 | c::set('email.amazon.secret', 'Your Amazon SES Secret');
18 |
19 | ### Postmark configuration
20 |
21 | Go to your site/config/config.php and add the following rules:
22 |
23 | c::set('email.use', 'postmark');
24 | c::set('email.postmark.key', 'Your Postmark API Key');
25 |
26 | ## How to use it?
27 |
28 | You can use it in your templates, snippets or plugins like this:
29 |
30 | 'John Doe ',
34 | 'from' => 'Max Musterman ',
35 | 'subject' => 'My first Email',
36 | 'body' => 'Hello my friend! How are things going?'
37 | ));
38 |
39 | ?>
40 |
41 | ### React on sending errors
42 |
43 | 'John Doe ',
47 | 'from' => 'Max Musterman ',
48 | 'subject' => 'My first Email',
49 | 'body' => 'Hello my friend! How are things going?'
50 | ));
51 |
52 | if(error($send)) {
53 |
54 | // show the response
55 | a::show($send);
56 |
57 | // or do something else like saying that the email failed
58 | echo "The email could not be sent";
59 |
60 | }
61 |
62 | ?>
63 |
64 | ## Available Params
65 |
66 | This is the full list of params you can pass to the email function:
67 |
68 | ### to
69 |
70 | The address the email will be sent to. You can use either just the address…
71 |
72 | 'to' => 'john@doe.com'
73 |
74 | …or the address together with a name…
75 |
76 | 'to' => 'John Doe '
77 |
78 | If you are always sending to the same address, you can setup the to address in your config like this:
79 |
80 | c::set('email.to', 'John Doe ');
81 |
82 | Afterwards you don't need to pass the to address when calling the email function.
83 |
84 | ### from
85 |
86 | The address from which the mail has been sent. Please make sure to use an address which you are allowed to use to avoid spam. The following formats are allowed
87 |
88 | 'from' => 'john@doe.com'
89 |
90 | 'from' => 'John Doe '
91 |
92 | If you are always sending from the same address, you can setup the from address in your config like this:
93 |
94 | c::set('email.from', 'John Doe ');
95 |
96 | Afterwards you don't need to pass the to address when calling the email function.
97 |
98 | ### replyto
99 |
100 | The reply address. The from address will be used if you don't pass this. The following formats are allowed
101 |
102 | 'from' => 'john@doe.com'
103 |
104 | 'from' => 'John Doe '
105 |
106 | If you are always using the same reply address, you can setup the address in your config like this:
107 |
108 | c::set('email.replyto', 'John Doe ');
109 |
110 | Afterwards you don't need to pass the to address when calling the email function.
111 |
112 | ### subject
113 |
114 | The subject line for your email. If you are always using the same subject you can setup a default subject in your config:
115 |
116 | c::set('email.subject', 'This is my default subject');
117 |
118 | ### body
119 |
120 | The plain text for your email. The email plugin does not support sending HTML emails.
121 |
122 | ### use
123 |
124 | If you want to switch the transport service, you can do it like this:
125 |
126 | 'use' => 'mail'
127 |
128 | 'use' => 'amazon'
129 |
130 | 'use' => 'postmark'
131 |
132 | ### postmark.key
133 |
134 | If you want to send from a different postmark api key, you can pass the key in the params, when calling the email function.
135 |
136 | ### postmark.test
137 |
138 | You can pass `postmark.test => true` when calling the email function to make a test call instead of sending a real request to the postmark api. Unfortunately this is not supported by the Amazon API as well.
139 |
140 | ### amazon.key
141 |
142 | If you want to send from a different amazon api key, you can pass the key in the params, when calling the email function.
143 |
144 | ### amazon.secret
145 |
146 | If you want to send from a different amazon api secret, you can pass the key in the params, when calling the email function.
147 |
148 |
149 | ## Author
150 | Bastian Allgeier
151 |
--------------------------------------------------------------------------------
/plugins/flickrbadge/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/flickrbadge/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flickrbadge",
3 | "readable": "Flickrbadge",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Display the latest pictures from your Flickr account",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/flickrbadge/readme.mdown:
--------------------------------------------------------------------------------
1 | # Flickrbadge Plugin
2 |
3 | ## What is it?
4 |
5 | It's a little plugin to display the latest public pictures from your Flickr account.
6 |
7 | ## Installation
8 |
9 | Copy the flickrbadge.php file to your site/plugins folder.
10 | You should make sure to enable caching. Otherwise the badge will make multiple API calls to Flickr's API every time the page is refreshed, which takes very long.
11 |
12 | - Go to site/config/config.php to set c::set('cache', true);
13 | - Make sure that site/cache is writable (change permissions to 0755)
14 |
15 | ## How to use it?
16 |
17 | You can add it to your templates like this:
18 |
19 | 'your-flickr-api-key',
23 | 'username' => 'your-flickr-username',
24 | 'limit' => 4,
25 | 'format' => 'medium'
26 | ));
27 |
28 | ?>
29 |
30 |
31 |
32 |
33 |
title() ?>
34 |
taken()) ?>
35 |
Views: views() ?>
36 |
Comments: comments() ?>
37 |
Tags: tags()) ?>
38 |
39 |
40 |
41 |
42 |
43 | ## Available Options
44 |
45 | ### key (required)
46 |
47 | Set your Flickr api key. You can get a Flickr API Key over here:
48 |
49 | ### username (required)
50 |
51 | Set your Flickr username.
52 |
53 | ### limit (default: 10)
54 |
55 | Set the number of images you'd like to display in your badge
56 |
57 | ### format (default: square)
58 |
59 | Set the image format for your badge. The following formats are available:
60 |
61 | - square
62 | - thumbnail
63 | - small
64 | - medium
65 | - medium_640
66 | - large
67 | - original
68 |
69 | ### cache (default: true)
70 |
71 | Disable or enable the cache. Caching the results is highly recommended. Otherwise the badge will be super slow. You must make sure that `site/cache` is writable (change permissions to 0755) You must also set c::set('cache', true); in site/config/config.php to enable the cache.
72 |
73 | ### refresh (default: two hours)
74 |
75 | Set the cache expiry in seconds. By default it will be set to two hours. After two hours the badge will try to fetch fresh data from the API. Photo and user information will be kept forever unless you delete the cache files manually. This will speed up the update process.
76 |
77 | ## Available variables for $picture objects
78 |
79 | When looping through the result array you can use the following variables:
80 |
81 | ### $picture->url()
82 |
83 | The url to the Flickr picture page
84 |
85 | ### $picture->src()
86 |
87 | The url of the image file
88 |
89 | ### $picture->title()
90 |
91 | The title of the picture
92 |
93 | ### $picture->description()
94 |
95 | The description for the picture
96 |
97 | ### $picture->tags()
98 |
99 | An array of tags
100 |
101 | ### $picture->taken()
102 |
103 | The unix timestamp when the picture has been taken
104 |
105 | ### $picture->posted()
106 |
107 | The unix timestamp when the picture has been posted on Flickr
108 |
109 | ### $picture->lastupdate()
110 |
111 | The unix timestamp when the picture has been updated
112 |
113 | ### $picture->views()
114 |
115 | The number of views for this picture
116 |
117 | ### $picture->comments()
118 |
119 | The number of comments for this picture
120 |
121 |
122 | ## Credits
123 |
124 | The plugin uses the awesome phpFlickr Class by Dan Coulter: http://phpflickr.com/
125 |
126 | ## Author
127 | Bastian Allgeier
128 |
--------------------------------------------------------------------------------
/plugins/github/README.mdown:
--------------------------------------------------------------------------------
1 | GitHub Plugin for Kirby
2 | =======================
3 |
4 | With that plugin you can implement a users GitHub information or list your repos easily in Kirby.
5 |
6 | Usage example for repos:
7 | ========================
8 | ```php
9 | repos() as $repo):
13 | ?>
14 |
43 |
44 |
45 | **Advanced Users:** See the source for further options.
46 |
47 | ## Attributes for the image
48 | * `$image->link` The link to the image
49 | * `$image->comments` The number of comments
50 | * `$image->likes` The number of likes
51 | * `$image->created` The timestamp when the image was created
52 | * `$image->thumb` The url of the thumbnail of the image
53 | * `$image->url` The url of the full-sized image
54 | * `$image->image_lowres` The url to a low-res version of the image
55 | * `$image->filter` The filter that was used
56 | * `$image->location` The location name
57 | * `$image->latitude` The latitude of the location
58 | * `$image->longitude` The longitude of the location
59 | * `$image->tags` An array of tags of the image
60 |
61 | ## Attributes for the user-object
62 | * `$user->username` The username of the user
63 | * `$user->full_name` The full name of the user
64 | * `$user->picture` The url to the avatar of the user
65 |
66 | ## Requirements
67 | Your web server must have support for cURL [(installation instructions)](http://www.php.net/manual/en/curl.installation.php).
68 |
69 | ## Author
70 | Copyright 2012, Simon Albrecht [http://albrecht.me/](http://albrecht.me).
71 | If you use this plugin, feel free to ping me [@s_albrecht](http://twitter.com/s_albrecht).
--------------------------------------------------------------------------------
/plugins/randomimage/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/randomimage/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "randomimage",
3 | "readable": "Random Image",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Display a random image from a given folder",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/randomimage/randomimage.php:
--------------------------------------------------------------------------------
1 |
10 | *
11 | *
12 | *
13 | * The directory must be relative to the root of the site.
14 | * Otherwise URLs will be broken
15 | *
16 | * @param string $dir the relative path to the directory
17 | * @return string the full url to the image
18 | */
19 | function randomimage($dir) {
20 | $files = dir::read(c::get('root') . '/' . $dir);
21 | shuffle($files);
22 | return url($dir . '/' . a::first($files));
23 | }
24 |
25 | ?>
--------------------------------------------------------------------------------
/plugins/randomimage/readme.mdown:
--------------------------------------------------------------------------------
1 | # Random Image
2 |
3 | Returns a random image url from a given directory
4 | Can be used to display random header images for example.
5 |
6 | ## Installation
7 | Put the `randomimage.php` file in your `site/plugins` folder. If this folder doesn't exist yet, create it.
8 |
9 | ## Example usage
10 |
11 |
12 |
13 |
14 |
15 | ## Notes
16 |
17 | The directory must be relative to the root of the site, otherwise URLs will be broken
18 |
19 | If you are working with images in a content directory you can simplify this by doing:
20 |
21 | images()->shuffle()->first()->url() ?>
22 |
23 | ## Author
24 | Bastian Allgeier
25 |
--------------------------------------------------------------------------------
/plugins/readingtime/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/readingtime/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "readingtime",
3 | "readable": "Reading Time",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Estimate the reading time for your content",
7 | "author": "Roy Lodder",
8 | "url": "http://roylodder.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/readingtime/readingtime.php:
--------------------------------------------------------------------------------
1 | text()) ?>
12 | *
13 | * Author: Roy Lodder
14 | * Contributor: Bastian Allgeier
15 | *
16 | */
17 |
18 | function readingtime($content, $params=array()) {
19 |
20 | $defaults = array(
21 | 'minute' => 'minute',
22 | 'minutes' => 'minutes',
23 | 'second' => 'second',
24 | 'seconds' => 'seconds',
25 | 'format' => '{minutesCount} {minutesLabel}, {secondsCount} {secondsLabel}'
26 | );
27 |
28 | $options = array_merge($defaults, $params);
29 | $words = str_word_count(strip_tags($content));
30 |
31 | $minutesCount = floor($words / 200);
32 | $secondsCount = floor($words % 200 / (200 / 60));
33 | $minutesLabel = ($minutesCount <= 1) ? $options['minute'] : $options['minutes'];
34 | $secondsLabel = ($secondsCount <= 1) ? $options['second'] : $options['seconds'];
35 |
36 | $replace = array(
37 | 'minutesCount' => $minutesCount,
38 | 'minutesLabel' => $minutesLabel,
39 | 'secondsCount' => $secondsCount,
40 | 'secondsLabel' => $secondsLabel,
41 | );
42 |
43 | $result = $options['format'];
44 |
45 | foreach($replace as $key => $value) {
46 | $result = str_replace('{' . $key . '}', $value, $result);
47 | }
48 |
49 | return $result;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/plugins/readingtime/readme.mdown:
--------------------------------------------------------------------------------
1 | # Estimated reading time plugin
2 |
3 | This is a plugin for [Kirby](http://getkirby.com/) that estimates the reading time for your content.
4 |
5 | ## Installation
6 |
7 | Put the `readingtime.php` file in your `site/plugins` folder.
8 |
9 | ## How to use it
10 |
11 | It's very simple! Just put `text()) ?>` in your template and it will echo the estimated reading time. You can pass any other page variable to estimate the reading time of it.
12 |
13 | ## Example usage
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
title()) ?>
23 | text()) ?>
24 | text()) ?>
25 |
26 |
27 |
28 |
29 |
30 |
31 | ## Language
32 |
33 | The plugin is very easy to localize. The default format for example is 3 minutes, 31 seconds. Pass the following params to translate it to any language:
34 |
35 | text(), array(
38 | 'minute' => 'Minute',
39 | 'minutes' => 'Minuten',
40 | 'second' => 'Sekunde',
41 | 'seconds' => 'Sekunden'
42 | ));
43 |
44 | ?>
45 |
46 | You can even change the entire format of the result:
47 |
48 | text(), array(
51 | 'minute' => 'Minute',
52 | 'minutes' => 'Minuten',
53 | 'second' => 'Sekunde',
54 | 'seconds' => 'Sekunden',
55 | 'format' => '{minutesCount} {minutesLabel} – {secondsCount} {secondsLabel}
56 | ));
57 |
58 | ?>
59 |
60 | ## Author
61 |
62 | Author: Roy Lodder
63 | Contributor: Bastian Allgeier
64 |
65 | Original Version: https://github.com/Roylodder/Kirbycms-Reading-Time-Snippet
66 |
67 |
--------------------------------------------------------------------------------
/plugins/readlater/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/readlater/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "readlater",
3 | "readable": "Read later",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Save a page for later reading. Supports Instapaper and Pocket.",
7 | "author": "Roy Lodder",
8 | "url": "http://roylodder.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/readlater/readlater.php:
--------------------------------------------------------------------------------
1 | array(
7 | 'link' => 'http://www.instapaper.com/hello2?url={url}&title={title}',
8 | 'label' => 'Add to Instapaper',
9 | ),
10 | 'pocket' => array(
11 | 'link' => 'https://getpocket.com/save?url={url}&title={title}',
12 | 'label' => 'Save to Pocket',
13 | ),
14 | 'readability' => array(
15 | 'link' => 'http://www.readability.com/save?url={url}',
16 | 'label' => 'Add to Readability',
17 | )
18 | );
19 |
20 | if(!array_key_exists($tool, $tools)) return false;
21 |
22 | // make it possible to pass params
23 | // as third object instead of fourth.
24 | if(is_array($label)) {
25 | $params = $label;
26 | $label = false;
27 | }
28 |
29 | $defaults = array(
30 | 'label' => $label,
31 | 'rel' => false,
32 | 'target' => false,
33 | 'class' => 'readlater ' . $tool,
34 | 'url' => url::current(),
35 | );
36 |
37 | $options = array_merge($defaults, $params);
38 | $url = urlencode($options['url']);
39 | $title = urlencode($content);
40 | $label = ($options['label']) ? $options['label'] : $tools[$tool]['label'];
41 | $rel = ($options['rel']) ? ' rel="' . $options['rel'] . '"' : '';
42 | $target = ($options['target']) ? ' target="' . $options['target'] . '"' : '';
43 | $class = ($options['class']) ? ' class="' . $options['class'] . '"' : '';
44 |
45 | $link = str_replace('{url}', $url, $tools[$tool]['link']);
46 | $link = str_replace('{title}', $title, $link);
47 |
48 | return '' . $label . '';
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/plugins/readlater/readme.mdown:
--------------------------------------------------------------------------------
1 | # Read later plugin
2 |
3 | This is a plugin for [Kirby](http://getkirby.com/) that let´s you save the page for later reading. It currently supports [Instapaper](http://www.instapaper.com/) and [Pocket](http://getpocket.com/).
4 |
5 | ## Installation
6 |
7 | Put the `readlater.php` file in your `site/plugins` folder.
8 |
9 | ## How to use it
10 |
11 | Simple! Put `title(),'instapaper') ?>` in your template and it will echo the a link that let´s you save the page to Instapaper. Do you want to use Pocket? Then you use `title(),'pocket') ?>` in your template.
12 |
13 | You can pass any other page variable to use for the title. I asume that you use `$page->title()` for the title but you are free to change it.
14 |
15 | ## Example usage
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | title(),'pocket') ?>
25 |
title()) ?>
26 | text()) ?>
27 |
28 |
29 |
30 |
31 |
32 |
33 | ## Link text
34 |
35 | The plugin let's you change the link text with ease. The default format for Instapaper is `Add to Instapaper`. For Pocket we use `Save to Pocket`.
36 |
37 | Simply pass the link text as third argument to use your own.
38 |
39 | title(), 'instapaper', 'Read later'); ?>
40 |
41 | ## Options
42 |
43 | You can add additional options to customize the html result:
44 |
45 | title(), 'instapaper', 'Read later', array(
48 | 'class' => 'mycustomclass',
49 | 'target' => '_blank',
50 | 'rel' => 'somerelattribute'
51 | ));
52 |
53 | ?>
54 |
55 | ## Author
56 |
57 | Author: Roy Lodder
58 | Contributor: Bastian Allgeier
--------------------------------------------------------------------------------
/plugins/related/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/related/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "related",
3 | "readable": "Related",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Link related pages via their URI",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/related/readme.mdown:
--------------------------------------------------------------------------------
1 | # Related Pages
2 |
3 | ## What is it?
4 |
5 | This plugin makes it possible to link related pages very easily by their URI in content files.
6 |
7 | ## Installation
8 |
9 | Put the related.php file in your site/plugins folder.
10 |
11 | ## How to use it?
12 |
13 | ### In your content files
14 |
15 | Title: My title
16 | ----
17 | Text: My text
18 | ----
19 | Related:
20 |
21 | - projects/project-1
22 | - blog/my-article
23 |
24 |
25 | ### In your templates
26 |
27 | related() as $related): ?>
28 | title()) ?>
29 |
30 |
31 |
32 | ## Result
33 |
34 | The result of the related() function will be a full set of `$pages`, which you can apply the same methods to as you would to a normal set of `$pages`. This makes it possible to do stuff like:
35 |
36 | $related = related($page->related());
37 |
38 | // show the url of the first related page
39 | echo $related->first()->url();
40 |
41 | // show the title of the last related page
42 | echo $related->last()->title();
43 |
44 | // limit the number of related items
45 | foreach($related->limit(5) as $related) {
46 | // do something
47 | }
48 |
49 | // etc.
50 |
51 | For each `$page` in the set of related `$pages` you have full access to all the custom fields and methods of the related `$page`
52 |
53 |
54 | ## Author
55 | Bastian Allgeier
56 |
--------------------------------------------------------------------------------
/plugins/related/related.php:
--------------------------------------------------------------------------------
1 | related() as $related): ?>
23 | * title()) ?>
24 | *
25 | *
26 | * Author: Bastian Allgeier
27 | *
28 | */
29 |
30 | function related($field) {
31 |
32 | global $site;
33 |
34 | // parse the field with yaml
35 | $raw = yaml($field);
36 | $related = array();
37 | $pages = $site->pages();
38 |
39 | foreach($raw as $r) {
40 | // make sure to only add found related pages
41 | if($rel = $pages->find($r)) $related[] = $rel;
42 | }
43 |
44 | return new relatedPages($related);
45 |
46 | }
47 |
48 | // this is only needed to build a proper find method
49 | // the pages find method will be broken with pages from
50 | // various subfolders
51 | class relatedPages extends pages {
52 |
53 | function find() {
54 |
55 | global $site;
56 |
57 | $args = func_get_args();
58 |
59 | // find multiple pages
60 | if(count($args) > 1) {
61 | $result = array();
62 | foreach($args as $arg) {
63 | $page = $this->find($arg);
64 | if($page) $result[] = $page;
65 | }
66 | return (empty($result)) ? false : new relatedPages($result);
67 | }
68 |
69 | return $site->pages()->find(a::first($args));
70 |
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/plugins/resrc/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial Release
--------------------------------------------------------------------------------
/plugins/resrc/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "resrc",
3 | "readable": "Resrc.it",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Provides a helper for prepending your image urls with http://resrc.it",
7 | "author": "Luke Watts",
8 | "url": "http://thisis.la/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/resrc/readme.mdown:
--------------------------------------------------------------------------------
1 | # Resrc.it
2 |
3 | ## What is it?
4 |
5 | Adds a helper for prepending your image urls with http://resrc.it, these can be configured
6 |
7 | ## Installation
8 |
9 | Put the resrc.php file in your site/plugins folder.
10 |
11 | ## How to use it?
12 |
13 | By default it will not prepend your URL's as resrc.it rely on sites being publically accessible, and if you're kicking of development you're probably working on `http://localhost:8888`
14 |
15 | Once you're up and running on a real server you just add the following lines to your
16 |
17 | ```
18 | c::set('resrc', true);
19 | c::set('resrc.plan', 'app'); /* app or trial */
20 | ```
21 |
22 | ## Further reading
23 |
24 | Checkout [ReSRC support](http://www.resrc.it/support) for more information about exactly how best to implement it within your template.
25 |
26 | ## Author
27 | Luke Watts
28 |
--------------------------------------------------------------------------------
/plugins/resrc/resrc.php:
--------------------------------------------------------------------------------
1 | resrc( array(
8 | 'url' => $url
9 | ) );
10 | }
11 |
12 | class kirbytextExtended extends kirbytext {
13 | function __construct($text = false, $markdown=true) {
14 | parent::__construct($text, $markdown);
15 |
16 | $this->addTags('resrc');
17 | }
18 |
19 | function resrc($params) {
20 | $url = @$params['url'];
21 |
22 | $version_of_resrc = c::get('resrc.plan') ? c::get('resrc.plan') : 'app';
23 |
24 | return c::get('resrc') ? 'http://' . $version_of_resrc . '.resrc.it/' . $url : $url;
25 | }
26 | }
--------------------------------------------------------------------------------
/plugins/search/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + added include option with "all", "visible" and "invisible" modes.
5 |
6 | ## v0.9
7 | + Initial release
--------------------------------------------------------------------------------
/plugins/search/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "search",
3 | "readable": "Search",
4 | "version": "0.9",
5 | "stable": true,
6 | "description": "Provide a search form for your site",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/search/readme.mdown:
--------------------------------------------------------------------------------
1 | # Search Plugin (Beta)
2 |
3 | ## What is it?
4 |
5 | The search plugin makes it possible to search the entire content of your site and to build a nice search form for your users.
6 |
7 | ## Installation
8 |
9 | Put the search.php file in your site/plugins folder.
10 |
11 | ## How to use it?
12 |
13 | $search = new search(array('searchfield' => 'search'));
14 | $results = $search->results();
15 |
16 | ## Available options
17 |
18 | ### searchfield
19 |
20 | The name of the html search field. This will also build the param in your URL:
21 | http://yourdomain.com/search/fieldname:searchword
22 |
23 | ### query
24 |
25 | Instead of passing a search field you can also pass a query string instead, which will be used to search for. The search won't be connected to a search form that way, but you can use it to manually search by that query.
26 |
27 | ### fields
28 |
29 | An array of field names to search in. By default all fields will be searched.
30 |
31 | ### mode ("and" or "or" | default is "or")
32 |
33 | Switch between "and" or "or" as search mode.
34 |
35 | ### score
36 |
37 | An array with field names as keys and score values, which will be mulitplied with the hits per field to get a more valid result
38 |
39 | ### words (default = false)
40 |
41 | Set this to true to search for full words only instead of strings within words.
42 |
43 | ### ignore
44 |
45 | An array of uris which should be ignored. This is perfect to not show "secret" pages in results or to skip the error page for example.
46 |
47 | ### include
48 |
49 | The include option makes it possible to take control of which pages are included in search results. You get the following options: "all", "visible", "invisible"
50 |
51 | ### in
52 |
53 | Specify a URI here to search within the children of that page instead of the entire site.
54 |
55 | ### minlength
56 |
57 | The minimum length of searchwords.
58 |
59 | ### stopwords
60 |
61 | An array of stopwords, which will not be considered during search.
62 |
63 | ### paginate
64 |
65 | Automatically paginate the final result. Add a number of rows to return for each result page.
66 |
67 | ## Author
68 | Bastian Allgeier
69 |
--------------------------------------------------------------------------------
/plugins/search/search.php:
--------------------------------------------------------------------------------
1 | fields = a::get($options, 'fields', array());
54 | $this->score = a::get($options, 'score', array());
55 | $this->words = a::get($options, 'words');
56 | $this->ignore = a::get($options, 'ignore', array());
57 | $this->include = a::get($options, 'include', 'all');
58 | $this->in = a::get($options, 'in');
59 | $this->minlength = a::get($options, 'minlength', false);
60 | $this->stopwords = a::get($options, 'stopwords', array());
61 | $this->query = a::get($options, 'query', false);
62 | $this->searchfield = a::get($options, 'searchfield', false);
63 | $this->paginate = a::get($options, 'paginate', false);
64 | $this->mode = str::lower(a::get($options, 'mode')) == 'and' ? 'and' : 'or';
65 |
66 | $result = array();
67 |
68 | // if you set a searchfield instead of a query
69 | // the query will automatically be fetched from
70 | // post or get requests
71 | if($this->searchfield) {
72 | $this->query = trim(urldecode(get($this->searchfield)));
73 | }
74 |
75 | // stop here if no searchword is found
76 | if(empty($this->query)) return false;
77 |
78 | $this->searchwords = preg_replace('/[^\pL]/u',',', preg_quote($this->query));
79 | $this->searchwords = str::split($this->searchwords, ',', $this->minlength);
80 |
81 | if(!empty($this->stopwords)) {
82 | $this->searchwords = array_diff($this->searchwords, $this->stopwords);
83 | }
84 |
85 | if(empty($this->searchwords)) return false;
86 |
87 | // do this to save the count function for all loops
88 | $countSearchwords = count($this->searchwords);
89 |
90 | // define the set of pages to search in
91 | $pages = ($this->in) ? $site->pages()->find($this->in)->children()->index() : $site->pages()->index();
92 |
93 | foreach($pages as $page) {
94 |
95 | if($this->include == 'visible' && !$page->isVisible()) continue;
96 | if($this->include == 'invisible' && $page->isVisible()) continue;
97 |
98 | if(in_array($page->uri(), $this->ignore)) continue;
99 |
100 | if(!empty($this->fields)) {
101 | $keys = array_intersect(array_keys($page->content->variables), $this->fields);
102 | } else if($page->content) {
103 | $keys = array_keys($page->content->variables);
104 | }
105 |
106 | $found = array();
107 | $matchedTotal = 0;
108 | $score = 0;
109 |
110 | foreach($keys as $field) {
111 | $value = $page->$field;
112 |
113 | $matchedPerField = 0;
114 | $matchedWords = 0;
115 | $fieldScore = a::get($this->score, $field, 1);
116 |
117 | foreach($this->searchwords as $s) {
118 |
119 | // only match words
120 | if($this->words) {
121 | $m = @preg_match_all('!\b' . $s . '\b!i', $value, $array);
122 | } else {
123 | $m = @preg_match_all('!' . $s . '!i', $value, $array);
124 | }
125 |
126 | // track matched search words
127 | if($m) $matchedWords++;
128 |
129 | // add the matches to the page
130 | $matchedPerField = $matchedPerField+$m;
131 |
132 | }
133 |
134 | if(
135 | $this->mode == 'and' && $countSearchwords == $matchedWords && $matchedPerField > 0 ||
136 | $this->mode == 'or' && $matchedPerField > 0
137 | ) {
138 | // add the number of hits;
139 | $matchedTotal = $matchedTotal+$matchedPerField;
140 |
141 | // apply the score for this field
142 | $score = $score+($matchedPerField*$fieldScore);
143 | }
144 |
145 | }
146 |
147 | // add all matched pages to the result set
148 | if($matchedTotal) {
149 | $result[$page->uid] = $page;
150 | $result[$page->uid]->searchHits = $matchedTotal;
151 | $result[$page->uid]->searchScore = $score;
152 | }
153 |
154 | }
155 |
156 | if(empty($result)) return false;
157 |
158 | $pages = new pages($result);
159 | $pages = $pages->sortBy('searchScore','desc');
160 |
161 | // add pagination
162 | if($this->paginate) $pages = $pages->paginate($this->paginate, array('mode' => 'query'));
163 |
164 | $this->results = $pages;
165 |
166 | }
167 |
168 | function results() {
169 | return $this->results;
170 | }
171 |
172 | function query() {
173 | return $this->query;
174 | }
175 |
176 | }
--------------------------------------------------------------------------------
/plugins/sublimevideo/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.1
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/sublimevideo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sublimevideo",
3 | "readable": "SublimeVideo",
4 | "version": "1.1",
5 | "stable": true,
6 | "description": "Use the SublimeVideo HTML5 player to display videos",
7 | "author": "Thibaut Ninove",
8 | "url": "http://wooconcept.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/sublimevideo/readme.mdown:
--------------------------------------------------------------------------------
1 | # SublimeVideo
2 |
3 | ## What is it?
4 |
5 | This plugin is a Kirbytext extension, in order to easily use the [SublimeVideo HTML5 Player](http://sublimevideo.net/). It provides you with a new tag:
6 |
7 | (sublime: video-name width: xxx height: yyy)
8 |
9 | ## Installation
10 |
11 | 1. Copy the `sublimevideo.php` file into your `site/plugins` folder. If the plugins folder doesn't exist yet, please create it. As a plugin, the file will be automatically loaded by Kirby.
12 |
13 | 2. Put your SublimeVideo embed code inside the `` tag of your site. It should look like this :
14 |
15 | ```html
16 |
17 | ```
18 |
19 | Please note that you need to have a [SublimeVideo account](http://sublimevideo.net/plans) (free). This service is very easy to use but if you need help, please refer to [their documentation](http://docs.sublimevideo.net/quickstart-guide). I am also not going to discuss [video encoding](http://docs.sublimevideo.net/encode-videos-for-the-web) here.
20 |
21 | ## How to use it?
22 |
23 | This tag will load all video files and an image poster file from the current page folder, which match the video-name value. Here's a list of example files:
24 |
25 | - myvideo.hd.mp4
26 | - myvideo.hd.ogv
27 | - myvideo.hd.webm
28 | - myvideo.mobile.mp4
29 | - myvideo.mobile.ogv
30 | - myvideo.mobile.webm
31 | - myvideo.poster.png
32 | - myvideo.standard.mp4
33 | - myvideo.standard.ogv
34 |
35 | Use the tag…
36 |
37 | (sublime: myvideo width: 400 height: 300)
38 |
39 | …in your text to automatically load the SublimeVideo with all matching files.
40 |
41 | Adding `.hd` and `.standard` to files with the same extension will mark files as HD and low-res video files and will enable [SublimeVideo HD switching](http://docs.sublimevideo.net/hd-switching) You can also add the `.mobile` prefix to specify a file, which will be used on mobile devices.
42 |
43 | If you add an additional image file with the same naming convention (i.e. `myvideo.poster.png`) this file will be used as a preview as long as the video has not been loaded yet and if video playback is not available.
44 |
45 | ### Attributes
46 |
47 | - `sublime`: the files common name
48 | - `width`: the width of the video
49 | - `height`: the height of the video
50 | - `uid`: a unique id (optional), which will appear in the [SublimeVideo stats](http://docs.sublimevideo.net/optimize-for-stats)
51 | - `name`: the name of the video (optional), which will appear in the [SublimeVideo stats](http://docs.sublimevideo.net/optimize-for-stats)
52 | - `class`: an additional class name, which will be added to the video tag. SublimeVideo tags already have a sublime class by default, but you can use this optionally to add another class.
53 |
54 | ### Full Example
55 |
56 | (sublime: myvideo width: 540 height: 304 name: My awesome video uid: myvideo class: myvideo)
57 |
58 | ## Shortcut
59 |
60 | If you need to embed SublimeVideos directly in your template or snippet files you can use the available shortcut function:
61 |
62 | ```php
63 |
64 |
65 |
66 | ```
67 |
68 | ## Support
69 |
70 | Provided as is, no support provided
71 |
72 | ## Author
73 |
74 | Author: Thibaut Ninove ([WooConcept](http://wooconcept.com))
75 | Contributor: Bastian Allgeier
--------------------------------------------------------------------------------
/plugins/sublimevideo/sublimevideo.php:
--------------------------------------------------------------------------------
1 | , with the help of Bastian Allgeier
6 | // Support: provided as is, no support provided
7 |
8 |
9 | // shortcut function to add sublime videos to templates and snippets as well.
10 | function sublime($id, $width=false, $height=false, $uid=false, $name=false, $class=false) {
11 | $kirbytext = kirbytext::classname();
12 | $obj = new $kirbytext();
13 | return $obj->sublime(array(
14 | 'sublime' => $id,
15 | 'width' => $width,
16 | 'height' => $height,
17 | 'uid' => ($uid) ? $uid : $id,
18 | 'name' => ($name) ? $name : $id,
19 | 'class' => $class
20 | ));
21 | }
22 |
23 |
24 | // kirbytext extension
25 | class kirbytextExtended extends kirbytext {
26 |
27 | function __construct($text=false, $markdown=true) {
28 |
29 | parent::__construct($text, $markdown);
30 |
31 | $this->addTags('sublime');
32 | $this->addAttributes('uid', 'name');
33 |
34 | }
35 |
36 | function sublime($params) {
37 |
38 | global $site;
39 |
40 | $page = ($this->obj) ? $this->obj : $site->pages()->active();
41 | $id = @$params['sublime'];
42 | $class = @$params['class'];
43 | $videos = array();
44 | $poster = false;
45 |
46 | // gather all video files which match the given id/name
47 | foreach($page->videos() as $v) {
48 |
49 | if(preg_match('!^' . preg_quote($id) . '!i', $v->name())) {
50 |
51 | $extension = f::extension($v->name());
52 | $mobile = ($extension == 'mobile') ? $v->mobile = true : $v->mobile = false;
53 | $hd = ($extension == 'hd') ? $v->hd = true : $v->hd = false;
54 |
55 | $videos[] = $v;
56 |
57 | }
58 |
59 | }
60 |
61 | if(empty($videos)) return false;
62 |
63 | // find the poster for this video
64 | foreach($page->images() as $i) {
65 | if(preg_match('!^' . preg_quote($id) . '!i', $i->name())) {
66 | $poster = $i;
67 | break;
68 | }
69 | }
70 |
71 | $defaults = array(
72 | 'width' => 400,
73 | 'height' => 300,
74 | 'uid' => $id,
75 | 'name' => $id,
76 | );
77 |
78 | $options = array_merge($defaults, $params);
79 | $width = html($options['width']);
80 | $height = html($options['height']);
81 | $uid = html($options['uid']);
82 | $name = html($options['name']);
83 |
84 | if(!$width) $width = c::get('kirbytext.video.width');
85 | if(!$height) $height = c::get('kirbytext.video.height');
86 |
87 | // create an additional css class if specified
88 | if(!empty($class)) $class = ' ' . html($class);
89 |
90 | // check for a poster
91 | $poster = ($poster) ? ' poster="' . $poster->url() . '"' : false;
92 |
93 | $html = '';
101 |
102 | return $html;
103 |
104 | }
105 |
106 | }
--------------------------------------------------------------------------------
/plugins/tagcloud/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v0.9
4 | + Initial release
--------------------------------------------------------------------------------
/plugins/tagcloud/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tagcloud",
3 | "readable": "Tagcloud",
4 | "version": "0.9",
5 | "stable": true,
6 | "description": "Display a tag cloud",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/plugins/tagcloud/readme.mdown:
--------------------------------------------------------------------------------
1 | # Tagcloud Plugin (Beta)
2 |
3 | ## What is it?
4 |
5 | The tagcloud plugin will fetch all tags (comma separated) from subpages and return them with additional information - like the number of subpages for a each tag.
6 |
7 | ## Installation
8 |
9 | Put the tagcloud.php file in your site/plugins folder.
10 |
11 | ## How to use it?
12 |
13 | ### Content files
14 |
15 | To add tags to your content files, put them in a comma separated list:
16 |
17 | Title: Some Title
18 | ----
19 | Text: Some Text
20 | ----
21 | Tags: design, fun, photography
22 | ----
23 |
24 | In your template add i.e.:
25 |
26 | find('blog'), array('limit' => 20)) ?>
27 |
28 |
34 |
35 |
36 | ## Available Options
37 |
38 | Set options like this:
39 |
40 | 5,
44 | 'refresh' => 60*60*5
45 | ));
46 |
47 | ?>
48 |
49 | ### limit (default: 10)
50 |
51 | Sets the number of returned tweets.
52 |
53 | ### cache (default: true)
54 |
55 | Disable or enable the cache. Caching the results is highly recommended. Otherwise the plugin will be super slow. You must make sure that `site/cache` is writable (change permissions to 0755) You must also set c::set('cache', true); in site/config/config.php to enable the cache.
56 |
57 | ### hiderep (default: false)
58 |
59 | Show or hide replies you've tweeted, e.g. for users with a large number of replies that aren't interesting for the general public.
60 |
61 | ### refresh (default: 20 minutes)
62 |
63 | Set the cache expiry in seconds. By default it will be set to 20 minutes. After 20 minutes the plugin will fetch fresh data from the Twitter API.
64 |
65 |
66 | ## Attributes for the tweet-object
67 |
68 | * `$tweet->url()` The URL to the Tweet page on Twitter
69 | * `$tweet->text()` The text of the Tweet
70 | * `$tweet->date()` The timestamp when the Tweet has been posted
71 | * `$tweet->source()` The source, from which the Tweet has been posted
72 | * `$tweet->user()` The user object (see object attributes)
73 |
74 | ## Attributes for the user-object
75 |
76 | * `$tweet->user()->name()` The full name of the user
77 | * `$tweet->user()->username()` The Twitter username
78 | * `$tweet->user()->bio()` The Twitter bio
79 | * `$tweet->user()->url()` The URL to the user's Twitter page
80 | * `$tweet->user()->image()` The user avatar pic
81 | * `$tweet->user()->following()` The number of accounts the user is following
82 | * `$tweet->user()->followers()` The number of followers
83 |
84 |
85 | ## Author
86 | Bastian Allgeier
87 |
88 |
--------------------------------------------------------------------------------
/plugins/tweets/tweets.php:
--------------------------------------------------------------------------------
1 | 10,
7 | 'cache' => true,
8 | 'hiderep' => false, //Parameter to hide replies in your feed - for accounts with high reply volumes
9 | 'refresh' => 60*20 // refresh every 20 minutes
10 | );
11 |
12 | // add the username to the defaults array
13 | $defaults['username'] = $username;
14 |
15 | $options = array_merge($defaults, $params);
16 |
17 | // check the cache dir
18 | $cacheDir = c::get('root.cache') . '/tweets';
19 | dir::make($cacheDir);
20 |
21 | // disable the cache if adding the cache dir failed
22 | if(!is_dir($cacheDir) || !is_writable($cacheDir)) $options['cache'] = false;
23 |
24 | // sanitize the limit
25 | if($options['limit'] > 200) $options['limit'] = 200;
26 |
27 | // generate a unique cache ID
28 | $cacheID = 'tweets/tweets.' . md5($options['username']) . '.' . $options['limit'] . '.php';
29 |
30 | if($options['cache']) {
31 | $cache = (cache::modified($cacheID) < time()-$options['refresh']) ? false : cache::get($cacheID);
32 | } else {
33 | $cache = false;
34 | }
35 |
36 | if(!empty($cache)) return $cache;
37 |
38 | // Encode the key and secret from the Twitter config.
39 | $twitterKey = urlencode(c::get('twitter.key'));
40 | $twitterSecret = urlencode(c::get('twitter.secret'));
41 |
42 | // combine and base64 encode the key and secret with a colon seperator
43 | $twitterCode = base64_encode( $twitterKey . ':' . $twitterSecret );
44 |
45 | // obtain a bearer token from the api, by building a request
46 |
47 | //url to use
48 | $url = 'https://api.twitter.com/oauth2/token';
49 |
50 | //create header
51 | $header = array(
52 | 'http' => array(
53 | 'method' => "POST",
54 | 'header' => "Content-type: application/x-www-form-urlencoded;charset=UTF-8\r\n"
55 | ."Authorization: Basic " . $twitterCode ."\r\n",
56 | 'content' => "grant_type=client_credentials",
57 | ),
58 | );
59 |
60 | //send the request
61 | $context = stream_context_create($header);
62 | $bearer = file_get_contents($url, false, $context);
63 |
64 | // decode the json response
65 | $bearer = json_decode($bearer);
66 |
67 | // send the rquest for tweets
68 |
69 | $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=' . $options['username'] . '&count=' . $options['limit']. '&include_rts=true' . '&exclude_replies=' . $options['hiderep'];
70 |
71 | $header = array(
72 | 'http' => array(
73 | 'method' => "GET",
74 | 'header' => "Authorization: Bearer " . $bearer->access_token ."\r\n",
75 | ),
76 | );
77 |
78 | $context = stream_context_create($header);
79 |
80 | $json = file_get_contents($url, false, $context);
81 |
82 | $data = json_decode($json);
83 |
84 | if(!$data) return false;
85 |
86 | $result = array();
87 |
88 | foreach($data as $tweet) {
89 |
90 | $user = $tweet->user;
91 |
92 | $result[] = new tweet(array(
93 | 'url' => 'http://twitter.com/' . $options['username'] . '/status/' . $tweet->id_str,
94 | 'text' => $tweet->text,
95 | 'date' => strtotime($tweet->created_at),
96 | 'source' => $tweet->source,
97 | 'user' => new obj(array(
98 | 'name' => $user->name,
99 | 'bio' => $user->description,
100 | 'username' => $user->screen_name,
101 | 'url' => 'http://twitter.com/' . $user->screen_name,
102 | 'image' => 'http://twitter.com/api/users/profile_image/' . $user->screen_name,
103 | 'following' => $user->friends_count,
104 | 'followers' => $user->followers_count,
105 | ))
106 | ));
107 |
108 | }
109 |
110 | $result = new obj($result);
111 |
112 | if($options['cache']) cache::set($cacheID, $result);
113 |
114 | return $result;
115 |
116 | }
117 |
118 | class tweet extends obj {
119 |
120 | function date($format=false) {
121 | return ($format) ? date($format, $this->date) : $this->date;
122 | }
123 |
124 | function text($link=false) {
125 | return ($link) ? self::link(html($this->text)) : $this->text;
126 | }
127 |
128 | static function link($text) {
129 | $text = preg_replace('/(http|https):\/\/([a-z0-9_\.\-\+\&\!\#\~\/\,]+)/i', '$1://$2', $text);
130 | $text = preg_replace('/@([A-Za-z0-9_]+)/is', '@$1', $text);
131 | $text = preg_replace('/#([A-Aa-z0-9_-]+)/is', '#$1', $text);
132 | return $text;
133 | }
134 |
135 | }
136 |
--------------------------------------------------------------------------------
/readme.mdown:
--------------------------------------------------------------------------------
1 | # Kirby 1 extensions
2 |
3 | **Deprecated. Please see http://github.com/getkirby**
4 |
5 |
--------------------------------------------------------------------------------
/snippets/breadcrumb/breadcrumb.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/snippets/breadcrumb/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/breadcrumb/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "breadcrumb",
3 | "readable": "Breadcrumb",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Display a breadcrumb navigation on your site",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/breadcrumb/readme.mdown:
--------------------------------------------------------------------------------
1 | # Breadcrumb Snippet
2 |
3 | ## What is it?
4 |
5 | A snippet which generates a breadcrumb for your site:
6 | For example: Home > Projects > Project 1
7 |
8 | ## Installation
9 |
10 | Put the breadcrumb.php file in your site/snippets folder
11 |
12 | ## How to use it?
13 |
14 |
15 |
16 | ## Customization
17 |
18 | Customize the html in site/snippets/breadcrumb.php to fit your site
19 |
20 | ## Author
21 | Bastian Allgeier
22 |
--------------------------------------------------------------------------------
/snippets/contactform/contactform.mail.php:
--------------------------------------------------------------------------------
1 | Hey,
2 |
3 | your contact form has been submitted
4 |
5 | Name: {name}
6 | ---------
7 | Email: {email}
8 | ---------
9 | Text:
10 |
11 | {text}
12 |
--------------------------------------------------------------------------------
/snippets/contactform/contactform.php:
--------------------------------------------------------------------------------
1 | 'John ',
5 | 'from' => 'Contact Form ',
6 | 'subject' => 'New contact form request',
7 | 'goto' => $page->url() . '/status:thank-you'
8 | ));
9 |
10 | ?>
11 |
12 |
13 |
14 |
15 |
Thank you very much for your request
16 |
We will get in contact as soon as possible
17 |
18 |
19 |
20 |
Get in contact
21 |
22 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/snippets/contactform/readme.mdown:
--------------------------------------------------------------------------------
1 | # Contactform Plugin & Snippets (Alpha)
2 |
3 | This plugin helps you render and submit a simple contact form with name, email and text
4 |
5 | ## Installation
6 | Put the `plugins/contactform` folder in this repo in your `site/plugins` folder. If this folder doesn't exist yet, create it.
7 |
8 | ### Installing snippets
9 | Copy the snippets in this folder and add them to `site/snippets`
10 |
11 | ### Add the contact form
12 |
13 | To add the contact form to your site, add the contactform snippet to your templates:
14 |
15 | ```
16 |
17 |
18 |
19 | ```
20 |
21 | ### Contact form settings
22 |
23 | Open `site/snippets/contactform.php` to set your email address and other options for the contact form:
24 |
25 | ```
26 |
27 | $form = new contactform(array(
28 | 'to' => 'John ',
29 | 'from' => 'Contact Form ',
30 | 'subject' => 'New contact form request',
31 | 'goto' => $page->url() . '/status:thank-you'
32 | ));
33 |
34 | ```
35 |
36 | You can also customize the HTML for the contact form however you need.
37 |
38 | ### Changing the email template
39 |
40 | Open `site/snippets/contactform.mail.php` to customize the email template. The contact form plugin will only send plain text emails. You can use the following placeholders in your template:
41 |
42 | ```
43 |
44 | {name}
45 | {email}
46 | {text}
47 |
48 | ```
49 |
50 | ## Requirements
51 |
52 | Since the plugin works with PHP closures, you need to run your site on PHP 5.3 + Older versions are not supported
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/snippets/disqus/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/disqus/disqus.php:
--------------------------------------------------------------------------------
1 | title();
6 | if(!isset($disqus_developer)) $disqus_developer = false;
7 | if(!isset($disqus_identifier)) $disqus_identifier = $page->uri();
8 | if(!isset($disqus_url)) $disqus_url = thisURL();
9 |
10 | $disqus_title = addcslashes($disqus_title, "'");
11 | $disqus_developer = ($disqus_developer) ? 'true' : 'false';
12 |
13 | ?>
14 |
15 |
28 |
29 | blog comments powered by Disqus
30 |
--------------------------------------------------------------------------------
/snippets/disqus/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "disqus",
3 | "readable": "Disqus",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Embed your Disqus comments",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/disqus/readme.mdown:
--------------------------------------------------------------------------------
1 | # Disqus Snippet 1.0
2 |
3 | ## What is it?
4 |
5 | A snippet which makes embedding Disqus comments very easy
6 |
7 | ## Installation
8 |
9 | Put the disqus.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 | 'yourshortname')) ?>
14 |
15 | ## Options
16 |
17 | ### disqus_title
18 |
19 | The title for your comment thread. This is the page title by default
20 |
21 | ### disqus_developer
22 |
23 | Set this to true to enable developer mode
24 |
25 | ### disqus_identifier
26 |
27 | By default this is the slug for the current page, which is unique. You can set any custom identifier if you want here though.
28 |
29 | ### disqus_url
30 |
31 | By default this is the current page url.
32 |
33 | ## Author
34 | Bastian Allgeier
35 |
--------------------------------------------------------------------------------
/snippets/feed/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.1
4 | + Added the descriptionExcerpt option.
5 | * Fixed some bugs
6 |
7 | ## v1.0
8 | + Initial release
--------------------------------------------------------------------------------
/snippets/feed/feed.php:
--------------------------------------------------------------------------------
1 | ';
11 |
12 | ?>
13 |
14 |
15 |
16 |
17 |
18 | title()) ?>
19 |
20 |
21 | modified()) ?>
22 |
23 |
24 | description() || isset($description)): ?>
25 | description()) ?>
26 |
27 |
28 |
29 |
30 | title()) ?>
31 | url()) ?>
32 | url()) ?>
33 | date()) ? date('r', $item->date()) : date('r', $item->modified()) ?>
34 |
35 |
36 |
37 | {$descriptionField}) ?>]]>
38 |
39 | {$descriptionField}, (isset($descriptionLength)) ? $descriptionLength : 140) ?>]]>
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/snippets/feed/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "feed",
3 | "readable": "Feed",
4 | "version": "1.1",
5 | "stable": true,
6 | "description": "Setup a RSS feed for your site",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/feed/readme.mdown:
--------------------------------------------------------------------------------
1 | # Feed Snippet
2 |
3 | ## What is it?
4 |
5 | A very simple snippet to help you setup RSS-Feeds for your site.
6 |
7 | ## Installation
8 |
9 | Put the feed.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 | find('blog')->children()->visible()->flip()->limit(10);
19 |
20 | // this is how you embed the feed snippet with some options
21 | snippet('feed', array(
22 | 'link' => url('blog'),
23 | 'items' => $items,
24 | 'descriptionField' => 'text',
25 | 'descriptionLength' => 300
26 | ));
27 |
28 | ?>
29 |
30 | ## Available Options
31 |
32 | ### title
33 |
34 | You can specify a title for your feed here. Otherwise the title, which you've added to your content txt (in our case feed.txt) will be used
35 |
36 | ### description
37 |
38 | You can specify a description for your feed here. Otherwise the description, which you've added to your content txt (in our case feed.txt) will be used
39 |
40 | ### link
41 |
42 | Main link in your feed to your site. In this example we want to link to our blog page.
43 |
44 | ### modified
45 |
46 | If you want to specify a modified date, simply pass a timestamp here. Otherwise this will be auto generated by the last modified date of your entire site.
47 |
48 | ### items
49 |
50 | Any set of pages
51 |
52 | ### descriptionExcerpt
53 |
54 | Create an excerpt – which you can control with descriptionLength – or not. This is true by default.
55 |
56 | ### descriptionField
57 |
58 | If you want to show a description for each item in your feed, make sure to specify a field, which is available in any item and should be used for the description. For example every page of our blog has a text field, so we use that for the item description.
59 |
60 | ### descriptionLength
61 |
62 | This is maximum number of characters the description will have. An excerpt is automatically generated.
63 |
64 | ## Author
65 | Bastian Allgeier
66 |
67 |
--------------------------------------------------------------------------------
/snippets/filelist/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/filelist/filelist.php:
--------------------------------------------------------------------------------
1 | files();
10 |
11 | // filter the list of files by extension
12 | if(isset($extension)) $files = $files->findByExtension($extension);
13 |
14 | // sort the list
15 | $files = $files->sortBy($sort, $direction);
16 |
17 | // when excluding files, the UL will still be returned if there are no files to show
18 | foreach($files->_ as $file):
19 | if(in_array($file->extension(),$exclude)) unset($files->_[$file->filename]);
20 | endforeach;
21 |
22 | if(count($files->_)>0):
23 | ?>
24 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/snippets/filelist/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "filelist",
3 | "readable": "Filelist",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Build a list of all available files for a page",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/filelist/readme.mdown:
--------------------------------------------------------------------------------
1 | # Filelist Snippet
2 |
3 | ## What is it?
4 |
5 | Filelist will generate a list of all or any matching files in your page's content folder. This is pretty handy for building download lists for example.
6 |
7 | ## Installation
8 |
9 | Put the filelist.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 |
14 |
15 | ## Options
16 |
17 | 'zip',
21 | 'sort' => 'filename',
22 | 'direction' => 'desc' // can be asc or desc
23 | ));
24 |
25 | ?>
26 |
27 | By passing additional variables you can customize the output of your list:
28 |
29 | ### extension
30 |
31 | Set the extension to only get a list of files with that extension. All files will be found by default if you don't specify an extension
32 |
33 | ### sort
34 |
35 | Change the sort field. Default is "filename"
36 |
37 | ### direction
38 |
39 | Change the sort direction. Default is "desc"
40 |
41 |
42 | ## Customization
43 |
44 | Customize the html in site/snippets/gallery.php to get the best result for your project
45 |
46 | ## Author
47 | Bastian Allgeier
48 |
--------------------------------------------------------------------------------
/snippets/flattr/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/flattr/flattr.php:
--------------------------------------------------------------------------------
1 | url();
9 | if(!isset($title)) $title = $page->title();
10 | if(!isset($description)) $description = null;
11 | if(!isset($category)) $category = null;
12 | if(!isset($language)) $language = null;
13 | if(!isset($tags)) $tags = null;
14 | if(!isset($button)) $button = null;
15 | if(!isset($popout)) $popout = null;
16 | if(!isset($hidden)) $hidden = null;
17 | if(!isset($html5)) $html5 = false;
18 |
19 | if(!$instances) :
20 |
21 | // javascript output (once)
22 | ?>
23 |
37 | endif;
38 |
39 | // html5 output
40 | if($html5 != false) :
41 | $atts = ' data-flattr-uid="' . $user_id . '"';
42 | if(!is_null($description)) $atts .= ' data-flattr-description="' . $description . '"';
43 | if(!is_null($category)) $atts .= ' data-flattr-category="' . $category . '"';
44 | if(!is_null($language)) $atts .= ' data-flattr-language="' . $language . '"';
45 | if(!is_null($tags)) $atts .= ' data-flattr-tags="' . $tags . '"';
46 | if(!is_null($button)) $atts .= ' data-flattr-button="compact"';
47 | if(!is_null($popout)) $atts .= ' data-flattr-popout="0"';
48 | if(!is_null($hidden)) $atts .= ' data-flattr-hidden="1"';
49 | ?>
50 | href=" echo $url ?>">Flattr this!
51 |
64 | Flattr this!
65 | endif;
66 |
67 | // noscript output
68 | $nosurl = 'https://flattr.com/submit/auto?user_id=' . $user_id . '&url=' . urlencode($url);
69 | if(!is_null($title)) $nosurl .= '&title=' . urlencode($title);
70 | if(!is_null($description)) $nosurl .= '&description=' . urlencode($description);
71 | if(!is_null($category)) $nosurl .= '&category=' . urlencode($category);
72 | if(!is_null($language)) $nosurl .= '&language=' . urlencode($language);
73 | if(!is_null($tags)) $nosurl .= '&tags=' . urlencode(implode(',', $tags));
74 | if(!is_null($hidden)) $nosurl .= '&hidden=1';
75 | ?>
76 |
--------------------------------------------------------------------------------
/snippets/flattr/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flattr",
3 | "readable": "Flattr",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Embed a Flattr button on your site",
7 | "author": "André Dujardin",
8 | "url": "http://djdn.de/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/flattr/readme.mdown:
--------------------------------------------------------------------------------
1 | # Flattr Snippet
2 |
3 | ## What is it?
4 |
5 | This snippet will embed a Flattr button in your site. You can set several options to customize it. The options are nearly equal to the original Flattr parameters. It even has a fallback if javascript is disabled and an optional HTML5 output.
6 |
7 | ## Installation
8 |
9 | Put the flattr.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 | ```php
14 | 'your_user_id')) ?>
15 | ```
16 |
17 | …or with more options…
18 |
19 | ```php
20 | 'your_user_id',
24 | 'url' => 'http://custom.url/path/to/page',
25 | 'title' => 'Your Page Headline',
26 | 'description' => 'Your Description',
27 | 'category' => 'One of the Flattr Categories',
28 | 'language' => 'en_GB',
29 | 'tags' => 'different, tags',
30 | 'button' => 'compact',
31 | 'popout' => '0',
32 | 'html5' => '1'
33 | ));
34 |
35 | ?>
36 | ```
37 |
38 | ## Options
39 |
40 | ### user_id (required)
41 |
42 | A Flattr username. This is a required parameter for autosubmit but not for things that are already on flattr.com.
43 |
44 | ### url (optional)
45 |
46 | Each thing on Flattr requires a unique URL. All parts of the URL, including the both the parameters and fragments, are used to distinguish the difference between submitted URLs. If this parameter is unset, the snippet grabs the *$page->url()* string.
47 |
48 | ### title (optional)
49 |
50 | Will be used to describe your thing on Fattr. The *title* should be between 5-100 characters. All HTML is stripped. If this parameter is unset, the snippet grabs the *$page->title()* string.
51 |
52 | ### description (optional)
53 |
54 | Will be used to describe your thing. The *description* should be between 5-1000 characters. All HTML is stripped except the * * character which will be converted into newlines *(\n)*.
55 |
56 | ### category (optional)
57 |
58 | This parameter is used to sort things on Flattr and has no impact on the functionality of your button. It's value must be one of the [available categories](https://api.flattr.com/rest/v2/categories.txt).
59 |
60 | ### language (optional)
61 |
62 | Specifies which language your thing is in. Specifying the language will allow visitors on Flattr to filter through the large amount of things and get a personalized feed of items in their selected languages. The value must be a language code from the [available languages](https://api.flattr.com/rest/v2/languages.txt). Note that even tho this parameter is optional, a language will be guessed and added automatically if it is omitted.
63 |
64 | ### tags (optional)
65 |
66 | This parameter allows you to add tags that can be used to describe your thing. This is used on Flattr to allow further filtering and sorting of things. Multiple tags are seperated by a comma *,*. Using non alpha characters in tags are not supported nor is using a comma for obvious reasons.
67 |
68 | ### button (optional)
69 |
70 | We also provide a compact version of our Flattr button. This parameter tells the embedded button script which button layout to use. Set this parameter to *compact* if you want the *compact* button. Don't set the parameter at all if you are fine with the normal button.
71 |
72 | ### popout (optional)
73 |
74 | Set this parameter to *0* to disable the popout that appears when hovering the mouse cursor over the button.
75 |
76 | ### hidden (optional)
77 |
78 | Not all content is suitable for public listing. If you for one reason or another don't want your content to be listed on Flattr set this parameter to *1*.
79 |
80 | ### html5 (optional)
81 |
82 | You can get the output in valid html5 if you set this parameter to *1*.
83 |
84 | Further information can be found on the Flattr developer page:
85 |
86 | # Author
87 | André Dujardin
--------------------------------------------------------------------------------
/snippets/gallery/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/gallery/gallery.php:
--------------------------------------------------------------------------------
1 | hasImages()): ?>
2 |
3 | images() as $image): ?>
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/snippets/gallery/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gallery",
3 | "readable": "Gallery",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Generate a list of images",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/gallery/readme.mdown:
--------------------------------------------------------------------------------
1 | # Gallery Snippet
2 |
3 | ## What is it?
4 |
5 | This is a very basic gallery snippet, which will generate a list of images, which are available in your page's content folder. Don't expect too much. It's just a good starting point for your own gallery script.
6 |
7 | ## Installation
8 |
9 | Put the gallery.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 |
14 |
15 | ## Customization
16 |
17 | Customize the html in site/snippets/gallery.php to get the best result for your project
18 |
19 | ## Author
20 | Bastian Allgeier
21 |
--------------------------------------------------------------------------------
/snippets/map/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/map/map.php:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
71 |
72 |
83 |
--------------------------------------------------------------------------------
/snippets/map/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "map",
3 | "readable": "Google Maps",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Display a Google Maps map",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/map/readme.mdown:
--------------------------------------------------------------------------------
1 | # Google Maps Snippet
2 |
3 | ## What is it?
4 |
5 | This snippet will embed a Google Map in your site. You can set your own address, zoom level and some other options to customize it. It even has a fallback to the Google Maps Image API if javascript is disabled.
6 |
7 | ## Installation
8 |
9 | Put the map.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 | 'Mannheim, Germany')) ?>
14 |
15 | …or with more options…
16 |
17 | 'Mannheim, Germany',
21 | 'zoom' => 17,
22 | 'width' => 300,
23 | 'height' => 200
24 | ));
25 |
26 | ?>
27 |
28 | ## Options
29 |
30 | ### Address (required)
31 |
32 | Set the address for your map like you would on Google Maps. For Example "Mannheim, Germany" or "Timesquare, New York"
33 |
34 | ### Width (default is 300)
35 |
36 | Set the width of your map in pixels without "px"
37 |
38 | ### Height (default is 300)
39 |
40 | Set the height of your map in pixels without "px"
41 |
42 | ### Zoom (default is 15)
43 |
44 | Set the zoom level for your map. Anything between 1 and 20 makes sense.
45 |
46 | ### Type (default is roadmap)
47 |
48 | The map type. Can be roadmap, satellite, hybrid, terrain
49 |
50 | ### ID
51 |
52 | The id of your map. By default this is set to a random string to make multiple maps possible on a single page.
53 |
54 | ### Class (default is map)
55 |
56 | Set the class name for your map container.
57 |
58 |
59 | ## Author
60 | Bastian Allgeier
61 |
--------------------------------------------------------------------------------
/snippets/menu/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/menu/menu.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/snippets/menu/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "menu",
3 | "readable": "Menu",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Generate a main menu of your site based on visible pages.",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/menu/readme.mdown:
--------------------------------------------------------------------------------
1 | # Menu Snippet
2 |
3 | ## What is it?
4 |
5 | This snippet generates a main menu for your site.
6 |
7 | ## Installation
8 |
9 | Put the menu.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 |
14 |
15 | ## Customization
16 |
17 | Customize the html in site/snippets/menu.php to get the best result for your project
18 |
19 | ## Author
20 | Bastian Allgeier
21 |
--------------------------------------------------------------------------------
/snippets/pagination/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/pagination/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pagination",
3 | "readable": "Pagination",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Adds full-flavoured pagination to your site",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/pagination/pagination.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/snippets/pagination/readme.mdown:
--------------------------------------------------------------------------------
1 | # Pagination Snippet
2 |
3 | ## What is it?
4 |
5 | Adds full-flavoured pagination to your site
6 |
7 | ## Installation
8 |
9 | Put the pagination.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 | find('blog')->children()->paginate(10) ?>
14 |
15 | $articles->pagination())) ?>
16 |
17 | … or with additional ranged pagination …
18 |
19 | $articles->pagination(), 'range' => 5)) ?>
20 |
21 | ## Customization
22 |
23 | Change the html in site/snippets/pagination.php
24 |
25 | ## Author
26 | Bastian Allgeier
27 |
--------------------------------------------------------------------------------
/snippets/podcastfeed/podcastfeed.php:
--------------------------------------------------------------------------------
1 | $podcast->title(),
7 | 'link' => url(),
8 | 'language' => 'en-en',
9 | 'modified' => $podcast->modified(),
10 | 'copyright' => $podcast->copyright(),
11 | 'description' => $podcast->description(),
12 | 'subtitle' => $podcast->subtitle(),
13 | 'author' => $podcast->author(),
14 | 'summary' => $podcast->summary(),
15 | 'category' => $podcast->category(),
16 | 'ownername' => $podcast->ownername(),
17 | 'owneremail' => $podcast->owneremail(),
18 | 'items' => array(),
19 | 'image' => ($podcast->images()->first()) ? $podcast->images()->first()->url() : false,
20 | );
21 |
22 | $vars = array_merge($defaults, $vars);
23 | extract($vars);
24 |
25 | // send the right header
26 | header('Content-type: text/xml; charset="utf-8"');
27 |
28 | // echo the doctype
29 | echo '';
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 | 300
61 | 300
62 |
63 |
64 |
65 |
66 |
67 | title()) ?>
68 | url()) ?>
69 | date())) ?>
70 |
71 | text()) ?>]]>
72 |
73 |
74 |
75 |
76 |
77 | images()->first()): ?>
78 |
79 |
80 |
81 | files()->filterBy('extension', 'mp3')->first()): ?>
82 |
83 | url()) ?>
84 |
85 |
86 | duration()) ?>
87 | keywords()) ?>
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/snippets/prevnext/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/prevnext/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "prevnext",
3 | "readable": "Prev Next",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Adds a prev page/next page snippet to your website",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/prevnext/prevnext.php:
--------------------------------------------------------------------------------
1 | hasPrevVisible()): ?>
2 | previous page
3 |
4 |
5 | hasNextVisible()): ?>
6 | next page
7 |
8 |
--------------------------------------------------------------------------------
/snippets/prevnext/readme.mdown:
--------------------------------------------------------------------------------
1 | # PrevNext Snippet
2 |
3 | ## What is it?
4 |
5 | Puts a "previous page | next page" navigation on your pages.
6 |
7 | ## Installation
8 |
9 | Put the prevnext.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 |
14 |
15 | ## Customization
16 |
17 | Change the html in site/snippets/prevnext.php
18 |
19 | ## Author
20 | Bastian Allgeier
21 |
--------------------------------------------------------------------------------
/snippets/submenu/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/submenu/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "submenu",
3 | "readable": "Submenu",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Generate a sub menu for a page with visible children",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/submenu/readme.mdown:
--------------------------------------------------------------------------------
1 | # Submenu Snippet
2 |
3 | ## What is it?
4 |
5 | This snippet generates a submenu for each page on the first level with visible children.
6 |
7 | ## Installation
8 |
9 | Put the submenu.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 |
14 |
15 | ## Customization
16 |
17 | Customize the html in site/snippets/submenu.php to get the best result for your project
18 |
19 | ## Author
20 | Bastian Allgeier
21 |
--------------------------------------------------------------------------------
/snippets/submenu/submenu.php:
--------------------------------------------------------------------------------
1 | findOpen();
5 | $items = ($open) ? $open->children()->visible() : false;
6 |
7 | ?>
8 | count()): ?>
9 |
16 |
17 |
--------------------------------------------------------------------------------
/snippets/treemenu/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/treemenu/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "treemenu",
3 | "readable": "Treemenu",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Adds a tree menu to your site",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/treemenu/readme.mdown:
--------------------------------------------------------------------------------
1 | # Treemenu Snippet
2 |
3 | ## What is it?
4 |
5 | a very simple tree menu snippet, which renders a menu of all your site's pages and subpages
6 |
7 | ## Installation
8 |
9 | Put the treemenu.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 |
14 |
15 | ## Customization
16 |
17 | Change the html in site/snippets/treemenu.php to get the best results for your project
18 |
19 | ## Start with a sublevel
20 |
21 | If you don't want it to start from the first level
22 | give it a set of pages, where it should start. i.e.:
23 |
24 |
25 |
26 | // get the first set of subpages which should be used
27 | $subpages = $pages->find('about-us')->children();
28 |
29 | // create the snippet beginning with those subpages
30 | snippet('treemenu', array('subpages' => $subpages));
31 |
32 | ?>
33 |
34 | ## Author
35 | Bastian Allgeier
36 |
--------------------------------------------------------------------------------
/snippets/treemenu/treemenu.php:
--------------------------------------------------------------------------------
1 | pages() ?>
2 |
--------------------------------------------------------------------------------
/snippets/video/changelog.mdown:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## v1.0
4 | + Initial release
--------------------------------------------------------------------------------
/snippets/video/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "video",
3 | "readable": "Video",
4 | "version": "1.0",
5 | "stable": true,
6 | "description": "Helper to create HTML5 video tags",
7 | "author": "Bastian Allgeier",
8 | "url": "http://getkirby.com/"
9 | }
10 |
--------------------------------------------------------------------------------
/snippets/video/readme.mdown:
--------------------------------------------------------------------------------
1 | # Video Snippet
2 |
3 | ## What is it?
4 |
5 | a very simple helper to build full html 5 video tags.
6 |
7 | ## Installation
8 |
9 | Put the video.php file in your site/snippets folder
10 |
11 | ## How to use it?
12 |
13 | videos()->find('movie.mp4'),
18 | $page->videos()->find('movie.mobile.mp4'),
19 | $page->videos()->find('movie.webm'),
20 | $page->videos()->find('movie.ogv'),
21 | );
22 |
23 | snippet('video', array(
24 | 'videos' => $videos,
25 | 'thumb' => $page->images()->find('movie.jpg')
26 | ));
27 |
28 | ?>
29 |
30 | ## Options
31 |
32 | ### width
33 |
34 | Set the width of the video. Default is 400px
35 |
36 | ### height
37 |
38 | Set the height of the video. Default is 300px
39 |
40 | ### preload
41 |
42 | (true|false) Default is true
43 |
44 | ### controls
45 |
46 | (true|false) Display controls for the video. Default is true
47 |
48 | ## Customization
49 |
50 | Change the html in site/snippets/video.php to get the best results for your project
51 |
52 | ## Author
53 | Bastian Allgeier
54 |
--------------------------------------------------------------------------------
/snippets/video/video.php:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/templates/feed/readme.mdown:
--------------------------------------------------------------------------------
1 | # Feed Template 1.0
2 |
3 | ## What is it?
4 |
5 | This is used in connection with the feed snippet to setup a RSS-Feed for any part of your site
6 |
7 | ## Installation
8 |
9 | Put the `feed.php` file from inside the `template` folder into the `templates` folder of your Kirby installation.
--------------------------------------------------------------------------------
/templates/feed/template/feed.php:
--------------------------------------------------------------------------------
1 | find('blog')->children()->visible()->flip()->limit(10);
7 |
8 | // this is how you embed the feed snippet with some options
9 | snippet('feed', array(
10 | 'link' => url('blog'),
11 | 'items' => $items,
12 | 'descriptionField' => 'text',
13 | 'descriptionLength' => 300
14 | ));
15 |
16 | ?>
--------------------------------------------------------------------------------
/templates/podcastfeed/podcastfeed.php:
--------------------------------------------------------------------------------
1 | find('podcast');
5 |
6 | // get any list of items
7 | // in this case we get all visible children of the podcast section,
8 | // flip them to get them in reverse order and make sure we only get the last 10
9 | $items = $podcast->children()->visible()->flip()->limit(10);
10 |
11 | // this is how you embed the feed snippet with some options
12 | snippet('podcastfeed', array(
13 | 'podcast' => $podcast,
14 | 'items' => $items,
15 | ));
16 |
17 | ?>
--------------------------------------------------------------------------------