Tag Archives: plugins

Plugins


Warning!!!
This system is in exclusive development right now. Stuff is still being populated, so don't consider it as a final version. Things will be added (as much as possible), and also may be changed (we will try not to make changes that will force you to change your plugins).

 

The EzGenerator core system now allows loading of custom plugins, that will handle extra manipulations on the current system, without the need of altering the main scripts.
This will allow us to continue developing the project and let users update regularely, without messing up their changes every time update is done.

How to use the system:

  

The system provides list of events, that are fired in a given situation. Every plugin can be attached to one or more (or even all) of the events to provide extra handling to a given core functionality.

Events are normally fired at the end of the specific action (when the core script handling is done), but there might be exceptions.


The plugins structure:

 

- Every plugin is per page (page id from the EZG project is used).
- There is one common folder EZGplugins inside the ezg_data folder (on the server).

- For each page you need plugins, you prepare new folder with the page id as name.

- You can put as many plugins as you want inside this folder and they will all load.

 

Example:

 

Let's say you have Blog (Page ID: 24) and Shop (Page ID: 27) on your project.
You go to the site and prepare folder EZGplugins in the ezg_data folder.
To set new plugin for the Blog, you go to EZGplugins folder and create new folder 24. Inside this folder you put 2 plugins: ExtraCommentsHandling.php and BlogPostingSpecial.php.
Same for 27 - you create the folder inside EZGplugins and you put inside one plugin: CustomCheckoutHandling.php.
Once you set up all the folders and plugins, you should have this in your project (online):

ezg_data/EZGplugins/

   |----24/

   |       |----ExtraCommentsHandling.php
   |       |----BlogPostingSpecial.php
   |----27/
   |       |----CustomCheckoutHandling.php

 

Note: Some modules (like the shop) have several subpages added automatically to the module by EZG. If you want to use something on the checkout page of the shop (for instance), and the checkout page has page ID: 30, DO NOT use 30 as a plugin folder name. Always use the main module page ID instead!

 

The plugins scripts:

 

- Every plugin must be a class with the same name as the file (without the file extension):
- Every plugin contains functions, which have same names as the events from the system.

- All functions must be public.

- (almost)* All functions must have 1 param - the EZG object the core provides so plugins can interact more efficiently with the core.

  * Since one core change some of the flags provide ability to add extra param, that is array with data, parsed by the system.

- If many plugins are attached to same event, they will be executed in the same order as the plugins are listed in the plugin folder (first file found in the folder is loaded first).

 

Example:

CustomCheckoutHandling.php

------------------------------------

  

class CustomCheckoutHandling extends EZGPlugin

{

public function loadPlugins($page)

{

echo 'CustomCheckoutHandling plugin loaded!';

}

public function show_item($page,$params)

{

foreach($params as $key => &$data)

{

$data = str_replace('duplicate','goat',$data);

}

}

}

 

 

When you load the Shop page, this line will be shown on the page the given text.

When you visit some item, it will replace all words "duplicate" with the word "goat".

 

 


LIST OF THE AVAILABLE EVENTS:

this list is stil being populated*

  1. Global:

    loadPlugins
      - fired when plugins loading is done.

  2. Shop/Catalog:

    checkout - fired when the checkout page is generated.
    process_order - fired when the order is processed (action=pay).
    show_user_orders - fired when user orders view is generated.
    view_invoice - fired when invoice is sent to the user via http
    view_invoices_list - fired when invoices list is shown to user.
    delete_order - fired when order is deleted (after deletion).
    update_products - fired when category list has been updated (before preparing the ouput).
    search - fired when search has been triggered.
    show_item($page,$params) - fired when individual item page is built. ($params contains 1 entry with the generated page HTML)

  3. Blog:

    show_frontpage - fired when frontpage is generated (before the printing on the page).
    save_entry  - fired when entry has been saved.
    save_entry_simple - fired when simple saving is done (using direct edit).
    handle_download  - fired when file has been downloaded
    get_timeline_data  - fired when timeline data has been calculated and parsed.
    show_timeline  - fired when timeline is shown to user (after showing).
    un_pub_entry - fired when entry has been published or unpublished.
    mail_entry  - fired when entry has been mailed.
    duplicate_entry  - fired when entry has been duplicated.
    reply_comment  - fired when comment is replied.
    un_app_comment - fired when comment has been approved or unapproved.
    del_comment - fired when comment has been deleted.
     
  4. Photoblog:

    process_complete 
    - fired when the script processing has been completed.
    show_timeline  - fired when timeline is shown to user (after showing).
    get_timeline_data  - fired when timeline data has been calculated and parsed.
    fullscreen - fired when fullscreen is activated.
    save_photo - fired when the photo bas been saved.
    post_entry  - fired when entry has been saved.
    publish_entry - fired when entry has been published.
    del_entry - fired when entry has been deleted.
    reply_comment  - fired when comment is replied.
    un_app_comment - fired when comment has been approved or unapproved.
    del_comment - fired when comment has been deleted.


  5. Guestbook:

    save_entry - fired when the entry has been saved.
    del_entry - fired when entry has been deleted.
    reply_comment_entry - fired when comment or entry has been replied.
    send_notification - fired when the notification has been sent.
    build_body_section - fired when the body section has been built.
    process_complete - fired when the script processing has been completed.
    sign - fired when guesbook has been signed.
    search_complete - fired when search processing has been complete.



 

 


Print  posted by atanas   General tags:  plugins   permalink
0 0


[home] 


CATEGORIES



TAGS


RECENT ENTRIES