Last active
January 20, 2017 09:32
-
-
Save ryandemmer/d34bd48bd7539e87f0d262f51f6ad0fc to your computer and use it in GitHub Desktop.
OnContentBeforeSave example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PlgContentExample extends JPlugin | |
{ | |
public function onContentBeforeSave($context, $article, $isNew) | |
{ | |
if ($context != 'com_content.form') { | |
return true; | |
} | |
$text = $article->text; | |
// make URL protocol relative | |
$text = preg_replace('#http:\/\/#i', '://', $text); | |
$article->text = $text; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment