Sfoglia il codice sorgente

Merge pull request #4 from theshka/gh-pages

Plugin Dev Documentation
Daniel Rudolf 9 anni fa
parent
commit
b3a62d3523

+ 0 - 4
_docs/customization.md

@@ -91,10 +91,6 @@ designers created in the past. As with plugins, you can find themes in
 
 #### Plugins for users
 
-Officially tested plugins can be found at http://pico.dev7studios.com/plugins,
-but there are many awesome third-party plugins out there! A good start point
-for discovery is [our Wiki](https://github.com/picocms/Pico/wiki/Pico-Plugins).
-
 Pico makes it very easy for you to add new features to your website. Simply
 upload the files of the plugin to the `plugins/` directory and you're done.
 Depending on the plugin you've installed, you may have to go through some more

+ 4 - 1
_plugin-dev/basics.md

@@ -5,5 +5,8 @@ nav: 1
 ---
 
 # Basics
+Creating your own content for Pico is *easy*.
 
-Coming soon!
+Inside the root Pico folder, all *themes* reside in the `themes` directory,
+and all *plugins* in the `plugins` directory. (As a developer, you may have
+changed these paths and/or directory names when you initialized Pico.)

+ 13 - 0
_plugin-dev/core.md

@@ -0,0 +1,13 @@
+---
+toc:
+    core:
+        _title: Core
+
+nav: 2
+---
+
+#Pico Core
+
+It's generally not a good idea to make modifications to the core of Pico. If you
+are looking to add or change functionality, can it be accomplished with a plugin?
+If not, and you are interested in helping to develop the Pico core, [fork us on GitHub](https://github.com/picocms/Pico)!

+ 84 - 0
_plugin-dev/plugins.md

@@ -0,0 +1,84 @@
+---
+toc:
+    plugins:
+        _title: Plugins
+        migrating: Migrating 0.X -> 1.0
+        your_first: Your First Plugin
+nav: 3
+---
+
+#Plugins
+At the heart of customizing Pico is a plugin. You can 'hook-in' to the Pico
+engine at many different times during the rendering of your site and its content.
+You will find a full example template in `plugins/DummyPlugin.php` to get you
+started on building some great stuff. Otherwise, keep reading to learn how to
+create your first plugin!
+
+Officially tested plugins can be found at http://pico.dev7studios.com/plugins,
+but there are many awesome third-party plugins out there! A good start point
+for discovery is our [Wiki](#plugin-wiki).
+
+#Migrating from 0.X -> 1.0
+The new event system supports plugin dependencies as well as some new events.
+You will be able to set an enabled/disabled state by default as well. If you
+have previously cerated a plugin for Pico, it is *HIGHLY* recommended that you
+update your class to extend from `AbstractPicoPlugin` and use the new events
+to avoid activating the `PicoDeprecated` plugin.
+
+    |---------------------|-----------------------------------------------------------|
+    | Event               | ... triggers the deprecated event                         |
+    |---------------------|-----------------------------------------------------------|
+    | onPluginsLoaded     | plugins_loaded()                                          |
+    | onConfigLoaded      | config_loaded($config)                                    |
+    | onRequestUrl        | request_url($url)                                         |
+    | onContentLoading    | before_load_content($file)                                |
+    | onContentLoaded     | after_load_content($file, $rawContent)                    |
+    | on404ContentLoading | before_404_load_content($file)                            |
+    | on404ContentLoaded  | after_404_load_content($file, $rawContent)                |
+    | onMetaHeaders       | before_read_file_meta($headers)                           |
+    | onMetaParsed        | file_meta($meta)                                          |
+    | onContentParsing    | before_parse_content($rawContent)                         |
+    | onContentParsed     | after_parse_content($content)                             |
+    | onContentParsed     | content_parsed($content)                                  |
+    | onSinglePageLoaded  | get_page_data($pages, $meta)                              |
+    | onPagesLoaded       | get_pages($pages, $currentPage, $previousPage, $nextPage) |
+    | onTwigRegistration  | before_twig_register()                                    |
+    | onPageRendering     | before_render($twigVariables, $twig, $templateName)       |
+    | onPageRendered      | after_render($output)                                     |
+    |---------------------|-----------------------------------------------------------|
+
+#Your First Plugin
+
+## 1. To get started, navigate to your `plugins` directory
+![Step1](style/images/docs/pico_plugins.jpg)
+
+---
+
+## 2. Create a new folder and name it your desired name using CammelCase
+![Step2](style/images/docs/pico_plugins_myplugin.jpg)
+
+> *Note:* It's not necessary to create the folder, if you do not have assets to
+> include, you can simply skip this step and continue to Step 3
+
+---
+
+## 3. Next, you should copy `DummyPlugin.php` inside your newly created folder and give it the same name as you did the folder
+![Step3](style/images/docs/pico_plugins_myplugin_php.jpg)
+
+---
+
+## 4. You will need to name the `class` the same as the `folder` and the `.php` file
+![Step4](style/images/docs/pico_plugins_myplugin_php_class.jpg)
+
+---
+
+## 5. From here, you will be able to hook-in to Pico's processing
+Choose an event that makes sense for your situation. Do you need to load configuration values?
+`onConfigLoaded`. You need to modify the content of the page before it is
+rendered by markdown? `onPageRendering`. Etc... Plugin developers shouldn't
+manipulate data in "wrong" events, this could lead to unexpected behavior.
+
+> *Note:* Don't forget to set your plugins enabled/disabled state, either by default or
+> through your sites `config/config.php` file.
+
+---

+ 10 - 0
_plugin-dev/wiki.md

@@ -0,0 +1,10 @@
+---
+toc:
+    wiki: Wiki
+nav: 3
+---
+
+#Plugin Wiki
+Whether you have an awesome new plugin you've created and you're dying to share,
+or if you're a new plugin developer and you're looking for some inspiration--
+our [Pico Plugin Wiki](https://github.com/picocms/Pico/wiki/Pico-Plugins) is here to help!

+ 1 - 3
plugin-dev.html

@@ -9,9 +9,7 @@ nav: 3
     <div class="inner">
         <h1 class="aligncenter">Create your own plugins &amp; themes</h1>
         <p class="description aligncenter">
-            Pico is highly customizable in two different ways:<br />
-            On the one hand you can change Picos apperance by using themes,<br />
-            on the other hand you can add new functionality by using plugins.
+            Pico is highly customizable -- the possibilites are endless when you're in control. 
         </p><br />
 
         <div class="one-fourth">

+ 32 - 16
plugins.html

@@ -12,26 +12,32 @@ nav: 4
             Want to make a plugin? See <a href="docs.html#plugins">the docs</a>.
         </p><br />
 
+        <h1>Pico 1.0 </h1>
         <div class="one-third">
-            <h3>RSS Feed</h3>
-            <p>Provides an RSS Feed for Pico. It will only include content with a "Date" field.</p>
-            <p><a href="https://github.com/gilbitron/Pico-RSS-Plugin" class="button red">Download</a></p>
+            <h3>Tags</h3>
+            <p>Provides tags functionality for Pico.</p>
+            <p><a href="https://github.com/szymonkaliski/Pico-Tags-Plugin" class="button red">Download</a></p>
         </div>
-        <div class="one-third">
-            <h3>Draftin</h3>
-            <p>
-                This is a Pico plugin that integrates <a href="http://draftin.com" target="_blank">Draft</a> into Pico.
-                You can see a tutorial on how to use it on <a href="http://www.codeforest.net/pico-cms-and-draft" target="_blank">Codeforest</a>.
-            </p>
-            <p><a href="https://github.com/codeforest/pico_draft" class="button red">Download</a></p>
+        <div class="one-third ">
+            <h3>Editor</h3>
+            <p>Markdown editor and file manager for Pico.</p>
+            <p><a href="https://github.com/theshka/Pico-Editor-Plugin" class="button red">Download</a></p>
         </div>
         <div class="one-third last">
-            <h3>Editor</h3>
-            <p>Provides an online Markdown editor and file manager for Pico.</p>
-            <p><a href="https://github.com/gilbitron/Pico-Editor-Plugin" class="button red">Download</a></p>
+            <h3>Pico GAnalytics</h3>
+            <p>Gooogle Analytics for Pico with basic options. </p>
+            <p><a href="https://github.com/bricebou/pico_ganalytics" class="button red">Download</a></p>
         </div>
         <div class="clear"></div><br />
 
+        <div class="one-third">
+            <h3>Pico GitHub Activity</h3>
+            <p>Your GitHub public activity feed.</p>
+            <p><a href="https://github.com/theshka/pico_githubactivity" class="button red">Download</a></p>
+        </div>
+        <div class="clear"></div><br />
+
+        <h1>Pico 0.X </h1>
         <div class="one-third">
             <h3>Pagination</h3>
             <p>Provides basic pagination for Pico.</p>
@@ -77,9 +83,19 @@ nav: 4
             <p><a href="https://github.com/ahmet2106/pico-navigation" class="button red">Download</a></p>
         </div>
         <div class="one-third last">
-            <h3>Tags</h3>
-            <p>Provides tags functionality for Pico.</p>
-            <p><a href="https://github.com/szymonkaliski/Pico-Tags-Plugin" class="button red">Download</a></p>
+            <h3>RSS Feed</h3>
+            <p>Provides an RSS Feed for Pico.</p>
+            <p><a href="https://github.com/gilbitron/Pico-RSS-Plugin" class="button red">Download</a></p>
+        </div>
+        <div class="clear"></div><br />
+
+        <div class="one-third">
+            <h3>Draftin</h3>
+            <p>
+                This is a Pico plugin that integrates <a href="http://draftin.com" target="_blank">Draft</a> into Pico.
+                You can see a tutorial on how to use it on <a href="http://www.codeforest.net/pico-cms-and-draft" target="_blank">Codeforest</a>.
+            </p>
+            <p><a href="https://github.com/codeforest/pico_draft" class="button red">Download</a></p>
         </div>
         <div class="clear"></div><br />
 

BIN
style/images/docs/pico_plugins.jpg


BIN
style/images/docs/pico_plugins_myplugin.jpg


BIN
style/images/docs/pico_plugins_myplugin_php.jpg


BIN
style/images/docs/pico_plugins_myplugin_php_class.jpg