Bonjour,
j'essaie de créer un mini plugin permettant l'ajout d'un bouton supplémentaire dans l'éditeur de Joomla 3.4
likebutton.xml
likebutton.php
en-GB.plg_editors-xtd_likebutton.ini
en-GB.plg_editors-xtd_likebutton.sys.ini
fr-FR.plg_editors-xtd_likebutton.ini
fr-FR.plg_editors-xtd_likebutton.sys.ini
edit : Le plugin fonctionne!
Merci pour votre aide !
j'essaie de créer un mini plugin permettant l'ajout d'un bouton supplémentaire dans l'éditeur de Joomla 3.4
likebutton.xml
Code PHP:
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="editors-xtd" method="upgrade">
<name>plg_editors-xtd_likebutton</name>
<creationDate>03/03/2015</creationDate>
<author>djphil</author>
<copyright>Copyright 2015 Digital Concepts All rights reserved!</copyright>
<authorEmail></authorEmail>
<authorUrl></authorUrl>
<license></license>
<version>0.0.1</version>
<description>PLG_EDITORS-XTD_LIKEBUTTON_XML_DESCRIPTION</description>
<files>
<filename plugin="likebutton">likebutton.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_editors-xtd_likebutton.ini</language>
<language tag="en-GB">en-GB.plg_editors-xtd_likebutton.sys.ini</language>
<language tag="fr-FR">fr-FR.plg_editors-xtd_likebutton.ini</language>
<language tag="fr-FR">fr-FR.plg_editors-xtd_likebutton.sys.ini</language>
</languages>
<config />
</extension>
Code PHP:
<?php
/**
* Like Button - Joomla Editor System
*
* @version 0.0.1
* @package Like Button
* @author djphil
* @copyright (C) 2015 Digital Concepts
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
/**
* Provides button to insert {like} into content edit box
*/
class plgButtonLikebutton extends JPlugin
{
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage('plg_editors-xtd_likebutton', JPATH_ADMINISTRATOR);
}
function onDisplay($name)
{
$getContent = $this->_subject->getContent($name);
$js = "
function insertLikebutton(editor) {
var content = $getContent
if (content.match(/{like}/)) {
return false;
} else {
jInsertEditorText('{like}', editor);
}
}
";
$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
$button = new JObject();
$button->set('class', 'btn');
$button->set('modal', false);
$button->set('onclick', 'insertLikebutton(\'' . $name . '\');return false;');
$button->set('text', JText::_('PLG_EDITORS-XTD_LIKEBUTTON_BUTTON_LIKEBUTTON'));
$button->set('name', 'thumbs-up');
$button->set('link', '#');
return $button;
}
}
Code PHP:
; Like Button - Joomla Editor Plugin System
; Copyright (C) 2015 Digital Concepts. All rights reserved.
; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
PLG_EDITORS-XTD_LIKEBUTTON="Button - Like button"
PLG_EDITORS-XTD_LIKEBUTTON_BUTTON_LIKEBUTTON="Like"
PLG_EDITORS-XTD_LIKEBUTTON_XML_DESCRIPTION="Provides a button for easy insertion of the {like} tag into articles."
Code PHP:
; Like Button - Joomla Editor Plugin System
; Copyright (C) 2015 Digital Concepts. All rights reserved.
; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
PLG_EDITORS-XTD_LIKEBUTTON="Button - Like button"
PLG_EDITORS-XTD_LIKEBUTTON_XML_DESCRIPTION="Provides a button for easy insertion of the {like} tag into articles."
Code PHP:
; Like Button - Joomla Editor Plugin System
; Copyright (C) 2015 Digital Concepts. All rights reserved.
; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
PLG_EDITORS-XTD_LIKEBUTTON="Button - Like boutton"
PLG_EDITORS-XTD_LIKEBUTTON_BUTTON_LIKEBUTTON="Like"
PLG_EDITORS-XTD_LIKEBUTTON_XML_DESCRIPTION="Fournit un bouton pour faciliter l'insertion de la balise {like} dans les articles."
Code PHP:
; Like Button - Joomla Editor Plugin System
; Copyright (C) 2015 Digital Concepts. All rights reserved.
; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
PLG_EDITORS-XTD_LIKEBUTTON="Button - Like boutton"
PLG_EDITORS-XTD_LIKEBUTTON_XML_DESCRIPTION="Fournit un bouton pour faciliter l'insertion de la balise {like} dans les articles."
Merci pour votre aide !
Commentaire