Skip to content

Commit

Permalink
Update plugins
Browse files Browse the repository at this point in the history
Update plugins and readme files.
Removed Zoo plugin. Zoo have his own commenting system.
  • Loading branch information
Globulopolis committed May 22, 2024
1 parent c344807 commit 5ca1ddf
Show file tree
Hide file tree
Showing 12 changed files with 576 additions and 1 deletion.
25 changes: 25 additions & 0 deletions FOR_DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [How to delete all comments of the object](#how-to-delete-all-comments-of-the-object)
- [How to delete all comments of the given component](#how-to-delete-all-comments-of-the-given-component)
- [Extra! For FW Gallery users](#for-fw-gallery-users)
- [Extra! For VirtueMart users](#for-virtuemart-users)

### Introduction

Expand Down Expand Up @@ -236,3 +237,27 @@ and add after `}`
</div>
<?php
```

### For VirtueMart users

Copy file `components/com_virtuemart/views/productdetails/tmpl/default.php` to `templates/YOUR_TEMPATE/html/com_virtuemart/productdetails/default.php` where `YOUR_TEMPATE` is currently used template.

Open copied file and search:

```
<?php // onContentAfterDisplay event
echo $this->product->event->afterDisplayContent;
```

and add after:

```php
$comments = JPATH_ROOT . '/components/com_jcomments/jcomments.php';

if (file_exists($comments)) {
require_once $comments;
echo JComments::show($this->product->virtuemart_product_id, 'com_virtuemart', $this->product->product_name);
}
```

Replace `echo $this->loadTemplate('reviews');` by the `//echo $this->loadTemplate('reviews');` to disable builtin VitrueMart reviews system.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Download <a href="https://github.com/exstreme/Jcomments-4/releases/latest" targe

Joomla 4.2+

Joomla 5.0+ with `Behaviour - Backward Compatibility` plugin enabled.
Joomla 5.0+

## Migration from Jcomments 3
- Make backup
Expand All @@ -29,6 +29,12 @@ Available modules can be downloaded <a href="https://github.com/exstreme/Jcommen

Available plugins can be downloaded <a href="https://github.com/exstreme/Jcomments-4/tree/master/build/plugins" target="_blank">here</a>.

## Integrations

The JComments has integrations with other components. See the full list in the folder https://github.com/exstreme/Jcomments-4/tree/master/component/site/plugins

**NOTE!** For _**FW Gallery**_ and _**VirtueMart**_ integration see `Extra section` at https://github.com/exstreme/Jcomments-4/blob/master/FOR_DEVELOPERS.md

## FAQ

* Does this component support hCaptcha plugin?
Expand Down
47 changes: 47 additions & 0 deletions component/site/plugins/com_mtree.plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* JComments plugin for Mosets tree (https://www.mosets.com/) support
*
* @version 4.0
* @package JComments
* @copyright (C) 2006-2016 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @copyright (C) 2016 exstreme (https://protectyoursite.ru) & Vladimir Globulopolis (https://xn--80aeqbhthr9b.com/ru/)
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/

use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Database\ParameterType;

defined('_JEXEC') or die;

class jc_com_mtree extends JCommentsPlugin
{
public function getObjectInfo($id, $language = null)
{
/** @var \Joomla\Database\DatabaseInterface $db */
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);

$query->select($db->quoteName(array('link_id', 'link_name', 'user_id')))
->from($db->quoteName('#__mt_links'))
->where($db->quoteName('link_id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);

$row = $db->loadObject();

$info = new JCommentsObjectInfo;

if (!empty($row))
{
$itemid = self::getItemid('com_mtree');
$itemid = $itemid > 0 ? '&Itemid=' . $itemid : '';

$info->title = $row->link_name;
$info->userid = $row->user_id;
$info->link = Route::_('index.php?option=com_mtree&task=viewlink&link_id=' . $id . $itemid);
}

return $info;
}
}
49 changes: 49 additions & 0 deletions component/site/plugins/com_phocadownload.plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* JComments plugin for Phoca Download (https://www.phoca.cz/phocadownload)
*
* @version 4.0
* @package JComments
* @copyright (C) 2006-2016 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @copyright (C) 2016 exstreme (https://protectyoursite.ru) & Vladimir Globulopolis (https://xn--80aeqbhthr9b.com/ru/)
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Database\ParameterType;

class jc_com_phocadownload extends JCommentsPlugin
{
public function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo;

/** @var \Joomla\Database\DatabaseInterface $db */
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);

$query->select($db->quoteName(array('id', 'title', 'access')))
->select('CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug')
->from($db->quoteName('#__phocadownload_categories'))
->where($db->quoteName('id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);

$db->setQuery($query);
$row = $db->loadObject();

if (!empty($row))
{
$itemid = self::getItemid('com_phocadownload');
$itemid = $itemid > 0 ? '&Itemid=' . $itemid : '';

$info->title = $row->title;
$info->access = $row->access;
$info->link = Route::_('index.php?option=com_phocadownload&view=category&id=' . $row->slug . $itemid);
}

return $info;
}
}
51 changes: 51 additions & 0 deletions component/site/plugins/com_phocadownload_files.plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* JComments plugin for Phoca Download (https://www.phoca.cz/phocadownload)
*
* @version 4.0
* @package JComments
* @copyright (C) 2006-2016 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @copyright (C) 2016 exstreme (https://protectyoursite.ru) & Vladimir Globulopolis (https://xn--80aeqbhthr9b.com/ru/)
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Database\ParameterType;

class jc_com_phocadownload_files extends JCommentsPlugin
{
public function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo;

/** @var \Joomla\Database\DatabaseInterface $db */
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);

$query->select($db->quoteName(array('a.id', 'a.title', 'a.access')))
->select('CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug')
->select('CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug')
->from($db->quoteName('#__phocadownload', 'a'))
->join('LEFT', $db->quoteName('#__phocadownload_categories', 'c'), 'c.id = a.catid')
->where($db->quoteName('a.id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);

$db->setQuery($query);
$row = $db->loadObject();

if (!empty($row))
{
$itemid = self::getItemid('com_phocadownload');
$itemid = $itemid > 0 ? '&Itemid=' . $itemid : '';

$info->title = $row->title;
$info->access = $row->access;
$info->link = Route::_('index.php?option=com_phocadownload&view=file&catid=' . $row->catslug . '&id=' . $row->slug . $itemid);
}

return $info;
}
}
50 changes: 50 additions & 0 deletions component/site/plugins/com_phocagallery.plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* JComments plugin for Phoca Gallery (https://www.phoca.cz/phocagallery)
*
* @version 4.0
* @package JComments
* @copyright (C) 2006-2016 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @copyright (C) 2016 exstreme (https://protectyoursite.ru) & Vladimir Globulopolis (https://xn--80aeqbhthr9b.com/ru/)
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Database\ParameterType;

class jc_com_phocagallery extends JCommentsPlugin
{
public function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo;

/** @var \Joomla\Database\DatabaseInterface $db */
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);

$query->select($db->quoteName(array('id', 'title', 'owner_id')))
->select('CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug')
->from($db->quoteName('#__phocagallery_categories'))
->where($db->quoteName('id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);

$db->setQuery($query);
$row = $db->loadObject();

if (!empty($row))
{
$itemid = self::getItemid('com_phocagallery');
$itemid = $itemid > 0 ? '&Itemid=' . $itemid : '';

$info->title = $row->title;
$info->access = 0;
$info->userid = $row->owner_id;
$info->link = Route::_('index.php?option=com_phocagallery&view=category&id=' . $row->slug . $itemid);
}

return $info;
}
}
56 changes: 56 additions & 0 deletions component/site/plugins/com_phocagallery_images.plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* JComments plugin for Phoca Gallery (https://www.phoca.cz/phocagallery)
*
* @version 4.0
* @package JComments
* @copyright (C) 2006-2016 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @copyright (C) 2016 exstreme (https://protectyoursite.ru) & Vladimir Globulopolis (https://xn--80aeqbhthr9b.com/ru/)
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Database\ParameterType;

class jc_com_phocagallery_images extends JCommentsPlugin
{
public function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo;

/** @var \Joomla\Database\DatabaseInterface $db */
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);

$query->select($db->quoteName(array('a.id', 'a.title')))
->select('CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug')
->select('CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug')
->from($db->quoteName('#__phocagallery', 'a'))
->join('LEFT', $db->quoteName('#__phocagallery_categories', 'c'), 'c.id = a.catid')
->where($db->quoteName('a.id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);

$db->setQuery($query);
$row = $db->loadObject();

if (!empty($row))
{
$itemid = self::getItemid('com_phocagallery');
$itemid = $itemid > 0 ? '&Itemid=' . $itemid : '';

$info->title = $row->title;
$info->access = 0;
$info->userid = $row->owner_id;

// Comment is displayed in popup window so we must create link to category view
// Because of possible pagination only this one image will be displayed not all

$info->link = Route::_('index.php?option=com_phocagallery&view=category&id=' . $row->catslug . '&cimgid=' . $row->slug . $itemid);
}

return $info;
}
}
50 changes: 50 additions & 0 deletions component/site/plugins/com_rseventspro.plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* JComments plugin for RSEvents!PRO (https://www.rsjoomla.com/joomla-extensions/joomla-events.html) objects support
*
* @version 4.0
* @package JComments
* @author Webcanyon (www.webcanyon.be) - based on work of Oregon
* @copyright (C) 2014 by Webcanyon
* @copyright (C) 2006-2016 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @copyright (C) 2016 exstreme (https://protectyoursite.ru) & Vladimir Globulopolis (https://xn--80aeqbhthr9b.com/ru/)
* @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\Database\ParameterType;

class jc_com_rseventspro extends JCommentsPlugin
{
public function getObjectInfo($id, $language = null)
{
/** @var \Joomla\Database\DatabaseInterface $db */
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);

$query->select($db->quoteName(array('id', 'name', 'owner')))
->from($db->quoteName('#__rseventspro_events'))
->where($db->quoteName('id') . ' = :id')
->bind(':id', $id, ParameterType::INTEGER);

$db->setQuery($query);
$row = $db->loadObject();

$info = new JCommentsObjectInfo;

if (!empty($row))
{
$itemid = self::getItemid('com_rseventspro');
$itemid = $itemid > 0 ? '&Itemid=' . $itemid : '';

$info->title = $row->name;
$info->userid = $row->owner;
$info->link = Route::_('index.php?option=com_rseventspro&view=rseventspro&layout=show&id=' . $row->id . $itemid);
}

return $info;
}
}
Loading

0 comments on commit 5ca1ddf

Please sign in to comment.