Hide minor edits - Show changes to markup
You have to name your Addon file like front_addonname.php if you want to use front workspaces.
You have to name your Addon file like front_addonname.php if you want to use front workspaces.
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, a list of addon functions and their assigned location (=workspace) is stored in an array. At every workspace in the core code the related functions from Admin addons are performed in run-time.
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, a list of addon functions and their assigned location (=workspace) is stored in an array. At every workspace in the core code the related functions from Admin addons are performed in run-time.
You have to name your Addon file like front_addonname.php if you want to use front workspaces.
(:nogroupfooter:)
See the code of a simple sample Front Addon here: Front Hello World Addon Code
See the code of a simple sample Front Addon here: Front Hello World Addon Code TOP
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. Pixelpost's core variables are always available in normal Addons. If you access them as globals they will be changed.\\
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. Pixelpost's core variables are always available in normal Addons. If you access them as globals they can be changed.\\
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. Pixelpost's core variables are always available. If you access them as globals they will be changed.\\
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. Pixelpost's core variables are always available in normal Addons. If you access them as globals they will be changed.\\
Admin Addons were invented in version 1.5. With Admin Addons you can
Admin Addons were invented in version 1.5.
With Admin Addons you can
Creating Addons is not difficult at all but you should be familiar to PHP and the Pixelpost core code. Please bear in mind that if you use Pixelpost's own variables they will be overwritten by your Addon.\\
Creating Addons is not difficult at all but you should be familiar to PHP and the Pixelpost core code. Please bear in mind that if you use Pixelpost's own variables they can be overwritten by your Addon.\\
See here a list of all available Admin workspaces.
See here a list of all available Admin workspaces.
See here a list of all available Front workspaces.
See here a list of all available Front workspaces.
See the code of a simple sample "Normal" Addon here: Hello World Addon Code
See the code of a simple sample "Normal" Addon here: Hello World Addon Code
See the code of a simple sample Admin Addon here: Admin Hello World Addon Code
See the code of a simple sample Front Addon here: Front Hello World Addon Code
See the code of a simple sample "Normal" Addon here: Hello World Addon Code
Naming convention: admin_addonname.php
Naming convention: admin_addonname.php
Naming convention: front_addonname.php
Naming convention: front_addonname.php
You can put them all together into a folder within the addons directory, using this naming convention: _addonfoldername
You can put them all together into a folder within the addons directory, using this naming convention: _addonfoldername
index.php?view=menu&menuview=new_submenu\\
index.php?view=menu&menuview=new_submenu\\
Tip: While testing your addon add ?errors to the address string in the URL field of your browser to show errors or change line 46 of index.php "error_reporting(0);" to "error_reporting(E_ALL ^ E_NOTICE);".
Tip: To show errors while testing your addon add "?errors" to the address string in the URL field of your browser or insert "error_reporting(E_ALL ^ E_NOTICE)" in the beginning of your Addon code (remove it when finished!).
Naming convention: addonname.php
Naming convention: addonname.php
(:source lang=PHP -link :)add_admin_functions('', 'admin_main_menu', 'New_Page', '')
(:source lang=PHP -link :)add_admin_functions('', 'admin_main_menu', 'New_Page', '');
(:source lang=PHP -link :)add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', ''
(:source lang=PHP -link :)add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', '');
add_front_functions($addon_function_name, $addon_front_workspace
add_front_functions($addon_function_name, $addon_front_workspace)
[@$addon_workspace = "image_edit";
// menu where the addon should appear in admin panel. in this case: images menu
$addon_menu = "images";
// What would be the title of submenu of this addon: 12cropimage
$addon_admin_submenu = "12cropimage";
// What is the function
$addon_function_name = "cropimage12_admin_addon";
// add the function\\
(:source lang=PHP -link :)[@$addon_workspace = "image_edit"; // menu where the addon should appear in admin panel. in this case: images menu $addon_menu = "images"; // What would be the title of submenu of this addon: 12cropimage $addon_admin_submenu = "12cropimage"; // What is the function $addon_function_name = "cropimage12_admin_addon";
// add the function
(:source lang=PHP -link :)add_admin_functions('', 'admin_main_menu', 'New_Page', ''
(:source lang=PHP -link :)add_admin_functions('', 'admin_main_menu', 'New_Page', '')
add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', ''
(:source lang=PHP -link :)add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', ''
[@function show_newpage() {
(:source lang=PHP -link :)[@function show_newpage() {
(:source lang=PHP4ALT -link :)add_admin_functions('', 'admin_main_menu', 'New_Page', ''
(:source lang=PHP -link :)add_admin_functions('', 'admin_main_menu', 'New_Page', ''
add_admin_functions('', 'admin_main_menu', 'New_Page', ''
(:source lang=PHP4ALT -link :)add_admin_functions('', 'admin_main_menu', 'New_Page', ''
This is the code for a very simple Front Addon which makes use of the front workspace 'frontpage_init'. It sets a specific category as default category
This is the code for a very simple Front Addon which makes use of the front workspace 'frontpage_init'. It sets a specific category as default category
To call your Addon functions in the right place you have to make use of the interface function:\\
To call your Admin Addon functions in the right place you have to make use of the admin interface function:\\
To call your Front Addon functions in the right place you have to make use of the front interface function:
add_front_functions($addon_function_name, $addon_front_workspace
The main reason for inventing the Front Workspaces in Pixelpost v1.7 was the demand for additional spam defeat methods. So you'll find the most front workspaces within the comments code where they can be used for spam statistics or for implementing new spam filters after the applying of Pixelpost's own spam control functions.
See the actual list of available Front Workspaces here:
Front Workspaces
The main reason for inventing the Front Workspaces in Pixelpost v1.7 was the demand for additional spam defeat methods. So you'll find the most front workspaces within the comments code where they can be used for spam statistics or for implementing new spam filters after or between the applying of Pixelpost's own spam control functions.
See the actual list of available Front Workspaces here: Front Workspaces
}@]
}@]
Front Addons work very similar to the Admin Addons. They use their own workspaces which we call Front Workspaces for differentiating.
The main reason for inventing the Front Workspaces in Pixelpost v1.7 was the demand for additional spam defeat methods. So you'll find the most front workspaces within the comments code where they can be used for spam statistics or for implementing new spam filters after the applying of Pixelpost's own spam control functions.
See the actual list of available Front Workspaces here:
Front Workspaces
add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', ''
add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', ''
function show_newpage() {
global $pixelpost_db_prefix;
if ($_GET['view']=='new_page']) {
echo '<div class="caption">NEW PAGE</div>
<div class="submenu">';
$submenuclass = '';
if (!isset($_GET['new_pageview']) || $_GET['new_pageview']=='overview') {
$submenuclass = 'selectedsubmenu';
echo "<a href='?view=new_page&new_pageview=overview' class='".$submenucssclass."' >OVERVIEW</a>\n";
}
$submenuclass = '';
if ($_GET['new_pageview'=='details') {
$submenuclass = 'selectedsubmenu';
echo "<a href='?view=new_page&new_pageview=details' class='".$submenucssclass."' >DETAILS</a>\n";
$submenuclass = '';
if ($_GET['new_pageview'=='settings') {
$submenuclass = 'selectedsubmenu';
echo "<a href='?view=new_page&new_pageview=settings' class='".$submenucssclass."' >SETTINGS</a>\n";
echo '</div>';
echo '<div class="jcaption">Section Title</div>';
echo '<p>This is a really new page!</p>';
}
}
}@]
}@]
add_admin_functions('', 'admin_main_menu', 'New_Page', ''add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', ''add_admin_functions('', 'admin_main_menu', 'New_Page', ''
add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', ''}
}@]
add_admin_functions('', 'admin_main_menu', 'New_Page', ''add_admin_functions('show_newpage', 'admin_main_menu_contents', 'New_Page', '' global $pixelpost_db_prefix;
if ($_GET['view']=='new_page']) {
echo '<div class="caption">NEW PAGE</div>
<div class="jcaption">Section Title</div>';
echo '<p>This is a really new page!</p>';
}
}
See a list of all available Admin workspaces below.
See here a list of all available Admin workspaces.
Front Addons can add extended functions within the Pixelpost code and can perform actions exactly in the moment they are called.
See a list of all available Front workspaces below.
Front Addons can add extended functions within the Pixelpost code and can perform actions exactly in the moment they are called.
See here a list of all available Front workspaces.
The function crop12_admin_addon() performs the action of this addon.
The function crop12_admin_addon() performs the action of this addon.
Please have a look into the code of admin_ping.php, admin_update_exif.php and admin_akismet_comment.php too!
If you want to add a new submenu to one of the original pages the link to this submenu page is automatically created as
index.php?view=menu&menuview=new_submenu
where menu is the menu variable and new_submenu is the name of your new submenu.
If you want to add a new submenu to one of the pages the link to this submenu page is automatically created as
index.php?view=menu&menuview=new_submenu
where menu is the menu variable and new_submenu is the name of your new submenu.
| Workspace Name | Menu | File Name | Insert Location |
|---|---|---|---|
| All Pages | |||
| admin_html_head | - | index.php | Between <HTML> and </HTML> of each admin page |
| admin_main_menu | - | index.php | while creating the Admin menus |
| admin_main_menu_contents | - | index.php | during the call of the submenu pages in dependence of GET variable |
| Options | |||
| options | options | options.php | when calling the Admin Options page. Use it to create a new submenu here. |
| additional_spam_measures | - | options.php | at the end of the form in submenu Spam Control |
| General Info | |||
| info | info | view_info.php | when calling the Admin Info page. Use it to create a new submenu here. |
| Comments | |||
| comments | comments | comments.php | when calling the Admin Comments page. Use it to create a new submenu here. |
| pages_commentbuttons | - | comments.php | after the SQL statement which counts the entries for the page numbers |
| show_commentbuttons_top | - | comments.php | after the buttons on top of the comments list |
| single_comment_list | - | comments.php | before each single comment in the list |
| show_commentbuttons_bottom | - | comments.php | after the buttons at the bottom of the comments list |
| New Image | |||
| image_upload_start | - | new_image.php | in the beginning of file upload |
| image_upload_succesful | - | new_image.php | after the successful upload of an image |
| image_upload_failed | - | new_image.php | after the error message if an image upload failed |
| image_uploaded | - | new_image.php | after the insert of the image into the database |
| upload_finished | - | new_image.php | after the insert of the image tags into the database |
| new_image_form_def_lang | - | new_image.php | within the new image form (after the default language tags) |
| new_image_form_alt_lang | - | new_image.php | within the new image form (after the alternative language tags) |
| new_image_form | - | new_image.php | at the end of new image form, just before the submit button |
| thumb_created | - | new_image.php | after the thumbnail creation but before the 12CropImage function |
| Edit Image | |||
| image_edit | images | images_edit.php | when calling the Admin Images Edit page. Use it to create a new submenu here. |
| image_update | - | images_edit.php | during the image update in the database right after updating the categories |
| image_reupload_start | - | images_edit.php | in the beginning of file re-upload |
| image_reupload_succesful | - | images_edit.php | after the successful re-upload of an image |
| image_reupload_failed | - | images_edit.php | after the error message if an image re-upload failed |
| image_deleted | - | images_edit.php | in the beginning of image deletion |
| image_list | - | images_edit.php | within the list of the images after the basic information |
| edit_image_form_def_lang | - | images_edit.php | within the edit image form (after the default language tags) |
| edit_image_form_alt_lang | - | images_edit.php | within the edit image form (after the alternative language tags) |
| edit_image_form | - | images_edit.php | at the end of edit image form, just before the submit button |
Workspaces can be compared to anchors within the admin code. All addon functions must be "tied" to a workspace and are called in the moment the script passes the workspace. This way you can add new functionality into many locations of the admin files.
See the list of available Admin Workspaces here:
Admin Workspaces
Use of the Admin Interface Function
in Pixelpost v1.7 that can be used for Admin addons:
Use of the Admin Interface Function
By using the interface function you can create your own menus and submenus with Your Admin Addon.
See the list of available Menus / Submenus here:
available Menus / Submenus
If you want to add a new submenu to one of the pages the link to this submenu page is automatically created as
index.php?view=menu&menuview=new_submenu
where menu is the menu variable and new_submenu is the name of your new submenu.
| Menu Name | Menu Variable | Submenu Name | Submenu Variable | Link |
|---|---|---|---|---|
| New Image | - | - | - | index.php |
| Options | options | General | general | index.php?view=options&optionsview=general |
| Options | options | Template | template | index.php?view=options&optionsview=template |
| Options | options | Thumbnails | thumb | index.php?view=options&optionsview=thumb |
| Options | options | Spam Control | antispam | index.php?view=options&optionsview=antispam |
| Options | options | New Submenu | new_submenu | index.php?view=options&optionsview=new_submenu |
| Images | images | - | - | index.php?view=images |
| Images | images | New Submenu | new_submenu | index.php?view=images&imagesview=new_submenu |
| Comments | comments | - | - | index.php?view=comments |
| Comments | comments | Comments | published | index.php?view=comments&show=published |
| Comments | comments | Awaiting Moderation | masked | index.php?view=comments&show=masked |
| Comments | comments | Akismet | akismet | index.php?view=comments&commentsview=akismet |
| Comments | comments | New Submenu | new_submenu | index.php?view=comments&commentsview=new_submenu |
| General Info | info | - | - | index.php?view=info |
| General Info | info | New Submenu | new_submenu | index.php?view=info&infoview=new_submenu |
If you want to add a new submenu to one of the pages the link to this submenu page is automatically created as
index.php?view=menu&menuview=new_submenu
where menu is the menu variable and new_submenu is the name of your new submenu.
Here are several ways to use this interface:
See the several ways to use this interface here:
Use of the Admin Interface Function
in Pixelpost v1.7 that can be used for Admin addons:
| Syntax | Description |
|---|---|
add_admin_functions($addon_function_name,$addon_workspace,'','')Example: add_admin_functions('do_pings','image_uploaded','','')The Addon function do_pings() is performed in the workspace "image_uploaded". | Here the interface is used to call an Addon function in the defined workspace. No menus or submenus are involved since every workspace has its unique location. |
add_admin_functions($addon_function_name,$addon_workspace,$addon_menu,$addon_submenu)Example: add_admin_functions('cropimage12_admin_addon','image_edit','images','12cropimage')Creates a new submenu named "12cropimage" under Images Menu, calling the function crop12_admin_addon() in the workspace "image_edit". | To create code within a new submenu of an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. |
| Special interface functions: | |
add_admin_functions($addon_function_name,'admin_html_head','','') | Inserts code between the <HTML> and </HTML> tags in all Admin pages. Can be used for CSS, Javascript or for including files. |
add_admin_functions('','admin_main_menu',$addon_menu,'') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?view=newitem and the menu title will show NEWITEM. |
add_admin_functions($addon_function_name,'admin_main_menu_contents',$addon_menu,'') | With this function the content of a new page is performed whenever the new page is called. Of course $addon_menu must be the name of the new page here. To add submenus to your new page you can code them directly in the new page code. |
in Pixelpost v1.7 that can be used for Admin addons:
| image_reupload_start | - | images_edit.php | in the beginning of file re-upload |
| image_reupload_succesful | - | images_edit.php | after the successful re-upload of an image |
| image_reupload_failed | - | images_edit.php | after the error message if an image re-upload failed |
| image_deleted | - | images_edit.php | in the beginning of image deletion |
| image_list | - | images_edit.php | within the list of the images after the basic information |
| edit_image_form_def_lang | - | images_edit.php | within the edit image form (after the default language tags) |
| edit_image_form_alt_lang | - | images_edit.php | within the edit image form (after the alternative language tags) |
| edit_image_form | - | images_edit.php | at the end of edit image form, just before the submit button |
| new_image_form_def_lang | - | new_image.php | within the new image form (after the default language tags) |
| new_image_form_alt_lang | - | new_image.php | within the new image form (after the alternative language tags) |
| new_image_form | - | new_image.php | at the end of new image form, just before the submit button |
| thumb_created | - | new_image.php | after the thumbnail creation but before the 12CropImage function |
| Edit Image | |||
| image_edit | images | images_edit.php | when calling the Admin Images Edit page. Use it to create a new submenu here. |
| image_update | - | images_edit.php | during the image update in the database right after updating the categories |
| All Pages |
| Options |
| General Info |
| Comments |
| New Image | |||
| image_upload_start | - | new_image.php | in the beginning of file upload |
| image_upload_succesful | - | new_image.php | after the successful upload of an image |
| image_upload_failed | - | new_image.php | after the error message if an image upload failed |
| image_uploaded | - | new_image.php | after the insert of the image into the database |
| upload_finished | - | new_image.php | after the insert of the image tags into the database |
| info | info | view_info.php | when calling the Admin Info page. Use it to create a new submenu here. |
| comments | comments | comments.php | when calling the Admin Comments page. Use it to create a new submenu here. |
| pages_commentbuttons | - | comments.php | after the SQL statement which counts the entries for the page numbers |
| show_commentbuttons_top | - | comments.php | after the buttons on top of the comments list |
| single_comment_list | - | comments.php | before each single comment in the list |
| show_commentbuttons_bottom | - | comments.php | after the buttons at the bottom of the comments list |
| Workspace Name | Menu Name | File Name | Description |
|---|
| Workspace Name | Menu | File Name | Insert Location |
|---|---|---|---|
| admin_html_head | - | index.php | Between <HTML> and </HTML> of each admin page |
| admin_main_menu | - | index.php | while creating the Admin menus |
| admin_main_menu_contents | - | index.php | during the call of the submenu pages in dependence of GET variable |
| options | options | options.php | when calling the Admin Options page. Use it to create a new submenu here. |
| additional_spam_measures | - | options.php | at the end of the form in submenu Spam Control |
You don't have to use all of those parameters when calling the interface, it depends on what kind of action you want to perform.
You don't have to use all of those parameters when calling the interface, it depends on what kind of action you want to perform. \\
| Special interface functions: |
|---|
| Special interface functions: |
|---|
Always remember that when writing an Admin Addon:\\
Always remember that when writing an Admin Addon:
Admin Addons were invented in version 1.5. They add new features and new menus / submenus to the Admin area. They have to be assigned to "workspaces" in predefined places and are called by a function whithout any arguments. The addon code is included at run-time in the location of the workspace, so you can use global variables to overwrite Pixelpost's variables at exactly this moment.
Admin Addons were invented in version 1.5. With Admin Addons you can
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, a list of addon functions and their assigned location (=workspace) is stored in an array. At every workspace in the core code the related functions from Admin addons are performed in run-time.
With Admin Addons you can
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, a list of addon functions and their corresponding workspaces is stored in an array. At every workspace in the core code the related functions from Admin addons are called in run-time.
You can access the variables of the Admin files inside your addon's functions. If you define them as globals you can overwrite them but make sure that the core code still works.
To call your Addon functions you have to make use of the interface function:\\
Always remember that when writing an Admin Addon:
*Workspaces are predefined unique locations within the core code of the admin files.
To call your Addon functions in the right place you have to make use of the interface function:\\
| Syntax | Description |
|---|
| Syntax | Description |
|---|
Here is the list of available menus / submenus in Pixelpost v1.7 that can be used for Admin addons:
in Pixelpost v1.7 that can be used for Admin addons:
| Workspace Name | Menu Name | File Name | Description |
|---|
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, the script looks for Admin addons in the Addons folder and updates the list of available Addons in database addons table. A list of addon functions and their corresponding workspaces is stored in an array. At every workspace in the core code the related functions from Admin addons are called in run-time.
You can access the variables of the Admin files as globals inside your addon's functions. You can overwrite them if needed but make sure that the core code still works.
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, a list of addon functions and their corresponding workspaces is stored in an array. At every workspace in the core code the related functions from Admin addons are called in run-time.
You can access the variables of the Admin files inside your addon's functions. If you define them as globals you can overwrite them but make sure that the core code still works.
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. Pixelpost's core variables are always available. if you access them as globals they will be changed.\\
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. Pixelpost's core variables are always available. If you access them as globals they will be changed.\\
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. You remember, most of Pixelpost's core variables are always available.\\
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. Pixelpost's core variables are always available. if you access them as globals they will be changed.\\
Open the file current_datetime.php in your Addons directory and have a look at the code. This Addon is provided as a simple example how to write an addon:\\
Open the file current_datetime.php in your Addons directory and have a look at the code. This Addon is provided as a simple example how to write an addon:
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, the script looks for Admin addons in the Addons folder and updates the list of available Addons in database addons table. A list of addon functions and their corresponding workspaces is stored in an array. At every workspace in the core code the related functions from Admin addons are called in run-time.
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, the script looks for Admin addons in the Addons folder and updates the list of available Addons in database addons table. A list of addon functions and their corresponding workspaces is stored in an array. At every workspace in the core code the related functions from Admin addons are called in run-time.
You can access the variables of the Admin files as globals inside your addon's functions. You can overwrite them if needed but make sure that the core code still works.
In dependence of what kind of action you want to perform, there are five ways to use this interface:
You don't have to use all of those parameters when calling the interface, it depends on what kind of action you want to perform. Here are several ways to use this interface:
add_admin_functions($addon_function_name,'admin_html_head','','') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name,$addon_workspace,'','') | Here the interface is used to call an Addon function in the defined workspace. No menus or submenus are involved since every workspace has its own location. |
add_admin_functions($addon_function_name,$addon_workspace,'','')Example: add_admin_functions('do_pings','image_uploaded','','')The Addon function do_pings() is performed in the workspace "image_uploaded". | Here the interface is used to call an Addon function in the defined workspace. No menus or submenus are involved since every workspace has its unique location. |
| To use a new submenu within an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. | |
add_admin_functions('','admin_main_menu',$addon_menu,'') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?x=newitem and the menu title will show NEWITEM. |
Example:add_admin_functions('cropimage12_admin_addon','image_edit','images','12cropimage')
Creates a new submenu named "12cropimage" under Images Menu, calling the function crop12_admin_addon() in the workspace "image_edit". ||To create code within a new submenu of an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. ||
| Special interface functions: | |
|---|---|
add_admin_functions($addon_function_name,'admin_html_head','','') | Inserts code between the <HTML> and </HTML> tags in all Admin pages. Can be used for CSS, Javascript or for including files. |
add_admin_functions('','admin_main_menu',$addon_menu,'') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?view=newitem and the menu title will show NEWITEM. |
Admin Addons were invented in version 1.5. They add new features and new menus / submenus to the Admin area. They have to be assigned to "workspaces" in predefined places and called by a function. The addon code is included in the location of the workspace, so you can use global variables to overwrite Pixelpost's variables at exactly this moment.
See a list of all available workspaces below.
Admin Addons were invented in version 1.5. They add new features and new menus / submenus to the Admin area. They have to be assigned to "workspaces" in predefined places and are called by a function whithout any arguments. The addon code is included at run-time in the location of the workspace, so you can use global variables to overwrite Pixelpost's variables at exactly this moment.
See a list of all available Admin workspaces below.
See a list of all available workspaces below.
See a list of all available Front workspaces below.
To call a function you have to make use of the interface function:\\
To call your Addon functions you have to make use of the interface function:\\
add_admin_functions($addon_function_name,$addon_workspace,$addon_menu,$addon_admin_submenu);@]
add_admin_functions($addon_function_name,$addon_workspace,$addon_menu,$addon_admin_submenu);@]
The function crop12_admin_addon() performs the action of this addon.
| General Info | info | New Submenu | new_submenu | index.php?view=info&infoview=new_submenu |
| General Info | info | New Submenu | new_submenu | index.php?view=info&infoview=new_submenu |
If you want to add a new submenu to one of the pages the link to this submenu page is automatically created as
index.php?view=menu&menuview=new_submenu
where menu is the menu variable and new_submenu is the name of your new submenu.
This Addon is provided as an example for an Admin addon. Open the file and see the code:
It starts again with the $addon_ variables which every Addon must have. Like mentioned above these are $addon_name, $addon_version and $addon_description.
It should perform its function in the New Image page and create a new submenu for that.
$addon_workspace = "image_edit";\\ // menu where the addon should appear in admin panel. in this case: images menu\\ $addon_menu = "images";\\ // What would be the title of submenu of this addon: 12cropimage\\ $addon_admin_submenu = "12cropimage";\\ // What is the function\\ $addon_function_name = "cropimage12_admin_addon";\\ // add the function\\ add_admin_functions($addon_function_name,$addon_workspace,$addon_menu,$addon_admin_submenu);
| Images | images | New Submenu | new_submenu | index.php?view=images&imagesview=new_submenu |
| Images | images | New Submenu | new_submenu | index.php?view=images&imagesview=new_submenu |
| Comments | comments | New Submenu | new_submenu | index.php?view=comments&commentsview=new_submenu |
| Comments | comments | New Submenu | new_submenu | index.php?view=comments&commentsview=new_submenu |
| General Info | info | New Submenu | new_submenu | index.php?view=info&infoview=new_submenu |
| General Info | info | New Submenu | new_submenu | index.php?view=info&infoview=new_submenu |
| Comments | comments | - | - | index.php?view=images |
| Comments | comments | - | - | index.php?view=comments |
| Comments | comments | Comments | published | index.php?view=comments&show=published |
| Comments | comments | Awaiting Moderation | masked | index.php?view=comments&show=masked |
| Comments | comments | Akismet | akismet | index.php?view=comments&commentsview=akismet |
| General Info | info | - | - | index.php?view=info |
| General Info | info | New Submenu | new_submenu | index.php?view=info&infoview=new_submenu |
| Menu Name | Menu Variable | Submenu Name | Submenu Variable | Link |
|---|
| Menu Name | Menu Variable | Submenu Name | Submenu Variable | Link |
|---|
| Options | options | General | general | index.php?x=options&optionsview=general |
| Options | options | Template | template | index.php?x=options&optionsview=template |
| Options | options | Thumbnails | thumb | index.php?x=options&optionsview=thumb |
| Options | options | Spam Control | antispam | index.php?x=options&optionsview=antispam |
| Options | options | General | general | index.php?view=options&optionsview=general |
| Options | options | Template | template | index.php?view=options&optionsview=template |
| Options | options | Thumbnails | thumb | index.php?view=options&optionsview=thumb |
| Options | options | Spam Control | antispam | index.php?view=options&optionsview=antispam |
| Options | options | New Submenu | new_submenu | index.php?view=options&optionsview=new_submenu |
| Images | images | - | - | index.php?view=images |
| Images | images | New Submenu | new_submenu | index.php?view=images&imagesview=new_submenu |
| Comments | comments | - | - | index.php?view=images |
| Comments | comments | New Submenu | new_submenu | index.php?view=comments&commentsview=new_submenu |
To add submenus to your new page you can code them directly in the new page code. ||
To add submenus to your new page you can code them directly in the new page code. ||
Here is the list of available menus / submenus in Pixelpost v1.7 that can be used for Admin addons:
| Menu Name | Menu Variable | Submenu Name | Submenu Variable | Link |
|---|---|---|---|---|
| New Image | - | - | - | index.php |
| Options | options | General | general | index.php?x=options&optionsview=general |
| Options | options | Template | template | index.php?x=options&optionsview=template |
| Options | options | Thumbnails | thumb | index.php?x=options&optionsview=thumb |
| Options | options | Spam Control | antispam | index.php?x=options&optionsview=antispam |
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu);
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_submenu);
add_admin_functions($addon_function_name, 'admin_html_head', '', '') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name, $addon_workspace, '', '') | Here the interface is used to call an Addon function in the defined workspace. No menus or submenus are involved since every workspace has its own location. |
add_admin_functions($addon_function_name,'admin_html_head','','') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name,$addon_workspace,'','') | Here the interface is used to call an Addon function in the defined workspace. No menus or submenus are involved since every workspace has its own location. |
add_admin_functions($addon_function_name, 'admin_html_head', '', '') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name, 'admin_html_head', '', '') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name, 'admin_html_head', '', '') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name, 'admin_html_head', '', '') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu) | To use a new submenu within an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. |
add_admin_functions('', 'admin_main_menu', $addon_menu, '') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?x=newitem and the menu title will show NEWITEM. |
add_admin_functions($addon_function_name, 'admin_main_menu_contents', $addon_menu, '') | With this function the content of a new page is performed whenever the new page is called. Of course $addon_menu must be the name of the new page here.\\ |
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu) | To use a new submenu within an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. |
add_admin_functions('', 'admin_main_menu', $addon_menu, '') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?x=newitem and the menu title will show NEWITEM. |
add_admin_functions($addon_function_name, 'admin_main_menu_contents', $addon_menu, '') | With this function the content of a new page is performed whenever the new page is called. Of course $addon_menu must be the name of the new page here.\\ |
($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu) | To use a new submenu within an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. |
('', 'admin_main_menu', $addon_menu, '') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?x=newitem and the menu title will show NEWITEM. |
($addon_function_name, 'admin_main_menu_contents', $addon_menu, '') | With this function the content of a new page is performed whenever the new page is called. Of course $addon_menu must be the name of the new page here.\\ |
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu) | To use a new submenu within an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. |
add_admin_functions('', 'admin_main_menu', $addon_menu, '') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?x=newitem and the menu title will show NEWITEM. |
add_admin_functions($addon_function_name, 'admin_main_menu_contents', $addon_menu, '') | With this function the content of a new page is performed whenever the new page is called. Of course $addon_menu must be the name of the new page here.\\ |
($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu) |
('', 'admin_main_menu', $addon_menu, '') | This is used to create a new menu entry in the Admin panel. The $addon_menu variable will indicate the menu name as well as the link to that new page in admin area. For instance if $addon_menu is "newitem", the link to the new page will be index.php?x=newitem and the menu title will show NEWITEM. |
($addon_function_name, 'admin_main_menu_contents', $addon_menu, '') | With this function the content of a new page is performed whenever the new page is called. Of course $addon_menu must be the name of the new page here. To add submenus to your new page you can code them directly in the new page code. |
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu);
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu);
In dependence of what kind of action you want to perform, there are five ways to use this interface:
| Syntax | Description |
|---|---|
add_admin_functions($addon_function_name, 'admin_html_head', '', '') | This is used to echo some HTML code between the <HTML> and </HTML> code in all Admin pages. It can be style definitions or JavaScript for example. |
add_admin_functions($addon_function_name, $addon_workspace, '', '') | Here the interface is used to call an Addon function in the defined workspace. No menus or submenus are involved since every workspace has its own location. |
($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu) | To use a new submenu within an existing menu you have to use the interface function with all variables set. $addon_menu should now be an existing menu item. If the submenu in $addon_admin_submenu does not exist the submenu entry is created automatically. |
($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu) |
As you can see in paged_archive.php the Addon has to repeat the "normal" pixelpost functions for showing the thumbnails in the archive page with page numbers.
As you can see in paged_archive.php the Addon has to repeat the "normal" pixelpost functions for showing the thumbnails in the archive page with page numbers.
With Admin Addons you can
The logic behind the Admin addons is simple: Whenever one of the Admin pages is called, the script looks for Admin addons in the Addons folder and updates the list of available Addons in database addons table. A list of addon functions and their corresponding workspaces is stored in an array. At every workspace in the core code the related functions from Admin addons are called in run-time.
To call a function you have to make use of the interface function:
add_admin_functions($addon_function_name, $addon_workspace, $addon_menu, $addon_admin_submenu);
Now have a closer look to the other normal Addons like calendar.php and paged_archive.php which come with your Pixelpost installation. You will see that you can call the MySQL functions as well, read out the tables and create new ones.
As you can see in paged_archive.php the Addon has to repeat the "normal" pixelpost functions for showing the thumbnails in the archive page with page numbers.
Open the file current_datetime.php in your Addons directory and have a look at the code. This Addon is provided as a simple example how to write an addon:
!!!!current_datetime.php
It starts with the $addon_ variables which every Addon must have. Like mentioned above these are $addon_name, $addon_version and $addon_description.
Perform your PHP code, here it is the call of PHP function gmdate() making use of the $cfgrow array of Pixelpost core code. You remember, most of Pixelpost's core variables are always available.
Replace your result with a template tag ($tmp variable is available too, it is always the one of the template that is in use right now).
Add your new template tag to the template where you want to show the new value.
That's all!
Normal Addons cannot make use of any existing template tags, but can call functions and variables. If you want to realize a different behaviour of Pixelpost, you usually have to rewrite the functions to your needs.
Addons cannot make use of any existing template tags, but can call functions and variables. If you want to realize a different behaviour of Pixelpost, you usually have to rewrite the functions in your Addon.
Admin Addons were invented in version 1.5 and add new features and new menus / submenus to the Admin area. They have to be assigned to "workspaces" in predefined places and called by a function. The addon code is included in the location of the workspace, so you can use global variables to overwrite Pixelpost's variables at exactly this moment.\\
Admin Addons were invented in version 1.5. They add new features and new menus / submenus to the Admin area. They have to be assigned to "workspaces" in predefined places and called by a function. The addon code is included in the location of the workspace, so you can use global variables to overwrite Pixelpost's variables at exactly this moment.\\
Front Addons can add extended functions within the Pixelpost code and make use of variables and functions in the moment they are called.
Front Addons can add extended functions within the Pixelpost code and can perform actions exactly in the moment they are called.
See a list of all available workspaces below.
Naming convention: front_addonname.php
Naming convention: front_addonname.php
For all these Addons you have to follow a few rules right in the beginning:
Since version 1.7 there are three types of Addons and you must know the difference between them to make use of the whole Addons functionality.
Normal Addons add new features to the visitor's side of the blog. They can create their own template tags which show new values on the pages. These Addons are called in the index.php in the pixelpost root directory, so their functions are available in all public pages.
Normal Addons cannot make use of any existing template tags, but can call functions and variables. If you want to realize a different behaviour of Pixelpost, you usually have to rewrite the functions to your needs.
Naming convention: addonname.php
Admin Addons were invented in version 1.5 and add new features and new menus / submenus to the Admin area. They have to be assigned to "workspaces" in predefined places and called by a function. The addon code is included in the location of the workspace, so you can use global variables to overwrite Pixelpost's variables at exactly this moment.
See a list of all available workspaces below.
Naming convention: admin_addonname.php
Front Addons are new in version 1.7. They behave similiar to the Admin Addons but their workspaces are defined within the front pages code. The code is again included when the workspace is parsed.
Front Addons can add extended functions within the Pixelpost code and make use of variables and functions in the moment they are called.
Naming convention: front_addonname.php
Creating Addons is not difficult at all but you should be familiar to PHP and the Pixelpost core code. Please bear in mind that if you use Pixelpost's own variables they will be overwritten by your Addon.
Tip: While testing your addon add ?errors to the address string in the URL field of your browser to show errors or change line 46 of index.php "error_reporting(0);" to "error_reporting(E_ALL ^ E_NOTICE);".