first commit
This commit is contained in:
7
Readme.md
Normal file
7
Readme.md
Normal 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
34
shortcode.php
Normal 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"> ⇗ OctoPart.com</a>', $article->text);
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
18
shortcode.xml
Normal file
18
shortcode.xml
Normal 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>
|
Reference in New Issue
Block a user