first commit

This commit is contained in:
2017-08-14 15:09:47 +00:00
commit ecf16d4ba3
3 changed files with 59 additions and 0 deletions

7
Readme.md Normal file
View File

@@ -0,0 +1,7 @@
# Usage
This is a content plugin, to add working shortcodes use syntax as follows in the example:
`... part RD 10 [[::rd10::]] ... ` which will generate `... part RD 10 ⇗ OctoPart.com ...` (url to OctoPart.com)

34
shortcode.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
defined('_JEXEC') or die;
class PlgContentShortcode extends JPlugin {
protected $autoloadLanguage = true;
function onContentPrepare ($context, $article, $params, $limitstart )
{
$article->text = str_replace('[[::', '<a href="https://octopart.com/search?q=', $article->text);
$article->text = str_replace('::]]','" target="_blank"> &neArr; OctoPart.com</a>', $article->text);
return true;
}
}
?>

18
shortcode.xml Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content" method="upgrade">
<name>Shortcodes for OctoPart.com</name>
<author>Greg</author>
<creationDate>August 2017</creationDate>
<copyright>No copyrights, I don't care</copyright>
<license>MIT</license>
<authorEmail>no@no.nom</authorEmail>
<authorUrl>github.com/phm3g</authorUrl>
<version>1.0</version>
<description>Shortcodes for OctoPart.com, usage: [[::partName::]]</description>
<files>
<filename plugin="shortcode">shortcode.php</filename>
<filename>index.html</filename>
</files>
<config>
</config>
</extension>