Adding a Service Class the update-proof way
-
Hi again,
I have figured out how to add another service by creating another class in the services folder for it.
I named it class-SH_Xing.php and put following code into it:
if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly
// widget class
class SH_Xing extends SH_Social_Service {public function __construct($type, $settings, $key) {
parent::__construct($type, $settings, $key);
$this->service = “Xing”;
$this->imageUrl = $this->imagePath . “xing.png”;
}public function shareButtonUrl($url, $title) {
return “https://www.xing.com/spi/shares/new?url=$url”;
}
}This shares the link to XING.COM perfectly. However I am aware that this will get lost when I upgrade the plug-in. Could you kindly advise how I may add this service in an update-proof way?
THANKS!
-
Unfortunately, there really isn’t an update-proof way to do this.
The WordPress plugin update process delete the whole plugin folder and replaces it with every upgrade.I have added the ability to look for additional icons in the upload folder, but I really can’t extend that to the service code itself, because allowing it to import and run arbitrary code from the uploads folder is a security risk.
I’m happy to add new services to the plugin. As you’ve seen, the actual code for a new service is very straightforward. What actually takes so much time is creating all the icons for the new service, especially as I am not a graphic designer.
I do have support for VK and XING planned in future, when I get a chance to work on the icons. And Whatsapp should be coming in the next update this weekend.
Cheers,
SarahHi Sarah,
thanks for your reply! The official square Xing icon provided by them actually fits in very well with your Simple Icons Set. But yeah I guess all the artistic versions you offer is what makes it more laboursome to implement. Keep up the great work!
Cheers
Paul
- The topic ‘Adding a Service Class the update-proof way’ is closed to new replies.