How to create an Extension in Plesk

Extensions are to Plesk what Plugins are to WordPress. They allow developers to add functionality to the Plesk Panel via PHP, make CSS and JavaScript tweaks and allow a very fine grained amount of customisations.

Creating modifications in isolated files instead of hacking Plesk core files also assures that upgrades won’t overwrite any changes you’ve made (much like the Child Theme philosophy in WordPress).

Here’s a quick how-to guide on writing your first extension.

Uploading an existing Extension

Extensions come into Plesk as a ZIP file which you upload under Server Management – Extensions (in the left hand sidebar):

Packaging an extension

To package your extension for installation in Plesk you can use the –pack option. This will create a handy ZIP file in the folder you’re currently in. Alternatively specify a path using the –destination option:

1

extension--pack myextension--destination/your/folder/here

Now you can distribute your file. Install it via the web interface under Extensions – Add Extension.

Example: Here’s a quick CSS tweak

Just to show you how powerful extensions can be, let’s add some CSS to the default Plesk styling. I’m going to make the big notifications box disappear that we see on the Admin Home Page:

Sometimes you just don’t want to see another Parallels advert…

With a quick inspection we can see the CSS class applied to the entire blue box. To suppress its output we can do this:

1

2

3

4

5

6

@charset"UTF-8";

/* CSS Document */

.p-box.home-promo-block{

display:none;

}

To add our own “child style sheet” we need to create a file called global.css in this directory:

/usr/local/psa/admin/htdocs/modules/myextension/

An index.php file should already be present here whose content will be displayed if a user clicks on your extension link (under Server Management – Extensions). With the additional CSS our big blue box is gone as long as our Extension stays active. The box comes back when our Extension is removed.

If you’d like to change the values of your Extension, such as title and description, edit the .xml file in /usr/local/psa/admin/plib/modules/myextension/meta.xml.

Box be gone. Zen at large.

More Information and Live Demo

Andy Kugaevskiy and I will do a demonstration on the best practices of working with the SDK at Parallels Summit in New Orleans this year. We’ll show you in detail how extensions can work for you. Join us if you can!

In the meantime checkout the marvellous documentation the team have put together at http://ext.plesk.com. And please keep in mind that these are very new features that will be expanded over the next few months.

Share this:

Related

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.