File manager - Edit - /home/ferretapmx/public_html/vote.zip
Back
PK LV�\oGJ�� � vote.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="content" method="upgrade"> <name>plg_content_vote</name> <author>Joomla! Project</author> <creationDate>2005-11</creationDate> <copyright>(C) 2005 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>3.0.0</version> <description>PLG_VOTE_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\Content\Vote</namespace> <files> <folder plugin="vote">services</folder> <folder>src</folder> <folder>tmpl</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_content_vote.ini</language> <language tag="en-GB">language/en-GB/plg_content_vote.sys.ini</language> </languages> <config> <fields name="params"> <fieldset name="basic"> <field name="position" type="list" label="PLG_VOTE_POSITION_LABEL" default="top" validate="options" > <option value="top">PLG_VOTE_TOP</option> <option value="bottom">PLG_VOTE_BOTTOM</option> </field> <field name="show_total_votes" type="radio" label="PLG_VOTE_TOTAL_VOTES_LABEL" layout="joomla.form.field.radio.switcher" default="0" filter="integer" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> </fieldset> </fields> </config> </extension> PK LV�\�lf� � src/Extension/Vote.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Content.vote * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\Content\Vote\Extension; use Joomla\CMS\Event\Content\AfterDisplayEvent; use Joomla\CMS\Event\Content\BeforeDisplayEvent; use Joomla\CMS\Event\Plugin\System\Schemaorg; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Uri\Uri; use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Vote plugin. * * @since 1.5 */ final class Vote extends CMSPlugin implements SubscriberInterface { /** * @var \Joomla\CMS\Application\CMSApplication * * @since 3.7.0 * * @deprecated 4.4.0 will be removed in 6.0 as it is there only for layout overrides * Use getApplication() instead */ protected $app; /** * Returns an array of events this subscriber will listen to. * * @return array * * @since 5.3.0 */ public static function getSubscribedEvents(): array { return [ 'onContentBeforeDisplay' => 'onContentBeforeDisplay', 'onContentAfterDisplay' => 'onContentAfterDisplay', 'onSchemaBeforeCompileHead' => 'onSchemaBeforeCompileHead', ]; } /** * Displays the voting area when viewing an article and the voting section is displayed before the article. * Add HTML string containing code for the votes if in com_content. * * @param BeforeDisplayEvent $event The event instance. * * @return void * * @since 1.6 */ public function onContentBeforeDisplay(BeforeDisplayEvent $event) { if ($this->params->get('position', 'top') !== 'top') { return; } $event->addResult( $this->displayVotingData($event->getContext(), $event->getItem(), $event->getParams(), $event->getPage()) ); } /** * Displays the voting area when viewing an article and the voting section is displayed after the article. * Add HTML string containing code for the votes if in com_content. * * @param AfterDisplayEvent $event The event instance. * * @return void * * @since 3.7.0 */ public function onContentAfterDisplay(AfterDisplayEvent $event) { if ($this->params->get('position', 'top') !== 'bottom') { return; } $event->addResult( $this->displayVotingData($event->getContext(), $event->getItem(), $event->getParams(), $event->getPage()) ); } /** * Displays the voting area * * @param string $context The context of the content being passed to the plugin * @param object $row The article object * @param object $params The article params * @param integer $page The 'page' number * * @return string HTML string containing code for the votes if in com_content else empty string * * @since 3.7.0 */ private function displayVotingData($context, $row, $params, $page) { $parts = explode('.', $context); if ($parts[0] !== 'com_content') { return ''; } if (empty($params) || !$params->get('show_vote', null)) { return ''; } // Load plugin language files only when needed (ex: they are not needed if show_vote is not active). $this->loadLanguage(); // Get the path for the rating summary layout file $path = PluginHelper::getLayoutPath('content', 'vote', 'rating'); // Render the layout ob_start(); include $path; $html = ob_get_clean(); if ($this->getApplication()->getInput()->getString('view', '') === 'article' && $row->state == 1) { // Get the path for the voting form layout file $path = PluginHelper::getLayoutPath('content', 'vote', 'vote'); // Render the layout ob_start(); include $path; $html .= ob_get_clean(); } return $html; } /** * Create SchemaOrg AggregateRating * * @param Schemaorg\BeforeCompileHeadEvent $event The event instance. * * @return void * * @since 5.2.0 */ public function onSchemaBeforeCompileHead(Schemaorg\BeforeCompileHeadEvent $event): void { $context = $event->getContext(); $schema = $event->getSchema(); $graph = $schema->get('@graph'); $baseId = Uri::root() . '#/schema/'; $schemaId = $baseId . str_replace('.', '/', $context); foreach ($graph as &$entry) { if (!isset($entry['@type']) || !isset($entry['@id'])) { continue; } if ($entry['@id'] !== $schemaId) { continue; } switch ($entry['@type']) { case 'Book': case 'Brand': case 'CreativeWork': case 'Event': case 'Offer': case 'Organization': case 'Place': case 'Product': case 'Recipe': case 'Service': $rating = $this->prepareAggregateRating($context); break; case 'Article': case 'BlogPosting': $rating = $this->prepareProductAggregateRating($context); break; } } if (isset($rating) && $rating) { $graph[] = $rating; $schema->set('@graph', $graph); } } /** * Prepare AggregateRating * * @param string $context * * @return ?string * * @since 5.2.0 */ protected function prepareAggregateRating($context) { [$extension, $view, $id] = explode('.', $context); if ($view === 'article') { $baseId = Uri::root() . '#/schema/'; $schemaId = $baseId . str_replace('.', '/', $context); $component = $this->getApplication()->bootComponent('com_content')->getMVCFactory(); $model = $component->createModel('Article', 'Site'); $article = $model->getItem($id); if ($article->rating_count > 0) { return ['@isPartOf' => ['@id' => $schemaId, 'aggregateRating' => ['@type' => 'AggregateRating','ratingCount' => (string) $article->rating_count,'ratingValue' => (string) $article->rating]]]; } } return false; } /** * Prepare Product AggregateRating * * @param string $context * * @return ?string * * @since 5.2.0 */ protected function prepareProductAggregateRating($context) { [$extension, $view, $id] = explode('.', $context); if ($view === 'article') { $baseId = Uri::root() . '#/schema/'; $schemaId = $baseId . str_replace('.', '/', $context); $component = $this->getApplication()->bootComponent('com_content')->getMVCFactory(); $model = $component->createModel('Article', 'Site'); $article = $model->getItem($id); if ($article->rating_count > 0) { return ['@isPartOf' => ['@id' => $schemaId, '@type' => 'Product', 'name' => $article->title, 'aggregateRating' => ['@type' => 'AggregateRating', 'ratingCount' => (string) $article->rating_count, 'ratingValue' => (string) $article->rating]]]; } } return false; } } PK LV�\�Sʉ� � src/Extension/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK LV�\�Sʉ� � src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK LV�\��U U tmpl/rating.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Content.vote * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Uri\Uri; /** * @var Joomla\CMS\WebAsset\WebAssetManager $wa * @var \Joomla\Plugin\Content\Vote\Extension\Vote $this */ $wa = $this->getApplication()->getDocument()->getWebAssetManager(); $wa->registerAndUseStyle('plg_content_vote', 'plg_content_vote/rating.css'); /** * Layout variables * ----------------- * @var string $context The context of the content being passed to the plugin * @var object &$row The article object * @var object &$params The article params * @var integer $page The 'page' number * @var array $parts The context segments * @var string $path Path to this file */ if ($context === 'com_content.categories') { return; } // Get the icons $iconStar = HTMLHelper::_('image', 'plg_content_vote/vote-star.svg', '', '', true, true); $iconHalfstar = HTMLHelper::_('image', 'plg_content_vote/vote-star-half.svg', '', '', true, true); // If you can't find the icons then skip it if ($iconStar === null || $iconHalfstar === null) { return; } // Get paths to icons $pathStar = JPATH_ROOT . substr($iconStar, strlen(Uri::root(true))); $pathHalfstar = JPATH_ROOT . substr($iconHalfstar, strlen(Uri::root(true))); // Write inline '<svg>' elements $star = file_exists($pathStar) ? file_get_contents($pathStar) : ''; $halfstar = file_exists($pathHalfstar) ? file_get_contents($pathHalfstar) : ''; // Get rating $rating = (float) $row->rating; $rcount = (int) $row->rating_count; // Round to 0.5 $rating = round($rating / 0.5) * 0.5; // Determine number of stars $stars = $rating; $img = ''; for ($i = 0; $i < floor($stars); $i++) { $img .= '<li class="vote-star">' . $star . '</li>'; } if (($stars - floor($stars)) >= 0.5) { $img .= '<li class="vote-star-empty">' . $star . '</li>'; $img .= '<li class="vote-star-half">' . $halfstar . '</li>'; ++$stars; } for ($i = $stars; $i < 5; $i++) { $img .= '<li class="vote-star-empty">' . $star . '</li>'; } ?> <div class="content_rating" role="img" aria-label="<?php echo Text::sprintf('PLG_VOTE_STAR_RATING', $rating); ?>"> <?php if ($rcount) : ?> <div class="visually-hidden"> <p itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"> <?php echo Text::sprintf('PLG_VOTE_USER_RATING', '<span itemprop="ratingValue">' . $rating . '</span>', '<span itemprop="bestRating">5</span>'); ?> <meta itemprop="ratingCount" content="<?php echo $rcount; ?>"> <meta itemprop="worstRating" content="1"> </p> </div> <?php if ($this->params->get('show_total_votes', 0)) : ?> <?php echo Text::sprintf('PLG_VOTE_TOTAL_VOTES', $rcount); ?> <?php endif; ?> <?php endif; ?> <ul> <?php echo $img; ?> </ul> </div> PK LV�\�06O O tmpl/vote.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Content.vote * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Uri\Uri; /** * Layout variables * ----------------- * @var string $context The context of the content being passed to the plugin * @var object &$row The article object * @var object &$params The article params * @var integer $page The 'page' number * @var array $parts The context segments * @var string $path Path to this file */ $uri = clone Uri::getInstance(); // Create option list for voting select box $options = []; for ($i = 1; $i < 6; $i++) { $options[] = HTMLHelper::_('select.option', $i, Text::sprintf('PLG_VOTE_VOTE', $i)); } ?> <form method="post" action="<?php echo htmlspecialchars($uri->toString(), ENT_COMPAT, 'UTF-8'); ?>" class="form-inline mb-2"> <span class="content_vote"> <label class="visually-hidden" for="content_vote_<?php echo (int) $row->id; ?>"><?php echo Text::_('PLG_VOTE_LABEL'); ?></label> <?php echo HTMLHelper::_('select.genericlist', $options, 'user_rating', 'class="form-select form-select-sm w-auto"', 'value', 'text', '5', 'content_vote_' . (int) $row->id); ?> <input class="btn btn-sm btn-primary align-baseline" type="submit" name="submit_vote" value="<?php echo Text::_('PLG_VOTE_RATE'); ?>"> <input type="hidden" name="task" value="article.vote"> <input type="hidden" name="hitcount" value="0"> <input type="hidden" name="url" value="<?php echo htmlspecialchars($uri->toString(), ENT_COMPAT, 'UTF-8'); ?>"> <?php echo HTMLHelper::_('form.token'); ?> </span> </form> PK LV�\�Sʉ� � tmpl/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK LV�\`7�k� � services/provider.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Content.vote * * @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ \defined('_JEXEC') or die; use Joomla\CMS\Extension\PluginInterface; use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Plugin\Content\Vote\Extension\Vote; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.4.0 */ public function register(Container $container): void { $container->set( PluginInterface::class, function (Container $container) { $plugin = new Vote( (array) PluginHelper::getPlugin('content', 'vote') ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } }; PK LV�\�Sʉ� � services/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK LV�\�Sʉ� � .htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK LV�\oGJ�� � vote.xmlnu �[��� PK LV�\�lf� � src/Extension/Vote.phpnu �[��� PK LV�\�Sʉ� � �$ src/Extension/.htaccessnu �7��m PK LV�\�Sʉ� � &