Spade

Mini Shell

Directory:~$ /home/lmsyaran/www/khsh/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/www/khsh/vote.zip

PK�{�[�nO���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 */
$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" itemscope
itemtype="https://schema.org/Product">
        <span itemprop="name"><?php echo $row->title;
?></span>
        <p class="visually-hidden"
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>
        <?php if ($this->params->get('show_total_votes',
0)) : ?>
            <?php echo Text::sprintf('PLG_VOTE_TOTAL_VOTES',
$rcount); ?>
        <?php endif; ?>
    </div>
    <?php endif; ?>
    <ul>
        <?php echo $img; ?>
    </ul>
</div>
PK�{�[�06OO
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�{�[��`�jjvote.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
 */

defined('_JEXEC') or die;

/**
 * Vote plugin.
 *
 * @since  1.5
 */
class PlgContentVote extends JPlugin
{
	/**
	 * Application object
	 *
	 * @var    JApplicationCms
	 * @since  3.7.0
	 */
	protected $app;

	/**
	 * The position the voting data is displayed in relative to the article.
	 *
	 * @var    string
	 * @since  3.7.0
	 */
	protected $votingPosition;

	/**
	 * Constructor.
	 *
	 * @param   object  &$subject  The object to observe
	 * @param   array   $config    An optional associative array of
configuration settings.
	 *
	 * @since   3.7.0
	 */
	public function __construct(&$subject, $config)
	{
		parent::__construct($subject, $config);

		$this->votingPosition = $this->params->get('position',
'top');
	}

	/**
	 * Displays the voting area when viewing an article and the voting section
is displayed before the article
	 *
	 * @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|boolean  HTML string containing code for the votes if
in com_content else boolean false
	 *
	 * @since   1.6
	 */
	public function onContentBeforeDisplay($context, &$row, &$params,
$page = 0)
	{
		if ($this->votingPosition !== 'top')
		{
			return '';
		}

		return $this->displayVotingData($context, $row, $params, $page);
	}

	/**
	 * Displays the voting area when viewing an article and the voting section
is displayed after the article
	 *
	 * @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|boolean  HTML string containing code for the votes if
in com_content else boolean false
	 *
	 * @since   3.7.0
	 */
	public function onContentAfterDisplay($context, &$row, &$params,
$page = 0)
	{
		if ($this->votingPosition !== 'bottom')
		{
			return '';
		}

		return $this->displayVotingData($context, $row, $params, $page);
	}

	/**
	 * 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|boolean  HTML string containing code for the votes if
in com_content else boolean false
	 *
	 * @since   3.7.0
	 */
	private function displayVotingData($context, &$row, &$params,
$page)
	{
		$parts = explode('.', $context);

		if ($parts[0] !== 'com_content')
		{
			return false;
		}

		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 = JPluginHelper::getLayoutPath('content',
'vote', 'rating');

		// Render the layout
		ob_start();
		include $path;
		$html = ob_get_clean();

		if ($this->app->input->getString('view', '')
=== 'article' && $row->state == 1)
		{
			// Get the path for the voting form layout file
			$path = JPluginHelper::getLayoutPath('content',
'vote', 'vote');

			// Render the layout
			ob_start();
			include $path;
			$html .= ob_get_clean();
		}

		return $html;
	}
}
PK�{�[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攌[]6���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\Event\DispatcherInterface;
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(
                    $container->get(DispatcherInterface::class),
                    (array) PluginHelper::getPlugin('content',
'vote')
                );
                $plugin->setApplication(Factory::getApplication());

                return $plugin;
            }
        );
    }
};
PK攌[�;�NNsrc/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\Plugin\CMSPlugin;
use Joomla\CMS\Plugin\PluginHelper;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Vote plugin.
 *
 * @since  1.5
 */
final class Vote extends CMSPlugin
{
    /**
     * @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;

    /**
     * Displays the voting area when viewing an article and the voting
section is displayed before the article
     *
     * @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|boolean  HTML string containing code for the votes
if in com_content else boolean false
     *
     * @since   1.6
     */
    public function onContentBeforeDisplay($context, &$row,
&$params, $page = 0)
    {
        if ($this->params->get('position', 'top')
!== 'top') {
            return '';
        }

        return $this->displayVotingData($context, $row, $params, $page);
    }

    /**
     * Displays the voting area when viewing an article and the voting
section is displayed after the article
     *
     * @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|boolean  HTML string containing code for the votes
if in com_content else boolean false
     *
     * @since   3.7.0
     */
    public function onContentAfterDisplay($context, &$row,
&$params, $page = 0)
    {
        if ($this->params->get('position', 'top')
!== 'bottom') {
            return '';
        }

        return $this->displayVotingData($context, $row, $params, $page);
    }

    /**
     * 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;
    }
}
PK�{�[�nO���tmpl/rating.phpnu�[���PK�{�[�06OO
�tmpl/vote.phpnu�[���PK�{�[��`�jjNvote.phpnu�[���PK�{�[oGJ����"vote.xmlnu�[���PK攌[]6����(services/provider.phpnu�[���PK攌[�;�NN4.src/Extension/Vote.phpnu�[���PK��=